@sonordev/site-kit 7.0.1 → 7.1.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 +3606 -0
- package/README.md +12 -13
- package/agent-manifest.json +11 -5
- package/dist/{AnalyticsProvider-EMM2TKRE.js → AnalyticsProvider-ZMQUV33M.js} +4 -4
- package/dist/{ArticleViewTracker-RA64BGL6.js → ArticleViewTracker-V7NUXYBY.js} +3 -3
- package/dist/{BlocksPopup-D25RFNOV.js → BlocksPopup-52EU7OUY.js} +4 -4
- package/dist/{ChatWidget-RYI7BMJJ.js → ChatWidget-5BHMNR57.js} +5 -5
- package/dist/{EngageWidget-UKFCN33M.js → EngageWidget-PCGLX7SO.js} +4 -4
- package/dist/{FileField-MUHA7LZR.js → FileField-TSFGNAMY.js} +3 -3
- package/dist/{FormSpotlight-TCLPWPLL.js → FormSpotlight-XLBWEOTE.js} +1 -1
- package/dist/{FormStage-CNYLP6I6.js → FormStage-IJQ5Q2X6.js} +1 -1
- package/dist/{ManagedForm-7ZL5SKTO.js → ManagedForm-Z3PKOPIZ.js} +6 -6
- package/dist/{ManagedNewsletterForm-33B4JLX7.js → ManagedNewsletterForm-QAO3POLC.js} +4 -4
- package/dist/{SignalCore-L5FVDHFE.js → SignalCore-RBA3VDBL.js} +3 -3
- package/dist/{SiteDesignReporter-4JOFL4FP.js → SiteDesignReporter-C4LR5X2V.js} +5 -5
- package/dist/SitemapSync-XVMGKCF3.js +8 -0
- package/dist/_client/booking-widget.js +5 -5
- package/dist/affiliates/index.js +3 -3
- package/dist/analytics/index.js +4 -4
- package/dist/articles/index.js +1 -1
- package/dist/articles/server-ui.js +1 -1
- package/dist/chat/index.js +5 -5
- package/dist/{chunk-FYBZ5SNP.js → chunk-3G2SE2J4.js} +1 -1
- package/dist/{chunk-HGCK465A.js → chunk-3J2ERO3I.js} +1 -1
- package/dist/{chunk-KXPBMCFL.js → chunk-3QI26673.js} +3 -1
- package/dist/{chunk-BMO3VGMR.js → chunk-3XPJKZ6D.js} +30 -7
- package/dist/{chunk-QGHSMJKW.js → chunk-4JQQDCMO.js} +1 -1
- package/dist/{chunk-6HDT4G4A.js → chunk-4YTYGG2C.js} +2 -2
- package/dist/{chunk-N2UVOR3X.js → chunk-662ILEZ6.js} +2 -0
- package/dist/chunk-6G43IRWR.js +4 -0
- package/dist/{chunk-LVESVYCE.js → chunk-7MHHWZKC.js} +11 -117
- package/dist/{chunk-MV2MBTC3.js → chunk-7QTMMHUO.js} +1 -1
- package/dist/{chunk-KPAZG65P.js → chunk-CGWUXUYZ.js} +138 -46
- package/dist/{chunk-4IQ52CXL.js → chunk-DUAO4Q75.js} +2 -2
- package/dist/{chunk-4RMVXRBO.js → chunk-EIULXXUJ.js} +3 -3
- package/dist/{chunk-3KUUH2YP.js → chunk-EVFZ7KEW.js} +1 -1
- package/dist/{chunk-OFOAHPUV.js → chunk-F42R35NV.js} +1 -1
- package/dist/{chunk-QANVUXKH.js → chunk-FLR3EMK6.js} +1 -1
- package/dist/{chunk-P4GRY6QP.js → chunk-GIAOPEN6.js} +1 -1
- package/dist/{chunk-P5J7VMQ3.js → chunk-GWUKQ26F.js} +1 -1
- package/dist/{chunk-TT63HHIT.js → chunk-HAG4YIZY.js} +1 -1
- package/dist/{chunk-QZZIKMAT.js → chunk-HVH37YPX.js} +1 -1
- package/dist/{chunk-SSUQKA7L.js → chunk-J4D6ZXRW.js} +1 -1
- package/dist/{chunk-GYESATRY.js → chunk-L2DJD5Y4.js} +1 -1
- package/dist/{chunk-WATH55UY.js → chunk-LFXVE32I.js} +1 -1
- package/dist/chunk-LPH5FANE.js +169 -0
- package/dist/{chunk-V6LSQRTH.js → chunk-PLUP2KN5.js} +1 -1
- package/dist/chunk-RYVDGXC2.js +19 -0
- package/dist/{chunk-EGOD74PP.js → chunk-U35H2JIQ.js} +2 -2
- package/dist/chunk-VCJYLYJV.js +49 -0
- package/dist/{chunk-FL4EPUWA.js → chunk-W2CL2DB3.js} +2 -2
- package/dist/{chunk-UZN4ZYR2.js → chunk-XD3ZQET6.js} +1 -1
- package/dist/{chunk-CVTVNC2U.js → chunk-XNVSCQ2O.js} +2 -2
- package/dist/{chunk-T3MC4HOD.js → chunk-YLSEB32F.js} +1 -1
- package/dist/chunk-ZETJTCMV.js +118 -0
- package/dist/{chunk-5SEM2V4A.js → chunk-ZIMFQWGJ.js} +3 -3
- package/dist/client/index.js +3 -3
- package/dist/cms/CmsPage.d.ts +1 -0
- package/dist/cms/CmsPreview.d.ts +1 -0
- package/dist/cms/CmsSection.d.ts +1 -0
- package/dist/cms/index.d.ts +6 -0
- package/dist/cms/server-api.d.ts +3 -0
- package/dist/commerce/index.js +4 -4
- package/dist/config/index.js +1 -1
- package/dist/contracts/entries.d.ts +1 -1
- package/dist/contracts/site-cache.d.ts +55 -0
- package/dist/contracts/site-edit-param.d.ts +7 -0
- package/dist/contracts/site-edit.d.ts +77 -0
- package/dist/contracts/slot-content.d.ts +111 -0
- package/dist/contracts/slots.d.ts +39 -25
- package/dist/engage/index.js +6 -6
- package/dist/fleet/index.js +4 -4
- package/dist/forms/index.js +8 -8
- package/dist/forms/server.js +2 -2
- package/dist/forms/types.d.ts +3 -1
- package/dist/images/index.js +4 -4
- package/dist/index.js +1 -1
- package/dist/layout/client.js +8 -7
- package/dist/layout/index.js +9 -8
- package/dist/llms/index.js +4 -2
- package/dist/llms/seo-revalidate.d.ts +8 -1
- package/dist/maps/index.js +3 -3
- package/dist/mcp/sonor.js +6 -6
- package/dist/overlay-RXV6U6QC.js +353 -0
- package/dist/proxy/index.js +2 -2
- package/dist/proxy/securityHeaders.d.ts +4 -0
- package/dist/revalidate/index.d.ts +44 -0
- package/dist/revalidate/index.js +27 -0
- package/dist/seo/ManagedContent.d.ts +2 -0
- package/dist/seo/client.js +4 -4
- package/dist/seo/index.js +9 -8
- package/dist/seo/llms.js +4 -2
- package/dist/seo/register-sitemap-cli.js +1 -1
- package/dist/seo/server.js +3 -2
- package/dist/seo/sitemap.js +2 -2
- package/dist/server/index.js +2 -2
- package/dist/{server-api-GJJQZVG7.js → server-api-BVCBLJKL.js} +2 -1
- package/dist/shared/build-entries.d.ts +1 -0
- package/dist/shared/edit-bridge.d.ts +8 -0
- package/dist/shared/version.d.ts +1 -1
- package/dist/signal/index.js +2 -2
- package/dist/sitemap/index.js +2 -2
- package/dist/slots/ManagedLink.d.ts +31 -0
- package/dist/slots/ManagedList.d.ts +30 -0
- package/dist/slots/ManagedRichText.d.ts +31 -0
- package/dist/slots/contract.js +2 -1
- package/dist/slots/edit/locate.d.ts +30 -0
- package/dist/slots/edit/overlay.d.ts +18 -0
- package/dist/slots/index.d.ts +12 -4
- package/dist/slots/index.js +4 -2
- package/dist/slots/revalidate.d.ts +8 -3
- package/dist/slots/rich.d.ts +7 -0
- package/dist/slots/server-api.d.ts +6 -2
- package/dist/sync/index.js +5 -5
- package/dist/website/images.js +4 -4
- package/dist/website/index.js +5 -5
- package/dist/website/popups.js +4 -4
- package/dist/website/slots/contract.js +2 -1
- package/dist/website/slots.js +4 -2
- package/dist/{writeLLMsTxt-UMHKGNRR.js → writeLLMsTxt-QR23OQUE.js} +1 -1
- package/docs/MIGRATING-TO-7.md +146 -0
- package/docs.json +69 -0
- package/package.json +14 -4
- package/src/admin-auth/README.md +88 -0
- package/src/analytics/README.md +264 -0
- package/src/articles/README.md +325 -0
- package/src/commerce/README.md +109 -0
- package/src/cta-bar/README.md +154 -0
- package/src/engage/README.md +241 -0
- package/src/forms/README.md +219 -0
- package/src/images/README.md +74 -0
- package/src/layout/README.md +66 -0
- package/src/llms/README.md +723 -0
- package/src/mcp/README.md +376 -0
- package/src/motion/README.md +372 -0
- package/src/og/README.md +304 -0
- package/src/proxy/README.md +152 -0
- package/src/redirects/README.md +74 -0
- package/src/reputation/README.md +64 -0
- package/src/revalidate/README.md +82 -0
- package/src/seo/README.md +346 -0
- package/src/signal/README.md +115 -0
- package/src/sitemap/README.md +127 -0
- package/src/slots/README.md +168 -0
- package/src/sync/README.md +115 -0
- package/dist/SitemapSync-7WKY4HXI.js +0 -8
- package/dist/chunk-SS636UDN.js +0 -35
|
@@ -1,120 +1,5 @@
|
|
|
1
1
|
import { secretsMatch, readCappedBody } from './chunk-XTRZGXB2.js';
|
|
2
|
-
import {
|
|
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-4JQQDCMO.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,
|
|
164
|
+
export { LEGACY_PUBLICATION_PATH, SEO_REVALIDATION_MAX_BODY_BYTES, SEO_REVALIDATION_MAX_ITEMS, createLlmsRevalidateHandler, createSeoRevalidationHandler, parseSeoRevalidationPayload };
|
|
@@ -1,16 +1,61 @@
|
|
|
1
|
-
import {
|
|
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: [
|
|
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
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
function
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { GlassStyles } from './chunk-JE4A5S4F.js';
|
|
3
3
|
import { chatLauncherStyles } from './chunk-NDF4A5JM.js';
|
|
4
|
-
import { useForm } from './chunk-
|
|
4
|
+
import { useForm } from './chunk-XD3ZQET6.js';
|
|
5
5
|
import { parseColor, relativeLuminance, DARK_LUMINANCE, contrastRatio } from './chunk-S22FSH7C.js';
|
|
6
|
-
import { sonorFetch } from './chunk-
|
|
6
|
+
import { sonorFetch } from './chunk-U35H2JIQ.js';
|
|
7
7
|
import { useState, useEffect, useRef, useLayoutEffect, useCallback, Fragment as Fragment$1 } from 'react';
|
|
8
8
|
import { lexer } from 'marked';
|
|
9
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { countStageViews, countStageQuestions, useFieldControls } from './chunk-
|
|
2
|
+
import { countStageViews, countStageQuestions, useFieldControls } from './chunk-YLSEB32F.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-
|
|
5
|
+
import { useFormLoadedAt, useFormTracking, submitForm, useRecaptchaWarmup, useForm } from './chunk-XD3ZQET6.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-
|
|
65
|
+
const load = resolvedExperience === "stage" ? import('./FormStage-IJQ5Q2X6.js').then((m) => m.FormStage) : import('./FormSpotlight-XLBWEOTE.js').then((m) => m.FormSpotlight);
|
|
66
66
|
load.then((Component) => {
|
|
67
67
|
if (!cancelled) setExperience(() => Component);
|
|
68
68
|
}).catch((err) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveFetch } from './chunk-VX5CMNMM.js';
|
|
2
2
|
import { monotonicMs } from './chunk-MH2DSGC6.js';
|
|
3
|
-
import { SITE_KIT_VERSION } from './chunk-
|
|
3
|
+
import { SITE_KIT_VERSION } from './chunk-4JQQDCMO.js';
|
|
4
4
|
import 'server-only';
|
|
5
5
|
|
|
6
6
|
var MINT_PATH = "/api/public/site-token";
|
|
@@ -4,7 +4,7 @@ import React, { lazy, useRef, useEffect, useState, Suspense } from 'react';
|
|
|
4
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
var InteractiveForm = lazy(
|
|
7
|
-
() => import('./ManagedForm-
|
|
7
|
+
() => import('./ManagedForm-Z3PKOPIZ.js').then((m) => ({ default: m.ManagedForm }))
|
|
8
8
|
);
|
|
9
9
|
function FormEnhancer({
|
|
10
10
|
formId,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { getSiteDesignTokens, tokensForReport, shouldReportDesign, sendSiteDesign } from './chunk-
|
|
2
|
+
import { getSiteDesignTokens, tokensForReport, shouldReportDesign, sendSiteDesign } from './chunk-W2CL2DB3.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,5 +1,5 @@
|
|
|
1
1
|
import { getSiteConfig } from './chunk-Z22QVHT4.js';
|
|
2
|
-
import { writeLLMsTxtToPublic } from './chunk-
|
|
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';
|
|
@@ -54,7 +54,7 @@ function useSignal() {
|
|
|
54
54
|
return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
55
55
|
}
|
|
56
56
|
var LazySignalCore = dynamic(
|
|
57
|
-
() => import('./SignalCore-
|
|
57
|
+
() => import('./SignalCore-RBA3VDBL.js').then((m) => ({ default: m.SignalCore })),
|
|
58
58
|
{ ssr: false }
|
|
59
59
|
);
|
|
60
60
|
function SignalBridge({
|
|
@@ -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-
|
|
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()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveSiteHost } from './chunk-FESKKJAS.js';
|
|
2
|
-
import { configureSiteCredential, currentCredential } from './chunk-
|
|
2
|
+
import { configureSiteCredential, currentCredential } from './chunk-EVFZ7KEW.js';
|
|
3
3
|
|
|
4
4
|
// src/shared/publishCredential.ts
|
|
5
5
|
function publishSiteCredential({
|
|
@@ -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-
|
|
4
|
+
import { sonorFetch } from './chunk-U35H2JIQ.js';
|
|
5
5
|
import { useRef, useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
var SYNC_STAMP_KEY = "_sk_sitemap_synced_at";
|