@captello/ulc-webview-sdk 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +123 -0
- package/README.md +352 -5
- package/dist/app-host.d.ts +228 -0
- package/dist/app-host.js +170 -0
- package/dist/app-host.js.map +1 -0
- package/dist/{chunk-PFFBCSJ2.js → chunk-ZPVXZW2B.js} +235 -19
- package/dist/chunk-ZPVXZW2B.js.map +1 -0
- package/dist/{chunk-4E7OW4RJ.js → chunk-ZX4AKPWF.js} +5 -3
- package/dist/chunk-ZX4AKPWF.js.map +1 -0
- package/dist/client-CAMlFA8s.d.ts +898 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +2 -2
- package/dist/promises.d.ts +3 -5
- package/dist/promises.js +2 -2
- package/dist/promises.js.map +1 -1
- package/dist/react.d.ts +19 -4
- package/dist/react.js +14 -3
- package/dist/react.js.map +1 -1
- package/package.json +83 -73
- package/dist/chunk-4E7OW4RJ.js.map +0 -1
- package/dist/chunk-PFFBCSJ2.js.map +0 -1
- package/dist/client-CalIoKT6.d.ts +0 -517
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/messages.ts","../src/client.ts"],"names":["OutboundMessageType","InboundMessageType"],"mappings":";AAwBO,IAAK,mBAAA,qBAAAA,oBAAAA,KAAL;AAEH,EAAAA,qBAAA,kBAAA,CAAA,GAAmB,oBAAA;AAEnB,EAAAA,qBAAA,kBAAA,CAAA,GAAmB,oBAAA;AAKnB,EAAAA,qBAAA,gBAAA,CAAA,GAAiB,iBAAA;AAEjB,EAAAA,qBAAA,mBAAA,CAAA,GAAoB,qBAAA;AAEpB,EAAAA,qBAAA,2BAAA,CAAA,GAA4B,6BAAA;AAE5B,EAAAA,qBAAA,yBAAA,CAAA,GAA0B,2BAAA;AAflB,EAAA,OAAAA,oBAAAA;AAAA,CAAA,EAAA,mBAAA,IAAA,EAAA;AA6GL,IAAK,kB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OAAO,CAAA;AAAA,IACrD;AACA,IAAA,IAAI,IAAA,CAAK,aAAa,IAAA,EAAM;AACxB,MAAA,KAAA,MAAW,YAAY,CAAC,GAAG,KAAK,YAAY,CAAA,WAAY,OAAO,CAAA;AAAA,IACnE;AAAA,EACJ;AACJ","file":"chunk-PFFBCSJ2.js","sourcesContent":["/**\n * The message protocol exchanged between the Captello capture webview (the iframe)\n * and its host page.\n *\n * Wire format (this is the contract — match it exactly):\n * - Every message is a JSON **string**. The webview sends outbound messages with\n * `JSON.stringify(message)` and reads inbound messages with `JSON.parse(event.data)`.\n * A host that posts a raw object instead of a string will be ignored, because the\n * webview's parser produces a non-object and bails.\n * - Every message is an object with a `type` discriminator. Inbound and outbound\n * types are disjoint string enums.\n *\n * Direction is named from the **webview's** point of view:\n * - {@link OutboundMessageType}: webview → host (the host listens for these).\n * - {@link InboundMessageType}: host → webview (the host sends these).\n */\n\nimport type { VisibleSubmissionDataItem } from \"./submission-data\";\n\n/* ------------------------------------------------------------------ *\n * Outbound: webview → host\n * ------------------------------------------------------------------ */\n\n/** Message `type` values the webview emits to its host. */\nexport enum OutboundMessageType {\n /** The form finished loading and rendering. Safe to interact with it after this. */\n FormLoadComplete = \"form_load_complete\",\n /** A user-facing error occurred; `data` is the translated, display-ready message. */\n FormErrorMessage = \"form_error_message\",\n /**\n * Emitted for embedded forms instead of submitting directly: `data` is the full\n * submission body for the host to persist/forward.\n */\n SubmissionBody = \"submission_body\",\n /** The form was submitted successfully. `action` indicates whether it was a new submission or an update. */\n FormSubmitSuccess = \"form_submit_success\",\n /** Connexions: the host should perform the profile redirect (embed mode). */\n ConnexionsProfileRedirect = \"connexions_profile_redirect\",\n /** Connexions: the host should trigger the vCard download (embed mode). */\n ConnexionsDownloadVcard = \"connexions_download_vcard\",\n}\n\n/**\n * Opaque submission payload carried by {@link OutboundMessageType.SubmissionBody}.\n *\n * This mirrors the webview's internal `FormSubmission` model. It is intentionally\n * typed as an open record here so the SDK stays decoupled from the app's full model\n * graph; the documented fields below are stable, the rest are passed through as-is.\n * Host code that needs the deep element-value types should treat `data` as untyped\n * and key it by element id (e.g. `\"element_12\"`, `\"element_12_3\"`).\n */\nexport interface SubmissionBody {\n id: number;\n form_id: number;\n prospect_id: number;\n email: string;\n first_name: string;\n last_name: string;\n full_name: string;\n company: string;\n phone: string;\n /** Submitted values keyed by element id / sub-element id. */\n data: Record<string, unknown>;\n /**\n * Visible, filled elements ready to render as key/value rows — one item per\n * element, discriminated by `element_type` (narrow on it for a precisely-typed\n * `element_value`). See {@link VisibleSubmissionDataItem}. May be absent on older\n * webview builds.\n */\n visible_submissions_data?: VisibleSubmissionDataItem[];\n submission_date: string;\n /** Query-string params the webview was loaded with, echoed back on submit. */\n query_parameters?: Record<string, string>;\n /** Additional fields from the webview's submission model are passed through verbatim. */\n [key: string]: unknown;\n}\n\n/**\n * Loose submission shape accepted when **pre-filling** the form (host → webview).\n *\n * Distinct from {@link SubmissionBody}: a received `submission_body` is always fully\n * populated, but when pre-filling you typically either round-trip a previously-received\n * body or pass a partial object assembled from your own data. A {@link SubmissionBody}\n * is assignable to this, so round-tripping just works.\n */\nexport interface SubmissionPrefill {\n /** Submitted values keyed by element id / sub-element id. */\n data?: Record<string, unknown>;\n [key: string]: unknown;\n}\n\ninterface FormLoadCompleteMessage {\n type: OutboundMessageType.FormLoadComplete;\n}\ninterface FormSubmitSuccessMessage {\n type: OutboundMessageType.FormSubmitSuccess;\n action: \"create\" | \"update\";\n}\ninterface FormErrorMessageMessage {\n type: OutboundMessageType.FormErrorMessage;\n /** Translated, display-ready error text. */\n data: string;\n}\ninterface SubmissionBodyMessage {\n type: OutboundMessageType.SubmissionBody;\n data: SubmissionBody;\n}\ninterface ConnexionsProfileRedirectMessage {\n type: OutboundMessageType.ConnexionsProfileRedirect;\n}\ninterface ConnexionsDownloadVcardMessage {\n type: OutboundMessageType.ConnexionsDownloadVcard;\n}\n\n/** Discriminated union of every message the webview can emit to its host. */\nexport type OutboundMessage =\n | FormLoadCompleteMessage\n | FormSubmitSuccessMessage\n | FormErrorMessageMessage\n | SubmissionBodyMessage\n | ConnexionsProfileRedirectMessage\n | ConnexionsDownloadVcardMessage;\n\n/** Maps each outbound `type` to its full message shape (used by the client's `.on`). */\nexport type OutboundMessageMap = {\n [M in OutboundMessage as M[\"type\"]]: M;\n};\n\n/* ------------------------------------------------------------------ *\n * Inbound: host → webview\n * ------------------------------------------------------------------ */\n\n/** Message `type` values the host sends into the webview. */\nexport enum InboundMessageType {\n /** Programmatically trigger form submission (as if the user pressed submit). */\n Submit = \"submit_form\",\n /** Reset the form, clearing all entered values. */\n Reset = \"reset_form\",\n /** Pre-fill the form with existing data. */\n FormPrefill = \"form_prefill\",\n /** Switch the current submission into draft-update mode. */\n UpdateDraft = \"update_draft\",\n /** Run validation against a target field (or the whole form). */\n TriggerValidation = \"trigger_validation\",\n}\n\n/** Shape selector for {@link InboundMessageType.FormPrefill} payloads. */\nexport enum PrefillDataType {\n UlcSubmissionAndInfo = \"ulc_submission_and_info\",\n}\n\n/** Targets for {@link InboundMessageType.TriggerValidation}. */\nexport type ValidationTarget = \"invitation_code\" | \"email\" | \"all\";\n\n/**\n * A single transcription field/value item for the `info` prefill array.\n *\n * The webview matches each item to a form element by `ll_field_unique_identifier`\n * alone (e.g. `\"FirstName\"`, `\"Email\"`); `ll_field_id` is catalog metadata and is not\n * used for matching, so it is accepted as either a number or a string. `value` is\n * typically a string but may be a boolean (e.g. the PII opt-out field).\n */\nexport interface PrefillInfoItem {\n ll_field_unique_identifier: string;\n ll_field_id?: string | number;\n value: string | boolean;\n}\n\ninterface SubmitMessage {\n type: InboundMessageType.Submit;\n}\ninterface ResetMessage {\n type: InboundMessageType.Reset;\n}\ninterface UpdateDraftMessage {\n type: InboundMessageType.UpdateDraft;\n}\ninterface TriggerValidationMessage {\n type: InboundMessageType.TriggerValidation;\n target: ValidationTarget;\n}\ninterface PrefillMessage {\n type: InboundMessageType.FormPrefill;\n data_type: PrefillDataType.UlcSubmissionAndInfo;\n data: { submission?: SubmissionPrefill; info?: PrefillInfoItem[] };\n}\n\n/** Discriminated union of every message the host can send into the webview. */\nexport type InboundMessage =\n | SubmitMessage\n | ResetMessage\n | UpdateDraftMessage\n | TriggerValidationMessage\n | PrefillMessage;\n\n/* ------------------------------------------------------------------ *\n * Runtime guards / parsing\n * ------------------------------------------------------------------ */\n\nconst OUTBOUND_TYPES: ReadonlySet<string> = new Set(Object.values(OutboundMessageType));\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/**\n * Parses a raw `MessageEvent.data` value into a typed {@link OutboundMessage}, or\n * returns `null` if it is not a recognized Captello webview message.\n *\n * Accepts either a JSON string (the webview always sends strings) or an\n * already-parsed object, so it is robust to hosts/proxies that pre-parse.\n */\nexport function parseOutboundMessage(data: unknown): OutboundMessage | null {\n let value: unknown = data;\n if (typeof value === \"string\") {\n try {\n value = JSON.parse(value);\n } catch {\n return null;\n }\n }\n if (!isPlainObject(value)) return null;\n if (typeof value[\"type\"] !== \"string\" || !OUTBOUND_TYPES.has(value[\"type\"])) return null;\n return value as unknown as OutboundMessage;\n}\n","import { InboundMessageType, OutboundMessageType, parseOutboundMessage, PrefillDataType } from \"./messages\";\nimport type {\n InboundMessage,\n OutboundMessage,\n OutboundMessageMap,\n PrefillInfoItem,\n SubmissionBody,\n SubmissionPrefill,\n ValidationTarget,\n} from \"./messages\";\n\n/** Listener for a specific outbound message type. */\nexport type OutboundListener<T extends OutboundMessageType> = (message: OutboundMessageMap[T]) => void;\n\n/** Listener for every outbound message (used by {@link CaptelloWebview.onAny}). */\nexport type AnyOutboundListener = (message: OutboundMessage) => void;\n\n/** Unsubscribe handle returned by every `on*` method. Calling it removes the listener. */\nexport type Unsubscribe = () => void;\n\n/**\n * Rejection reason from {@link CaptelloWebview.submitAndWait} when the webview reports\n * a `form_error_message`. `message` is the translated, display-ready text.\n */\nexport class SubmissionError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SubmissionError\";\n }\n}\n\n/**\n * Rejection reason from {@link CaptelloWebview.submitAndWait} when no `submission_body`\n * or `form_error_message` arrives within the timeout.\n */\nexport class SubmissionTimeoutError extends Error {\n constructor(public readonly timeoutMs: number) {\n super(`Captello webview did not respond to submit within ${timeoutMs}ms.`);\n this.name = \"SubmissionTimeoutError\";\n }\n}\n\nexport interface CaptelloWebviewOptions {\n /**\n * Origin to validate incoming messages against and to target outgoing messages.\n * Strongly recommended — set it to the webview's origin (e.g.\n * `\"https://capture.captello.com\"`), e.g. `new URL(embedUrl).origin`.\n *\n * Defaults to `\"*\"`, which accepts messages from any origin and posts without an\n * origin check. Only acceptable for trusted/local development.\n */\n targetOrigin?: string;\n /**\n * The window to attach the `message` listener to. Defaults to the global `window`.\n * Override for testing or non-standard host environments.\n */\n hostWindow?: Window;\n /**\n * If `true` (default), incoming messages are accepted only when they originate\n * from the bound iframe's `contentWindow`. Set `false` only if the webview relays\n * messages through an intermediate window and source matching is impossible.\n */\n matchSource?: boolean;\n /**\n * If `true` (default), messages sent before the webview reports\n * `form_load_complete` are buffered and flushed, in order, once it's ready. This\n * removes a common footgun: calling `prefill(...)` right after mount would\n * otherwise post to a form that isn't listening yet and be silently dropped.\n *\n * Set `false` to send immediately (the legacy behavior). Note: a client that\n * attaches *after* the form already loaded will not have seen `form_load_complete`,\n * so its queued messages won't flush — create the client with the iframe.\n */\n queueUntilReady?: boolean;\n}\n\n/** Emits a console warning in development builds only. No-op in production / no bundler. */\nfunction devWarn(message: string): void {\n try {\n if (typeof process !== \"undefined\" && process.env && process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(message);\n }\n } catch {\n /* `process` not defined (pure browser, no bundler define) → stay silent */\n }\n}\n\ntype ElementOrFrame = HTMLIFrameElement | { contentWindow: Window | null };\n\n/**\n * Host-side controller for an embedded Captello capture webview.\n *\n * Wraps a single `<iframe>` and encodes the full message protocol:\n * - **Receiving** (webview → host): subscribe with {@link on} / {@link onAny}.\n * - **Sending** (host → webview): use {@link submit}, {@link reset}, {@link prefill},\n * {@link triggerValidation}, {@link updateDraft}, or the lower-level {@link send}.\n *\n * Wire details handled for you: outgoing messages are `JSON.stringify`'d (the webview\n * parses inbound data with `JSON.parse`, so a raw object would be ignored), and\n * incoming messages are validated by origin + source before being parsed.\n *\n * @example\n * ```ts\n * const iframe = document.querySelector(\"iframe\")!;\n * const webview = new CaptelloWebview(iframe, {\n * targetOrigin: \"https://capture.captello.com\",\n * });\n *\n * webview.on(OutboundMessageType.FormLoadComplete, () => console.log(\"ready\"));\n * webview.on(OutboundMessageType.SubmissionBody, (msg) => save(msg.data));\n *\n * // later, drive the form:\n * webview.submit();\n *\n * // on teardown:\n * webview.destroy();\n * ```\n */\nexport class CaptelloWebview {\n private readonly frame: ElementOrFrame;\n private readonly targetOrigin: string;\n private readonly hostWindow: Window;\n private readonly matchSource: boolean;\n\n private readonly listeners = new Map<OutboundMessageType, Set<OutboundListener<OutboundMessageType>>>();\n private readonly anyListeners = new Set<AnyOutboundListener>();\n private readonly boundHandler: (event: MessageEvent) => void;\n private destroyed = false;\n\n private readonly queueUntilReady: boolean;\n /** True once `form_load_complete` has been observed. */\n private ready = false;\n /** Messages sent before ready, flushed in order on load. */\n private readonly outbox: InboundMessage[] = [];\n\n constructor(frame: ElementOrFrame, options: CaptelloWebviewOptions = {}) {\n if (!frame) {\n throw new Error(\"CaptelloWebview: an iframe element (or { contentWindow }) is required.\");\n }\n this.frame = frame;\n this.targetOrigin = options.targetOrigin ?? \"*\";\n this.matchSource = options.matchSource ?? true;\n this.queueUntilReady = options.queueUntilReady ?? true;\n\n // Nudge (dev only) when running without origin scoping. \"*\" accepts inbound\n // messages from any origin and posts outbound without an origin check — fine\n // for local/trusted dev, unsafe in production. Set targetOrigin to the\n // webview's origin, e.g. `new URL(embedUrl).origin`.\n if (this.targetOrigin === \"*\") {\n devWarn(\n '[captello-sdk] No targetOrigin set — defaulting to \"*\", which accepts messages ' +\n \"from any origin and posts without an origin check. Set targetOrigin to the webview's \" +\n \"origin (e.g. new URL(embedUrl).origin) in production.\",\n );\n }\n\n const hostWindow = options.hostWindow ?? (typeof window !== \"undefined\" ? window : undefined);\n if (!hostWindow) {\n throw new Error(\n \"CaptelloWebview: no host window available. Pass `hostWindow` when constructing outside a browser.\",\n );\n }\n this.hostWindow = hostWindow;\n\n this.boundHandler = (event: MessageEvent) => this.handleMessage(event);\n this.hostWindow.addEventListener(\"message\", this.boundHandler);\n }\n\n /** `true` once the webview has reported `form_load_complete`. */\n get isReady(): boolean {\n return this.ready;\n }\n\n /* -------------------------------------------------------------- *\n * Receiving (webview → host)\n * -------------------------------------------------------------- */\n\n /**\n * Subscribe to a single outbound message type. Returns an unsubscribe function.\n *\n * @example webview.on(OutboundMessageType.FormErrorMessage, (m) => toast(m.data));\n */\n on<T extends OutboundMessageType>(type: T, listener: OutboundListener<T>): Unsubscribe {\n let set = this.listeners.get(type);\n if (!set) {\n set = new Set();\n this.listeners.set(type, set);\n }\n set.add(listener as OutboundListener<OutboundMessageType>);\n return () => {\n set?.delete(listener as OutboundListener<OutboundMessageType>);\n };\n }\n\n /**\n * Subscribe once: the listener is removed automatically after it fires the first\n * time for `type`. Returns an unsubscribe function for cancelling early.\n */\n once<T extends OutboundMessageType>(type: T, listener: OutboundListener<T>): Unsubscribe {\n const off = this.on(type, (message) => {\n off();\n listener(message);\n });\n return off;\n }\n\n /** Subscribe to every outbound message regardless of type. Returns an unsubscribe function. */\n onAny(listener: AnyOutboundListener): Unsubscribe {\n this.anyListeners.add(listener);\n return () => {\n this.anyListeners.delete(listener);\n };\n }\n\n /* -------------------------------------------------------------- *\n * Sending (host → webview)\n * -------------------------------------------------------------- */\n\n /**\n * Low-level send: posts any inbound message to the webview as a JSON string.\n * Prefer the typed helpers below; use this only for forward-compatibility.\n *\n * When `queueUntilReady` is enabled (the default) and the form hasn't reported\n * `form_load_complete` yet, the message is buffered and flushed on load instead of\n * posted immediately.\n *\n * @throws if the iframe's `contentWindow` is not available (not yet loaded /\n * detached) and the message can't be queued.\n */\n send(message: InboundMessage): void {\n if (this.destroyed) {\n throw new Error(\"CaptelloWebview: cannot send after destroy().\");\n }\n if (this.queueUntilReady && !this.ready) {\n this.outbox.push(message);\n return;\n }\n this.postNow(message);\n }\n\n /** Posts a message immediately, bypassing the ready-queue. */\n private postNow(message: InboundMessage): void {\n const target = this.frame.contentWindow;\n if (!target) {\n throw new Error(\n \"CaptelloWebview: iframe.contentWindow is null. Wait for the iframe to load before sending.\",\n );\n }\n // The webview reads inbound data with JSON.parse(event.data), so it must be a string.\n target.postMessage(JSON.stringify(message), this.targetOrigin);\n }\n\n /** Marks the client ready and flushes any queued messages, in order. */\n private markReadyAndFlush(): void {\n if (this.ready) return;\n this.ready = true;\n const queued = this.outbox.splice(0);\n for (const message of queued) {\n try {\n this.postNow(message);\n } catch {\n /* iframe detached between load and flush — drop silently */\n }\n }\n }\n\n /** Programmatically submit the form (fire-and-forget). */\n submit(): void {\n this.send({ type: InboundMessageType.Submit });\n }\n\n /**\n * Submit the form and await the outcome.\n *\n * Sends `submit_form`, then resolves with the {@link SubmissionBody} when the\n * webview emits `submission_body`, or rejects with a {@link SubmissionError}\n * (carrying the translated message) when it emits `form_error_message`. Rejects\n * with a {@link SubmissionTimeoutError} if neither arrives within `timeoutMs`.\n *\n * This is the typed, leak-free version of the common \"click submit, wait for the\n * result\" flow — listeners are always cleaned up, including on timeout.\n *\n * @param timeoutMs how long to wait before giving up. Defaults to 60_000.\n * @example\n * try {\n * const body = await webview.submitAndWait();\n * await persist(body);\n * } catch (err) {\n * if (err instanceof SubmissionError) showToast(err.message);\n * }\n */\n submitAndWait(timeoutMs = 60_000): Promise<SubmissionBody> {\n return new Promise<SubmissionBody>((resolve, reject) => {\n let settled = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n const cleanup = () => {\n settled = true;\n offSuccess();\n offError();\n if (timer !== undefined) clearTimeout(timer);\n };\n\n const offSuccess = this.on(OutboundMessageType.SubmissionBody, (message) => {\n if (settled) return;\n cleanup();\n resolve(message.data);\n });\n const offError = this.on(OutboundMessageType.FormErrorMessage, (message) => {\n if (settled) return;\n cleanup();\n reject(new SubmissionError(message.data));\n });\n\n if (timeoutMs > 0 && timeoutMs !== Infinity) {\n timer = setTimeout(() => {\n if (settled) return;\n cleanup();\n reject(new SubmissionTimeoutError(timeoutMs));\n }, timeoutMs);\n }\n\n try {\n this.send({ type: InboundMessageType.Submit });\n } catch (err) {\n if (!settled) {\n cleanup();\n reject(err);\n }\n }\n });\n }\n\n /** Reset the form, clearing all entered values. */\n reset(): void {\n this.send({ type: InboundMessageType.Reset });\n }\n\n /** Switch the current submission into draft-update mode. */\n updateDraft(): void {\n this.send({ type: InboundMessageType.UpdateDraft });\n }\n\n /** Run validation against a target field, or `\"all\"` for the whole form. */\n triggerValidation(target: ValidationTarget): void {\n this.send({ type: InboundMessageType.TriggerValidation, target });\n }\n\n /** Pre-fill form fields from a submission body, transcription items, or both. */\n prefill(data: { submission?: SubmissionPrefill; info?: PrefillInfoItem[] }): void {\n this.send({\n type: InboundMessageType.FormPrefill,\n data_type: PrefillDataType.UlcSubmissionAndInfo,\n data,\n });\n }\n\n /* -------------------------------------------------------------- *\n * Lifecycle\n * -------------------------------------------------------------- */\n\n /** Remove the `message` listener and drop all subscriptions. Idempotent. */\n destroy(): void {\n if (this.destroyed) return;\n this.destroyed = true;\n this.hostWindow.removeEventListener(\"message\", this.boundHandler);\n this.listeners.clear();\n this.anyListeners.clear();\n this.outbox.length = 0;\n }\n\n /* -------------------------------------------------------------- *\n * Internals\n * -------------------------------------------------------------- */\n\n private handleMessage(event: MessageEvent): void {\n if (this.destroyed) return;\n\n // Origin check: skip when targetOrigin is the wildcard. Warn (dev only) if a\n // message that *looks* like ours is dropped on origin — a common \"why isn't my\n // listener firing?\" cause.\n if (this.targetOrigin !== \"*\" && event.origin !== this.targetOrigin) {\n if (parseOutboundMessage(event.data)) {\n devWarn(\n `[captello-sdk] Ignored a Captello message from origin \"${event.origin}\" ` +\n `(expected \"${this.targetOrigin}\"). Check the targetOrigin you passed.`,\n );\n }\n return;\n }\n\n // Source check: only accept messages from the bound iframe's window.\n if (this.matchSource) {\n const expected = this.frame.contentWindow;\n if (expected && event.source !== expected) {\n if (parseOutboundMessage(event.data)) {\n devWarn(\n \"[captello-sdk] Ignored a Captello message from an unexpected source window \" +\n \"(not the bound iframe). If the webview relays through another window, set matchSource: false.\",\n );\n }\n return;\n }\n }\n\n const message = parseOutboundMessage(event.data);\n if (!message) return;\n\n // Flip to ready (and flush queued sends) the moment the form loads, before\n // dispatching to listeners — so a listener can send and have it post immediately.\n if (message.type === OutboundMessageType.FormLoadComplete) {\n this.markReadyAndFlush();\n }\n\n const set = this.listeners.get(message.type);\n if (set) {\n // Copy to a snapshot so a listener that unsubscribes mid-dispatch is safe.\n for (const listener of [...set]) listener(message);\n }\n if (this.anyListeners.size) {\n for (const listener of [...this.anyListeners]) listener(message);\n }\n }\n}\n"]}
|
|
@@ -1,517 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for a submission's **visible** data — the list a host renders as key/value
|
|
3
|
-
* pairs (one row per filled, visible form element).
|
|
4
|
-
*
|
|
5
|
-
* The webview emits this as `visible_submissions_data` inside the `submission_body`
|
|
6
|
-
* payload: an array of {@link VisibleSubmissionDataItem}, discriminated by
|
|
7
|
-
* `element_type`, where `element_value`'s shape depends on the type. Narrow on
|
|
8
|
-
* `element_type` to get a precisely-typed `element_value` and render it however you
|
|
9
|
-
* like:
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* for (const item of submission.visible_submissions_data ?? []) {
|
|
13
|
-
* switch (item.element_type) {
|
|
14
|
-
* case FormElementType.email:
|
|
15
|
-
* row(item.element_title, item.element_value); // element_value: string
|
|
16
|
-
* break;
|
|
17
|
-
* case FormElementType.checkbox:
|
|
18
|
-
* // element_value: string[] | OrderCheckboxSubmissionData
|
|
19
|
-
* break;
|
|
20
|
-
* // …
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Every form element type, mirroring the webview's `FormElementType`. The string
|
|
26
|
-
* values are the wire values. Structural types (sections, separators, …) never carry
|
|
27
|
-
* a value and never appear in visible submission data.
|
|
28
|
-
*/
|
|
29
|
-
declare enum FormElementType {
|
|
30
|
-
email = "email",
|
|
31
|
-
section = "section_block",
|
|
32
|
-
html_block = "section",
|
|
33
|
-
url = "url",
|
|
34
|
-
text = "text",
|
|
35
|
-
select = "select",
|
|
36
|
-
radio = "radio",
|
|
37
|
-
simple_name = "simple_name",
|
|
38
|
-
textarea = "textarea",
|
|
39
|
-
time = "time",
|
|
40
|
-
address = "address",
|
|
41
|
-
money = "money",
|
|
42
|
-
number = "number",
|
|
43
|
-
date = "date",
|
|
44
|
-
phone = "phone",
|
|
45
|
-
simple_phone = "simple_phone",
|
|
46
|
-
checkbox = "checkbox",
|
|
47
|
-
image = "image",
|
|
48
|
-
business_card = "business_card",
|
|
49
|
-
signature = "signature",
|
|
50
|
-
barcode = "barcode",
|
|
51
|
-
separator = "column_separator",
|
|
52
|
-
activation = "activation",
|
|
53
|
-
document = "documents",
|
|
54
|
-
datetime = "datetime",
|
|
55
|
-
meeting = "meeting",
|
|
56
|
-
audio = "audio",
|
|
57
|
-
rating = "rating",
|
|
58
|
-
assign_owner = "assign_owner",
|
|
59
|
-
boolean = "boolean",
|
|
60
|
-
engagem_feeder = "engagem_feeder",
|
|
61
|
-
speaker_section = "speaker_section_block",
|
|
62
|
-
session_section = "session_section_block",
|
|
63
|
-
image_placeholder = "image_placeholder",
|
|
64
|
-
star_rating = "star_survey",
|
|
65
|
-
attachments = "attachments"
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* `simple_name` value: the visible sub-fields keyed by their transcription identifier
|
|
69
|
-
* (`ll_field_unique_identifier`), the same identifiers used by prefill. Hidden sub-fields are
|
|
70
|
-
* omitted, so keys are optional.
|
|
71
|
-
*/
|
|
72
|
-
type NameSubmissionValue = {
|
|
73
|
-
FirstName?: string;
|
|
74
|
-
LastName?: string;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* `address` value: the visible sub-fields keyed by their transcription identifier
|
|
78
|
-
* (`ll_field_unique_identifier`). Hidden sub-fields are omitted, so keys are optional.
|
|
79
|
-
*/
|
|
80
|
-
type AddressSubmissionValue = {
|
|
81
|
-
StreetAddress?: string;
|
|
82
|
-
StreetAddress2?: string;
|
|
83
|
-
City?: string;
|
|
84
|
-
State?: string;
|
|
85
|
-
Zipcode?: string;
|
|
86
|
-
Country?: string;
|
|
87
|
-
};
|
|
88
|
-
/** Checkbox value when the element is an "order" checkbox (quantities + note). */
|
|
89
|
-
type OrderCheckboxSubmissionData = {
|
|
90
|
-
values: {
|
|
91
|
-
value: string;
|
|
92
|
-
quantity: number;
|
|
93
|
-
}[];
|
|
94
|
-
note: string;
|
|
95
|
-
};
|
|
96
|
-
/** Radio/select value when the element is an "order" radio/select (quantity + note). */
|
|
97
|
-
type OrderRadioSubmissionData = {
|
|
98
|
-
value: string;
|
|
99
|
-
quantity: number;
|
|
100
|
-
note: string;
|
|
101
|
-
};
|
|
102
|
-
/** An uploaded attachment. `blob` is not present on the wire (postMessage JSON drops it). */
|
|
103
|
-
type AttachmentValue = {
|
|
104
|
-
token: string;
|
|
105
|
-
url: string;
|
|
106
|
-
name: string;
|
|
107
|
-
size: number;
|
|
108
|
-
};
|
|
109
|
-
/** A business-card capture: front/back image references (either may be absent). */
|
|
110
|
-
type BusinessCardValue = {
|
|
111
|
-
front: string;
|
|
112
|
-
back: string;
|
|
113
|
-
};
|
|
114
|
-
/** One engagement-feeder question/answer entry. */
|
|
115
|
-
type SubmissionQuestionData = {
|
|
116
|
-
question: string;
|
|
117
|
-
answers: string[];
|
|
118
|
-
/** `""` when the element is hidden. */
|
|
119
|
-
correct_answer: number | "";
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* Maps each value-carrying element type to its `element_value` shape. Structural
|
|
123
|
-
* types are intentionally absent, so they can never appear in a visible item.
|
|
124
|
-
*/
|
|
125
|
-
type VisibleSubmissionElementValueMap = {
|
|
126
|
-
[FormElementType.email]: string;
|
|
127
|
-
[FormElementType.url]: string;
|
|
128
|
-
[FormElementType.text]: string;
|
|
129
|
-
[FormElementType.textarea]: string;
|
|
130
|
-
[FormElementType.money]: string;
|
|
131
|
-
[FormElementType.number]: string;
|
|
132
|
-
[FormElementType.phone]: string;
|
|
133
|
-
[FormElementType.simple_phone]: string;
|
|
134
|
-
[FormElementType.date]: string;
|
|
135
|
-
[FormElementType.time]: string;
|
|
136
|
-
[FormElementType.datetime]: string;
|
|
137
|
-
[FormElementType.audio]: string;
|
|
138
|
-
[FormElementType.rating]: string;
|
|
139
|
-
[FormElementType.star_rating]: string;
|
|
140
|
-
[FormElementType.assign_owner]: string;
|
|
141
|
-
[FormElementType.signature]: string;
|
|
142
|
-
[FormElementType.barcode]: string;
|
|
143
|
-
[FormElementType.meeting]: string;
|
|
144
|
-
[FormElementType.activation]: string;
|
|
145
|
-
[FormElementType.checkbox]: string[] | OrderCheckboxSubmissionData;
|
|
146
|
-
[FormElementType.radio]: string | OrderRadioSubmissionData;
|
|
147
|
-
[FormElementType.select]: string | OrderRadioSubmissionData;
|
|
148
|
-
[FormElementType.image]: string[];
|
|
149
|
-
[FormElementType.document]: number[];
|
|
150
|
-
[FormElementType.engagem_feeder]: SubmissionQuestionData[];
|
|
151
|
-
[FormElementType.business_card]: Partial<BusinessCardValue>;
|
|
152
|
-
[FormElementType.boolean]: boolean;
|
|
153
|
-
[FormElementType.attachments]: AttachmentValue[];
|
|
154
|
-
[FormElementType.simple_name]: NameSubmissionValue;
|
|
155
|
-
[FormElementType.address]: AddressSubmissionValue;
|
|
156
|
-
};
|
|
157
|
-
/** Element types that carry a user-facing value (i.e. can appear in visible data). */
|
|
158
|
-
type VisibleSubmissionElementType = keyof VisibleSubmissionElementValueMap;
|
|
159
|
-
/**
|
|
160
|
-
* One entry in `visible_submissions_data`, discriminated by `element_type`. Narrowing
|
|
161
|
-
* on `element_type` gives a precisely-typed `element_value`.
|
|
162
|
-
*/
|
|
163
|
-
type VisibleSubmissionDataItem = {
|
|
164
|
-
[T in VisibleSubmissionElementType]: {
|
|
165
|
-
element_id: string;
|
|
166
|
-
element_title: string;
|
|
167
|
-
element_type: T;
|
|
168
|
-
element_value: VisibleSubmissionElementValueMap[T];
|
|
169
|
-
};
|
|
170
|
-
}[VisibleSubmissionElementType];
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* The message protocol exchanged between the Captello capture webview (the iframe)
|
|
174
|
-
* and its host page.
|
|
175
|
-
*
|
|
176
|
-
* Wire format (this is the contract — match it exactly):
|
|
177
|
-
* - Every message is a JSON **string**. The webview sends outbound messages with
|
|
178
|
-
* `JSON.stringify(message)` and reads inbound messages with `JSON.parse(event.data)`.
|
|
179
|
-
* A host that posts a raw object instead of a string will be ignored, because the
|
|
180
|
-
* webview's parser produces a non-object and bails.
|
|
181
|
-
* - Every message is an object with a `type` discriminator. Inbound and outbound
|
|
182
|
-
* types are disjoint string enums.
|
|
183
|
-
*
|
|
184
|
-
* Direction is named from the **webview's** point of view:
|
|
185
|
-
* - {@link OutboundMessageType}: webview → host (the host listens for these).
|
|
186
|
-
* - {@link InboundMessageType}: host → webview (the host sends these).
|
|
187
|
-
*/
|
|
188
|
-
|
|
189
|
-
/** Message `type` values the webview emits to its host. */
|
|
190
|
-
declare enum OutboundMessageType {
|
|
191
|
-
/** The form finished loading and rendering. Safe to interact with it after this. */
|
|
192
|
-
FormLoadComplete = "form_load_complete",
|
|
193
|
-
/** A user-facing error occurred; `data` is the translated, display-ready message. */
|
|
194
|
-
FormErrorMessage = "form_error_message",
|
|
195
|
-
/**
|
|
196
|
-
* Emitted for embedded forms instead of submitting directly: `data` is the full
|
|
197
|
-
* submission body for the host to persist/forward.
|
|
198
|
-
*/
|
|
199
|
-
SubmissionBody = "submission_body",
|
|
200
|
-
/** The form was submitted successfully. `action` indicates whether it was a new submission or an update. */
|
|
201
|
-
FormSubmitSuccess = "form_submit_success",
|
|
202
|
-
/** Connexions: the host should perform the profile redirect (embed mode). */
|
|
203
|
-
ConnexionsProfileRedirect = "connexions_profile_redirect",
|
|
204
|
-
/** Connexions: the host should trigger the vCard download (embed mode). */
|
|
205
|
-
ConnexionsDownloadVcard = "connexions_download_vcard"
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Opaque submission payload carried by {@link OutboundMessageType.SubmissionBody}.
|
|
209
|
-
*
|
|
210
|
-
* This mirrors the webview's internal `FormSubmission` model. It is intentionally
|
|
211
|
-
* typed as an open record here so the SDK stays decoupled from the app's full model
|
|
212
|
-
* graph; the documented fields below are stable, the rest are passed through as-is.
|
|
213
|
-
* Host code that needs the deep element-value types should treat `data` as untyped
|
|
214
|
-
* and key it by element id (e.g. `"element_12"`, `"element_12_3"`).
|
|
215
|
-
*/
|
|
216
|
-
interface SubmissionBody {
|
|
217
|
-
id: number;
|
|
218
|
-
form_id: number;
|
|
219
|
-
prospect_id: number;
|
|
220
|
-
email: string;
|
|
221
|
-
first_name: string;
|
|
222
|
-
last_name: string;
|
|
223
|
-
full_name: string;
|
|
224
|
-
company: string;
|
|
225
|
-
phone: string;
|
|
226
|
-
/** Submitted values keyed by element id / sub-element id. */
|
|
227
|
-
data: Record<string, unknown>;
|
|
228
|
-
/**
|
|
229
|
-
* Visible, filled elements ready to render as key/value rows — one item per
|
|
230
|
-
* element, discriminated by `element_type` (narrow on it for a precisely-typed
|
|
231
|
-
* `element_value`). See {@link VisibleSubmissionDataItem}. May be absent on older
|
|
232
|
-
* webview builds.
|
|
233
|
-
*/
|
|
234
|
-
visible_submissions_data?: VisibleSubmissionDataItem[];
|
|
235
|
-
submission_date: string;
|
|
236
|
-
/** Query-string params the webview was loaded with, echoed back on submit. */
|
|
237
|
-
query_parameters?: Record<string, string>;
|
|
238
|
-
/** Additional fields from the webview's submission model are passed through verbatim. */
|
|
239
|
-
[key: string]: unknown;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Loose submission shape accepted when **pre-filling** the form (host → webview).
|
|
243
|
-
*
|
|
244
|
-
* Distinct from {@link SubmissionBody}: a received `submission_body` is always fully
|
|
245
|
-
* populated, but when pre-filling you typically either round-trip a previously-received
|
|
246
|
-
* body or pass a partial object assembled from your own data. A {@link SubmissionBody}
|
|
247
|
-
* is assignable to this, so round-tripping just works.
|
|
248
|
-
*/
|
|
249
|
-
interface SubmissionPrefill {
|
|
250
|
-
/** Submitted values keyed by element id / sub-element id. */
|
|
251
|
-
data?: Record<string, unknown>;
|
|
252
|
-
[key: string]: unknown;
|
|
253
|
-
}
|
|
254
|
-
interface FormLoadCompleteMessage {
|
|
255
|
-
type: OutboundMessageType.FormLoadComplete;
|
|
256
|
-
}
|
|
257
|
-
interface FormSubmitSuccessMessage {
|
|
258
|
-
type: OutboundMessageType.FormSubmitSuccess;
|
|
259
|
-
action: "create" | "update";
|
|
260
|
-
}
|
|
261
|
-
interface FormErrorMessageMessage {
|
|
262
|
-
type: OutboundMessageType.FormErrorMessage;
|
|
263
|
-
/** Translated, display-ready error text. */
|
|
264
|
-
data: string;
|
|
265
|
-
}
|
|
266
|
-
interface SubmissionBodyMessage {
|
|
267
|
-
type: OutboundMessageType.SubmissionBody;
|
|
268
|
-
data: SubmissionBody;
|
|
269
|
-
}
|
|
270
|
-
interface ConnexionsProfileRedirectMessage {
|
|
271
|
-
type: OutboundMessageType.ConnexionsProfileRedirect;
|
|
272
|
-
}
|
|
273
|
-
interface ConnexionsDownloadVcardMessage {
|
|
274
|
-
type: OutboundMessageType.ConnexionsDownloadVcard;
|
|
275
|
-
}
|
|
276
|
-
/** Discriminated union of every message the webview can emit to its host. */
|
|
277
|
-
type OutboundMessage = FormLoadCompleteMessage | FormSubmitSuccessMessage | FormErrorMessageMessage | SubmissionBodyMessage | ConnexionsProfileRedirectMessage | ConnexionsDownloadVcardMessage;
|
|
278
|
-
/** Maps each outbound `type` to its full message shape (used by the client's `.on`). */
|
|
279
|
-
type OutboundMessageMap = {
|
|
280
|
-
[M in OutboundMessage as M["type"]]: M;
|
|
281
|
-
};
|
|
282
|
-
/** Message `type` values the host sends into the webview. */
|
|
283
|
-
declare enum InboundMessageType {
|
|
284
|
-
/** Programmatically trigger form submission (as if the user pressed submit). */
|
|
285
|
-
Submit = "submit_form",
|
|
286
|
-
/** Reset the form, clearing all entered values. */
|
|
287
|
-
Reset = "reset_form",
|
|
288
|
-
/** Pre-fill the form with existing data. */
|
|
289
|
-
FormPrefill = "form_prefill",
|
|
290
|
-
/** Switch the current submission into draft-update mode. */
|
|
291
|
-
UpdateDraft = "update_draft",
|
|
292
|
-
/** Run validation against a target field (or the whole form). */
|
|
293
|
-
TriggerValidation = "trigger_validation"
|
|
294
|
-
}
|
|
295
|
-
/** Shape selector for {@link InboundMessageType.FormPrefill} payloads. */
|
|
296
|
-
declare enum PrefillDataType {
|
|
297
|
-
UlcSubmissionAndInfo = "ulc_submission_and_info"
|
|
298
|
-
}
|
|
299
|
-
/** Targets for {@link InboundMessageType.TriggerValidation}. */
|
|
300
|
-
type ValidationTarget = "invitation_code" | "email" | "all";
|
|
301
|
-
/**
|
|
302
|
-
* A single transcription field/value item for the `info` prefill array.
|
|
303
|
-
*
|
|
304
|
-
* The webview matches each item to a form element by `ll_field_unique_identifier`
|
|
305
|
-
* alone (e.g. `"FirstName"`, `"Email"`); `ll_field_id` is catalog metadata and is not
|
|
306
|
-
* used for matching, so it is accepted as either a number or a string. `value` is
|
|
307
|
-
* typically a string but may be a boolean (e.g. the PII opt-out field).
|
|
308
|
-
*/
|
|
309
|
-
interface PrefillInfoItem {
|
|
310
|
-
ll_field_unique_identifier: string;
|
|
311
|
-
ll_field_id?: string | number;
|
|
312
|
-
value: string | boolean;
|
|
313
|
-
}
|
|
314
|
-
interface SubmitMessage {
|
|
315
|
-
type: InboundMessageType.Submit;
|
|
316
|
-
}
|
|
317
|
-
interface ResetMessage {
|
|
318
|
-
type: InboundMessageType.Reset;
|
|
319
|
-
}
|
|
320
|
-
interface UpdateDraftMessage {
|
|
321
|
-
type: InboundMessageType.UpdateDraft;
|
|
322
|
-
}
|
|
323
|
-
interface TriggerValidationMessage {
|
|
324
|
-
type: InboundMessageType.TriggerValidation;
|
|
325
|
-
target: ValidationTarget;
|
|
326
|
-
}
|
|
327
|
-
interface PrefillMessage {
|
|
328
|
-
type: InboundMessageType.FormPrefill;
|
|
329
|
-
data_type: PrefillDataType.UlcSubmissionAndInfo;
|
|
330
|
-
data: {
|
|
331
|
-
submission?: SubmissionPrefill;
|
|
332
|
-
info?: PrefillInfoItem[];
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
/** Discriminated union of every message the host can send into the webview. */
|
|
336
|
-
type InboundMessage = SubmitMessage | ResetMessage | UpdateDraftMessage | TriggerValidationMessage | PrefillMessage;
|
|
337
|
-
/**
|
|
338
|
-
* Parses a raw `MessageEvent.data` value into a typed {@link OutboundMessage}, or
|
|
339
|
-
* returns `null` if it is not a recognized Captello webview message.
|
|
340
|
-
*
|
|
341
|
-
* Accepts either a JSON string (the webview always sends strings) or an
|
|
342
|
-
* already-parsed object, so it is robust to hosts/proxies that pre-parse.
|
|
343
|
-
*/
|
|
344
|
-
declare function parseOutboundMessage(data: unknown): OutboundMessage | null;
|
|
345
|
-
|
|
346
|
-
/** Listener for a specific outbound message type. */
|
|
347
|
-
type OutboundListener<T extends OutboundMessageType> = (message: OutboundMessageMap[T]) => void;
|
|
348
|
-
/** Listener for every outbound message (used by {@link CaptelloWebview.onAny}). */
|
|
349
|
-
type AnyOutboundListener = (message: OutboundMessage) => void;
|
|
350
|
-
/** Unsubscribe handle returned by every `on*` method. Calling it removes the listener. */
|
|
351
|
-
type Unsubscribe = () => void;
|
|
352
|
-
/**
|
|
353
|
-
* Rejection reason from {@link CaptelloWebview.submitAndWait} when the webview reports
|
|
354
|
-
* a `form_error_message`. `message` is the translated, display-ready text.
|
|
355
|
-
*/
|
|
356
|
-
declare class SubmissionError extends Error {
|
|
357
|
-
constructor(message: string);
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Rejection reason from {@link CaptelloWebview.submitAndWait} when no `submission_body`
|
|
361
|
-
* or `form_error_message` arrives within the timeout.
|
|
362
|
-
*/
|
|
363
|
-
declare class SubmissionTimeoutError extends Error {
|
|
364
|
-
readonly timeoutMs: number;
|
|
365
|
-
constructor(timeoutMs: number);
|
|
366
|
-
}
|
|
367
|
-
interface CaptelloWebviewOptions {
|
|
368
|
-
/**
|
|
369
|
-
* Origin to validate incoming messages against and to target outgoing messages.
|
|
370
|
-
* Strongly recommended — set it to the webview's origin (e.g.
|
|
371
|
-
* `"https://capture.captello.com"`), e.g. `new URL(embedUrl).origin`.
|
|
372
|
-
*
|
|
373
|
-
* Defaults to `"*"`, which accepts messages from any origin and posts without an
|
|
374
|
-
* origin check. Only acceptable for trusted/local development.
|
|
375
|
-
*/
|
|
376
|
-
targetOrigin?: string;
|
|
377
|
-
/**
|
|
378
|
-
* The window to attach the `message` listener to. Defaults to the global `window`.
|
|
379
|
-
* Override for testing or non-standard host environments.
|
|
380
|
-
*/
|
|
381
|
-
hostWindow?: Window;
|
|
382
|
-
/**
|
|
383
|
-
* If `true` (default), incoming messages are accepted only when they originate
|
|
384
|
-
* from the bound iframe's `contentWindow`. Set `false` only if the webview relays
|
|
385
|
-
* messages through an intermediate window and source matching is impossible.
|
|
386
|
-
*/
|
|
387
|
-
matchSource?: boolean;
|
|
388
|
-
/**
|
|
389
|
-
* If `true` (default), messages sent before the webview reports
|
|
390
|
-
* `form_load_complete` are buffered and flushed, in order, once it's ready. This
|
|
391
|
-
* removes a common footgun: calling `prefill(...)` right after mount would
|
|
392
|
-
* otherwise post to a form that isn't listening yet and be silently dropped.
|
|
393
|
-
*
|
|
394
|
-
* Set `false` to send immediately (the legacy behavior). Note: a client that
|
|
395
|
-
* attaches *after* the form already loaded will not have seen `form_load_complete`,
|
|
396
|
-
* so its queued messages won't flush — create the client with the iframe.
|
|
397
|
-
*/
|
|
398
|
-
queueUntilReady?: boolean;
|
|
399
|
-
}
|
|
400
|
-
type ElementOrFrame = HTMLIFrameElement | {
|
|
401
|
-
contentWindow: Window | null;
|
|
402
|
-
};
|
|
403
|
-
/**
|
|
404
|
-
* Host-side controller for an embedded Captello capture webview.
|
|
405
|
-
*
|
|
406
|
-
* Wraps a single `<iframe>` and encodes the full message protocol:
|
|
407
|
-
* - **Receiving** (webview → host): subscribe with {@link on} / {@link onAny}.
|
|
408
|
-
* - **Sending** (host → webview): use {@link submit}, {@link reset}, {@link prefill},
|
|
409
|
-
* {@link triggerValidation}, {@link updateDraft}, or the lower-level {@link send}.
|
|
410
|
-
*
|
|
411
|
-
* Wire details handled for you: outgoing messages are `JSON.stringify`'d (the webview
|
|
412
|
-
* parses inbound data with `JSON.parse`, so a raw object would be ignored), and
|
|
413
|
-
* incoming messages are validated by origin + source before being parsed.
|
|
414
|
-
*
|
|
415
|
-
* @example
|
|
416
|
-
* ```ts
|
|
417
|
-
* const iframe = document.querySelector("iframe")!;
|
|
418
|
-
* const webview = new CaptelloWebview(iframe, {
|
|
419
|
-
* targetOrigin: "https://capture.captello.com",
|
|
420
|
-
* });
|
|
421
|
-
*
|
|
422
|
-
* webview.on(OutboundMessageType.FormLoadComplete, () => console.log("ready"));
|
|
423
|
-
* webview.on(OutboundMessageType.SubmissionBody, (msg) => save(msg.data));
|
|
424
|
-
*
|
|
425
|
-
* // later, drive the form:
|
|
426
|
-
* webview.submit();
|
|
427
|
-
*
|
|
428
|
-
* // on teardown:
|
|
429
|
-
* webview.destroy();
|
|
430
|
-
* ```
|
|
431
|
-
*/
|
|
432
|
-
declare class CaptelloWebview {
|
|
433
|
-
private readonly frame;
|
|
434
|
-
private readonly targetOrigin;
|
|
435
|
-
private readonly hostWindow;
|
|
436
|
-
private readonly matchSource;
|
|
437
|
-
private readonly listeners;
|
|
438
|
-
private readonly anyListeners;
|
|
439
|
-
private readonly boundHandler;
|
|
440
|
-
private destroyed;
|
|
441
|
-
private readonly queueUntilReady;
|
|
442
|
-
/** True once `form_load_complete` has been observed. */
|
|
443
|
-
private ready;
|
|
444
|
-
/** Messages sent before ready, flushed in order on load. */
|
|
445
|
-
private readonly outbox;
|
|
446
|
-
constructor(frame: ElementOrFrame, options?: CaptelloWebviewOptions);
|
|
447
|
-
/** `true` once the webview has reported `form_load_complete`. */
|
|
448
|
-
get isReady(): boolean;
|
|
449
|
-
/**
|
|
450
|
-
* Subscribe to a single outbound message type. Returns an unsubscribe function.
|
|
451
|
-
*
|
|
452
|
-
* @example webview.on(OutboundMessageType.FormErrorMessage, (m) => toast(m.data));
|
|
453
|
-
*/
|
|
454
|
-
on<T extends OutboundMessageType>(type: T, listener: OutboundListener<T>): Unsubscribe;
|
|
455
|
-
/**
|
|
456
|
-
* Subscribe once: the listener is removed automatically after it fires the first
|
|
457
|
-
* time for `type`. Returns an unsubscribe function for cancelling early.
|
|
458
|
-
*/
|
|
459
|
-
once<T extends OutboundMessageType>(type: T, listener: OutboundListener<T>): Unsubscribe;
|
|
460
|
-
/** Subscribe to every outbound message regardless of type. Returns an unsubscribe function. */
|
|
461
|
-
onAny(listener: AnyOutboundListener): Unsubscribe;
|
|
462
|
-
/**
|
|
463
|
-
* Low-level send: posts any inbound message to the webview as a JSON string.
|
|
464
|
-
* Prefer the typed helpers below; use this only for forward-compatibility.
|
|
465
|
-
*
|
|
466
|
-
* When `queueUntilReady` is enabled (the default) and the form hasn't reported
|
|
467
|
-
* `form_load_complete` yet, the message is buffered and flushed on load instead of
|
|
468
|
-
* posted immediately.
|
|
469
|
-
*
|
|
470
|
-
* @throws if the iframe's `contentWindow` is not available (not yet loaded /
|
|
471
|
-
* detached) and the message can't be queued.
|
|
472
|
-
*/
|
|
473
|
-
send(message: InboundMessage): void;
|
|
474
|
-
/** Posts a message immediately, bypassing the ready-queue. */
|
|
475
|
-
private postNow;
|
|
476
|
-
/** Marks the client ready and flushes any queued messages, in order. */
|
|
477
|
-
private markReadyAndFlush;
|
|
478
|
-
/** Programmatically submit the form (fire-and-forget). */
|
|
479
|
-
submit(): void;
|
|
480
|
-
/**
|
|
481
|
-
* Submit the form and await the outcome.
|
|
482
|
-
*
|
|
483
|
-
* Sends `submit_form`, then resolves with the {@link SubmissionBody} when the
|
|
484
|
-
* webview emits `submission_body`, or rejects with a {@link SubmissionError}
|
|
485
|
-
* (carrying the translated message) when it emits `form_error_message`. Rejects
|
|
486
|
-
* with a {@link SubmissionTimeoutError} if neither arrives within `timeoutMs`.
|
|
487
|
-
*
|
|
488
|
-
* This is the typed, leak-free version of the common "click submit, wait for the
|
|
489
|
-
* result" flow — listeners are always cleaned up, including on timeout.
|
|
490
|
-
*
|
|
491
|
-
* @param timeoutMs how long to wait before giving up. Defaults to 60_000.
|
|
492
|
-
* @example
|
|
493
|
-
* try {
|
|
494
|
-
* const body = await webview.submitAndWait();
|
|
495
|
-
* await persist(body);
|
|
496
|
-
* } catch (err) {
|
|
497
|
-
* if (err instanceof SubmissionError) showToast(err.message);
|
|
498
|
-
* }
|
|
499
|
-
*/
|
|
500
|
-
submitAndWait(timeoutMs?: number): Promise<SubmissionBody>;
|
|
501
|
-
/** Reset the form, clearing all entered values. */
|
|
502
|
-
reset(): void;
|
|
503
|
-
/** Switch the current submission into draft-update mode. */
|
|
504
|
-
updateDraft(): void;
|
|
505
|
-
/** Run validation against a target field, or `"all"` for the whole form. */
|
|
506
|
-
triggerValidation(target: ValidationTarget): void;
|
|
507
|
-
/** Pre-fill form fields from a submission body, transcription items, or both. */
|
|
508
|
-
prefill(data: {
|
|
509
|
-
submission?: SubmissionPrefill;
|
|
510
|
-
info?: PrefillInfoItem[];
|
|
511
|
-
}): void;
|
|
512
|
-
/** Remove the `message` listener and drop all subscriptions. Idempotent. */
|
|
513
|
-
destroy(): void;
|
|
514
|
-
private handleMessage;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
export { type AddressSubmissionValue as A, type BusinessCardValue as B, type CaptelloWebviewOptions as C, FormElementType as F, type InboundMessage as I, type NameSubmissionValue as N, OutboundMessageType as O, type PrefillInfoItem as P, type SubmissionBody as S, type Unsubscribe as U, type ValidationTarget as V, type OutboundMessageMap as a, SubmissionError as b, SubmissionTimeoutError as c, type OutboundMessage as d, type SubmissionPrefill as e, CaptelloWebview as f, type AnyOutboundListener as g, type AttachmentValue as h, InboundMessageType as i, type OrderCheckboxSubmissionData as j, type OrderRadioSubmissionData as k, type OutboundListener as l, type SubmissionQuestionData as m, type VisibleSubmissionDataItem as n, type VisibleSubmissionElementType as o, type VisibleSubmissionElementValueMap as p, parseOutboundMessage as q };
|