Render a form from a page

Use case: the host app has no form UI. Load a published page_id and let the SDK draw primitive controls.

Steps

  1. Authenticate (exchange).
  2. catalog.list() if you do not already have a page UUID.
  3. page.get(pageId) — loads FieldStore with fillable fields.
  4. Mount generated UI (FormView / walk store.fields()).
  5. On submit, submissions.save with store.values() keyed by field_name.

JavaScript

import { Comprehendly } from '../src/index.js'

const client = new Comprehendly({ publishableKey: 'pk_test_…' })
await client.exchange()

const catalog = await client.catalog.list()
const pageId = catalog.forms[0].id
const page = await client.page.get(pageId)

for (const field of client.store.fields()) {
  if (!field.generated) continue
  // create input; on input:
  client.store.set({ fieldName: field.fieldName, value, source: 'user' })
}

Runnable: clone comprehendly-sdk-js, run the demo server; the Generated section is this path.

Swift

let client = ComprehendlyClient(publishableKey: "pk_test_…")
try await client.exchange()
let page = try await client.pageGet(pageId)
// SwiftUI
ComprehendlyFormView(store: client.store)

Limits