@wopr-network/platform-ui-core 1.27.6 → 1.27.7
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
|
@@ -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
|
-
{
|
|
208
|
+
{showDividends && dividendStats && (
|
|
209
|
+
<FirstDividendDialog todayAmountCents={todayDividendCents} />
|
|
210
|
+
)}
|
|
208
211
|
</div>
|
|
209
212
|
);
|
|
210
213
|
}
|
package/src/lib/brand-config.ts
CHANGED
|
@@ -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",
|