@sonordev/site-kit 3.0.4 → 3.2.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 +107 -0
- package/agent-manifest.json +377 -0
- package/dist/AnalyticsProvider-CD635CHQ.mjs +8 -0
- package/dist/{AnalyticsProvider-MLT26JRP.mjs.map → AnalyticsProvider-CD635CHQ.mjs.map} +1 -1
- package/dist/AnalyticsProvider-WK2Z6AIN.js +29 -0
- package/dist/{AnalyticsProvider-WTOGN7LV.js.map → AnalyticsProvider-WK2Z6AIN.js.map} +1 -1
- package/dist/BlogPostFaqSection-4AD2NIGG.js +13 -0
- package/dist/{BlogPostFaqSection-H556RV62.js.map → BlogPostFaqSection-4AD2NIGG.js.map} +1 -1
- package/dist/{BlogPostFaqSection-VSHOKKUD.mjs → BlogPostFaqSection-TU6YEC7P.mjs} +3 -3
- package/dist/{BlogPostFaqSection-VSHOKKUD.mjs.map → BlogPostFaqSection-TU6YEC7P.mjs.map} +1 -1
- package/dist/ChatWidget-AIOOZY6H.js +17 -0
- package/dist/{ChatWidget-MAL7FB4M.js.map → ChatWidget-AIOOZY6H.js.map} +1 -1
- package/dist/ChatWidget-UAAWDBNS.mjs +8 -0
- package/dist/{ChatWidget-QPZTPSPE.mjs.map → ChatWidget-UAAWDBNS.mjs.map} +1 -1
- package/dist/EngageWidget-EZ5T6H3K.mjs +7 -0
- package/dist/{EngageWidget-IPBUA4DW.mjs.map → EngageWidget-EZ5T6H3K.mjs.map} +1 -1
- package/dist/EngageWidget-RWVWW56C.js +16 -0
- package/dist/{EngageWidget-N3CABK3L.js.map → EngageWidget-RWVWW56C.js.map} +1 -1
- package/dist/{SignalCore-4MDIJUAP.mjs → SignalCore-4B4RNYLV.mjs} +60 -47
- package/dist/SignalCore-4B4RNYLV.mjs.map +1 -0
- package/dist/{SignalCore-ZMFUE3N4.js → SignalCore-AECW2JFP.js} +60 -47
- package/dist/SignalCore-AECW2JFP.js.map +1 -0
- package/dist/SitemapSync-AICU4SSV.js +15 -0
- package/dist/{SitemapSync-FUCH6Y6J.js.map → SitemapSync-AICU4SSV.js.map} +1 -1
- package/dist/SitemapSync-CIZCAZXK.mjs +6 -0
- package/dist/{SitemapSync-LCSPRAWU.mjs.map → SitemapSync-CIZCAZXK.mjs.map} +1 -1
- package/dist/analytics/index.js +11 -9
- package/dist/analytics/index.mjs +4 -2
- package/dist/blog/index.js +12 -12
- package/dist/blog/index.mjs +2 -2
- package/dist/blog/server-ui.js +5 -5
- package/dist/blog/server-ui.mjs +1 -1
- package/dist/brand.css +8 -3
- package/dist/{chunk-QTWA44S3.mjs → chunk-2WYEJOGA.mjs} +7 -8
- package/dist/chunk-2WYEJOGA.mjs.map +1 -0
- package/dist/{chunk-AN4ATCYQ.mjs → chunk-45QHDA7Q.mjs} +3 -3
- package/dist/{chunk-AN4ATCYQ.mjs.map → chunk-45QHDA7Q.mjs.map} +1 -1
- package/dist/{chunk-RI6JZUAE.js → chunk-4FBV5BJW.js} +7 -8
- package/dist/chunk-4FBV5BJW.js.map +1 -0
- package/dist/{chunk-YJWKHCOB.js → chunk-4NTMIU6V.js} +13 -11
- package/dist/chunk-4NTMIU6V.js.map +1 -0
- package/dist/{chunk-YFGKIKXA.mjs → chunk-57QV6NIY.mjs} +3 -3
- package/dist/{chunk-YFGKIKXA.mjs.map → chunk-57QV6NIY.mjs.map} +1 -1
- package/dist/chunk-5OWZUNNE.js +102 -0
- package/dist/chunk-5OWZUNNE.js.map +1 -0
- package/dist/{chunk-EUDTPXUI.mjs → chunk-6HPNFWSC.mjs} +3 -3
- package/dist/{chunk-EUDTPXUI.mjs.map → chunk-6HPNFWSC.mjs.map} +1 -1
- package/dist/{chunk-ZM2ALSBM.js → chunk-7TX5BKVA.js} +18 -7
- package/dist/chunk-7TX5BKVA.js.map +1 -0
- package/dist/{chunk-FT5JNCD4.mjs → chunk-AB2VYIYU.mjs} +11 -11
- package/dist/{chunk-FT5JNCD4.mjs.map → chunk-AB2VYIYU.mjs.map} +1 -1
- package/dist/{chunk-I5TJIESQ.js → chunk-BMKZHXWQ.js} +11 -11
- package/dist/{chunk-I5TJIESQ.js.map → chunk-BMKZHXWQ.js.map} +1 -1
- package/dist/{chunk-KHFNPPOX.mjs → chunk-DSRPKUQI.mjs} +6 -6
- package/dist/{chunk-KHFNPPOX.mjs.map → chunk-DSRPKUQI.mjs.map} +1 -1
- package/dist/chunk-EAASMIWX.js +258 -0
- package/dist/chunk-EAASMIWX.js.map +1 -0
- package/dist/{chunk-T4QBSRA4.mjs → chunk-EIWRPGOK.mjs} +37 -60
- package/dist/chunk-EIWRPGOK.mjs.map +1 -0
- package/dist/{chunk-O7E6QVK3.js → chunk-GCDVKOSM.js} +3 -3
- package/dist/{chunk-O7E6QVK3.js.map → chunk-GCDVKOSM.js.map} +1 -1
- package/dist/{chunk-KMZ527EM.mjs → chunk-GN62H6EG.mjs} +34 -8
- package/dist/chunk-GN62H6EG.mjs.map +1 -0
- package/dist/{chunk-UJQYSVYV.js → chunk-GQF6QAQS.js} +4 -4
- package/dist/{chunk-UJQYSVYV.js.map → chunk-GQF6QAQS.js.map} +1 -1
- package/dist/{chunk-MLJXELPA.js → chunk-HAZN43I6.js} +60 -94
- package/dist/chunk-HAZN43I6.js.map +1 -0
- package/dist/chunk-LZSCCJ4O.mjs +253 -0
- package/dist/chunk-LZSCCJ4O.mjs.map +1 -0
- package/dist/{chunk-TCVHI3JP.mjs → chunk-N2HR2E4Z.mjs} +60 -92
- package/dist/chunk-N2HR2E4Z.mjs.map +1 -0
- package/dist/{chunk-VCWSSGCU.js → chunk-NAVDN4AE.js} +7 -7
- package/dist/{chunk-VCWSSGCU.js.map → chunk-NAVDN4AE.js.map} +1 -1
- package/dist/chunk-NDHFU4HV.mjs +97 -0
- package/dist/chunk-NDHFU4HV.mjs.map +1 -0
- package/dist/{chunk-PST3NOEM.mjs → chunk-O237KKCX.mjs} +4 -4
- package/dist/{chunk-PST3NOEM.mjs.map → chunk-O237KKCX.mjs.map} +1 -1
- package/dist/{chunk-5AESOLXS.mjs → chunk-OTY7EWET.mjs} +13 -11
- package/dist/chunk-OTY7EWET.mjs.map +1 -0
- package/dist/chunk-Q2NBD54V.js +69 -0
- package/dist/chunk-Q2NBD54V.js.map +1 -0
- package/dist/{chunk-DGHPOWLU.js → chunk-R5A64DCX.js} +8 -8
- package/dist/{chunk-DGHPOWLU.js.map → chunk-R5A64DCX.js.map} +1 -1
- package/dist/{chunk-3YQCPLGP.mjs → chunk-RFIWVH3D.mjs} +41 -79
- package/dist/chunk-RFIWVH3D.mjs.map +1 -0
- package/dist/{chunk-NNZDHLXN.js → chunk-S3YQGTBF.js} +35 -9
- package/dist/chunk-S3YQGTBF.js.map +1 -0
- package/dist/{chunk-IBDVZ6BF.js → chunk-SLWTG2LJ.js} +69 -74
- package/dist/chunk-SLWTG2LJ.js.map +1 -0
- package/dist/chunk-SN2O72UF.mjs +6 -0
- package/dist/chunk-SN2O72UF.mjs.map +1 -0
- package/dist/{chunk-65SMJBHW.mjs → chunk-T2DEEKVQ.mjs} +69 -74
- package/dist/chunk-T2DEEKVQ.mjs.map +1 -0
- package/dist/{chunk-3GCEFS73.js → chunk-TE3W5REY.js} +39 -62
- package/dist/chunk-TE3W5REY.js.map +1 -0
- package/dist/{chunk-IFVMZFNT.js → chunk-TVCCZ7NR.js} +41 -79
- package/dist/chunk-TVCCZ7NR.js.map +1 -0
- package/dist/{chunk-EBJ4S5DU.js → chunk-UT2CF4FC.js} +4 -4
- package/dist/{chunk-EBJ4S5DU.js.map → chunk-UT2CF4FC.js.map} +1 -1
- package/dist/chunk-V6NVBFEP.js +54 -0
- package/dist/chunk-V6NVBFEP.js.map +1 -0
- package/dist/{chunk-6FWQMKVO.mjs → chunk-WN5A3KSY.mjs} +18 -7
- package/dist/chunk-WN5A3KSY.mjs.map +1 -0
- package/dist/chunk-WRZQS7O4.js +8 -0
- package/dist/chunk-WRZQS7O4.js.map +1 -0
- package/dist/chunk-WZHWWOUC.js +51 -0
- package/dist/chunk-WZHWWOUC.js.map +1 -0
- package/dist/chunk-X3S6KXAP.mjs +47 -0
- package/dist/chunk-X3S6KXAP.mjs.map +1 -0
- package/dist/chunk-X4OPM3SK.mjs +43 -0
- package/dist/chunk-X4OPM3SK.mjs.map +1 -0
- package/dist/chunk-ZPLN537Q.mjs +57 -0
- package/dist/chunk-ZPLN537Q.mjs.map +1 -0
- package/dist/cli/index.js +8986 -1276
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +8972 -1280
- package/dist/cli/index.mjs.map +1 -1
- package/dist/commerce/index.js +50 -48
- package/dist/commerce/index.mjs +5 -3
- package/dist/engage/index.js +11 -8
- package/dist/engage/index.js.map +1 -1
- package/dist/engage/index.mjs +8 -5
- package/dist/engage/index.mjs.map +1 -1
- package/dist/fleet/contract.d.mts +99 -0
- package/dist/fleet/contract.d.ts +99 -0
- package/dist/fleet/contract.js +53 -0
- package/dist/fleet/contract.js.map +1 -0
- package/dist/fleet/contract.mjs +4 -0
- package/dist/fleet/contract.mjs.map +1 -0
- package/dist/fleet/index.d.mts +89 -0
- package/dist/fleet/index.d.ts +89 -0
- package/dist/fleet/index.js +74 -0
- package/dist/fleet/index.js.map +1 -0
- package/dist/fleet/index.mjs +9 -0
- package/dist/fleet/index.mjs.map +1 -0
- package/dist/forms/contract.d.mts +69 -0
- package/dist/forms/contract.d.ts +69 -0
- package/dist/forms/contract.js +33 -0
- package/dist/forms/contract.js.map +1 -0
- package/dist/forms/contract.mjs +4 -0
- package/dist/forms/contract.mjs.map +1 -0
- package/dist/forms/index.js +21 -17
- package/dist/forms/index.js.map +1 -1
- package/dist/forms/index.mjs +14 -10
- package/dist/forms/index.mjs.map +1 -1
- package/dist/forms/styles.css +10 -8
- package/dist/images/index.js +10 -8
- package/dist/images/index.mjs +3 -1
- package/dist/index.js +98 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -7
- package/dist/index.mjs.map +1 -1
- package/dist/layout/client.d.mts +8 -1
- package/dist/layout/client.d.ts +8 -1
- package/dist/layout/client.js +8 -3
- package/dist/layout/client.mjs +7 -2
- package/dist/layout/index.d.mts +7 -1
- package/dist/layout/index.d.ts +7 -1
- package/dist/layout/index.js +57 -4
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/index.mjs +56 -3
- package/dist/layout/index.mjs.map +1 -1
- package/dist/llms/index.d.mts +4 -0
- package/dist/llms/index.d.ts +4 -0
- package/dist/llms/index.js +12 -12
- package/dist/llms/index.mjs +2 -2
- package/dist/maps/index.js +9 -18
- package/dist/maps/index.js.map +1 -1
- package/dist/maps/index.mjs +9 -18
- package/dist/maps/index.mjs.map +1 -1
- package/dist/portfolio/contract.d.mts +61 -0
- package/dist/portfolio/contract.d.ts +61 -0
- package/dist/portfolio/contract.js +43 -0
- package/dist/portfolio/contract.js.map +1 -0
- package/dist/portfolio/contract.mjs +38 -0
- package/dist/portfolio/contract.mjs.map +1 -0
- package/dist/seo/client.js +4 -2
- package/dist/seo/client.mjs +3 -1
- package/dist/seo/index.js +4 -2
- package/dist/seo/index.js.map +1 -1
- package/dist/seo/index.mjs +3 -1
- package/dist/seo/index.mjs.map +1 -1
- package/dist/seo-pages/contract.d.mts +62 -0
- package/dist/seo-pages/contract.d.ts +62 -0
- package/dist/seo-pages/contract.js +48 -0
- package/dist/seo-pages/contract.js.map +1 -0
- package/dist/seo-pages/contract.mjs +44 -0
- package/dist/seo-pages/contract.mjs.map +1 -0
- package/dist/signal/index.js +11 -11
- package/dist/signal/index.mjs +2 -2
- package/dist/sitemap/index.js +2 -2
- package/dist/sitemap/index.mjs +1 -1
- package/dist/sites/contract.d.mts +57 -0
- package/dist/sites/contract.d.ts +57 -0
- package/dist/sites/contract.js +37 -0
- package/dist/sites/contract.js.map +1 -0
- package/dist/sites/contract.mjs +4 -0
- package/dist/sites/contract.mjs.map +1 -0
- package/package.json +44 -4
- package/skills/site-kit/SKILL.md +66 -0
- package/dist/AnalyticsProvider-MLT26JRP.mjs +0 -6
- package/dist/AnalyticsProvider-WTOGN7LV.js +0 -27
- package/dist/BlogPostFaqSection-H556RV62.js +0 -13
- package/dist/ChatWidget-MAL7FB4M.js +0 -14
- package/dist/ChatWidget-QPZTPSPE.mjs +0 -5
- package/dist/EngageWidget-IPBUA4DW.mjs +0 -5
- package/dist/EngageWidget-N3CABK3L.js +0 -14
- package/dist/SignalCore-4MDIJUAP.mjs.map +0 -1
- package/dist/SignalCore-ZMFUE3N4.js.map +0 -1
- package/dist/SitemapSync-FUCH6Y6J.js +0 -13
- package/dist/SitemapSync-LCSPRAWU.mjs +0 -4
- package/dist/chunk-3GCEFS73.js.map +0 -1
- package/dist/chunk-3YQCPLGP.mjs.map +0 -1
- package/dist/chunk-5AESOLXS.mjs.map +0 -1
- package/dist/chunk-65SMJBHW.mjs.map +0 -1
- package/dist/chunk-6FWQMKVO.mjs.map +0 -1
- package/dist/chunk-IBDVZ6BF.js.map +0 -1
- package/dist/chunk-IFVMZFNT.js.map +0 -1
- package/dist/chunk-KMZ527EM.mjs.map +0 -1
- package/dist/chunk-MLJXELPA.js.map +0 -1
- package/dist/chunk-NNZDHLXN.js.map +0 -1
- package/dist/chunk-QTWA44S3.mjs.map +0 -1
- package/dist/chunk-RI6JZUAE.js.map +0 -1
- package/dist/chunk-T4QBSRA4.mjs.map +0 -1
- package/dist/chunk-TCVHI3JP.mjs.map +0 -1
- package/dist/chunk-YJWKHCOB.js.map +0 -1
- package/dist/chunk-ZM2ALSBM.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { FleetModule, FleetHeartbeatSource } from './contract.mjs';
|
|
2
|
+
export { FLEET_CONTRACT_VERSION, FLEET_MODULES, FLEET_MODULES_MAX, FLEET_SITE_MAX_LENGTH, FLEET_VERSION_MAX_LENGTH, FLEET_VERSION_PATTERN, FleetHeartbeatPayload, FleetHeartbeatResponse, buildFleetHeartbeatPayload, isFleetModule, normalizeFleetModules, normalizeFleetSite, sanitizeFleetVersion } from './contract.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @sonordev/site-kit/fleet — FleetHeartbeat
|
|
6
|
+
*
|
|
7
|
+
* A childless, effect-only client component that reports this site's build
|
|
8
|
+
* fingerprint (kit version, Next.js version, active modules, host) to Sonor
|
|
9
|
+
* exactly once per browser session. It exists so the platform can answer
|
|
10
|
+
* "which version / modules / key state is each site running" without shelling
|
|
11
|
+
* into every client repo.
|
|
12
|
+
*
|
|
13
|
+
* It is mounted as a deferred, CHILDLESS SIBLING — never a wrapper — by
|
|
14
|
+
* SiteKitClientProviders, behind the same idle/first-interaction gate as
|
|
15
|
+
* Analytics and Engage, so it never enters the critical hydration path (see
|
|
16
|
+
* CLAUDE.md "the page must server-render"). It renders null and carries no
|
|
17
|
+
* visitor data.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
interface FleetHeartbeatProps {
|
|
21
|
+
/** Sonor API origin. Falls back to `window.__SITE_KIT_API_URL__` then api.sonor.io. */
|
|
22
|
+
apiUrl?: string;
|
|
23
|
+
/** Project API key. Falls back to `window.__SITE_KIT_API_KEY__`. */
|
|
24
|
+
apiKey?: string;
|
|
25
|
+
/** Host for the multi-site sub-dimension. Falls back to `__SITE_KIT_SITE__` then location.host. */
|
|
26
|
+
site?: string | null;
|
|
27
|
+
/** Client-observable active modules (SiteKitClientProviders passes the enabled set). */
|
|
28
|
+
modules?: FleetModule[];
|
|
29
|
+
/** Installed Next.js version if known; otherwise best-effort runtime detection. */
|
|
30
|
+
nextVersion?: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Self-defer to idle / first interaction. Default true so standalone use is
|
|
33
|
+
* safe. SiteKitClientProviders already gates the mount and passes false.
|
|
34
|
+
*/
|
|
35
|
+
defer?: boolean;
|
|
36
|
+
/** Send at most once per browser session per (version, host). Default true. */
|
|
37
|
+
oncePerSession?: boolean;
|
|
38
|
+
debug?: boolean;
|
|
39
|
+
}
|
|
40
|
+
declare function FleetHeartbeat({ apiUrl, apiKey, site, modules, nextVersion, defer, oncePerSession, debug, }: FleetHeartbeatProps): null;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @sonordev/site-kit/fleet — heartbeat sender (single source of truth for the POST)
|
|
44
|
+
*
|
|
45
|
+
* One place that turns fleet inputs into a validated payload and ships it to
|
|
46
|
+
* `/api/public/fleet/heartbeat`. Used by BOTH the client component
|
|
47
|
+
* (FleetHeartbeat) and any build-time caller, so the send path never forks.
|
|
48
|
+
*
|
|
49
|
+
* It routes through the canonical `sonorFetch` transport, which already stamps
|
|
50
|
+
* the x-sitekit-version header, attaches x-api-key, and honors the auth
|
|
51
|
+
* circuit breaker — a site on a stale/canceled key will not spam the API.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/** Canonical ingest path — resolved against the site's Sonor API origin. */
|
|
55
|
+
declare const FLEET_HEARTBEAT_PATH = "/api/public/fleet/heartbeat";
|
|
56
|
+
interface SendFleetHeartbeatOptions {
|
|
57
|
+
/** Sonor API origin (e.g. https://api.sonor.io). Trailing slash tolerated. */
|
|
58
|
+
apiUrl: string;
|
|
59
|
+
/** Project API key — scopes the request; the project is resolved server-side. */
|
|
60
|
+
apiKey: string;
|
|
61
|
+
/** Client-observable active modules (validated/deduped by the contract). */
|
|
62
|
+
modules?: FleetModule[] | string[];
|
|
63
|
+
/** Normalized host for the multi-site sub-dimension (server re-normalizes). */
|
|
64
|
+
site?: string | null;
|
|
65
|
+
/** Installed Next.js version, if the caller can resolve it. */
|
|
66
|
+
nextVersion?: string | null;
|
|
67
|
+
/** 'client' (runtime boot) or 'build' (CI). Default 'client'. */
|
|
68
|
+
source?: FleetHeartbeatSource;
|
|
69
|
+
/** Override the reported kit version. Defaults to the runtime SITE_KIT_VERSION. */
|
|
70
|
+
kitVersion?: string;
|
|
71
|
+
/** Log one info line with the result. Never logs at error level. */
|
|
72
|
+
debug?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Best-effort runtime detection of the host Next.js version. Unreliable by
|
|
76
|
+
* design — Next does not expose its version consistently across app/pages
|
|
77
|
+
* router — so it returns null unless a site injects `__SITE_KIT_NEXT_VERSION__`
|
|
78
|
+
* or `window.next.version` is present. Build-time callers should pass
|
|
79
|
+
* `nextVersion` explicitly (resolvable from `next/package.json`).
|
|
80
|
+
*/
|
|
81
|
+
declare function detectNextVersion(): string | null;
|
|
82
|
+
/**
|
|
83
|
+
* Fire one heartbeat. Fire-and-forget by contract: it never throws — a
|
|
84
|
+
* telemetry POST must never break a visitor's page or a site's build. Returns
|
|
85
|
+
* true only when the POST was accepted (2xx).
|
|
86
|
+
*/
|
|
87
|
+
declare function sendFleetHeartbeat(opts: SendFleetHeartbeatOptions): Promise<boolean>;
|
|
88
|
+
|
|
89
|
+
export { FLEET_HEARTBEAT_PATH, FleetHeartbeat, type FleetHeartbeatProps, FleetHeartbeatSource, FleetModule, type SendFleetHeartbeatOptions, detectNextVersion, sendFleetHeartbeat };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { FleetModule, FleetHeartbeatSource } from './contract.js';
|
|
2
|
+
export { FLEET_CONTRACT_VERSION, FLEET_MODULES, FLEET_MODULES_MAX, FLEET_SITE_MAX_LENGTH, FLEET_VERSION_MAX_LENGTH, FLEET_VERSION_PATTERN, FleetHeartbeatPayload, FleetHeartbeatResponse, buildFleetHeartbeatPayload, isFleetModule, normalizeFleetModules, normalizeFleetSite, sanitizeFleetVersion } from './contract.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @sonordev/site-kit/fleet — FleetHeartbeat
|
|
6
|
+
*
|
|
7
|
+
* A childless, effect-only client component that reports this site's build
|
|
8
|
+
* fingerprint (kit version, Next.js version, active modules, host) to Sonor
|
|
9
|
+
* exactly once per browser session. It exists so the platform can answer
|
|
10
|
+
* "which version / modules / key state is each site running" without shelling
|
|
11
|
+
* into every client repo.
|
|
12
|
+
*
|
|
13
|
+
* It is mounted as a deferred, CHILDLESS SIBLING — never a wrapper — by
|
|
14
|
+
* SiteKitClientProviders, behind the same idle/first-interaction gate as
|
|
15
|
+
* Analytics and Engage, so it never enters the critical hydration path (see
|
|
16
|
+
* CLAUDE.md "the page must server-render"). It renders null and carries no
|
|
17
|
+
* visitor data.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
interface FleetHeartbeatProps {
|
|
21
|
+
/** Sonor API origin. Falls back to `window.__SITE_KIT_API_URL__` then api.sonor.io. */
|
|
22
|
+
apiUrl?: string;
|
|
23
|
+
/** Project API key. Falls back to `window.__SITE_KIT_API_KEY__`. */
|
|
24
|
+
apiKey?: string;
|
|
25
|
+
/** Host for the multi-site sub-dimension. Falls back to `__SITE_KIT_SITE__` then location.host. */
|
|
26
|
+
site?: string | null;
|
|
27
|
+
/** Client-observable active modules (SiteKitClientProviders passes the enabled set). */
|
|
28
|
+
modules?: FleetModule[];
|
|
29
|
+
/** Installed Next.js version if known; otherwise best-effort runtime detection. */
|
|
30
|
+
nextVersion?: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* Self-defer to idle / first interaction. Default true so standalone use is
|
|
33
|
+
* safe. SiteKitClientProviders already gates the mount and passes false.
|
|
34
|
+
*/
|
|
35
|
+
defer?: boolean;
|
|
36
|
+
/** Send at most once per browser session per (version, host). Default true. */
|
|
37
|
+
oncePerSession?: boolean;
|
|
38
|
+
debug?: boolean;
|
|
39
|
+
}
|
|
40
|
+
declare function FleetHeartbeat({ apiUrl, apiKey, site, modules, nextVersion, defer, oncePerSession, debug, }: FleetHeartbeatProps): null;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @sonordev/site-kit/fleet — heartbeat sender (single source of truth for the POST)
|
|
44
|
+
*
|
|
45
|
+
* One place that turns fleet inputs into a validated payload and ships it to
|
|
46
|
+
* `/api/public/fleet/heartbeat`. Used by BOTH the client component
|
|
47
|
+
* (FleetHeartbeat) and any build-time caller, so the send path never forks.
|
|
48
|
+
*
|
|
49
|
+
* It routes through the canonical `sonorFetch` transport, which already stamps
|
|
50
|
+
* the x-sitekit-version header, attaches x-api-key, and honors the auth
|
|
51
|
+
* circuit breaker — a site on a stale/canceled key will not spam the API.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/** Canonical ingest path — resolved against the site's Sonor API origin. */
|
|
55
|
+
declare const FLEET_HEARTBEAT_PATH = "/api/public/fleet/heartbeat";
|
|
56
|
+
interface SendFleetHeartbeatOptions {
|
|
57
|
+
/** Sonor API origin (e.g. https://api.sonor.io). Trailing slash tolerated. */
|
|
58
|
+
apiUrl: string;
|
|
59
|
+
/** Project API key — scopes the request; the project is resolved server-side. */
|
|
60
|
+
apiKey: string;
|
|
61
|
+
/** Client-observable active modules (validated/deduped by the contract). */
|
|
62
|
+
modules?: FleetModule[] | string[];
|
|
63
|
+
/** Normalized host for the multi-site sub-dimension (server re-normalizes). */
|
|
64
|
+
site?: string | null;
|
|
65
|
+
/** Installed Next.js version, if the caller can resolve it. */
|
|
66
|
+
nextVersion?: string | null;
|
|
67
|
+
/** 'client' (runtime boot) or 'build' (CI). Default 'client'. */
|
|
68
|
+
source?: FleetHeartbeatSource;
|
|
69
|
+
/** Override the reported kit version. Defaults to the runtime SITE_KIT_VERSION. */
|
|
70
|
+
kitVersion?: string;
|
|
71
|
+
/** Log one info line with the result. Never logs at error level. */
|
|
72
|
+
debug?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Best-effort runtime detection of the host Next.js version. Unreliable by
|
|
76
|
+
* design — Next does not expose its version consistently across app/pages
|
|
77
|
+
* router — so it returns null unless a site injects `__SITE_KIT_NEXT_VERSION__`
|
|
78
|
+
* or `window.next.version` is present. Build-time callers should pass
|
|
79
|
+
* `nextVersion` explicitly (resolvable from `next/package.json`).
|
|
80
|
+
*/
|
|
81
|
+
declare function detectNextVersion(): string | null;
|
|
82
|
+
/**
|
|
83
|
+
* Fire one heartbeat. Fire-and-forget by contract: it never throws — a
|
|
84
|
+
* telemetry POST must never break a visitor's page or a site's build. Returns
|
|
85
|
+
* true only when the POST was accepted (2xx).
|
|
86
|
+
*/
|
|
87
|
+
declare function sendFleetHeartbeat(opts: SendFleetHeartbeatOptions): Promise<boolean>;
|
|
88
|
+
|
|
89
|
+
export { FLEET_HEARTBEAT_PATH, FleetHeartbeat, type FleetHeartbeatProps, FleetHeartbeatSource, FleetModule, type SendFleetHeartbeatOptions, detectNextVersion, sendFleetHeartbeat };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunk5OWZUNNE_js = require('../chunk-5OWZUNNE.js');
|
|
5
|
+
require('../chunk-HGNSJXWT.js');
|
|
6
|
+
var chunkQ2NBD54V_js = require('../chunk-Q2NBD54V.js');
|
|
7
|
+
require('../chunk-EAASMIWX.js');
|
|
8
|
+
require('../chunk-WRZQS7O4.js');
|
|
9
|
+
require('../chunk-ZSMWDLMK.js');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Object.defineProperty(exports, "FLEET_HEARTBEAT_PATH", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return chunk5OWZUNNE_js.FLEET_HEARTBEAT_PATH; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "FleetHeartbeat", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunk5OWZUNNE_js.FleetHeartbeat; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, "detectNextVersion", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return chunk5OWZUNNE_js.detectNextVersion; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "sendFleetHeartbeat", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunk5OWZUNNE_js.sendFleetHeartbeat; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "FLEET_CONTRACT_VERSION", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return chunkQ2NBD54V_js.FLEET_CONTRACT_VERSION; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "FLEET_MODULES", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkQ2NBD54V_js.FLEET_MODULES; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "FLEET_MODULES_MAX", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkQ2NBD54V_js.FLEET_MODULES_MAX; }
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "FLEET_SITE_MAX_LENGTH", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () { return chunkQ2NBD54V_js.FLEET_SITE_MAX_LENGTH; }
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, "FLEET_VERSION_MAX_LENGTH", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return chunkQ2NBD54V_js.FLEET_VERSION_MAX_LENGTH; }
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, "FLEET_VERSION_PATTERN", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () { return chunkQ2NBD54V_js.FLEET_VERSION_PATTERN; }
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "buildFleetHeartbeatPayload", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () { return chunkQ2NBD54V_js.buildFleetHeartbeatPayload; }
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "isFleetModule", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () { return chunkQ2NBD54V_js.isFleetModule; }
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "normalizeFleetModules", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () { return chunkQ2NBD54V_js.normalizeFleetModules; }
|
|
64
|
+
});
|
|
65
|
+
Object.defineProperty(exports, "normalizeFleetSite", {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () { return chunkQ2NBD54V_js.normalizeFleetSite; }
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "sanitizeFleetVersion", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function () { return chunkQ2NBD54V_js.sanitizeFleetVersion; }
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
export { FLEET_HEARTBEAT_PATH, FleetHeartbeat, detectNextVersion, sendFleetHeartbeat } from '../chunk-NDHFU4HV.mjs';
|
|
3
|
+
import '../chunk-ZVBLXXNJ.mjs';
|
|
4
|
+
export { FLEET_CONTRACT_VERSION, FLEET_MODULES, FLEET_MODULES_MAX, FLEET_SITE_MAX_LENGTH, FLEET_VERSION_MAX_LENGTH, FLEET_VERSION_PATTERN, buildFleetHeartbeatPayload, isFleetModule, normalizeFleetModules, normalizeFleetSite, sanitizeFleetVersion } from '../chunk-ZPLN537Q.mjs';
|
|
5
|
+
import '../chunk-LZSCCJ4O.mjs';
|
|
6
|
+
import '../chunk-SN2O72UF.mjs';
|
|
7
|
+
import '../chunk-4XPGGLVP.mjs';
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sonordev/site-kit/forms/contract — managed-form honeypot policy (v1)
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the honeypot trap-field naming + server-side
|
|
5
|
+
* detection policy, shared by the client (site-kit emits the trap field) and
|
|
6
|
+
* the server (sonor-api names the trap in the form config it returns AND
|
|
7
|
+
* detects hits on intake). Same pattern as the other site-kit contracts:
|
|
8
|
+
* sonor-api keeps a byte-identical inline mirror
|
|
9
|
+
* (`src/modules/forms/honeypot-contract.ts`) guarded by the shared drift-test
|
|
10
|
+
* vectors in `contract.test.ts`.
|
|
11
|
+
*
|
|
12
|
+
* The default field name (`_sk_hp_url`) is deliberately obscure: a common name
|
|
13
|
+
* like "website" collides with real form fields and flags genuine submissions
|
|
14
|
+
* as spam, so generic names are only trusted when they DON'T match a real
|
|
15
|
+
* field of the form (see `resolveHoneypotFieldNames`).
|
|
16
|
+
*/
|
|
17
|
+
/** Bump on breaking changes to the honeypot policy. */
|
|
18
|
+
declare const FORMS_HONEYPOT_CONTRACT_VERSION: 1;
|
|
19
|
+
/**
|
|
20
|
+
* Default honeypot field name emitted by site-kit and used by the server as the
|
|
21
|
+
* fallback trap name when a form has no explicitly configured `honeypot_field`.
|
|
22
|
+
* Deliberately obscure to avoid colliding with real form fields.
|
|
23
|
+
*/
|
|
24
|
+
declare const DEFAULT_HONEYPOT_FIELD = "_sk_hp_url";
|
|
25
|
+
/**
|
|
26
|
+
* Generic trap names the server also watches on intake — the canonical default
|
|
27
|
+
* plus legacy names still emitted by older deployed forms. Each is only trusted
|
|
28
|
+
* when it doesn't collide with a real configured field of the form.
|
|
29
|
+
*/
|
|
30
|
+
declare const GENERIC_HONEYPOT_FIELDS: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* Build the set of field names the server treats as honeypot traps for one form.
|
|
33
|
+
* Generic names that collide with a real field slug are dropped (or every real
|
|
34
|
+
* lead using that field would be flagged); the form's dedicated
|
|
35
|
+
* `honeypot_field` is always honored. Returns an empty set when disabled.
|
|
36
|
+
*/
|
|
37
|
+
declare function resolveHoneypotFieldNames(opts: {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
formHoneypotField?: string | null;
|
|
40
|
+
realFieldSlugs?: Iterable<string>;
|
|
41
|
+
}): Set<string>;
|
|
42
|
+
/**
|
|
43
|
+
* True when any watched trap field carries a non-empty value — the marker of an
|
|
44
|
+
* automated submission (real users never see or fill the trap).
|
|
45
|
+
*/
|
|
46
|
+
declare function isHoneypotTriggered(data: Record<string, unknown> | null | undefined, fieldNames: Iterable<string>): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Agent-native contract: JSON Schema for the honeypot slice of the public form
|
|
49
|
+
* config, so services and agents can validate it mechanically.
|
|
50
|
+
*/
|
|
51
|
+
declare const HONEYPOT_CONFIG_JSON_SCHEMA: {
|
|
52
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
53
|
+
readonly $id: "https://sonor.io/schemas/honeypot-config.v1.json";
|
|
54
|
+
readonly title: "HoneypotConfig";
|
|
55
|
+
readonly description: "The honeypot slice of a public managed-form config.";
|
|
56
|
+
readonly type: "object";
|
|
57
|
+
readonly properties: {
|
|
58
|
+
readonly honeypot_enabled: {
|
|
59
|
+
readonly type: "boolean";
|
|
60
|
+
};
|
|
61
|
+
readonly honeypot_field: {
|
|
62
|
+
readonly description: "Trap field name; defaults to \"_sk_hp_url\" when unset.";
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readonly additionalProperties: true;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { DEFAULT_HONEYPOT_FIELD, FORMS_HONEYPOT_CONTRACT_VERSION, GENERIC_HONEYPOT_FIELDS, HONEYPOT_CONFIG_JSON_SCHEMA, isHoneypotTriggered, resolveHoneypotFieldNames };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sonordev/site-kit/forms/contract — managed-form honeypot policy (v1)
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the honeypot trap-field naming + server-side
|
|
5
|
+
* detection policy, shared by the client (site-kit emits the trap field) and
|
|
6
|
+
* the server (sonor-api names the trap in the form config it returns AND
|
|
7
|
+
* detects hits on intake). Same pattern as the other site-kit contracts:
|
|
8
|
+
* sonor-api keeps a byte-identical inline mirror
|
|
9
|
+
* (`src/modules/forms/honeypot-contract.ts`) guarded by the shared drift-test
|
|
10
|
+
* vectors in `contract.test.ts`.
|
|
11
|
+
*
|
|
12
|
+
* The default field name (`_sk_hp_url`) is deliberately obscure: a common name
|
|
13
|
+
* like "website" collides with real form fields and flags genuine submissions
|
|
14
|
+
* as spam, so generic names are only trusted when they DON'T match a real
|
|
15
|
+
* field of the form (see `resolveHoneypotFieldNames`).
|
|
16
|
+
*/
|
|
17
|
+
/** Bump on breaking changes to the honeypot policy. */
|
|
18
|
+
declare const FORMS_HONEYPOT_CONTRACT_VERSION: 1;
|
|
19
|
+
/**
|
|
20
|
+
* Default honeypot field name emitted by site-kit and used by the server as the
|
|
21
|
+
* fallback trap name when a form has no explicitly configured `honeypot_field`.
|
|
22
|
+
* Deliberately obscure to avoid colliding with real form fields.
|
|
23
|
+
*/
|
|
24
|
+
declare const DEFAULT_HONEYPOT_FIELD = "_sk_hp_url";
|
|
25
|
+
/**
|
|
26
|
+
* Generic trap names the server also watches on intake — the canonical default
|
|
27
|
+
* plus legacy names still emitted by older deployed forms. Each is only trusted
|
|
28
|
+
* when it doesn't collide with a real configured field of the form.
|
|
29
|
+
*/
|
|
30
|
+
declare const GENERIC_HONEYPOT_FIELDS: readonly string[];
|
|
31
|
+
/**
|
|
32
|
+
* Build the set of field names the server treats as honeypot traps for one form.
|
|
33
|
+
* Generic names that collide with a real field slug are dropped (or every real
|
|
34
|
+
* lead using that field would be flagged); the form's dedicated
|
|
35
|
+
* `honeypot_field` is always honored. Returns an empty set when disabled.
|
|
36
|
+
*/
|
|
37
|
+
declare function resolveHoneypotFieldNames(opts: {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
formHoneypotField?: string | null;
|
|
40
|
+
realFieldSlugs?: Iterable<string>;
|
|
41
|
+
}): Set<string>;
|
|
42
|
+
/**
|
|
43
|
+
* True when any watched trap field carries a non-empty value — the marker of an
|
|
44
|
+
* automated submission (real users never see or fill the trap).
|
|
45
|
+
*/
|
|
46
|
+
declare function isHoneypotTriggered(data: Record<string, unknown> | null | undefined, fieldNames: Iterable<string>): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Agent-native contract: JSON Schema for the honeypot slice of the public form
|
|
49
|
+
* config, so services and agents can validate it mechanically.
|
|
50
|
+
*/
|
|
51
|
+
declare const HONEYPOT_CONFIG_JSON_SCHEMA: {
|
|
52
|
+
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
53
|
+
readonly $id: "https://sonor.io/schemas/honeypot-config.v1.json";
|
|
54
|
+
readonly title: "HoneypotConfig";
|
|
55
|
+
readonly description: "The honeypot slice of a public managed-form config.";
|
|
56
|
+
readonly type: "object";
|
|
57
|
+
readonly properties: {
|
|
58
|
+
readonly honeypot_enabled: {
|
|
59
|
+
readonly type: "boolean";
|
|
60
|
+
};
|
|
61
|
+
readonly honeypot_field: {
|
|
62
|
+
readonly description: "Trap field name; defaults to \"_sk_hp_url\" when unset.";
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readonly additionalProperties: true;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { DEFAULT_HONEYPOT_FIELD, FORMS_HONEYPOT_CONTRACT_VERSION, GENERIC_HONEYPOT_FIELDS, HONEYPOT_CONFIG_JSON_SCHEMA, isHoneypotTriggered, resolveHoneypotFieldNames };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkV6NVBFEP_js = require('../chunk-V6NVBFEP.js');
|
|
4
|
+
require('../chunk-ZSMWDLMK.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "DEFAULT_HONEYPOT_FIELD", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkV6NVBFEP_js.DEFAULT_HONEYPOT_FIELD; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "FORMS_HONEYPOT_CONTRACT_VERSION", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkV6NVBFEP_js.FORMS_HONEYPOT_CONTRACT_VERSION; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "GENERIC_HONEYPOT_FIELDS", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkV6NVBFEP_js.GENERIC_HONEYPOT_FIELDS; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "HONEYPOT_CONFIG_JSON_SCHEMA", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkV6NVBFEP_js.HONEYPOT_CONFIG_JSON_SCHEMA; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "isHoneypotTriggered", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkV6NVBFEP_js.isHoneypotTriggered; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "resolveHoneypotFieldNames", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkV6NVBFEP_js.resolveHoneypotFieldNames; }
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=contract.js.map
|
|
33
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"contract.js"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { DEFAULT_HONEYPOT_FIELD, FORMS_HONEYPOT_CONTRACT_VERSION, GENERIC_HONEYPOT_FIELDS, HONEYPOT_CONFIG_JSON_SCHEMA, isHoneypotTriggered, resolveHoneypotFieldNames } from '../chunk-X3S6KXAP.mjs';
|
|
2
|
+
import '../chunk-4XPGGLVP.mjs';
|
|
3
|
+
//# sourceMappingURL=contract.mjs.map
|
|
4
|
+
//# sourceMappingURL=contract.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"contract.mjs"}
|
package/dist/forms/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkHAZN43I6_js = require('../chunk-HAZN43I6.js');
|
|
5
|
+
var chunkV6NVBFEP_js = require('../chunk-V6NVBFEP.js');
|
|
6
|
+
var chunkEAASMIWX_js = require('../chunk-EAASMIWX.js');
|
|
7
|
+
require('../chunk-WRZQS7O4.js');
|
|
5
8
|
require('../chunk-ZSMWDLMK.js');
|
|
6
9
|
var React2 = require('react');
|
|
7
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -39,11 +42,11 @@ async function apiRequest(method, path, body) {
|
|
|
39
42
|
const token = await getAuthToken();
|
|
40
43
|
headers["Authorization"] = `Bearer ${token}`;
|
|
41
44
|
}
|
|
42
|
-
const response = await
|
|
45
|
+
const response = await chunkEAASMIWX_js.sonorFetch(`${baseUrl}${path}`, {
|
|
43
46
|
method,
|
|
44
47
|
headers,
|
|
45
48
|
body: body ? JSON.stringify(body) : void 0
|
|
46
|
-
});
|
|
49
|
+
}, { retries: 0 });
|
|
47
50
|
if (!response.ok) {
|
|
48
51
|
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
49
52
|
throw new Error(error.message || `API error: ${response.status}`);
|
|
@@ -449,7 +452,7 @@ function DatePicker({
|
|
|
449
452
|
width: "100%",
|
|
450
453
|
padding: "var(--sk-input-padding, 10px 12px)",
|
|
451
454
|
backgroundColor: "var(--sk-input-bg, #fff)",
|
|
452
|
-
border: `1px solid ${open ? "var(--sk-input-border-focus, #
|
|
455
|
+
border: `1px solid ${open ? "var(--sk-input-border-focus, #2563eb)" : "var(--sk-input-border, #d1d5db)"}`,
|
|
453
456
|
borderRadius: "var(--sk-input-radius, 0.375rem)",
|
|
454
457
|
fontSize: "var(--sk-font-size, 14px)",
|
|
455
458
|
color: value ? "var(--sk-form-success-text, #111)" : "var(--sk-text-tertiary, #9ca3af)",
|
|
@@ -533,8 +536,8 @@ function DatePicker({
|
|
|
533
536
|
fontSize: "13px",
|
|
534
537
|
fontWeight: selected ? 700 : todayMark ? 600 : 400,
|
|
535
538
|
borderRadius: "6px",
|
|
536
|
-
border: todayMark && !selected ? "1px solid var(--sk-primary, #
|
|
537
|
-
background: selected ? "var(--sk-primary, #
|
|
539
|
+
border: todayMark && !selected ? "1px solid var(--sk-primary, #2563eb)" : "1px solid transparent",
|
|
540
|
+
background: selected ? "var(--sk-primary, #2563eb)" : "transparent",
|
|
538
541
|
color: disabled ? "var(--sk-text-tertiary, #9ca3af)" : selected ? "#fff" : "var(--sk-form-success-text, #111)",
|
|
539
542
|
cursor: disabled ? "not-allowed" : "pointer",
|
|
540
543
|
opacity: disabled ? 0.4 : 1,
|
|
@@ -571,7 +574,7 @@ function DatePicker({
|
|
|
571
574
|
cursor: "pointer",
|
|
572
575
|
fontSize: "12px",
|
|
573
576
|
fontWeight: 600,
|
|
574
|
-
color: "var(--sk-primary, #
|
|
577
|
+
color: "var(--sk-primary, #2563eb)",
|
|
575
578
|
padding: "4px 8px"
|
|
576
579
|
},
|
|
577
580
|
children: "Today"
|
|
@@ -892,7 +895,7 @@ async function uploadFormFile(file) {
|
|
|
892
895
|
}
|
|
893
896
|
const body = new FormData();
|
|
894
897
|
body.append("file", file);
|
|
895
|
-
const response = await
|
|
898
|
+
const response = await chunkEAASMIWX_js.sonorFetch(
|
|
896
899
|
`${apiUrl}/api/public/forms/upload`,
|
|
897
900
|
{
|
|
898
901
|
method: "POST",
|
|
@@ -924,10 +927,10 @@ function FormClient({
|
|
|
924
927
|
const [isComplete, setIsComplete] = React2.useState(false);
|
|
925
928
|
const [submitError, setSubmitError] = React2.useState(null);
|
|
926
929
|
const [honeypotValue, setHoneypotValue] = React2.useState("");
|
|
927
|
-
const honeypotFieldName = config2.honeypot_field ||
|
|
930
|
+
const honeypotFieldName = config2.honeypot_field || chunkV6NVBFEP_js.DEFAULT_HONEYPOT_FIELD;
|
|
928
931
|
const formLoadedAt = React2.useRef(Date.now());
|
|
929
932
|
const isSubmittingRef = React2.useRef(false);
|
|
930
|
-
const { trackStepChange, trackComplete } =
|
|
933
|
+
const { trackStepChange, trackComplete } = chunkHAZN43I6_js.useFormTracking({
|
|
931
934
|
formId: config2.id,
|
|
932
935
|
totalSteps: config2.total_steps
|
|
933
936
|
});
|
|
@@ -1086,7 +1089,7 @@ function FormClient({
|
|
|
1086
1089
|
setIsSubmitting(true);
|
|
1087
1090
|
setSubmitError(null);
|
|
1088
1091
|
try {
|
|
1089
|
-
const data = await
|
|
1092
|
+
const data = await chunkHAZN43I6_js.submitForm({
|
|
1090
1093
|
config: config2,
|
|
1091
1094
|
values: buildVisibleValues(),
|
|
1092
1095
|
honeypotValue: config2.honeypot_enabled ? honeypotValue : "",
|
|
@@ -1128,7 +1131,7 @@ function FormClient({
|
|
|
1128
1131
|
};
|
|
1129
1132
|
if (isComplete) {
|
|
1130
1133
|
const raw = config2.success_message;
|
|
1131
|
-
const message = typeof raw === "string" && raw.trim().length > 0 ? raw.trim() :
|
|
1134
|
+
const message = typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : chunkHAZN43I6_js.DEFAULT_FORM_SUCCESS_MESSAGE;
|
|
1132
1135
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1133
1136
|
"div",
|
|
1134
1137
|
{
|
|
@@ -1180,7 +1183,7 @@ function FormClient({
|
|
|
1180
1183
|
}, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sk-form__progress-bar", style: {
|
|
1181
1184
|
width: `${progress}%`,
|
|
1182
1185
|
height: "100%",
|
|
1183
|
-
backgroundColor: "var(--sk-progress-fill, #
|
|
1186
|
+
backgroundColor: "var(--sk-progress-fill, #2563eb)",
|
|
1184
1187
|
transition: "width 0.3s ease"
|
|
1185
1188
|
} }) })
|
|
1186
1189
|
] }),
|
|
@@ -1220,6 +1223,7 @@ function FormClient({
|
|
|
1220
1223
|
name: honeypotFieldName,
|
|
1221
1224
|
tabIndex: -1,
|
|
1222
1225
|
autoComplete: "off",
|
|
1226
|
+
"aria-hidden": "true",
|
|
1223
1227
|
style: {
|
|
1224
1228
|
position: "absolute",
|
|
1225
1229
|
left: -9999,
|
|
@@ -1251,7 +1255,7 @@ function ManagedForm({
|
|
|
1251
1255
|
form,
|
|
1252
1256
|
isLoading,
|
|
1253
1257
|
fetchError
|
|
1254
|
-
} =
|
|
1258
|
+
} = chunkHAZN43I6_js.useForm(formId, {
|
|
1255
1259
|
projectId,
|
|
1256
1260
|
onSuccess,
|
|
1257
1261
|
onError
|
|
@@ -1276,15 +1280,15 @@ function ManagedForm({
|
|
|
1276
1280
|
|
|
1277
1281
|
Object.defineProperty(exports, "DEFAULT_FORM_SUCCESS_MESSAGE", {
|
|
1278
1282
|
enumerable: true,
|
|
1279
|
-
get: function () { return
|
|
1283
|
+
get: function () { return chunkHAZN43I6_js.DEFAULT_FORM_SUCCESS_MESSAGE; }
|
|
1280
1284
|
});
|
|
1281
1285
|
Object.defineProperty(exports, "useForm", {
|
|
1282
1286
|
enumerable: true,
|
|
1283
|
-
get: function () { return
|
|
1287
|
+
get: function () { return chunkHAZN43I6_js.useForm; }
|
|
1284
1288
|
});
|
|
1285
1289
|
Object.defineProperty(exports, "useFormTracking", {
|
|
1286
1290
|
enumerable: true,
|
|
1287
|
-
get: function () { return
|
|
1291
|
+
get: function () { return chunkHAZN43I6_js.useFormTracking; }
|
|
1288
1292
|
});
|
|
1289
1293
|
exports.DatePicker = DatePicker;
|
|
1290
1294
|
exports.FormClient = FormClient;
|