feat: comprehensive API docs and custom theme system#477
Open
gidson5 wants to merge 1 commit into
Open
Conversation
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>
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 serverdocs/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 patterndocs/api/sdk/javascript.md/python.md/go.md: SDK usage examples for all resources including webhook handlers and error handlingdocs/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 themingdocs/api/guides/theme-integration.md: CSS variable injection into web views, WCAG contrast audit, export/import workflow, light/dark variant inheritancedocs/api/README.md: versioned documentation hub with version table, rate-limit reference, and environment URLs#379 — Custom theme system
src/theme/types.ts:BrandConfigextended withlogoUriandfont(ThemeFont); newThemeExport(version-enveloped portable snapshot); newContrastResultfor WCAG auditsrc/theme/cssVariables.ts(new):generateCssVariablesmaps ThemeColors keys to--st-*CSS custom properties (camelCase → kebab);toCssBlockserialises to:root {}string;relativeLuminance,contrastRatio,checkContrast(AA/AAA),auditThemeContrast(6 key pairs)src/theme/themes.ts: built-in themes now carrycssVariables;createBrandThemeacceptslogoUri/fontand regenerates CSS variables automaticallysrc/theme/themeStore.ts:exportTheme(version-1 JSON envelope, omitscssVariables);importTheme(validates envelope, regenerates CSS vars, deduplicates by id); persistence stripscssVariablesto keep AsyncStorage lean, regenerates on rehydrationsrc/theme/index.ts: exports all new utilities and typessrc/theme/__tests__/cssVariables.test.ts(new): coversgenerateCssVariables,toCssBlock, luminance, contrast ratio,checkContrast,auditThemeContrastsrc/theme/__tests__/themeStore.test.ts: extended withlogoUri/fontinaddBrandTheme, automatic CSS variable generation,exportThemeround-trip,importTheme(success, invalid JSON, wrong version, duplicate id replacement)Test plan
npx jest src/theme— all existing + new tests passexportTheme→importThemeround-trip preserves colours and regenerates cssVariablesauditThemeContrast(darkTheme)text/background pair passes WCAG AAauditThemeContrast(highContrastTheme)all pairs pass AAdocs/api/swagger.htmland all endpoints render correctlynpx @redocly/cli lint docs/api/openapi.yaml🤖 Generated with Claude Code