@growth-labs/cms 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +165 -0
- package/dist/engine/activity-log.d.ts +17 -0
- package/dist/engine/activity-log.d.ts.map +1 -0
- package/dist/engine/activity-log.js +17 -0
- package/dist/engine/activity-log.js.map +1 -0
- package/dist/engine/ai-prompts.d.ts +57 -0
- package/dist/engine/ai-prompts.d.ts.map +1 -0
- package/dist/engine/ai-prompts.js +90 -0
- package/dist/engine/ai-prompts.js.map +1 -0
- package/dist/engine/ai-writeback.d.ts +36 -0
- package/dist/engine/ai-writeback.d.ts.map +1 -0
- package/dist/engine/ai-writeback.js +45 -0
- package/dist/engine/ai-writeback.js.map +1 -0
- package/dist/engine/api-keys.d.ts +76 -0
- package/dist/engine/api-keys.d.ts.map +1 -0
- package/dist/engine/api-keys.js +165 -0
- package/dist/engine/api-keys.js.map +1 -0
- package/dist/engine/content-insights.d.ts +36 -0
- package/dist/engine/content-insights.d.ts.map +1 -0
- package/dist/engine/content-insights.js +114 -0
- package/dist/engine/content-insights.js.map +1 -0
- package/dist/engine/contributors.d.ts +25 -0
- package/dist/engine/contributors.d.ts.map +1 -0
- package/dist/engine/contributors.js +59 -0
- package/dist/engine/contributors.js.map +1 -0
- package/dist/engine/cron.d.ts +15 -0
- package/dist/engine/cron.d.ts.map +1 -0
- package/dist/engine/cron.js +33 -0
- package/dist/engine/cron.js.map +1 -0
- package/dist/engine/d1.d.ts +16 -0
- package/dist/engine/d1.d.ts.map +1 -0
- package/dist/engine/d1.js +13 -0
- package/dist/engine/d1.js.map +1 -0
- package/dist/engine/foundry-dispatch.d.ts +52 -0
- package/dist/engine/foundry-dispatch.d.ts.map +1 -0
- package/dist/engine/foundry-dispatch.js +290 -0
- package/dist/engine/foundry-dispatch.js.map +1 -0
- package/dist/engine/import-parsers.d.ts +11 -0
- package/dist/engine/import-parsers.d.ts.map +1 -0
- package/dist/engine/import-parsers.js +373 -0
- package/dist/engine/import-parsers.js.map +1 -0
- package/dist/engine/index.d.ts +28 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +57 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/invites.d.ts +78 -0
- package/dist/engine/invites.d.ts.map +1 -0
- package/dist/engine/invites.js +158 -0
- package/dist/engine/invites.js.map +1 -0
- package/dist/engine/members.d.ts +59 -0
- package/dist/engine/members.d.ts.map +1 -0
- package/dist/engine/members.js +124 -0
- package/dist/engine/members.js.map +1 -0
- package/dist/engine/membership-rules.d.ts +25 -0
- package/dist/engine/membership-rules.d.ts.map +1 -0
- package/dist/engine/membership-rules.js +44 -0
- package/dist/engine/membership-rules.js.map +1 -0
- package/dist/engine/og-render.d.ts +40 -0
- package/dist/engine/og-render.d.ts.map +1 -0
- package/dist/engine/og-render.js +26 -0
- package/dist/engine/og-render.js.map +1 -0
- package/dist/engine/publish-guard.d.ts +58 -0
- package/dist/engine/publish-guard.d.ts.map +1 -0
- package/dist/engine/publish-guard.js +80 -0
- package/dist/engine/publish-guard.js.map +1 -0
- package/dist/engine/publisher.d.ts +171 -0
- package/dist/engine/publisher.d.ts.map +1 -0
- package/dist/engine/publisher.js +597 -0
- package/dist/engine/publisher.js.map +1 -0
- package/dist/engine/revisions.d.ts +39 -0
- package/dist/engine/revisions.d.ts.map +1 -0
- package/dist/engine/revisions.js +203 -0
- package/dist/engine/revisions.js.map +1 -0
- package/dist/engine/sanitize.d.ts +52 -0
- package/dist/engine/sanitize.d.ts.map +1 -0
- package/dist/engine/sanitize.js +155 -0
- package/dist/engine/sanitize.js.map +1 -0
- package/dist/engine/seed-membership.d.ts +29 -0
- package/dist/engine/seed-membership.d.ts.map +1 -0
- package/dist/engine/seed-membership.js +65 -0
- package/dist/engine/seed-membership.js.map +1 -0
- package/dist/engine/seo.d.ts +20 -0
- package/dist/engine/seo.d.ts.map +1 -0
- package/dist/engine/seo.js +50 -0
- package/dist/engine/seo.js.map +1 -0
- package/dist/engine/slug-redirects.d.ts +8 -0
- package/dist/engine/slug-redirects.d.ts.map +1 -0
- package/dist/engine/slug-redirects.js +26 -0
- package/dist/engine/slug-redirects.js.map +1 -0
- package/dist/engine/slug.d.ts +6 -0
- package/dist/engine/slug.d.ts.map +1 -0
- package/dist/engine/slug.js +28 -0
- package/dist/engine/slug.js.map +1 -0
- package/dist/engine/soft-delete.d.ts +8 -0
- package/dist/engine/soft-delete.d.ts.map +1 -0
- package/dist/engine/soft-delete.js +28 -0
- package/dist/engine/soft-delete.js.map +1 -0
- package/dist/engine/tags.d.ts +14 -0
- package/dist/engine/tags.d.ts.map +1 -0
- package/dist/engine/tags.js +79 -0
- package/dist/engine/tags.js.map +1 -0
- package/dist/engine/topics.d.ts +10 -0
- package/dist/engine/topics.d.ts.map +1 -0
- package/dist/engine/topics.js +140 -0
- package/dist/engine/topics.js.map +1 -0
- package/dist/engine/url-guard.d.ts +12 -0
- package/dist/engine/url-guard.d.ts.map +1 -0
- package/dist/engine/url-guard.js +129 -0
- package/dist/engine/url-guard.js.map +1 -0
- package/dist/engine/validator/checks/bare-url-not-autolinked.d.ts +20 -0
- package/dist/engine/validator/checks/bare-url-not-autolinked.d.ts.map +1 -0
- package/dist/engine/validator/checks/bare-url-not-autolinked.js +54 -0
- package/dist/engine/validator/checks/bare-url-not-autolinked.js.map +1 -0
- package/dist/engine/validator/checks/broken-footnote-label.d.ts +16 -0
- package/dist/engine/validator/checks/broken-footnote-label.d.ts.map +1 -0
- package/dist/engine/validator/checks/broken-footnote-label.js +17 -0
- package/dist/engine/validator/checks/broken-footnote-label.js.map +1 -0
- package/dist/engine/validator/checks/double-encoded-entities.d.ts +18 -0
- package/dist/engine/validator/checks/double-encoded-entities.d.ts.map +1 -0
- package/dist/engine/validator/checks/double-encoded-entities.js +23 -0
- package/dist/engine/validator/checks/double-encoded-entities.js.map +1 -0
- package/dist/engine/validator/checks/empty-alt-text.d.ts +14 -0
- package/dist/engine/validator/checks/empty-alt-text.d.ts.map +1 -0
- package/dist/engine/validator/checks/empty-alt-text.js +23 -0
- package/dist/engine/validator/checks/empty-alt-text.js.map +1 -0
- package/dist/engine/validator/checks/heading-hierarchy-skip.d.ts +11 -0
- package/dist/engine/validator/checks/heading-hierarchy-skip.d.ts.map +1 -0
- package/dist/engine/validator/checks/heading-hierarchy-skip.js +20 -0
- package/dist/engine/validator/checks/heading-hierarchy-skip.js.map +1 -0
- package/dist/engine/validator/checks/html-comment-leak.d.ts +20 -0
- package/dist/engine/validator/checks/html-comment-leak.d.ts.map +1 -0
- package/dist/engine/validator/checks/html-comment-leak.js +30 -0
- package/dist/engine/validator/checks/html-comment-leak.js.map +1 -0
- package/dist/engine/validator/checks/iframe-missing-dims-and-wrapper.d.ts +12 -0
- package/dist/engine/validator/checks/iframe-missing-dims-and-wrapper.d.ts.map +1 -0
- package/dist/engine/validator/checks/iframe-missing-dims-and-wrapper.js +17 -0
- package/dist/engine/validator/checks/iframe-missing-dims-and-wrapper.js.map +1 -0
- package/dist/engine/validator/checks/invisible-control-chars.d.ts +24 -0
- package/dist/engine/validator/checks/invisible-control-chars.d.ts.map +1 -0
- package/dist/engine/validator/checks/invisible-control-chars.js +30 -0
- package/dist/engine/validator/checks/invisible-control-chars.js.map +1 -0
- package/dist/engine/validator/checks/paywall-marker-leak.d.ts +17 -0
- package/dist/engine/validator/checks/paywall-marker-leak.d.ts.map +1 -0
- package/dist/engine/validator/checks/paywall-marker-leak.js +22 -0
- package/dist/engine/validator/checks/paywall-marker-leak.js.map +1 -0
- package/dist/engine/validator/checks/raw-block-html.d.ts +28 -0
- package/dist/engine/validator/checks/raw-block-html.d.ts.map +1 -0
- package/dist/engine/validator/checks/raw-block-html.js +38 -0
- package/dist/engine/validator/checks/raw-block-html.js.map +1 -0
- package/dist/engine/validator/checks/stale-body-html.d.ts +28 -0
- package/dist/engine/validator/checks/stale-body-html.d.ts.map +1 -0
- package/dist/engine/validator/checks/stale-body-html.js +15 -0
- package/dist/engine/validator/checks/stale-body-html.js.map +1 -0
- package/dist/engine/validator/checks/unresolved-footnote-anchor.d.ts +11 -0
- package/dist/engine/validator/checks/unresolved-footnote-anchor.d.ts.map +1 -0
- package/dist/engine/validator/checks/unresolved-footnote-anchor.js +48 -0
- package/dist/engine/validator/checks/unresolved-footnote-anchor.js.map +1 -0
- package/dist/engine/validator/checks/word-gdocs-paste-artifacts.d.ts +23 -0
- package/dist/engine/validator/checks/word-gdocs-paste-artifacts.d.ts.map +1 -0
- package/dist/engine/validator/checks/word-gdocs-paste-artifacts.js +47 -0
- package/dist/engine/validator/checks/word-gdocs-paste-artifacts.js.map +1 -0
- package/dist/engine/validator/index.d.ts +75 -0
- package/dist/engine/validator/index.d.ts.map +1 -0
- package/dist/engine/validator/index.js +313 -0
- package/dist/engine/validator/index.js.map +1 -0
- package/dist/engine/validator/scan.d.ts +28 -0
- package/dist/engine/validator/scan.d.ts.map +1 -0
- package/dist/engine/validator/scan.js +97 -0
- package/dist/engine/validator/scan.js.map +1 -0
- package/dist/engine/validator/types.d.ts +50 -0
- package/dist/engine/validator/types.d.ts.map +1 -0
- package/dist/engine/validator/types.js +51 -0
- package/dist/engine/validator/types.js.map +1 -0
- package/dist/engine/webhook-signer.d.ts +39 -0
- package/dist/engine/webhook-signer.d.ts.map +1 -0
- package/dist/engine/webhook-signer.js +117 -0
- package/dist/engine/webhook-signer.js.map +1 -0
- package/dist/engine/webhooks.d.ts +75 -0
- package/dist/engine/webhooks.d.ts.map +1 -0
- package/dist/engine/webhooks.js +139 -0
- package/dist/engine/webhooks.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/integration/index.d.ts +6 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/index.js +294 -0
- package/dist/integration/index.js.map +1 -0
- package/dist/integration/options.d.ts +105 -0
- package/dist/integration/options.d.ts.map +1 -0
- package/dist/integration/options.js +25 -0
- package/dist/integration/options.js.map +1 -0
- package/dist/integration/vite-plugin.d.ts +4 -0
- package/dist/integration/vite-plugin.d.ts.map +1 -0
- package/dist/integration/vite-plugin.js +37 -0
- package/dist/integration/vite-plugin.js.map +1 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +3 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/null.d.ts +9 -0
- package/dist/providers/null.d.ts.map +1 -0
- package/dist/providers/null.js +144 -0
- package/dist/providers/null.js.map +1 -0
- package/dist/providers/types.d.ts +277 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/routes/ai.d.ts +25 -0
- package/dist/routes/ai.d.ts.map +1 -0
- package/dist/routes/ai.js +381 -0
- package/dist/routes/ai.js.map +1 -0
- package/dist/routes/analytics.d.ts +15 -0
- package/dist/routes/analytics.d.ts.map +1 -0
- package/dist/routes/analytics.js +61 -0
- package/dist/routes/analytics.js.map +1 -0
- package/dist/routes/api-keys.d.ts +13 -0
- package/dist/routes/api-keys.d.ts.map +1 -0
- package/dist/routes/api-keys.js +109 -0
- package/dist/routes/api-keys.js.map +1 -0
- package/dist/routes/authors.d.ts +19 -0
- package/dist/routes/authors.d.ts.map +1 -0
- package/dist/routes/authors.js +202 -0
- package/dist/routes/authors.js.map +1 -0
- package/dist/routes/authz-matrix.d.ts +78 -0
- package/dist/routes/authz-matrix.d.ts.map +1 -0
- package/dist/routes/authz-matrix.js +170 -0
- package/dist/routes/authz-matrix.js.map +1 -0
- package/dist/routes/calendar.d.ts +19 -0
- package/dist/routes/calendar.d.ts.map +1 -0
- package/dist/routes/calendar.js +89 -0
- package/dist/routes/calendar.js.map +1 -0
- package/dist/routes/config.d.ts +70 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +23 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/content-insights.d.ts +18 -0
- package/dist/routes/content-insights.d.ts.map +1 -0
- package/dist/routes/content-insights.js +137 -0
- package/dist/routes/content-insights.js.map +1 -0
- package/dist/routes/content.d.ts +145 -0
- package/dist/routes/content.d.ts.map +1 -0
- package/dist/routes/content.js +1374 -0
- package/dist/routes/content.js.map +1 -0
- package/dist/routes/context.d.ts +104 -0
- package/dist/routes/context.d.ts.map +1 -0
- package/dist/routes/context.js +26 -0
- package/dist/routes/context.js.map +1 -0
- package/dist/routes/cron.d.ts +8 -0
- package/dist/routes/cron.d.ts.map +1 -0
- package/dist/routes/cron.js +20 -0
- package/dist/routes/cron.js.map +1 -0
- package/dist/routes/dashboard.d.ts +12 -0
- package/dist/routes/dashboard.d.ts.map +1 -0
- package/dist/routes/dashboard.js +113 -0
- package/dist/routes/dashboard.js.map +1 -0
- package/dist/routes/imports.d.ts +10 -0
- package/dist/routes/imports.d.ts.map +1 -0
- package/dist/routes/imports.js +149 -0
- package/dist/routes/imports.js.map +1 -0
- package/dist/routes/index.d.ts +75 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/index.js +141 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/media-lib.d.ts +75 -0
- package/dist/routes/media-lib.d.ts.map +1 -0
- package/dist/routes/media-lib.js +305 -0
- package/dist/routes/media-lib.js.map +1 -0
- package/dist/routes/media.d.ts +32 -0
- package/dist/routes/media.d.ts.map +1 -0
- package/dist/routes/media.js +756 -0
- package/dist/routes/media.js.map +1 -0
- package/dist/routes/preview.d.ts +19 -0
- package/dist/routes/preview.d.ts.map +1 -0
- package/dist/routes/preview.js +150 -0
- package/dist/routes/preview.js.map +1 -0
- package/dist/routes/rbac-invites.d.ts +31 -0
- package/dist/routes/rbac-invites.d.ts.map +1 -0
- package/dist/routes/rbac-invites.js +174 -0
- package/dist/routes/rbac-invites.js.map +1 -0
- package/dist/routes/rbac.d.ts +12 -0
- package/dist/routes/rbac.d.ts.map +1 -0
- package/dist/routes/rbac.js +126 -0
- package/dist/routes/rbac.js.map +1 -0
- package/dist/routes/shell.d.ts +22 -0
- package/dist/routes/shell.d.ts.map +1 -0
- package/dist/routes/shell.js +123 -0
- package/dist/routes/shell.js.map +1 -0
- package/dist/routes/subscriptions.d.ts +21 -0
- package/dist/routes/subscriptions.d.ts.map +1 -0
- package/dist/routes/subscriptions.js +127 -0
- package/dist/routes/subscriptions.js.map +1 -0
- package/dist/routes/tags.d.ts +23 -0
- package/dist/routes/tags.d.ts.map +1 -0
- package/dist/routes/tags.js +68 -0
- package/dist/routes/tags.js.map +1 -0
- package/dist/routes/topics.d.ts +12 -0
- package/dist/routes/topics.d.ts.map +1 -0
- package/dist/routes/topics.js +49 -0
- package/dist/routes/topics.js.map +1 -0
- package/dist/routes/webhooks.d.ts +31 -0
- package/dist/routes/webhooks.d.ts.map +1 -0
- package/dist/routes/webhooks.js +173 -0
- package/dist/routes/webhooks.js.map +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +6 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/insights-ingest.d.ts +959 -0
- package/dist/schema/insights-ingest.d.ts.map +1 -0
- package/dist/schema/insights-ingest.js +112 -0
- package/dist/schema/insights-ingest.js.map +1 -0
- package/dist/schema/migrations.d.ts +63 -0
- package/dist/schema/migrations.d.ts.map +1 -0
- package/dist/schema/migrations.js +589 -0
- package/dist/schema/migrations.js.map +1 -0
- package/dist/schema/tables.d.ts +11 -0
- package/dist/schema/tables.d.ts.map +1 -0
- package/dist/schema/tables.js +56 -0
- package/dist/schema/tables.js.map +1 -0
- package/dist/schema/types.d.ts +476 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +37 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/ui/api/_authz.d.ts +6 -0
- package/dist/ui/api/_authz.d.ts.map +1 -0
- package/dist/ui/api/_authz.js +74 -0
- package/dist/ui/api/_authz.js.map +1 -0
- package/dist/ui/api/_content-config.d.ts +22 -0
- package/dist/ui/api/_content-config.d.ts.map +1 -0
- package/dist/ui/api/_content-config.js +50 -0
- package/dist/ui/api/_content-config.js.map +1 -0
- package/dist/ui/api/activity.d.ts +3 -0
- package/dist/ui/api/activity.d.ts.map +1 -0
- package/dist/ui/api/activity.js +28 -0
- package/dist/ui/api/activity.js.map +1 -0
- package/dist/ui/api/analytics.d.ts +3 -0
- package/dist/ui/api/analytics.d.ts.map +1 -0
- package/dist/ui/api/analytics.js +36 -0
- package/dist/ui/api/analytics.js.map +1 -0
- package/dist/ui/api/authors/[id].d.ts +4 -0
- package/dist/ui/api/authors/[id].d.ts.map +1 -0
- package/dist/ui/api/authors/[id].js +17 -0
- package/dist/ui/api/authors/[id].js.map +1 -0
- package/dist/ui/api/authors.d.ts +4 -0
- package/dist/ui/api/authors.d.ts.map +1 -0
- package/dist/ui/api/authors.js +12 -0
- package/dist/ui/api/authors.js.map +1 -0
- package/dist/ui/api/calendar.d.ts +3 -0
- package/dist/ui/api/calendar.d.ts.map +1 -0
- package/dist/ui/api/calendar.js +16 -0
- package/dist/ui/api/calendar.js.map +1 -0
- package/dist/ui/api/content/[id]/ai/headlines.d.ts +3 -0
- package/dist/ui/api/content/[id]/ai/headlines.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/ai/headlines.js +7 -0
- package/dist/ui/api/content/[id]/ai/headlines.js.map +1 -0
- package/dist/ui/api/content/[id]/ai/meta-description.d.ts +3 -0
- package/dist/ui/api/content/[id]/ai/meta-description.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/ai/meta-description.js +6 -0
- package/dist/ui/api/content/[id]/ai/meta-description.js.map +1 -0
- package/dist/ui/api/content/[id]/ai/og-image.d.ts +3 -0
- package/dist/ui/api/content/[id]/ai/og-image.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/ai/og-image.js +7 -0
- package/dist/ui/api/content/[id]/ai/og-image.js.map +1 -0
- package/dist/ui/api/content/[id]/ai/proofread.d.ts +3 -0
- package/dist/ui/api/content/[id]/ai/proofread.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/ai/proofread.js +7 -0
- package/dist/ui/api/content/[id]/ai/proofread.js.map +1 -0
- package/dist/ui/api/content/[id]/ai/takeaways.d.ts +3 -0
- package/dist/ui/api/content/[id]/ai/takeaways.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/ai/takeaways.js +6 -0
- package/dist/ui/api/content/[id]/ai/takeaways.js.map +1 -0
- package/dist/ui/api/content/[id]/contributors.d.ts +4 -0
- package/dist/ui/api/content/[id]/contributors.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/contributors.js +8 -0
- package/dist/ui/api/content/[id]/contributors.js.map +1 -0
- package/dist/ui/api/content/[id]/preview-token.d.ts +3 -0
- package/dist/ui/api/content/[id]/preview-token.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/preview-token.js +16 -0
- package/dist/ui/api/content/[id]/preview-token.js.map +1 -0
- package/dist/ui/api/content/[id]/revisions/[rev]/restore.d.ts +3 -0
- package/dist/ui/api/content/[id]/revisions/[rev]/restore.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/revisions/[rev]/restore.js +7 -0
- package/dist/ui/api/content/[id]/revisions/[rev]/restore.js.map +1 -0
- package/dist/ui/api/content/[id]/revisions/[rev].d.ts +3 -0
- package/dist/ui/api/content/[id]/revisions/[rev].d.ts.map +1 -0
- package/dist/ui/api/content/[id]/revisions/[rev].js +6 -0
- package/dist/ui/api/content/[id]/revisions/[rev].js.map +1 -0
- package/dist/ui/api/content/[id]/revisions.d.ts +3 -0
- package/dist/ui/api/content/[id]/revisions.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/revisions.js +6 -0
- package/dist/ui/api/content/[id]/revisions.js.map +1 -0
- package/dist/ui/api/content/[id]/seo-score.d.ts +3 -0
- package/dist/ui/api/content/[id]/seo-score.d.ts.map +1 -0
- package/dist/ui/api/content/[id]/seo-score.js +7 -0
- package/dist/ui/api/content/[id]/seo-score.js.map +1 -0
- package/dist/ui/api/content/[id].d.ts +5 -0
- package/dist/ui/api/content/[id].d.ts.map +1 -0
- package/dist/ui/api/content/[id].js +17 -0
- package/dist/ui/api/content/[id].js.map +1 -0
- package/dist/ui/api/content/bulk.d.ts +3 -0
- package/dist/ui/api/content/bulk.d.ts.map +1 -0
- package/dist/ui/api/content/bulk.js +7 -0
- package/dist/ui/api/content/bulk.js.map +1 -0
- package/dist/ui/api/content/counts.d.ts +3 -0
- package/dist/ui/api/content/counts.d.ts.map +1 -0
- package/dist/ui/api/content/counts.js +8 -0
- package/dist/ui/api/content/counts.js.map +1 -0
- package/dist/ui/api/content/foundry-callback.d.ts +3 -0
- package/dist/ui/api/content/foundry-callback.d.ts.map +1 -0
- package/dist/ui/api/content/foundry-callback.js +8 -0
- package/dist/ui/api/content/foundry-callback.js.map +1 -0
- package/dist/ui/api/content/import/confirm.d.ts +3 -0
- package/dist/ui/api/content/import/confirm.d.ts.map +1 -0
- package/dist/ui/api/content/import/confirm.js +11 -0
- package/dist/ui/api/content/import/confirm.js.map +1 -0
- package/dist/ui/api/content/import/parse.d.ts +3 -0
- package/dist/ui/api/content/import/parse.d.ts.map +1 -0
- package/dist/ui/api/content/import/parse.js +11 -0
- package/dist/ui/api/content/import/parse.js.map +1 -0
- package/dist/ui/api/content/insights-ingest.d.ts +3 -0
- package/dist/ui/api/content/insights-ingest.d.ts.map +1 -0
- package/dist/ui/api/content/insights-ingest.js +15 -0
- package/dist/ui/api/content/insights-ingest.js.map +1 -0
- package/dist/ui/api/content-insights/dismiss.d.ts +3 -0
- package/dist/ui/api/content-insights/dismiss.d.ts.map +1 -0
- package/dist/ui/api/content-insights/dismiss.js +16 -0
- package/dist/ui/api/content-insights/dismiss.js.map +1 -0
- package/dist/ui/api/content-insights/index.d.ts +3 -0
- package/dist/ui/api/content-insights/index.d.ts.map +1 -0
- package/dist/ui/api/content-insights/index.js +12 -0
- package/dist/ui/api/content-insights/index.js.map +1 -0
- package/dist/ui/api/content-insights/undismiss.d.ts +3 -0
- package/dist/ui/api/content-insights/undismiss.d.ts.map +1 -0
- package/dist/ui/api/content-insights/undismiss.js +16 -0
- package/dist/ui/api/content-insights/undismiss.js.map +1 -0
- package/dist/ui/api/content.d.ts +4 -0
- package/dist/ui/api/content.d.ts.map +1 -0
- package/dist/ui/api/content.js +16 -0
- package/dist/ui/api/content.js.map +1 -0
- package/dist/ui/api/dashboard.d.ts +3 -0
- package/dist/ui/api/dashboard.d.ts.map +1 -0
- package/dist/ui/api/dashboard.js +22 -0
- package/dist/ui/api/dashboard.js.map +1 -0
- package/dist/ui/api/me.d.ts +3 -0
- package/dist/ui/api/me.d.ts.map +1 -0
- package/dist/ui/api/me.js +18 -0
- package/dist/ui/api/me.js.map +1 -0
- package/dist/ui/api/media/[id].d.ts +3 -0
- package/dist/ui/api/media/[id].d.ts.map +1 -0
- package/dist/ui/api/media/[id].js +17 -0
- package/dist/ui/api/media/[id].js.map +1 -0
- package/dist/ui/api/media/images.d.ts +3 -0
- package/dist/ui/api/media/images.d.ts.map +1 -0
- package/dist/ui/api/media/images.js +6 -0
- package/dist/ui/api/media/images.js.map +1 -0
- package/dist/ui/api/media/library/[id].d.ts +3 -0
- package/dist/ui/api/media/library/[id].d.ts.map +1 -0
- package/dist/ui/api/media/library/[id].js +6 -0
- package/dist/ui/api/media/library/[id].js.map +1 -0
- package/dist/ui/api/media/library.d.ts +3 -0
- package/dist/ui/api/media/library.d.ts.map +1 -0
- package/dist/ui/api/media/library.js +17 -0
- package/dist/ui/api/media/library.js.map +1 -0
- package/dist/ui/api/media/podcast/abort.d.ts +3 -0
- package/dist/ui/api/media/podcast/abort.d.ts.map +1 -0
- package/dist/ui/api/media/podcast/abort.js +4 -0
- package/dist/ui/api/media/podcast/abort.js.map +1 -0
- package/dist/ui/api/media/podcast/complete.d.ts +3 -0
- package/dist/ui/api/media/podcast/complete.d.ts.map +1 -0
- package/dist/ui/api/media/podcast/complete.js +4 -0
- package/dist/ui/api/media/podcast/complete.js.map +1 -0
- package/dist/ui/api/media/podcast/init.d.ts +3 -0
- package/dist/ui/api/media/podcast/init.d.ts.map +1 -0
- package/dist/ui/api/media/podcast/init.js +4 -0
- package/dist/ui/api/media/podcast/init.js.map +1 -0
- package/dist/ui/api/media/podcast/part.d.ts +3 -0
- package/dist/ui/api/media/podcast/part.d.ts.map +1 -0
- package/dist/ui/api/media/podcast/part.js +4 -0
- package/dist/ui/api/media/podcast/part.js.map +1 -0
- package/dist/ui/api/media/podcast.d.ts +3 -0
- package/dist/ui/api/media/podcast.d.ts.map +1 -0
- package/dist/ui/api/media/podcast.js +6 -0
- package/dist/ui/api/media/podcast.js.map +1 -0
- package/dist/ui/api/media/videos/abort.d.ts +3 -0
- package/dist/ui/api/media/videos/abort.d.ts.map +1 -0
- package/dist/ui/api/media/videos/abort.js +6 -0
- package/dist/ui/api/media/videos/abort.js.map +1 -0
- package/dist/ui/api/media/videos/complete.d.ts +3 -0
- package/dist/ui/api/media/videos/complete.d.ts.map +1 -0
- package/dist/ui/api/media/videos/complete.js +6 -0
- package/dist/ui/api/media/videos/complete.js.map +1 -0
- package/dist/ui/api/media/videos/init.d.ts +3 -0
- package/dist/ui/api/media/videos/init.d.ts.map +1 -0
- package/dist/ui/api/media/videos/init.js +6 -0
- package/dist/ui/api/media/videos/init.js.map +1 -0
- package/dist/ui/api/media/videos/part.d.ts +3 -0
- package/dist/ui/api/media/videos/part.d.ts.map +1 -0
- package/dist/ui/api/media/videos/part.js +6 -0
- package/dist/ui/api/media/videos/part.js.map +1 -0
- package/dist/ui/api/notifications.d.ts +4 -0
- package/dist/ui/api/notifications.d.ts.map +1 -0
- package/dist/ui/api/notifications.js +20 -0
- package/dist/ui/api/notifications.js.map +1 -0
- package/dist/ui/api/search.d.ts +3 -0
- package/dist/ui/api/search.d.ts.map +1 -0
- package/dist/ui/api/search.js +18 -0
- package/dist/ui/api/search.js.map +1 -0
- package/dist/ui/api/settings/api-keys/[id].d.ts +3 -0
- package/dist/ui/api/settings/api-keys/[id].d.ts.map +1 -0
- package/dist/ui/api/settings/api-keys/[id].js +22 -0
- package/dist/ui/api/settings/api-keys/[id].js.map +1 -0
- package/dist/ui/api/settings/api-keys.d.ts +4 -0
- package/dist/ui/api/settings/api-keys.d.ts.map +1 -0
- package/dist/ui/api/settings/api-keys.js +19 -0
- package/dist/ui/api/settings/api-keys.js.map +1 -0
- package/dist/ui/api/settings/domains.d.ts +3 -0
- package/dist/ui/api/settings/domains.d.ts.map +1 -0
- package/dist/ui/api/settings/domains.js +32 -0
- package/dist/ui/api/settings/domains.js.map +1 -0
- package/dist/ui/api/settings/integrations.d.ts +3 -0
- package/dist/ui/api/settings/integrations.d.ts.map +1 -0
- package/dist/ui/api/settings/integrations.js +32 -0
- package/dist/ui/api/settings/integrations.js.map +1 -0
- package/dist/ui/api/settings/members/[userId].d.ts +4 -0
- package/dist/ui/api/settings/members/[userId].d.ts.map +1 -0
- package/dist/ui/api/settings/members/[userId].js +26 -0
- package/dist/ui/api/settings/members/[userId].js.map +1 -0
- package/dist/ui/api/settings/members/invite.d.ts +3 -0
- package/dist/ui/api/settings/members/invite.d.ts.map +1 -0
- package/dist/ui/api/settings/members/invite.js +21 -0
- package/dist/ui/api/settings/members/invite.js.map +1 -0
- package/dist/ui/api/settings/members.d.ts +3 -0
- package/dist/ui/api/settings/members.d.ts.map +1 -0
- package/dist/ui/api/settings/members.js +17 -0
- package/dist/ui/api/settings/members.js.map +1 -0
- package/dist/ui/api/settings/webhooks/[id]/test.d.ts +3 -0
- package/dist/ui/api/settings/webhooks/[id]/test.d.ts.map +1 -0
- package/dist/ui/api/settings/webhooks/[id]/test.js +24 -0
- package/dist/ui/api/settings/webhooks/[id]/test.js.map +1 -0
- package/dist/ui/api/settings/webhooks/[id].d.ts +3 -0
- package/dist/ui/api/settings/webhooks/[id].d.ts.map +1 -0
- package/dist/ui/api/settings/webhooks/[id].js +23 -0
- package/dist/ui/api/settings/webhooks/[id].js.map +1 -0
- package/dist/ui/api/settings/webhooks.d.ts +4 -0
- package/dist/ui/api/settings/webhooks.d.ts.map +1 -0
- package/dist/ui/api/settings/webhooks.js +21 -0
- package/dist/ui/api/settings/webhooks.js.map +1 -0
- package/dist/ui/api/subscriptions.d.ts +4 -0
- package/dist/ui/api/subscriptions.d.ts.map +1 -0
- package/dist/ui/api/subscriptions.js +47 -0
- package/dist/ui/api/subscriptions.js.map +1 -0
- package/dist/ui/api/tags/[id].d.ts +4 -0
- package/dist/ui/api/tags/[id].d.ts.map +1 -0
- package/dist/ui/api/tags/[id].js +18 -0
- package/dist/ui/api/tags/[id].js.map +1 -0
- package/dist/ui/api/tags/index.d.ts +4 -0
- package/dist/ui/api/tags/index.d.ts.map +1 -0
- package/dist/ui/api/tags/index.js +13 -0
- package/dist/ui/api/tags/index.js.map +1 -0
- package/dist/ui/api/topics/[id].d.ts +3 -0
- package/dist/ui/api/topics/[id].d.ts.map +1 -0
- package/dist/ui/api/topics/[id].js +15 -0
- package/dist/ui/api/topics/[id].js.map +1 -0
- package/dist/ui/api/topics/index.d.ts +4 -0
- package/dist/ui/api/topics/index.d.ts.map +1 -0
- package/dist/ui/api/topics/index.js +12 -0
- package/dist/ui/api/topics/index.js.map +1 -0
- package/dist/ui/api/workspace-settings.d.ts +4 -0
- package/dist/ui/api/workspace-settings.d.ts.map +1 -0
- package/dist/ui/api/workspace-settings.js +20 -0
- package/dist/ui/api/workspace-settings.js.map +1 -0
- package/dist/ui/client/boot-state.d.ts +15 -0
- package/dist/ui/client/boot-state.d.ts.map +1 -0
- package/dist/ui/client/boot-state.js +36 -0
- package/dist/ui/client/boot-state.js.map +1 -0
- package/dist/ui/client/mount.d.ts +3 -0
- package/dist/ui/client/mount.d.ts.map +1 -0
- package/dist/ui/client/mount.js +37 -0
- package/dist/ui/client/mount.js.map +1 -0
- package/dist/ui/commands.d.ts +23 -0
- package/dist/ui/commands.d.ts.map +1 -0
- package/dist/ui/commands.js +48 -0
- package/dist/ui/commands.js.map +1 -0
- package/dist/ui/components/CmsApp.d.ts +16 -0
- package/dist/ui/components/CmsApp.d.ts.map +1 -0
- package/dist/ui/components/CmsApp.js +74 -0
- package/dist/ui/components/CmsApp.js.map +1 -0
- package/dist/ui/components/CommandPalette.d.ts +7 -0
- package/dist/ui/components/CommandPalette.d.ts.map +1 -0
- package/dist/ui/components/CommandPalette.js +61 -0
- package/dist/ui/components/CommandPalette.js.map +1 -0
- package/dist/ui/components/NoAccessScreen.d.ts +2 -0
- package/dist/ui/components/NoAccessScreen.d.ts.map +1 -0
- package/dist/ui/components/NoAccessScreen.js +42 -0
- package/dist/ui/components/NoAccessScreen.js.map +1 -0
- package/dist/ui/components/ShareModal.d.ts +27 -0
- package/dist/ui/components/ShareModal.d.ts.map +1 -0
- package/dist/ui/components/ShareModal.js +208 -0
- package/dist/ui/components/ShareModal.js.map +1 -0
- package/dist/ui/components/SharePickers.d.ts +39 -0
- package/dist/ui/components/SharePickers.d.ts.map +1 -0
- package/dist/ui/components/SharePickers.js +352 -0
- package/dist/ui/components/SharePickers.js.map +1 -0
- package/dist/ui/components/ShareStatsPanel.d.ts +22 -0
- package/dist/ui/components/ShareStatsPanel.d.ts.map +1 -0
- package/dist/ui/components/ShareStatsPanel.js +317 -0
- package/dist/ui/components/ShareStatsPanel.js.map +1 -0
- package/dist/ui/components/Sidebar.d.ts +7 -0
- package/dist/ui/components/Sidebar.d.ts.map +1 -0
- package/dist/ui/components/Sidebar.js +20 -0
- package/dist/ui/components/Sidebar.js.map +1 -0
- package/dist/ui/components/SiteSwitcher.d.ts +4 -0
- package/dist/ui/components/SiteSwitcher.d.ts.map +1 -0
- package/dist/ui/components/SiteSwitcher.js +35 -0
- package/dist/ui/components/SiteSwitcher.js.map +1 -0
- package/dist/ui/components/Topbar.d.ts +9 -0
- package/dist/ui/components/Topbar.d.ts.map +1 -0
- package/dist/ui/components/Topbar.js +20 -0
- package/dist/ui/components/Topbar.js.map +1 -0
- package/dist/ui/editor/AiAssistPanel.d.ts +8 -0
- package/dist/ui/editor/AiAssistPanel.d.ts.map +1 -0
- package/dist/ui/editor/AiAssistPanel.js +221 -0
- package/dist/ui/editor/AiAssistPanel.js.map +1 -0
- package/dist/ui/editor/ContentForm.d.ts +46 -0
- package/dist/ui/editor/ContentForm.d.ts.map +1 -0
- package/dist/ui/editor/ContentForm.js +821 -0
- package/dist/ui/editor/ContentForm.js.map +1 -0
- package/dist/ui/editor/Rte.d.ts +16 -0
- package/dist/ui/editor/Rte.d.ts.map +1 -0
- package/dist/ui/editor/Rte.js +272 -0
- package/dist/ui/editor/Rte.js.map +1 -0
- package/dist/ui/editor/ai-assist.d.ts +43 -0
- package/dist/ui/editor/ai-assist.d.ts.map +1 -0
- package/dist/ui/editor/ai-assist.js +114 -0
- package/dist/ui/editor/ai-assist.js.map +1 -0
- package/dist/ui/editor/autosave.d.ts +18 -0
- package/dist/ui/editor/autosave.d.ts.map +1 -0
- package/dist/ui/editor/autosave.js +23 -0
- package/dist/ui/editor/autosave.js.map +1 -0
- package/dist/ui/editor/content-payload.d.ts +19 -0
- package/dist/ui/editor/content-payload.d.ts.map +1 -0
- package/dist/ui/editor/content-payload.js +97 -0
- package/dist/ui/editor/content-payload.js.map +1 -0
- package/dist/ui/editor/editor-media-upload.d.ts +6 -0
- package/dist/ui/editor/editor-media-upload.d.ts.map +1 -0
- package/dist/ui/editor/editor-media-upload.js +20 -0
- package/dist/ui/editor/editor-media-upload.js.map +1 -0
- package/dist/ui/editor/serialize.d.ts +6 -0
- package/dist/ui/editor/serialize.d.ts.map +1 -0
- package/dist/ui/editor/serialize.js +479 -0
- package/dist/ui/editor/serialize.js.map +1 -0
- package/dist/ui/editor/tweet-embed.d.ts +4 -0
- package/dist/ui/editor/tweet-embed.d.ts.map +1 -0
- package/dist/ui/editor/tweet-embed.js +49 -0
- package/dist/ui/editor/tweet-embed.js.map +1 -0
- package/dist/ui/hash-router.d.ts +5 -0
- package/dist/ui/hash-router.d.ts.map +1 -0
- package/dist/ui/hash-router.js +25 -0
- package/dist/ui/hash-router.js.map +1 -0
- package/dist/ui/icons.d.ts +32 -0
- package/dist/ui/icons.d.ts.map +1 -0
- package/dist/ui/icons.js +86 -0
- package/dist/ui/icons.js.map +1 -0
- package/dist/ui/inspector/Field.d.ts +12 -0
- package/dist/ui/inspector/Field.d.ts.map +1 -0
- package/dist/ui/inspector/Field.js +8 -0
- package/dist/ui/inspector/Field.js.map +1 -0
- package/dist/ui/inspector/FoundryTab.d.ts +9 -0
- package/dist/ui/inspector/FoundryTab.d.ts.map +1 -0
- package/dist/ui/inspector/FoundryTab.js +362 -0
- package/dist/ui/inspector/FoundryTab.js.map +1 -0
- package/dist/ui/inspector/HistoryTab.d.ts +7 -0
- package/dist/ui/inspector/HistoryTab.d.ts.map +1 -0
- package/dist/ui/inspector/HistoryTab.js +289 -0
- package/dist/ui/inspector/HistoryTab.js.map +1 -0
- package/dist/ui/inspector/Inspector.d.ts +13 -0
- package/dist/ui/inspector/Inspector.d.ts.map +1 -0
- package/dist/ui/inspector/Inspector.js +163 -0
- package/dist/ui/inspector/Inspector.js.map +1 -0
- package/dist/ui/inspector/OrganizeTab.d.ts +15 -0
- package/dist/ui/inspector/OrganizeTab.d.ts.map +1 -0
- package/dist/ui/inspector/OrganizeTab.js +319 -0
- package/dist/ui/inspector/OrganizeTab.js.map +1 -0
- package/dist/ui/inspector/PublishTab.d.ts +18 -0
- package/dist/ui/inspector/PublishTab.d.ts.map +1 -0
- package/dist/ui/inspector/PublishTab.js +339 -0
- package/dist/ui/inspector/PublishTab.js.map +1 -0
- package/dist/ui/inspector/Section.d.ts +10 -0
- package/dist/ui/inspector/Section.d.ts.map +1 -0
- package/dist/ui/inspector/Section.js +40 -0
- package/dist/ui/inspector/Section.js.map +1 -0
- package/dist/ui/inspector/SeoTab.d.ts +19 -0
- package/dist/ui/inspector/SeoTab.d.ts.map +1 -0
- package/dist/ui/inspector/SeoTab.js +328 -0
- package/dist/ui/inspector/SeoTab.js.map +1 -0
- package/dist/ui/inspector/foundry-stages.d.ts +36 -0
- package/dist/ui/inspector/foundry-stages.d.ts.map +1 -0
- package/dist/ui/inspector/foundry-stages.js +101 -0
- package/dist/ui/inspector/foundry-stages.js.map +1 -0
- package/dist/ui/inspector/inspector-data.d.ts +80 -0
- package/dist/ui/inspector/inspector-data.d.ts.map +1 -0
- package/dist/ui/inspector/inspector-data.js +172 -0
- package/dist/ui/inspector/inspector-data.js.map +1 -0
- package/dist/ui/inspector/organize-data.d.ts +23 -0
- package/dist/ui/inspector/organize-data.d.ts.map +1 -0
- package/dist/ui/inspector/organize-data.js +28 -0
- package/dist/ui/inspector/organize-data.js.map +1 -0
- package/dist/ui/inspector/revision-diff.d.ts +49 -0
- package/dist/ui/inspector/revision-diff.d.ts.map +1 -0
- package/dist/ui/inspector/revision-diff.js +166 -0
- package/dist/ui/inspector/revision-diff.js.map +1 -0
- package/dist/ui/inspector/seo-helpers.d.ts +37 -0
- package/dist/ui/inspector/seo-helpers.d.ts.map +1 -0
- package/dist/ui/inspector/seo-helpers.js +37 -0
- package/dist/ui/inspector/seo-helpers.js.map +1 -0
- package/dist/ui/inspector/tab-visibility.d.ts +14 -0
- package/dist/ui/inspector/tab-visibility.d.ts.map +1 -0
- package/dist/ui/inspector/tab-visibility.js +28 -0
- package/dist/ui/inspector/tab-visibility.js.map +1 -0
- package/dist/ui/nav.d.ts +16 -0
- package/dist/ui/nav.d.ts.map +1 -0
- package/dist/ui/nav.js +33 -0
- package/dist/ui/nav.js.map +1 -0
- package/dist/ui/pages/admin.astro +32 -0
- package/dist/ui/preview/draft-page.d.ts +37 -0
- package/dist/ui/preview/draft-page.d.ts.map +1 -0
- package/dist/ui/preview/draft-page.js +212 -0
- package/dist/ui/preview/draft-page.js.map +1 -0
- package/dist/ui/preview/preview-layout.d.ts +23 -0
- package/dist/ui/preview/preview-layout.d.ts.map +1 -0
- package/dist/ui/preview/preview-layout.js +30 -0
- package/dist/ui/preview/preview-layout.js.map +1 -0
- package/dist/ui/screens/AnalyticsScreen.d.ts +2 -0
- package/dist/ui/screens/AnalyticsScreen.d.ts.map +1 -0
- package/dist/ui/screens/AnalyticsScreen.js +408 -0
- package/dist/ui/screens/AnalyticsScreen.js.map +1 -0
- package/dist/ui/screens/AuthorsScreen.d.ts +2 -0
- package/dist/ui/screens/AuthorsScreen.d.ts.map +1 -0
- package/dist/ui/screens/AuthorsScreen.js +225 -0
- package/dist/ui/screens/AuthorsScreen.js.map +1 -0
- package/dist/ui/screens/CalendarScreen.d.ts +6 -0
- package/dist/ui/screens/CalendarScreen.d.ts.map +1 -0
- package/dist/ui/screens/CalendarScreen.js +327 -0
- package/dist/ui/screens/CalendarScreen.js.map +1 -0
- package/dist/ui/screens/ContentInsightsScreen.d.ts +2 -0
- package/dist/ui/screens/ContentInsightsScreen.d.ts.map +1 -0
- package/dist/ui/screens/ContentInsightsScreen.js +129 -0
- package/dist/ui/screens/ContentInsightsScreen.js.map +1 -0
- package/dist/ui/screens/ContentRoute.d.ts +2 -0
- package/dist/ui/screens/ContentRoute.d.ts.map +1 -0
- package/dist/ui/screens/ContentRoute.js +32 -0
- package/dist/ui/screens/ContentRoute.js.map +1 -0
- package/dist/ui/screens/DashboardScreen.d.ts +6 -0
- package/dist/ui/screens/DashboardScreen.d.ts.map +1 -0
- package/dist/ui/screens/DashboardScreen.js +273 -0
- package/dist/ui/screens/DashboardScreen.js.map +1 -0
- package/dist/ui/screens/EditorScreen.d.ts +7 -0
- package/dist/ui/screens/EditorScreen.d.ts.map +1 -0
- package/dist/ui/screens/EditorScreen.js +426 -0
- package/dist/ui/screens/EditorScreen.js.map +1 -0
- package/dist/ui/screens/LibraryScreen.d.ts +6 -0
- package/dist/ui/screens/LibraryScreen.d.ts.map +1 -0
- package/dist/ui/screens/LibraryScreen.js +580 -0
- package/dist/ui/screens/LibraryScreen.js.map +1 -0
- package/dist/ui/screens/MediaScreen.d.ts +2 -0
- package/dist/ui/screens/MediaScreen.d.ts.map +1 -0
- package/dist/ui/screens/MediaScreen.js +173 -0
- package/dist/ui/screens/MediaScreen.js.map +1 -0
- package/dist/ui/screens/SettingsScreen.d.ts +4 -0
- package/dist/ui/screens/SettingsScreen.d.ts.map +1 -0
- package/dist/ui/screens/SettingsScreen.js +751 -0
- package/dist/ui/screens/SettingsScreen.js.map +1 -0
- package/dist/ui/screens/SocialShareScreen.d.ts +2 -0
- package/dist/ui/screens/SocialShareScreen.d.ts.map +1 -0
- package/dist/ui/screens/SocialShareScreen.js +224 -0
- package/dist/ui/screens/SocialShareScreen.js.map +1 -0
- package/dist/ui/screens/SubscriptionsScreen.d.ts +2 -0
- package/dist/ui/screens/SubscriptionsScreen.d.ts.map +1 -0
- package/dist/ui/screens/SubscriptionsScreen.js +441 -0
- package/dist/ui/screens/SubscriptionsScreen.js.map +1 -0
- package/dist/ui/screens/TopicsScreen.d.ts +2 -0
- package/dist/ui/screens/TopicsScreen.d.ts.map +1 -0
- package/dist/ui/screens/TopicsScreen.js +360 -0
- package/dist/ui/screens/TopicsScreen.js.map +1 -0
- package/dist/ui/screens/analytics-data.d.ts +19 -0
- package/dist/ui/screens/analytics-data.d.ts.map +1 -0
- package/dist/ui/screens/analytics-data.js +42 -0
- package/dist/ui/screens/analytics-data.js.map +1 -0
- package/dist/ui/screens/calendar-data.d.ts +45 -0
- package/dist/ui/screens/calendar-data.d.ts.map +1 -0
- package/dist/ui/screens/calendar-data.js +70 -0
- package/dist/ui/screens/calendar-data.js.map +1 -0
- package/dist/ui/screens/content-insights-data.d.ts +54 -0
- package/dist/ui/screens/content-insights-data.d.ts.map +1 -0
- package/dist/ui/screens/content-insights-data.js +82 -0
- package/dist/ui/screens/content-insights-data.js.map +1 -0
- package/dist/ui/screens/content-view.d.ts +21 -0
- package/dist/ui/screens/content-view.d.ts.map +1 -0
- package/dist/ui/screens/content-view.js +17 -0
- package/dist/ui/screens/content-view.js.map +1 -0
- package/dist/ui/screens/library-data.d.ts +76 -0
- package/dist/ui/screens/library-data.d.ts.map +1 -0
- package/dist/ui/screens/library-data.js +116 -0
- package/dist/ui/screens/library-data.js.map +1 -0
- package/dist/ui/screens/media-upload.d.ts +19 -0
- package/dist/ui/screens/media-upload.d.ts.map +1 -0
- package/dist/ui/screens/media-upload.js +187 -0
- package/dist/ui/screens/media-upload.js.map +1 -0
- package/dist/ui/screens/public-url.d.ts +24 -0
- package/dist/ui/screens/public-url.d.ts.map +1 -0
- package/dist/ui/screens/public-url.js +74 -0
- package/dist/ui/screens/public-url.js.map +1 -0
- package/dist/ui/screens/registry.d.ts +3 -0
- package/dist/ui/screens/registry.d.ts.map +1 -0
- package/dist/ui/screens/registry.js +38 -0
- package/dist/ui/screens/registry.js.map +1 -0
- package/dist/ui/screens/render-state.d.ts +105 -0
- package/dist/ui/screens/render-state.d.ts.map +1 -0
- package/dist/ui/screens/render-state.js +127 -0
- package/dist/ui/screens/render-state.js.map +1 -0
- package/dist/ui/screens/settings-data.d.ts +55 -0
- package/dist/ui/screens/settings-data.d.ts.map +1 -0
- package/dist/ui/screens/settings-data.js +89 -0
- package/dist/ui/screens/settings-data.js.map +1 -0
- package/dist/ui/screens/settings-panels-data.d.ts +58 -0
- package/dist/ui/screens/settings-panels-data.d.ts.map +1 -0
- package/dist/ui/screens/settings-panels-data.js +88 -0
- package/dist/ui/screens/settings-panels-data.js.map +1 -0
- package/dist/ui/screens/social-share-data.d.ts +307 -0
- package/dist/ui/screens/social-share-data.d.ts.map +1 -0
- package/dist/ui/screens/social-share-data.js +447 -0
- package/dist/ui/screens/social-share-data.js.map +1 -0
- package/dist/ui/screens/topics-data.d.ts +38 -0
- package/dist/ui/screens/topics-data.d.ts.map +1 -0
- package/dist/ui/screens/topics-data.js +50 -0
- package/dist/ui/screens/topics-data.js.map +1 -0
- package/dist/ui/styles/broadsheet.css +394 -0
- package/dist/ui/theme.d.ts +23 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/theme.js +87 -0
- package/dist/ui/theme.js.map +1 -0
- package/dist/ui/tweaks.d.ts +7 -0
- package/dist/ui/tweaks.d.ts.map +1 -0
- package/dist/ui/tweaks.js +31 -0
- package/dist/ui/tweaks.js.map +1 -0
- package/dist/ui/use-hash-router.d.ts +6 -0
- package/dist/ui/use-hash-router.d.ts.map +1 -0
- package/dist/ui/use-hash-router.js +15 -0
- package/dist/ui/use-hash-router.js.map +1 -0
- package/dist/ui/use-tweaks.d.ts +6 -0
- package/dist/ui/use-tweaks.d.ts.map +1 -0
- package/dist/ui/use-tweaks.js +24 -0
- package/dist/ui/use-tweaks.js.map +1 -0
- package/dist/ui/workspace-context.d.ts +34 -0
- package/dist/ui/workspace-context.d.ts.map +1 -0
- package/dist/ui/workspace-context.js +32 -0
- package/dist/ui/workspace-context.js.map +1 -0
- package/migrations/0001_create_cms_tables.sql +200 -0
- package/migrations/0002_review_softdelete_board.sql +112 -0
- package/migrations/0003_content_contributors.sql +16 -0
- package/migrations/0004_seo_faq_columns.sql +6 -0
- package/migrations/0005_revision_delta_columns.sql +5 -0
- package/migrations/0006_processing_trigger_token.sql +4 -0
- package/migrations/0007_content_slug_redirects.sql +9 -0
- package/migrations/0008_workspace_settings.sql +17 -0
- package/migrations/0009_workspace_memberships.sql +36 -0
- package/migrations/0010_api_keys_webhooks.sql +21 -0
- package/migrations/0011_notifications_activity.sql +22 -0
- package/migrations/0012_content_imports.sql +10 -0
- package/migrations/0013_media_normalization.sql +4 -0
- package/migrations/0014_api_key_prefix.sql +3 -0
- package/migrations/0015_cms_topics.sql +7 -0
- package/migrations/0016_content_insights.sql +53 -0
- package/package.json +82 -0
- package/src/engine/activity-log.ts +39 -0
- package/src/engine/ai-prompts.ts +124 -0
- package/src/engine/ai-writeback.ts +62 -0
- package/src/engine/api-keys.ts +239 -0
- package/src/engine/content-insights.ts +198 -0
- package/src/engine/contributors.ts +95 -0
- package/src/engine/cron.ts +62 -0
- package/src/engine/d1.ts +29 -0
- package/src/engine/foundry-dispatch.ts +417 -0
- package/src/engine/import-parsers.ts +478 -0
- package/src/engine/index.ts +230 -0
- package/src/engine/invites.ts +271 -0
- package/src/engine/members.ts +216 -0
- package/src/engine/membership-rules.ts +63 -0
- package/src/engine/og-render.ts +59 -0
- package/src/engine/publish-guard.ts +123 -0
- package/src/engine/publisher.ts +1032 -0
- package/src/engine/revisions.ts +292 -0
- package/src/engine/sanitize.ts +183 -0
- package/src/engine/seed-membership.ts +92 -0
- package/src/engine/seo.ts +72 -0
- package/src/engine/slug-redirects.ts +34 -0
- package/src/engine/slug.ts +33 -0
- package/src/engine/soft-delete.ts +42 -0
- package/src/engine/tags.ts +95 -0
- package/src/engine/topics.ts +158 -0
- package/src/engine/url-guard.ts +136 -0
- package/src/engine/validator/checks/bare-url-not-autolinked.ts +78 -0
- package/src/engine/validator/checks/broken-footnote-label.ts +33 -0
- package/src/engine/validator/checks/double-encoded-entities.ts +46 -0
- package/src/engine/validator/checks/empty-alt-text.ts +35 -0
- package/src/engine/validator/checks/heading-hierarchy-skip.ts +33 -0
- package/src/engine/validator/checks/html-comment-leak.ts +58 -0
- package/src/engine/validator/checks/iframe-missing-dims-and-wrapper.ts +34 -0
- package/src/engine/validator/checks/invisible-control-chars.ts +58 -0
- package/src/engine/validator/checks/paywall-marker-leak.ts +43 -0
- package/src/engine/validator/checks/raw-block-html.ts +65 -0
- package/src/engine/validator/checks/stale-body-html.ts +39 -0
- package/src/engine/validator/checks/unresolved-footnote-anchor.ts +61 -0
- package/src/engine/validator/checks/word-gdocs-paste-artifacts.ts +72 -0
- package/src/engine/validator/index.ts +385 -0
- package/src/engine/validator/scan.ts +103 -0
- package/src/engine/validator/types.ts +114 -0
- package/src/engine/webhook-signer.ts +139 -0
- package/src/engine/webhooks.ts +224 -0
- package/src/index.ts +79 -0
- package/src/integration/index.ts +298 -0
- package/src/integration/options.ts +30 -0
- package/src/integration/vite-plugin.ts +37 -0
- package/src/providers/index.ts +2 -0
- package/src/providers/null.ts +160 -0
- package/src/providers/types.ts +284 -0
- package/src/routes/ai.ts +461 -0
- package/src/routes/analytics.ts +78 -0
- package/src/routes/api-keys.ts +133 -0
- package/src/routes/authors.ts +282 -0
- package/src/routes/authz-matrix.ts +239 -0
- package/src/routes/calendar.ts +127 -0
- package/src/routes/config.ts +99 -0
- package/src/routes/content-insights.ts +159 -0
- package/src/routes/content.ts +1753 -0
- package/src/routes/context.ts +146 -0
- package/src/routes/cron.ts +27 -0
- package/src/routes/dashboard.ts +174 -0
- package/src/routes/imports.ts +190 -0
- package/src/routes/index.ts +295 -0
- package/src/routes/media-lib.ts +405 -0
- package/src/routes/media.ts +944 -0
- package/src/routes/preview.ts +182 -0
- package/src/routes/rbac-invites.ts +220 -0
- package/src/routes/rbac.ts +155 -0
- package/src/routes/shell.ts +163 -0
- package/src/routes/subscriptions.ts +167 -0
- package/src/routes/tags.ts +93 -0
- package/src/routes/topics.ts +58 -0
- package/src/routes/webhooks.ts +233 -0
- package/src/schema/index.ts +45 -0
- package/src/schema/insights-ingest.ts +126 -0
- package/src/schema/migrations.ts +599 -0
- package/src/schema/tables.ts +59 -0
- package/src/schema/types.ts +576 -0
- package/src/ui/api/_authz.ts +100 -0
- package/src/ui/api/_content-config.ts +75 -0
- package/src/ui/api/activity.ts +33 -0
- package/src/ui/api/analytics.ts +42 -0
- package/src/ui/api/authors/[id].ts +23 -0
- package/src/ui/api/authors.ts +19 -0
- package/src/ui/api/calendar.ts +21 -0
- package/src/ui/api/content/[id]/ai/headlines.ts +10 -0
- package/src/ui/api/content/[id]/ai/meta-description.ts +11 -0
- package/src/ui/api/content/[id]/ai/og-image.ts +10 -0
- package/src/ui/api/content/[id]/ai/proofread.ts +10 -0
- package/src/ui/api/content/[id]/ai/takeaways.ts +11 -0
- package/src/ui/api/content/[id]/contributors.ts +13 -0
- package/src/ui/api/content/[id]/preview-token.ts +21 -0
- package/src/ui/api/content/[id]/revisions/[rev]/restore.ts +12 -0
- package/src/ui/api/content/[id]/revisions/[rev].ts +11 -0
- package/src/ui/api/content/[id]/revisions.ts +9 -0
- package/src/ui/api/content/[id]/seo-score.ts +10 -0
- package/src/ui/api/content/[id].ts +23 -0
- package/src/ui/api/content/bulk.ts +10 -0
- package/src/ui/api/content/counts.ts +11 -0
- package/src/ui/api/content/foundry-callback.ts +11 -0
- package/src/ui/api/content/import/confirm.ts +16 -0
- package/src/ui/api/content/import/parse.ts +16 -0
- package/src/ui/api/content/insights-ingest.ts +24 -0
- package/src/ui/api/content-insights/dismiss.ts +23 -0
- package/src/ui/api/content-insights/index.ts +21 -0
- package/src/ui/api/content-insights/undismiss.ts +23 -0
- package/src/ui/api/content.ts +21 -0
- package/src/ui/api/dashboard.ts +28 -0
- package/src/ui/api/me.ts +23 -0
- package/src/ui/api/media/[id].ts +22 -0
- package/src/ui/api/media/images.ts +9 -0
- package/src/ui/api/media/library/[id].ts +9 -0
- package/src/ui/api/media/library.ts +22 -0
- package/src/ui/api/media/podcast/abort.ts +6 -0
- package/src/ui/api/media/podcast/complete.ts +6 -0
- package/src/ui/api/media/podcast/init.ts +6 -0
- package/src/ui/api/media/podcast/part.ts +6 -0
- package/src/ui/api/media/podcast.ts +9 -0
- package/src/ui/api/media/videos/abort.ts +9 -0
- package/src/ui/api/media/videos/complete.ts +9 -0
- package/src/ui/api/media/videos/init.ts +9 -0
- package/src/ui/api/media/videos/part.ts +9 -0
- package/src/ui/api/notifications.ts +26 -0
- package/src/ui/api/search.ts +23 -0
- package/src/ui/api/settings/api-keys/[id].ts +28 -0
- package/src/ui/api/settings/api-keys.ts +25 -0
- package/src/ui/api/settings/domains.ts +37 -0
- package/src/ui/api/settings/integrations.ts +40 -0
- package/src/ui/api/settings/members/[userId].ts +33 -0
- package/src/ui/api/settings/members/invite.ts +27 -0
- package/src/ui/api/settings/members.ts +23 -0
- package/src/ui/api/settings/webhooks/[id]/test.ts +30 -0
- package/src/ui/api/settings/webhooks/[id].ts +29 -0
- package/src/ui/api/settings/webhooks.ts +27 -0
- package/src/ui/api/subscriptions.ts +56 -0
- package/src/ui/api/tags/[id].ts +24 -0
- package/src/ui/api/tags/index.ts +18 -0
- package/src/ui/api/topics/[id].ts +20 -0
- package/src/ui/api/topics/index.ts +17 -0
- package/src/ui/api/workspace-settings.ts +26 -0
- package/src/ui/client/boot-state.ts +42 -0
- package/src/ui/client/mount.tsx +41 -0
- package/src/ui/commands.ts +62 -0
- package/src/ui/components/CmsApp.tsx +149 -0
- package/src/ui/components/CommandPalette.tsx +118 -0
- package/src/ui/components/NoAccessScreen.tsx +79 -0
- package/src/ui/components/ShareModal.tsx +650 -0
- package/src/ui/components/SharePickers.tsx +790 -0
- package/src/ui/components/ShareStatsPanel.tsx +721 -0
- package/src/ui/components/Sidebar.tsx +86 -0
- package/src/ui/components/SiteSwitcher.tsx +100 -0
- package/src/ui/components/Topbar.tsx +93 -0
- package/src/ui/editor/AiAssistPanel.tsx +407 -0
- package/src/ui/editor/ContentForm.tsx +1462 -0
- package/src/ui/editor/Rte.tsx +382 -0
- package/src/ui/editor/ai-assist.ts +139 -0
- package/src/ui/editor/autosave.ts +36 -0
- package/src/ui/editor/content-payload.ts +125 -0
- package/src/ui/editor/editor-media-upload.ts +26 -0
- package/src/ui/editor/serialize.ts +522 -0
- package/src/ui/editor/tweet-embed.ts +60 -0
- package/src/ui/hash-router.ts +30 -0
- package/src/ui/icons.tsx +208 -0
- package/src/ui/inspector/Field.tsx +30 -0
- package/src/ui/inspector/FoundryTab.tsx +613 -0
- package/src/ui/inspector/HistoryTab.tsx +482 -0
- package/src/ui/inspector/Inspector.tsx +328 -0
- package/src/ui/inspector/OrganizeTab.tsx +534 -0
- package/src/ui/inspector/PublishTab.tsx +626 -0
- package/src/ui/inspector/Section.tsx +81 -0
- package/src/ui/inspector/SeoTab.tsx +573 -0
- package/src/ui/inspector/foundry-stages.ts +140 -0
- package/src/ui/inspector/inspector-data.ts +232 -0
- package/src/ui/inspector/organize-data.ts +51 -0
- package/src/ui/inspector/revision-diff.ts +213 -0
- package/src/ui/inspector/seo-helpers.ts +71 -0
- package/src/ui/inspector/tab-visibility.ts +37 -0
- package/src/ui/nav.ts +48 -0
- package/src/ui/pages/admin.astro +32 -0
- package/src/ui/preview/draft-page.tsx +395 -0
- package/src/ui/preview/preview-layout.ts +49 -0
- package/src/ui/screens/AnalyticsScreen.tsx +938 -0
- package/src/ui/screens/AuthorsScreen.tsx +524 -0
- package/src/ui/screens/CalendarScreen.tsx +694 -0
- package/src/ui/screens/ContentInsightsScreen.tsx +417 -0
- package/src/ui/screens/ContentRoute.tsx +35 -0
- package/src/ui/screens/DashboardScreen.tsx +654 -0
- package/src/ui/screens/EditorScreen.tsx +673 -0
- package/src/ui/screens/LibraryScreen.tsx +1350 -0
- package/src/ui/screens/MediaScreen.tsx +357 -0
- package/src/ui/screens/SettingsScreen.tsx +1841 -0
- package/src/ui/screens/SocialShareScreen.tsx +670 -0
- package/src/ui/screens/SubscriptionsScreen.tsx +1240 -0
- package/src/ui/screens/TopicsScreen.tsx +912 -0
- package/src/ui/screens/analytics-data.ts +68 -0
- package/src/ui/screens/calendar-data.ts +126 -0
- package/src/ui/screens/content-insights-data.ts +127 -0
- package/src/ui/screens/content-view.ts +30 -0
- package/src/ui/screens/library-data.ts +177 -0
- package/src/ui/screens/media-upload.ts +283 -0
- package/src/ui/screens/public-url.ts +81 -0
- package/src/ui/screens/registry.tsx +53 -0
- package/src/ui/screens/render-state.ts +228 -0
- package/src/ui/screens/settings-data.ts +140 -0
- package/src/ui/screens/settings-panels-data.ts +142 -0
- package/src/ui/screens/social-share-data.ts +753 -0
- package/src/ui/screens/topics-data.ts +75 -0
- package/src/ui/styles/broadsheet.css +394 -0
- package/src/ui/theme.ts +104 -0
- package/src/ui/tweaks.ts +37 -0
- package/src/ui/use-hash-router.ts +17 -0
- package/src/ui/use-tweaks.ts +31 -0
- package/src/ui/workspace-context.tsx +62 -0
- package/src/virtual.d.ts +4 -0
|
@@ -0,0 +1,1240 @@
|
|
|
1
|
+
// src/ui/screens/SubscriptionsScreen.tsx — Subscriptions screen (P5 Task 11).
|
|
2
|
+
//
|
|
3
|
+
// Renders the member list + filters, 4 KPI cards (Active/MRR/Churn/LTV),
|
|
4
|
+
// the plan-mix bar, export, and gift subscription — backed entirely by
|
|
5
|
+
// GET /admin/api/subscriptions?type=* (members / kpis / planMix / export)
|
|
6
|
+
// and POST /admin/api/subscriptions (gift).
|
|
7
|
+
//
|
|
8
|
+
// Honesty conventions (two-level per grounding fact 10):
|
|
9
|
+
// - result.status === 'empty' → honest empty state, no mock numbers
|
|
10
|
+
// - result.status === 'partial' → render value with a partial affordance
|
|
11
|
+
// - result.status === 'live' → render the real value
|
|
12
|
+
// - per-key null (e.g. ltv: null) → "— pending backfill" via formatKpi
|
|
13
|
+
//
|
|
14
|
+
// NO BData / MEMBERS / mock KPI numbers (38,214 / $320k / $186).
|
|
15
|
+
//
|
|
16
|
+
// Presentation: Broadsheet idiom — page-head/page-title, .grid-stats KPI cards
|
|
17
|
+
// with serif .tnum numbers, .seg filter, the .tbl members table with .pill.pdot
|
|
18
|
+
// plan/status chips, the .masthead-rule hairline under card titles, and the
|
|
19
|
+
// gift dialog on a .scrim + .panel.panel-pad with .field-label/.input/.btn.
|
|
20
|
+
|
|
21
|
+
import { useCallback, useEffect, useReducer, useState } from 'react'
|
|
22
|
+
import type {
|
|
23
|
+
DuplicateAccountsReport,
|
|
24
|
+
GiftOrdersPage,
|
|
25
|
+
LsImportSummary,
|
|
26
|
+
ProviderResult,
|
|
27
|
+
SubscriptionMember,
|
|
28
|
+
} from '../../providers/types.js'
|
|
29
|
+
import { Icon } from '../icons.js'
|
|
30
|
+
import {
|
|
31
|
+
formatKpi,
|
|
32
|
+
type KpiPending,
|
|
33
|
+
type PlanMixBucket,
|
|
34
|
+
planMixToBars,
|
|
35
|
+
selectKpiState,
|
|
36
|
+
} from './render-state.js'
|
|
37
|
+
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// Filter options
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
type FilterOption = 'all' | 'paid' | 'past_due' | 'canceled'
|
|
43
|
+
|
|
44
|
+
const FILTER_LABELS: Array<{ value: FilterOption; label: string }> = [
|
|
45
|
+
{ value: 'all', label: 'All' },
|
|
46
|
+
{ value: 'paid', label: 'Paid' },
|
|
47
|
+
{ value: 'past_due', label: 'Past due' },
|
|
48
|
+
{ value: 'canceled', label: 'Canceled' },
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Data shapes
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
interface SubscriptionsData {
|
|
56
|
+
members: ProviderResult<SubscriptionMember[]>
|
|
57
|
+
kpis: ProviderResult<Record<string, number | null>>
|
|
58
|
+
planMix: ProviderResult<PlanMixBucket[]>
|
|
59
|
+
duplicates: ProviderResult<DuplicateAccountsReport>
|
|
60
|
+
gifts: ProviderResult<GiftOrdersPage>
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// Reducer
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
|
|
67
|
+
interface SubscriptionsState {
|
|
68
|
+
loading: boolean
|
|
69
|
+
error: string | null
|
|
70
|
+
data: SubscriptionsData | null
|
|
71
|
+
page: number
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type SubscriptionsAction =
|
|
75
|
+
| { type: 'fetch-start' }
|
|
76
|
+
| { type: 'fetch-ok'; data: SubscriptionsData }
|
|
77
|
+
| { type: 'fetch-error'; error: string }
|
|
78
|
+
| { type: 'set-page'; page: number }
|
|
79
|
+
|
|
80
|
+
function init(): SubscriptionsState {
|
|
81
|
+
return { loading: true, error: null, data: null, page: 1 }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function reducer(state: SubscriptionsState, action: SubscriptionsAction): SubscriptionsState {
|
|
85
|
+
switch (action.type) {
|
|
86
|
+
case 'fetch-start':
|
|
87
|
+
return { ...state, loading: true, error: null }
|
|
88
|
+
case 'fetch-ok':
|
|
89
|
+
return { ...state, loading: false, error: null, data: action.data }
|
|
90
|
+
case 'fetch-error':
|
|
91
|
+
return { ...state, loading: false, error: action.error, data: null }
|
|
92
|
+
case 'set-page':
|
|
93
|
+
return { ...state, page: action.page }
|
|
94
|
+
default:
|
|
95
|
+
return state
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// Gift form state
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
interface GiftState {
|
|
104
|
+
open: boolean
|
|
105
|
+
email: string
|
|
106
|
+
planVariantId: string
|
|
107
|
+
submitting: boolean
|
|
108
|
+
result: string | null
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
// SubscriptionsScreen
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
|
|
115
|
+
export function SubscriptionsScreen() {
|
|
116
|
+
const [filter, setFilter] = useState<FilterOption>('all')
|
|
117
|
+
const [s, dispatch] = useReducer(reducer, undefined, init)
|
|
118
|
+
const [gift, setGift] = useState<GiftState>({
|
|
119
|
+
open: false,
|
|
120
|
+
email: '',
|
|
121
|
+
planVariantId: '',
|
|
122
|
+
submitting: false,
|
|
123
|
+
result: null,
|
|
124
|
+
})
|
|
125
|
+
const [exporting, setExporting] = useState(false)
|
|
126
|
+
|
|
127
|
+
const fetchData = useCallback(async (f: FilterOption, page: number) => {
|
|
128
|
+
dispatch({ type: 'fetch-start' })
|
|
129
|
+
try {
|
|
130
|
+
const filterParam = f === 'all' ? '' : `&filter=${f}`
|
|
131
|
+
const [membersRes, kpisRes, planMixRes, duplicatesRes, giftsRes] = await Promise.all([
|
|
132
|
+
fetch(`/admin/api/subscriptions?type=members${filterParam}&page=${page}`),
|
|
133
|
+
fetch('/admin/api/subscriptions?type=kpis'),
|
|
134
|
+
fetch('/admin/api/subscriptions?type=planMix'),
|
|
135
|
+
fetch('/admin/api/subscriptions?type=duplicates'),
|
|
136
|
+
fetch('/admin/api/subscriptions?type=gifts'),
|
|
137
|
+
])
|
|
138
|
+
|
|
139
|
+
if (!membersRes.ok || !kpisRes.ok || !planMixRes.ok || !duplicatesRes.ok || !giftsRes.ok) {
|
|
140
|
+
const bad = [membersRes, kpisRes, planMixRes, duplicatesRes, giftsRes].find((r) => !r.ok)!
|
|
141
|
+
dispatch({ type: 'fetch-error', error: `${bad.status} ${bad.statusText}` })
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const [members, kpis, planMix, duplicates, gifts] = await Promise.all([
|
|
146
|
+
membersRes.json() as Promise<ProviderResult<SubscriptionMember[]>>,
|
|
147
|
+
kpisRes.json() as Promise<ProviderResult<Record<string, number | null>>>,
|
|
148
|
+
planMixRes.json() as Promise<ProviderResult<PlanMixBucket[]>>,
|
|
149
|
+
duplicatesRes.json() as Promise<ProviderResult<DuplicateAccountsReport>>,
|
|
150
|
+
giftsRes.json() as Promise<ProviderResult<GiftOrdersPage>>,
|
|
151
|
+
])
|
|
152
|
+
|
|
153
|
+
dispatch({ type: 'fetch-ok', data: { members, kpis, planMix, duplicates, gifts } })
|
|
154
|
+
} catch (err) {
|
|
155
|
+
dispatch({ type: 'fetch-error', error: String(err) })
|
|
156
|
+
}
|
|
157
|
+
}, [])
|
|
158
|
+
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
void fetchData(filter, s.page)
|
|
161
|
+
}, [fetchData, filter, s.page])
|
|
162
|
+
|
|
163
|
+
const handleFilterChange = (f: FilterOption) => {
|
|
164
|
+
setFilter(f)
|
|
165
|
+
dispatch({ type: 'set-page', page: 1 })
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const handleExport = async () => {
|
|
169
|
+
setExporting(true)
|
|
170
|
+
try {
|
|
171
|
+
const res = await fetch('/admin/api/subscriptions?type=export&fmt=csv')
|
|
172
|
+
if (!res.ok) return
|
|
173
|
+
const body = (await res.json()) as ProviderResult<string>
|
|
174
|
+
if (body.status === 'empty' || !body.data) return
|
|
175
|
+
const blob = new Blob([body.data], { type: 'text/csv' })
|
|
176
|
+
const url = URL.createObjectURL(blob)
|
|
177
|
+
const a = document.createElement('a')
|
|
178
|
+
a.href = url
|
|
179
|
+
a.download = 'members.csv'
|
|
180
|
+
a.click()
|
|
181
|
+
URL.revokeObjectURL(url)
|
|
182
|
+
} finally {
|
|
183
|
+
setExporting(false)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const handleGiftSubmit = async () => {
|
|
188
|
+
if (!gift.email || !gift.planVariantId) return
|
|
189
|
+
setGift((g) => ({ ...g, submitting: true, result: null }))
|
|
190
|
+
try {
|
|
191
|
+
const res = await fetch('/admin/api/subscriptions', {
|
|
192
|
+
method: 'POST',
|
|
193
|
+
headers: { 'Content-Type': 'application/json' },
|
|
194
|
+
body: JSON.stringify({ email: gift.email, planVariantId: gift.planVariantId }),
|
|
195
|
+
})
|
|
196
|
+
const body = (await res.json()) as ProviderResult<{ id: string }>
|
|
197
|
+
if (body.status === 'empty' || !body.data.id) {
|
|
198
|
+
setGift((g) => ({ ...g, submitting: false, result: 'Provider not configured.' }))
|
|
199
|
+
} else {
|
|
200
|
+
setGift((g) => ({
|
|
201
|
+
...g,
|
|
202
|
+
submitting: false,
|
|
203
|
+
result: `Gift created: ${body.data.id}`,
|
|
204
|
+
email: '',
|
|
205
|
+
planVariantId: '',
|
|
206
|
+
}))
|
|
207
|
+
void fetchData(filter, s.page)
|
|
208
|
+
}
|
|
209
|
+
} catch (err) {
|
|
210
|
+
setGift((g) => ({ ...g, submitting: false, result: String(err) }))
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const isPartial = s.data !== null && s.data.kpis.status === 'partial'
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<div className="page page-wide fade-in subscriptions-screen" style={{ maxWidth: 1340 }}>
|
|
218
|
+
<div className="page-head">
|
|
219
|
+
<div>
|
|
220
|
+
<h1 className="page-title">Subscriptions</h1>
|
|
221
|
+
<div className="page-sub">Members, revenue, and plan distribution.</div>
|
|
222
|
+
</div>
|
|
223
|
+
<div style={{ display: 'flex', gap: 8 }}>
|
|
224
|
+
<button
|
|
225
|
+
type="button"
|
|
226
|
+
className="btn"
|
|
227
|
+
onClick={() => void handleExport()}
|
|
228
|
+
disabled={exporting}
|
|
229
|
+
>
|
|
230
|
+
<Icon name="download" size={16} />
|
|
231
|
+
{exporting ? 'Exporting…' : 'Export'}
|
|
232
|
+
</button>
|
|
233
|
+
<button
|
|
234
|
+
type="button"
|
|
235
|
+
className="btn primary"
|
|
236
|
+
onClick={() => setGift((g) => ({ ...g, open: true }))}
|
|
237
|
+
>
|
|
238
|
+
<Icon name="sparkle" size={16} />
|
|
239
|
+
Gift subscription
|
|
240
|
+
</button>
|
|
241
|
+
</div>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
{s.loading && (
|
|
245
|
+
<div style={{ color: 'var(--ink-muted)', fontSize: 14 }}>Loading subscriptions…</div>
|
|
246
|
+
)}
|
|
247
|
+
|
|
248
|
+
{!s.loading && s.error && (
|
|
249
|
+
<div style={{ color: 'var(--red)', fontSize: 14, display: 'flex', alignItems: 'center' }}>
|
|
250
|
+
{s.error}
|
|
251
|
+
<button
|
|
252
|
+
type="button"
|
|
253
|
+
className="btn sm"
|
|
254
|
+
style={{ marginLeft: 12 }}
|
|
255
|
+
onClick={() => void fetchData(filter, s.page)}
|
|
256
|
+
>
|
|
257
|
+
Retry
|
|
258
|
+
</button>
|
|
259
|
+
</div>
|
|
260
|
+
)}
|
|
261
|
+
|
|
262
|
+
{!s.loading && !s.error && s.data && (
|
|
263
|
+
<SubscriptionsBody
|
|
264
|
+
data={s.data}
|
|
265
|
+
isPartial={isPartial}
|
|
266
|
+
filter={filter}
|
|
267
|
+
onFilterChange={handleFilterChange}
|
|
268
|
+
page={s.page}
|
|
269
|
+
onPageChange={(p) => dispatch({ type: 'set-page', page: p })}
|
|
270
|
+
/>
|
|
271
|
+
)}
|
|
272
|
+
|
|
273
|
+
{/* Gift modal */}
|
|
274
|
+
{gift.open && (
|
|
275
|
+
<GiftModal
|
|
276
|
+
gift={gift}
|
|
277
|
+
onChange={(field, value) => setGift((g) => ({ ...g, [field]: value }))}
|
|
278
|
+
onSubmit={() => void handleGiftSubmit()}
|
|
279
|
+
onClose={() => setGift((g) => ({ ...g, open: false, result: null }))}
|
|
280
|
+
/>
|
|
281
|
+
)}
|
|
282
|
+
</div>
|
|
283
|
+
)
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// ---------------------------------------------------------------------------
|
|
287
|
+
// SubscriptionsBody
|
|
288
|
+
// ---------------------------------------------------------------------------
|
|
289
|
+
|
|
290
|
+
function SubscriptionsBody({
|
|
291
|
+
data,
|
|
292
|
+
isPartial,
|
|
293
|
+
filter,
|
|
294
|
+
onFilterChange,
|
|
295
|
+
page,
|
|
296
|
+
onPageChange,
|
|
297
|
+
}: {
|
|
298
|
+
data: SubscriptionsData
|
|
299
|
+
isPartial: boolean
|
|
300
|
+
filter: FilterOption
|
|
301
|
+
onFilterChange: (f: FilterOption) => void
|
|
302
|
+
page: number
|
|
303
|
+
onPageChange: (p: number) => void
|
|
304
|
+
}) {
|
|
305
|
+
// resolvePlanName: null impl echoes the id — the screen receives plan-mix from the
|
|
306
|
+
// provider and resolves names via the plan-mix data directly (the provider already
|
|
307
|
+
// supplies the plan id; a real resolver is injected at cutover).
|
|
308
|
+
const resolveName = (id: string) => id
|
|
309
|
+
|
|
310
|
+
const showPlanMix =
|
|
311
|
+
data.planMix.status !== 'empty' && data.planMix.data && data.planMix.data.length > 0
|
|
312
|
+
|
|
313
|
+
return (
|
|
314
|
+
<>
|
|
315
|
+
{isPartial && (
|
|
316
|
+
<PartialBanner message="Showing partial subscription data — LTV/MRR/churn pending LemonSqueezy backfill." />
|
|
317
|
+
)}
|
|
318
|
+
|
|
319
|
+
{/* KPI cards */}
|
|
320
|
+
<KpiCards kpis={data.kpis} />
|
|
321
|
+
|
|
322
|
+
{/* Members table (1.6fr) + plan mix aside (1fr) */}
|
|
323
|
+
<div className="grid-split-wide" style={{ marginBottom: 'var(--gap)' }}>
|
|
324
|
+
<div className="panel" style={{ overflow: 'hidden' }}>
|
|
325
|
+
<div
|
|
326
|
+
style={{
|
|
327
|
+
display: 'flex',
|
|
328
|
+
alignItems: 'center',
|
|
329
|
+
justifyContent: 'space-between',
|
|
330
|
+
padding: '15px 18px 14px',
|
|
331
|
+
}}
|
|
332
|
+
>
|
|
333
|
+
<div className="card-title">Members</div>
|
|
334
|
+
<FilterSegment value={filter} onChange={onFilterChange} />
|
|
335
|
+
</div>
|
|
336
|
+
<hr className="masthead-rule" style={{ margin: '0 18px' }} />
|
|
337
|
+
<MembersTable
|
|
338
|
+
result={data.members}
|
|
339
|
+
resolvePlanName={resolveName}
|
|
340
|
+
page={page}
|
|
341
|
+
onPageChange={onPageChange}
|
|
342
|
+
/>
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
{showPlanMix ? (
|
|
346
|
+
<PlanMixChart planMix={data.planMix} resolvePlanName={resolveName} />
|
|
347
|
+
) : (
|
|
348
|
+
<div className="panel panel-pad">
|
|
349
|
+
<div className="card-title" style={{ marginBottom: 16 }}>
|
|
350
|
+
Plan mix
|
|
351
|
+
</div>
|
|
352
|
+
<EmptyPanel
|
|
353
|
+
icon="chart"
|
|
354
|
+
message="Plan distribution will appear once the subscriptions provider is configured."
|
|
355
|
+
/>
|
|
356
|
+
</div>
|
|
357
|
+
)}
|
|
358
|
+
</div>
|
|
359
|
+
|
|
360
|
+
{/* Admin-parity panels: Duplicate Accounts, Gift Orders, LemonSqueezy Sync */}
|
|
361
|
+
<DuplicateAccountsPanel result={data.duplicates} />
|
|
362
|
+
<GiftOrdersPanel result={data.gifts} />
|
|
363
|
+
<LemonSqueezySyncPanel />
|
|
364
|
+
</>
|
|
365
|
+
)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// ---------------------------------------------------------------------------
|
|
369
|
+
// DuplicateAccountsPanel — billing-email + canonical-email conflict groups
|
|
370
|
+
// ---------------------------------------------------------------------------
|
|
371
|
+
|
|
372
|
+
function DuplicateAccountsPanel({ result }: { result: ProviderResult<DuplicateAccountsReport> }) {
|
|
373
|
+
const report = result.data
|
|
374
|
+
const billing = report?.billingConflicts ?? []
|
|
375
|
+
const canonical = report?.canonicalConflicts ?? []
|
|
376
|
+
const hasAny = billing.length > 0 || canonical.length > 0
|
|
377
|
+
|
|
378
|
+
return (
|
|
379
|
+
<div className="panel panel-pad" style={{ marginBottom: 'var(--gap)' }}>
|
|
380
|
+
<div className="card-title">Duplicate accounts</div>
|
|
381
|
+
<div className="page-sub" style={{ margin: '4px 0 0' }}>
|
|
382
|
+
Accounts sharing a billing email or Gmail-canonical alias.
|
|
383
|
+
</div>
|
|
384
|
+
<hr className="masthead-rule" style={{ margin: '12px 0 16px' }} />
|
|
385
|
+
|
|
386
|
+
{result.status === 'partial' && (
|
|
387
|
+
<div className="kicker" style={{ color: 'var(--amber)', marginBottom: 12 }}>
|
|
388
|
+
Partial data
|
|
389
|
+
</div>
|
|
390
|
+
)}
|
|
391
|
+
|
|
392
|
+
{result.status === 'empty' || !hasAny ? (
|
|
393
|
+
<EmptyPanel
|
|
394
|
+
icon="users"
|
|
395
|
+
message={
|
|
396
|
+
result.status === 'empty'
|
|
397
|
+
? 'Duplicate-account checks run once the subscriptions provider is configured.'
|
|
398
|
+
: 'No duplicate-account signals found.'
|
|
399
|
+
}
|
|
400
|
+
/>
|
|
401
|
+
) : (
|
|
402
|
+
<>
|
|
403
|
+
{report && (
|
|
404
|
+
<div className="kicker" style={{ marginBottom: 14, color: 'var(--ink-muted)' }}>
|
|
405
|
+
{report.summary.billingConflictGroups} billing ·{' '}
|
|
406
|
+
{report.summary.canonicalConflictGroups} canonical · {report.summary.impactedAccounts}{' '}
|
|
407
|
+
accounts impacted
|
|
408
|
+
</div>
|
|
409
|
+
)}
|
|
410
|
+
{billing.length > 0 && (
|
|
411
|
+
<div style={{ marginBottom: canonical.length > 0 ? 18 : 0 }}>
|
|
412
|
+
<div className="kicker" style={{ marginBottom: 8 }}>
|
|
413
|
+
Shared billing email
|
|
414
|
+
</div>
|
|
415
|
+
{billing.map((g) => (
|
|
416
|
+
<ConflictRow
|
|
417
|
+
key={`b:${g.billingEmail}`}
|
|
418
|
+
title={g.billingEmail}
|
|
419
|
+
count={g.accountCount}
|
|
420
|
+
emails={g.accountEmails}
|
|
421
|
+
/>
|
|
422
|
+
))}
|
|
423
|
+
</div>
|
|
424
|
+
)}
|
|
425
|
+
{canonical.length > 0 && (
|
|
426
|
+
<div>
|
|
427
|
+
<div className="kicker" style={{ marginBottom: 8 }}>
|
|
428
|
+
Canonical email matches
|
|
429
|
+
</div>
|
|
430
|
+
{canonical.map((g) => (
|
|
431
|
+
<ConflictRow
|
|
432
|
+
key={`c:${g.canonicalEmail}`}
|
|
433
|
+
title={g.canonicalEmail}
|
|
434
|
+
count={g.accountCount}
|
|
435
|
+
emails={g.accountEmails}
|
|
436
|
+
/>
|
|
437
|
+
))}
|
|
438
|
+
</div>
|
|
439
|
+
)}
|
|
440
|
+
</>
|
|
441
|
+
)}
|
|
442
|
+
</div>
|
|
443
|
+
)
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function ConflictRow({ title, count, emails }: { title: string; count: number; emails: string[] }) {
|
|
447
|
+
return (
|
|
448
|
+
<div
|
|
449
|
+
style={{
|
|
450
|
+
display: 'flex',
|
|
451
|
+
alignItems: 'baseline',
|
|
452
|
+
justifyContent: 'space-between',
|
|
453
|
+
gap: 12,
|
|
454
|
+
padding: '9px 0',
|
|
455
|
+
borderBottom: '1px solid var(--border-soft)',
|
|
456
|
+
}}
|
|
457
|
+
>
|
|
458
|
+
<div style={{ minWidth: 0 }}>
|
|
459
|
+
<div style={{ fontSize: 13, fontWeight: 600, color: 'var(--ink)' }}>{title}</div>
|
|
460
|
+
<div
|
|
461
|
+
style={{
|
|
462
|
+
fontSize: 12,
|
|
463
|
+
color: 'var(--ink-muted)',
|
|
464
|
+
overflow: 'hidden',
|
|
465
|
+
textOverflow: 'ellipsis',
|
|
466
|
+
whiteSpace: 'nowrap',
|
|
467
|
+
maxWidth: 520,
|
|
468
|
+
}}
|
|
469
|
+
>
|
|
470
|
+
{emails.join(', ')}
|
|
471
|
+
</div>
|
|
472
|
+
</div>
|
|
473
|
+
<span className="type-tag" style={{ flexShrink: 0 }}>
|
|
474
|
+
{count} accounts
|
|
475
|
+
</span>
|
|
476
|
+
</div>
|
|
477
|
+
)
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// ---------------------------------------------------------------------------
|
|
481
|
+
// GiftOrdersPanel — gift-order claim/delivery tracking
|
|
482
|
+
// ---------------------------------------------------------------------------
|
|
483
|
+
|
|
484
|
+
function GiftOrdersPanel({ result }: { result: ProviderResult<GiftOrdersPage> }) {
|
|
485
|
+
const page = result.data
|
|
486
|
+
const rows = page?.rows ?? []
|
|
487
|
+
|
|
488
|
+
return (
|
|
489
|
+
<div className="panel panel-pad" style={{ marginBottom: 'var(--gap)' }}>
|
|
490
|
+
<div className="card-title">Gift orders</div>
|
|
491
|
+
<div className="page-sub" style={{ margin: '4px 0 0' }}>
|
|
492
|
+
Gifted subscriptions, claim status, and recipient delivery.
|
|
493
|
+
</div>
|
|
494
|
+
<hr className="masthead-rule" style={{ margin: '12px 0 16px' }} />
|
|
495
|
+
|
|
496
|
+
{result.status === 'partial' && (
|
|
497
|
+
<div className="kicker" style={{ color: 'var(--amber)', marginBottom: 12 }}>
|
|
498
|
+
Partial data
|
|
499
|
+
</div>
|
|
500
|
+
)}
|
|
501
|
+
|
|
502
|
+
{result.status === 'empty' || rows.length === 0 ? (
|
|
503
|
+
<EmptyPanel
|
|
504
|
+
icon="sparkle"
|
|
505
|
+
message={
|
|
506
|
+
result.status === 'empty'
|
|
507
|
+
? 'Gift orders appear once the subscriptions provider is configured.'
|
|
508
|
+
: 'No gift orders found.'
|
|
509
|
+
}
|
|
510
|
+
/>
|
|
511
|
+
) : (
|
|
512
|
+
<>
|
|
513
|
+
{page && (
|
|
514
|
+
<div className="kicker" style={{ marginBottom: 14, color: 'var(--ink-muted)' }}>
|
|
515
|
+
{page.summary.redeemed} claimed · {page.summary.pendingClaim} pending · {page.total}{' '}
|
|
516
|
+
total
|
|
517
|
+
</div>
|
|
518
|
+
)}
|
|
519
|
+
<div style={{ overflowX: 'auto' }}>
|
|
520
|
+
<table className="tbl" style={{ minWidth: 640 }}>
|
|
521
|
+
<thead>
|
|
522
|
+
<tr>
|
|
523
|
+
<th>Recipient</th>
|
|
524
|
+
<th>Gifter</th>
|
|
525
|
+
<th>Plan</th>
|
|
526
|
+
<th>Status</th>
|
|
527
|
+
</tr>
|
|
528
|
+
</thead>
|
|
529
|
+
<tbody>
|
|
530
|
+
{rows.map((g) => (
|
|
531
|
+
<tr key={g.id}>
|
|
532
|
+
<td>
|
|
533
|
+
<div style={{ fontSize: 13, fontWeight: 600, color: 'var(--ink)' }}>
|
|
534
|
+
{g.recipientName || g.recipientEmail}
|
|
535
|
+
</div>
|
|
536
|
+
{g.recipientName && (
|
|
537
|
+
<div style={{ fontSize: 12, color: 'var(--ink-muted)' }}>
|
|
538
|
+
{g.recipientEmail}
|
|
539
|
+
</div>
|
|
540
|
+
)}
|
|
541
|
+
</td>
|
|
542
|
+
<td style={{ fontSize: 12.5, color: 'var(--ink-muted)' }}>{g.gifterEmail}</td>
|
|
543
|
+
<td>
|
|
544
|
+
<span className="type-tag">
|
|
545
|
+
{g.planType} · {g.durationDays}d
|
|
546
|
+
</span>
|
|
547
|
+
</td>
|
|
548
|
+
<td>
|
|
549
|
+
<GiftStatusBadge redeemedAt={g.redeemedAt} status={g.status} />
|
|
550
|
+
</td>
|
|
551
|
+
</tr>
|
|
552
|
+
))}
|
|
553
|
+
</tbody>
|
|
554
|
+
</table>
|
|
555
|
+
</div>
|
|
556
|
+
</>
|
|
557
|
+
)}
|
|
558
|
+
</div>
|
|
559
|
+
)
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function GiftStatusBadge({ redeemedAt, status }: { redeemedAt: number | null; status: string }) {
|
|
563
|
+
const claimed = redeemedAt !== null
|
|
564
|
+
return (
|
|
565
|
+
<span className={`pill ${claimed ? 'published' : 'review'}`}>
|
|
566
|
+
<span className="pdot" />
|
|
567
|
+
{claimed ? 'Claimed' : status === 'pending' ? 'Unclaimed' : status}
|
|
568
|
+
</span>
|
|
569
|
+
)
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// ---------------------------------------------------------------------------
|
|
573
|
+
// LemonSqueezySyncPanel — triggers the privileged import + shows the summary
|
|
574
|
+
// ---------------------------------------------------------------------------
|
|
575
|
+
|
|
576
|
+
interface SyncState {
|
|
577
|
+
running: boolean
|
|
578
|
+
summary: LsImportSummary | null
|
|
579
|
+
error: string | null
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
function LemonSqueezySyncPanel() {
|
|
583
|
+
const [s, setS] = useState<SyncState>({ running: false, summary: null, error: null })
|
|
584
|
+
|
|
585
|
+
const runSync = useCallback(async (dryRun: boolean) => {
|
|
586
|
+
setS({ running: true, summary: null, error: null })
|
|
587
|
+
try {
|
|
588
|
+
const res = await fetch(`/admin/api/subscriptions?type=import-ls&dryRun=${dryRun}`, {
|
|
589
|
+
method: 'POST',
|
|
590
|
+
})
|
|
591
|
+
if (!res.ok) {
|
|
592
|
+
setS({ running: false, summary: null, error: `${res.status} ${res.statusText}` })
|
|
593
|
+
return
|
|
594
|
+
}
|
|
595
|
+
const body = (await res.json()) as ProviderResult<LsImportSummary>
|
|
596
|
+
setS({ running: false, summary: body.data, error: null })
|
|
597
|
+
} catch (err) {
|
|
598
|
+
setS({ running: false, summary: null, error: String(err) })
|
|
599
|
+
}
|
|
600
|
+
}, [])
|
|
601
|
+
|
|
602
|
+
return (
|
|
603
|
+
<div className="panel panel-pad" style={{ marginBottom: 'var(--gap)' }}>
|
|
604
|
+
<div className="card-title">LemonSqueezy sync</div>
|
|
605
|
+
<div className="page-sub" style={{ margin: '4px 0 0' }}>
|
|
606
|
+
Pull subscriptions from LemonSqueezy and reconcile users + entitlements. Existing records
|
|
607
|
+
are updated, new ones created — nothing is deleted.
|
|
608
|
+
</div>
|
|
609
|
+
<hr className="masthead-rule" style={{ margin: '12px 0 16px' }} />
|
|
610
|
+
|
|
611
|
+
<div style={{ display: 'flex', gap: 8 }}>
|
|
612
|
+
<button
|
|
613
|
+
type="button"
|
|
614
|
+
className="btn"
|
|
615
|
+
onClick={() => void runSync(true)}
|
|
616
|
+
disabled={s.running}
|
|
617
|
+
>
|
|
618
|
+
Dry run
|
|
619
|
+
</button>
|
|
620
|
+
<button
|
|
621
|
+
type="button"
|
|
622
|
+
className="btn primary"
|
|
623
|
+
onClick={() => void runSync(false)}
|
|
624
|
+
disabled={s.running}
|
|
625
|
+
>
|
|
626
|
+
<Icon name="bolt" size={15} />
|
|
627
|
+
{s.running ? 'Syncing…' : 'Sync all'}
|
|
628
|
+
</button>
|
|
629
|
+
</div>
|
|
630
|
+
|
|
631
|
+
{s.error && <div style={{ marginTop: 14, fontSize: 13, color: 'var(--red)' }}>{s.error}</div>}
|
|
632
|
+
|
|
633
|
+
{s.summary && (
|
|
634
|
+
<div
|
|
635
|
+
style={{
|
|
636
|
+
marginTop: 16,
|
|
637
|
+
border: '1px solid var(--border)',
|
|
638
|
+
borderRadius: 'var(--radius)',
|
|
639
|
+
padding: '14px 16px',
|
|
640
|
+
background: 'var(--panel-2)',
|
|
641
|
+
}}
|
|
642
|
+
>
|
|
643
|
+
<div className="kicker" style={{ marginBottom: 8 }}>
|
|
644
|
+
{s.summary.dryRun ? 'Dry run preview' : 'Sync complete'}
|
|
645
|
+
</div>
|
|
646
|
+
{s.summary.synced === 0 &&
|
|
647
|
+
s.summary.usersCreated === 0 &&
|
|
648
|
+
s.summary.usersUpdated === 0 ? (
|
|
649
|
+
<div style={{ fontSize: 13, color: 'var(--ink-muted)' }}>
|
|
650
|
+
Nothing to sync — the subscriptions provider returned no records.
|
|
651
|
+
</div>
|
|
652
|
+
) : (
|
|
653
|
+
<div
|
|
654
|
+
style={{
|
|
655
|
+
display: 'flex',
|
|
656
|
+
flexWrap: 'wrap',
|
|
657
|
+
gap: '6px 18px',
|
|
658
|
+
fontSize: 13,
|
|
659
|
+
color: 'var(--ink-soft)',
|
|
660
|
+
}}
|
|
661
|
+
>
|
|
662
|
+
<span>
|
|
663
|
+
<strong className="tnum">{s.summary.synced}</strong> synced
|
|
664
|
+
</span>
|
|
665
|
+
<span>
|
|
666
|
+
<strong className="tnum">{s.summary.usersCreated}</strong> users created
|
|
667
|
+
</span>
|
|
668
|
+
<span>
|
|
669
|
+
<strong className="tnum">{s.summary.usersUpdated}</strong> users updated
|
|
670
|
+
</span>
|
|
671
|
+
<span>
|
|
672
|
+
<strong className="tnum">{s.summary.subscriptionsCreated}</strong> subs created
|
|
673
|
+
</span>
|
|
674
|
+
<span>
|
|
675
|
+
<strong className="tnum">{s.summary.subscriptionsUpdated}</strong> subs updated
|
|
676
|
+
</span>
|
|
677
|
+
</div>
|
|
678
|
+
)}
|
|
679
|
+
</div>
|
|
680
|
+
)}
|
|
681
|
+
</div>
|
|
682
|
+
)
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// ---------------------------------------------------------------------------
|
|
686
|
+
// KPI cards — 4 cards: Active / MRR / Churn / LTV
|
|
687
|
+
// ---------------------------------------------------------------------------
|
|
688
|
+
|
|
689
|
+
const KPI_DEFS: Array<{
|
|
690
|
+
key: string
|
|
691
|
+
label: string
|
|
692
|
+
fmt: 'num' | 'pct' | 'usd'
|
|
693
|
+
}> = [
|
|
694
|
+
{ key: 'active', label: 'Active subscribers', fmt: 'num' },
|
|
695
|
+
{ key: 'mrr', label: 'Monthly recurring', fmt: 'usd' },
|
|
696
|
+
{ key: 'churn', label: 'Churn', fmt: 'pct' },
|
|
697
|
+
{ key: 'ltv', label: 'Avg. LTV', fmt: 'usd' },
|
|
698
|
+
]
|
|
699
|
+
|
|
700
|
+
function KpiCards({ kpis }: { kpis: ProviderResult<Record<string, number | null>> }) {
|
|
701
|
+
const kpiStatus = selectKpiState(kpis)
|
|
702
|
+
|
|
703
|
+
if (kpiStatus === 'empty') {
|
|
704
|
+
return (
|
|
705
|
+
<div style={{ marginBottom: 'var(--gap)' }}>
|
|
706
|
+
<EmptyPanel
|
|
707
|
+
icon="users"
|
|
708
|
+
message="No subscription data yet — configure the subscriptions provider."
|
|
709
|
+
/>
|
|
710
|
+
</div>
|
|
711
|
+
)
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
return (
|
|
715
|
+
<div className="grid-stats" style={{ marginBottom: 'var(--gap)' }}>
|
|
716
|
+
{KPI_DEFS.map((def) => {
|
|
717
|
+
const raw = kpis.data?.[def.key] ?? null
|
|
718
|
+
const formatted = formatKpi(raw, def.fmt)
|
|
719
|
+
const isPending =
|
|
720
|
+
formatted !== null && typeof formatted === 'object' && (formatted as KpiPending).pending
|
|
721
|
+
|
|
722
|
+
const displayValue = isPending ? null : (formatted as string)
|
|
723
|
+
const displayNote = isPending ? '— pending backfill' : null
|
|
724
|
+
|
|
725
|
+
return (
|
|
726
|
+
<KpiCard
|
|
727
|
+
key={def.key}
|
|
728
|
+
label={def.label}
|
|
729
|
+
status={isPending ? 'partial' : kpiStatus}
|
|
730
|
+
value={displayValue}
|
|
731
|
+
note={displayNote}
|
|
732
|
+
/>
|
|
733
|
+
)
|
|
734
|
+
})}
|
|
735
|
+
</div>
|
|
736
|
+
)
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function KpiCard({
|
|
740
|
+
label,
|
|
741
|
+
status,
|
|
742
|
+
value,
|
|
743
|
+
note,
|
|
744
|
+
}: {
|
|
745
|
+
label: string
|
|
746
|
+
status: 'live' | 'partial' | 'empty'
|
|
747
|
+
value: string | null
|
|
748
|
+
note: string | null
|
|
749
|
+
}) {
|
|
750
|
+
return (
|
|
751
|
+
<div className="panel panel-pad">
|
|
752
|
+
<div className="kicker">{label}</div>
|
|
753
|
+
<div
|
|
754
|
+
className="serif tnum"
|
|
755
|
+
style={{
|
|
756
|
+
fontSize: 30,
|
|
757
|
+
fontWeight: 600,
|
|
758
|
+
color: 'var(--ink)',
|
|
759
|
+
margin: '6px 0 4px',
|
|
760
|
+
whiteSpace: 'nowrap',
|
|
761
|
+
}}
|
|
762
|
+
>
|
|
763
|
+
{status === 'empty' || value === null ? (
|
|
764
|
+
<span style={{ fontSize: 18, color: 'var(--ink-muted)' }}>—</span>
|
|
765
|
+
) : (
|
|
766
|
+
value
|
|
767
|
+
)}
|
|
768
|
+
</div>
|
|
769
|
+
{note && <span style={{ fontSize: 12, color: 'var(--ink-faint)' }}>{note}</span>}
|
|
770
|
+
{status === 'partial' && !note && (
|
|
771
|
+
<span className="kicker" style={{ color: 'var(--amber)' }}>
|
|
772
|
+
Partial
|
|
773
|
+
</span>
|
|
774
|
+
)}
|
|
775
|
+
</div>
|
|
776
|
+
)
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// ---------------------------------------------------------------------------
|
|
780
|
+
// PlanMixChart — stacked bar + legend rows (aside panel)
|
|
781
|
+
// ---------------------------------------------------------------------------
|
|
782
|
+
|
|
783
|
+
const PLAN_DOT_COLORS = ['#1f6b4a', '#0c4a6e', '#5b4bc4', '#8c6d14', '#475569']
|
|
784
|
+
|
|
785
|
+
function PlanMixChart({
|
|
786
|
+
planMix,
|
|
787
|
+
resolvePlanName,
|
|
788
|
+
}: {
|
|
789
|
+
planMix: ProviderResult<PlanMixBucket[]>
|
|
790
|
+
resolvePlanName: (id: string) => string
|
|
791
|
+
}) {
|
|
792
|
+
if (!planMix.data || planMix.data.length === 0) return null
|
|
793
|
+
|
|
794
|
+
const bars = planMixToBars(planMix.data, resolvePlanName)
|
|
795
|
+
const colorFor = (i: number) => PLAN_DOT_COLORS[i % PLAN_DOT_COLORS.length]
|
|
796
|
+
|
|
797
|
+
return (
|
|
798
|
+
<div className="panel panel-pad">
|
|
799
|
+
<div className="card-title" style={{ marginBottom: 16 }}>
|
|
800
|
+
Plan mix
|
|
801
|
+
</div>
|
|
802
|
+
{planMix.status === 'partial' && (
|
|
803
|
+
<div className="kicker" style={{ color: 'var(--amber)', marginBottom: 12 }}>
|
|
804
|
+
Partial data
|
|
805
|
+
</div>
|
|
806
|
+
)}
|
|
807
|
+
<div
|
|
808
|
+
style={{
|
|
809
|
+
display: 'flex',
|
|
810
|
+
height: 10,
|
|
811
|
+
borderRadius: 6,
|
|
812
|
+
overflow: 'hidden',
|
|
813
|
+
marginBottom: 18,
|
|
814
|
+
}}
|
|
815
|
+
>
|
|
816
|
+
{bars.map((bar, i) => (
|
|
817
|
+
<span key={bar.name} style={{ width: `${bar.pct}%`, background: colorFor(i) }} />
|
|
818
|
+
))}
|
|
819
|
+
</div>
|
|
820
|
+
{bars.map((bar, i) => (
|
|
821
|
+
<div
|
|
822
|
+
key={bar.name}
|
|
823
|
+
style={{
|
|
824
|
+
display: 'flex',
|
|
825
|
+
alignItems: 'center',
|
|
826
|
+
gap: 10,
|
|
827
|
+
padding: '9px 0',
|
|
828
|
+
borderBottom: '1px solid var(--border-soft)',
|
|
829
|
+
}}
|
|
830
|
+
>
|
|
831
|
+
<span style={{ width: 9, height: 9, borderRadius: 2, background: colorFor(i) }} />
|
|
832
|
+
<span style={{ flex: 1, fontSize: 13, fontWeight: 600, color: 'var(--ink)' }}>
|
|
833
|
+
{bar.name}
|
|
834
|
+
</span>
|
|
835
|
+
<span className="tnum" style={{ fontSize: 12.5, color: 'var(--ink-muted)' }}>
|
|
836
|
+
{bar.count.toLocaleString('en-US')}
|
|
837
|
+
</span>
|
|
838
|
+
<span
|
|
839
|
+
className="tnum"
|
|
840
|
+
style={{
|
|
841
|
+
fontSize: 12.5,
|
|
842
|
+
fontWeight: 600,
|
|
843
|
+
color: 'var(--ink-soft)',
|
|
844
|
+
width: 54,
|
|
845
|
+
textAlign: 'right',
|
|
846
|
+
}}
|
|
847
|
+
>
|
|
848
|
+
{bar.pct.toFixed(1)}%
|
|
849
|
+
</span>
|
|
850
|
+
</div>
|
|
851
|
+
))}
|
|
852
|
+
</div>
|
|
853
|
+
)
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
// ---------------------------------------------------------------------------
|
|
857
|
+
// MembersTable
|
|
858
|
+
// ---------------------------------------------------------------------------
|
|
859
|
+
|
|
860
|
+
function MembersTable({
|
|
861
|
+
result,
|
|
862
|
+
resolvePlanName,
|
|
863
|
+
page,
|
|
864
|
+
onPageChange,
|
|
865
|
+
}: {
|
|
866
|
+
result: ProviderResult<SubscriptionMember[]>
|
|
867
|
+
resolvePlanName: (id: string) => string
|
|
868
|
+
page: number
|
|
869
|
+
onPageChange: (p: number) => void
|
|
870
|
+
}) {
|
|
871
|
+
if (result.status === 'empty') {
|
|
872
|
+
return (
|
|
873
|
+
<div style={{ padding: 18 }}>
|
|
874
|
+
<EmptyPanel
|
|
875
|
+
icon="users"
|
|
876
|
+
message="No members yet — configure the subscriptions provider to list members."
|
|
877
|
+
/>
|
|
878
|
+
</div>
|
|
879
|
+
)
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
if (!result.data || result.data.length === 0) {
|
|
883
|
+
return (
|
|
884
|
+
<div style={{ padding: 18 }}>
|
|
885
|
+
<EmptyPanel icon="users" message="No members match this filter." />
|
|
886
|
+
</div>
|
|
887
|
+
)
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
const members = result.data
|
|
891
|
+
|
|
892
|
+
return (
|
|
893
|
+
<div>
|
|
894
|
+
{result.status === 'partial' && (
|
|
895
|
+
<div
|
|
896
|
+
className="kicker"
|
|
897
|
+
style={{
|
|
898
|
+
padding: '8px 18px',
|
|
899
|
+
color: 'var(--amber)',
|
|
900
|
+
background: 'color-mix(in srgb, var(--amber) 7%, transparent)',
|
|
901
|
+
borderBottom: '1px solid var(--border)',
|
|
902
|
+
}}
|
|
903
|
+
>
|
|
904
|
+
Partial data — some member fields may be incomplete
|
|
905
|
+
</div>
|
|
906
|
+
)}
|
|
907
|
+
<div style={{ overflowX: 'auto' }}>
|
|
908
|
+
<table className="tbl" style={{ minWidth: 640 }}>
|
|
909
|
+
<thead>
|
|
910
|
+
<tr>
|
|
911
|
+
<th style={{ paddingLeft: 18 }}>Member</th>
|
|
912
|
+
<th>Plan</th>
|
|
913
|
+
<th>Status</th>
|
|
914
|
+
<th>LTV</th>
|
|
915
|
+
</tr>
|
|
916
|
+
</thead>
|
|
917
|
+
<tbody>
|
|
918
|
+
{members.map((member) => {
|
|
919
|
+
const planName = member.planVariantId ? resolvePlanName(member.planVariantId) : '—'
|
|
920
|
+
const email = member.email ?? '(no email)'
|
|
921
|
+
const initials = initialsFor(email)
|
|
922
|
+
// LTV: not on SubscriptionMember interface — individual member LTV is per-KPI
|
|
923
|
+
// (only available via getKpis aggregate); render "—" honestly.
|
|
924
|
+
return (
|
|
925
|
+
<tr key={member.id}>
|
|
926
|
+
<td style={{ paddingLeft: 18 }}>
|
|
927
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 11 }}>
|
|
928
|
+
<div
|
|
929
|
+
className="avatar"
|
|
930
|
+
style={{
|
|
931
|
+
background: avatarColor(email),
|
|
932
|
+
width: 30,
|
|
933
|
+
height: 30,
|
|
934
|
+
fontSize: 11,
|
|
935
|
+
}}
|
|
936
|
+
>
|
|
937
|
+
{initials}
|
|
938
|
+
</div>
|
|
939
|
+
<div style={{ minWidth: 0 }}>
|
|
940
|
+
<div
|
|
941
|
+
style={{
|
|
942
|
+
fontSize: 13,
|
|
943
|
+
fontWeight: 600,
|
|
944
|
+
color: 'var(--ink)',
|
|
945
|
+
overflow: 'hidden',
|
|
946
|
+
textOverflow: 'ellipsis',
|
|
947
|
+
whiteSpace: 'nowrap',
|
|
948
|
+
maxWidth: 280,
|
|
949
|
+
}}
|
|
950
|
+
>
|
|
951
|
+
{email}
|
|
952
|
+
</div>
|
|
953
|
+
</div>
|
|
954
|
+
</div>
|
|
955
|
+
</td>
|
|
956
|
+
<td>
|
|
957
|
+
<span className="type-tag">{planName}</span>
|
|
958
|
+
</td>
|
|
959
|
+
<td>
|
|
960
|
+
<StatusBadge status={member.status} />
|
|
961
|
+
</td>
|
|
962
|
+
<td className="tnum" style={{ color: 'var(--ink-faint)' }}>
|
|
963
|
+
—
|
|
964
|
+
</td>
|
|
965
|
+
</tr>
|
|
966
|
+
)
|
|
967
|
+
})}
|
|
968
|
+
</tbody>
|
|
969
|
+
</table>
|
|
970
|
+
</div>
|
|
971
|
+
|
|
972
|
+
{/* Pagination */}
|
|
973
|
+
<div
|
|
974
|
+
style={{
|
|
975
|
+
display: 'flex',
|
|
976
|
+
justifyContent: 'flex-end',
|
|
977
|
+
alignItems: 'center',
|
|
978
|
+
gap: 10,
|
|
979
|
+
padding: '12px 18px',
|
|
980
|
+
}}
|
|
981
|
+
>
|
|
982
|
+
<button
|
|
983
|
+
type="button"
|
|
984
|
+
className="btn sm"
|
|
985
|
+
disabled={page <= 1}
|
|
986
|
+
onClick={() => onPageChange(page - 1)}
|
|
987
|
+
style={{ opacity: page <= 1 ? 0.4 : 1 }}
|
|
988
|
+
>
|
|
989
|
+
<Icon name="chevLeft" size={14} />
|
|
990
|
+
Prev
|
|
991
|
+
</button>
|
|
992
|
+
<span className="kicker">Page {page}</span>
|
|
993
|
+
<button
|
|
994
|
+
type="button"
|
|
995
|
+
className="btn sm"
|
|
996
|
+
disabled={members.length === 0}
|
|
997
|
+
onClick={() => onPageChange(page + 1)}
|
|
998
|
+
style={{ opacity: members.length === 0 ? 0.4 : 1 }}
|
|
999
|
+
>
|
|
1000
|
+
Next
|
|
1001
|
+
<Icon name="chevRight" size={14} />
|
|
1002
|
+
</button>
|
|
1003
|
+
</div>
|
|
1004
|
+
</div>
|
|
1005
|
+
)
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// ---------------------------------------------------------------------------
|
|
1009
|
+
// StatusBadge — broadsheet .pill with leading .pdot
|
|
1010
|
+
// ---------------------------------------------------------------------------
|
|
1011
|
+
|
|
1012
|
+
// Map provider status → broadsheet pill variant + display label.
|
|
1013
|
+
const STATUS_PILL: Record<string, { cls: string; label: string }> = {
|
|
1014
|
+
active: { cls: 'published', label: 'Active' },
|
|
1015
|
+
past_due: { cls: 'review', label: 'Past due' },
|
|
1016
|
+
canceled: { cls: 'draft', label: 'Canceled' },
|
|
1017
|
+
trialing: { cls: 'scheduled', label: 'Trialing' },
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
function StatusBadge({ status }: { status: string | null }) {
|
|
1021
|
+
const variant = status ? STATUS_PILL[status] : undefined
|
|
1022
|
+
const cls = variant?.cls ?? 'draft'
|
|
1023
|
+
const label = variant?.label ?? status ?? '—'
|
|
1024
|
+
return (
|
|
1025
|
+
<span className={`pill ${cls}`}>
|
|
1026
|
+
<span className="pdot" />
|
|
1027
|
+
{label}
|
|
1028
|
+
</span>
|
|
1029
|
+
)
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
// ---------------------------------------------------------------------------
|
|
1033
|
+
// FilterSegment — broadsheet .seg segmented control
|
|
1034
|
+
// ---------------------------------------------------------------------------
|
|
1035
|
+
|
|
1036
|
+
function FilterSegment({
|
|
1037
|
+
value,
|
|
1038
|
+
onChange,
|
|
1039
|
+
}: {
|
|
1040
|
+
value: FilterOption
|
|
1041
|
+
onChange: (f: FilterOption) => void
|
|
1042
|
+
}) {
|
|
1043
|
+
return (
|
|
1044
|
+
<div className="seg">
|
|
1045
|
+
{FILTER_LABELS.map((opt) => (
|
|
1046
|
+
<button
|
|
1047
|
+
key={opt.value}
|
|
1048
|
+
type="button"
|
|
1049
|
+
className={value === opt.value ? 'on' : ''}
|
|
1050
|
+
onClick={() => onChange(opt.value)}
|
|
1051
|
+
>
|
|
1052
|
+
{opt.label}
|
|
1053
|
+
</button>
|
|
1054
|
+
))}
|
|
1055
|
+
</div>
|
|
1056
|
+
)
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
// ---------------------------------------------------------------------------
|
|
1060
|
+
// GiftModal — .scrim + .panel.panel-pad dialog
|
|
1061
|
+
// ---------------------------------------------------------------------------
|
|
1062
|
+
|
|
1063
|
+
function GiftModal({
|
|
1064
|
+
gift,
|
|
1065
|
+
onChange,
|
|
1066
|
+
onSubmit,
|
|
1067
|
+
onClose,
|
|
1068
|
+
}: {
|
|
1069
|
+
gift: GiftState
|
|
1070
|
+
onChange: (field: 'email' | 'planVariantId', value: string) => void
|
|
1071
|
+
onSubmit: () => void
|
|
1072
|
+
onClose: () => void
|
|
1073
|
+
}) {
|
|
1074
|
+
const ok = gift.result?.startsWith('Gift created')
|
|
1075
|
+
return (
|
|
1076
|
+
<div
|
|
1077
|
+
className="scrim"
|
|
1078
|
+
style={{ placeItems: 'center', zIndex: 100 }}
|
|
1079
|
+
role="dialog"
|
|
1080
|
+
aria-modal="true"
|
|
1081
|
+
aria-label="Gift subscription"
|
|
1082
|
+
onClick={onClose}
|
|
1083
|
+
onKeyUp={(e) => {
|
|
1084
|
+
if (e.key === 'Escape') onClose()
|
|
1085
|
+
}}
|
|
1086
|
+
>
|
|
1087
|
+
{/* biome-ignore lint/a11y/useKeyWithClickEvents: onClick only stops the backdrop close from bubbling; it is not a user-facing action and needs no keyboard handler. The dialog scrim above owns click-away + Escape. */}
|
|
1088
|
+
<div
|
|
1089
|
+
className="panel panel-pad fade-only"
|
|
1090
|
+
role="document"
|
|
1091
|
+
style={{ width: 420, boxShadow: 'var(--shadow-lg)' }}
|
|
1092
|
+
onClick={(e) => e.stopPropagation()}
|
|
1093
|
+
>
|
|
1094
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 4 }}>
|
|
1095
|
+
<Icon name="sparkle" size={18} style={{ color: 'var(--accent)' }} />
|
|
1096
|
+
<div className="card-title">Gift subscription</div>
|
|
1097
|
+
<button
|
|
1098
|
+
type="button"
|
|
1099
|
+
className="icon-btn"
|
|
1100
|
+
style={{ marginLeft: 'auto' }}
|
|
1101
|
+
onClick={onClose}
|
|
1102
|
+
>
|
|
1103
|
+
<Icon name="x" size={16} />
|
|
1104
|
+
</button>
|
|
1105
|
+
</div>
|
|
1106
|
+
<hr className="masthead-rule" style={{ margin: '6px 0 18px' }} />
|
|
1107
|
+
|
|
1108
|
+
<label style={{ display: 'block', marginBottom: 16 }}>
|
|
1109
|
+
<span className="field-label">Recipient email</span>
|
|
1110
|
+
<input
|
|
1111
|
+
className="input"
|
|
1112
|
+
type="email"
|
|
1113
|
+
value={gift.email}
|
|
1114
|
+
onChange={(e) => onChange('email', e.target.value)}
|
|
1115
|
+
placeholder="subscriber@example.com"
|
|
1116
|
+
/>
|
|
1117
|
+
</label>
|
|
1118
|
+
|
|
1119
|
+
<label style={{ display: 'block', marginBottom: 16 }}>
|
|
1120
|
+
<span className="field-label">Plan variant ID</span>
|
|
1121
|
+
<input
|
|
1122
|
+
className="input"
|
|
1123
|
+
type="text"
|
|
1124
|
+
value={gift.planVariantId}
|
|
1125
|
+
onChange={(e) => onChange('planVariantId', e.target.value)}
|
|
1126
|
+
placeholder="e.g. variant_123"
|
|
1127
|
+
/>
|
|
1128
|
+
</label>
|
|
1129
|
+
|
|
1130
|
+
{gift.result && (
|
|
1131
|
+
<div
|
|
1132
|
+
style={{
|
|
1133
|
+
fontSize: 12,
|
|
1134
|
+
color: ok ? 'var(--green)' : 'var(--red)',
|
|
1135
|
+
padding: '6px 10px',
|
|
1136
|
+
background: ok
|
|
1137
|
+
? 'color-mix(in srgb, var(--green) 8%, transparent)'
|
|
1138
|
+
: 'color-mix(in srgb, var(--red) 8%, transparent)',
|
|
1139
|
+
borderRadius: 'var(--radius-sm)',
|
|
1140
|
+
marginBottom: 16,
|
|
1141
|
+
}}
|
|
1142
|
+
>
|
|
1143
|
+
{gift.result}
|
|
1144
|
+
</div>
|
|
1145
|
+
)}
|
|
1146
|
+
|
|
1147
|
+
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: 10 }}>
|
|
1148
|
+
<button type="button" className="btn" onClick={onClose}>
|
|
1149
|
+
Cancel
|
|
1150
|
+
</button>
|
|
1151
|
+
<button
|
|
1152
|
+
type="button"
|
|
1153
|
+
className="btn primary"
|
|
1154
|
+
onClick={onSubmit}
|
|
1155
|
+
disabled={gift.submitting || !gift.email || !gift.planVariantId}
|
|
1156
|
+
style={{
|
|
1157
|
+
opacity: gift.submitting || !gift.email || !gift.planVariantId ? 0.5 : 1,
|
|
1158
|
+
}}
|
|
1159
|
+
>
|
|
1160
|
+
{gift.submitting ? 'Gifting…' : 'Send gift'}
|
|
1161
|
+
</button>
|
|
1162
|
+
</div>
|
|
1163
|
+
</div>
|
|
1164
|
+
</div>
|
|
1165
|
+
)
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
// ---------------------------------------------------------------------------
|
|
1169
|
+
// Shared micro-components
|
|
1170
|
+
// ---------------------------------------------------------------------------
|
|
1171
|
+
|
|
1172
|
+
function EmptyPanel({
|
|
1173
|
+
icon,
|
|
1174
|
+
message,
|
|
1175
|
+
}: {
|
|
1176
|
+
icon: Parameters<typeof Icon>[0]['name']
|
|
1177
|
+
message: string
|
|
1178
|
+
}) {
|
|
1179
|
+
return (
|
|
1180
|
+
<div
|
|
1181
|
+
style={{
|
|
1182
|
+
border: '1px solid var(--border)',
|
|
1183
|
+
borderRadius: 'var(--radius)',
|
|
1184
|
+
padding: '28px 20px',
|
|
1185
|
+
textAlign: 'center',
|
|
1186
|
+
fontSize: 13,
|
|
1187
|
+
color: 'var(--ink-muted)',
|
|
1188
|
+
background: 'var(--panel-2)',
|
|
1189
|
+
display: 'flex',
|
|
1190
|
+
flexDirection: 'column',
|
|
1191
|
+
alignItems: 'center',
|
|
1192
|
+
gap: 8,
|
|
1193
|
+
}}
|
|
1194
|
+
>
|
|
1195
|
+
<Icon name={icon} size={22} style={{ color: 'var(--border)', opacity: 0.7 }} />
|
|
1196
|
+
<span>{message}</span>
|
|
1197
|
+
</div>
|
|
1198
|
+
)
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
function PartialBanner({ message }: { message: string }) {
|
|
1202
|
+
return (
|
|
1203
|
+
<div
|
|
1204
|
+
style={{
|
|
1205
|
+
padding: '8px 14px',
|
|
1206
|
+
marginBottom: 'var(--gap)',
|
|
1207
|
+
background: 'color-mix(in srgb, var(--amber) 8%, transparent)',
|
|
1208
|
+
border: '1px solid color-mix(in srgb, var(--amber) 20%, transparent)',
|
|
1209
|
+
borderRadius: 'var(--radius-sm)',
|
|
1210
|
+
fontSize: 12,
|
|
1211
|
+
color: 'var(--amber)',
|
|
1212
|
+
display: 'flex',
|
|
1213
|
+
alignItems: 'center',
|
|
1214
|
+
gap: 7,
|
|
1215
|
+
}}
|
|
1216
|
+
>
|
|
1217
|
+
<Icon name="bolt" size={13} />
|
|
1218
|
+
{message}
|
|
1219
|
+
</div>
|
|
1220
|
+
)
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
// ---------------------------------------------------------------------------
|
|
1224
|
+
// Avatar helpers — derive initials + a stable tint from the member email
|
|
1225
|
+
// ---------------------------------------------------------------------------
|
|
1226
|
+
|
|
1227
|
+
function initialsFor(email: string): string {
|
|
1228
|
+
const local = email.split('@')[0] ?? email
|
|
1229
|
+
const parts = local.split(/[.\-_+]/).filter(Boolean)
|
|
1230
|
+
if (parts.length >= 2) return (parts[0]![0]! + parts[1]![0]!).toUpperCase()
|
|
1231
|
+
return local.slice(0, 2).toUpperCase()
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
const AVATAR_COLORS = ['#0c4a6e', '#1f6b4a', '#5b4bc4', '#8c6d14', '#075985', '#475569']
|
|
1235
|
+
|
|
1236
|
+
function avatarColor(seed: string): string {
|
|
1237
|
+
let h = 0
|
|
1238
|
+
for (let i = 0; i < seed.length; i++) h = (h * 31 + seed.charCodeAt(i)) >>> 0
|
|
1239
|
+
return AVATAR_COLORS[h % AVATAR_COLORS.length]!
|
|
1240
|
+
}
|