@wopr-network/platform-ui-core 1.27.6 → 1.27.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wopr-network/platform-ui-core",
3
- "version": "1.27.6",
3
+ "version": "1.27.8",
4
4
  "description": "Brand-agnostic AI agent platform UI — deploy as any brand via env vars",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,6 +20,7 @@ import { Skeleton } from "@/components/ui/skeleton";
20
20
  import type { CreditBalance as CreditBalanceData, DividendWalletStats } from "@/lib/api";
21
21
  import { getDividendStats } from "@/lib/api";
22
22
  import { useSession } from "@/lib/auth-client";
23
+ import { getBrandConfig } from "@/lib/brand-config";
23
24
  import { getOrganization } from "@/lib/org-api";
24
25
  import { trpc } from "@/lib/trpc";
25
26
 
@@ -56,6 +57,7 @@ function CreditsContent() {
56
57
  }, [session?.user?.email, session?.user?.id]);
57
58
 
58
59
  const [showCryptoPending, setShowCryptoPending] = useState(cryptoPending);
60
+ const showDividends = getBrandConfig().dividendsEnabled;
59
61
  const [dividendStats, setDividendStats] = useState<DividendWalletStats | null>(null);
60
62
  const [todayDividendCents, setTodayDividendCents] = useState(0);
61
63
 
@@ -91,6 +93,7 @@ function CreditsContent() {
91
93
  const error = balanceError ? "Failed to load credit balance." : null;
92
94
 
93
95
  useEffect(() => {
96
+ if (!showDividends) return;
94
97
  getDividendStats()
95
98
  .then((statsData) => {
96
99
  if (statsData) {
@@ -101,7 +104,7 @@ function CreditsContent() {
101
104
  }
102
105
  })
103
106
  .catch(() => null);
104
- }, []);
107
+ }, [showDividends]);
105
108
 
106
109
  if (!orgChecked) {
107
110
  return (
@@ -161,14 +164,12 @@ function CreditsContent() {
161
164
  <div className="max-w-3xl space-y-6">
162
165
  <div>
163
166
  <h1 className="text-2xl font-bold tracking-tight">Credits</h1>
164
- <p className="text-sm text-muted-foreground">
165
- Stay active to keep claiming your daily dividend
166
- </p>
167
+ <p className="text-sm text-muted-foreground">Purchase and manage your credits</p>
167
168
  </div>
168
169
 
169
170
  <LowBalanceBanner balance={balance.balance} runway={balance.runway} />
170
171
 
171
- {dividendStats && (
172
+ {showDividends && dividendStats && (
172
173
  <DividendBanner todayAmountCents={todayDividendCents} stats={dividendStats} />
173
174
  )}
174
175
 
@@ -183,14 +184,14 @@ function CreditsContent() {
183
184
 
184
185
  <CreditBalance data={balance} />
185
186
 
186
- {dividendStats && (
187
+ {showDividends && dividendStats && (
187
188
  <DividendEligibility
188
189
  windowExpiresAt={dividendStats.userWindowExpiresAt}
189
190
  eligible={dividendStats.userEligible}
190
191
  />
191
192
  )}
192
193
 
193
- {dividendStats && (
194
+ {showDividends && dividendStats && (
194
195
  <DividendPoolStats
195
196
  poolCents={dividendStats.poolCents}
196
197
  activeUsers={dividendStats.activeUsers}
@@ -204,7 +205,9 @@ function CreditsContent() {
204
205
  <AutoTopupCard />
205
206
  <TransactionHistory />
206
207
 
207
- {dividendStats && <FirstDividendDialog todayAmountCents={todayDividendCents} />}
208
+ {showDividends && dividendStats && (
209
+ <FirstDividendDialog todayAmountCents={todayDividendCents} />
210
+ )}
208
211
  </div>
209
212
  );
210
213
  }
@@ -8,6 +8,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
8
8
  import { Skeleton } from "@/components/ui/skeleton";
9
9
  import type { CreditOption } from "@/lib/api";
10
10
  import { createCreditCheckout, getCreditOptions } from "@/lib/api";
11
+ import { getBrandConfig } from "@/lib/brand-config";
11
12
  import { logger } from "@/lib/logger";
12
13
  import { cn } from "@/lib/utils";
13
14
  import { isAllowedRedirectUrl } from "@/lib/validate-redirect-url";
@@ -84,7 +85,9 @@ export function BuyCreditsPanel() {
84
85
  <CardHeader>
85
86
  <CardTitle>Buy Credits</CardTitle>
86
87
  <p className="text-xs text-muted-foreground">
87
- Every purchase resets your 7-day dividend window
88
+ {getBrandConfig().dividendsEnabled
89
+ ? "Every purchase resets your 7-day dividend window"
90
+ : "Top up your credit balance"}
88
91
  </p>
89
92
  </CardHeader>
90
93
  <CardContent>
@@ -104,7 +107,9 @@ export function BuyCreditsPanel() {
104
107
  <CardHeader>
105
108
  <CardTitle>Buy Credits</CardTitle>
106
109
  <p className="text-xs text-muted-foreground">
107
- Every purchase resets your 7-day dividend window
110
+ {getBrandConfig().dividendsEnabled
111
+ ? "Every purchase resets your 7-day dividend window"
112
+ : "Top up your credit balance"}
108
113
  </p>
109
114
  </CardHeader>
110
115
  <CardContent className="space-y-3">
@@ -123,7 +128,9 @@ export function BuyCreditsPanel() {
123
128
  <CardHeader>
124
129
  <CardTitle>Buy Credits</CardTitle>
125
130
  <p className="text-xs text-muted-foreground">
126
- Every purchase resets your 7-day dividend window
131
+ {getBrandConfig().dividendsEnabled
132
+ ? "Every purchase resets your 7-day dividend window"
133
+ : "Top up your credit balance"}
127
134
  </p>
128
135
  </CardHeader>
129
136
  <CardContent>
@@ -94,6 +94,9 @@ export interface BrandConfig {
94
94
  /** Whether the embedded chat widget is enabled (default true). */
95
95
  chatEnabled: boolean;
96
96
 
97
+ /** Whether dividend features are shown in billing (default false). */
98
+ dividendsEnabled: boolean;
99
+
97
100
  /** Feature bullet points shown on the billing plans page. */
98
101
  planFeatures: string[];
99
102
  }
@@ -175,6 +178,7 @@ function envDefaults(): BrandConfig {
175
178
  price: process.env.NEXT_PUBLIC_BRAND_PRICE || "",
176
179
  homePath: process.env.NEXT_PUBLIC_BRAND_HOME_PATH || "/marketplace",
177
180
  chatEnabled: process.env.NEXT_PUBLIC_BRAND_CHAT_ENABLED !== "false",
181
+ dividendsEnabled: process.env.NEXT_PUBLIC_BRAND_DIVIDENDS_ENABLED === "true",
178
182
  planFeatures: parseStringArray(process.env.NEXT_PUBLIC_BRAND_PLAN_FEATURES) ?? [
179
183
  "Signup credit included",
180
184
  "All channels",