@parag.more.withsurface.com/forms-sdk 0.1.4

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.
Files changed (177) hide show
  1. package/README.md +63 -0
  2. package/dist/index.cjs +2737 -0
  3. package/dist/index.cjs.map +7 -0
  4. package/dist/index.mjs +2714 -0
  5. package/dist/index.mjs.map +7 -0
  6. package/dist/react/index.cjs +44 -0
  7. package/dist/react/index.cjs.map +7 -0
  8. package/dist/react/index.mjs +21 -0
  9. package/dist/react/index.mjs.map +7 -0
  10. package/dist/surface-forms-sdk.min.js +2 -0
  11. package/dist/surface-forms-sdk.min.js.map +7 -0
  12. package/dist/types/bind/bindForm.d.ts +43 -0
  13. package/dist/types/bind/bindForm.d.ts.map +1 -0
  14. package/dist/types/bind/bindForm.test.d.ts +2 -0
  15. package/dist/types/bind/bindForm.test.d.ts.map +1 -0
  16. package/dist/types/bind/bookingWidget.d.ts +35 -0
  17. package/dist/types/bind/bookingWidget.d.ts.map +1 -0
  18. package/dist/types/bind/bookingWidget.test.d.ts +2 -0
  19. package/dist/types/bind/bookingWidget.test.d.ts.map +1 -0
  20. package/dist/types/core/client/emailValidation.d.ts +23 -0
  21. package/dist/types/core/client/emailValidation.d.ts.map +1 -0
  22. package/dist/types/core/client/emailValidation.test.d.ts +2 -0
  23. package/dist/types/core/client/emailValidation.test.d.ts.map +1 -0
  24. package/dist/types/core/client/responses.d.ts +35 -0
  25. package/dist/types/core/client/responses.d.ts.map +1 -0
  26. package/dist/types/core/client/responses.test.d.ts +2 -0
  27. package/dist/types/core/client/responses.test.d.ts.map +1 -0
  28. package/dist/types/core/client/runtimeConfig.contract.test.d.ts +2 -0
  29. package/dist/types/core/client/runtimeConfig.contract.test.d.ts.map +1 -0
  30. package/dist/types/core/client/runtimeConfig.d.ts +72 -0
  31. package/dist/types/core/client/runtimeConfig.d.ts.map +1 -0
  32. package/dist/types/core/client/runtimeConfig.test.d.ts +2 -0
  33. package/dist/types/core/client/runtimeConfig.test.d.ts.map +1 -0
  34. package/dist/types/core/client/scheduler.contract.test.d.ts +2 -0
  35. package/dist/types/core/client/scheduler.contract.test.d.ts.map +1 -0
  36. package/dist/types/core/client/scheduler.d.ts +121 -0
  37. package/dist/types/core/client/scheduler.d.ts.map +1 -0
  38. package/dist/types/core/client/scheduler.test.d.ts +2 -0
  39. package/dist/types/core/client/scheduler.test.d.ts.map +1 -0
  40. package/dist/types/core/client/transport.d.ts +56 -0
  41. package/dist/types/core/client/transport.d.ts.map +1 -0
  42. package/dist/types/core/client/transport.test.d.ts +2 -0
  43. package/dist/types/core/client/transport.test.d.ts.map +1 -0
  44. package/dist/types/core/engine/answerAudit.d.ts +21 -0
  45. package/dist/types/core/engine/answerAudit.d.ts.map +1 -0
  46. package/dist/types/core/engine/answerAudit.test.d.ts +2 -0
  47. package/dist/types/core/engine/answerAudit.test.d.ts.map +1 -0
  48. package/dist/types/core/engine/answerStates.contract.test.d.ts +2 -0
  49. package/dist/types/core/engine/answerStates.contract.test.d.ts.map +1 -0
  50. package/dist/types/core/engine/answerStates.d.ts +92 -0
  51. package/dist/types/core/engine/answerStates.d.ts.map +1 -0
  52. package/dist/types/core/engine/formEngine.d.ts +145 -0
  53. package/dist/types/core/engine/formEngine.d.ts.map +1 -0
  54. package/dist/types/core/engine/formEngine.test.d.ts +2 -0
  55. package/dist/types/core/engine/formEngine.test.d.ts.map +1 -0
  56. package/dist/types/core/engine/redirect.d.ts +36 -0
  57. package/dist/types/core/engine/redirect.d.ts.map +1 -0
  58. package/dist/types/core/engine/redirect.test.d.ts +2 -0
  59. package/dist/types/core/engine/redirect.test.d.ts.map +1 -0
  60. package/dist/types/core/engine/responsePayload.contract.test.d.ts +2 -0
  61. package/dist/types/core/engine/responsePayload.contract.test.d.ts.map +1 -0
  62. package/dist/types/core/engine/responsePayload.d.ts +74 -0
  63. package/dist/types/core/engine/responsePayload.d.ts.map +1 -0
  64. package/dist/types/core/engine/responsePayload.test.d.ts +2 -0
  65. package/dist/types/core/engine/responsePayload.test.d.ts.map +1 -0
  66. package/dist/types/core/engine/urlData.contract.test.d.ts +2 -0
  67. package/dist/types/core/engine/urlData.contract.test.d.ts.map +1 -0
  68. package/dist/types/core/engine/urlData.d.ts +30 -0
  69. package/dist/types/core/engine/urlData.d.ts.map +1 -0
  70. package/dist/types/core/engine/urlData.test.d.ts +2 -0
  71. package/dist/types/core/engine/urlData.test.d.ts.map +1 -0
  72. package/dist/types/core/engine/urlPrefill.d.ts +21 -0
  73. package/dist/types/core/engine/urlPrefill.d.ts.map +1 -0
  74. package/dist/types/core/engine/urlPrefill.test.d.ts +2 -0
  75. package/dist/types/core/engine/urlPrefill.test.d.ts.map +1 -0
  76. package/dist/types/core/events/dropoffDetection.d.ts +21 -0
  77. package/dist/types/core/events/dropoffDetection.d.ts.map +1 -0
  78. package/dist/types/core/events/dropoffDetection.test.d.ts +2 -0
  79. package/dist/types/core/events/dropoffDetection.test.d.ts.map +1 -0
  80. package/dist/types/core/events/emitter.d.ts +23 -0
  81. package/dist/types/core/events/emitter.d.ts.map +1 -0
  82. package/dist/types/core/events/emitter.test.d.ts +2 -0
  83. package/dist/types/core/events/emitter.test.d.ts.map +1 -0
  84. package/dist/types/core/events/formJourneyTracker.contract.test.d.ts +2 -0
  85. package/dist/types/core/events/formJourneyTracker.contract.test.d.ts.map +1 -0
  86. package/dist/types/core/events/formJourneyTracker.d.ts +69 -0
  87. package/dist/types/core/events/formJourneyTracker.d.ts.map +1 -0
  88. package/dist/types/core/events/formJourneyTracker.test.d.ts +2 -0
  89. package/dist/types/core/events/formJourneyTracker.test.d.ts.map +1 -0
  90. package/dist/types/core/events/pushEvents.contract.test.d.ts +2 -0
  91. package/dist/types/core/events/pushEvents.contract.test.d.ts.map +1 -0
  92. package/dist/types/core/events/pushEvents.d.ts +62 -0
  93. package/dist/types/core/events/pushEvents.d.ts.map +1 -0
  94. package/dist/types/core/events/pushEvents.test.d.ts +2 -0
  95. package/dist/types/core/events/pushEvents.test.d.ts.map +1 -0
  96. package/dist/types/core/events/startedDetection.d.ts +11 -0
  97. package/dist/types/core/events/startedDetection.d.ts.map +1 -0
  98. package/dist/types/core/events/startedDetection.test.d.ts +2 -0
  99. package/dist/types/core/events/startedDetection.test.d.ts.map +1 -0
  100. package/dist/types/core/events/viewDetection.d.ts +15 -0
  101. package/dist/types/core/events/viewDetection.d.ts.map +1 -0
  102. package/dist/types/core/events/viewDetection.test.d.ts +2 -0
  103. package/dist/types/core/events/viewDetection.test.d.ts.map +1 -0
  104. package/dist/types/core/identity/browserFingerprint.d.ts +40 -0
  105. package/dist/types/core/identity/browserFingerprint.d.ts.map +1 -0
  106. package/dist/types/core/identity/browserFingerprint.test.d.ts +2 -0
  107. package/dist/types/core/identity/browserFingerprint.test.d.ts.map +1 -0
  108. package/dist/types/core/identity/ensureIdentified.d.ts +27 -0
  109. package/dist/types/core/identity/ensureIdentified.d.ts.map +1 -0
  110. package/dist/types/core/identity/ensureIdentified.test.d.ts +2 -0
  111. package/dist/types/core/identity/ensureIdentified.test.d.ts.map +1 -0
  112. package/dist/types/core/identity/identify.contract.test.d.ts +2 -0
  113. package/dist/types/core/identity/identify.contract.test.d.ts.map +1 -0
  114. package/dist/types/core/identity/identify.d.ts +48 -0
  115. package/dist/types/core/identity/identify.d.ts.map +1 -0
  116. package/dist/types/core/identity/identify.test.d.ts +2 -0
  117. package/dist/types/core/identity/identify.test.d.ts.map +1 -0
  118. package/dist/types/core/identity/journey.contract.test.d.ts +2 -0
  119. package/dist/types/core/identity/journey.contract.test.d.ts.map +1 -0
  120. package/dist/types/core/identity/journey.d.ts +28 -0
  121. package/dist/types/core/identity/journey.d.ts.map +1 -0
  122. package/dist/types/core/identity/journey.test.d.ts +2 -0
  123. package/dist/types/core/identity/journey.test.d.ts.map +1 -0
  124. package/dist/types/core/identity/journey.testStubs.d.ts +5 -0
  125. package/dist/types/core/identity/journey.testStubs.d.ts.map +1 -0
  126. package/dist/types/core/identity/leadDataCache.d.ts +27 -0
  127. package/dist/types/core/identity/leadDataCache.d.ts.map +1 -0
  128. package/dist/types/core/identity/leadDataCache.test.d.ts +2 -0
  129. package/dist/types/core/identity/leadDataCache.test.d.ts.map +1 -0
  130. package/dist/types/enrichment/attachEnrichment.d.ts +35 -0
  131. package/dist/types/enrichment/attachEnrichment.d.ts.map +1 -0
  132. package/dist/types/enrichment/attachEnrichment.test.d.ts +2 -0
  133. package/dist/types/enrichment/attachEnrichment.test.d.ts.map +1 -0
  134. package/dist/types/index.d.ts +28 -0
  135. package/dist/types/index.d.ts.map +1 -0
  136. package/dist/types/react/index.d.ts +2 -0
  137. package/dist/types/react/index.d.ts.map +1 -0
  138. package/dist/types/react/ssr.test.d.ts +2 -0
  139. package/dist/types/react/ssr.test.d.ts.map +1 -0
  140. package/dist/types/react/useSurfaceForm.d.ts +25 -0
  141. package/dist/types/react/useSurfaceForm.d.ts.map +1 -0
  142. package/dist/types/react/useSurfaceForm.test.d.ts +2 -0
  143. package/dist/types/react/useSurfaceForm.test.d.ts.map +1 -0
  144. package/dist/types/surfaceForms.d.ts +120 -0
  145. package/dist/types/surfaceForms.d.ts.map +1 -0
  146. package/dist/types/surfaceForms.test.d.ts +2 -0
  147. package/dist/types/surfaceForms.test.d.ts.map +1 -0
  148. package/dist/types/tracking/attachTracking.d.ts +35 -0
  149. package/dist/types/tracking/attachTracking.d.ts.map +1 -0
  150. package/dist/types/tracking/attachTracking.test.d.ts +2 -0
  151. package/dist/types/tracking/attachTracking.test.d.ts.map +1 -0
  152. package/dist/types/tracking/conversionRules.contract.test.d.ts +2 -0
  153. package/dist/types/tracking/conversionRules.contract.test.d.ts.map +1 -0
  154. package/dist/types/tracking/conversionRules.d.ts +87 -0
  155. package/dist/types/tracking/conversionRules.d.ts.map +1 -0
  156. package/dist/types/tracking/conversionRules.test.d.ts +2 -0
  157. package/dist/types/tracking/conversionRules.test.d.ts.map +1 -0
  158. package/dist/types/tracking/vendors.d.ts +46 -0
  159. package/dist/types/tracking/vendors.d.ts.map +1 -0
  160. package/dist/types/tracking/vendors.test.d.ts +2 -0
  161. package/dist/types/tracking/vendors.test.d.ts.map +1 -0
  162. package/dist/types/validation/attachEmailValidation.d.ts +8 -0
  163. package/dist/types/validation/attachEmailValidation.d.ts.map +1 -0
  164. package/dist/types/validation/attachEmailValidation.test.d.ts +2 -0
  165. package/dist/types/validation/attachEmailValidation.test.d.ts.map +1 -0
  166. package/docs/api.md +310 -0
  167. package/docs/reference/binding.md +116 -0
  168. package/docs/reference/clients.md +212 -0
  169. package/docs/reference/engine.md +193 -0
  170. package/docs/reference/events.md +93 -0
  171. package/docs/reference/identity.md +116 -0
  172. package/llms.txt +317 -0
  173. package/package.json +25 -0
  174. package/skills/surface-forms-sdk/SKILL.md +153 -0
  175. package/skills/surface-forms-sdk/debugging.md +64 -0
  176. package/skills/surface-forms-sdk/editing.md +67 -0
  177. package/skills/surface-forms-sdk/patterns.md +222 -0
