@ottocode/web-sdk 0.1.243 → 0.1.245
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/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +139 -139
- package/dist/components/index.js.map +21 -21
- package/dist/components/onboarding/steps/ProviderSetupStep.d.ts.map +1 -1
- package/dist/components/settings/{SetuTopupModal.d.ts → OttoRouterTopupModal.d.ts} +2 -2
- package/dist/components/settings/OttoRouterTopupModal.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +71 -71
- package/dist/hooks/index.js.map +12 -12
- package/dist/hooks/useAuthStatus.d.ts +1 -1
- package/dist/hooks/useAuthStatus.d.ts.map +1 -1
- package/dist/hooks/useOttoRouterBalance.d.ts +4 -0
- package/dist/hooks/useOttoRouterBalance.d.ts.map +1 -0
- package/dist/index.js +152 -152
- package/dist/index.js.map +22 -22
- package/dist/lib/api-client/auth.d.ts +4 -4
- package/dist/lib/api-client/auth.d.ts.map +1 -1
- package/dist/lib/api-client/index.d.ts +7 -7
- package/dist/lib/api-client/index.d.ts.map +1 -1
- package/dist/lib/api-client/{setu.d.ts → ottorouter.d.ts} +5 -5
- package/dist/lib/api-client/ottorouter.d.ts.map +1 -0
- package/dist/lib/index.js +30 -30
- package/dist/lib/index.js.map +6 -6
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +4 -4
- package/dist/stores/index.js.map +5 -5
- package/dist/stores/onboardingStore.d.ts +1 -1
- package/dist/stores/onboardingStore.d.ts.map +1 -1
- package/dist/stores/{setuStore.d.ts → ottorouterStore.d.ts} +15 -15
- package/dist/stores/ottorouterStore.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/components/settings/SetuTopupModal.d.ts.map +0 -1
- package/dist/hooks/useSetuBalance.d.ts +0 -4
- package/dist/hooks/useSetuBalance.d.ts.map +0 -1
- package/dist/lib/api-client/setu.d.ts.map +0 -1
- package/dist/stores/setuStore.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1286,11 +1286,11 @@ var approvalMixin = {
|
|
|
1286
1286
|
}
|
|
1287
1287
|
};
|
|
1288
1288
|
|
|
1289
|
-
// src/lib/api-client/
|
|
1289
|
+
// src/lib/api-client/ottorouter.ts
|
|
1290
1290
|
import {
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1291
|
+
getOttoRouterBalance as apiGetSetuBalance,
|
|
1292
|
+
getOttoRouterWallet as apiGetSetuWallet,
|
|
1293
|
+
getOttoRouterUsdcBalance as apiGetSetuUsdcBalance,
|
|
1294
1294
|
createPolarCheckout as apiCreatePolarCheckout,
|
|
1295
1295
|
getPolarTopupEstimate as apiGetPolarTopupEstimate,
|
|
1296
1296
|
getPolarTopupStatus as apiGetPolarTopupStatus,
|
|
@@ -1301,8 +1301,8 @@ import {
|
|
|
1301
1301
|
cancelTopup as apiCancelTopup,
|
|
1302
1302
|
getPendingTopup as apiGetPendingTopup
|
|
1303
1303
|
} from "@ottocode/api";
|
|
1304
|
-
var
|
|
1305
|
-
async
|
|
1304
|
+
var ottorouterMixin = {
|
|
1305
|
+
async getOttoRouterBalance() {
|
|
1306
1306
|
try {
|
|
1307
1307
|
const response = await apiGetSetuBalance();
|
|
1308
1308
|
if (response.error)
|
|
@@ -1312,7 +1312,7 @@ var setuMixin = {
|
|
|
1312
1312
|
return null;
|
|
1313
1313
|
}
|
|
1314
1314
|
},
|
|
1315
|
-
async
|
|
1315
|
+
async getOttoRouterWallet() {
|
|
1316
1316
|
try {
|
|
1317
1317
|
const response = await apiGetSetuWallet();
|
|
1318
1318
|
if (response.error)
|
|
@@ -1322,7 +1322,7 @@ var setuMixin = {
|
|
|
1322
1322
|
return { configured: false };
|
|
1323
1323
|
}
|
|
1324
1324
|
},
|
|
1325
|
-
async
|
|
1325
|
+
async getOttoRouterUsdcBalance(network = "mainnet") {
|
|
1326
1326
|
try {
|
|
1327
1327
|
const response = await apiGetSetuUsdcBalance({
|
|
1328
1328
|
query: { network }
|
|
@@ -1427,9 +1427,9 @@ var setuMixin = {
|
|
|
1427
1427
|
// src/lib/api-client/auth.ts
|
|
1428
1428
|
import {
|
|
1429
1429
|
getAuthStatus as apiGetAuthStatus,
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1430
|
+
setupOttoRouterWallet as apiSetupSetuWallet,
|
|
1431
|
+
importOttoRouterWallet as apiImportSetuWallet,
|
|
1432
|
+
exportOttoRouterWallet as apiExportSetuWallet,
|
|
1433
1433
|
addProviderApiKey as apiAddProviderApiKey,
|
|
1434
1434
|
removeProvider as apiRemoveProvider,
|
|
1435
1435
|
completeOnboarding as apiCompleteOnboarding,
|
|
@@ -1450,13 +1450,13 @@ var authMixin = {
|
|
|
1450
1450
|
throw new Error(extractErrorMessage(response.error));
|
|
1451
1451
|
return response.data;
|
|
1452
1452
|
},
|
|
1453
|
-
async
|
|
1453
|
+
async setupOttoRouterWallet() {
|
|
1454
1454
|
const response = await apiSetupSetuWallet();
|
|
1455
1455
|
if (response.error)
|
|
1456
1456
|
throw new Error(extractErrorMessage(response.error));
|
|
1457
1457
|
return response.data;
|
|
1458
1458
|
},
|
|
1459
|
-
async
|
|
1459
|
+
async importOttoRouterWallet(privateKey) {
|
|
1460
1460
|
const response = await apiImportSetuWallet({
|
|
1461
1461
|
body: { privateKey }
|
|
1462
1462
|
});
|
|
@@ -1464,7 +1464,7 @@ var authMixin = {
|
|
|
1464
1464
|
throw new Error(extractErrorMessage(response.error));
|
|
1465
1465
|
return response.data;
|
|
1466
1466
|
},
|
|
1467
|
-
async
|
|
1467
|
+
async exportOttoRouterWallet() {
|
|
1468
1468
|
const response = await apiExportSetuWallet();
|
|
1469
1469
|
if (response.error)
|
|
1470
1470
|
throw new Error(extractErrorMessage(response.error));
|
|
@@ -1646,22 +1646,22 @@ class ApiClient {
|
|
|
1646
1646
|
syncSession = branchesMixin.syncSession;
|
|
1647
1647
|
approveToolCall = approvalMixin.approveToolCall;
|
|
1648
1648
|
getPendingApprovals = approvalMixin.getPendingApprovals;
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
getPolarTopupEstimate =
|
|
1653
|
-
createPolarCheckout =
|
|
1654
|
-
selectTopupMethod =
|
|
1655
|
-
cancelTopup =
|
|
1656
|
-
getPendingTopup =
|
|
1657
|
-
getPolarTopupStatus =
|
|
1658
|
-
getRazorpayTopupEstimate =
|
|
1659
|
-
createRazorpayOrder =
|
|
1660
|
-
verifyRazorpayPayment =
|
|
1649
|
+
getOttoRouterBalance = ottorouterMixin.getOttoRouterBalance;
|
|
1650
|
+
getOttoRouterWallet = ottorouterMixin.getOttoRouterWallet;
|
|
1651
|
+
getOttoRouterUsdcBalance = ottorouterMixin.getOttoRouterUsdcBalance;
|
|
1652
|
+
getPolarTopupEstimate = ottorouterMixin.getPolarTopupEstimate;
|
|
1653
|
+
createPolarCheckout = ottorouterMixin.createPolarCheckout;
|
|
1654
|
+
selectTopupMethod = ottorouterMixin.selectTopupMethod;
|
|
1655
|
+
cancelTopup = ottorouterMixin.cancelTopup;
|
|
1656
|
+
getPendingTopup = ottorouterMixin.getPendingTopup;
|
|
1657
|
+
getPolarTopupStatus = ottorouterMixin.getPolarTopupStatus;
|
|
1658
|
+
getRazorpayTopupEstimate = ottorouterMixin.getRazorpayTopupEstimate;
|
|
1659
|
+
createRazorpayOrder = ottorouterMixin.createRazorpayOrder;
|
|
1660
|
+
verifyRazorpayPayment = ottorouterMixin.verifyRazorpayPayment;
|
|
1661
1661
|
getAuthStatus = authMixin.getAuthStatus;
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1662
|
+
setupOttoRouterWallet = authMixin.setupOttoRouterWallet;
|
|
1663
|
+
importOttoRouterWallet = authMixin.importOttoRouterWallet;
|
|
1664
|
+
exportOttoRouterWallet = authMixin.exportOttoRouterWallet;
|
|
1665
1665
|
addProvider = authMixin.addProvider;
|
|
1666
1666
|
removeProvider = authMixin.removeProvider;
|
|
1667
1667
|
completeOnboarding = authMixin.completeOnboarding;
|
|
@@ -2613,7 +2613,7 @@ var providerLogos = {
|
|
|
2613
2613
|
xai: xaiLogo,
|
|
2614
2614
|
zai: zaiLogo,
|
|
2615
2615
|
"zai-coding": zaiLogo,
|
|
2616
|
-
|
|
2616
|
+
ottorouter: setuLogo,
|
|
2617
2617
|
minimax: minimaxLogo,
|
|
2618
2618
|
opencode: opencodeLogo,
|
|
2619
2619
|
copilot: copilotLogo
|
|
@@ -3225,9 +3225,9 @@ function createChatInputKeyHandler(options) {
|
|
|
3225
3225
|
};
|
|
3226
3226
|
}
|
|
3227
3227
|
|
|
3228
|
-
// src/stores/
|
|
3228
|
+
// src/stores/ottorouterStore.ts
|
|
3229
3229
|
import { create as create5 } from "zustand";
|
|
3230
|
-
var
|
|
3230
|
+
var useOttoRouterStore = create5((set) => ({
|
|
3231
3231
|
balance: null,
|
|
3232
3232
|
usdcBalance: null,
|
|
3233
3233
|
network: "mainnet",
|
|
@@ -3475,8 +3475,8 @@ var ChatInput = memo4(forwardRef5(function ChatInput2({
|
|
|
3475
3475
|
const updateDefaultsMutation = useUpdateDefaults();
|
|
3476
3476
|
const files = filesData?.files || [];
|
|
3477
3477
|
const changedFiles = filesData?.changedFiles || [];
|
|
3478
|
-
const setuSubscription =
|
|
3479
|
-
const isSetu = providerName === "
|
|
3478
|
+
const setuSubscription = useOttoRouterStore((s) => s.subscription);
|
|
3479
|
+
const isSetu = providerName === "ottorouter";
|
|
3480
3480
|
const setuPlanLabel = useMemo4(() => {
|
|
3481
3481
|
if (!isSetu)
|
|
3482
3482
|
return null;
|
|
@@ -14145,32 +14145,32 @@ function useProviderUsage(provider, authType) {
|
|
|
14145
14145
|
};
|
|
14146
14146
|
}
|
|
14147
14147
|
|
|
14148
|
-
// src/hooks/
|
|
14148
|
+
// src/hooks/useOttoRouterBalance.ts
|
|
14149
14149
|
import { useEffect as useEffect21, useCallback as useCallback16 } from "react";
|
|
14150
|
-
function
|
|
14151
|
-
const setBalance =
|
|
14152
|
-
const setUsdcBalance =
|
|
14153
|
-
const setWalletAddress =
|
|
14154
|
-
const setLoading =
|
|
14155
|
-
const setScope =
|
|
14156
|
-
const setPayg =
|
|
14157
|
-
const setSubscription =
|
|
14158
|
-
const setLimits =
|
|
14150
|
+
function useOttoRouterBalance(providerName) {
|
|
14151
|
+
const setBalance = useOttoRouterStore((s) => s.setBalance);
|
|
14152
|
+
const setUsdcBalance = useOttoRouterStore((s) => s.setUsdcBalance);
|
|
14153
|
+
const setWalletAddress = useOttoRouterStore((s) => s.setWalletAddress);
|
|
14154
|
+
const setLoading = useOttoRouterStore((s) => s.setLoading);
|
|
14155
|
+
const setScope = useOttoRouterStore((s) => s.setScope);
|
|
14156
|
+
const setPayg = useOttoRouterStore((s) => s.setPayg);
|
|
14157
|
+
const setSubscription = useOttoRouterStore((s) => s.setSubscription);
|
|
14158
|
+
const setLimits = useOttoRouterStore((s) => s.setLimits);
|
|
14159
14159
|
const setUsage = useUsageStore((s) => s.setUsage);
|
|
14160
|
-
const balance =
|
|
14161
|
-
const usdcBalance =
|
|
14162
|
-
const subscription =
|
|
14163
|
-
const network =
|
|
14160
|
+
const balance = useOttoRouterStore((s) => s.balance);
|
|
14161
|
+
const usdcBalance = useOttoRouterStore((s) => s.usdcBalance);
|
|
14162
|
+
const subscription = useOttoRouterStore((s) => s.subscription);
|
|
14163
|
+
const network = useOttoRouterStore((s) => s.network);
|
|
14164
14164
|
const fetchBalance = useCallback16(async () => {
|
|
14165
|
-
if (providerName !== "
|
|
14165
|
+
if (providerName !== "ottorouter") {
|
|
14166
14166
|
return;
|
|
14167
14167
|
}
|
|
14168
14168
|
setLoading(true);
|
|
14169
14169
|
try {
|
|
14170
14170
|
const [setuData, usdcData, walletData] = await Promise.all([
|
|
14171
|
-
apiClient.
|
|
14172
|
-
apiClient.
|
|
14173
|
-
apiClient.
|
|
14171
|
+
apiClient.getOttoRouterBalance(),
|
|
14172
|
+
apiClient.getOttoRouterUsdcBalance(network),
|
|
14173
|
+
apiClient.getOttoRouterWallet()
|
|
14174
14174
|
]);
|
|
14175
14175
|
if (setuData) {
|
|
14176
14176
|
setBalance(setuData.balance);
|
|
@@ -14181,8 +14181,8 @@ function useSetuBalance(providerName) {
|
|
|
14181
14181
|
setLimits(setuData.limits ?? null);
|
|
14182
14182
|
const sub = setuData.subscription;
|
|
14183
14183
|
if (sub?.active && sub.usageWindows) {
|
|
14184
|
-
setUsage("
|
|
14185
|
-
provider: "
|
|
14184
|
+
setUsage("ottorouter", {
|
|
14185
|
+
provider: "ottorouter",
|
|
14186
14186
|
primaryWindow: {
|
|
14187
14187
|
usedPercent: sub.usageWindows.fiveHour.percentUsed,
|
|
14188
14188
|
windowSeconds: 18000,
|
|
@@ -14224,7 +14224,7 @@ function useSetuBalance(providerName) {
|
|
|
14224
14224
|
]);
|
|
14225
14225
|
const needsUsageWindows = subscription?.active && !subscription.usageWindows;
|
|
14226
14226
|
useEffect21(() => {
|
|
14227
|
-
if (providerName === "
|
|
14227
|
+
if (providerName === "ottorouter" && (balance === null || usdcBalance === null || needsUsageWindows)) {
|
|
14228
14228
|
fetchBalance();
|
|
14229
14229
|
}
|
|
14230
14230
|
}, [providerName, balance, usdcBalance, needsUsageWindows, fetchBalance]);
|
|
@@ -14287,9 +14287,9 @@ function LeanHeader({
|
|
|
14287
14287
|
const { data: allModels } = useAllModels();
|
|
14288
14288
|
const providerAuthType = allModels?.[session.provider]?.authType;
|
|
14289
14289
|
const { usage, isOAuthProvider } = useProviderUsage(session.provider, providerAuthType);
|
|
14290
|
-
const isSetu = session.provider === "
|
|
14291
|
-
|
|
14292
|
-
const setuUsage = useUsageStore((s) => s.usage
|
|
14290
|
+
const isSetu = session.provider === "ottorouter";
|
|
14291
|
+
useOttoRouterBalance(isSetu ? "ottorouter" : undefined);
|
|
14292
|
+
const setuUsage = useUsageStore((s) => s.usage.ottorouter);
|
|
14293
14293
|
return /* @__PURE__ */ jsxs56(Fragment28, {
|
|
14294
14294
|
children: [
|
|
14295
14295
|
/* @__PURE__ */ jsx64("div", {
|
|
@@ -14368,7 +14368,7 @@ function LeanHeader({
|
|
|
14368
14368
|
}),
|
|
14369
14369
|
isSetu && setuUsage && /* @__PURE__ */ jsx64(UsageRing, {
|
|
14370
14370
|
usage: setuUsage,
|
|
14371
|
-
provider: "
|
|
14371
|
+
provider: "ottorouter"
|
|
14372
14372
|
}),
|
|
14373
14373
|
/* @__PURE__ */ jsx64("div", {
|
|
14374
14374
|
className: "flex items-center gap-3",
|
|
@@ -14433,8 +14433,8 @@ var TopupApprovalCard = memo13(function TopupApprovalCard2({
|
|
|
14433
14433
|
}) {
|
|
14434
14434
|
const [isProcessing, setIsProcessing] = useState29(false);
|
|
14435
14435
|
const [selectedMethod, setSelectedMethod] = useState29(null);
|
|
14436
|
-
const openTopupModal =
|
|
14437
|
-
const hasGoPlan =
|
|
14436
|
+
const openTopupModal = useOttoRouterStore((s) => s.openTopupModal);
|
|
14437
|
+
const hasGoPlan = useOttoRouterStore((s) => !!s.subscription?.active);
|
|
14438
14438
|
const handleSelectCrypto = async () => {
|
|
14439
14439
|
setSelectedMethod("crypto");
|
|
14440
14440
|
setIsProcessing(true);
|
|
@@ -15825,7 +15825,7 @@ function useToolApprovalShortcuts(sessionId) {
|
|
|
15825
15825
|
]);
|
|
15826
15826
|
}
|
|
15827
15827
|
|
|
15828
|
-
// src/components/settings/
|
|
15828
|
+
// src/components/settings/OttoRouterTopupModal.tsx
|
|
15829
15829
|
import { memo as memo16, useState as useState31, useEffect as useEffect25, useCallback as useCallback19, useRef as useRef16 } from "react";
|
|
15830
15830
|
import {
|
|
15831
15831
|
CreditCard as CreditCard4,
|
|
@@ -15957,7 +15957,7 @@ var StatusIndicator = memo15(function StatusIndicator2({
|
|
|
15957
15957
|
});
|
|
15958
15958
|
});
|
|
15959
15959
|
|
|
15960
|
-
// src/components/settings/
|
|
15960
|
+
// src/components/settings/OttoRouterTopupModal.tsx
|
|
15961
15961
|
import { jsx as jsx68, jsxs as jsxs60, Fragment as Fragment29 } from "react/jsx-runtime";
|
|
15962
15962
|
var PRESET_AMOUNTS = [10, 25, 50, 100];
|
|
15963
15963
|
var MIN_AMOUNT = 5;
|
|
@@ -16022,13 +16022,13 @@ function RazorpayIcon({ className = "w-5 h-5" }) {
|
|
|
16022
16022
|
]
|
|
16023
16023
|
});
|
|
16024
16024
|
}
|
|
16025
|
-
var
|
|
16026
|
-
const isOpen =
|
|
16027
|
-
const closeModal =
|
|
16028
|
-
const balance =
|
|
16029
|
-
const setBalance =
|
|
16030
|
-
const usdcBalance =
|
|
16031
|
-
const subscription =
|
|
16025
|
+
var OttoRouterTopupModal = memo16(function OttoRouterTopupModal2() {
|
|
16026
|
+
const isOpen = useOttoRouterStore((s) => s.isTopupModalOpen);
|
|
16027
|
+
const closeModal = useOttoRouterStore((s) => s.closeTopupModal);
|
|
16028
|
+
const balance = useOttoRouterStore((s) => s.balance);
|
|
16029
|
+
const setBalance = useOttoRouterStore((s) => s.setBalance);
|
|
16030
|
+
const usdcBalance = useOttoRouterStore((s) => s.usdcBalance);
|
|
16031
|
+
const subscription = useOttoRouterStore((s) => s.subscription);
|
|
16032
16032
|
const [view, setView] = useState31("amount");
|
|
16033
16033
|
const [gateway, setGateway] = useState31("polar");
|
|
16034
16034
|
const [amount, setAmount] = useState31(25);
|
|
@@ -16109,7 +16109,7 @@ var SetuTopupModal = memo16(function SetuTopupModal2() {
|
|
|
16109
16109
|
stopPolling();
|
|
16110
16110
|
setConfirmedAmount(status.amountUsd);
|
|
16111
16111
|
localStorage.removeItem("pendingPolarCheckout");
|
|
16112
|
-
const balanceData = await apiClient.
|
|
16112
|
+
const balanceData = await apiClient.getOttoRouterBalance();
|
|
16113
16113
|
if (balanceData?.balance !== undefined) {
|
|
16114
16114
|
setBalance(balanceData.balance);
|
|
16115
16115
|
}
|
|
@@ -16191,7 +16191,7 @@ var SetuTopupModal = memo16(function SetuTopupModal2() {
|
|
|
16191
16191
|
});
|
|
16192
16192
|
if (result.success) {
|
|
16193
16193
|
setConfirmedAmount(result.credited);
|
|
16194
|
-
const balanceData = await apiClient.
|
|
16194
|
+
const balanceData = await apiClient.getOttoRouterBalance();
|
|
16195
16195
|
if (balanceData?.balance !== undefined) {
|
|
16196
16196
|
setBalance(balanceData.balance);
|
|
16197
16197
|
}
|
|
@@ -16240,7 +16240,7 @@ var SetuTopupModal = memo16(function SetuTopupModal2() {
|
|
|
16240
16240
|
stopPolling();
|
|
16241
16241
|
setConfirmedAmount(status.amountUsd);
|
|
16242
16242
|
localStorage.removeItem("pendingPolarCheckout");
|
|
16243
|
-
const balanceData = await apiClient.
|
|
16243
|
+
const balanceData = await apiClient.getOttoRouterBalance();
|
|
16244
16244
|
if (balanceData?.balance !== undefined) {
|
|
16245
16245
|
setBalance(balanceData.balance);
|
|
16246
16246
|
}
|
|
@@ -16249,7 +16249,7 @@ var SetuTopupModal = memo16(function SetuTopupModal2() {
|
|
|
16249
16249
|
toast.error("Payment not confirmed yet. Keep waiting or try again.");
|
|
16250
16250
|
}
|
|
16251
16251
|
} catch (err) {
|
|
16252
|
-
console.error("[
|
|
16252
|
+
console.error("[OttoRouterTopupModal] Check failed:", err);
|
|
16253
16253
|
toast.error("Failed to check payment status");
|
|
16254
16254
|
} finally {
|
|
16255
16255
|
setIsManualChecking(false);
|
|
@@ -16702,7 +16702,7 @@ var MessageThreadContainer = memo17(function MessageThreadContainer2({
|
|
|
16702
16702
|
compact: preferences2.compactThread,
|
|
16703
16703
|
onSelectSession
|
|
16704
16704
|
}),
|
|
16705
|
-
/* @__PURE__ */ jsx69(
|
|
16705
|
+
/* @__PURE__ */ jsx69(OttoRouterTopupModal, {})
|
|
16706
16706
|
]
|
|
16707
16707
|
});
|
|
16708
16708
|
});
|
|
@@ -21081,7 +21081,7 @@ function useAuthStatus() {
|
|
|
21081
21081
|
const status = await fetchAuthStatus();
|
|
21082
21082
|
if (status) {
|
|
21083
21083
|
const hasAnyProvider = Object.values(status.providers).some((p) => p.configured);
|
|
21084
|
-
const needsOnboarding = !status.onboardingComplete || !hasAnyProvider || !status.
|
|
21084
|
+
const needsOnboarding = !status.onboardingComplete || !hasAnyProvider || !status.ottorouter.configured;
|
|
21085
21085
|
if (needsOnboarding) {
|
|
21086
21086
|
setOpen(true);
|
|
21087
21087
|
}
|
|
@@ -21092,7 +21092,7 @@ function useAuthStatus() {
|
|
|
21092
21092
|
setLoading(true);
|
|
21093
21093
|
setError(null);
|
|
21094
21094
|
try {
|
|
21095
|
-
const result = await apiClient.
|
|
21095
|
+
const result = await apiClient.setupOttoRouterWallet();
|
|
21096
21096
|
await fetchAuthStatus();
|
|
21097
21097
|
return result;
|
|
21098
21098
|
} catch (err) {
|
|
@@ -21107,7 +21107,7 @@ function useAuthStatus() {
|
|
|
21107
21107
|
setLoading(true);
|
|
21108
21108
|
setError(null);
|
|
21109
21109
|
try {
|
|
21110
|
-
const result = await apiClient.
|
|
21110
|
+
const result = await apiClient.importOttoRouterWallet(privateKey);
|
|
21111
21111
|
await fetchAuthStatus();
|
|
21112
21112
|
return result;
|
|
21113
21113
|
} catch (err) {
|
|
@@ -21312,7 +21312,7 @@ var STORAGE_KEY2 = "pendingPolarCheckout";
|
|
|
21312
21312
|
function useTopupCallback() {
|
|
21313
21313
|
const hasHandled = useRef25(false);
|
|
21314
21314
|
const loadingToastId = useRef25(null);
|
|
21315
|
-
const setBalance =
|
|
21315
|
+
const setBalance = useOttoRouterStore((s) => s.setBalance);
|
|
21316
21316
|
const removeToast = useToastStore((s) => s.removeToast);
|
|
21317
21317
|
useEffect36(() => {
|
|
21318
21318
|
if (hasHandled.current)
|
|
@@ -21346,7 +21346,7 @@ function useTopupCallback() {
|
|
|
21346
21346
|
if (status?.confirmed) {
|
|
21347
21347
|
localStorage.removeItem(STORAGE_KEY2);
|
|
21348
21348
|
dismissLoading();
|
|
21349
|
-
const balanceData = await apiClient.
|
|
21349
|
+
const balanceData = await apiClient.getOttoRouterBalance();
|
|
21350
21350
|
if (balanceData?.balance !== undefined) {
|
|
21351
21351
|
setBalance(balanceData.balance);
|
|
21352
21352
|
}
|
|
@@ -21593,20 +21593,20 @@ var SettingsSidebar = memo31(function SettingsSidebar2() {
|
|
|
21593
21593
|
const { data: allModels } = useAllModels();
|
|
21594
21594
|
const { preferences: preferences2, updatePreferences } = usePreferences();
|
|
21595
21595
|
const updateDefaults = useUpdateDefaults();
|
|
21596
|
-
const
|
|
21597
|
-
const
|
|
21598
|
-
const
|
|
21599
|
-
const
|
|
21600
|
-
const openTopupModal =
|
|
21596
|
+
const ottorouterBalance = useOttoRouterStore((s) => s.balance);
|
|
21597
|
+
const ottorouterWallet = useOttoRouterStore((s) => s.walletAddress);
|
|
21598
|
+
const ottorouterUsdcBalance = useOttoRouterStore((s) => s.usdcBalance);
|
|
21599
|
+
const ottorouterLoading = useOttoRouterStore((s) => s.isLoading);
|
|
21600
|
+
const openTopupModal = useOttoRouterStore((s) => s.openTopupModal);
|
|
21601
21601
|
useTopupCallback();
|
|
21602
|
-
const hasSetu = config2?.providers?.includes("
|
|
21603
|
-
const { fetchBalance: refreshSetuBalance } =
|
|
21602
|
+
const hasSetu = config2?.providers?.includes("ottorouter");
|
|
21603
|
+
const { fetchBalance: refreshSetuBalance } = useOttoRouterBalance(hasSetu ? "ottorouter" : undefined);
|
|
21604
21604
|
const setOnboardingOpen = useOnboardingStore((s) => s.setOpen);
|
|
21605
21605
|
const setStep = useOnboardingStore((s) => s.setStep);
|
|
21606
21606
|
const setManageMode = useOnboardingStore((s) => s.setManageMode);
|
|
21607
21607
|
const { fetchAuthStatus } = useAuthStatus();
|
|
21608
21608
|
const exportSetuPrivateKey = useCallback27(async () => {
|
|
21609
|
-
return await apiClient.
|
|
21609
|
+
return await apiClient.exportOttoRouterWallet();
|
|
21610
21610
|
}, []);
|
|
21611
21611
|
const providerOptions = useMemo22(() => {
|
|
21612
21612
|
if (!config2?.providers || !allModels)
|
|
@@ -21829,16 +21829,16 @@ var SettingsSidebar = memo31(function SettingsSidebar2() {
|
|
|
21829
21829
|
})
|
|
21830
21830
|
})
|
|
21831
21831
|
}),
|
|
21832
|
-
config2?.providers?.includes("
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21832
|
+
config2?.providers?.includes("ottorouter") && /* @__PURE__ */ jsx88(SetuWalletSection, {
|
|
21833
|
+
ottorouterWallet,
|
|
21834
|
+
ottorouterBalance,
|
|
21835
|
+
ottorouterUsdcBalance,
|
|
21836
|
+
ottorouterLoading,
|
|
21837
21837
|
refreshSetuBalance,
|
|
21838
21838
|
openTopupModal,
|
|
21839
21839
|
onExportPrivateKey: exportSetuPrivateKey
|
|
21840
21840
|
}),
|
|
21841
|
-
/* @__PURE__ */ jsx88(
|
|
21841
|
+
/* @__PURE__ */ jsx88(OttoRouterTopupModal, {})
|
|
21842
21842
|
]
|
|
21843
21843
|
})
|
|
21844
21844
|
]
|
|
@@ -21847,8 +21847,8 @@ var SettingsSidebar = memo31(function SettingsSidebar2() {
|
|
|
21847
21847
|
});
|
|
21848
21848
|
});
|
|
21849
21849
|
function SetuSubscriptionInfo() {
|
|
21850
|
-
const subscription =
|
|
21851
|
-
const payg =
|
|
21850
|
+
const subscription = useOttoRouterStore((s) => s.subscription);
|
|
21851
|
+
const payg = useOttoRouterStore((s) => s.payg);
|
|
21852
21852
|
if (!subscription?.active)
|
|
21853
21853
|
return null;
|
|
21854
21854
|
return /* @__PURE__ */ jsxs80(Fragment35, {
|
|
@@ -21885,15 +21885,15 @@ function SetuSubscriptionInfo() {
|
|
|
21885
21885
|
});
|
|
21886
21886
|
}
|
|
21887
21887
|
var SetuWalletSection = memo31(function SetuWalletSection2({
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21888
|
+
ottorouterWallet,
|
|
21889
|
+
ottorouterBalance,
|
|
21890
|
+
ottorouterUsdcBalance,
|
|
21891
|
+
ottorouterLoading,
|
|
21892
21892
|
refreshSetuBalance,
|
|
21893
21893
|
openTopupModal,
|
|
21894
21894
|
onExportPrivateKey
|
|
21895
21895
|
}) {
|
|
21896
|
-
const hasActiveSubscription =
|
|
21896
|
+
const hasActiveSubscription = useOttoRouterStore((s) => !!s.subscription?.active);
|
|
21897
21897
|
const [copied, setCopied] = useState39(false);
|
|
21898
21898
|
const [isExportModalOpen, setIsExportModalOpen] = useState39(false);
|
|
21899
21899
|
const [exportPrivateKey, setExportPrivateKey] = useState39(null);
|
|
@@ -21901,12 +21901,12 @@ var SetuWalletSection = memo31(function SetuWalletSection2({
|
|
|
21901
21901
|
const [exportPrivateKeyError, setExportPrivateKeyError] = useState39(null);
|
|
21902
21902
|
const [privateKeyCopied, setPrivateKeyCopied] = useState39(false);
|
|
21903
21903
|
const handleCopy = useCallback27(async () => {
|
|
21904
|
-
if (!
|
|
21904
|
+
if (!ottorouterWallet)
|
|
21905
21905
|
return;
|
|
21906
|
-
await navigator.clipboard.writeText(
|
|
21906
|
+
await navigator.clipboard.writeText(ottorouterWallet);
|
|
21907
21907
|
setCopied(true);
|
|
21908
21908
|
setTimeout(() => setCopied(false), 2000);
|
|
21909
|
-
}, [
|
|
21909
|
+
}, [ottorouterWallet]);
|
|
21910
21910
|
const handleOpenExportPrivateKey = async () => {
|
|
21911
21911
|
setIsExportModalOpen(true);
|
|
21912
21912
|
setPrivateKeyCopied(false);
|
|
@@ -21952,7 +21952,7 @@ var SetuWalletSection = memo31(function SetuWalletSection2({
|
|
|
21952
21952
|
return "—";
|
|
21953
21953
|
return `${balance.toFixed(2)} USDC`;
|
|
21954
21954
|
};
|
|
21955
|
-
const isLoaded =
|
|
21955
|
+
const isLoaded = ottorouterWallet !== null;
|
|
21956
21956
|
return /* @__PURE__ */ jsxs80(SettingsSection, {
|
|
21957
21957
|
title: "Setu Credits",
|
|
21958
21958
|
icon: /* @__PURE__ */ jsx88(Wallet3, {
|
|
@@ -21961,11 +21961,11 @@ var SetuWalletSection = memo31(function SetuWalletSection2({
|
|
|
21961
21961
|
action: /* @__PURE__ */ jsx88("button", {
|
|
21962
21962
|
type: "button",
|
|
21963
21963
|
onClick: refreshSetuBalance,
|
|
21964
|
-
disabled:
|
|
21964
|
+
disabled: ottorouterLoading,
|
|
21965
21965
|
className: "p-1 hover:bg-muted rounded transition-colors disabled:opacity-50",
|
|
21966
21966
|
title: "Refresh balances",
|
|
21967
21967
|
children: /* @__PURE__ */ jsx88(RefreshCw8, {
|
|
21968
|
-
className: `w-3.5 h-3.5 text-muted-foreground ${
|
|
21968
|
+
className: `w-3.5 h-3.5 text-muted-foreground ${ottorouterLoading ? "animate-spin" : ""}`
|
|
21969
21969
|
})
|
|
21970
21970
|
}),
|
|
21971
21971
|
children: [
|
|
@@ -21976,7 +21976,7 @@ var SetuWalletSection = memo31(function SetuWalletSection2({
|
|
|
21976
21976
|
children: /* @__PURE__ */ jsx88("div", {
|
|
21977
21977
|
className: "p-2 bg-white rounded-lg",
|
|
21978
21978
|
children: /* @__PURE__ */ jsx88(QRCodeSVG, {
|
|
21979
|
-
value:
|
|
21979
|
+
value: ottorouterWallet,
|
|
21980
21980
|
size: 120,
|
|
21981
21981
|
level: "M",
|
|
21982
21982
|
includeMargin: false
|
|
@@ -21996,7 +21996,7 @@ var SetuWalletSection = memo31(function SetuWalletSection2({
|
|
|
21996
21996
|
className: "flex items-center gap-1.5 font-mono text-foreground hover:text-muted-foreground transition-colors",
|
|
21997
21997
|
title: "Copy address",
|
|
21998
21998
|
children: [
|
|
21999
|
-
truncateWallet(
|
|
21999
|
+
truncateWallet(ottorouterWallet),
|
|
22000
22000
|
copied ? /* @__PURE__ */ jsx88(Check11, {
|
|
22001
22001
|
className: "w-3 h-3 text-green-500"
|
|
22002
22002
|
}) : /* @__PURE__ */ jsx88(Copy3, {
|
|
@@ -22011,11 +22011,11 @@ var SetuWalletSection = memo31(function SetuWalletSection2({
|
|
|
22011
22011
|
children: [
|
|
22012
22012
|
/* @__PURE__ */ jsx88(SettingRow, {
|
|
22013
22013
|
label: "Balance",
|
|
22014
|
-
value: formatBalance(
|
|
22014
|
+
value: formatBalance(ottorouterBalance)
|
|
22015
22015
|
}),
|
|
22016
22016
|
/* @__PURE__ */ jsx88(SettingRow, {
|
|
22017
22017
|
label: "USDC",
|
|
22018
|
-
value: formatUsdcBalance(
|
|
22018
|
+
value: formatUsdcBalance(ottorouterUsdcBalance)
|
|
22019
22019
|
})
|
|
22020
22020
|
]
|
|
22021
22021
|
})
|
|
@@ -24940,17 +24940,17 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
24940
24940
|
const copilotCancelledRef = useRef31(false);
|
|
24941
24941
|
const copilotPollFnRef = useRef31(onPollCopilotDeviceFlow);
|
|
24942
24942
|
copilotPollFnRef.current = onPollCopilotDeviceFlow;
|
|
24943
|
-
const balance =
|
|
24944
|
-
const usdcBalance =
|
|
24945
|
-
const payg =
|
|
24946
|
-
const subscription =
|
|
24947
|
-
const isBalanceLoading =
|
|
24943
|
+
const balance = useOttoRouterStore((s) => s.balance);
|
|
24944
|
+
const usdcBalance = useOttoRouterStore((s) => s.usdcBalance);
|
|
24945
|
+
const payg = useOttoRouterStore((s) => s.payg);
|
|
24946
|
+
const subscription = useOttoRouterStore((s) => s.subscription);
|
|
24947
|
+
const isBalanceLoading = useOttoRouterStore((s) => s.isLoading);
|
|
24948
24948
|
const apiKeyInputRef = useRef31(null);
|
|
24949
24949
|
const oauthCodeInputRef = useRef31(null);
|
|
24950
24950
|
const importPrivateKeyRef = useRef31(null);
|
|
24951
|
-
const isTopupModalOpen =
|
|
24951
|
+
const isTopupModalOpen = useOttoRouterStore((s) => s.isTopupModalOpen);
|
|
24952
24952
|
const prevTopupModalOpen = useRef31(false);
|
|
24953
|
-
const { fetchBalance } =
|
|
24953
|
+
const { fetchBalance } = useOttoRouterBalance("ottorouter");
|
|
24954
24954
|
const effectivePayg = payg?.effectiveSpendableUsd ?? balance ?? 0;
|
|
24955
24955
|
const setuStatusLabel = subscription?.active ? `GO ${(subscription.creditsRemaining ?? 0).toFixed(1)} credits` : `$${effectivePayg.toFixed(2)}`;
|
|
24956
24956
|
useEffect46(() => {
|
|
@@ -24960,11 +24960,11 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
24960
24960
|
prevTopupModalOpen.current = isTopupModalOpen;
|
|
24961
24961
|
}, [isTopupModalOpen, fetchBalance]);
|
|
24962
24962
|
useEffect46(() => {
|
|
24963
|
-
if (!authStatus.
|
|
24963
|
+
if (!authStatus.ottorouter.configured && !isSettingUp) {
|
|
24964
24964
|
setIsSettingUp(true);
|
|
24965
24965
|
onSetupWallet().finally(() => setIsSettingUp(false));
|
|
24966
24966
|
}
|
|
24967
|
-
}, [authStatus.
|
|
24967
|
+
}, [authStatus.ottorouter.configured, onSetupWallet, isSettingUp]);
|
|
24968
24968
|
useEffect46(() => {
|
|
24969
24969
|
if (addingProvider && apiKeyInputRef.current) {
|
|
24970
24970
|
apiKeyInputRef.current.focus();
|
|
@@ -25026,8 +25026,8 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
25026
25026
|
};
|
|
25027
25027
|
}, [copilotPolling, copilotDevice]);
|
|
25028
25028
|
const handleCopy = async () => {
|
|
25029
|
-
if (authStatus.
|
|
25030
|
-
await navigator.clipboard.writeText(authStatus.
|
|
25029
|
+
if (authStatus.ottorouter.publicKey) {
|
|
25030
|
+
await navigator.clipboard.writeText(authStatus.ottorouter.publicKey);
|
|
25031
25031
|
setCopied(true);
|
|
25032
25032
|
setTimeout(() => setCopied(false), 2000);
|
|
25033
25033
|
}
|
|
@@ -25217,8 +25217,8 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
25217
25217
|
setIsImportingWallet(false);
|
|
25218
25218
|
}
|
|
25219
25219
|
};
|
|
25220
|
-
const configuredProviders = Object.entries(authStatus.providers).filter(([id, info]) => info.configured && id !== "
|
|
25221
|
-
const unconfiguredProviders = Object.entries(authStatus.providers).filter(([id, info]) => !info.configured && id !== "
|
|
25220
|
+
const configuredProviders = Object.entries(authStatus.providers).filter(([id, info]) => info.configured && id !== "ottorouter");
|
|
25221
|
+
const unconfiguredProviders = Object.entries(authStatus.providers).filter(([id, info]) => !info.configured && id !== "ottorouter");
|
|
25222
25222
|
return /* @__PURE__ */ jsxs91("div", {
|
|
25223
25223
|
className: "min-h-screen flex flex-col",
|
|
25224
25224
|
children: [
|
|
@@ -25229,7 +25229,7 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
25229
25229
|
className: "flex items-center gap-3",
|
|
25230
25230
|
children: [
|
|
25231
25231
|
/* @__PURE__ */ jsx102(ProviderLogo, {
|
|
25232
|
-
provider: "
|
|
25232
|
+
provider: "ottorouter",
|
|
25233
25233
|
size: 24
|
|
25234
25234
|
}),
|
|
25235
25235
|
/* @__PURE__ */ jsx102("span", {
|
|
@@ -25273,14 +25273,14 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
25273
25273
|
/* @__PURE__ */ jsx102("div", {
|
|
25274
25274
|
children: /* @__PURE__ */ jsx102("div", {
|
|
25275
25275
|
className: "bg-card rounded-2xl border border-border p-5",
|
|
25276
|
-
children: authStatus.
|
|
25276
|
+
children: authStatus.ottorouter.configured && authStatus.ottorouter.publicKey ? /* @__PURE__ */ jsxs91("div", {
|
|
25277
25277
|
className: "flex flex-col h-full",
|
|
25278
25278
|
children: [
|
|
25279
25279
|
/* @__PURE__ */ jsxs91("div", {
|
|
25280
25280
|
className: "flex items-center gap-2 px-3 py-2 bg-green-500/10 border border-green-500/20 rounded-lg",
|
|
25281
25281
|
children: [
|
|
25282
25282
|
/* @__PURE__ */ jsx102(ProviderLogo, {
|
|
25283
|
-
provider: "
|
|
25283
|
+
provider: "ottorouter",
|
|
25284
25284
|
size: 16
|
|
25285
25285
|
}),
|
|
25286
25286
|
/* @__PURE__ */ jsx102("span", {
|
|
@@ -25298,7 +25298,7 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
25298
25298
|
children: /* @__PURE__ */ jsx102("div", {
|
|
25299
25299
|
className: "bg-white p-2 rounded-lg",
|
|
25300
25300
|
children: /* @__PURE__ */ jsx102(QRCodeSVG3, {
|
|
25301
|
-
value: authStatus.
|
|
25301
|
+
value: authStatus.ottorouter.publicKey,
|
|
25302
25302
|
size: 140,
|
|
25303
25303
|
level: "M"
|
|
25304
25304
|
})
|
|
@@ -25312,7 +25312,7 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
25312
25312
|
onClick: handleCopy,
|
|
25313
25313
|
className: "w-full flex items-center justify-center gap-2 px-3 py-2 bg-muted hover:bg-muted/80 rounded-lg text-xs font-mono text-muted-foreground transition-colors",
|
|
25314
25314
|
children: [
|
|
25315
|
-
truncateAddress(authStatus.
|
|
25315
|
+
truncateAddress(authStatus.ottorouter.publicKey),
|
|
25316
25316
|
copied ? /* @__PURE__ */ jsx102(Check13, {
|
|
25317
25317
|
className: "w-3.5 h-3.5 text-green-500"
|
|
25318
25318
|
}) : /* @__PURE__ */ jsx102(Copy5, {
|
|
@@ -25469,7 +25469,7 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
25469
25469
|
children: "No"
|
|
25470
25470
|
})
|
|
25471
25471
|
]
|
|
25472
|
-
}) : id !== "
|
|
25472
|
+
}) : id !== "ottorouter" && /* @__PURE__ */ jsx102("button", {
|
|
25473
25473
|
type: "button",
|
|
25474
25474
|
onClick: () => handleRemoveProvider(id),
|
|
25475
25475
|
className: "ml-1 p-1 text-green-600/40 dark:text-green-500/40 hover:text-green-600/80 dark:hover:text-green-500/80 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
@@ -25641,7 +25641,7 @@ var ProviderSetupStep = memo45(function ProviderSetupStep2({
|
|
|
25641
25641
|
className: "flex items-center gap-3 p-6 border-b border-border",
|
|
25642
25642
|
children: [
|
|
25643
25643
|
/* @__PURE__ */ jsx102(ProviderLogo, {
|
|
25644
|
-
provider: "
|
|
25644
|
+
provider: "ottorouter",
|
|
25645
25645
|
size: 24
|
|
25646
25646
|
}),
|
|
25647
25647
|
/* @__PURE__ */ jsx102("h3", {
|
|
@@ -25997,7 +25997,7 @@ var DefaultsStep = memo46(function DefaultsStep2({
|
|
|
25997
25997
|
const [allModels, setAllModels] = useState45(null);
|
|
25998
25998
|
const [isLoading, setIsLoading] = useState45(true);
|
|
25999
25999
|
const [isSaving, setIsSaving] = useState45(false);
|
|
26000
|
-
const [selectedProvider, setSelectedProvider] = useState45("
|
|
26000
|
+
const [selectedProvider, setSelectedProvider] = useState45("ottorouter");
|
|
26001
26001
|
const [selectedModel, setSelectedModel] = useState45("kimi-k2.5");
|
|
26002
26002
|
const [selectedAgent, setSelectedAgent] = useState45(authStatus.defaults.agent || "build");
|
|
26003
26003
|
const [selectedApproval, setSelectedApproval] = useState45(authStatus.defaults.toolApproval || "dangerous");
|
|
@@ -26016,10 +26016,10 @@ var DefaultsStep = memo46(function DefaultsStep2({
|
|
|
26016
26016
|
]);
|
|
26017
26017
|
setConfig(configData);
|
|
26018
26018
|
setAllModels(modelsData);
|
|
26019
|
-
const cfgProvider = configData?.defaults?.provider || "
|
|
26019
|
+
const cfgProvider = configData?.defaults?.provider || "ottorouter";
|
|
26020
26020
|
const cfgModel = configData?.defaults?.model || "kimi-k2.5";
|
|
26021
26021
|
const providerHasModels = modelsData?.[cfgProvider]?.models?.length > 0;
|
|
26022
|
-
const resolvedProvider = providerHasModels ? cfgProvider : "
|
|
26022
|
+
const resolvedProvider = providerHasModels ? cfgProvider : "ottorouter";
|
|
26023
26023
|
const resolvedModel = providerHasModels && modelsData[cfgProvider].models.some((m) => m.id === cfgModel) ? cfgModel : modelsData?.[resolvedProvider]?.models?.[0]?.id || "kimi-k2.5";
|
|
26024
26024
|
setSelectedProvider(resolvedProvider);
|
|
26025
26025
|
setSelectedModel(resolvedModel);
|
|
@@ -26079,7 +26079,7 @@ var DefaultsStep = memo46(function DefaultsStep2({
|
|
|
26079
26079
|
})
|
|
26080
26080
|
});
|
|
26081
26081
|
}
|
|
26082
|
-
const availableProviders = config2?.providers.filter((p) => (authStatus.providers[p]?.configured || p === "
|
|
26082
|
+
const availableProviders = config2?.providers.filter((p) => (authStatus.providers[p]?.configured || p === "ottorouter") && allModels?.[p]?.models?.length > 0) || ["ottorouter"];
|
|
26083
26083
|
const currentProviderModels = allModels?.[selectedProvider]?.models || [];
|
|
26084
26084
|
return /* @__PURE__ */ jsxs92("div", {
|
|
26085
26085
|
className: "min-h-screen flex flex-col",
|
|
@@ -26091,7 +26091,7 @@ var DefaultsStep = memo46(function DefaultsStep2({
|
|
|
26091
26091
|
className: "flex items-center gap-3",
|
|
26092
26092
|
children: [
|
|
26093
26093
|
/* @__PURE__ */ jsx103(ProviderLogo, {
|
|
26094
|
-
provider: "
|
|
26094
|
+
provider: "ottorouter",
|
|
26095
26095
|
size: 24
|
|
26096
26096
|
}),
|
|
26097
26097
|
/* @__PURE__ */ jsx103("span", {
|
|
@@ -26354,7 +26354,7 @@ var OnboardingModal = memo47(function OnboardingModal2({
|
|
|
26354
26354
|
const nextStep = useOnboardingStore((s) => s.nextStep);
|
|
26355
26355
|
const prevStep = useOnboardingStore((s) => s.prevStep);
|
|
26356
26356
|
const reset = useOnboardingStore((s) => s.reset);
|
|
26357
|
-
const openTopupModal =
|
|
26357
|
+
const openTopupModal = useOttoRouterStore((s) => s.openTopupModal);
|
|
26358
26358
|
const {
|
|
26359
26359
|
setupWallet,
|
|
26360
26360
|
importWallet,
|
|
@@ -26938,8 +26938,8 @@ import { useEffect as useEffect52, useRef as useRef33 } from "react";
|
|
|
26938
26938
|
function useSetuPayments(sessionId) {
|
|
26939
26939
|
const clientRef = useRef33(null);
|
|
26940
26940
|
const loadingToastIdRef = useRef33(null);
|
|
26941
|
-
const setBalance =
|
|
26942
|
-
const setPaymentPending =
|
|
26941
|
+
const setBalance = useOttoRouterStore((s) => s.setBalance);
|
|
26942
|
+
const setPaymentPending = useOttoRouterStore((s) => s.setPaymentPending);
|
|
26943
26943
|
const removeToast = useToastStore((s) => s.removeToast);
|
|
26944
26944
|
const updateToast = useToastStore((s) => s.updateToast);
|
|
26945
26945
|
const setPendingTopup = useTopupApprovalStore((s) => s.setPendingTopup);
|
|
@@ -26954,7 +26954,7 @@ function useSetuPayments(sessionId) {
|
|
|
26954
26954
|
const unsubscribe = client3.on("*", (event) => {
|
|
26955
26955
|
const payload = event.payload;
|
|
26956
26956
|
switch (event.type) {
|
|
26957
|
-
case "
|
|
26957
|
+
case "ottorouter.topup.required": {
|
|
26958
26958
|
const amountUsd = typeof payload?.amountUsd === "number" ? payload.amountUsd : 0;
|
|
26959
26959
|
const currentBalance = typeof payload?.currentBalance === "number" ? payload.currentBalance : 0;
|
|
26960
26960
|
const minTopupUsd = typeof payload?.minTopupUsd === "number" ? payload.minTopupUsd : 5;
|
|
@@ -26970,7 +26970,7 @@ function useSetuPayments(sessionId) {
|
|
|
26970
26970
|
});
|
|
26971
26971
|
break;
|
|
26972
26972
|
}
|
|
26973
|
-
case "
|
|
26973
|
+
case "ottorouter.topup.method_selected": {
|
|
26974
26974
|
const method = payload?.method;
|
|
26975
26975
|
if (method === "crypto") {
|
|
26976
26976
|
setPaymentPending(true);
|
|
@@ -26978,13 +26978,13 @@ function useSetuPayments(sessionId) {
|
|
|
26978
26978
|
}
|
|
26979
26979
|
break;
|
|
26980
26980
|
}
|
|
26981
|
-
case "
|
|
26981
|
+
case "ottorouter.topup.cancelled": {
|
|
26982
26982
|
clearPendingTopup();
|
|
26983
26983
|
const reason = typeof payload?.reason === "string" ? payload.reason : "Request cancelled";
|
|
26984
26984
|
toast(`⚠️ ${reason}`);
|
|
26985
26985
|
break;
|
|
26986
26986
|
}
|
|
26987
|
-
case "
|
|
26987
|
+
case "ottorouter.payment.required": {
|
|
26988
26988
|
const amountUsd = typeof payload?.amountUsd === "number" ? payload.amountUsd : 0;
|
|
26989
26989
|
setPaymentPending(true);
|
|
26990
26990
|
if (!loadingToastIdRef.current) {
|
|
@@ -26992,7 +26992,7 @@ function useSetuPayments(sessionId) {
|
|
|
26992
26992
|
}
|
|
26993
26993
|
break;
|
|
26994
26994
|
}
|
|
26995
|
-
case "
|
|
26995
|
+
case "ottorouter.payment.signing": {
|
|
26996
26996
|
if (loadingToastIdRef.current) {
|
|
26997
26997
|
updateToast(loadingToastIdRef.current, {
|
|
26998
26998
|
message: "✍️ Signing transaction..."
|
|
@@ -27002,7 +27002,7 @@ function useSetuPayments(sessionId) {
|
|
|
27002
27002
|
}
|
|
27003
27003
|
break;
|
|
27004
27004
|
}
|
|
27005
|
-
case "
|
|
27005
|
+
case "ottorouter.payment.complete": {
|
|
27006
27006
|
clearPendingTopup();
|
|
27007
27007
|
const rawAmount = payload?.amountUsd;
|
|
27008
27008
|
const rawBalance = payload?.newBalance;
|
|
@@ -27026,7 +27026,7 @@ function useSetuPayments(sessionId) {
|
|
|
27026
27026
|
}
|
|
27027
27027
|
break;
|
|
27028
27028
|
}
|
|
27029
|
-
case "
|
|
27029
|
+
case "ottorouter.fiat.checkout_created": {
|
|
27030
27030
|
clearPendingTopup();
|
|
27031
27031
|
setPaymentPending(false);
|
|
27032
27032
|
if (loadingToastIdRef.current) {
|
|
@@ -27036,7 +27036,7 @@ function useSetuPayments(sessionId) {
|
|
|
27036
27036
|
toast.success("\uD83D\uDCB3 Complete payment, then retry your message");
|
|
27037
27037
|
break;
|
|
27038
27038
|
}
|
|
27039
|
-
case "
|
|
27039
|
+
case "ottorouter.balance.updated": {
|
|
27040
27040
|
const rawBalance = payload?.balanceRemaining;
|
|
27041
27041
|
const newBalance = typeof rawBalance === "number" ? rawBalance : typeof rawBalance === "string" ? parseFloat(rawBalance) : null;
|
|
27042
27042
|
if (newBalance !== null && !Number.isNaN(newBalance)) {
|
|
@@ -27044,7 +27044,7 @@ function useSetuPayments(sessionId) {
|
|
|
27044
27044
|
}
|
|
27045
27045
|
break;
|
|
27046
27046
|
}
|
|
27047
|
-
case "
|
|
27047
|
+
case "ottorouter.payment.error": {
|
|
27048
27048
|
clearPendingTopup();
|
|
27049
27049
|
const error = typeof payload?.error === "string" ? payload.error : "Payment failed";
|
|
27050
27050
|
setPaymentPending(false);
|
|
@@ -27101,9 +27101,7 @@ export {
|
|
|
27101
27101
|
useSkillDetail,
|
|
27102
27102
|
useSidebarStore,
|
|
27103
27103
|
useShareStatus,
|
|
27104
|
-
useSetuStore,
|
|
27105
27104
|
useSetuPayments,
|
|
27106
|
-
useSetuBalance,
|
|
27107
27105
|
useSettingsStore,
|
|
27108
27106
|
useSessionsInfinite,
|
|
27109
27107
|
useSessions,
|
|
@@ -27127,6 +27125,8 @@ export {
|
|
|
27127
27125
|
usePendingResearchStore,
|
|
27128
27126
|
useParentSession,
|
|
27129
27127
|
usePanelWidthStore,
|
|
27128
|
+
useOttoRouterStore,
|
|
27129
|
+
useOttoRouterBalance,
|
|
27130
27130
|
useOnboardingStore,
|
|
27131
27131
|
useModels,
|
|
27132
27132
|
useMessages,
|
|
@@ -27196,7 +27196,6 @@ export {
|
|
|
27196
27196
|
SkillsSidebarToggle,
|
|
27197
27197
|
SkillsSidebar,
|
|
27198
27198
|
SkillViewerPanel,
|
|
27199
|
-
SetuTopupModal,
|
|
27200
27199
|
SettingsSidebarToggle,
|
|
27201
27200
|
SettingsSidebar,
|
|
27202
27201
|
SessionListContainer,
|
|
@@ -27213,6 +27212,7 @@ export {
|
|
|
27213
27212
|
QuickFilePicker,
|
|
27214
27213
|
ProviderSetupStep,
|
|
27215
27214
|
ProviderLogo,
|
|
27215
|
+
OttoRouterTopupModal,
|
|
27216
27216
|
OnboardingModal,
|
|
27217
27217
|
NewSessionLanding,
|
|
27218
27218
|
MessageThreadContainer,
|
|
@@ -27247,4 +27247,4 @@ export {
|
|
|
27247
27247
|
API_BASE_URL
|
|
27248
27248
|
};
|
|
27249
27249
|
|
|
27250
|
-
//# debugId=
|
|
27250
|
+
//# debugId=9C514795CD6F4E2764756E2164756E21
|