@wopr-network/platform-ui-core 1.19.4 → 1.19.6
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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { motion } from "framer-motion";
|
|
4
4
|
import { Check } from "lucide-react";
|
|
5
5
|
import Link from "next/link";
|
|
6
|
+
import { useRouter } from "next/navigation";
|
|
6
7
|
import { useState } from "react";
|
|
7
8
|
import { Button } from "@/components/ui/button";
|
|
8
9
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
|
@@ -87,6 +88,8 @@ export function CreateInstanceClient() {
|
|
|
87
88
|
setSelectedPlugins((prev) => (prev.includes(p) ? prev.filter((x) => x !== p) : [...prev, p]));
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
const router = useRouter();
|
|
92
|
+
|
|
90
93
|
async function handleSubmit() {
|
|
91
94
|
if (!name.trim()) return;
|
|
92
95
|
const validationError = validateName(name);
|
|
@@ -96,21 +99,25 @@ export function CreateInstanceClient() {
|
|
|
96
99
|
}
|
|
97
100
|
setSubmitting(true);
|
|
98
101
|
setSubmitError(null);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
102
|
+
|
|
103
|
+
const preset = presets.find((p) => p.id === selectedPreset);
|
|
104
|
+
const payload = {
|
|
105
|
+
name: name.trim(),
|
|
106
|
+
template: preset?.name ?? "Custom",
|
|
107
|
+
provider,
|
|
108
|
+
channels: selectedChannels,
|
|
109
|
+
plugins: selectedPlugins,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// Fire-and-forget: redirect immediately, let backend provision in background.
|
|
113
|
+
// The instances page polls for status updates.
|
|
114
|
+
createInstance(payload).catch(() => {
|
|
115
|
+
// Silently handled — instance list will show provisioning/error state
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
setCreated(true);
|
|
119
|
+
// Short delay for the success animation, then redirect to instances
|
|
120
|
+
setTimeout(() => router.push("/instances"), 1500);
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
if (created) {
|
package/src/lib/api.ts
CHANGED
|
@@ -1279,8 +1279,8 @@ export interface CheckoutResponse {
|
|
|
1279
1279
|
export async function getCreditBalance(): Promise<CreditBalance> {
|
|
1280
1280
|
const res = await trpcVanilla.billing.creditsBalance.query({});
|
|
1281
1281
|
return {
|
|
1282
|
-
balance: (res?.balance_cents ?? 0) / 100,
|
|
1283
|
-
dailyBurn: (res?.daily_burn_cents ?? 0) / 100,
|
|
1282
|
+
balance: (res?.balance_credits ?? res?.balance_cents ?? 0) / 100,
|
|
1283
|
+
dailyBurn: (res?.daily_burn_credits ?? res?.daily_burn_cents ?? 0) / 100,
|
|
1284
1284
|
runway: res?.runway_days ?? null,
|
|
1285
1285
|
};
|
|
1286
1286
|
}
|