Skip to content

feat: comprehensive API docs and custom theme system#477

Open
gidson5 wants to merge 1 commit into
Smartdevs17:mainfrom
gidson5:feat/380-379-api-docs-theme-system
Open

feat: comprehensive API docs and custom theme system#477
gidson5 wants to merge 1 commit into
Smartdevs17:mainfrom
gidson5:feat/380-379-api-docs-theme-system

Conversation

@gidson5
Copy link
Copy Markdown

@gidson5 gidson5 commented May 29, 2026

Closes #380, closes #379

Summary

#380 — Comprehensive API documentation

  • docs/api/openapi.yaml: OpenAPI 3.0.3 spec covering subscriptions, plans, customers, billing, webhooks, and themes endpoints with full schemas, error responses, rate-limit docs, and sandbox server
  • docs/api/swagger.html: self-contained Swagger UI interactive explorer (dark-themed, try-it-out enabled)
  • docs/api/webhooks.md: full webhook event reference — 11 event types with example payloads, HMAC-SHA256 signature verification, exponential retry policy, and idempotency pattern
  • docs/api/sdk/javascript.md / python.md / go.md: SDK usage examples for all resources including webhook handlers and error handling
  • docs/api/guides/getting-started.md: 7-step first-integration walkthrough (customer → plan → subscription → webhook)
  • docs/api/guides/saas-integration.md: feature gating, upgrade/downgrade, dunning sequence, idempotent webhook processing, per-merchant theming
  • docs/api/guides/theme-integration.md: CSS variable injection into web views, WCAG contrast audit, export/import workflow, light/dark variant inheritance
  • docs/api/README.md: versioned documentation hub with version table, rate-limit reference, and environment URLs

#379 — Custom theme system

  • src/theme/types.ts: BrandConfig extended with logoUri and font (ThemeFont); new ThemeExport (version-enveloped portable snapshot); new ContrastResult for WCAG audit
  • src/theme/cssVariables.ts (new): generateCssVariables maps ThemeColors keys to --st-* CSS custom properties (camelCase → kebab); toCssBlock serialises to :root {} string; relativeLuminance, contrastRatio, checkContrast (AA/AAA), auditThemeContrast (6 key pairs)
  • src/theme/themes.ts: built-in themes now carry cssVariables; createBrandTheme accepts logoUri/font and regenerates CSS variables automatically
  • src/theme/themeStore.ts: exportTheme (version-1 JSON envelope, omits cssVariables); importTheme (validates envelope, regenerates CSS vars, deduplicates by id); persistence strips cssVariables to keep AsyncStorage lean, regenerates on rehydration
  • src/theme/index.ts: exports all new utilities and types
  • src/theme/__tests__/cssVariables.test.ts (new): covers generateCssVariables, toCssBlock, luminance, contrast ratio, checkContrast, auditThemeContrast
  • src/theme/__tests__/themeStore.test.ts: extended with logoUri/font in addBrandTheme, automatic CSS variable generation, exportTheme round-trip, importTheme (success, invalid JSON, wrong version, duplicate id replacement)

Test plan

  • npx jest src/theme — all existing + new tests pass
  • exportThemeimportTheme round-trip preserves colours and regenerates cssVariables
  • auditThemeContrast(darkTheme) text/background pair passes WCAG AA
  • auditThemeContrast(highContrastTheme) all pairs pass AA
  • Swagger UI loads at docs/api/swagger.html and all endpoints render correctly
  • OpenAPI spec validates with npx @redocly/cli lint docs/api/openapi.yaml

🤖 Generated with Claude Code

Closes Smartdevs17#380, closes Smartdevs17#379

## Smartdevs17#380 — Comprehensive API documentation
- docs/api/openapi.yaml: OpenAPI 3.0.3 specification covering subscriptions,
  plans, customers, billing/invoices, webhooks, and themes endpoints with
  full request/response schemas, error responses, and rate-limit docs
- docs/api/swagger.html: self-contained Swagger UI interactive explorer
  (load openapi.yaml, try-it-out enabled, dark-themed)
- docs/api/webhooks.md: full webhook event reference — subscription.created,
  subscription.updated, subscription.cancelled, subscription.paused,
  subscription.resumed, subscription.trial_will_end, subscription.expired,
  invoice.created, invoice.paid, invoice.payment_failed, customer.created;
  includes signature verification, retry policy, and idempotency pattern
- docs/api/sdk/javascript.md: JS/TS SDK examples for all resources including
  webhook signature verification and error handling
- docs/api/sdk/python.md: Python SDK examples with Flask webhook handler
- docs/api/sdk/go.md: Go SDK examples with net/http webhook handler
- docs/api/guides/getting-started.md: 7-step first integration walkthrough
- docs/api/guides/saas-integration.md: feature gating, upgrade/downgrade,
  dunning management, idempotent webhook processing, per-merchant themes
- docs/api/guides/theme-integration.md: CSS variable injection, contrast
  audit, export/import, light/dark variant inheritance
- docs/api/README.md: versioned documentation hub with version table,
  rate-limit reference, and environment URLs

## Smartdevs17#379 — Custom theme system
- src/theme/types.ts: extend BrandConfig with logoUri and font (ThemeFont);
  add ThemeExport (version-enveloped portable snapshot); add ContrastResult
  for WCAG audit results
- src/theme/cssVariables.ts: new module with generateCssVariables (maps
  ThemeColors keys to --st-* CSS custom properties, camelCase → kebab-case),
  toCssBlock (serialise to :root{} string), relativeLuminance, contrastRatio,
  checkContrast (AA/AAA pass/fail), auditThemeContrast (6 key colour pairs)
- src/theme/themes.ts: attach cssVariables to all three built-in themes;
  createBrandTheme now accepts logoUri and font from BrandConfig and
  regenerates cssVariables automatically
- src/theme/themeStore.ts: add exportTheme (JSON with version envelope,
  omits cssVariables) and importTheme (validates envelope, regenerates
  cssVariables, replaces same-id themes); persist hook strips cssVariables
  to keep AsyncStorage lean and regenerates on rehydration
- src/theme/index.ts: export all new utilities and types
- src/theme/__tests__/cssVariables.test.ts: new — covers generateCssVariables,
  toCssBlock, relativeLuminance, contrastRatio, checkContrast, auditThemeContrast
- src/theme/__tests__/themeStore.test.ts: extended — covers logoUri/font in
  addBrandTheme, automatic cssVariables generation, exportTheme round-trip,
  importTheme (success, invalid JSON, wrong version, dedup)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@gidson5 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Implement subscription comprehensive API documentation Implement subscription custom theme system

1 participant