@sonordev/site-kit 7.1.2 → 7.3.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/AGENTS.md +1 -1
- package/CHANGELOG.md +60 -0
- package/README.md +9 -8
- package/agent-manifest.json +17 -7
- package/dist/{AnalyticsProvider-ZB33W6MC.js → AnalyticsProvider-DJQA66AG.js} +4 -4
- package/dist/{ArticleViewTracker-GMHYLLLZ.js → ArticleViewTracker-GFOAXFV7.js} +3 -3
- package/dist/{BlocksPopup-EA6LYL25.js → BlocksPopup-AHDU34TL.js} +5 -5
- package/dist/ChatWidget-FHBAHFZX.js +17 -0
- package/dist/{FileField-QKA3JB2Q.js → FileField-J5W5MIAZ.js} +3 -3
- package/dist/{FormSpotlight-AQTIA5TP.js → FormSpotlight-PE5YZBFZ.js} +20 -6
- package/dist/{FormStage-FDTLTP3B.js → FormStage-OOPQC27J.js} +27 -7
- package/dist/ManagedForm-JRZAJ7SZ.js +16 -0
- package/dist/{ManagedNewsletterForm-J6QSAGGP.js → ManagedNewsletterForm-TC5542ZG.js} +7 -5
- package/dist/{SignalCore-JZNXOLNT.js → SignalCore-2YP5FCAS.js} +3 -3
- package/dist/SiteChat-EGEZJJVV.js +5 -0
- package/dist/{SiteDesignReporter-W4EJUSTE.js → SiteDesignReporter-YEEWJKWN.js} +5 -5
- package/dist/SitePopups-LQBIXIFV.js +10 -0
- package/dist/SitemapSync-LSZ2EYOF.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/analytics/send-gate.d.ts +1 -1
- package/dist/articles/index.js +2 -2
- package/dist/articles/server-ui.js +3 -2
- package/dist/articles/server.js +2 -1
- package/dist/{engage → chat}/ChatWidget.d.ts +7 -6
- package/dist/{engage → chat}/EchoUiActions.d.ts +1 -1
- package/dist/chat/SiteChat.d.ts +25 -0
- package/dist/{engage → chat}/brand-color.d.ts +1 -1
- package/dist/{engage → chat}/chat-messages.d.ts +1 -1
- package/dist/{engage → chat}/echo-config.d.ts +1 -1
- package/dist/chat/index.d.ts +10 -6
- package/dist/chat/index.js +14 -8
- package/dist/{engage → chat}/launcher-placement.d.ts +1 -7
- package/dist/{engage → chat}/socket-loader.d.ts +2 -2
- package/dist/chat/types.d.ts +136 -0
- package/dist/chunk-27FISYK4.js +4 -0
- package/dist/{chunk-HF57LG73.js → chunk-2AD3CDRR.js} +43 -29
- package/dist/{chunk-M3YEPKP7.js → chunk-2ECWEUHP.js} +1 -1
- package/dist/{chunk-LUXVWITO.js → chunk-4NTBQNHA.js} +247 -78
- package/dist/{chunk-AH5Q262S.js → chunk-56KNHB4U.js} +1 -1
- package/dist/{chunk-GLHQ3LRO.js → chunk-6U3VLV2C.js} +1 -1
- package/dist/{chunk-3SDOQUUF.js → chunk-BEBR4OJD.js} +2 -2
- package/dist/{chunk-JSZN6LDZ.js → chunk-BF7TZYC3.js} +38 -31
- package/dist/{chunk-AQSNPZY4.js → chunk-C2FZBUSS.js} +80 -1
- package/dist/{chunk-PHYMNUJU.js → chunk-CYUFBKJQ.js} +1 -1
- package/dist/{chunk-6WIQCXOO.js → chunk-DNPNYWVL.js} +1 -1
- package/dist/{chunk-V6FDQLR7.js → chunk-EPT6FJUY.js} +53 -21
- package/dist/chunk-HODO5BX5.js +28 -0
- package/dist/chunk-HW7B43E5.js +14 -0
- package/dist/{chunk-PGMVL4AB.js → chunk-I2YX3HVD.js} +2 -2
- package/dist/{chunk-JTU2GOM4.js → chunk-L7U23XI2.js} +18 -6
- package/dist/{chunk-YEMPUQVU.js → chunk-MKMD2HJW.js} +2 -2
- package/dist/{chunk-Q4W23JYM.js → chunk-MRQ2U4LZ.js} +1 -1
- package/dist/chunk-MVR4FY5R.js +187 -0
- package/dist/{chunk-VGH4MDTU.js → chunk-NI2XNEMR.js} +1 -1
- package/dist/{chunk-4Y5FWDPM.js → chunk-NZ4RXN3G.js} +55 -7
- package/dist/{chunk-RHNWA34F.js → chunk-O5RGXTWU.js} +41 -7
- package/dist/{chunk-TXBAOEKG.js → chunk-PKGN32AU.js} +5 -4
- package/dist/chunk-Q6E4OPGG.js +40 -0
- package/dist/chunk-RDPW4D33.js +45 -0
- package/dist/{chunk-UXOGCKL6.js → chunk-T4DLETKR.js} +1 -1
- package/dist/{chunk-NK4CSJNP.js → chunk-UPRSH6Q4.js} +2 -2
- package/dist/{chunk-ERXXITG4.js → chunk-VF4F5WXZ.js} +1 -1
- package/dist/chunk-VWWITFWM.js +300 -0
- package/dist/{chunk-WWSHFRDL.js → chunk-WDQB4OXY.js} +7 -3
- package/dist/{chunk-VDF5DFWT.js → chunk-WGG6GTKW.js} +1 -1
- package/dist/{chunk-CSTQDNGK.js → chunk-WGIDC6QP.js} +43 -24
- package/dist/{chunk-V3PUVBME.js → chunk-XLSQTTUE.js} +2 -4
- package/dist/{chunk-JBE46QJZ.js → chunk-Y6LP36UW.js} +1 -1
- package/dist/chunk-YJLS6JBI.js +370 -0
- package/dist/{chunk-QEDHRBAT.js → chunk-Z65DHMTW.js} +26 -9
- package/dist/{chunk-ILU5I6RW.js → chunk-ZHS2XFLV.js} +1 -1
- package/dist/{chunk-D5EC5KVO.js → chunk-ZKHI4E2B.js} +2 -2
- package/dist/{chunk-CIG5UL2S.js → chunk-ZTLMPUO6.js} +3 -2
- package/dist/client/index.js +3 -3
- package/dist/commerce/index.js +4 -4
- package/dist/contracts/color.d.ts +1 -1
- package/dist/contracts/entries.d.ts +1 -1
- package/dist/contracts/error-page.d.ts +183 -0
- package/dist/contracts/llms.d.ts +1 -0
- package/dist/contracts/proposal-sitemap.d.ts +130 -0
- package/dist/contracts/schema-placeholders.d.ts +87 -0
- package/dist/engage/EngageWidget.d.ts +13 -12
- package/dist/engage/index.d.ts +10 -9
- package/dist/engage/index.js +31 -35
- package/dist/engage/types.d.ts +19 -244
- package/dist/fleet/FleetHeartbeat.d.ts +1 -1
- package/dist/fleet/index.js +4 -4
- package/dist/forms/FormEnhancer.d.ts +25 -12
- package/dist/forms/ServerForm.d.ts +11 -10
- package/dist/forms/StaticForm.d.ts +3 -1
- package/dist/forms/field-autocomplete.d.ts +28 -0
- package/dist/forms/form-dom-values.d.ts +42 -0
- package/dist/forms/index.js +11 -9
- package/dist/forms/server.js +6 -4
- package/dist/forms/static.js +3 -2
- package/dist/forms/submitForm.d.ts +8 -1
- package/dist/forms/types.d.ts +41 -2
- package/dist/forms/useForm.d.ts +21 -4
- package/dist/forms/webmcp.d.ts +38 -0
- package/dist/images/index.js +4 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/dist/layout/SiteKitClientProviders.d.ts +3 -3
- package/dist/layout/SiteKitLayout.d.ts +4 -4
- package/dist/layout/client.d.ts +3 -3
- package/dist/layout/client.js +7 -7
- package/dist/layout/index.js +8 -8
- package/dist/layout/types.d.ts +5 -4
- package/dist/llms/agent-access.d.ts +4 -0
- package/dist/llms/contract.js +1 -1
- package/dist/llms/index.js +6 -6
- package/dist/maps/index.js +3 -3
- package/dist/mcp/WebMcpTools.d.ts +5 -4
- package/dist/mcp/client.js +14 -7
- package/dist/mcp/discovery.d.ts +48 -0
- package/dist/mcp/handlers.d.ts +13 -7
- package/dist/mcp/index.d.ts +5 -3
- package/dist/mcp/index.js +62 -30
- package/dist/mcp/serverCard.d.ts +6 -7
- package/dist/mcp/sonor.js +14 -11
- package/dist/revalidate/index.js +2 -2
- package/dist/seo/client.js +4 -4
- package/dist/seo/index.js +15 -8
- package/dist/seo/llms/contract.js +1 -1
- package/dist/seo/llms.js +6 -6
- package/dist/seo/register-sitemap-cli.js +1 -1
- package/dist/seo/sitemap.js +4 -4
- package/dist/server/index.js +2 -2
- package/dist/shared/dialog.d.ts +27 -0
- package/dist/shared/identity.d.ts +1 -1
- package/dist/shared/layers.d.ts +7 -0
- package/dist/shared/mid-form.d.ts +53 -0
- package/dist/shared/reporting-gate.d.ts +1 -1
- package/dist/shared/version.d.ts +1 -1
- package/dist/shared/visual-viewport-gap.d.ts +1 -1
- package/dist/signal/index.js +2 -2
- package/dist/signal/types.d.ts +1 -1
- package/dist/sitemap/index.js +4 -4
- package/dist/{socket-loader-R24ZSRSQ.js → socket-loader-CGIPEG74.js} +1 -1
- package/dist/sync/index.js +5 -5
- package/dist/types.d.ts +3 -1
- package/dist/{web-vitals.attribution-GD6LGLVF.js → web-vitals.attribution-N2PCCF4Q.js} +1 -1
- package/dist/website/BlocksPopup.d.ts +1 -1
- package/dist/website/PopupBlocks.d.ts +5 -2
- package/dist/website/SitePopups.d.ts +25 -0
- package/dist/website/images.js +4 -4
- package/dist/website/index.js +6 -6
- package/dist/website/popup-rules.d.ts +46 -0
- package/dist/website/popup-types.d.ts +113 -0
- package/dist/website/popups.d.ts +2 -6
- package/dist/website/popups.js +6 -14
- package/dist/{writeLLMsTxt-G3JBNBC5.js → writeLLMsTxt-2NQVDGYI.js} +3 -3
- package/docs/MIGRATING-TO-7.md +41 -9
- package/docs.json +2 -1
- package/package.json +2 -2
- package/src/analytics/README.md +2 -2
- package/src/articles/README.md +4 -1
- package/src/{engage → chat}/README.md +63 -62
- package/src/forms/README.md +49 -3
- package/src/layout/README.md +8 -5
- package/src/llms/README.md +69 -0
- package/src/mcp/README.md +50 -16
- package/src/seo/README.md +3 -1
- package/src/sync/README.md +10 -0
- package/src/website/README.md +133 -0
- package/dist/ChatWidget-UCDWMWCW.js +0 -15
- package/dist/EngageWidget-7ZYSK4GE.js +0 -11
- package/dist/ManagedForm-H7BVAH2W.js +0 -14
- package/dist/SitemapSync-XBANGKHZ.js +0 -8
- package/dist/chunk-NDF4A5JM.js +0 -37
- package/dist/chunk-VLARKWZU.js +0 -100
- package/dist/chunk-YCJT4JJG.js +0 -837
- package/dist/engage/DesignRenderer.d.ts +0 -57
- package/dist/engage/element-rules.d.ts +0 -38
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { generateArticleAuthorNode, resolveArticleArtwork, withArticleAuthorIdentity } from './chunk-QXMIKDOL.js';
|
|
2
2
|
import { resolveArticleUrl, createPublicationRoutes, resolvePublicationUrl, articleCategorySlug } from './chunk-WMVK77ND.js';
|
|
3
|
+
import { withoutSchemaPlaceholders } from './chunk-VWWITFWM.js';
|
|
3
4
|
import { withSiteParam, withSiteBody } from './chunk-MJP63SSS.js';
|
|
4
5
|
import { resolveServerApiConfig } from './chunk-X6F6SO4S.js';
|
|
5
6
|
import { notFound } from 'next/navigation';
|
|
@@ -959,10 +960,10 @@ function generateBreadcrumbSchema(post, options = {}) {
|
|
|
959
960
|
}
|
|
960
961
|
function generateAllArticleSchemas(post, options = {}) {
|
|
961
962
|
const schemas = [];
|
|
962
|
-
const eeatSchema = post.schema ?? post.schema_json;
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
schemas.push(...
|
|
963
|
+
const eeatSchema = withoutSchemaPlaceholders(post.schema ?? post.schema_json).value;
|
|
964
|
+
const eeatNodes = eeatSchema ? Array.isArray(eeatSchema) ? eeatSchema : [eeatSchema] : [];
|
|
965
|
+
if (eeatNodes.length > 0) {
|
|
966
|
+
schemas.push(...eeatNodes.map((node) => withArticleAuthorIdentity(node, post.author, options)));
|
|
966
967
|
} else {
|
|
967
968
|
schemas.push(generateArticleSchema(post, options));
|
|
968
969
|
const faqItems = post.faq_items ?? post.faqItems;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { declarativeToolForm } from './chunk-HW7B43E5.js';
|
|
2
|
+
|
|
3
|
+
// src/forms/webmcp.ts
|
|
4
|
+
var DESCRIPTION_BY_TYPE = {
|
|
5
|
+
prospect: "Send this business an inquiry: a question, a quote request or a project to discuss.",
|
|
6
|
+
contact: "Send this business a message through its contact form.",
|
|
7
|
+
support: "Ask this business for help with an existing order, project or account.",
|
|
8
|
+
feedback: "Send this business feedback.",
|
|
9
|
+
newsletter: "Sign an email address up for this business's newsletter.",
|
|
10
|
+
custom: "Submit this form to the business."
|
|
11
|
+
};
|
|
12
|
+
function formToolName(config) {
|
|
13
|
+
const base = String(config.slug || "").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
14
|
+
return `submit_${base || "form"}`.slice(0, 64);
|
|
15
|
+
}
|
|
16
|
+
function formToolDescription(config) {
|
|
17
|
+
const lead = DESCRIPTION_BY_TYPE[config.form_type] ?? DESCRIPTION_BY_TYPE.custom;
|
|
18
|
+
const named = config.name ? ` The form is called "${config.name}".` : "";
|
|
19
|
+
const extra = typeof config.description === "string" ? config.description.trim() : "";
|
|
20
|
+
return `${lead}${named}${extra ? ` ${extra}` : ""}`.slice(0, 500);
|
|
21
|
+
}
|
|
22
|
+
function formToolAttributes(config) {
|
|
23
|
+
return declarativeToolForm({ name: formToolName(config), description: formToolDescription(config) });
|
|
24
|
+
}
|
|
25
|
+
function readAgentSubmit(event) {
|
|
26
|
+
const fields = event ?? {};
|
|
27
|
+
const invoked = fields.agentInvoked === true;
|
|
28
|
+
return {
|
|
29
|
+
invoked,
|
|
30
|
+
respond: (outcome) => {
|
|
31
|
+
if (!invoked || typeof fields.respondWith !== "function") return;
|
|
32
|
+
try {
|
|
33
|
+
fields.respondWith.call(event, outcome);
|
|
34
|
+
} catch {
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { formToolAttributes, readAgentSubmit };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { DEFAULT_WIDGET_Z_INDEX } from './chunk-27FISYK4.js';
|
|
3
|
+
import { resolveAnalyticsTarget } from './chunk-43OCZ3JA.js';
|
|
4
|
+
import { useState, useEffect } from 'react';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
6
|
+
import dynamic from 'next/dynamic';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var LazyChatWidget = dynamic(
|
|
10
|
+
() => import('./ChatWidget-FHBAHFZX.js').then((m) => ({ default: m.ChatWidget })),
|
|
11
|
+
{ ssr: false }
|
|
12
|
+
);
|
|
13
|
+
function SiteChat(props) {
|
|
14
|
+
const target = resolveAnalyticsTarget(props);
|
|
15
|
+
if (!target) return null;
|
|
16
|
+
return /* @__PURE__ */ jsx(IdleChat, { ...props });
|
|
17
|
+
}
|
|
18
|
+
function IdleChat({ projectId, position = "bottom-right", offsetBottom, zIndex = DEFAULT_WIDGET_Z_INDEX }) {
|
|
19
|
+
const [ready, setReady] = useState(false);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const id = typeof requestIdleCallback !== "undefined" ? requestIdleCallback(() => setReady(true), { timeout: 3e3 }) : setTimeout(() => setReady(true), 1);
|
|
22
|
+
return () => {
|
|
23
|
+
typeof cancelIdleCallback !== "undefined" ? cancelIdleCallback(id) : clearTimeout(id);
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
if (!ready || typeof document === "undefined") return null;
|
|
27
|
+
return ReactDOM.createPortal(
|
|
28
|
+
/* @__PURE__ */ jsx(
|
|
29
|
+
LazyChatWidget,
|
|
30
|
+
{
|
|
31
|
+
projectId: projectId ?? void 0,
|
|
32
|
+
config: {
|
|
33
|
+
position,
|
|
34
|
+
offsetBottom,
|
|
35
|
+
zIndex,
|
|
36
|
+
buttonColor: "#2563eb"
|
|
37
|
+
// Default blue-600 (AA on white), overridden by --sk-primary CSS var or API brand_primary
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
document.body
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { SiteChat };
|
|
@@ -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-BEBR4OJD.js';
|
|
5
5
|
import { useRef, useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
var SYNC_STAMP_KEY = "_sk_sitemap_synced_at";
|
|
@@ -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-
|
|
6
|
-
import { SITE_KIT_VERSION } from './chunk-
|
|
5
|
+
import { sonorFetch } from './chunk-BEBR4OJD.js';
|
|
6
|
+
import { SITE_KIT_VERSION } from './chunk-56KNHB4U.js';
|
|
7
7
|
import { useRef, useEffect } from 'react';
|
|
8
8
|
|
|
9
9
|
// src/fleet/heartbeat.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveSiteHost } from './chunk-FESKKJAS.js';
|
|
2
|
-
import { configureSiteCredential, currentCredential } from './chunk-
|
|
2
|
+
import { configureSiteCredential, currentCredential } from './chunk-WGG6GTKW.js';
|
|
3
3
|
|
|
4
4
|
// src/shared/publishCredential.ts
|
|
5
5
|
function publishSiteCredential({
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
// src/contracts/schema-placeholders.ts
|
|
2
|
+
var RESERVED_EXAMPLE_DOMAINS = ["example.com", "example.net", "example.org"];
|
|
3
|
+
var RESERVED_EXAMPLE_TLD = "example";
|
|
4
|
+
var PLACEHOLDER_NAMES = /* @__PURE__ */ new Set([
|
|
5
|
+
"example",
|
|
6
|
+
"example business",
|
|
7
|
+
"example company",
|
|
8
|
+
"example organization",
|
|
9
|
+
"your business",
|
|
10
|
+
"your business name",
|
|
11
|
+
"your company",
|
|
12
|
+
"your company name",
|
|
13
|
+
"your organization",
|
|
14
|
+
"your organization name",
|
|
15
|
+
"business name",
|
|
16
|
+
"company name",
|
|
17
|
+
"organization name",
|
|
18
|
+
"your name",
|
|
19
|
+
"lorem ipsum"
|
|
20
|
+
]);
|
|
21
|
+
var NAME_KEYS = /* @__PURE__ */ new Set([
|
|
22
|
+
"name",
|
|
23
|
+
"legalName",
|
|
24
|
+
"alternateName",
|
|
25
|
+
"author",
|
|
26
|
+
"creator",
|
|
27
|
+
"publisher",
|
|
28
|
+
"brand",
|
|
29
|
+
"provider",
|
|
30
|
+
"seller",
|
|
31
|
+
"manufacturer",
|
|
32
|
+
"organizer",
|
|
33
|
+
"founder"
|
|
34
|
+
]);
|
|
35
|
+
var PHONE_KEYS = /* @__PURE__ */ new Set(["telephone", "faxNumber"]);
|
|
36
|
+
var URI_TEMPLATE_KEYS = /* @__PURE__ */ new Set(["target", "urlTemplate"]);
|
|
37
|
+
var BODY_TEXT_KEYS = /* @__PURE__ */ new Set(["articleBody"]);
|
|
38
|
+
var ANNOTATION_KEYS = /* @__PURE__ */ new Set(["note", "notes", "_note", "_notes", "_comment", "_comments", "__comment", "$comment"]);
|
|
39
|
+
var STRUCTURAL_KEYS = /* @__PURE__ */ new Set(["@context", "@type", "@id", "position"]);
|
|
40
|
+
var MUSTACHE_SLOT = /\{\{\s*[#^/>&]?\s*[A-Za-z_$][\w$.[\]-]*\s*\}\}/;
|
|
41
|
+
var JSX_EXPRESSION_VALUE = /^\{\s*[A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*|\[[^\]]*\])+[^{}]*\}$/;
|
|
42
|
+
var JSX_MEMBER_IN_TEXT = /\{\s*[A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)+\s*\}/;
|
|
43
|
+
var BRACKET_SLOT_VALUE = /^\[\s*[A-Za-z][^[\]"{}<>]{0,80}\]$/;
|
|
44
|
+
var BRACKET_SLOT_IN_TEXT = /\[\s*((?:your|insert your|enter your|add your)\s+[^[\]]{1,60}?|(?:(?:business|company|organization|brand|full|first|last|resident|client|customer|author)\s+)?(?:name|phone(?:\s+number)?|telephone|email(?:\s+address)?|(?:street\s+)?address|city|state|zip(?:\s+code)?|postal\s+code|website|url|logo|date))\s*\](?!\()/gi;
|
|
45
|
+
var REPLACE_MARKER = /\bREPLACE(?:_WITH_\w*|_ME\b)/;
|
|
46
|
+
var UPPER_SLOT_VALUE = /^YOUR_[A-Z0-9_]+$/;
|
|
47
|
+
var MAX_DEPTH = 40;
|
|
48
|
+
var MAX_EVIDENCE = 5;
|
|
49
|
+
var EVIDENCE_VALUE_LENGTH = 120;
|
|
50
|
+
function withoutSchemaPlaceholders(value) {
|
|
51
|
+
const state = { dropped: [], notes: [] };
|
|
52
|
+
if (value === null || value === void 0) return { value: null, ...state };
|
|
53
|
+
const result = visitRoot(value, state);
|
|
54
|
+
return { value: result, ...state };
|
|
55
|
+
}
|
|
56
|
+
function visitRoot(value, state) {
|
|
57
|
+
if (Array.isArray(value)) {
|
|
58
|
+
const out = visitArray(value, "$", state, 0, true);
|
|
59
|
+
return out.removed && out.value.length === 0 ? null : out.value;
|
|
60
|
+
}
|
|
61
|
+
if (!isPlainObject(value)) return value;
|
|
62
|
+
if (isGraphWrapper(value)) {
|
|
63
|
+
const out = visitContainer(value, "$", state, 0);
|
|
64
|
+
return out.removedChild && !hasContentBeyond(out.value, /* @__PURE__ */ new Set(["@context"])) ? null : out.value;
|
|
65
|
+
}
|
|
66
|
+
const visit = visitNode(value, "$", state, 0);
|
|
67
|
+
return visit.keep ? visit.value : null;
|
|
68
|
+
}
|
|
69
|
+
function visitNode(node, path, state, depth) {
|
|
70
|
+
if (isAnnotationOnly(node)) {
|
|
71
|
+
state.dropped.push({ path, type: null, reasons: ["annotation"], evidence: annotationEvidence(node) });
|
|
72
|
+
return { keep: false };
|
|
73
|
+
}
|
|
74
|
+
const evidence = [];
|
|
75
|
+
collectEvidence(node, evidence, depth);
|
|
76
|
+
if (evidence.length) {
|
|
77
|
+
state.dropped.push({ path, type: typeOf(node), reasons: unique(evidence.map((e) => e.reason)), evidence });
|
|
78
|
+
return { keep: false };
|
|
79
|
+
}
|
|
80
|
+
const droppedMark = state.dropped.length;
|
|
81
|
+
const notesMark = state.notes.length;
|
|
82
|
+
const pruned = visitContainer(node, path, state, depth);
|
|
83
|
+
if (pruned.removedChild && !hasContentBeyond(pruned.value, STRUCTURAL_KEYS)) {
|
|
84
|
+
const children = state.dropped.splice(droppedMark);
|
|
85
|
+
state.notes.length = notesMark;
|
|
86
|
+
state.dropped.push({
|
|
87
|
+
path,
|
|
88
|
+
type: typeOf(node),
|
|
89
|
+
reasons: unique(["emptied", ...children.flatMap((c) => c.reasons)]),
|
|
90
|
+
evidence: children.flatMap((c) => c.evidence).slice(0, MAX_EVIDENCE)
|
|
91
|
+
});
|
|
92
|
+
return { keep: false };
|
|
93
|
+
}
|
|
94
|
+
return { keep: true, value: pruned.value };
|
|
95
|
+
}
|
|
96
|
+
function visitContainer(obj, path, state, depth) {
|
|
97
|
+
if (depth >= MAX_DEPTH) return { value: obj, removedChild: false };
|
|
98
|
+
let changed = false;
|
|
99
|
+
let removedChild = false;
|
|
100
|
+
const out = {};
|
|
101
|
+
for (const [key, child] of Object.entries(obj)) {
|
|
102
|
+
if (key === "@context") {
|
|
103
|
+
out[key] = child;
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (ANNOTATION_KEYS.has(key)) {
|
|
107
|
+
state.notes.push({ path, key });
|
|
108
|
+
changed = true;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const childPath = stepKey(path, key);
|
|
112
|
+
if (Array.isArray(child)) {
|
|
113
|
+
const pruned = visitArray(child, childPath, state, depth + 1, key === "@graph");
|
|
114
|
+
if (pruned.removed) removedChild = true;
|
|
115
|
+
if (pruned.value !== child) changed = true;
|
|
116
|
+
if (pruned.removed && pruned.value.length === 0) continue;
|
|
117
|
+
out[key] = pruned.value;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (isPlainObject(child)) {
|
|
121
|
+
if (isNestedNode(child)) {
|
|
122
|
+
const visit = visitNode(child, childPath, state, depth + 1);
|
|
123
|
+
if (!visit.keep) {
|
|
124
|
+
changed = true;
|
|
125
|
+
removedChild = true;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
if (visit.value !== child) changed = true;
|
|
129
|
+
out[key] = visit.value;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const pruned = visitContainer(child, childPath, state, depth + 1);
|
|
133
|
+
if (pruned.removedChild) removedChild = true;
|
|
134
|
+
if (pruned.value !== child) changed = true;
|
|
135
|
+
out[key] = pruned.value;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
out[key] = child;
|
|
139
|
+
}
|
|
140
|
+
return { value: changed ? out : obj, removedChild };
|
|
141
|
+
}
|
|
142
|
+
function visitArray(items, path, state, depth, units) {
|
|
143
|
+
if (depth >= MAX_DEPTH) return { value: items, removed: false };
|
|
144
|
+
let changed = false;
|
|
145
|
+
let removed = false;
|
|
146
|
+
const out = [];
|
|
147
|
+
items.forEach((item, index) => {
|
|
148
|
+
const itemPath = `${path}[${index}]`;
|
|
149
|
+
if (Array.isArray(item)) {
|
|
150
|
+
const pruned = visitArray(item, itemPath, state, depth + 1, units);
|
|
151
|
+
if (pruned.removed) removed = true;
|
|
152
|
+
if (pruned.value !== item) changed = true;
|
|
153
|
+
out.push(pruned.value);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
if (isPlainObject(item) && (units || isNestedNode(item))) {
|
|
157
|
+
const visit = visitNode(item, itemPath, state, depth + 1);
|
|
158
|
+
if (!visit.keep) {
|
|
159
|
+
changed = true;
|
|
160
|
+
removed = true;
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (visit.value !== item) changed = true;
|
|
164
|
+
out.push(visit.value);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (isPlainObject(item)) {
|
|
168
|
+
const pruned = visitContainer(item, itemPath, state, depth + 1);
|
|
169
|
+
if (pruned.removedChild) removed = true;
|
|
170
|
+
if (pruned.value !== item) changed = true;
|
|
171
|
+
out.push(pruned.value);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
out.push(item);
|
|
175
|
+
});
|
|
176
|
+
return { value: changed ? out : items, removed };
|
|
177
|
+
}
|
|
178
|
+
function collectEvidence(holder, out, depth) {
|
|
179
|
+
for (const [key, value] of Object.entries(holder)) {
|
|
180
|
+
if (key === "@context" || ANNOTATION_KEYS.has(key)) continue;
|
|
181
|
+
collectFromValue(holder, key, value, out, depth);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function collectFromValue(holder, key, value, out, depth) {
|
|
185
|
+
if (depth >= MAX_DEPTH || out.length >= MAX_EVIDENCE) return;
|
|
186
|
+
if (typeof value === "string") {
|
|
187
|
+
for (const reason of placeholderReasons(key, value, holder)) {
|
|
188
|
+
if (out.length >= MAX_EVIDENCE) return;
|
|
189
|
+
out.push({ reason, key, value: cutForLog(value) });
|
|
190
|
+
}
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
if (Array.isArray(value)) {
|
|
194
|
+
for (const item of value) collectFromValue(holder, key, item, out, depth + 1);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (isPlainObject(value) && !isNestedNode(value)) collectEvidence(value, out, depth + 1);
|
|
198
|
+
}
|
|
199
|
+
function placeholderReasons(key, raw, holder) {
|
|
200
|
+
const value = raw.trim();
|
|
201
|
+
if (!value) return [];
|
|
202
|
+
const reasons = [];
|
|
203
|
+
const host = urlHost(value);
|
|
204
|
+
if (host && isReservedExampleHost(host)) reasons.push("example_domain");
|
|
205
|
+
if ((PHONE_KEYS.has(key) || /^tel:/i.test(value)) && isPlaceholderPhone(value)) reasons.push("placeholder_phone");
|
|
206
|
+
if (NAME_KEYS.has(key) && !("value" in holder) && PLACEHOLDER_NAMES.has(normalizeName(value))) {
|
|
207
|
+
reasons.push("placeholder_name");
|
|
208
|
+
}
|
|
209
|
+
if (isTemplateSlot(key, value)) reasons.push("template_token");
|
|
210
|
+
return reasons;
|
|
211
|
+
}
|
|
212
|
+
function isTemplateSlot(key, value) {
|
|
213
|
+
if (JSX_EXPRESSION_VALUE.test(value) || BRACKET_SLOT_VALUE.test(value) || UPPER_SLOT_VALUE.test(value)) return true;
|
|
214
|
+
if (REPLACE_MARKER.test(value)) return true;
|
|
215
|
+
if (!BODY_TEXT_KEYS.has(key)) {
|
|
216
|
+
if (MUSTACHE_SLOT.test(value)) return true;
|
|
217
|
+
for (const match of value.matchAll(BRACKET_SLOT_IN_TEXT)) {
|
|
218
|
+
if (/^[A-Z]/.test(match[1])) return true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return !URI_TEMPLATE_KEYS.has(key) && isUrlOrPath(value) && JSX_MEMBER_IN_TEXT.test(value);
|
|
222
|
+
}
|
|
223
|
+
function urlHost(value) {
|
|
224
|
+
const mailto = /^mailto:[^@\s?]+@([^?\s#/]+)/i.exec(value);
|
|
225
|
+
if (mailto) return mailto[1];
|
|
226
|
+
const url = /^(?:[a-z][a-z0-9+.-]*:)?\/\/(?:[^/?#@\s]*@)?([^/?#:\s]+)/i.exec(value);
|
|
227
|
+
if (url) return url[1];
|
|
228
|
+
const email = /^[^\s@/:]+@([^\s@/:?#]+)$/.exec(value);
|
|
229
|
+
if (email) return email[1];
|
|
230
|
+
const bare = /^((?:[a-z0-9-]+\.)+[a-z][a-z0-9-]*)\.?(?::\d+)?(?:[/?#]\S*)?$/i.exec(value);
|
|
231
|
+
return bare ? bare[1] : null;
|
|
232
|
+
}
|
|
233
|
+
function isReservedExampleHost(host) {
|
|
234
|
+
const h = host.toLowerCase().replace(/\.$/, "");
|
|
235
|
+
if (h === RESERVED_EXAMPLE_TLD || h.endsWith(`.${RESERVED_EXAMPLE_TLD}`)) return true;
|
|
236
|
+
return RESERVED_EXAMPLE_DOMAINS.some((domain) => h === domain || h.endsWith(`.${domain}`));
|
|
237
|
+
}
|
|
238
|
+
function isUrlOrPath(value) {
|
|
239
|
+
return /^(?:[a-z][a-z0-9+.-]*:)?\/\//i.test(value) || value.startsWith("/");
|
|
240
|
+
}
|
|
241
|
+
function isPlaceholderPhone(raw) {
|
|
242
|
+
const value = raw.replace(/^tel:/i, "").trim();
|
|
243
|
+
if (/^[+\d\s().xX-]+$/.test(value) && (value.match(/x/gi)?.length ?? 0) >= 4) return true;
|
|
244
|
+
let digits = value.replace(/\D/g, "");
|
|
245
|
+
if (digits.length === 11 && digits.startsWith("1")) digits = digits.slice(1);
|
|
246
|
+
if (digits.length >= 7 && /^0+$/.test(digits)) return true;
|
|
247
|
+
if (digits === "1234567890" || digits === "1234567") return true;
|
|
248
|
+
const local = digits.length === 10 ? digits.slice(3) : digits.length === 7 ? digits : null;
|
|
249
|
+
return local !== null && /^55501\d\d$/.test(local);
|
|
250
|
+
}
|
|
251
|
+
function normalizeName(value) {
|
|
252
|
+
return value.replace(/\s+/g, " ").trim().replace(/[.,]+$/, "").toLowerCase();
|
|
253
|
+
}
|
|
254
|
+
function isPlainObject(value) {
|
|
255
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
256
|
+
}
|
|
257
|
+
function isNestedNode(value) {
|
|
258
|
+
return "@type" in value || "@id" in value || isAnnotationOnly(value);
|
|
259
|
+
}
|
|
260
|
+
function isGraphWrapper(value) {
|
|
261
|
+
return "@graph" in value && !("@type" in value) && !("@id" in value);
|
|
262
|
+
}
|
|
263
|
+
function isAnnotationOnly(value) {
|
|
264
|
+
if ("@type" in value || "@id" in value || "@graph" in value) return false;
|
|
265
|
+
const keys = Object.keys(value).filter((key) => key !== "@context");
|
|
266
|
+
return keys.length > 0 && keys.every((key) => ANNOTATION_KEYS.has(key));
|
|
267
|
+
}
|
|
268
|
+
function annotationEvidence(node) {
|
|
269
|
+
return Object.entries(node).filter(([key]) => ANNOTATION_KEYS.has(key)).slice(0, MAX_EVIDENCE).map(([key, value]) => ({
|
|
270
|
+
reason: "annotation",
|
|
271
|
+
key,
|
|
272
|
+
value: cutForLog(typeof value === "string" ? value : JSON.stringify(value) ?? "")
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
function hasContentBeyond(obj, ignored) {
|
|
276
|
+
return Object.entries(obj).some(([key, value]) => !ignored.has(key) && hasContent(value));
|
|
277
|
+
}
|
|
278
|
+
function hasContent(value) {
|
|
279
|
+
if (value === null || value === void 0 || value === "") return false;
|
|
280
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
281
|
+
if (isPlainObject(value)) return Object.keys(value).length > 0;
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
284
|
+
function typeOf(node) {
|
|
285
|
+
const type = node["@type"];
|
|
286
|
+
if (typeof type === "string") return type;
|
|
287
|
+
if (Array.isArray(type)) return type.filter((t) => typeof t === "string").join(",") || null;
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
function stepKey(path, key) {
|
|
291
|
+
return /^[A-Za-z_$][\w$]*$/.test(key) ? `${path}.${key}` : `${path}[${JSON.stringify(key)}]`;
|
|
292
|
+
}
|
|
293
|
+
function unique(values) {
|
|
294
|
+
return [...new Set(values)];
|
|
295
|
+
}
|
|
296
|
+
function cutForLog(value) {
|
|
297
|
+
return value.length > EVIDENCE_VALUE_LENGTH ? `${value.slice(0, EVIDENCE_VALUE_LENGTH)}...` : value;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export { withoutSchemaPlaceholders };
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { generateLLMsTxt, generateLLMsFullTxt } from './chunk-
|
|
1
|
+
import { generateLLMsTxt, generateLLMsFullTxt, appendAgentAccessSection } from './chunk-Z65DHMTW.js';
|
|
2
2
|
import { createHash } from 'crypto';
|
|
3
3
|
import { existsSync, readFileSync } from 'fs';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
|
|
6
|
+
function withAgentAccess(markdown, options) {
|
|
7
|
+
const baseUrl = options.baseUrl || process.env.NEXT_PUBLIC_SITE_URL || process.env.SITE_URL || "";
|
|
8
|
+
return options.mcp ? appendAgentAccessSection(markdown, baseUrl, options.mcp === true ? {} : options.mcp) : markdown;
|
|
9
|
+
}
|
|
6
10
|
function weakEtag(body) {
|
|
7
11
|
const h = createHash("sha1").update(body, "utf8").digest("base64url");
|
|
8
12
|
return `W/"${h}"`;
|
|
@@ -25,7 +29,7 @@ function createLLMsTxtHandler(options = {}) {
|
|
|
25
29
|
if (preferStatic) {
|
|
26
30
|
const staticPath = join(process.cwd(), "public", "llms.txt");
|
|
27
31
|
if (existsSync(staticPath)) {
|
|
28
|
-
const markdown2 = readFileSync(staticPath, "utf-8");
|
|
32
|
+
const markdown2 = withAgentAccess(readFileSync(staticPath, "utf-8"), generateOptions);
|
|
29
33
|
return new Response(markdown2, {
|
|
30
34
|
status: 200,
|
|
31
35
|
headers: llmsResponseHeaders(markdown2, { ...robots, "X-Sections": "static" })
|
|
@@ -61,7 +65,7 @@ function createLLMsFullTxtHandler(options = {}) {
|
|
|
61
65
|
if (preferStatic) {
|
|
62
66
|
const staticPath = join(process.cwd(), "public", "llms-full.txt");
|
|
63
67
|
if (existsSync(staticPath)) {
|
|
64
|
-
const markdown2 = readFileSync(staticPath, "utf-8");
|
|
68
|
+
const markdown2 = withAgentAccess(readFileSync(staticPath, "utf-8"), generateOptions);
|
|
65
69
|
return new Response(markdown2, {
|
|
66
70
|
status: 200,
|
|
67
71
|
headers: llmsResponseHeaders(markdown2, { ...robots, "X-Sections": "static" })
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { countStageViews, countStageQuestions, useFieldControls } from './chunk-
|
|
2
|
+
import { countStageViews, countStageQuestions, useFieldControls } from './chunk-ZKHI4E2B.js';
|
|
3
3
|
import { HoneypotField } from './chunk-DXO6SBMD.js';
|
|
4
|
-
import { DelightStyles, FormMomentum, FormField } from './chunk-
|
|
5
|
-
import { useFormLoadedAt, useFormTracking, submitForm, useRecaptchaWarmup, useForm } from './chunk-
|
|
6
|
-
import {
|
|
4
|
+
import { DelightStyles, FormMomentum, FormField } from './chunk-4NTBQNHA.js';
|
|
5
|
+
import { useFormLoadedAt, useFormTracking, submitForm, useRecaptchaWarmup, useForm } from './chunk-EPT6FJUY.js';
|
|
6
|
+
import { readAgentSubmit, formToolAttributes } from './chunk-Q6E4OPGG.js';
|
|
7
|
+
import { isFieldVisible, validateField, isFieldComplete, isDisplayOnly, unseenControlValues } from './chunk-C2FZBUSS.js';
|
|
7
8
|
import { DEFAULT_FORM_SUCCESS_MESSAGE } from './chunk-5SQK3D53.js';
|
|
8
9
|
import { DEFAULT_HONEYPOT_FIELD } from './chunk-NJCTQH2P.js';
|
|
9
10
|
import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
@@ -62,7 +63,7 @@ function FormClient({
|
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
65
|
let cancelled = false;
|
|
65
|
-
const load = resolvedExperience === "stage" ? import('./FormStage-
|
|
66
|
+
const load = resolvedExperience === "stage" ? import('./FormStage-OOPQC27J.js').then((m) => m.FormStage) : import('./FormSpotlight-PE5YZBFZ.js').then((m) => m.FormSpotlight);
|
|
66
67
|
load.then((Component) => {
|
|
67
68
|
if (!cancelled) setExperience(() => Component);
|
|
68
69
|
}).catch((err) => {
|
|
@@ -130,15 +131,16 @@ function FormClient({
|
|
|
130
131
|
setErrors(newErrors);
|
|
131
132
|
return Object.keys(newErrors).length === 0;
|
|
132
133
|
}, [currentFields, validateField2]);
|
|
133
|
-
const
|
|
134
|
+
const validateAllFor = useCallback((vals) => {
|
|
134
135
|
const allFields = config.fields || [];
|
|
136
|
+
const visible = (field) => isFieldVisible(field, vals);
|
|
135
137
|
const newErrors = {};
|
|
136
138
|
for (const field of allFields) {
|
|
137
|
-
const error =
|
|
139
|
+
const error = validateField(field, vals, visible);
|
|
138
140
|
if (error) newErrors[field.slug] = error;
|
|
139
141
|
}
|
|
140
142
|
setErrors(newErrors);
|
|
141
|
-
if (Object.keys(newErrors).length === 0) return { ok: true, firstErrorStep: null };
|
|
143
|
+
if (Object.keys(newErrors).length === 0) return { ok: true, firstErrorStep: null, errors: newErrors };
|
|
142
144
|
let firstErrorStep = null;
|
|
143
145
|
if (config.is_multi_step && config.steps) {
|
|
144
146
|
const ordered = [...config.steps].sort((a, b) => a.step_number - b.step_number);
|
|
@@ -149,16 +151,16 @@ function FormClient({
|
|
|
149
151
|
}
|
|
150
152
|
}
|
|
151
153
|
}
|
|
152
|
-
return { ok: false, firstErrorStep };
|
|
153
|
-
}, [config
|
|
154
|
-
const buildVisibleValues = useCallback(() => {
|
|
154
|
+
return { ok: false, firstErrorStep, errors: newErrors };
|
|
155
|
+
}, [config]);
|
|
156
|
+
const buildVisibleValues = useCallback((vals) => {
|
|
155
157
|
const out = {};
|
|
156
158
|
for (const field of config.fields || []) {
|
|
157
|
-
if (!
|
|
158
|
-
if (field.slug in
|
|
159
|
+
if (!isFieldVisible(field, vals)) continue;
|
|
160
|
+
if (field.slug in vals) out[field.slug] = vals[field.slug];
|
|
159
161
|
}
|
|
160
162
|
return out;
|
|
161
|
-
}, [config
|
|
163
|
+
}, [config]);
|
|
162
164
|
const setFieldValue = useCallback((key, value) => {
|
|
163
165
|
setTouched((prev) => prev[key] ? prev : { ...prev, [key]: true });
|
|
164
166
|
setValues((prev) => ({ ...prev, [key]: value }));
|
|
@@ -197,15 +199,19 @@ function FormClient({
|
|
|
197
199
|
trackStepChange(targetStep);
|
|
198
200
|
}
|
|
199
201
|
}, [step, config.total_steps, trackStepChange]);
|
|
200
|
-
const submit = useCallback(async () => {
|
|
201
|
-
if (isSubmittingRef.current) return;
|
|
202
|
-
const
|
|
202
|
+
const submit = useCallback(async (options) => {
|
|
203
|
+
if (isSubmittingRef.current) return { status: "busy" };
|
|
204
|
+
const domFills = options && typeof options === "object" && options.domFills && typeof options.domFills === "object" ? options.domFills : null;
|
|
205
|
+
const agentInvoked = !!options && typeof options === "object" && options.agentInvoked === true;
|
|
206
|
+
const vals = domFills && Object.keys(domFills).length > 0 ? { ...values, ...domFills } : values;
|
|
207
|
+
if (vals !== values) setValues(vals);
|
|
208
|
+
const { ok, firstErrorStep, errors: invalid } = validateAllFor(vals);
|
|
203
209
|
if (!ok) {
|
|
204
210
|
if (firstErrorStep != null) {
|
|
205
211
|
setStepDirection("back");
|
|
206
212
|
setStep(firstErrorStep);
|
|
207
213
|
}
|
|
208
|
-
return;
|
|
214
|
+
return { status: "invalid", errors: invalid };
|
|
209
215
|
}
|
|
210
216
|
isSubmittingRef.current = true;
|
|
211
217
|
setIsSubmitting(true);
|
|
@@ -213,9 +219,10 @@ function FormClient({
|
|
|
213
219
|
try {
|
|
214
220
|
const data = await submitForm({
|
|
215
221
|
config,
|
|
216
|
-
values: buildVisibleValues(),
|
|
222
|
+
values: buildVisibleValues(vals),
|
|
217
223
|
honeypotValue: config.honeypot_enabled ? honeypotValue : "",
|
|
218
|
-
formLoadedAt: formLoadedAt()
|
|
224
|
+
formLoadedAt: formLoadedAt(),
|
|
225
|
+
agentInvoked
|
|
219
226
|
});
|
|
220
227
|
trackComplete();
|
|
221
228
|
setIsComplete(true);
|
|
@@ -223,15 +230,19 @@ function FormClient({
|
|
|
223
230
|
if (config.redirect_url) {
|
|
224
231
|
window.location.href = config.redirect_url;
|
|
225
232
|
}
|
|
233
|
+
const confirmation = typeof config.success_message === "string" && config.success_message.trim() ? config.success_message.trim() : DEFAULT_FORM_SUCCESS_MESSAGE;
|
|
234
|
+
return { status: "sent", message: confirmation, submissionId: data.submissionId || void 0 };
|
|
226
235
|
} catch (error) {
|
|
227
236
|
console.error("[Forms] Submission error:", error);
|
|
228
|
-
|
|
237
|
+
const message = "Something went wrong sending your submission. Please try again.";
|
|
238
|
+
setSubmitError(message);
|
|
229
239
|
onError?.(error);
|
|
240
|
+
return { status: "failed", message };
|
|
230
241
|
} finally {
|
|
231
242
|
isSubmittingRef.current = false;
|
|
232
243
|
setIsSubmitting(false);
|
|
233
244
|
}
|
|
234
|
-
}, [config, honeypotValue,
|
|
245
|
+
}, [config, values, honeypotValue, validateAllFor, buildVisibleValues, trackComplete, onSuccess, onError]);
|
|
235
246
|
const progress = useMemo(() => {
|
|
236
247
|
return Math.round(step / config.total_steps * 100);
|
|
237
248
|
}, [step, config.total_steps]);
|
|
@@ -316,13 +327,21 @@ function FormClient({
|
|
|
316
327
|
"data-sk-state": isSubmitting ? "submitting" : "idle",
|
|
317
328
|
"data-sk-ready": momentum.total > 0 && momentum.done >= momentum.total && step >= config.total_steps ? "true" : void 0,
|
|
318
329
|
className: `sk-form ${className || ""}`,
|
|
330
|
+
...formToolAttributes(config),
|
|
319
331
|
method: "post",
|
|
320
332
|
onSubmit: (e) => {
|
|
321
333
|
e.preventDefault();
|
|
334
|
+
const agent = readAgentSubmit(e.nativeEvent);
|
|
322
335
|
if (step < config.total_steps) {
|
|
323
|
-
nextStep();
|
|
336
|
+
const moved = nextStep();
|
|
337
|
+
agent.respond(
|
|
338
|
+
Promise.resolve(
|
|
339
|
+
moved ? { status: "next_step", step: step + 1, totalSteps: config.total_steps } : { status: "invalid", errors: {} }
|
|
340
|
+
)
|
|
341
|
+
);
|
|
324
342
|
} else {
|
|
325
|
-
|
|
343
|
+
const domFills = unseenControlValues(e.currentTarget, config.fields, honeypotFieldName, values);
|
|
344
|
+
agent.respond(submit({ agentInvoked: agent.invoked, domFills }));
|
|
326
345
|
}
|
|
327
346
|
},
|
|
328
347
|
children: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormEnhancer } from './chunk-
|
|
2
|
-
import { StaticForm } from './chunk-
|
|
1
|
+
import { FormEnhancer } from './chunk-MVR4FY5R.js';
|
|
2
|
+
import { StaticForm } from './chunk-ZTLMPUO6.js';
|
|
3
3
|
import { serverApiFetch } from './chunk-X6F6SO4S.js';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
@@ -8,7 +8,6 @@ async function ServerForm({
|
|
|
8
8
|
className,
|
|
9
9
|
experience,
|
|
10
10
|
enter = "fade",
|
|
11
|
-
enhance = true,
|
|
12
11
|
defer = true,
|
|
13
12
|
initialConfig,
|
|
14
13
|
configOptions,
|
|
@@ -16,7 +15,6 @@ async function ServerForm({
|
|
|
16
15
|
}) {
|
|
17
16
|
const config = initialConfig ?? await getFormConfig(formId, configOptions);
|
|
18
17
|
const shell = /* @__PURE__ */ jsx(StaticForm, { config, className });
|
|
19
|
-
if (!enhance) return shell;
|
|
20
18
|
return /* @__PURE__ */ jsx(
|
|
21
19
|
FormEnhancer,
|
|
22
20
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSiteConfig } from './chunk-Z22QVHT4.js';
|
|
2
|
-
import { writeLLMsTxtToPublic } from './chunk-
|
|
2
|
+
import { writeLLMsTxtToPublic } from './chunk-Z65DHMTW.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';
|