Skip to content

Add canonical examples for the marketing SDK pages - #509

Open
Jonesy464 wants to merge 3 commits into
mainfrom
rj/3646-canonical-examples
Open

Add canonical examples for the marketing SDK pages#509
Jonesy464 wants to merge 3 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/esign.js
// Test packets use development signatures and do not count toward
// your billed packets
isTest: true,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add allowUpdates: false in here? it powers interactive signing, which a lot people want/will need. the comment can be about how you need it set to true to use interactive signing, and interactive signing is a product pack feature

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to both the .js and .ts examples:

// Set to true for interactive signing, where signers fill fields as they
// sign. Over the API that needs the Product pack or Enterprise plan
allowUpdates: false,

Used "Product pack or Enterprise" since that's what the e-sign doc says for API access.

One catch: the Python and C# examples can't have this field. allowUpdates isn't on CreateEtchPacketPayload in python-anvil or Payloads/Request/CreateEtchPacket.cs in dotnet-anvil. node-anvil works because it passes variables straight through.

Those two SDKs are missing a lot more than this one. createEtchPacket takes 25 args, python-anvil is missing 9 and dotnet-anvil 12:

  • python-anvil: allowUpdates, requireSignatures, finishPageOptions, excludeCertificateFromSignerDownloads, signatureRecipients, signatureProvider, advancedCreate, detectBoxesAdvanced, organizationEid
  • dotnet-anvil: those plus enableEmails, createCastTemplatesFromUploads, duplicateCasts

Should I create an issue to update them?

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.
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