@wopr-network/platform-ui-core 1.23.1 → 1.24.1
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
|
@@ -145,7 +145,7 @@ describe("BuyCryptoCreditPanel", () => {
|
|
|
145
145
|
await user.click(screen.getByText("$50"));
|
|
146
146
|
await user.click(screen.getByRole("button", { name: "Pay with USDC" }));
|
|
147
147
|
|
|
148
|
-
expect(mockCreateCheckout).toHaveBeenCalledWith("base", 50);
|
|
148
|
+
expect(mockCreateCheckout).toHaveBeenCalledWith("usdc:base", 50);
|
|
149
149
|
expect(await screen.findByText("0xabc123def456")).toBeInTheDocument();
|
|
150
150
|
expect(screen.getByText("50.000000 USDC")).toBeInTheDocument();
|
|
151
151
|
});
|
|
@@ -370,7 +370,7 @@ describe("BuyCryptoCreditPanel", () => {
|
|
|
370
370
|
vi.useRealTimers();
|
|
371
371
|
});
|
|
372
372
|
|
|
373
|
-
it("calls createCheckout with
|
|
373
|
+
it("calls createCheckout with methodId", async () => {
|
|
374
374
|
mockGetSupportedPaymentMethods.mockResolvedValue([MOCK_ETH_METHOD]);
|
|
375
375
|
mockCreateCheckout.mockResolvedValue({
|
|
376
376
|
depositAddress: "0xdef456",
|
|
@@ -391,6 +391,6 @@ describe("BuyCryptoCreditPanel", () => {
|
|
|
391
391
|
await user.click(screen.getByText("$100"));
|
|
392
392
|
await user.click(screen.getByRole("button", { name: "Pay with ETH" }));
|
|
393
393
|
|
|
394
|
-
expect(mockCreateCheckout).toHaveBeenCalledWith("base", 100);
|
|
394
|
+
expect(mockCreateCheckout).toHaveBeenCalledWith("eth:base", 100);
|
|
395
395
|
});
|
|
396
396
|
});
|
|
@@ -24,7 +24,7 @@ import { Button } from "@/components/ui/button";
|
|
|
24
24
|
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet";
|
|
25
25
|
import { usePageContext } from "@/hooks/use-page-context";
|
|
26
26
|
import { useWebMCP } from "@/hooks/use-webmcp";
|
|
27
|
-
import { productName } from "@/lib/brand-config";
|
|
27
|
+
import { getBrandConfig, productName } from "@/lib/brand-config";
|
|
28
28
|
import { ChatProvider } from "@/lib/chat/chat-context";
|
|
29
29
|
|
|
30
30
|
export default function DashboardLayout({
|
|
@@ -107,7 +107,7 @@ export default function DashboardLayout({
|
|
|
107
107
|
</motion.main>
|
|
108
108
|
</AnimatePresence>
|
|
109
109
|
</div>
|
|
110
|
-
{!pathname.startsWith("/chat") && <ChatWidget />}
|
|
110
|
+
{getBrandConfig().chatEnabled && !pathname.startsWith("/chat") && <ChatWidget />}
|
|
111
111
|
</ChatProvider>
|
|
112
112
|
);
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ export function BuyCryptoCreditPanel() {
|
|
|
119
119
|
setLoading(true);
|
|
120
120
|
setError(null);
|
|
121
121
|
try {
|
|
122
|
-
const result = await createCheckout(selectedMethod.
|
|
122
|
+
const result = await createCheckout(selectedMethod.id, selectedAmount);
|
|
123
123
|
setCheckout(result);
|
|
124
124
|
} catch {
|
|
125
125
|
setError("Checkout failed. Please try again.");
|
package/src/lib/api.ts
CHANGED
|
@@ -1364,8 +1364,8 @@ export interface CheckoutResult {
|
|
|
1364
1364
|
priceCents?: number;
|
|
1365
1365
|
}
|
|
1366
1366
|
|
|
1367
|
-
export async function createCheckout(
|
|
1368
|
-
return trpcVanilla.billing.checkout.mutate({
|
|
1367
|
+
export async function createCheckout(methodId: string, amountUsd: number): Promise<CheckoutResult> {
|
|
1368
|
+
return trpcVanilla.billing.checkout.mutate({ methodId, amountUsd });
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
1371
|
// --- Charge status polling ---
|
package/src/lib/brand-config.ts
CHANGED
|
@@ -90,6 +90,9 @@ export interface BrandConfig {
|
|
|
90
90
|
|
|
91
91
|
/** Sidebar navigation items. Each has a label and href. */
|
|
92
92
|
navItems: Array<{ label: string; href: string }>;
|
|
93
|
+
|
|
94
|
+
/** Whether the embedded chat widget is enabled (default true). */
|
|
95
|
+
chatEnabled: boolean;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
/**
|
|
@@ -154,6 +157,7 @@ function envDefaults(): BrandConfig {
|
|
|
154
157
|
companyLegalName: process.env.NEXT_PUBLIC_BRAND_COMPANY_LEGAL || "Platform Inc.",
|
|
155
158
|
price: process.env.NEXT_PUBLIC_BRAND_PRICE || "",
|
|
156
159
|
homePath: process.env.NEXT_PUBLIC_BRAND_HOME_PATH || "/marketplace",
|
|
160
|
+
chatEnabled: process.env.NEXT_PUBLIC_BRAND_CHAT_ENABLED !== "false",
|
|
157
161
|
navItems: parseNavItems(process.env.NEXT_PUBLIC_BRAND_NAV_ITEMS) ?? [
|
|
158
162
|
{ label: "Dashboard", href: "/dashboard" },
|
|
159
163
|
{ label: "Chat", href: "/chat" },
|