@parag.more.withsurface.com/forms-sdk 0.1.4 → 0.1.5
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/dist/index.cjs +2 -3
- package/dist/index.mjs +2 -3
- package/dist/react/index.cjs +0 -1
- package/dist/react/index.mjs +0 -1
- package/dist/surface-forms-sdk.min.js +0 -1
- package/dist/types/bind/bindForm.d.ts +0 -36
- package/dist/types/bind/bindForm.test.d.ts +0 -1
- package/dist/types/bind/bookingWidget.d.ts +0 -11
- package/dist/types/bind/bookingWidget.test.d.ts +0 -1
- package/dist/types/core/client/emailValidation.d.ts +0 -4
- package/dist/types/core/client/emailValidation.test.d.ts +0 -1
- package/dist/types/core/client/responses.d.ts +0 -15
- package/dist/types/core/client/responses.test.d.ts +0 -1
- package/dist/types/core/client/runtimeConfig.contract.test.d.ts +0 -1
- package/dist/types/core/client/runtimeConfig.d.ts +0 -32
- package/dist/types/core/client/runtimeConfig.test.d.ts +0 -1
- package/dist/types/core/client/scheduler.contract.test.d.ts +0 -1
- package/dist/types/core/client/scheduler.d.ts +0 -27
- package/dist/types/core/client/scheduler.test.d.ts +0 -1
- package/dist/types/core/client/transport.d.ts +0 -28
- package/dist/types/core/client/transport.test.d.ts +0 -1
- package/dist/types/core/engine/answerAudit.d.ts +0 -12
- package/dist/types/core/engine/answerAudit.test.d.ts +0 -1
- package/dist/types/core/engine/answerStates.contract.test.d.ts +0 -1
- package/dist/types/core/engine/answerStates.d.ts +0 -17
- package/dist/types/core/engine/formEngine.d.ts +0 -53
- package/dist/types/core/engine/formEngine.test.d.ts +0 -1
- package/dist/types/core/engine/redirect.d.ts +0 -23
- package/dist/types/core/engine/redirect.test.d.ts +0 -1
- package/dist/types/core/engine/responsePayload.contract.test.d.ts +0 -1
- package/dist/types/core/engine/responsePayload.d.ts +0 -28
- package/dist/types/core/engine/responsePayload.test.d.ts +0 -1
- package/dist/types/core/engine/urlData.contract.test.d.ts +0 -1
- package/dist/types/core/engine/urlData.d.ts +0 -17
- package/dist/types/core/engine/urlData.test.d.ts +0 -1
- package/dist/types/core/engine/urlPrefill.d.ts +0 -9
- package/dist/types/core/engine/urlPrefill.test.d.ts +0 -1
- package/dist/types/core/events/dropoffDetection.d.ts +0 -14
- package/dist/types/core/events/dropoffDetection.test.d.ts +0 -1
- package/dist/types/core/events/emitter.d.ts +0 -17
- package/dist/types/core/events/emitter.test.d.ts +0 -1
- package/dist/types/core/events/formJourneyTracker.contract.test.d.ts +0 -1
- package/dist/types/core/events/formJourneyTracker.d.ts +0 -19
- package/dist/types/core/events/formJourneyTracker.test.d.ts +0 -1
- package/dist/types/core/events/pushEvents.contract.test.d.ts +0 -1
- package/dist/types/core/events/pushEvents.d.ts +0 -16
- package/dist/types/core/events/pushEvents.test.d.ts +0 -1
- package/dist/types/core/events/startedDetection.d.ts +0 -10
- package/dist/types/core/events/startedDetection.test.d.ts +0 -1
- package/dist/types/core/events/viewDetection.d.ts +0 -14
- package/dist/types/core/events/viewDetection.test.d.ts +0 -1
- package/dist/types/core/identity/browserFingerprint.d.ts +0 -19
- package/dist/types/core/identity/browserFingerprint.test.d.ts +0 -1
- package/dist/types/core/identity/ensureIdentified.d.ts +0 -16
- package/dist/types/core/identity/ensureIdentified.test.d.ts +0 -1
- package/dist/types/core/identity/identify.contract.test.d.ts +0 -1
- package/dist/types/core/identity/identify.d.ts +0 -15
- package/dist/types/core/identity/identify.test.d.ts +0 -1
- package/dist/types/core/identity/journey.contract.test.d.ts +0 -1
- package/dist/types/core/identity/journey.d.ts +0 -16
- package/dist/types/core/identity/journey.test.d.ts +0 -1
- package/dist/types/core/identity/journey.testStubs.d.ts +0 -2
- package/dist/types/core/identity/leadDataCache.d.ts +0 -16
- package/dist/types/core/identity/leadDataCache.test.d.ts +0 -1
- package/dist/types/enrichment/attachEnrichment.d.ts +0 -21
- package/dist/types/enrichment/attachEnrichment.test.d.ts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/react/index.d.ts +0 -1
- package/dist/types/react/ssr.test.d.ts +0 -1
- package/dist/types/react/useSurfaceForm.d.ts +0 -11
- package/dist/types/react/useSurfaceForm.test.d.ts +0 -1
- package/dist/types/surfaceForms.d.ts +0 -72
- package/dist/types/surfaceForms.test.d.ts +0 -1
- package/dist/types/tracking/attachTracking.d.ts +0 -22
- package/dist/types/tracking/attachTracking.test.d.ts +0 -1
- package/dist/types/tracking/conversionRules.contract.test.d.ts +0 -1
- package/dist/types/tracking/conversionRules.d.ts +0 -12
- package/dist/types/tracking/conversionRules.test.d.ts +0 -1
- package/dist/types/tracking/vendors.d.ts +0 -22
- package/dist/types/tracking/vendors.test.d.ts +0 -1
- package/dist/types/validation/attachEmailValidation.d.ts +0 -1
- package/dist/types/validation/attachEmailValidation.test.d.ts +0 -1
- package/docs/reference/identity.md +2 -3
- package/package.json +1 -1
- package/dist/index.cjs.map +0 -7
- package/dist/index.mjs.map +0 -7
- package/dist/react/index.cjs.map +0 -7
- package/dist/react/index.mjs.map +0 -7
- package/dist/surface-forms-sdk.min.js.map +0 -7
- package/dist/types/bind/bindForm.d.ts.map +0 -1
- package/dist/types/bind/bindForm.test.d.ts.map +0 -1
- package/dist/types/bind/bookingWidget.d.ts.map +0 -1
- package/dist/types/bind/bookingWidget.test.d.ts.map +0 -1
- package/dist/types/core/client/emailValidation.d.ts.map +0 -1
- package/dist/types/core/client/emailValidation.test.d.ts.map +0 -1
- package/dist/types/core/client/responses.d.ts.map +0 -1
- package/dist/types/core/client/responses.test.d.ts.map +0 -1
- package/dist/types/core/client/runtimeConfig.contract.test.d.ts.map +0 -1
- package/dist/types/core/client/runtimeConfig.d.ts.map +0 -1
- package/dist/types/core/client/runtimeConfig.test.d.ts.map +0 -1
- package/dist/types/core/client/scheduler.contract.test.d.ts.map +0 -1
- package/dist/types/core/client/scheduler.d.ts.map +0 -1
- package/dist/types/core/client/scheduler.test.d.ts.map +0 -1
- package/dist/types/core/client/transport.d.ts.map +0 -1
- package/dist/types/core/client/transport.test.d.ts.map +0 -1
- package/dist/types/core/engine/answerAudit.d.ts.map +0 -1
- package/dist/types/core/engine/answerAudit.test.d.ts.map +0 -1
- package/dist/types/core/engine/answerStates.contract.test.d.ts.map +0 -1
- package/dist/types/core/engine/answerStates.d.ts.map +0 -1
- package/dist/types/core/engine/formEngine.d.ts.map +0 -1
- package/dist/types/core/engine/formEngine.test.d.ts.map +0 -1
- package/dist/types/core/engine/redirect.d.ts.map +0 -1
- package/dist/types/core/engine/redirect.test.d.ts.map +0 -1
- package/dist/types/core/engine/responsePayload.contract.test.d.ts.map +0 -1
- package/dist/types/core/engine/responsePayload.d.ts.map +0 -1
- package/dist/types/core/engine/responsePayload.test.d.ts.map +0 -1
- package/dist/types/core/engine/urlData.contract.test.d.ts.map +0 -1
- package/dist/types/core/engine/urlData.d.ts.map +0 -1
- package/dist/types/core/engine/urlData.test.d.ts.map +0 -1
- package/dist/types/core/engine/urlPrefill.d.ts.map +0 -1
- package/dist/types/core/engine/urlPrefill.test.d.ts.map +0 -1
- package/dist/types/core/events/dropoffDetection.d.ts.map +0 -1
- package/dist/types/core/events/dropoffDetection.test.d.ts.map +0 -1
- package/dist/types/core/events/emitter.d.ts.map +0 -1
- package/dist/types/core/events/emitter.test.d.ts.map +0 -1
- package/dist/types/core/events/formJourneyTracker.contract.test.d.ts.map +0 -1
- package/dist/types/core/events/formJourneyTracker.d.ts.map +0 -1
- package/dist/types/core/events/formJourneyTracker.test.d.ts.map +0 -1
- package/dist/types/core/events/pushEvents.contract.test.d.ts.map +0 -1
- package/dist/types/core/events/pushEvents.d.ts.map +0 -1
- package/dist/types/core/events/pushEvents.test.d.ts.map +0 -1
- package/dist/types/core/events/startedDetection.d.ts.map +0 -1
- package/dist/types/core/events/startedDetection.test.d.ts.map +0 -1
- package/dist/types/core/events/viewDetection.d.ts.map +0 -1
- package/dist/types/core/events/viewDetection.test.d.ts.map +0 -1
- package/dist/types/core/identity/browserFingerprint.d.ts.map +0 -1
- package/dist/types/core/identity/browserFingerprint.test.d.ts.map +0 -1
- package/dist/types/core/identity/ensureIdentified.d.ts.map +0 -1
- package/dist/types/core/identity/ensureIdentified.test.d.ts.map +0 -1
- package/dist/types/core/identity/identify.contract.test.d.ts.map +0 -1
- package/dist/types/core/identity/identify.d.ts.map +0 -1
- package/dist/types/core/identity/identify.test.d.ts.map +0 -1
- package/dist/types/core/identity/journey.contract.test.d.ts.map +0 -1
- package/dist/types/core/identity/journey.d.ts.map +0 -1
- package/dist/types/core/identity/journey.test.d.ts.map +0 -1
- package/dist/types/core/identity/journey.testStubs.d.ts.map +0 -1
- package/dist/types/core/identity/leadDataCache.d.ts.map +0 -1
- package/dist/types/core/identity/leadDataCache.test.d.ts.map +0 -1
- package/dist/types/enrichment/attachEnrichment.d.ts.map +0 -1
- package/dist/types/enrichment/attachEnrichment.test.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/react/index.d.ts.map +0 -1
- package/dist/types/react/ssr.test.d.ts.map +0 -1
- package/dist/types/react/useSurfaceForm.d.ts.map +0 -1
- package/dist/types/react/useSurfaceForm.test.d.ts.map +0 -1
- package/dist/types/surfaceForms.d.ts.map +0 -1
- package/dist/types/surfaceForms.test.d.ts.map +0 -1
- package/dist/types/tracking/attachTracking.d.ts.map +0 -1
- package/dist/types/tracking/attachTracking.test.d.ts.map +0 -1
- package/dist/types/tracking/conversionRules.contract.test.d.ts.map +0 -1
- package/dist/types/tracking/conversionRules.d.ts.map +0 -1
- package/dist/types/tracking/conversionRules.test.d.ts.map +0 -1
- package/dist/types/tracking/vendors.d.ts.map +0 -1
- package/dist/types/tracking/vendors.test.d.ts.map +0 -1
- package/dist/types/validation/attachEmailValidation.d.ts.map +0 -1
- package/dist/types/validation/attachEmailValidation.test.d.ts.map +0 -1
|
@@ -3,37 +3,6 @@ import { type Unsubscribe } from "../events/emitter";
|
|
|
3
3
|
import type { FormJourneyTracker, FormJourneyTransitionReason } from "../events/formJourneyTracker";
|
|
4
4
|
import { type PushEventClient } from "../events/pushEvents";
|
|
5
5
|
import { type AnswerStates, type ExternalStates } from "./responsePayload";
|
|
6
|
-
/**
|
|
7
|
-
* The headless step engine (forms-sdk-plan.md §2.2): answers, traversal,
|
|
8
|
-
* response writes, and lifecycle events over the modules this stack built.
|
|
9
|
-
* Native semantics preserved:
|
|
10
|
-
*
|
|
11
|
-
* - **Partial saves on forward step change only** (row 23): first forward
|
|
12
|
-
* move creates the response, later moves update it, and every write sends
|
|
13
|
-
* the id of the step being *left* — all gated by
|
|
14
|
-
* `settings.trackPartialResponses` except the finishing write, which always
|
|
15
|
-
* happens.
|
|
16
|
-
* - **Finished/invalid derivation** (row 27): a resolved next step of
|
|
17
|
-
* `"END"`/`"INVALID"`/`undefined` finishes the form; `"INVALID"`
|
|
18
|
-
* disqualifies.
|
|
19
|
-
* - **Step transition events** (row 31): the `form_step_submitted` +
|
|
20
|
-
* `form_step_viewed` batch with `stepCompletionTime` in seconds since the
|
|
21
|
-
* engine was created (native's `initialRenderTime`), skipped when the form
|
|
22
|
-
* finishes (native returns before emitting on `"END"`).
|
|
23
|
-
* - `markViewed` mirrors native's view actions: `form_viewed` + first-step
|
|
24
|
-
* `form_step_viewed`, once.
|
|
25
|
-
* - Backward navigation never writes (native only re-arms `stepIdToSubmit`).
|
|
26
|
-
*
|
|
27
|
-
* **The engine does not evaluate routing** (Decisions #6): the customer's own
|
|
28
|
-
* code owns navigation. `next()`/`back()` are linear conveniences,
|
|
29
|
-
* `goToStep()` is the explicit move — forward jumps carry full forward
|
|
30
|
-
* semantics (step events, journey transition, partial write), jumps to an
|
|
31
|
-
* already-visited step rewind like `back()` (no write). Disqualification is
|
|
32
|
-
* the explicit `disqualify()` verb — in native it was a routing outcome (the
|
|
33
|
-
* `INVALID` sentinel), so without routing it needs its own API. The pluggable
|
|
34
|
-
* `resolveNextStep` remains as the headless hook for callers who express
|
|
35
|
-
* their routing as a resolver instead of imperative `goToStep` calls.
|
|
36
|
-
*/
|
|
37
6
|
export type ResolvedNextStep = {
|
|
38
7
|
stepId: string;
|
|
39
8
|
reason?: FormJourneyTransitionReason;
|
|
@@ -72,30 +41,23 @@ export type FormEngineEvents = {
|
|
|
72
41
|
export type FormEngineState = {
|
|
73
42
|
currentStepId: string;
|
|
74
43
|
answers: AnswerStates;
|
|
75
|
-
/** Pseudo-answer states riding every write (URL_DATA attribution, enrichment results, …). */
|
|
76
44
|
externalStates: ExternalStates;
|
|
77
45
|
responseId: string | null;
|
|
78
|
-
/** From the create reply; with the responseId it authorizes a later resume (persist both). */
|
|
79
46
|
resumeToken: string | null;
|
|
80
47
|
finished: boolean;
|
|
81
48
|
};
|
|
82
49
|
export type FormEngine = {
|
|
83
50
|
setAnswer: (questionId: string, state: Record<string, unknown>) => void;
|
|
84
|
-
/** Writes a pseudo-answer external state (enrichment results, custom attribution) that rides every subsequent save. */
|
|
85
51
|
setExternalState: (id: string, state: {
|
|
86
52
|
type: string;
|
|
87
53
|
} & Record<string, unknown>) => void;
|
|
88
|
-
/** Merges keys into the response `meta` object carried by every subsequent save (post-finish it amends the stored response). */
|
|
89
54
|
mergeMeta: (partial: Record<string, unknown>) => void;
|
|
90
55
|
next: () => Promise<void>;
|
|
91
56
|
back: () => void;
|
|
92
|
-
/** Customer-owned navigation (Decisions #6): forward jumps save like next(), visited-step jumps rewind like back(). */
|
|
93
57
|
goToStep: (stepId: string) => Promise<void>;
|
|
94
58
|
submit: () => Promise<void>;
|
|
95
|
-
/** Finishes the form as disqualified (`invalidResponse: true`) — the explicit replacement for native's INVALID routing outcome. */
|
|
96
59
|
disqualify: () => Promise<void>;
|
|
97
60
|
savePartial: () => Promise<void>;
|
|
98
|
-
/** Resolves when every write queued so far has settled — await it before tearing the page down (test harnesses, SPA unmounts). */
|
|
99
61
|
flush: () => Promise<void>;
|
|
100
62
|
markViewed: () => void;
|
|
101
63
|
on: <K extends keyof FormEngineEvents>(event: K, handler: (payload: FormEngineEvents[K]) => void) => Unsubscribe;
|
|
@@ -105,7 +67,6 @@ export type FormEngine = {
|
|
|
105
67
|
export declare const createFormEngine: ({ formId, environmentId, steps, transport, resolveNextStep, trackPartialResponses, trackCookies, externalStates, meta, identity, pushEvents, formJourney, preview, resume, }: {
|
|
106
68
|
formId: string;
|
|
107
69
|
environmentId?: string;
|
|
108
|
-
/** Ordered logical steps of the form record (the data contract). */
|
|
109
70
|
steps: Array<{
|
|
110
71
|
id: string;
|
|
111
72
|
endStepKind?: "thank_you" | "disqualified";
|
|
@@ -116,11 +77,6 @@ export declare const createFormEngine: ({ formId, environmentId, steps, transpor
|
|
|
116
77
|
trackCookies?: boolean;
|
|
117
78
|
externalStates?: ExternalStates;
|
|
118
79
|
meta?: Record<string, unknown>;
|
|
119
|
-
/**
|
|
120
|
-
* Read at every write/event, not captured at construction — a re-identify
|
|
121
|
-
* (SurfaceForm.identify after cache expiry) must attribute subsequent
|
|
122
|
-
* responses and events to the current visitor, not the boot-time one.
|
|
123
|
-
*/
|
|
124
80
|
identity?: () => {
|
|
125
81
|
fingerprint?: string;
|
|
126
82
|
leadSessionId?: string;
|
|
@@ -128,18 +84,9 @@ export declare const createFormEngine: ({ formId, environmentId, steps, transpor
|
|
|
128
84
|
};
|
|
129
85
|
pushEvents?: PushEventClient;
|
|
130
86
|
formJourney?: FormJourneyTracker;
|
|
131
|
-
/** Preview mode never writes (§2.2): traversal and events run, responses are never created. */
|
|
132
87
|
preview?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Resume a stored response (row 28): the seeded responseId turns every write
|
|
135
|
-
* into an update (no duplicate row), and the seeded answers ride along in
|
|
136
|
-
* the full-answer-set resend. Answers are keyed by questionId and seeded
|
|
137
|
-
* under the first step — the wire flattens steps, and presentation (which
|
|
138
|
-
* step to show) is the caller's own navigation.
|
|
139
|
-
*/
|
|
140
88
|
resume?: {
|
|
141
89
|
responseId: string;
|
|
142
90
|
answers?: Record<string, Record<string, unknown>>;
|
|
143
91
|
};
|
|
144
92
|
}) => FormEngine;
|
|
145
|
-
//# sourceMappingURL=formEngine.d.ts.map
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redirect handling (forms-sdk-plan.md rows 17/48), mirroring form-render's
|
|
3
|
-
* `handleRedirect.ts`:
|
|
4
|
-
*
|
|
5
|
-
* - Identity handoff: `leadId` and `sessionId` are appended as query params so
|
|
6
|
-
* the destination page's tag/SDK resolves the same visitor (row 17).
|
|
7
|
-
* - Protocol default matches `addProtocolToUrl` verbatim, including its quirk:
|
|
8
|
-
* the check is `startsWith("https")`, so an explicit `http://` URL gets
|
|
9
|
-
* double-prefixed. Replicated, not fixed — it's on the plan's
|
|
10
|
-
* replicate-then-review list territory (Phase 0 item 5); the parity harness
|
|
11
|
-
* compares against native.
|
|
12
|
-
* - Unparseable URLs pass through unchanged, blank URLs redirect nowhere.
|
|
13
|
-
* - `CurrentWindow` navigates `window.location` — the SDK runs first-party,
|
|
14
|
-
* which is exactly what native's `window.parent.location` resolves to on a
|
|
15
|
-
* top-level page. `NewTab` opens `_blank`.
|
|
16
|
-
* - Preview never navigates (native gates on preview/editing screens).
|
|
17
|
-
*
|
|
18
|
-
* The step engine owns *when* to redirect (per-step + thank-you triggers and
|
|
19
|
-
* the `redirectTimeout ?? 400 ms` delay — the default is exported here);
|
|
20
|
-
* parent-param forwarding via `redirectUrlParams` templating lands with the
|
|
21
|
-
* external-state store work (row 56).
|
|
22
|
-
*/
|
|
23
1
|
export type RedirectType = "NewTab" | "CurrentWindow";
|
|
24
2
|
export declare const DEFAULT_REDIRECT_TIMEOUT_MS = 400;
|
|
25
3
|
export declare const buildRedirectUrl: (url: string, { leadId, sessionId }?: {
|
|
@@ -33,4 +11,3 @@ export declare const performRedirect: ({ url, redirectType, leadId, sessionId, p
|
|
|
33
11
|
sessionId?: string;
|
|
34
12
|
preview?: boolean;
|
|
35
13
|
}) => void;
|
|
36
|
-
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -1,34 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Response payload builders (forms-sdk-plan.md rows 24-26), mirroring
|
|
3
|
-
* form-render's `createResponseApiPayload` exactly — the semantics here are
|
|
4
|
-
* load-bearing server contracts:
|
|
5
|
-
*
|
|
6
|
-
* - **Full answer-set resend on every write** (row 26): all steps' answers
|
|
7
|
-
* plus every external-state entry as a pseudo-answer keyed by its stateId.
|
|
8
|
-
* Server-side UTM preservation depends on the URL_DATA entry riding every
|
|
9
|
-
* update.
|
|
10
|
-
* - `SCHEDULER_AVAILABILITY_DATA` entries are transient client-only data and
|
|
11
|
-
* are never persisted.
|
|
12
|
-
* - Surface-native booking detection: the first answer with
|
|
13
|
-
* `eventScheduled: true` and a non-Calendly/Cal.com `uri` stamps
|
|
14
|
-
* `meta.bookingId`.
|
|
15
|
-
* - `enrichedFields` precedence: person-attribute enrichment wins over the
|
|
16
|
-
* processed APOLLO_EMAIL_ENRICHMENT external state, `{}` as the floor.
|
|
17
|
-
* - `meta.cookies` is stripped when `trackCookies` is off.
|
|
18
|
-
* - Creates pin `responseShapeVersion: "2.0"`; updates carry `responseId`.
|
|
19
|
-
*
|
|
20
|
-
* Types are local structural mirrors of `ZFormResponseData` /
|
|
21
|
-
* `ZFormUpdateResponseData` (zero-runtime-deps); the contract test validates
|
|
22
|
-
* built payloads against the real schemas. Answer/external-state entry shapes
|
|
23
|
-
* are pass-through records — component state shapes belong to the engine.
|
|
24
|
-
*/
|
|
25
1
|
export type SingleFormResponse = {
|
|
26
2
|
questionId: string;
|
|
27
3
|
response: Record<string, unknown>;
|
|
28
4
|
};
|
|
29
|
-
/** Answers grouped per step, keyed stepId → questionId → component state. */
|
|
30
5
|
export type AnswerStates = Record<string, Record<string, Record<string, unknown>>>;
|
|
31
|
-
/** External state entries keyed by stateId; `type` discriminates (URL_DATA, enrichment, …). */
|
|
32
6
|
export type ExternalStates = Record<string, {
|
|
33
7
|
type: string;
|
|
34
8
|
} & Record<string, unknown>>;
|
|
@@ -61,7 +35,6 @@ type BuildPayloadOptions = {
|
|
|
61
35
|
invalidResponse: boolean;
|
|
62
36
|
trackCookies: boolean;
|
|
63
37
|
meta?: Record<string, unknown>;
|
|
64
|
-
/** Person-attribute enrichment; wins over external-state enrichment like native. */
|
|
65
38
|
personAttributeEnrichedFields?: Record<string, unknown>;
|
|
66
39
|
fingerprint?: string;
|
|
67
40
|
leadSessionId?: string;
|
|
@@ -71,4 +44,3 @@ export declare const createUpdateResponsePayload: (options: BuildPayloadOptions
|
|
|
71
44
|
responseId: string;
|
|
72
45
|
}) => FormUpdateResponsePayload;
|
|
73
46
|
export {};
|
|
74
|
-
//# sourceMappingURL=responsePayload.d.ts.map
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Attribution capture (forms-sdk-plan.md row 56): the `URL_DATA`
|
|
3
|
-
* external-state entry that rides every response write and feeds UTM/source
|
|
4
|
-
* attribution. Mirrors the URL-config branch of form-render's
|
|
5
|
-
* `buildExternalStateStore` — same shape (`fullUrl`/`params`/`referrer`/
|
|
6
|
-
* `cookies`, wire-validated against `ZURLData` in the contract test), same
|
|
7
|
-
* `defaultUrl` precedence, same swallow-on-malformed behavior.
|
|
8
|
-
*
|
|
9
|
-
* One structural simplification the self-hosted model earns (plan §4.1): the
|
|
10
|
-
* SDK runs in the page it measures, so `fullUrl`/`referrer`/`cookies` are
|
|
11
|
-
* read directly from `location`/`document` — native needs them relayed
|
|
12
|
-
* through `?url=`/`?referrer=`/`?cookies=` query params by the tag, including
|
|
13
|
-
* cookies as a JSON blob. Cookie capture stays gated by the same
|
|
14
|
-
* `trackCookies` setting.
|
|
15
|
-
*/
|
|
16
1
|
export type UrlData = {
|
|
17
2
|
type: "URL_DATA";
|
|
18
3
|
fullUrl?: string;
|
|
@@ -23,8 +8,6 @@ export type UrlData = {
|
|
|
23
8
|
export declare const constructUrlParamsObject: (url: string) => Record<string, string>;
|
|
24
9
|
export declare const parseCookiesObject: (cookieString: string) => Record<string, string>;
|
|
25
10
|
export declare const buildUrlData: ({ defaultUrl, trackCookies, }?: {
|
|
26
|
-
/** Config-pinned URL that wins over the live page URL, like native. */
|
|
27
11
|
defaultUrl?: string;
|
|
28
12
|
trackCookies?: boolean;
|
|
29
13
|
}) => UrlData;
|
|
30
|
-
//# sourceMappingURL=urlData.d.ts.map
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* URL prefill parsing (forms-sdk-plan.md row 19), same syntax as the native
|
|
3
|
-
* runtime's `useFormUrlParameters`/`parseQuestionId`: any
|
|
4
|
-
* `?<questionId>_<fieldName>=value` query param prefills a field. The param
|
|
5
|
-
* name splits on the FIRST underscore (field names may contain more), both
|
|
6
|
-
* sides are trimmed, `url`/`referrer`/`cookies` are reserved for attribution,
|
|
7
|
-
* and params without an underscore are ignored (no field to target).
|
|
8
|
-
*/
|
|
9
1
|
export type ParsedUrlQuestionId = {
|
|
10
2
|
originalId: string;
|
|
11
3
|
questionId: string;
|
|
@@ -18,4 +10,3 @@ export declare const parseQuestionId: (input: string) => {
|
|
|
18
10
|
fieldName: string | null;
|
|
19
11
|
};
|
|
20
12
|
export declare const parsePrefillParams: (search: string | URLSearchParams) => Record<string, ParsedUrlQuestionId[]> | null;
|
|
21
|
-
//# sourceMappingURL=urlPrefill.d.ts.map
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import type { PushEventClient } from "./pushEvents";
|
|
2
|
-
/**
|
|
3
|
-
* `form_step_dropoff` beacon (forms-sdk-plan.md row 32), form-render's
|
|
4
|
-
* `useBeforeUnload` semantics without React: on `pagehide` — the only
|
|
5
|
-
* teardown event that still delivers beacons reliably — emit the drop-off
|
|
6
|
-
* event for the step the visitor abandoned, but only after the form was
|
|
7
|
-
* started and never for bfcache suspensions (`event.persisted`), which are
|
|
8
|
-
* not abandonment.
|
|
9
|
-
*
|
|
10
|
-
* State is read through a getter at fire time because the current step and
|
|
11
|
-
* session change after the listener attaches (native reads refs for the same
|
|
12
|
-
* reason). Delivery rides the pushEvent client, whose transport is
|
|
13
|
-
* sendBeacon-first — the property that makes a pagehide send survivable.
|
|
14
|
-
*/
|
|
15
2
|
export declare const observeDropoff: (pushEventClient: PushEventClient, getState: () => {
|
|
16
3
|
started: boolean;
|
|
17
4
|
formId: string;
|
|
18
5
|
stepId: string;
|
|
19
6
|
sessionId?: string;
|
|
20
7
|
}) => (() => void);
|
|
21
|
-
//# sourceMappingURL=dropoffDetection.d.ts.map
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Instance-scoped typed event emitter — the primitive behind the SDK's
|
|
3
|
-
* public `form.on(...)` lifecycle surface (forms-sdk-plan.md §2.2) and the
|
|
4
|
-
* store-subscription contract adapters build on (§2.9).
|
|
5
|
-
*
|
|
6
|
-
* Exists because the SDK cannot use Node's EventEmitter (zero runtime deps,
|
|
7
|
-
* browser bundle) and must not reproduce form-render's module-level
|
|
8
|
-
* singleton listeners, which break multi-form pages (§2.7). Handler
|
|
9
|
-
* exceptions are isolated per handler: a throwing host callback never breaks
|
|
10
|
-
* the engine or sibling handlers — the never-break-the-host-page guarantee
|
|
11
|
-
* applied to the callback boundary.
|
|
12
|
-
*
|
|
13
|
-
* The concrete SDK event map (viewed/started/stepChanged/…) is owned by the
|
|
14
|
-
* step engine, which defines the payload shapes it emits; this module is
|
|
15
|
-
* deliberately payload-agnostic.
|
|
16
|
-
*/
|
|
17
1
|
export type Unsubscribe = () => void;
|
|
18
2
|
export type Emitter<TEventMap extends Record<string, unknown>> = {
|
|
19
3
|
on: <K extends keyof TEventMap>(event: K, handler: (payload: TEventMap[K]) => void) => Unsubscribe;
|
|
20
4
|
emit: <K extends keyof TEventMap>(event: K, payload: TEventMap[K]) => void;
|
|
21
5
|
};
|
|
22
6
|
export declare const createEmitter: <TEventMap extends Record<string, unknown>>() => Emitter<TEventMap>;
|
|
23
|
-
//# sourceMappingURL=emitter.d.ts.map
|
|
@@ -1,22 +1,4 @@
|
|
|
1
1
|
import type { Transport } from "../client/transport";
|
|
2
|
-
/**
|
|
3
|
-
* Form-journey step telemetry (forms-sdk-plan.md row 30): visits, transitions,
|
|
4
|
-
* and outcomes beaconed to `POST /api/v1/form-journey/track`. A direct port of
|
|
5
|
-
* form-render's `createFormJourneyTracker` — same ordinal bookkeeping, same
|
|
6
|
-
* close-previous-visit timing, same 50-visit cap with `truncated`, same
|
|
7
|
-
* freeze-on-terminal-outcome, same microtask coalescing (a transition
|
|
8
|
-
* immediately followed by a terminal sends one beacon, so an in-progress
|
|
9
|
-
* write can't race the disqualified one), and the same synchronous flush for
|
|
10
|
-
* the `in_progress` terminal, which only fires from pagehide and cannot
|
|
11
|
-
* depend on a microtask racing page teardown.
|
|
12
|
-
*
|
|
13
|
-
* Wire types are local structural mirrors of the Zod schemas in
|
|
14
|
-
* `@surface/types/v1/formJourney` (zero-runtime-deps); the contract test
|
|
15
|
-
* validates them against the real `ZFormJourneyTrackPayload`. The
|
|
16
|
-
* `transitionMeta`/`matched` payloads are typed opaque here — they are
|
|
17
|
-
* constructed by routing evaluation, which lands with the routing extraction,
|
|
18
|
-
* and the tracker only passes them through.
|
|
19
|
-
*/
|
|
20
2
|
export type FormJourneyOutcome = "in_progress" | "completed" | "partial" | "disqualified" | "dropped_off";
|
|
21
3
|
export type FormJourneyTransitionReason = "initial" | "linear" | "conditional_match" | "default_fallback" | "prefill_jump" | "back_nav" | "auto_skip";
|
|
22
4
|
export type FormJourneyVisit = {
|
|
@@ -66,4 +48,3 @@ export declare const createFormJourneyTracker: ({ transport, preview, }: {
|
|
|
66
48
|
transport: Transport;
|
|
67
49
|
preview?: boolean;
|
|
68
50
|
}) => FormJourneyTracker;
|
|
69
|
-
//# sourceMappingURL=formJourneyTracker.d.ts.map
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import type { Transport } from "../client/transport";
|
|
2
|
-
/**
|
|
3
|
-
* Client for the internal event pipeline `POST /api/v1/pushEvent`
|
|
4
|
-
* (forms-sdk-plan.md row 33), mirroring form-render's `callPushEventApi`:
|
|
5
|
-
* same wire shapes, same client-side bot filter, same required-field guard
|
|
6
|
-
* (any invalid event drops the whole request), same beacon-first delivery.
|
|
7
|
-
* Two deliberate departures, both decided in the plan: no PostHog mirror
|
|
8
|
-
* (Surface-internal telemetry — §1D row 33) and a `preview` flag that blocks
|
|
9
|
-
* every send so agent preview loops never pollute data (§2.2).
|
|
10
|
-
*
|
|
11
|
-
* The wire types below are structural mirrors of the Zod schemas in
|
|
12
|
-
* `@surface/types/v1/surfaceEvent/model/types.ts` — local because the SDK
|
|
13
|
-
* ships with zero runtime dependencies; the contract test in this directory
|
|
14
|
-
* validates them against the real schemas.
|
|
15
|
-
*/
|
|
16
2
|
export type SurfaceEventType = "form_viewed" | "form_started" | "form_completed" | "form_step_viewed" | "form_step_submitted" | "form_step_dropoff" | "form_question_submitted" | "response_submission_created" | "response_submission_error" | "script_initiated";
|
|
17
3
|
export type SurfaceEventEntityType = "form" | "form_step" | "response";
|
|
18
4
|
export type PushEventProperty = {
|
|
@@ -29,7 +15,6 @@ export type PushEventPayload = {
|
|
|
29
15
|
leadId?: string;
|
|
30
16
|
environmentId?: string;
|
|
31
17
|
};
|
|
32
|
-
/** The server accepts exactly one batch shape: a step transition pair. */
|
|
33
18
|
export type PushEventBatch = {
|
|
34
19
|
events: [
|
|
35
20
|
PushEventPayload & {
|
|
@@ -59,4 +44,3 @@ export declare const createPushEventClient: ({ transport, preview, }: {
|
|
|
59
44
|
transport: Transport;
|
|
60
45
|
preview?: boolean;
|
|
61
46
|
}) => PushEventClient;
|
|
62
|
-
//# sourceMappingURL=pushEvents.d.ts.map
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `form_started` detection (forms-sdk-plan.md row 22): native fires it on the
|
|
3
|
-
* first deep-inequality between the current answer state and the snapshot
|
|
4
|
-
* taken at mount, once per form instance (`DualPaneAdjustableForm`'s
|
|
5
|
-
* `startedForm` ref + lodash `isEqual`). The detector captures the snapshot at
|
|
6
|
-
* creation; `check(current)` returns true exactly once, on the first
|
|
7
|
-
* divergence. The local deep-equal covers the answer-state shape (plain
|
|
8
|
-
* objects, arrays, primitives) — key order insensitive, like lodash.
|
|
9
|
-
*/
|
|
10
1
|
export declare const createStartedDetector: <T>(initial: T) => ((current: T) => boolean);
|
|
11
|
-
//# sourceMappingURL=startedDetection.d.ts.map
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `form_viewed` detection (forms-sdk-plan.md row 21): an IntersectionObserver
|
|
3
|
-
* on the bound form root, firing the callback exactly once per observer —
|
|
4
|
-
* form-render's `useDetectFormView` semantics with its React scaffolding
|
|
5
|
-
* removed. The once-guard replaces native's belt-and-braces 1 s throttle:
|
|
6
|
-
* with a single fire per instance there is nothing left to throttle. The
|
|
7
|
-
* caller (bind layer / engine) emits `form_viewed` + first-step
|
|
8
|
-
* `form_step_viewed`, exactly what native's throttled callback did.
|
|
9
|
-
*
|
|
10
|
-
* If `IntersectionObserver` is unavailable the callback fires immediately —
|
|
11
|
-
* losing view analytics entirely is worse than counting a below-fold mount,
|
|
12
|
-
* and native never handled this case (it would throw).
|
|
13
|
-
*/
|
|
14
1
|
export declare const observeFormView: (element: Element, onViewed: () => void) => (() => void);
|
|
15
|
-
//# sourceMappingURL=viewDetection.d.ts.map
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canonical browser-fingerprint implementation for Surface lead identity.
|
|
3
|
-
*
|
|
4
|
-
* The lead-identity pipeline keys on the SHA-256 of `JSON.stringify` over the
|
|
5
|
-
* collected fields, so the object's insertion order, value shapes, and falsy
|
|
6
|
-
* fallbacks (`||`, not `??`) ARE the wire contract: any deviation produces a
|
|
7
|
-
* different hash and splits one visitor into two leads. Do not reorder fields,
|
|
8
|
-
* rename keys, or change fallback behavior here without a coordinated
|
|
9
|
-
* migration.
|
|
10
|
-
*
|
|
11
|
-
* This module supersedes the two byte-identical copies it was lifted from —
|
|
12
|
-
* `packages/form-render/src/lib/client/leads/browserFingerprint.ts` and the
|
|
13
|
-
* public tag's `src/lead/fingerprint.ts` (trysurface/scripts) — which consume
|
|
14
|
-
* it over time (forms-sdk-plan.md, parity row 9). The identity test in this
|
|
15
|
-
* directory pins hash equality against the form-render copy.
|
|
16
|
-
*/
|
|
17
1
|
export type Fingerprint = {
|
|
18
2
|
deviceType: "Mobile" | "Desktop";
|
|
19
3
|
screen: {
|
|
@@ -28,13 +12,10 @@ export type Fingerprint = {
|
|
|
28
12
|
}>;
|
|
29
13
|
os: string;
|
|
30
14
|
language: string;
|
|
31
|
-
/** Absent (never null/empty) when `navigator.plugins` is null. */
|
|
32
15
|
plugins?: string[];
|
|
33
16
|
timezone: string;
|
|
34
17
|
environmentId: string;
|
|
35
|
-
/** SHA-256 hex of the serialized fields above. */
|
|
36
18
|
id: string;
|
|
37
19
|
};
|
|
38
20
|
export declare function getHash(input: string): Promise<string>;
|
|
39
21
|
export declare const getBrowserFingerprint: (environmentId: string) => Promise<Fingerprint>;
|
|
40
|
-
//# sourceMappingURL=browserFingerprint.d.ts.map
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import type { Transport } from "../client/transport";
|
|
2
2
|
import { type LeadSource } from "./identify";
|
|
3
3
|
import { type CachedLeadData } from "./leadDataCache";
|
|
4
|
-
/**
|
|
5
|
-
* The boot-sequence identity step (forms-sdk-plan.md §2.2): resolve the
|
|
6
|
-
* visitor before any response write, since attribute sync silently no-ops for
|
|
7
|
-
* responses whose lead was never identified (row 60). Mirrors the tag's
|
|
8
|
-
* `identifyLead` flow: a fresh cache entry with a session and fingerprint
|
|
9
|
-
* skips the network entirely; otherwise compute the fingerprint, carry any
|
|
10
|
-
* cached leadId/session forward so the server can preserve identity, and
|
|
11
|
-
* cache the result under the shared tag key.
|
|
12
|
-
*
|
|
13
|
-
* `preview: true` blocks the identify call outright — the preview contract
|
|
14
|
-
* (§2.2) is that drafts never create leads. Concurrent calls (multi-form
|
|
15
|
-
* pages) may race one identify each; that is safe — the server find-or-creates
|
|
16
|
-
* by fingerprint, so both resolve to the same lead — and avoids the tag's
|
|
17
|
-
* module-level in-flight flag, which the SDK's instance-scoped rule forbids.
|
|
18
|
-
*/
|
|
19
4
|
export declare const ensureIdentified: ({ transport, environmentId, formId, pageUrl, source, preview, }: {
|
|
20
5
|
transport: Transport;
|
|
21
6
|
environmentId: string;
|
|
@@ -24,4 +9,3 @@ export declare const ensureIdentified: ({ transport, environmentId, formId, page
|
|
|
24
9
|
source?: LeadSource;
|
|
25
10
|
preview?: boolean;
|
|
26
11
|
}) => Promise<CachedLeadData | null>;
|
|
27
|
-
//# sourceMappingURL=ensureIdentified.d.ts.map
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import type { Transport } from "../client/transport";
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper for `POST /api/v1/lead/identify` (forms-sdk-plan.md row 10),
|
|
4
|
-
* mirroring form-render's `identifyLeadForFormRequest`: same payload fields,
|
|
5
|
-
* same URL normalization (trailing slashes stripped from href and pathname),
|
|
6
|
-
* same keepalive delivery, same `data.data` response unwrap, null on any
|
|
7
|
-
* failure. The wire types are structural mirrors of `ZLeadIdentifyPayload`
|
|
8
|
-
* (`@surface/types/v1/lead/app/types.ts`) — local because the SDK ships with
|
|
9
|
-
* zero runtime dependencies; the contract test validates them against the
|
|
10
|
-
* real schema.
|
|
11
|
-
*
|
|
12
|
-
* `source` defaults to `"sdkForm"` — the dedicated SDK value (Decisions #8),
|
|
13
|
-
* so SDK-originated leads stay distinguishable from the native runtime's
|
|
14
|
-
* `"surfaceForm"` in the leads hub and analytics.
|
|
15
|
-
*/
|
|
16
2
|
export type LeadSource = "surfaceForm" | "htmlForm" | "websiteDeAnon" | "webhook" | "website" | "imported" | "scheduler" | "linkedin" | "sdkForm";
|
|
17
3
|
export type IdentifyPayload = {
|
|
18
4
|
environmentId: string;
|
|
@@ -45,4 +31,3 @@ export declare const buildIdentifyPayload: ({ environmentId, fingerprintId, page
|
|
|
45
31
|
referrer?: string | null;
|
|
46
32
|
}) => IdentifyPayload;
|
|
47
33
|
export declare const identifyLead: (transport: Transport, payload: IdentifyPayload) => Promise<IdentifyResult | null>;
|
|
48
|
-
//# sourceMappingURL=identify.d.ts.map
|
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
import type { Transport } from "../client/transport";
|
|
2
|
-
/**
|
|
3
|
-
* Opt-in user-journey page-view tracking (forms-sdk-plan.md row 16), the
|
|
4
|
-
* SDK's `journey: true` module. Mirrors the public tag's implementation
|
|
5
|
-
* (trysurface/scripts `src/store/{user-journey,journey-cookies}.ts`, verified
|
|
6
|
-
* at HEAD): same cookies (`surface_journey_id`, 60 d, eTLD+1 domain;
|
|
7
|
-
* `surface_recent_visit`, 1 d), same duplicate-URL skip, same delivery split —
|
|
8
|
-
* beacon when the journey id is already known (nothing to read back), fetch
|
|
9
|
-
* when it isn't so the server-issued id can be captured — and the same
|
|
10
|
-
* history-patching SPA route detection.
|
|
11
|
-
*
|
|
12
|
-
* Journey→response stitching stays server-side (UTM backfill on response
|
|
13
|
-
* create); the client's only job is delivering page views under a stable id.
|
|
14
|
-
*/
|
|
15
2
|
export declare const JOURNEY_COOKIE_NAME = "surface_journey_id";
|
|
16
3
|
export declare const RECENT_VISIT_COOKIE_NAME = "surface_recent_visit";
|
|
17
4
|
export type JourneyTracker = {
|
|
18
5
|
trackPageView: (url?: string) => Promise<void>;
|
|
19
|
-
/** Patches history + popstate; returns a teardown restoring the originals. */
|
|
20
6
|
observeRouteChanges: () => () => void;
|
|
21
|
-
/** Deletes both journey cookies — the native clear-on-first-step-completion hook. */
|
|
22
7
|
clear: () => void;
|
|
23
8
|
};
|
|
24
9
|
export declare const createJourneyTracker: ({ transport, environmentId, }: {
|
|
25
10
|
transport: Transport;
|
|
26
11
|
environmentId: string;
|
|
27
12
|
}) => JourneyTracker;
|
|
28
|
-
//# sourceMappingURL=journey.d.ts.map
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TTL-stamped lead-identity cache (forms-sdk-plan.md row 11), byte-compatible
|
|
3
|
-
* with the public tag's `surfaceLeadData` localStorage entry — same key, same
|
|
4
|
-
* shape, same 10-minute TTL, same remove-on-expiry read semantics
|
|
5
|
-
* (trysurface/scripts `src/lead/identify.ts`).
|
|
6
|
-
*
|
|
7
|
-
* Sharing the tag's key IS the interop rule (plan §4.1): on a page where the
|
|
8
|
-
* tag is also installed, the SDK reads the identity the tag already resolved
|
|
9
|
-
* and skips its own identify — and vice versa — so both agree on the visitor
|
|
10
|
-
* without any cross-component protocol.
|
|
11
|
-
*
|
|
12
|
-
* Every access is guarded: no localStorage (SSR) reads as a cache miss, and
|
|
13
|
-
* storage exceptions (Safari private mode, quota) are swallowed — cache loss
|
|
14
|
-
* only costs an extra identify round-trip.
|
|
15
|
-
*/
|
|
16
1
|
export declare const LEAD_DATA_STORAGE_KEY = "surfaceLeadData";
|
|
17
2
|
export declare const LEAD_DATA_TTL_MS: number;
|
|
18
3
|
export type CachedLeadData = {
|
|
@@ -24,4 +9,3 @@ export type CachedLeadData = {
|
|
|
24
9
|
};
|
|
25
10
|
export declare const readLeadData: () => CachedLeadData | null;
|
|
26
11
|
export declare const writeLeadData: (data: Omit<CachedLeadData, "expiry">) => void;
|
|
27
|
-
//# sourceMappingURL=leadDataCache.d.ts.map
|
|
@@ -1,25 +1,5 @@
|
|
|
1
1
|
import type { Transport } from "../core/client/transport";
|
|
2
2
|
import type { FormEngine } from "../core/engine/formEngine";
|
|
3
|
-
/**
|
|
4
|
-
* Real-time identity enrichment for SDK forms (field-run finding 4.10): the
|
|
5
|
-
* native renderer fires `/api/v1/services/enrichment/realtime` on blur of the
|
|
6
|
-
* IdentityInfo `enrichmentSourceField` (or `websiteUrl`, or EmailForm's email)
|
|
7
|
-
* and stores the result as the `selfServeEnrichment` APOLLO_EMAIL_ENRICHMENT
|
|
8
|
-
* external state — which the response payload forwards as `enrichedFields`
|
|
9
|
-
* and which drives field autofill. The SDK has no blur moment (headless
|
|
10
|
-
* callers have no DOM at all), so the trigger is a debounced answer-watch: a
|
|
11
|
-
* candidate value that is a valid email/domain and has been stable for
|
|
12
|
-
* `DEBOUNCE_MS` fires once (deduped per value, native semantics); completing
|
|
13
|
-
* a step flushes the pending debounce so a type-then-advance never loses the
|
|
14
|
-
* window. The request is never awaited — submission must not block on the
|
|
15
|
-
* vendor API — so a result can resolve after the finishing write; the engine
|
|
16
|
-
* persists it anyway by amending the stored response on setExternalState.
|
|
17
|
-
* Results merge existing-keys-win, exactly like native's G2 rule — a later
|
|
18
|
-
* trigger only fills gaps.
|
|
19
|
-
*
|
|
20
|
-
* The provider key never reaches the page: the endpoint resolves it
|
|
21
|
-
* server-side and is rate-limited per-IP and per-form.
|
|
22
|
-
*/
|
|
23
3
|
export type EnrichmentSource = {
|
|
24
4
|
questionId: string;
|
|
25
5
|
fieldNames: string[];
|
|
@@ -32,4 +12,3 @@ export type AttachEnrichmentOptions = {
|
|
|
32
12
|
sources: EnrichmentSource[];
|
|
33
13
|
};
|
|
34
14
|
export declare const attachEnrichment: ({ engine, transport, formId, sources, }: AttachEnrichmentOptions) => (() => void);
|
|
35
|
-
//# sourceMappingURL=attachEnrichment.d.ts.map
|