@wopr-network/platform-ui-core 1.27.7 → 1.27.9
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/next.config.ts +1 -2
- package/package.json +17 -17
- package/src/__tests__/account-switcher.test.tsx +21 -20
- package/src/__tests__/activity-page.test.tsx +2 -6
- package/src/__tests__/add-payment-method-dialog.test.tsx +9 -32
- package/src/__tests__/admin-api.test.ts +1 -6
- package/src/__tests__/admin-gpu-api.test.ts +1 -3
- package/src/__tests__/admin-marketplace-api.test.ts +1 -4
- package/src/__tests__/admin-middleware.test.ts +76 -83
- package/src/__tests__/affiliate-dashboard.test.tsx +3 -3
- package/src/__tests__/api-401-redirect.test.ts +46 -9
- package/src/__tests__/api-client.test.ts +3 -5
- package/src/__tests__/api-config.test.ts +22 -42
- package/src/__tests__/api-fleet-resources.test.ts +1 -2
- package/src/__tests__/api-fleet-trpc.test.ts +2 -8
- package/src/__tests__/api-null-guards.test.ts +3 -1
- package/src/__tests__/audit-log-table-pagination.test.tsx +2 -6
- package/src/__tests__/auth-password-reset.test.tsx +7 -21
- package/src/__tests__/auth-redirect.test.tsx +8 -2
- package/src/__tests__/auth.test.tsx +25 -23
- package/src/__tests__/auto-topup-card.test.tsx +4 -12
- package/src/__tests__/backups-tab.test.tsx +3 -4
- package/src/__tests__/billing-layout-nav-hidden.test.tsx +5 -37
- package/src/__tests__/billing-payment-org-invoices.test.tsx +2 -18
- package/src/__tests__/billing.test.tsx +8 -39
- package/src/__tests__/bot-settings/resources-tab.test.tsx +1 -3
- package/src/__tests__/bot-settings/storage-tab.test.tsx +1 -3
- package/src/__tests__/bot-settings/vps-upgrade-card.test.tsx +1 -3
- package/src/__tests__/bot-settings-restart.test.tsx +1 -3
- package/src/__tests__/bot-settings.test.tsx +2 -6
- package/src/__tests__/brand.test.ts +6 -26
- package/src/__tests__/buy-credits-panel.test.tsx +1 -3
- package/src/__tests__/buy-crypto-credits-panel.test.tsx +101 -119
- package/src/__tests__/capability-conflicts.test.ts +2 -8
- package/src/__tests__/capability-resolver.test.tsx +2 -12
- package/src/__tests__/channel-wizard.test.tsx +4 -17
- package/src/__tests__/chat/chat-panel.test.tsx +1 -4
- package/src/__tests__/chat-store.test.ts +5 -15
- package/src/__tests__/command-center.test.tsx +10 -12
- package/src/__tests__/compliance-retention-edit.test.tsx +3 -6
- package/src/__tests__/confirmation-tracker.test.tsx +3 -18
- package/src/__tests__/coupon-input.test.tsx +1 -3
- package/src/__tests__/create-instance.test.tsx +1 -3
- package/src/__tests__/credit-balance.test.tsx +4 -12
- package/src/__tests__/credits.test.tsx +32 -85
- package/src/__tests__/email-verification-banner.test.tsx +2 -6
- package/src/__tests__/error-boundaries.test.tsx +0 -1
- package/src/__tests__/fetch-pricing.test.ts +2 -1
- package/src/__tests__/field-oauth.test.tsx +2 -6
- package/src/__tests__/fixtures/mock-manifests-data.js +1 -3
- package/src/__tests__/fixtures/mock-manifests.ts +2 -4
- package/src/__tests__/fleet-health-timestamp.test.tsx +1 -8
- package/src/__tests__/fleet-health-update.test.tsx +1 -8
- package/src/__tests__/gpu-dashboard.test.tsx +2 -6
- package/src/__tests__/instance-detail.test.tsx +3 -9
- package/src/__tests__/instance-list.test.tsx +1 -5
- package/src/__tests__/layout-snapshots.test.tsx +64 -11
- package/src/__tests__/marketplace-admin.test.tsx +2 -6
- package/src/__tests__/marketplace.test.tsx +11 -35
- package/src/__tests__/merge-api-rates.test.ts +1 -6
- package/src/__tests__/middleware.test.ts +32 -219
- package/src/__tests__/next-config-headers.test.ts +1 -3
- package/src/__tests__/notifications.test.tsx +4 -11
- package/src/__tests__/oauth-buttons.test.tsx +36 -59
- package/src/__tests__/oauth-error-mapping.test.tsx +2 -6
- package/src/__tests__/observability.test.tsx +23 -36
- package/src/__tests__/onboarding-page.test.tsx +4 -6
- package/src/__tests__/org-billing-api.test.tsx +1 -6
- package/src/__tests__/plugin-install-flow.test.tsx +28 -58
- package/src/__tests__/plugin-registry.test.tsx +3 -11
- package/src/__tests__/plugin-tool-sync.test.ts +1 -3
- package/src/__tests__/plugins-catalog-error.test.tsx +2 -6
- package/src/__tests__/plugins-toggle-race.test.tsx +3 -5
- package/src/__tests__/portfolio-chart.test.tsx +2 -6
- package/src/__tests__/promotion-form.test.tsx +2 -6
- package/src/__tests__/promotions-list.test.tsx +1 -3
- package/src/__tests__/provider-key-api.test.ts +2 -1
- package/src/__tests__/resend-verification-button.test.tsx +8 -24
- package/src/__tests__/secrets-audit-pagination.test.tsx +1 -3
- package/src/__tests__/settings.test.tsx +11 -21
- package/src/__tests__/setup-checklist.test.tsx +3 -9
- package/src/__tests__/setup.ts +25 -6
- package/src/__tests__/snapshot-api.test.ts +2 -1
- package/src/__tests__/step-superpowers.test.tsx +1 -3
- package/src/__tests__/tenant-context.test.tsx +1 -6
- package/src/__tests__/tenant-keys-api.test.ts +3 -4
- package/src/__tests__/tenant-table-pagination.test.tsx +2 -6
- package/src/__tests__/terminal-log-cleanup.test.tsx +0 -1
- package/src/__tests__/transaction-history.test.tsx +190 -238
- package/src/__tests__/trpc-types.test.ts +2 -6
- package/src/__tests__/use-chat.test.ts +1 -3
- package/src/__tests__/use-plugin-setup-chat-stale-closure.test.ts +1 -4
- package/src/__tests__/use-sidecar-bridge.test.tsx +105 -0
- package/src/__tests__/use-webmcp.test.ts +1 -3
- package/src/__tests__/validate-elevenlabs-key.test.ts +2 -1
- package/src/__tests__/verify-page.test.tsx +4 -13
- package/src/__tests__/verify-redirect.test.tsx +2 -6
- package/src/app/(auth)/error.tsx +1 -7
- package/src/app/(auth)/forgot-password/page.tsx +4 -18
- package/src/app/(auth)/login/page.tsx +5 -22
- package/src/app/(auth)/reset-password/page.tsx +2 -12
- package/src/app/(auth)/signup/page.tsx +10 -44
- package/src/app/(auth)/verify/page.tsx +47 -0
- package/src/app/(dashboard)/billing/credits/page.tsx +14 -67
- package/src/app/(dashboard)/billing/error.tsx +2 -10
- package/src/app/(dashboard)/billing/layout.tsx +12 -62
- package/src/app/(dashboard)/billing/payment/page.tsx +17 -68
- package/src/app/(dashboard)/billing/plans/page.tsx +3 -9
- package/src/app/(dashboard)/billing/usage/hosted/page.tsx +8 -25
- package/src/app/(dashboard)/billing/usage/page.tsx +63 -103
- package/src/app/(dashboard)/changesets/[id]/changeset-detail-client.tsx +9 -27
- package/src/app/(dashboard)/changesets/[id]/error.tsx +2 -6
- package/src/app/(dashboard)/changesets/error.tsx +1 -7
- package/src/app/(dashboard)/chat/page.tsx +2 -6
- package/src/app/(dashboard)/dashboard/network/page.tsx +5 -19
- package/src/app/(dashboard)/error.tsx +1 -7
- package/src/app/(dashboard)/layout.tsx +15 -36
- package/src/app/(dashboard)/marketplace/[plugin]/page.tsx +14 -51
- package/src/app/(dashboard)/marketplace/error.tsx +1 -7
- package/src/app/(dashboard)/marketplace/page.tsx +6 -27
- package/src/app/(dashboard)/not-found.tsx +2 -5
- package/src/app/(dashboard)/onboarding/page.tsx +5 -22
- package/src/app/(dashboard)/settings/account/page.tsx +1 -6
- package/src/app/(dashboard)/settings/activity/page.tsx +8 -34
- package/src/app/(dashboard)/settings/api-keys/page.tsx +15 -60
- package/src/app/(dashboard)/settings/brain/page.tsx +9 -31
- package/src/app/(dashboard)/settings/error.tsx +2 -10
- package/src/app/(dashboard)/settings/notifications/page.tsx +2 -6
- package/src/app/(dashboard)/settings/org/page.tsx +13 -56
- package/src/app/(dashboard)/settings/page.tsx +1 -0
- package/src/app/(dashboard)/settings/profile/page.tsx +126 -73
- package/src/app/(dashboard)/settings/providers/page.tsx +21 -78
- package/src/app/(dashboard)/settings/secrets/page.tsx +13 -58
- package/src/app/(dashboard)/settings/security/page.tsx +31 -111
- package/src/app/admin/email-templates/email-templates-client.tsx +15 -58
- package/src/app/admin/error.tsx +1 -7
- package/src/app/admin/fleet-updates/error.tsx +1 -7
- package/src/app/admin/fleet-updates/fleet-updates-client.tsx +10 -50
- package/src/app/admin/layout.tsx +4 -0
- package/src/app/admin/payment-methods/page.tsx +9 -38
- package/src/app/admin/products/error.tsx +2 -7
- package/src/app/admin/products/page.tsx +1 -4
- package/src/app/admin/promotions/[id]/page.tsx +9 -38
- package/src/app/admin/promotions/page.tsx +9 -36
- package/src/app/admin/rate-overrides/page.tsx +9 -45
- package/src/app/auth/callback/[provider]/page.tsx +1 -8
- package/src/app/auth/verify/page.tsx +9 -36
- package/src/app/channels/error.tsx +2 -10
- package/src/app/channels/layout.tsx +9 -0
- package/src/app/channels/page.tsx +8 -20
- package/src/app/channels/setup/[plugin]/page.tsx +3 -5
- package/src/app/error.tsx +1 -7
- package/src/app/fleet/error.tsx +1 -7
- package/src/app/fleet/layout.tsx +5 -0
- package/src/app/fleet/settings/page.tsx +1 -3
- package/src/app/global-error.tsx +2 -10
- package/src/app/globals.css +1 -4
- package/src/app/instances/[id]/instance-detail-client.tsx +51 -125
- package/src/app/instances/error.tsx +2 -10
- package/src/app/instances/instance-list-client.tsx +20 -69
- package/src/app/instances/layout.tsx +9 -0
- package/src/app/instances/new/create-instance-client.tsx +10 -31
- package/src/app/layout.tsx +2 -10
- package/src/app/not-found.tsx +1 -3
- package/src/app/page.tsx +1 -2
- package/src/app/plugins/error.tsx +2 -10
- package/src/app/plugins/layout.tsx +5 -0
- package/src/app/plugins/page.tsx +16 -48
- package/src/app/pricing/error.tsx +1 -7
- package/src/app/privacy/page.tsx +93 -150
- package/src/app/status/error.tsx +1 -7
- package/src/app/terms/page.tsx +89 -144
- package/src/components/account-switcher.tsx +25 -52
- package/src/components/admin/accounting-dashboard.tsx +1 -3
- package/src/components/admin/admin-guard.tsx +1 -3
- package/src/components/admin/admin-nav.tsx +1 -3
- package/src/components/admin/affiliate-dashboard.tsx +25 -94
- package/src/components/admin/audit-log-table.tsx +13 -49
- package/src/components/admin/billing-health-dashboard.tsx +7 -25
- package/src/components/admin/bulk-actions-bar.test.tsx +1 -7
- package/src/components/admin/bulk-actions-bar.tsx +1 -3
- package/src/components/admin/bulk-export-dialog.test.tsx +1 -7
- package/src/components/admin/bulk-export-dialog.tsx +6 -32
- package/src/components/admin/bulk-grant-dialog.test.tsx +2 -6
- package/src/components/admin/bulk-grant-dialog.tsx +4 -15
- package/src/components/admin/bulk-preview-dialog.tsx +3 -12
- package/src/components/admin/bulk-reactivate-dialog.tsx +1 -7
- package/src/components/admin/bulk-select-all-banner.tsx +1 -6
- package/src/components/admin/bulk-suspend-dialog.tsx +5 -12
- package/src/components/admin/bulk-undo-toast.tsx +1 -2
- package/src/components/admin/compliance-dashboard.tsx +31 -101
- package/src/components/admin/gpu-dashboard.tsx +21 -70
- package/src/components/admin/grant-credits-dialog.tsx +4 -17
- package/src/components/admin/incident-dashboard.tsx +10 -25
- package/src/components/admin/inference-dashboard.tsx +14 -54
- package/src/components/admin/marketplace-admin.tsx +18 -60
- package/src/components/admin/migrations-dashboard.tsx +9 -42
- package/src/components/admin/onboarding-dashboard.tsx +14 -64
- package/src/components/admin/pool-config-dashboard.tsx +4 -10
- package/src/components/admin/products/fleet-form.tsx +2 -11
- package/src/components/admin/products/nav-editor.tsx +3 -10
- package/src/components/admin/promotions/promotion-form.tsx +9 -42
- package/src/components/admin/roles-dashboard.tsx +7 -34
- package/src/components/admin/suspend-dialog.tsx +4 -11
- package/src/components/admin/tenant-notes-panel.tsx +1 -3
- package/src/components/admin/tenant-row-actions.tsx +4 -20
- package/src/components/admin/tenant-table.tsx +12 -49
- package/src/components/auth/auth-redirect.tsx +11 -3
- package/src/components/auth/email-verification-result-banner.tsx +1 -3
- package/src/components/auth/resend-verification-button.tsx +2 -10
- package/src/components/auth/wopr-wordmark.tsx +1 -3
- package/src/components/billing/add-payment-method-dialog.tsx +1 -2
- package/src/components/billing/affiliate-dashboard.tsx +4 -16
- package/src/components/billing/amount-selector.tsx +1 -3
- package/src/components/billing/auto-topup-card.tsx +2 -11
- package/src/components/billing/buy-credits-panel.tsx +14 -17
- package/src/components/billing/byok-callout.tsx +6 -8
- package/src/components/billing/confirmation-tracker.tsx +4 -14
- package/src/components/billing/credit-balance-badge.tsx +22 -0
- package/src/components/billing/credit-balance.tsx +3 -9
- package/src/components/billing/crypto-checkout.tsx +5 -24
- package/src/components/billing/degraded-state-banner.tsx +1 -3
- package/src/components/billing/deposit-view.tsx +301 -41
- package/src/components/billing/dividend-banner.tsx +1 -3
- package/src/components/billing/dividend-eligibility.tsx +3 -12
- package/src/components/billing/dividend-pool-stats.tsx +6 -20
- package/src/components/billing/first-dividend-dialog.tsx +2 -2
- package/src/components/billing/org-billing-page.tsx +8 -31
- package/src/components/billing/payment-method-picker.tsx +2 -10
- package/src/components/billing/suspension-banner.tsx +2 -7
- package/src/components/billing/transaction-history.tsx +10 -58
- package/src/components/billing/unified-checkout.tsx +547 -0
- package/src/components/bot-settings/backups-tab.tsx +9 -33
- package/src/components/bot-settings/bot-settings-client.tsx +32 -134
- package/src/components/bot-settings/resources-tab.tsx +2 -9
- package/src/components/bot-settings/storage-tab.tsx +19 -48
- package/src/components/bot-settings/vps-info-panel.tsx +3 -11
- package/src/components/bot-settings/vps-upgrade-card.tsx +3 -4
- package/src/components/brand-hydrator.tsx +13 -0
- package/src/components/channel-wizard/field-interactive.tsx +1 -3
- package/src/components/channel-wizard/field-qr.tsx +10 -39
- package/src/components/channel-wizard/step-renderer.tsx +5 -28
- package/src/components/channel-wizard/wizard.tsx +6 -31
- package/src/components/chat/chat-message.tsx +1 -4
- package/src/components/chat/chat-panel.tsx +4 -18
- package/src/components/chat/chat-widget.tsx +3 -14
- package/src/components/dashboard/command-center.tsx +15 -61
- package/src/components/fleet/update-settings-card.tsx +7 -23
- package/src/components/instance-update-banner.tsx +130 -0
- package/src/components/instances/friends-tab.test.tsx +2 -9
- package/src/components/instances/friends-tab.tsx +18 -74
- package/src/components/instances/update-available-badge.tsx +2 -11
- package/src/components/landing/hero.tsx +3 -9
- package/src/components/landing/landing-page.tsx +1 -3
- package/src/components/landing/portfolio-chart.tsx +4 -9
- package/src/components/landing/story-sections.tsx +1 -3
- package/src/components/landing/terminal-sequence.tsx +4 -17
- package/src/components/marketplace/empty-state.tsx +2 -6
- package/src/components/marketplace/first-visit-hero.tsx +1 -3
- package/src/components/marketplace/install-wizard.tsx +20 -77
- package/src/components/marketplace/marketplace-tabs.tsx +1 -4
- package/src/components/marketplace/plugin-card.tsx +2 -9
- package/src/components/marketplace/superpower-content.tsx +1 -3
- package/src/components/marketplace/terminal-search.tsx +2 -8
- package/src/components/oauth-buttons.tsx +29 -14
- package/src/components/observability/fleet-health.tsx +5 -18
- package/src/components/observability/health-overview.tsx +7 -20
- package/src/components/observability/logs-viewer.tsx +8 -32
- package/src/components/observability/metrics-dashboard.tsx +2 -15
- package/src/components/onboarding/fallback-setup.tsx +6 -25
- package/src/components/onboarding/setup-checklist.tsx +18 -51
- package/src/components/onboarding/step-superpowers.tsx +1 -4
- package/src/components/plugin-setup/setup-chat-panel.tsx +6 -22
- package/src/components/pricing/dividend-calculator.tsx +6 -12
- package/src/components/pricing/dividend-stats.tsx +5 -17
- package/src/components/pricing/pricing-page.tsx +17 -36
- package/src/components/settings/create-org-wizard.tsx +2 -5
- package/src/components/sidebar.tsx +7 -42
- package/src/components/sidecar-frame.tsx +78 -0
- package/src/components/status/status-page.tsx +6 -28
- package/src/components/ui/alert-dialog.tsx +8 -25
- package/src/components/ui/badge.tsx +2 -8
- package/src/components/ui/banner.tsx +1 -6
- package/src/components/ui/card.tsx +5 -24
- package/src/components/ui/checkbox.tsx +1 -5
- package/src/components/ui/collapsible.tsx +3 -8
- package/src/components/ui/dialog.tsx +4 -10
- package/src/components/ui/dropdown-menu.tsx +9 -18
- package/src/components/ui/form.tsx +2 -16
- package/src/components/ui/popover.tsx +3 -23
- package/src/components/ui/progress.tsx +1 -5
- package/src/components/ui/radio-group.tsx +3 -15
- package/src/components/ui/select.tsx +4 -17
- package/src/components/ui/sheet.tsx +5 -19
- package/src/components/ui/skeleton.tsx +1 -7
- package/src/components/ui/table.tsx +5 -22
- package/src/components/ui/tabs.tsx +3 -13
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/components/unified-sidebar.tsx +493 -0
- package/src/hooks/__tests__/use-fleet-sse.test.ts +1 -4
- package/src/hooks/__tests__/use-save-queue.test.ts +2 -8
- package/src/hooks/use-credit-balance.ts +27 -0
- package/src/hooks/use-my-org-role.ts +1 -3
- package/src/hooks/use-plugin-registry.ts +8 -14
- package/src/hooks/use-plugin-setup-chat.ts +2 -5
- package/src/hooks/use-sidecar-bridge.tsx +148 -0
- package/src/hooks/use-webmcp.ts +1 -4
- package/src/lib/__tests__/admin-api.test.ts +1 -3
- package/src/lib/__tests__/api-bot-crud.test.ts +8 -18
- package/src/lib/__tests__/api-fetch.test.ts +4 -16
- package/src/lib/__tests__/org-billing-api.test.ts +1 -3
- package/src/lib/__tests__/pricing-data.test.ts +0 -8
- package/src/lib/__tests__/settings-api.test.ts +1 -3
- package/src/lib/admin-affiliate-api.ts +2 -7
- package/src/lib/admin-api.ts +6 -26
- package/src/lib/admin-incident-api.ts +11 -19
- package/src/lib/admin-marketplace-api.ts +1 -5
- package/src/lib/api-config.test.ts +5 -50
- package/src/lib/api.ts +143 -122
- package/src/lib/auth-client.ts +1 -2
- package/src/lib/bot-settings-data.ts +11 -36
- package/src/lib/brand-config.ts +56 -115
- package/src/lib/brand.ts +2 -15
- package/src/lib/chat/use-chat.ts +2 -7
- package/src/lib/cost-comparison-data.test.ts +1 -3
- package/src/lib/cost-comparison-data.ts +1 -4
- package/src/lib/errors.ts +1 -4
- package/src/lib/fetch-utils.test.ts +26 -9
- package/src/lib/fetch-utils.ts +40 -11
- package/src/lib/logger.ts +2 -0
- package/src/lib/marketplace-data.ts +3 -11
- package/src/lib/oauth-errors.ts +2 -4
- package/src/lib/onboarding-data.ts +3 -11
- package/src/lib/org-api.ts +2 -10
- package/src/lib/org-billing-api.ts +5 -19
- package/src/lib/plugin/tool-definitions.ts +1 -2
- package/src/lib/require-auth.ts +57 -0
- package/src/lib/settings-api.ts +1 -4
- package/src/lib/sidecar-routes.ts +43 -0
- package/src/lib/trpc-server.ts +49 -0
- package/src/lib/trpc-types.ts +4 -6
- package/src/lib/trpc.tsx +12 -4
- package/src/lib/validate-redirect-url.ts +1 -4
- package/src/lib/webmcp/marketplace-onboarding-tools.ts +6 -16
- package/src/lib/webmcp/register.ts +1 -4
- package/src/lib/webmcp/tools.ts +2 -9
- package/src/proxy.ts +35 -212
- package/src/types/missing-deps.d.ts +2 -8
- package/tsconfig.json +1 -8
- package/biome.json +0 -52
- package/src/__tests__/__snapshots__/layout-snapshots.test.tsx.snap +0 -741
- package/src/__tests__/billing-byok-callout.test.tsx +0 -76
- package/src/lib/__tests__/__snapshots__/pricing-data.test.ts.snap +0 -112
|
@@ -46,9 +46,7 @@ export function DividendBanner({ todayAmountCents, stats }: DividendBannerProps)
|
|
|
46
46
|
</span>{" "}
|
|
47
47
|
today.
|
|
48
48
|
</p>
|
|
49
|
-
<p className="text-sm text-muted-foreground">
|
|
50
|
-
Community dividend from the daily pool
|
|
51
|
-
</p>
|
|
49
|
+
<p className="text-sm text-muted-foreground">Community dividend from the daily pool</p>
|
|
52
50
|
</div>
|
|
53
51
|
</div>
|
|
54
52
|
</motion.div>
|
|
@@ -55,17 +55,10 @@ export function DividendEligibility({ windowExpiresAt, eligible }: DividendEligi
|
|
|
55
55
|
<Card>
|
|
56
56
|
<CardContent className="p-4 space-y-3">
|
|
57
57
|
<div className="flex items-center gap-2">
|
|
58
|
-
<ClockIcon
|
|
59
|
-
className={cn(
|
|
60
|
-
"size-4 shrink-0",
|
|
61
|
-
isExpiringSoon ? "text-terminal-dim" : "text-terminal",
|
|
62
|
-
)}
|
|
63
|
-
/>
|
|
58
|
+
<ClockIcon className={cn("size-4 shrink-0", isExpiringSoon ? "text-terminal-dim" : "text-terminal")} />
|
|
64
59
|
<p className="text-sm font-medium">
|
|
65
60
|
You're in the pool for{" "}
|
|
66
|
-
<span
|
|
67
|
-
className={cn("font-bold", isExpiringSoon ? "text-terminal-dim" : "text-terminal")}
|
|
68
|
-
>
|
|
61
|
+
<span className={cn("font-bold", isExpiringSoon ? "text-terminal-dim" : "text-terminal")}>
|
|
69
62
|
{daysRemaining}
|
|
70
63
|
</span>{" "}
|
|
71
64
|
more day{daysRemaining === 1 ? "" : "s"}
|
|
@@ -76,9 +69,7 @@ export function DividendEligibility({ windowExpiresAt, eligible }: DividendEligi
|
|
|
76
69
|
className="h-2"
|
|
77
70
|
aria-label={`${daysRemaining} days remaining in dividend pool`}
|
|
78
71
|
/>
|
|
79
|
-
{isExpiringSoon &&
|
|
80
|
-
<p className="text-xs text-terminal-dim">Buy credits to reset your 7-day window</p>
|
|
81
|
-
)}
|
|
72
|
+
{isExpiringSoon && <p className="text-xs text-terminal-dim">Buy credits to reset your 7-day window</p>}
|
|
82
73
|
</CardContent>
|
|
83
74
|
</Card>
|
|
84
75
|
</motion.div>
|
|
@@ -11,11 +11,7 @@ interface DividendPoolStatsProps {
|
|
|
11
11
|
perUserCents: number;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export function DividendPoolStats({
|
|
15
|
-
poolCents,
|
|
16
|
-
activeUsers,
|
|
17
|
-
perUserCents,
|
|
18
|
-
}: DividendPoolStatsProps) {
|
|
14
|
+
export function DividendPoolStats({ poolCents, activeUsers, perUserCents }: DividendPoolStatsProps) {
|
|
19
15
|
if (poolCents === 0 && activeUsers === 0) {
|
|
20
16
|
return (
|
|
21
17
|
<motion.div
|
|
@@ -28,9 +24,7 @@ export function DividendPoolStats({
|
|
|
28
24
|
<CardTitle className="text-base">Community Pool</CardTitle>
|
|
29
25
|
</CardHeader>
|
|
30
26
|
<CardContent>
|
|
31
|
-
<p className="text-sm text-muted-foreground">
|
|
32
|
-
Pool building... check back after the first purchase day.
|
|
33
|
-
</p>
|
|
27
|
+
<p className="text-sm text-muted-foreground">Pool building... check back after the first purchase day.</p>
|
|
34
28
|
</CardContent>
|
|
35
29
|
</Card>
|
|
36
30
|
</motion.div>
|
|
@@ -53,27 +47,19 @@ export function DividendPoolStats({
|
|
|
53
47
|
<CardContent>
|
|
54
48
|
<div className="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:gap-6 text-sm">
|
|
55
49
|
<div>
|
|
56
|
-
<span className="block text-xs uppercase tracking-wider text-primary/60">
|
|
57
|
-
Today's pool
|
|
58
|
-
</span>
|
|
50
|
+
<span className="block text-xs uppercase tracking-wider text-primary/60">Today's pool</span>
|
|
59
51
|
<span className="font-bold text-lg font-mono text-terminal">{poolDollars}</span>
|
|
60
52
|
</div>
|
|
61
53
|
<div>
|
|
62
|
-
<span className="block text-xs uppercase tracking-wider text-primary/60">
|
|
63
|
-
Active users
|
|
64
|
-
</span>
|
|
54
|
+
<span className="block text-xs uppercase tracking-wider text-primary/60">Active users</span>
|
|
65
55
|
<span className="font-bold text-lg font-mono flex items-center gap-1.5">
|
|
66
56
|
<UsersIcon className="size-4 text-muted-foreground" />
|
|
67
57
|
{activeUsers}
|
|
68
58
|
</span>
|
|
69
59
|
</div>
|
|
70
60
|
<div>
|
|
71
|
-
<span className="block text-xs uppercase tracking-wider text-primary/60">
|
|
72
|
-
|
|
73
|
-
</span>
|
|
74
|
-
<span className="font-bold text-lg font-mono text-terminal">
|
|
75
|
-
{perUserDollars}/day
|
|
76
|
-
</span>
|
|
61
|
+
<span className="block text-xs uppercase tracking-wider text-primary/60">Your share</span>
|
|
62
|
+
<span className="font-bold text-lg font-mono text-terminal">{perUserDollars}/day</span>
|
|
77
63
|
</div>
|
|
78
64
|
</div>
|
|
79
65
|
<p className="mt-3 text-xs text-muted-foreground">
|
|
@@ -93,8 +93,8 @@ export function FirstDividendDialog({ todayAmountCents }: FirstDividendDialogPro
|
|
|
93
93
|
<span className="font-mono tabular-nums">{formatCreditStandard(animatedAmount)}</span>
|
|
94
94
|
</DialogTitle>
|
|
95
95
|
<DialogDescription>
|
|
96
|
-
This is your community dividend — a share of the platform's daily margin,
|
|
97
|
-
|
|
96
|
+
This is your community dividend — a share of the platform's daily margin, distributed equally
|
|
97
|
+
to all active users. Stay active to keep earning.
|
|
98
98
|
</DialogDescription>
|
|
99
99
|
</DialogHeader>
|
|
100
100
|
<DialogFooter className="justify-center sm:justify-center">
|
|
@@ -23,14 +23,7 @@ import { Button } from "@/components/ui/button";
|
|
|
23
23
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
24
24
|
import { CreditDetailed } from "@/components/ui/credit-detailed";
|
|
25
25
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
26
|
-
import {
|
|
27
|
-
Table,
|
|
28
|
-
TableBody,
|
|
29
|
-
TableCell,
|
|
30
|
-
TableHead,
|
|
31
|
-
TableHeader,
|
|
32
|
-
TableRow,
|
|
33
|
-
} from "@/components/ui/table";
|
|
26
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
|
|
34
27
|
import { toUserMessage } from "@/lib/errors";
|
|
35
28
|
import { formatCreditStandard } from "@/lib/format-credit";
|
|
36
29
|
import type { OrgCreditBalance, OrgMemberUsageRow } from "@/lib/org-billing-api";
|
|
@@ -108,9 +101,7 @@ export function OrgBillingPage({ orgId, orgName, isAdmin }: OrgBillingPageProps)
|
|
|
108
101
|
const handleSetDefault = useCallback(
|
|
109
102
|
async (paymentMethodId: string) => {
|
|
110
103
|
setSettingDefault(paymentMethodId);
|
|
111
|
-
setPaymentMethods((pms) =>
|
|
112
|
-
pms.map((pm) => ({ ...pm, isDefault: pm.id === paymentMethodId })),
|
|
113
|
-
);
|
|
104
|
+
setPaymentMethods((pms) => pms.map((pm) => ({ ...pm, isDefault: pm.id === paymentMethodId })));
|
|
114
105
|
try {
|
|
115
106
|
await setOrgDefaultPaymentMethod(orgId, paymentMethodId);
|
|
116
107
|
} catch {
|
|
@@ -204,9 +195,7 @@ export function OrgBillingPage({ orgId, orgName, isAdmin }: OrgBillingPageProps)
|
|
|
204
195
|
animate={{ opacity: 1, y: 0 }}
|
|
205
196
|
transition={{ duration: 0.4, delay: sectionDelays.balance, ease: "easeOut" }}
|
|
206
197
|
>
|
|
207
|
-
<CreditBalance
|
|
208
|
-
data={{ balance: balance.balance, dailyBurn: balance.dailyBurn, runway: balance.runway }}
|
|
209
|
-
/>
|
|
198
|
+
<CreditBalance data={{ balance: balance.balance, dailyBurn: balance.dailyBurn, runway: balance.runway }} />
|
|
210
199
|
</motion.div>
|
|
211
200
|
|
|
212
201
|
{/* Buy Credits (admin only) */}
|
|
@@ -237,9 +226,7 @@ export function OrgBillingPage({ orgId, orgName, isAdmin }: OrgBillingPageProps)
|
|
|
237
226
|
</CardHeader>
|
|
238
227
|
<CardContent>
|
|
239
228
|
{members.length === 0 ? (
|
|
240
|
-
<p className="text-sm text-muted-foreground">
|
|
241
|
-
No usage data for this billing period.
|
|
242
|
-
</p>
|
|
229
|
+
<p className="text-sm text-muted-foreground">No usage data for this billing period.</p>
|
|
243
230
|
) : (
|
|
244
231
|
<div className="overflow-x-auto">
|
|
245
232
|
<Table>
|
|
@@ -310,17 +297,11 @@ export function OrgBillingPage({ orgId, orgName, isAdmin }: OrgBillingPageProps)
|
|
|
310
297
|
) : (
|
|
311
298
|
<div className="space-y-3">
|
|
312
299
|
{paymentMethods.map((pm) => (
|
|
313
|
-
<div
|
|
314
|
-
key={pm.id}
|
|
315
|
-
className="flex items-center justify-between rounded-md border p-3"
|
|
316
|
-
>
|
|
300
|
+
<div key={pm.id} className="flex items-center justify-between rounded-md border p-3">
|
|
317
301
|
<p className="text-sm font-medium font-mono">
|
|
318
302
|
**** {pm.last4}
|
|
319
303
|
{pm.isDefault && (
|
|
320
|
-
<Badge
|
|
321
|
-
variant="outline"
|
|
322
|
-
className="ml-2 border-primary/25 text-primary text-xs"
|
|
323
|
-
>
|
|
304
|
+
<Badge variant="outline" className="ml-2 border-primary/25 text-primary text-xs">
|
|
324
305
|
Default
|
|
325
306
|
</Badge>
|
|
326
307
|
)}
|
|
@@ -365,16 +346,12 @@ export function OrgBillingPage({ orgId, orgName, isAdmin }: OrgBillingPageProps)
|
|
|
365
346
|
</>
|
|
366
347
|
)}
|
|
367
348
|
</CardContent>
|
|
368
|
-
<AlertDialog
|
|
369
|
-
open={!!deletingPmId}
|
|
370
|
-
onOpenChange={(open) => !open && setDeletingPmId(null)}
|
|
371
|
-
>
|
|
349
|
+
<AlertDialog open={!!deletingPmId} onOpenChange={(open) => !open && setDeletingPmId(null)}>
|
|
372
350
|
<AlertDialogContent>
|
|
373
351
|
<AlertDialogHeader>
|
|
374
352
|
<AlertDialogTitle>Remove Payment Method</AlertDialogTitle>
|
|
375
353
|
<AlertDialogDescription>
|
|
376
|
-
This payment method will be permanently removed from your organization. This
|
|
377
|
-
action cannot be undone.
|
|
354
|
+
This payment method will be permanently removed from your organization. This action cannot be undone.
|
|
378
355
|
</AlertDialogDescription>
|
|
379
356
|
</AlertDialogHeader>
|
|
380
357
|
<AlertDialogFooter>
|
|
@@ -56,19 +56,11 @@ export function PaymentMethodPicker({ methods, onSelect, onBack }: PaymentMethod
|
|
|
56
56
|
return (
|
|
57
57
|
<div className="space-y-3">
|
|
58
58
|
{onBack && (
|
|
59
|
-
<button
|
|
60
|
-
type="button"
|
|
61
|
-
onClick={onBack}
|
|
62
|
-
className="text-sm text-muted-foreground hover:text-foreground"
|
|
63
|
-
>
|
|
59
|
+
<button type="button" onClick={onBack} className="text-sm text-muted-foreground hover:text-foreground">
|
|
64
60
|
← Back
|
|
65
61
|
</button>
|
|
66
62
|
)}
|
|
67
|
-
<Input
|
|
68
|
-
placeholder="Search token or network..."
|
|
69
|
-
value={search}
|
|
70
|
-
onChange={(e) => setSearch(e.target.value)}
|
|
71
|
-
/>
|
|
63
|
+
<Input placeholder="Search token or network..." value={search} onChange={(e) => setSearch(e.target.value)} />
|
|
72
64
|
<div className="flex flex-wrap gap-2">
|
|
73
65
|
{FILTERS.map((f) => (
|
|
74
66
|
<button
|
|
@@ -16,10 +16,7 @@ export function SuspensionBanner() {
|
|
|
16
16
|
|
|
17
17
|
const load = useCallback(async () => {
|
|
18
18
|
try {
|
|
19
|
-
const [data, summaryData] = await Promise.all([
|
|
20
|
-
getCreditBalance(),
|
|
21
|
-
getBillingUsageSummary().catch(() => null),
|
|
22
|
-
]);
|
|
19
|
+
const [data, summaryData] = await Promise.all([getCreditBalance(), getBillingUsageSummary().catch(() => null)]);
|
|
23
20
|
setBalance(data.balance);
|
|
24
21
|
setRunway(data.runway);
|
|
25
22
|
setSummary(summaryData);
|
|
@@ -40,9 +37,7 @@ export function SuspensionBanner() {
|
|
|
40
37
|
<LowBalanceBanner balance={balance} runway={runway} global />
|
|
41
38
|
{summary && summary.amountDue > 0 && (
|
|
42
39
|
<Banner variant="warning" role="alert">
|
|
43
|
-
<span className="flex-1">
|
|
44
|
-
{formatCreditStandard(summary.amountDue)} due this billing period
|
|
45
|
-
</span>
|
|
40
|
+
<span className="flex-1">{formatCreditStandard(summary.amountDue)} due this billing period</span>
|
|
46
41
|
<Link href="/billing/usage" className="font-semibold underline underline-offset-4">
|
|
47
42
|
View usage
|
|
48
43
|
</Link>
|
|
@@ -11,20 +11,22 @@ import {
|
|
|
11
11
|
SparklesIcon,
|
|
12
12
|
WrenchIcon,
|
|
13
13
|
} from "lucide-react";
|
|
14
|
-
import {
|
|
14
|
+
import { useState } from "react";
|
|
15
15
|
import { Badge } from "@/components/ui/badge";
|
|
16
16
|
import { Button } from "@/components/ui/button";
|
|
17
17
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
|
18
18
|
import { Skeleton } from "@/components/ui/skeleton";
|
|
19
19
|
import type { CreditTransaction, CreditTransactionType } from "@/lib/api";
|
|
20
|
-
import {
|
|
20
|
+
import { mapTransactionRows } from "@/lib/api";
|
|
21
21
|
import { formatCreditStandard } from "@/lib/format-credit";
|
|
22
|
+
import { trpc } from "@/lib/trpc";
|
|
22
23
|
import { cn } from "@/lib/utils";
|
|
23
24
|
|
|
24
25
|
const TYPE_CONFIG: Record<CreditTransactionType, { icon: typeof ArrowUpIcon; label: string }> = {
|
|
25
26
|
purchase: { icon: ArrowUpIcon, label: "Purchase" },
|
|
26
27
|
signup_credit: { icon: GiftIcon, label: "Signup credit" },
|
|
27
28
|
bot_runtime: { icon: WrenchIcon, label: "Bot runtime" },
|
|
29
|
+
adapter_usage: { icon: ArrowDownIcon, label: "LLM Inference" },
|
|
28
30
|
refund: { icon: RotateCcwIcon, label: "Refund" },
|
|
29
31
|
bonus: { icon: SparklesIcon, label: "Bonus" },
|
|
30
32
|
adjustment: { icon: SlidersHorizontalIcon, label: "Adjustment" },
|
|
@@ -41,44 +43,12 @@ const staggerItem = {
|
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
export function TransactionHistory() {
|
|
44
|
-
const [transactions, setTransactions] = useState<CreditTransaction[]>([]);
|
|
45
|
-
const [cursor, setCursor] = useState<string | null>(null);
|
|
46
|
-
const [loading, setLoading] = useState(true);
|
|
47
|
-
const [loadingMore, setLoadingMore] = useState(false);
|
|
48
|
-
const [error, setError] = useState<string | null>(null);
|
|
49
46
|
const [hoveredId, setHoveredId] = useState<string | null>(null);
|
|
50
47
|
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const res = await getCreditHistory();
|
|
56
|
-
setTransactions(res.transactions);
|
|
57
|
-
setCursor(res.nextCursor);
|
|
58
|
-
} catch {
|
|
59
|
-
setError("Failed to load transactions.");
|
|
60
|
-
} finally {
|
|
61
|
-
setLoading(false);
|
|
62
|
-
}
|
|
63
|
-
}, []);
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
loadInitial();
|
|
67
|
-
}, [loadInitial]);
|
|
68
|
-
|
|
69
|
-
async function loadMore() {
|
|
70
|
-
if (!cursor) return;
|
|
71
|
-
setLoadingMore(true);
|
|
72
|
-
try {
|
|
73
|
-
const res = await getCreditHistory(cursor);
|
|
74
|
-
setTransactions((prev) => [...prev, ...res.transactions]);
|
|
75
|
-
setCursor(res.nextCursor);
|
|
76
|
-
} catch {
|
|
77
|
-
setError("Failed to load more transactions.");
|
|
78
|
-
} finally {
|
|
79
|
-
setLoadingMore(false);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
48
|
+
const { data: raw, isLoading: loading, error: queryError, refetch } = trpc.billing.creditsDailySummary.useQuery({});
|
|
49
|
+
const rows = Array.isArray((raw as { rows?: unknown[] })?.rows) ? (raw as { rows: unknown[] }).rows : [];
|
|
50
|
+
const transactions: CreditTransaction[] = mapTransactionRows(rows as Parameters<typeof mapTransactionRows>[0]);
|
|
51
|
+
const error = queryError ? "Failed to load transactions." : null;
|
|
82
52
|
|
|
83
53
|
if (loading) {
|
|
84
54
|
return (
|
|
@@ -115,13 +85,7 @@ export function TransactionHistory() {
|
|
|
115
85
|
<CardContent>
|
|
116
86
|
<div className="flex h-20 flex-col items-center justify-center gap-2 text-muted-foreground">
|
|
117
87
|
<p>{error}</p>
|
|
118
|
-
<Button
|
|
119
|
-
type="button"
|
|
120
|
-
variant="link"
|
|
121
|
-
size="sm"
|
|
122
|
-
onClick={loadInitial}
|
|
123
|
-
className="h-auto p-0"
|
|
124
|
-
>
|
|
88
|
+
<Button type="button" variant="link" size="sm" onClick={() => refetch()} className="h-auto p-0">
|
|
125
89
|
Retry
|
|
126
90
|
</Button>
|
|
127
91
|
</div>
|
|
@@ -185,12 +149,7 @@ export function TransactionHistory() {
|
|
|
185
149
|
</div>
|
|
186
150
|
</div>
|
|
187
151
|
</div>
|
|
188
|
-
<span
|
|
189
|
-
className={cn(
|
|
190
|
-
"font-mono font-medium",
|
|
191
|
-
isPositive ? "text-emerald-500" : "text-red-500",
|
|
192
|
-
)}
|
|
193
|
-
>
|
|
152
|
+
<span className={cn("font-mono font-medium", isPositive ? "text-emerald-500" : "text-red-500")}>
|
|
194
153
|
{isPositive ? "+" : "-"}
|
|
195
154
|
{formatCreditStandard(Math.abs(tx.amount))}
|
|
196
155
|
</span>
|
|
@@ -224,13 +183,6 @@ export function TransactionHistory() {
|
|
|
224
183
|
})}
|
|
225
184
|
</div>
|
|
226
185
|
{error && <p className="text-sm text-destructive">{error}</p>}
|
|
227
|
-
{cursor && (
|
|
228
|
-
<div className="pt-2">
|
|
229
|
-
<Button variant="outline" size="sm" onClick={loadMore} disabled={loadingMore}>
|
|
230
|
-
{loadingMore ? "Loading more..." : "Load more"}
|
|
231
|
-
</Button>
|
|
232
|
-
</div>
|
|
233
|
-
)}
|
|
234
186
|
</>
|
|
235
187
|
)}
|
|
236
188
|
</CardContent>
|