@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
package/dist/types/index.d.ts
CHANGED
|
@@ -25,4 +25,3 @@ export { LEAD_DATA_STORAGE_KEY, LEAD_DATA_TTL_MS, readLeadData, writeLeadData, t
|
|
|
25
25
|
export { ENRICHMENT_STATE_ID, attachEnrichment, type AttachEnrichmentOptions, type EnrichmentSource, } from "./enrichment/attachEnrichment";
|
|
26
26
|
export { SurfaceForms, type SurfaceForm, type SurfaceFormsInitOptions } from "./surfaceForms";
|
|
27
27
|
export { attachEmailValidation, type AttachEmailValidationOptions } from "./validation/attachEmailValidation";
|
|
28
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import type { FormEngine, FormEngineState } from "../core/engine/formEngine";
|
|
2
|
-
/**
|
|
3
|
-
* React adapter (forms-sdk-plan.md §2.9): a thin `useSyncExternalStore`
|
|
4
|
-
* subscription over the headless engine's store contract. The host renders
|
|
5
|
-
* the current step from `state` with controlled inputs; every action is the
|
|
6
|
-
* engine's own method, so engine semantics are identical to the `bind/` mode
|
|
7
|
-
* by construction — only who applies visibility differs.
|
|
8
|
-
*
|
|
9
|
-
* Server snapshots reuse `engine.state()`: the engine is SSR-safe to create
|
|
10
|
-
* (no DOM access until interaction), so hydration sees the initial step.
|
|
11
|
-
*/
|
|
12
2
|
export type UseSurfaceFormResult = {
|
|
13
3
|
state: FormEngineState;
|
|
14
4
|
setAnswer: FormEngine["setAnswer"];
|
|
@@ -22,4 +12,3 @@ export type UseSurfaceFormResult = {
|
|
|
22
12
|
on: FormEngine["on"];
|
|
23
13
|
};
|
|
24
14
|
export declare const useSurfaceForm: (engine: FormEngine) => UseSurfaceFormResult;
|
|
25
|
-
//# sourceMappingURL=useSurfaceForm.d.ts.map
|
|
@@ -3,118 +3,46 @@ import { type RuntimeConfig } from "./core/client/runtimeConfig";
|
|
|
3
3
|
import { type FormEngine, type ResolveNextStep } from "./core/engine/formEngine";
|
|
4
4
|
import type { LeadSource } from "./core/identity/identify";
|
|
5
5
|
import { type TrackingSettings } from "./tracking/attachTracking";
|
|
6
|
-
/**
|
|
7
|
-
* The public entry point (forms-sdk-plan.md §2.2): composes the boot sequence
|
|
8
|
-
* in the native, load-bearing order — identify before the first write (row
|
|
9
|
-
* 60: attribute sync silently no-ops otherwise) — then wires events, journey,
|
|
10
|
-
* drop-off, and the optional DOM binding around one engine instance.
|
|
11
|
-
*
|
|
12
|
-
* **The form definition boots from the runtime-config endpoint** (§2.3,
|
|
13
|
-
* Decisions #7): when `steps` is omitted, init fetches the published record
|
|
14
|
-
* and derives the step order, the behavioral settings gates, and the expected
|
|
15
|
-
* questionIds for the §4.3 drift warning. Caller-provided `steps`/`settings`/
|
|
16
|
-
* `expectedQuestionIds` still win — offline tests and agents that already
|
|
17
|
-
* hold the record skip the fetch entirely.
|
|
18
|
-
*
|
|
19
|
-
* `preview: true` replicates the native guarantee that previews never pollute
|
|
20
|
-
* data (§2.2): identify, response writes, pushEvents, form-journey, and the
|
|
21
|
-
* journey module are all blocked client-side.
|
|
22
|
-
*/
|
|
23
6
|
export type SurfaceFormsInitOptions = {
|
|
24
7
|
environmentId: string;
|
|
25
8
|
formId: string;
|
|
26
|
-
/** Ordered logical steps of the form record; omitted = fetched from runtime-config. */
|
|
27
9
|
steps?: Array<{
|
|
28
10
|
id: string;
|
|
29
11
|
endStepKind?: "thank_you" | "disqualified";
|
|
30
12
|
}>;
|
|
31
|
-
/**
|
|
32
|
-
* Behavioral gates + customer-tag config (rows 51–55). Omitted values fill
|
|
33
|
-
* from runtime-config ONLY when `steps` is also omitted (the record fetch) —
|
|
34
|
-
* caller-provided `steps` skip the fetch entirely, so pass tracking settings
|
|
35
|
-
* explicitly in that offline mode.
|
|
36
|
-
*/
|
|
37
13
|
settings?: {
|
|
38
14
|
trackPartialResponses?: boolean;
|
|
39
15
|
trackCookies?: boolean;
|
|
40
16
|
} & TrackingSettings;
|
|
41
17
|
apiBaseUrl?: string;
|
|
42
|
-
/** Enables the bind/ layer + view detection on this root. */
|
|
43
18
|
container?: Element;
|
|
44
|
-
/** Stateful questionIds from the record; unbound ones get the §4.3 runtime warning. */
|
|
45
19
|
expectedQuestionIds?: string[];
|
|
46
|
-
/** Routing evaluation; defaults to linear order until the extracted routing module lands. */
|
|
47
20
|
resolveNextStep?: ResolveNextStep;
|
|
48
|
-
/** Seeds a URL_DATA external-state entry under this id (attribution, row 56). */
|
|
49
21
|
urlDataStateId?: string;
|
|
50
22
|
source?: LeadSource;
|
|
51
|
-
/** Page-view tracking module (tag parity), default off. */
|
|
52
23
|
journey?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Automatic waterfall email validation (row 37), default off: watches
|
|
55
|
-
* email answers (debounced, per-address verdicts, fail-open) and annotates
|
|
56
|
-
* the response `meta` with native's `isEmailValid`/`emailValidation`/
|
|
57
|
-
* `emailValidationFailed` keys. Opt-in because verdicts spend the form
|
|
58
|
-
* owner's validator quota. The on-demand `validateEmail` on the handle is
|
|
59
|
-
* always available and shares the same per-address cache.
|
|
60
|
-
*/
|
|
61
24
|
emailValidation?: boolean;
|
|
62
25
|
preview?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Signed token from the create_form / get_sdk_binding_map replies; with
|
|
65
|
-
* `preview: true` it unlocks the DRAFT config of a never-published form.
|
|
66
|
-
* Without it, preview serves the published config.
|
|
67
|
-
*/
|
|
68
26
|
previewToken?: string;
|
|
69
|
-
/**
|
|
70
|
-
* Resume a stored response: pass the `responseId` + `resumeToken` pair a
|
|
71
|
-
* previous session's create returned (`state().resumeToken`, or the `saved`
|
|
72
|
-
* event). Boot fetches the stored answers through the token-gated read-back
|
|
73
|
-
* and seeds the engine — writes become updates and earlier answers are
|
|
74
|
-
* preserved; a failed fetch warns and starts fresh. Ignored in preview.
|
|
75
|
-
*/
|
|
76
27
|
resume?: {
|
|
77
28
|
responseId: string;
|
|
78
29
|
resumeToken: string;
|
|
79
30
|
};
|
|
80
|
-
/** Logs every captured answer and warns on states the server would reject (unknown questionId, wrong/missing type, malformed choices). Development aid; never enable in production. */
|
|
81
31
|
debug?: boolean;
|
|
82
32
|
meta?: Record<string, unknown>;
|
|
83
33
|
};
|
|
84
34
|
export type SurfaceForm = Pick<FormEngine, "setAnswer" | "setExternalState" | "next" | "back" | "goToStep" | "submit" | "disqualify" | "savePartial" | "flush" | "markViewed" | "on" | "state" | "subscribe"> & {
|
|
85
|
-
/** Re-runs identify (e.g. after an SPA route change); cache makes it cheap. */
|
|
86
35
|
identify: () => Promise<unknown>;
|
|
87
|
-
/**
|
|
88
|
-
* On-demand waterfall email validation (row 37): resolves a per-address
|
|
89
|
-
* deliverability verdict, cached for the form's lifetime and fail-open on
|
|
90
|
-
* validator outage. Use it to gate your own navigation:
|
|
91
|
-
* `if ((await form.validateEmail(value)).isValid) form.next()`.
|
|
92
|
-
* In preview it resolves a synthetic valid verdict without network.
|
|
93
|
-
*/
|
|
94
36
|
validateEmail: (email: string) => Promise<EmailValidationResult>;
|
|
95
|
-
/**
|
|
96
|
-
* Records caller-computed values (a qualification score, an A/B bucket, …)
|
|
97
|
-
* onto the response `meta` — they ride the next save, or amend the stored
|
|
98
|
-
* response when the form already finished. SDK-owned keys
|
|
99
|
-
* (`surfaceTagStatus` and the email-validation verdicts) are dropped with a
|
|
100
|
-
* console warning: dashboards trust those.
|
|
101
|
-
*/
|
|
102
37
|
mergeMeta: (partial: Record<string, unknown>) => void;
|
|
103
|
-
/**
|
|
104
|
-
* What actually runs in THIS environment — the record can declare features
|
|
105
|
-
* (an enrichment source field) that the environment does not back with a
|
|
106
|
-
* provider, and nothing else surfaces that.
|
|
107
|
-
*/
|
|
108
38
|
capabilities: {
|
|
109
39
|
enrichment: boolean;
|
|
110
40
|
emailValidation: boolean;
|
|
111
41
|
tracking: boolean;
|
|
112
42
|
};
|
|
113
|
-
/** The fetched published record (labels, component types); undefined when `steps` was caller-provided. */
|
|
114
43
|
runtimeConfig?: RuntimeConfig;
|
|
115
44
|
destroy: () => void;
|
|
116
45
|
};
|
|
117
46
|
export declare const SurfaceForms: {
|
|
118
47
|
init: ({ environmentId, formId, steps, settings, apiBaseUrl, container, expectedQuestionIds, resolveNextStep, urlDataStateId, source, journey, emailValidation, preview, previewToken, debug, resume, meta, }: SurfaceFormsInitOptions) => Promise<SurfaceForm>;
|
|
119
48
|
};
|
|
120
|
-
//# sourceMappingURL=surfaceForms.d.ts.map
|
|
@@ -1,27 +1,6 @@
|
|
|
1
1
|
import type { FormEngine } from "../core/engine/formEngine";
|
|
2
2
|
import { type AdConversionRule } from "./conversionRules";
|
|
3
3
|
import { type VendorSettings } from "./vendors";
|
|
4
|
-
/**
|
|
5
|
-
* Phase-2 tracking runtime (forms-sdk-plan.md rows 51–55): binds one engine
|
|
6
|
-
* instance to the customer-tag lifecycle events and the ad-conversion rule
|
|
7
|
-
* engine. Trigger moments mirror `useConversionRules`' semantics translated
|
|
8
|
-
* from React effects to engine events:
|
|
9
|
-
*
|
|
10
|
-
* - `form_started`: the response row landing (first `saved`) in a session that
|
|
11
|
-
* began without a responseId — a resume never refires.
|
|
12
|
-
* - `step_submitted`: the first `stepCompleted` of the session.
|
|
13
|
-
* - `reached_step`: every step that becomes current (including the initial
|
|
14
|
-
* one), once per step — back-nav never refires.
|
|
15
|
-
* - terminal (`reached_qualified` + `form_submitted` union, deduped by rule):
|
|
16
|
-
* the `completed` event; a disqualified finish never fires.
|
|
17
|
-
* - `email_provided` / `meeting_booked`: first non-empty email answer / first
|
|
18
|
-
* scheduler state with `eventScheduled` — detected via `subscribe`.
|
|
19
|
-
*
|
|
20
|
-
* Every rule fires once per instance; `responseId` stays the platform-side
|
|
21
|
-
* dedupe key, so moments reached before the first write queue and flush when
|
|
22
|
-
* `saved` delivers the id (native's pending-refs, minus the React plumbing).
|
|
23
|
-
* All state is instance-scoped (§2.7) — two forms on one page track separately.
|
|
24
|
-
*/
|
|
25
4
|
export type TrackingSettings = VendorSettings & {
|
|
26
5
|
adsConversions?: AdConversionRule[];
|
|
27
6
|
};
|
|
@@ -32,4 +11,3 @@ export type AttachTrackingOptions = {
|
|
|
32
11
|
win?: Window;
|
|
33
12
|
};
|
|
34
13
|
export declare const attachTracking: ({ engine, formId, settings, win }: AttachTrackingOptions) => (() => void);
|
|
35
|
-
//# sourceMappingURL=attachTracking.d.ts.map
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ad-conversion rule engine (forms-sdk-plan.md row 55): a dependency-free port
|
|
3
|
-
* of form-render's `adConversions/{evaluateRules,fireConversion}.ts` and the
|
|
4
|
-
* `ZAdConversionRule` settings schema. The SDK always runs first-party, so the
|
|
5
|
-
* native parent-page/postMessage/ack hop disappears — matching rules fire
|
|
6
|
-
* directly on this window. Rule semantics, provider payloads, and the
|
|
7
|
-
* `responseId` dedupe key are identical by construction; the contract test
|
|
8
|
-
* validates these local types against the real Zod schema.
|
|
9
|
-
*/
|
|
10
1
|
export type AdConversionProvider = "x" | "meta" | "openai" | "ga4" | "linkedin";
|
|
11
2
|
export type AdConversionTrigger = "reached_qualified" | "form_submitted" | "reached_step" | "form_started" | "step_submitted" | "email_provided" | "meeting_booked";
|
|
12
3
|
export type AdConversionCondition = {
|
|
@@ -77,11 +68,8 @@ export declare const DEFAULT_OPENAI_EVENT_NAME = "lead_created";
|
|
|
77
68
|
export declare const matchesCondition: (condition: AdConversionCondition, params: TrackingParams) => boolean;
|
|
78
69
|
export declare const matchesConditions: (conditions: AdConversionCondition[], params: TrackingParams, operator?: "and" | "or") => boolean;
|
|
79
70
|
export declare const ruleToConversionEvent: (rule: AdConversionRule) => ConversionEvent | null;
|
|
80
|
-
/** Rules firing for this trigger given the page's tracking params; `reached_step` also needs the step id to match. */
|
|
81
71
|
export declare const selectFiringEvents: (rules: AdConversionRule[], trigger: AdConversionTrigger, params: TrackingParams, stepId?: string) => {
|
|
82
72
|
rule: AdConversionRule;
|
|
83
73
|
conversion: ConversionEvent;
|
|
84
74
|
}[];
|
|
85
|
-
/** Fire one conversion on this window. Best-effort: silent under ad blockers, never throws into the form. */
|
|
86
75
|
export declare const fireConversion: (win: Window, conversion: ConversionEvent, ctx: FireContext) => boolean;
|
|
87
|
-
//# sourceMappingURL=conversionRules.d.ts.map
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Customer-tag bootstrap + lifecycle emission (forms-sdk-plan.md rows 51–54,
|
|
3
|
-
* 58): GTM container, GA4, Meta Pixel, and HubSpot from the form's settings,
|
|
4
|
-
* with the same don't-double-inject guards as the native runtime and the
|
|
5
|
-
* parent tag. No React, no react-gtm-module / react-facebook-pixel — direct
|
|
6
|
-
* global bootstraps like the parent tag's providers.
|
|
7
|
-
*
|
|
8
|
-
* Three native quirks are FIXED here by decision (2026-08-10, memory +
|
|
9
|
-
* plan rows 51–52) — the parity harness whitelists them as intentional diffs:
|
|
10
|
-
* - GTM `SurfaceFormSubmitEvent` carries `formId` (native omits it).
|
|
11
|
-
* - `stepId` in `SurfaceFormStepSubmitted` is the real step id (native sends
|
|
12
|
-
* the step *name*) — migration note for name-keyed GTM triggers.
|
|
13
|
-
* - GA4 config does NOT hardcode `debug_mode: true`.
|
|
14
|
-
*/
|
|
15
1
|
export type LifecycleUrlData = {
|
|
16
2
|
url: string;
|
|
17
3
|
urlParams: Record<string, string>;
|
|
@@ -25,22 +11,14 @@ export type VendorSettings = {
|
|
|
25
11
|
};
|
|
26
12
|
};
|
|
27
13
|
export type StepSubmittedPayload = LifecycleUrlData & {
|
|
28
|
-
/** Quirk fix: the real step id — native sends the step name here. */
|
|
29
14
|
stepId: string;
|
|
30
15
|
formId: string;
|
|
31
16
|
emailProvided: boolean;
|
|
32
17
|
meetingBooked: boolean;
|
|
33
18
|
};
|
|
34
|
-
/**
|
|
35
|
-
* One instance per SurfaceForms.init (no module-level singletons — §2.7):
|
|
36
|
-
* injects the configured vendors immediately, exposes the three lifecycle
|
|
37
|
-
* emitters with native event names/payload keys (they are customers' GTM
|
|
38
|
-
* trigger contracts).
|
|
39
|
-
*/
|
|
40
19
|
export declare const createVendorTracker: (win: Window, settings: VendorSettings) => {
|
|
41
20
|
formStarted: (formId: string, urlData: LifecycleUrlData) => void;
|
|
42
21
|
stepSubmitted: (payload: StepSubmittedPayload) => void;
|
|
43
22
|
formCompleted: (formId: string, urlData: LifecycleUrlData) => void;
|
|
44
23
|
};
|
|
45
24
|
export type VendorTracker = ReturnType<typeof createVendorTracker>;
|
|
46
|
-
//# sourceMappingURL=vendors.d.ts.map
|
|
@@ -5,9 +5,8 @@ Exhaustive reference for the `core/identity` domain. Map of everything: [`../api
|
|
|
5
5
|
## Fingerprint (`core/identity/browserFingerprint`)
|
|
6
6
|
|
|
7
7
|
- **`getBrowserFingerprint(environmentId): Promise<Fingerprint>`** — the canonical Surface
|
|
8
|
-
fingerprint.
|
|
9
|
-
|
|
10
|
-
your own variant — a different serialization splits one visitor into two leads.
|
|
8
|
+
fingerprint. Its serialization is a server-side identity contract: always use this function
|
|
9
|
+
as-is — a hand-rolled variant produces a different `id` and splits one visitor into two leads.
|
|
11
10
|
- **`getHash(input): Promise<string>`** — SHA-256 hex via Web Crypto.
|
|
12
11
|
|
|
13
12
|
```ts
|
package/package.json
CHANGED