@@ -0,0 +1,43 @@
1
+ import type { FormEngine } from "../core/engine/formEngine";
2
+ /**
3
+ * The `data-*` binding layer (forms-sdk-plan.md §2.1/§5.2): makes plain
4
+ * agent-authored HTML drive the headless engine with zero authored JS. The
5
+ * attribute contract is a superset of the conventions the public tag's
6
+ * external-form path already uses (`data-question-id` / `data-field-name`
7
+ * discovery, `input[type=email]` → `emailAddress` inference,
8
+ * `surface-next-button` / `surface-submit-button` classes), plus
9
+ * customer-owned routing affordances (`data-surface-goto-step` branch buttons,
10
+ * `surface-disqualify-button` — Decisions #6) and the
11
+ * stepped-only rule: `data-step-id` containers matching the record's steps,
12
+ * which the SDK shows/hides itself — a multi-step record presents one step at
13
+ * a time (§2.9). A single-step record may omit containers entirely.
14
+ *
15
+ * Fields merge into one component state per question (`{ [fieldName]: value }`
16
+ * accumulates firstName/lastName style groups); `data-field-name` defaults to
17
+ * `"input"` — ShortInput's state key — and email inputs without it default to
18
+ * `"email"`, EmailForm's; a `<select>` on a Dropdown defaults to `"selected"`,
19
+ * its state key. Every state carries its `type` discriminator
20
+ * (`data-question-type`, inferred for the two text states) because the wire
21
+ * schema validates states as a discriminated union.
22
+ *
23
+ * Choice questions are captured per GROUP, not per control: their wire states
24
+ * are structural (`MultipleOptionsQuestion` wants the ENTIRE option list as
25
+ * `{key, index, value}` entries, `GraphicOptions` wants `{value, index}`),
26
+ * which no single radio's string value can express — the 2026-08 field run
27
+ * shipped exactly that and ingest rejected it. Every change rebuilds the full
28
+ * answer from all radios/checkboxes under the binding (key = the control's
29
+ * `value` attribute, index = DOM order, so author options in record order).
30
+ *
31
+ * Runtime drift guard (§4.3): Surface never sees the customer's HTML, so on
32
+ * bind the record's stateful questionIds are compared against what the DOM
33
+ * actually bound — unbound ids get a console warning, the publish-gate-less
34
+ * counterpart of `validate_form_html`.
35
+ */
36
+ export type BindFormOptions = {
37
+ engine: FormEngine;
38
+ root: Element;
39
+ /** Stateful questionIds from the form record; unbound ones are warned about. */
40
+ expectedQuestionIds?: string[];
41
+ };
42
+ export declare const bindForm: ({ engine, root, expectedQuestionIds }: BindFormOptions) => (() => void);
43
+ //# sourceMappingURL=bindForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindForm.d.ts","sourceRoot":"","sources":["../../../src/bind/bindForm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,gFAAgF;IAChF,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AA2EF,eAAO,MAAM,QAAQ,0CAA2C,eAAe,KAAG,CAAC,MAAM,IAAI,CA4G5F,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bindForm.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindForm.test.d.ts","sourceRoot":"","sources":["../../../src/bind/bindForm.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import type { Booking, SchedulerClient, TimeSlot } from "../core/client/scheduler";
2
+ export type BookingWidgetOptions = {
3
+ container: Element;
4
+ scheduler: SchedulerClient;
5
+ eventTypeId: string;
6
+ timezone?: string;
7
+ duration?: number;
8
+ prefill?: {
9
+ name?: string;
10
+ email?: string;
11
+ };
12
+ /** Threads booking↔response linkage into the booking meta block. */
13
+ identity?: {
14
+ responseId?: string;
15
+ leadSessionId?: string;
16
+ fingerprint?: string;
17
+ };
18
+ /**
19
+ * Overrides for the widget's human-readable copy. Defaults use
20
+ * `Intl.DateTimeFormat` in the visitor's locale; every button also carries
21
+ * the raw value in `data-value` (`YYYY-MM` months, `YYYY-MM-DD` dates, ISO
22
+ * instants for slots), so relabeling never needs to parse the text back.
23
+ */
24
+ formatters?: {
25
+ /** `month` is `YYYY-MM`. */
26
+ month?: (month: string) => string;
27
+ /** `date` is `YYYY-MM-DD`. */
28
+ date?: (date: string) => string;
29
+ /** `slot.start`/`slot.end` are ISO instants; format in the widget's timezone. */
30
+ time?: (slot: TimeSlot) => string;
31
+ };
32
+ onComplete: (booking: Booking) => void;
33
+ };
34
+ export declare const mountBookingWidget: ({ container, scheduler, eventTypeId, timezone, duration, prefill, identity, formatters, onComplete, }: BookingWidgetOptions) => (() => void);
35
+ //# sourceMappingURL=bookingWidget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bookingWidget.d.ts","sourceRoot":"","sources":["../../../src/bind/bookingWidget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAkBnF,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,eAAe,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5C,oEAAoE;IACpE,QAAQ,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjF;;;;;OAKG;IACH,UAAU,CAAC,EAAE;QACX,4BAA4B;QAC5B,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;QAClC,8BAA8B;QAC9B,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;QAChC,iFAAiF;QACjF,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC;KACnC,CAAC;IACF,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,CAAC;AA8BF,eAAO,MAAM,kBAAkB,0GAU5B,oBAAoB,KAAG,CAAC,MAAM,IAAI,CA0LpC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bookingWidget.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bookingWidget.test.d.ts","sourceRoot":"","sources":["../../../src/bind/bookingWidget.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import type { Transport } from "./transport";
2
+ export type EmailValidationResult = {
3
+ email: string;
4
+ /** Deliverable per the waterfall + blacklist; fail-open true when validation could not run. */
5
+ isValid: boolean;
6
+ status?: string;
7
+ reason?: string;
8
+ blacklistEntryIds?: string[];
9
+ /** Validation did not actually run (network/server failure) — `isValid` is the fail-open default. */
10
+ failed?: boolean;
11
+ };
12
+ export type EmailValidator = {
13
+ validate: (email: string) => Promise<EmailValidationResult>;
14
+ validateBatch: (emails: string[]) => Promise<EmailValidationResult[]>;
15
+ };
16
+ export type CreateEmailValidatorOptions = {
17
+ transport: Transport;
18
+ environmentId: string;
19
+ /** Preview never spends validator quota: every email reports a synthetic valid result. */
20
+ preview?: boolean;
21
+ };
22
+ export declare const createEmailValidator: ({ transport, environmentId, preview, }: CreateEmailValidatorOptions) => EmailValidator;
23
+ //# sourceMappingURL=emailValidation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emailValidation.d.ts","sourceRoot":"","sources":["../../../../src/core/client/emailValidation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAkB7C,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,+FAA+F;IAC/F,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAWF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC5D,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;CACvE,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,0FAA0F;IAC1F,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAsBF,eAAO,MAAM,oBAAoB,2CAI9B,2BAA2B,KAAG,cAmChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=emailValidation.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emailValidation.test.d.ts","sourceRoot":"","sources":["../../../../src/core/client/emailValidation.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,35 @@
1
+ import type { FormResponsePayload, FormUpdateResponsePayload } from "../engine/responsePayload";
2
+ import type { Transport, TransportResult } from "./transport";
3
+ export type CreateResponseResult = {
4
+ responseId: string;
5
+ leadId: string | null;
6
+ /** Authorizes the token-gated read-back (resume); persist alongside the responseId. */
7
+ resumeToken: string | null;
8
+ };
9
+ export declare const submitResponse: (transport: Transport, payload: FormResponsePayload) => Promise<TransportResult<CreateResponseResult>>;
10
+ export declare const updateResponse: (transport: Transport, payload: FormUpdateResponsePayload) => void;
11
+ /**
12
+ * Awaited delivery for the FINISHING update (the 2026-08 field run measured
13
+ * the beacon path silently dropping the terminal write on fast page close:
14
+ * `submit()` resolved, `saved` fired, and the server kept a step-1 partial).
15
+ * `keepalive` lets the request survive an immediate navigation; credentials
16
+ * match the beacon path's `${formId}_pa` cookie round-trip.
17
+ */
18
+ export declare const updateResponseConfirmed: (transport: Transport, payload: FormUpdateResponsePayload) => Promise<TransportResult<unknown>>;
19
+ export type StoredAnswerRow = {
20
+ questionId: string;
21
+ response: Record<string, unknown>;
22
+ };
23
+ /**
24
+ * Read-back of a stored response for resume (Decisions #11: the route is
25
+ * token-gated; the create reply issued the token). External-state
26
+ * pseudo-answers (URL_DATA) are stripped — they are attribution snapshots the
27
+ * engine re-derives from its own page context, not visitor answers.
28
+ */
29
+ export declare const fetchStoredResponse: (transport: Transport, { responseId, resumeToken }: {
30
+ responseId: string;
31
+ resumeToken: string;
32
+ }) => Promise<TransportResult<{
33
+ answers: StoredAnswerRow[];
34
+ }>>;
35
+ //# sourceMappingURL=responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/core/client/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAChG,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAe9D,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,uFAAuF;IACvF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,CAAC;AAMF,eAAO,MAAM,cAAc,cACd,SAAS,WACX,mBAAmB,KAC3B,OAAO,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAiB/C,CAAC;AAEF,eAAO,MAAM,cAAc,cAAe,SAAS,WAAW,yBAAyB,KAAG,IAEzF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,cACvB,SAAS,WACX,yBAAyB,KACjC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAC2C,CAAC;AAE/E,MAAM,MAAM,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAaxF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,cACnB,SAAS,+BACS;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,KACvE,OAAO,CAAC,eAAe,CAAC;IAAE,OAAO,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC,CAUzD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=responses.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.test.d.ts","sourceRoot":"","sources":["../../../../src/core/client/responses.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtimeConfig.contract.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeConfig.contract.test.d.ts","sourceRoot":"","sources":["../../../../src/core/client/runtimeConfig.contract.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,72 @@
1
+ import type { Transport, TransportResult } from "./transport";
2
+ /**
3
+ * Boot-time fetch of the published form record (forms-sdk-plan.md §2.3,
4
+ * Decisions #7): `GET /api/v1/public/forms/[formId]/runtime-config` serves the
5
+ * same `TCachedForm` payload the hosted `/s/[formId]` page reads — config
6
+ * (steps + components, the data contract) and settings (behavioral gates like
7
+ * `trackPartialResponses`; tracking ids for the Phase-2 tracking module).
8
+ * `settings.password` never arrives — the server strips it and the SDK
9
+ * validates gated forms through `/api/v1/check-password`.
10
+ *
11
+ * The step/question extraction mirrors `extractFlatComponentsFromStep`
12
+ * (form-render gridLayoutUtils): a step's `components` is either a flat
13
+ * component array or a ComponentGridLayout whose rows hold components or
14
+ * `GridLayoutRowItem` wrappers; stateful components carry `state.questionId` —
15
+ * the same discriminator the MCP validator's `collectQuestionIds` uses.
16
+ */
17
+ type RuntimeStep = {
18
+ id: string;
19
+ endStepKind?: "thank_you" | "disqualified";
20
+ components?: unknown;
21
+ };
22
+ export type RuntimeConfig = {
23
+ id: string;
24
+ name?: string;
25
+ environmentId?: string;
26
+ config: {
27
+ steps?: RuntimeStep[];
28
+ } & Record<string, unknown>;
29
+ settings?: ({
30
+ trackPartialResponses?: boolean;
31
+ trackCookie?: boolean;
32
+ } & Record<string, unknown>) | null;
33
+ };
34
+ /** `preview` asks the server for the draft config of a never-published form (authoring loop); published forms serve live either way. */
35
+ export declare const fetchRuntimeConfig: (transport: Transport, formId: string, { preview, previewToken }?: {
36
+ preview?: boolean;
37
+ previewToken?: string;
38
+ }) => Promise<TransportResult<{
39
+ data?: RuntimeConfig;
40
+ }>>;
41
+ /** Step order + ending kinds — the engine's traversal contract, including where submit/disqualify land. */
42
+ export declare const stepsOf: (config: RuntimeConfig["config"]) => Array<{
43
+ id: string;
44
+ endStepKind?: "thank_you" | "disqualified";
45
+ }>;
46
+ export declare const statefulQuestionsOf: (config: RuntimeConfig["config"]) => Array<{
47
+ questionId: string;
48
+ componentType?: string;
49
+ }>;
50
+ export declare const statefulQuestionIdsOf: (config: RuntimeConfig["config"]) => string[];
51
+ /**
52
+ * Questions whose answers can trigger real-time enrichment, with the state
53
+ * keys to watch — the native renderer's blur triggers translated to data
54
+ * (identityInfo.tsx handleOnBlur): IdentityInfo fires on its configured
55
+ * `enrichmentSourceField` (default emailAddress) and always on `websiteUrl`;
56
+ * EmailForm fires on its email.
57
+ */
58
+ export declare const enrichmentSourcesOf: (config: RuntimeConfig["config"]) => Array<{
59
+ questionId: string;
60
+ fieldNames: string[];
61
+ }>;
62
+ /**
63
+ * True when a component EXPLICITLY declares `enrichmentSourceField` — the
64
+ * authoring-time signal that the owner expects enrichment to run. Implicit
65
+ * sources (every EmailForm / IdentityInfo default) don't count: they make any
66
+ * form with an email question look enrichment-configured.
67
+ */
68
+ export declare const hasDeclaredEnrichmentSource: (config: RuntimeConfig["config"]) => boolean;
69
+ /** Mirrors form-render's provider gate (buildExternalStateStore): v2 config with at least one enabled provider exposing fields. */
70
+ export declare const hasEnabledEnrichmentProvider: (settings: RuntimeConfig["settings"]) => boolean;
71
+ export {};
72
+ //# sourceMappingURL=runtimeConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeConfig.d.ts","sourceRoot":"","sources":["../../../../src/core/client/runtimeConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AAEH,KAAK,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,WAAW,GAAG,cAAc,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpG,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC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AAC,KAAG,OAOzE,CAAC;AAEN,mIAAmI;AACnI,eAAO,MAAM,4BAA4B,aAAc,aAAa,CAAC,UAAU,CAAC,KAAG,OAUlF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=runtimeConfig.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeConfig.test.d.ts","sourceRoot":"","sources":["../../../../src/core/client/runtimeConfig.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=scheduler.contract.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.contract.test.d.ts","sourceRoot":"","sources":["../../../../src/core/client/scheduler.contract.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,121 @@
1
+ import type { Transport, TransportResult } from "./transport";
2
+ /**
3
+ * Thin wrap of the public Surface-native scheduler endpoints (forms-sdk-plan.md
4
+ * row 46 — Phase-1 MVP scope by product decision). Query and payload shapes
5
+ * mirror `@surface/scheduler-ui`'s hooks byte-for-byte (that package is
6
+ * AGPL-tree and cannot ship in the MIT SDK — plan §2.9), including the split
7
+ * of `YYYY-MM` into numeric month/year params and the booking `meta` block
8
+ * that drives server-side booking↔response linkage.
9
+ *
10
+ * `preview: true` mirrors the native BookingForm exactly: queries carry
11
+ * `preview=true`, and `book()` resolves a fabricated preview booking without
12
+ * any network call — draft interactions never create real bookings.
13
+ *
14
+ * `toSchedulerAnswerState` reproduces `SurfaceScheduler.handleBookingComplete`:
15
+ * the persisted DynamicScheduler component state whose `eventScheduled`/`uri`
16
+ * pair the payload builder's bookingId detection and the server's booking
17
+ * meta injection key on. `googleMeetLink` is the frozen persisted key even
18
+ * though the API field is `meetingJoinLink`.
19
+ */
20
+ export type BookingAttendee = {
21
+ name: string;
22
+ email: string;
23
+ isHost: boolean;
24
+ };
25
+ export type Booking = {
26
+ id: string;
27
+ startTime: string;
28
+ endTime: string;
29
+ timezone: string;
30
+ inviteeName: string;
31
+ inviteeEmail: string;
32
+ meetingJoinLink: string | null;
33
+ cancelToken: string;
34
+ rescheduleToken: string;
35
+ attendees: BookingAttendee[];
36
+ };
37
+ export type TimeSlot = {
38
+ start: string;
39
+ end: string;
40
+ };
41
+ export type AvailabilitySummary = {
42
+ has_availability: boolean;
43
+ available_slots_7d: number;
44
+ available_slots_14d: number;
45
+ available_slots_30d: number;
46
+ available_days_7d: number;
47
+ next_available_date: string | null;
48
+ total_available_slots: number;
49
+ rep_meeting_count_today: number;
50
+ };
51
+ type HostScope = {
52
+ hostId?: string;
53
+ ownerEmail?: string;
54
+ };
55
+ export type SchedulerClient = {
56
+ getPublicEventType: <TEventType = unknown>(eventTypeId: string) => Promise<TransportResult<TEventType>>;
57
+ getAvailabilitySummary: (args: {
58
+ eventTypeId: string;
59
+ timezone?: string;
60
+ }) => Promise<TransportResult<{
61
+ data?: AvailabilitySummary;
62
+ }>>;
63
+ getMonthAvailability: (args: {
64
+ eventTypeId: string;
65
+ /** Calendar month as `YYYY-MM`; split into numeric month/year params like native. */
66
+ month: string;
67
+ timezone: string;
68
+ duration?: number;
69
+ } & HostScope) => Promise<TransportResult<{
70
+ data?: {
71
+ dates?: unknown[];
72
+ resolvedHost?: unknown;
73
+ };
74
+ }>>;
75
+ getSlots: (args: {
76
+ eventTypeId: string;
77
+ date: string;
78
+ timezone: string;
79
+ duration?: number;
80
+ } & HostScope) => Promise<TransportResult<{
81
+ data?: {
82
+ slots?: TimeSlot[];
83
+ };
84
+ }>>;
85
+ book: (args: {
86
+ eventTypeId: string;
87
+ startTime: string;
88
+ /**
89
+ * The selected slot's end. Required — every booking comes from a picked
90
+ * slot, and a fallback would fabricate zero-length preview meetings. Only
91
+ * preview fabrication reads it (the server derives real end times); it is
92
+ * never sent on the wire.
93
+ */
94
+ endTime: string;
95
+ timezone: string;
96
+ inviteeName: string;
97
+ inviteeEmail: string;
98
+ duration?: number;
99
+ intakeResponses?: Record<string, string>;
100
+ guestEmails?: string[];
101
+ captchaToken?: string;
102
+ responseId?: string;
103
+ leadSessionId?: string;
104
+ fingerprint?: string;
105
+ hostRouting?: unknown;
106
+ }) => Promise<TransportResult<Booking>>;
107
+ reschedule: (args: {
108
+ bookingId: string;
109
+ rescheduleToken: string;
110
+ newStartTime: string;
111
+ timezone: string;
112
+ }) => Promise<TransportResult<Booking>>;
113
+ };
114
+ export declare const createSchedulerClient: ({ transport, preview, }: {
115
+ transport: Transport;
116
+ preview?: boolean;
117
+ }) => SchedulerClient;
118
+ /** The persisted DynamicScheduler component state for a completed booking. */
119
+ export declare const toSchedulerAnswerState: (booking: Booking) => Record<string, unknown>;
120
+ export {};
121
+ //# sourceMappingURL=scheduler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/core/client/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9D;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE/E,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC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E;AAC9E,eAAO,MAAM,sBAAsB,YAAa,OAAO,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAa/E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=scheduler.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler.test.d.ts","sourceRoot":"","sources":["../../../../src/core/client/scheduler.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Delivery layer for the SDK's first-party requests, mirroring the native
3
+ * runtime's two transports (forms-sdk-plan.md §2.4):
4
+ *
5
+ * - `post` — plain `fetch` for calls whose response body the engine needs
6
+ * (response create returns `responseId`/`meta`, identify returns
7
+ * `leadId`/`sessionId`). Never throws: resolves to a typed result so
8
+ * callers keep the never-break-the-host-page guarantee (§2.6).
9
+ * - `beacon` — `sendBeacon`-first with `fetch(keepalive)` fallback for
10
+ * fire-and-forget writes (response updates, events, journey), the same
11
+ * semantics as form-render's `updateResponse.ts` / `sendPushEventRequest.ts`.
12
+ * Failures are swallowed by design: the server's drop-off sweep reconciles
13
+ * missed updates, and events are best-effort.
14
+ *
15
+ * Unlike form-render (relative paths, same-origin only), every request is
16
+ * absolute against a configurable base URL — SDK pages are customer-hosted
17
+ * and always cross-origin (§4.1).
18
+ */
19
+ /** The host the public tag already targets (scripts:src/constants.ts). */
20
+ export declare const DEFAULT_API_BASE_URL = "https://forms.withsurface.com";
21
+ /**
22
+ * Sent as `X-Surface-Sdk-Version` on every fetch-path request (Decisions #14:
23
+ * SDK 429s must be measurable before rate limits are revisited). `sendBeacon`
24
+ * cannot carry headers, so beacon deliveries carry the version as the `sdv`
25
+ * query param instead — the server reads both. Bumped manually until
26
+ * extraction wires it to package.json at build time.
27
+ */
28
+ export declare const SDK_VERSION = "0.1.0";
29
+ export type TransportResult<TData> = {
30
+ ok: true;
31
+ data: TData;
32
+ } | {
33
+ ok: false;
34
+ error: TransportError;
35
+ };
36
+ export type TransportError = {
37
+ kind: "network";
38
+ cause: unknown;
39
+ } | {
40
+ kind: "http";
41
+ status: number;
42
+ body?: unknown;
43
+ };
44
+ export type Transport = {
45
+ get: <TData>(path: string) => Promise<TransportResult<TData>>;
46
+ post: <TData>(path: string, payload: unknown, opts?: {
47
+ keepalive?: boolean;
48
+ credentials?: boolean;
49
+ }) => Promise<TransportResult<TData>>;
50
+ /** Returns true only when `sendBeacon` queued the payload; the fire-and-forget fetch fallback reports false. */
51
+ beacon: (path: string, payload: unknown) => boolean;
52
+ };
53
+ export declare const createTransport: ({ apiBaseUrl, }?: {
54
+ apiBaseUrl?: string;
55
+ }) => Transport;
56
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../src/core/client/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AAEpE;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AASnC,MAAM,MAAM,eAAe,CAAC,KAAK,IAAI;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAE,CAAC;AAEtG,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9D,IAAI,EAAE,CAAC,KAAK,EACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,KAClD,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,gHAAgH;IAChH,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;CACrD,CAAC;AAEF,eAAO,MAAM,eAAe,qBAEzB;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,KAAQ,SA6EjC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transport.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.test.d.ts","sourceRoot":"","sources":["../../../../src/core/client/transport.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `init({ debug: true })` answer auditing: the bind layer always produces
3
+ * valid shapes, but headless `setAnswer` callers are one label-string away
4
+ * from the ingest 400 that static gates cannot see (2026-08 field run). The
5
+ * auditor checks only facts that cannot false-positive — unknown questionId,
6
+ * wrong `type` discriminator, a merged state with no `type` at all, and a
7
+ * choice-list answer whose `choices` is not an array — and logs every
8
+ * captured answer so a session is replayable from the console.
9
+ */
10
+ export type AuditedQuestion = {
11
+ questionId: string;
12
+ componentType?: string;
13
+ };
14
+ export declare const auditAnswer: ({ questions, questionId, merged, }: {
15
+ /** Stateful questions of the record; empty when the record wasn't fetched (caller-provided steps). */
16
+ questions: Map<string, AuditedQuestion>;
17
+ questionId: string;
18
+ /** The post-merge state (setAnswer patches accumulate per question). */
19
+ merged: Record<string, unknown>;
20
+ }) => void;
21
+ //# sourceMappingURL=answerAudit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answerAudit.d.ts","sourceRoot":"","sources":["../../../../src/core/engine/answerAudit.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,MAAM,MAAM,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7E,eAAO,MAAM,WAAW,uCAIrB;IACD,sGAAsG;IACtG,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,KAAG,IAsCH,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=answerAudit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answerAudit.test.d.ts","sourceRoot":"","sources":["../../../../src/core/engine/answerAudit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=answerStates.contract.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"answerStates.contract.test.d.ts","sourceRoot":"","sources":["../../../../src/core/engine/answerStates.contract.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Typed answer states for headless callers (plan §2.9): the bind layer builds
3
+ * these automatically, but React/headless code hands them to `setAnswer` by
4
+ * hand — and shipping a bare label string where a structured state belongs is
5
+ * the classic production 400 (2026-08 field run). These local types mirror
6
+ * each component's wire schema and are contract-tested against
7
+ * `@surface/types` (dev dependency only — the SDK ships zero runtime deps).
8
+ *
9
+ * `setAnswer` itself stays structurally typed (`Record<string, unknown>`):
10
+ * legacy component types not listed here remain settable, and answers merge
11
+ * per question, so partial patches are legal. Annotate call sites with these
12
+ * types to get the compiler's help.
13
+ */
14
+ export type ShortInputAnswer = {
15
+ type: "ShortInput";
16
+ input: string;
17
+ };
18
+ export type LongInputAnswer = {
19
+ type: "LongInput";
20
+ input: string;
21
+ };
22
+ export type EmailFormAnswer = {
23
+ type: "EmailForm";
24
+ email: string;
25
+ subscriptionCheck?: boolean;
26
+ };
27
+ export type DropdownAnswer = {
28
+ type: "Dropdown";
29
+ selected: string | string[];
30
+ };
31
+ export type DisclaimerAnswer = {
32
+ type: "Disclaimer";
33
+ check?: boolean;
34
+ };
35
+ export type FileUploaderAnswer = {
36
+ type: "FileUploader";
37
+ fileUrl?: string;
38
+ };
39
+ /** The ENTIRE option list, one entry per record option — never only the picked one. */
40
+ export type MultipleOptionsAnswer = {
41
+ type: "MultipleOptionsQuestion";
42
+ choices: Array<{
43
+ key: string;
44
+ value: boolean;
45
+ index: number;
46
+ }>;
47
+ selectedOther?: boolean;
48
+ };
49
+ export type MMChoiceAnswer = {
50
+ type: "MMChoiceQuestion";
51
+ choices: Array<{
52
+ key: string;
53
+ value: boolean;
54
+ }>;
55
+ };
56
+ export type MultipleChoiceAnswer = {
57
+ type: "MultipleChoiceQuestion";
58
+ choices: Array<{
59
+ key: string;
60
+ value: boolean;
61
+ }>;
62
+ };
63
+ export type GraphicOptionsAnswer = {
64
+ type: "GraphicOptions";
65
+ value: string;
66
+ index: number;
67
+ };
68
+ export type MultipleChoiceSingleAnswerAnswer = {
69
+ type: "MultipleChoiceSingleAnswer";
70
+ value: string;
71
+ index: number;
72
+ };
73
+ /** Canonical IdentityInfo answer keys (mirrors IdentityInfoKeysArray; contract-tested). */
74
+ export declare const IDENTITY_INFO_ANSWER_KEYS: readonly ["firstName", "lastName", "fullName", "emailAddress", "workEmailAddress", "phoneNumber", "companyName", "numberOfEmployees", "websiteUrl", "title", "streetAddress", "aptSuiteEtc", "city", "state", "country", "zipCode", "companyRevenue", "profilePictureUrl"];
75
+ export type IdentityInfoAnswerKey = (typeof IDENTITY_INFO_ANSWER_KEYS)[number];
76
+ export type IdentityInfoAnswer = {
77
+ type: "IdentityInfo";
78
+ } & Partial<Record<IdentityInfoAnswerKey, string>>;
79
+ /** Booking answers; `toSchedulerAnswerState` produces this — override `type` to the record's component type. */
80
+ export type SchedulerAnswer = {
81
+ type: "CalendlyScreen" | "DynamicScheduler";
82
+ eventScheduled: boolean;
83
+ uri: string;
84
+ meetingTime?: string;
85
+ meetingEndTime?: string;
86
+ ownerEmails?: string;
87
+ guestEmails?: string;
88
+ inviteeName?: string;
89
+ googleMeetLink?: string;
90
+ };
91
+ export type KnownAnswerState = ShortInputAnswer | LongInputAnswer | EmailFormAnswer | DropdownAnswer | DisclaimerAnswer | FileUploaderAnswer | MultipleOptionsAnswer | MMChoiceAnswer | MultipleChoiceAnswer | GraphicOptionsAnswer | MultipleChoiceSingleAnswerAnswer | IdentityInfoAnswer | SchedulerAnswer;
92
+ //# sourceMappingURL=answerStates.d.ts.map