Skip to content

Add canonical examples for the marketing SDK pages - #509

Merged
Jonesy464 merged 5 commits into
mainfrom
rj/3646-canonical-examples
Sep 3, 2026
Merged

Jonesy464 merged 5 commits into
mainfrom
rj/3646-canonical-examples

Conversation

@Jonesy464

Copy link
Copy Markdown
Contributor

Part of anvilco/marketing-site#3646 (SDK repos own their code examples; the central anvil-api-usage-examples repo is being sunset).

Adds examples/{fill,generate-markdown,generate-html,create-etch-packet}.{js,ts}: the canonical, display-ready examples the marketing SDK pages will source at build (the sourcing shipped with anvilco/marketing-site#3617 scans exactly this directory; the kebab-cased basename becomes the example concept, and the file extension routes it to the JavaScript or TypeScript page).

Content is migrated from anvil-api-usage-examples with a refresh pass. Fixes found in the sources:

  • The e-sign example shipped baseURL: 'https://staging.useanvil.com', pointing anyone who copied it at staging. Removed.
  • Its NDA-upload half referenced a static/ asset that only exists in the central repo; the example is now the self-contained sample-template flow (upload-with-fields stays documented in the API docs).
  • The fill example's placekitten.com image URL is a dead service. Dropped.
  • font-style: underline in the HTML example is invalid CSS; now italic.
  • Replaced the central repo's ../lib/run harness with plain async entrypoints, and trimmed headers. The run commands are framed for a consumer project since @anvilco/anvil can't self-resolve inside this repo (no exports field).

Verification:

  • All four TS files type-check against the published @anvilco/anvil under both moduleResolution: bundler and node/CommonJS; JS mirrors pass Node ESM syntax checks.
  • All four executed live against the API with a dev key: fill and both generates returned 200 with valid PDFs (confirming the sample template and its field IDs are current), and the e-sign mutation created a packet (run as an isTest draft so no email was sent; the committed file keeps isDraft: false).
  • The marketing site's deriveLanguageExamples resolves this directory to exactly the four concepts per language.

@Jonesy464 Jonesy464 self-assigned this Aug 20, 2026
@Jonesy464
Jonesy464 force-pushed the rj/3646-canonical-examples branch from 1b412d2 to 6073b70 Compare August 20, 2026 23:08
@Jonesy464
Jonesy464 marked this pull request as ready for review August 26, 2026 21:32
@Jonesy464
Jonesy464 requested a review from a team August 26, 2026 21:58
Comment thread examples/sign.js
Interactive signing is a common ask and the flag that enables it was not
visible in the example. Set to false with a comment on what true does, per
review on #509.
Matches the marketing page key, which moved off create-etch-packet for search
intent (review on anvilco/marketing-site#3674). The concept is derived from the
filename, so the two have to agree.
Matches the marketing page key, which stays at its published /sign/ URL
rather than renaming (review on anvilco/marketing-site#3674). The concept is
derived from the filename, so the two have to agree.
The marketing site renders these verbatim in a panel about 79 characters
wide, so longer lines scroll sideways. generate-markdown's content was one
252-character line; split across literals it is the same 230 characters.

fill now builds a payload variable first, matching the C# and Python
examples. The sign run instructions still named create-etch-packet, which
the rename to sign.* left behind.
@Jonesy464
Jonesy464 force-pushed the rj/3646-canonical-examples branch from be10edd to df470ca Compare September 3, 2026 21:42
@Jonesy464
Jonesy464 merged commit 579cff9 into main Sep 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants