@djangocfg/ext-payments 1.0.21 → 1.0.23
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/config.cjs +14 -5
- package/dist/config.js +14 -5
- package/dist/i18n.cjs +434 -0
- package/dist/i18n.d.cts +172 -0
- package/dist/i18n.d.ts +172 -0
- package/dist/i18n.js +406 -0
- package/dist/index.cjs +653 -113
- package/dist/index.js +654 -114
- package/package.json +22 -13
- package/src/components/ActivityList.tsx +15 -4
- package/src/components/AddFundsSheet.tsx +34 -14
- package/src/components/BalanceHero.tsx +17 -5
- package/src/components/CurrencyCombobox.tsx +13 -3
- package/src/components/PaymentSheet.tsx +72 -29
- package/src/components/WithdrawSheet.tsx +36 -15
- package/src/components/WithdrawalSheet.tsx +75 -32
- package/src/i18n/index.ts +26 -0
- package/src/i18n/locales/en.ts +136 -0
- package/src/i18n/locales/ko.ts +136 -0
- package/src/i18n/locales/ru.ts +136 -0
- package/src/i18n/types.ts +169 -0
- package/src/i18n/usePaymentsT.ts +60 -0
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext,
|
|
1
|
+
import { createContext, useMemo, useState, useCallback, useEffect, useContext, useRef } from 'react';
|
|
2
2
|
import { initializeExtensionAPI, createExtensionAPI } from '@djangocfg/ext-base/api';
|
|
3
3
|
import { createConsola, consola } from 'consola';
|
|
4
4
|
import pRetry, { AbortError } from 'p-retry';
|
|
@@ -6,6 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
import useSWR, { useSWRConfig } from 'swr';
|
|
7
7
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
8
8
|
import { Plus, ArrowUpRight, RefreshCw, AlertCircle, XCircle, CheckCircle2, Loader2, Clock, ArrowDownLeft, History, ChevronRight, Ban, ExternalLink } from 'lucide-react';
|
|
9
|
+
import { useLocale } from 'next-intl';
|
|
9
10
|
import { Skeleton, Button, TokenIcon, useLocalStorage, ResponsiveSheet, ResponsiveSheetContent, ResponsiveSheetHeader, ResponsiveSheetTitle, ResponsiveSheetDescription, Form, FormField, FormItem, FormLabel, FormControl, Input, FormMessage, Alert, AlertDescription, CopyButton, Combobox } from '@djangocfg/ui-core';
|
|
10
11
|
import { cn } from '@djangocfg/ui-core/lib';
|
|
11
12
|
import moment3 from 'moment';
|
|
@@ -2045,8 +2046,411 @@ function mapWithdrawalStatus(status) {
|
|
|
2045
2046
|
return "pending";
|
|
2046
2047
|
}
|
|
2047
2048
|
}
|
|
2049
|
+
|
|
2050
|
+
// src/i18n/locales/en.ts
|
|
2051
|
+
var en = {
|
|
2052
|
+
balance: {
|
|
2053
|
+
available: "Available Balance",
|
|
2054
|
+
totalDeposited: "Total Deposited",
|
|
2055
|
+
totalWithdrawn: "Total Withdrawn"
|
|
2056
|
+
},
|
|
2057
|
+
actions: {
|
|
2058
|
+
addFunds: "Add Funds",
|
|
2059
|
+
withdraw: "Withdraw",
|
|
2060
|
+
continue: "Continue",
|
|
2061
|
+
requestWithdrawal: "Request Withdrawal",
|
|
2062
|
+
cancel: "Cancel",
|
|
2063
|
+
close: "Close",
|
|
2064
|
+
copyAddress: "Copy Address",
|
|
2065
|
+
copied: "Copied!",
|
|
2066
|
+
viewAll: "View All",
|
|
2067
|
+
tryAgain: "Try Again",
|
|
2068
|
+
refreshStatus: "Refresh Status",
|
|
2069
|
+
createNewPayment: "Create New Payment",
|
|
2070
|
+
openInPaymentProvider: "Open in Payment Provider"
|
|
2071
|
+
},
|
|
2072
|
+
paymentStatus: {
|
|
2073
|
+
waiting: "Waiting for payment",
|
|
2074
|
+
confirming: "Confirming",
|
|
2075
|
+
completed: "Completed",
|
|
2076
|
+
failed: "Failed",
|
|
2077
|
+
expired: "Expired",
|
|
2078
|
+
paymentExpired: "Payment Expired"
|
|
2079
|
+
},
|
|
2080
|
+
withdrawalStatus: {
|
|
2081
|
+
pending: "Pending Approval",
|
|
2082
|
+
approved: "Approved",
|
|
2083
|
+
processing: "Processing",
|
|
2084
|
+
completed: "Completed",
|
|
2085
|
+
rejected: "Rejected",
|
|
2086
|
+
cancelled: "Cancelled"
|
|
2087
|
+
},
|
|
2088
|
+
paymentDescriptions: {
|
|
2089
|
+
sendCrypto: "Send cryptocurrency to complete payment",
|
|
2090
|
+
expired: "This payment has expired",
|
|
2091
|
+
completed: "Payment completed successfully",
|
|
2092
|
+
failed: "Payment failed",
|
|
2093
|
+
confirming: "Confirming your payment",
|
|
2094
|
+
createNew: "Please create a new payment to continue"
|
|
2095
|
+
},
|
|
2096
|
+
withdrawalDescriptions: {
|
|
2097
|
+
pendingApproval: "Waiting for admin approval",
|
|
2098
|
+
processing: "Your withdrawal is being processed",
|
|
2099
|
+
completed: "Withdrawal completed successfully",
|
|
2100
|
+
rejected: "Withdrawal was rejected",
|
|
2101
|
+
cancelled: "Withdrawal was cancelled"
|
|
2102
|
+
},
|
|
2103
|
+
form: {
|
|
2104
|
+
amount: "Amount",
|
|
2105
|
+
amountUsd: "Amount (USD)",
|
|
2106
|
+
currency: "Currency",
|
|
2107
|
+
walletAddress: "Wallet Address",
|
|
2108
|
+
selectCurrency: "Select currency...",
|
|
2109
|
+
enterWalletAddress: "Enter your wallet address",
|
|
2110
|
+
search: "Search...",
|
|
2111
|
+
payWith: "Pay with",
|
|
2112
|
+
withdrawAs: "Withdraw as",
|
|
2113
|
+
amountToSend: "Amount to send",
|
|
2114
|
+
equivalent: "Equivalent",
|
|
2115
|
+
network: "Network",
|
|
2116
|
+
paymentAddress: "Payment Address",
|
|
2117
|
+
transactionHash: "Transaction Hash",
|
|
2118
|
+
paymentId: "Payment ID",
|
|
2119
|
+
orderId: "Order #",
|
|
2120
|
+
created: "Created"
|
|
2121
|
+
},
|
|
2122
|
+
validation: {
|
|
2123
|
+
minimumDeposit: "Minimum $1",
|
|
2124
|
+
minimumWithdrawal: "Minimum $10",
|
|
2125
|
+
selectCurrency: "Select a currency",
|
|
2126
|
+
invalidWalletAddress: "Invalid wallet address"
|
|
2127
|
+
},
|
|
2128
|
+
messages: {
|
|
2129
|
+
paymentCreated: "Payment created successfully",
|
|
2130
|
+
paymentFailed: "Failed to create payment",
|
|
2131
|
+
withdrawalCreated: "Withdrawal request created",
|
|
2132
|
+
withdrawalFailed: "Failed to create withdrawal request",
|
|
2133
|
+
withdrawalCancelled: "Withdrawal cancelled",
|
|
2134
|
+
addressCopied: "Address copied to clipboard",
|
|
2135
|
+
failedToLoadPayment: "Failed to load payment",
|
|
2136
|
+
failedToCreateWithdrawal: "Failed to create withdrawal request"
|
|
2137
|
+
},
|
|
2138
|
+
sheets: {
|
|
2139
|
+
addFundsTitle: "Add Funds",
|
|
2140
|
+
addFundsDescription: "Add funds to your wallet using cryptocurrency",
|
|
2141
|
+
withdrawTitle: "Withdraw",
|
|
2142
|
+
withdrawDescription: "Withdraw funds to your cryptocurrency wallet",
|
|
2143
|
+
paymentTitle: "Payment Details",
|
|
2144
|
+
withdrawalTitle: "Withdrawal Details"
|
|
2145
|
+
},
|
|
2146
|
+
activity: {
|
|
2147
|
+
title: "Recent Activity",
|
|
2148
|
+
noActivity: "No Activity Yet",
|
|
2149
|
+
deposit: "Deposit",
|
|
2150
|
+
withdrawal: "Withdrawal",
|
|
2151
|
+
payment: "Payment",
|
|
2152
|
+
transactionsWillAppear: "Your transactions will appear here"
|
|
2153
|
+
},
|
|
2154
|
+
estimate: {
|
|
2155
|
+
gettingRate: "Getting rate...",
|
|
2156
|
+
calculating: "Calculating fees...",
|
|
2157
|
+
enterAmountToSee: "Enter amount to see conversion",
|
|
2158
|
+
youWillSend: "You will send",
|
|
2159
|
+
youWillReceive: "You will receive",
|
|
2160
|
+
serviceFee: "Service fee",
|
|
2161
|
+
networkFee: "Network fee",
|
|
2162
|
+
rate: "Rate",
|
|
2163
|
+
minimumAmount: "Minimum amount"
|
|
2164
|
+
},
|
|
2165
|
+
withdraw: {
|
|
2166
|
+
insufficientBalance: "Insufficient balance",
|
|
2167
|
+
approvalWarning: "Withdrawal requests require admin approval. Processing may take 24-48 hours.",
|
|
2168
|
+
submitting: "Submitting...",
|
|
2169
|
+
creating: "Creating...",
|
|
2170
|
+
expiresIn: "Expires in"
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
|
|
2174
|
+
// src/i18n/locales/ru.ts
|
|
2175
|
+
var ru = {
|
|
2176
|
+
balance: {
|
|
2177
|
+
available: "\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0439 \u0431\u0430\u043B\u0430\u043D\u0441",
|
|
2178
|
+
totalDeposited: "\u0412\u0441\u0435\u0433\u043E \u0432\u043D\u0435\u0441\u0435\u043D\u043E",
|
|
2179
|
+
totalWithdrawn: "\u0412\u0441\u0435\u0433\u043E \u0432\u044B\u0432\u0435\u0434\u0435\u043D\u043E"
|
|
2180
|
+
},
|
|
2181
|
+
actions: {
|
|
2182
|
+
addFunds: "\u041F\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u044C",
|
|
2183
|
+
withdraw: "\u0412\u044B\u0432\u0435\u0441\u0442\u0438",
|
|
2184
|
+
continue: "\u041F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C",
|
|
2185
|
+
requestWithdrawal: "\u0417\u0430\u043F\u0440\u043E\u0441\u0438\u0442\u044C \u0432\u044B\u0432\u043E\u0434",
|
|
2186
|
+
cancel: "\u041E\u0442\u043C\u0435\u043D\u0430",
|
|
2187
|
+
close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
|
|
2188
|
+
copyAddress: "\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0430\u0434\u0440\u0435\u0441",
|
|
2189
|
+
copied: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D\u043E!",
|
|
2190
|
+
viewAll: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0432\u0441\u0435",
|
|
2191
|
+
tryAgain: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430",
|
|
2192
|
+
refreshStatus: "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u0442\u0430\u0442\u0443\u0441",
|
|
2193
|
+
createNewPayment: "\u0421\u043E\u0437\u0434\u0430\u0442\u044C \u043D\u043E\u0432\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436",
|
|
2194
|
+
openInPaymentProvider: "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0443 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430"
|
|
2195
|
+
},
|
|
2196
|
+
paymentStatus: {
|
|
2197
|
+
waiting: "\u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u043E\u043F\u043B\u0430\u0442\u044B",
|
|
2198
|
+
confirming: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435",
|
|
2199
|
+
completed: "\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E",
|
|
2200
|
+
failed: "\u041E\u0448\u0438\u0431\u043A\u0430",
|
|
2201
|
+
expired: "\u0418\u0441\u0442\u0435\u043A\u043B\u043E",
|
|
2202
|
+
paymentExpired: "\u041F\u043B\u0430\u0442\u0451\u0436 \u0438\u0441\u0442\u0451\u043A"
|
|
2203
|
+
},
|
|
2204
|
+
withdrawalStatus: {
|
|
2205
|
+
pending: "\u041E\u0436\u0438\u0434\u0430\u0435\u0442 \u043E\u0434\u043E\u0431\u0440\u0435\u043D\u0438\u044F",
|
|
2206
|
+
approved: "\u041E\u0434\u043E\u0431\u0440\u0435\u043D\u043E",
|
|
2207
|
+
processing: "\u041E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430",
|
|
2208
|
+
completed: "\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u043E",
|
|
2209
|
+
rejected: "\u041E\u0442\u043A\u043B\u043E\u043D\u0435\u043D\u043E",
|
|
2210
|
+
cancelled: "\u041E\u0442\u043C\u0435\u043D\u0435\u043D\u043E"
|
|
2211
|
+
},
|
|
2212
|
+
paymentDescriptions: {
|
|
2213
|
+
sendCrypto: "\u041E\u0442\u043F\u0440\u0430\u0432\u044C\u0442\u0435 \u043A\u0440\u0438\u043F\u0442\u043E\u0432\u0430\u043B\u044E\u0442\u0443 \u0434\u043B\u044F \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043D\u0438\u044F \u043F\u043B\u0430\u0442\u0435\u0436\u0430",
|
|
2214
|
+
expired: "\u0421\u0440\u043E\u043A \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u043F\u043B\u0430\u0442\u0435\u0436\u0430 \u0438\u0441\u0442\u0451\u043A",
|
|
2215
|
+
completed: "\u041F\u043B\u0430\u0442\u0451\u0436 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D",
|
|
2216
|
+
failed: "\u041F\u043B\u0430\u0442\u0451\u0436 \u043D\u0435 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D",
|
|
2217
|
+
confirming: "\u041F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u0435 \u043F\u043B\u0430\u0442\u0435\u0436\u0430",
|
|
2218
|
+
createNew: "\u0421\u043E\u0437\u0434\u0430\u0439\u0442\u0435 \u043D\u043E\u0432\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436 \u0434\u043B\u044F \u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0435\u043D\u0438\u044F"
|
|
2219
|
+
},
|
|
2220
|
+
withdrawalDescriptions: {
|
|
2221
|
+
pendingApproval: "\u041E\u0436\u0438\u0434\u0430\u043D\u0438\u0435 \u043E\u0434\u043E\u0431\u0440\u0435\u043D\u0438\u044F \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430",
|
|
2222
|
+
processing: "\u0412\u0430\u0448 \u0432\u044B\u0432\u043E\u0434 \u043E\u0431\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F",
|
|
2223
|
+
completed: "\u0412\u044B\u0432\u043E\u0434 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D",
|
|
2224
|
+
rejected: "\u0412\u044B\u0432\u043E\u0434 \u0431\u044B\u043B \u043E\u0442\u043A\u043B\u043E\u043D\u0451\u043D",
|
|
2225
|
+
cancelled: "\u0412\u044B\u0432\u043E\u0434 \u0431\u044B\u043B \u043E\u0442\u043C\u0435\u043D\u0451\u043D"
|
|
2226
|
+
},
|
|
2227
|
+
form: {
|
|
2228
|
+
amount: "\u0421\u0443\u043C\u043C\u0430",
|
|
2229
|
+
amountUsd: "\u0421\u0443\u043C\u043C\u0430 (USD)",
|
|
2230
|
+
currency: "\u0412\u0430\u043B\u044E\u0442\u0430",
|
|
2231
|
+
walletAddress: "\u0410\u0434\u0440\u0435\u0441 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430",
|
|
2232
|
+
selectCurrency: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u043B\u044E\u0442\u0443...",
|
|
2233
|
+
enterWalletAddress: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430",
|
|
2234
|
+
search: "\u041F\u043E\u0438\u0441\u043A...",
|
|
2235
|
+
payWith: "\u041E\u043F\u043B\u0430\u0442\u0438\u0442\u044C \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E",
|
|
2236
|
+
withdrawAs: "\u0412\u044B\u0432\u0435\u0441\u0442\u0438 \u043A\u0430\u043A",
|
|
2237
|
+
amountToSend: "\u0421\u0443\u043C\u043C\u0430 \u043A \u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0435",
|
|
2238
|
+
equivalent: "\u042D\u043A\u0432\u0438\u0432\u0430\u043B\u0435\u043D\u0442",
|
|
2239
|
+
network: "\u0421\u0435\u0442\u044C",
|
|
2240
|
+
paymentAddress: "\u0410\u0434\u0440\u0435\u0441 \u0434\u043B\u044F \u043E\u043F\u043B\u0430\u0442\u044B",
|
|
2241
|
+
transactionHash: "\u0425\u0435\u0448 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438",
|
|
2242
|
+
paymentId: "ID \u043F\u043B\u0430\u0442\u0435\u0436\u0430",
|
|
2243
|
+
orderId: "\u0417\u0430\u043A\u0430\u0437 \u2116",
|
|
2244
|
+
created: "\u0421\u043E\u0437\u0434\u0430\u043D\u043E"
|
|
2245
|
+
},
|
|
2246
|
+
validation: {
|
|
2247
|
+
minimumDeposit: "\u041C\u0438\u043D\u0438\u043C\u0443\u043C $1",
|
|
2248
|
+
minimumWithdrawal: "\u041C\u0438\u043D\u0438\u043C\u0443\u043C $10",
|
|
2249
|
+
selectCurrency: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0432\u0430\u043B\u044E\u0442\u0443",
|
|
2250
|
+
invalidWalletAddress: "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 \u0430\u0434\u0440\u0435\u0441 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430"
|
|
2251
|
+
},
|
|
2252
|
+
messages: {
|
|
2253
|
+
paymentCreated: "\u041F\u043B\u0430\u0442\u0451\u0436 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0441\u043E\u0437\u0434\u0430\u043D",
|
|
2254
|
+
paymentFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u043F\u043B\u0430\u0442\u0451\u0436",
|
|
2255
|
+
withdrawalCreated: "\u0417\u0430\u043F\u0440\u043E\u0441 \u043D\u0430 \u0432\u044B\u0432\u043E\u0434 \u0441\u043E\u0437\u0434\u0430\u043D",
|
|
2256
|
+
withdrawalFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441 \u043D\u0430 \u0432\u044B\u0432\u043E\u0434",
|
|
2257
|
+
withdrawalCancelled: "\u0412\u044B\u0432\u043E\u0434 \u043E\u0442\u043C\u0435\u043D\u0451\u043D",
|
|
2258
|
+
addressCopied: "\u0410\u0434\u0440\u0435\u0441 \u0441\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u043D",
|
|
2259
|
+
failedToLoadPayment: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u043B\u0430\u0442\u0451\u0436",
|
|
2260
|
+
failedToCreateWithdrawal: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0441\u043E\u0437\u0434\u0430\u0442\u044C \u0437\u0430\u043F\u0440\u043E\u0441 \u043D\u0430 \u0432\u044B\u0432\u043E\u0434"
|
|
2261
|
+
},
|
|
2262
|
+
sheets: {
|
|
2263
|
+
addFundsTitle: "\u041F\u043E\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435",
|
|
2264
|
+
addFundsDescription: "\u041F\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435 \u043A\u043E\u0448\u0435\u043B\u0451\u043A \u0441 \u043F\u043E\u043C\u043E\u0449\u044C\u044E \u043A\u0440\u0438\u043F\u0442\u043E\u0432\u0430\u043B\u044E\u0442\u044B",
|
|
2265
|
+
withdrawTitle: "\u0412\u044B\u0432\u043E\u0434",
|
|
2266
|
+
withdrawDescription: "\u0412\u044B\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043D\u0430 \u043A\u0440\u0438\u043F\u0442\u043E\u0432\u0430\u043B\u044E\u0442\u043D\u044B\u0439 \u043A\u043E\u0448\u0435\u043B\u0451\u043A",
|
|
2267
|
+
paymentTitle: "\u0414\u0435\u0442\u0430\u043B\u0438 \u043F\u043B\u0430\u0442\u0435\u0436\u0430",
|
|
2268
|
+
withdrawalTitle: "\u0414\u0435\u0442\u0430\u043B\u0438 \u0432\u044B\u0432\u043E\u0434\u0430"
|
|
2269
|
+
},
|
|
2270
|
+
activity: {
|
|
2271
|
+
title: "\u041F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u044C",
|
|
2272
|
+
noActivity: "\u041D\u0435\u0442 \u0430\u043A\u0442\u0438\u0432\u043D\u043E\u0441\u0442\u0438",
|
|
2273
|
+
deposit: "\u041F\u043E\u043F\u043E\u043B\u043D\u0435\u043D\u0438\u0435",
|
|
2274
|
+
withdrawal: "\u0412\u044B\u0432\u043E\u0434",
|
|
2275
|
+
payment: "\u041F\u043B\u0430\u0442\u0451\u0436",
|
|
2276
|
+
transactionsWillAppear: "\u0412\u0430\u0448\u0438 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438 \u043F\u043E\u044F\u0432\u044F\u0442\u0441\u044F \u0437\u0434\u0435\u0441\u044C"
|
|
2277
|
+
},
|
|
2278
|
+
estimate: {
|
|
2279
|
+
gettingRate: "\u041F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u0435 \u043A\u0443\u0440\u0441\u0430...",
|
|
2280
|
+
calculating: "\u0420\u0430\u0441\u0447\u0451\u0442 \u043A\u043E\u043C\u0438\u0441\u0441\u0438\u0439...",
|
|
2281
|
+
enterAmountToSee: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u0443\u043C\u043C\u0443 \u0434\u043B\u044F \u043A\u043E\u043D\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438",
|
|
2282
|
+
youWillSend: "\u0412\u044B \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u0435",
|
|
2283
|
+
youWillReceive: "\u0412\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u0435",
|
|
2284
|
+
serviceFee: "\u041A\u043E\u043C\u0438\u0441\u0441\u0438\u044F \u0441\u0435\u0440\u0432\u0438\u0441\u0430",
|
|
2285
|
+
networkFee: "\u041A\u043E\u043C\u0438\u0441\u0441\u0438\u044F \u0441\u0435\u0442\u0438",
|
|
2286
|
+
rate: "\u041A\u0443\u0440\u0441",
|
|
2287
|
+
minimumAmount: "\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0441\u0443\u043C\u043C\u0430"
|
|
2288
|
+
},
|
|
2289
|
+
withdraw: {
|
|
2290
|
+
insufficientBalance: "\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u0441\u0440\u0435\u0434\u0441\u0442\u0432",
|
|
2291
|
+
approvalWarning: "\u0417\u0430\u043F\u0440\u043E\u0441\u044B \u043D\u0430 \u0432\u044B\u0432\u043E\u0434 \u0442\u0440\u0435\u0431\u0443\u044E\u0442 \u043E\u0434\u043E\u0431\u0440\u0435\u043D\u0438\u044F \u0430\u0434\u043C\u0438\u043D\u0438\u0441\u0442\u0440\u0430\u0442\u043E\u0440\u0430. \u041E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u043C\u043E\u0436\u0435\u0442 \u0437\u0430\u043D\u044F\u0442\u044C 24-48 \u0447\u0430\u0441\u043E\u0432.",
|
|
2292
|
+
submitting: "\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430...",
|
|
2293
|
+
creating: "\u0421\u043E\u0437\u0434\u0430\u043D\u0438\u0435...",
|
|
2294
|
+
expiresIn: "\u0418\u0441\u0442\u0435\u043A\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437"
|
|
2295
|
+
}
|
|
2296
|
+
};
|
|
2297
|
+
|
|
2298
|
+
// src/i18n/locales/ko.ts
|
|
2299
|
+
var ko = {
|
|
2300
|
+
balance: {
|
|
2301
|
+
available: "\uC0AC\uC6A9 \uAC00\uB2A5 \uC794\uC561",
|
|
2302
|
+
totalDeposited: "\uCD1D \uC785\uAE08\uC561",
|
|
2303
|
+
totalWithdrawn: "\uCD1D \uCD9C\uAE08\uC561"
|
|
2304
|
+
},
|
|
2305
|
+
actions: {
|
|
2306
|
+
addFunds: "\uC785\uAE08\uD558\uAE30",
|
|
2307
|
+
withdraw: "\uCD9C\uAE08\uD558\uAE30",
|
|
2308
|
+
continue: "\uACC4\uC18D",
|
|
2309
|
+
requestWithdrawal: "\uCD9C\uAE08 \uC694\uCCAD",
|
|
2310
|
+
cancel: "\uCDE8\uC18C",
|
|
2311
|
+
close: "\uB2EB\uAE30",
|
|
2312
|
+
copyAddress: "\uC8FC\uC18C \uBCF5\uC0AC",
|
|
2313
|
+
copied: "\uBCF5\uC0AC\uB428!",
|
|
2314
|
+
viewAll: "\uC804\uCCB4 \uBCF4\uAE30",
|
|
2315
|
+
tryAgain: "\uB2E4\uC2DC \uC2DC\uB3C4",
|
|
2316
|
+
refreshStatus: "\uC0C1\uD0DC \uC0C8\uB85C\uACE0\uCE68",
|
|
2317
|
+
createNewPayment: "\uC0C8 \uACB0\uC81C \uB9CC\uB4E4\uAE30",
|
|
2318
|
+
openInPaymentProvider: "\uACB0\uC81C \uC81C\uACF5\uC5C5\uCCB4\uC5D0\uC11C \uC5F4\uAE30"
|
|
2319
|
+
},
|
|
2320
|
+
paymentStatus: {
|
|
2321
|
+
waiting: "\uACB0\uC81C \uB300\uAE30 \uC911",
|
|
2322
|
+
confirming: "\uD655\uC778 \uC911",
|
|
2323
|
+
completed: "\uC644\uB8CC",
|
|
2324
|
+
failed: "\uC2E4\uD328",
|
|
2325
|
+
expired: "\uB9CC\uB8CC\uB428",
|
|
2326
|
+
paymentExpired: "\uACB0\uC81C \uB9CC\uB8CC\uB428"
|
|
2327
|
+
},
|
|
2328
|
+
withdrawalStatus: {
|
|
2329
|
+
pending: "\uC2B9\uC778 \uB300\uAE30 \uC911",
|
|
2330
|
+
approved: "\uC2B9\uC778\uB428",
|
|
2331
|
+
processing: "\uCC98\uB9AC \uC911",
|
|
2332
|
+
completed: "\uC644\uB8CC",
|
|
2333
|
+
rejected: "\uAC70\uBD80\uB428",
|
|
2334
|
+
cancelled: "\uCDE8\uC18C\uB428"
|
|
2335
|
+
},
|
|
2336
|
+
paymentDescriptions: {
|
|
2337
|
+
sendCrypto: "\uACB0\uC81C\uB97C \uC644\uB8CC\uD558\uB824\uBA74 \uC554\uD638\uD654\uD3D0\uB97C \uBCF4\uB0B4\uC138\uC694",
|
|
2338
|
+
expired: "\uC774 \uACB0\uC81C\uAC00 \uB9CC\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
2339
|
+
completed: "\uACB0\uC81C\uAC00 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
2340
|
+
failed: "\uACB0\uC81C\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4",
|
|
2341
|
+
confirming: "\uACB0\uC81C \uD655\uC778 \uC911",
|
|
2342
|
+
createNew: "\uACC4\uC18D\uD558\uB824\uBA74 \uC0C8 \uACB0\uC81C\uB97C \uC0DD\uC131\uD558\uC138\uC694"
|
|
2343
|
+
},
|
|
2344
|
+
withdrawalDescriptions: {
|
|
2345
|
+
pendingApproval: "\uAD00\uB9AC\uC790 \uC2B9\uC778 \uB300\uAE30 \uC911",
|
|
2346
|
+
processing: "\uCD9C\uAE08\uC774 \uCC98\uB9AC\uB418\uACE0 \uC788\uC2B5\uB2C8\uB2E4",
|
|
2347
|
+
completed: "\uCD9C\uAE08\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
2348
|
+
rejected: "\uCD9C\uAE08\uC774 \uAC70\uBD80\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
2349
|
+
cancelled: "\uCD9C\uAE08\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4"
|
|
2350
|
+
},
|
|
2351
|
+
form: {
|
|
2352
|
+
amount: "\uAE08\uC561",
|
|
2353
|
+
amountUsd: "\uAE08\uC561 (USD)",
|
|
2354
|
+
currency: "\uD1B5\uD654",
|
|
2355
|
+
walletAddress: "\uC9C0\uAC11 \uC8FC\uC18C",
|
|
2356
|
+
selectCurrency: "\uD1B5\uD654 \uC120\uD0DD...",
|
|
2357
|
+
enterWalletAddress: "\uC9C0\uAC11 \uC8FC\uC18C \uC785\uB825",
|
|
2358
|
+
search: "\uAC80\uC0C9...",
|
|
2359
|
+
payWith: "\uACB0\uC81C \uC218\uB2E8",
|
|
2360
|
+
withdrawAs: "\uCD9C\uAE08 \uD1B5\uD654",
|
|
2361
|
+
amountToSend: "\uBCF4\uB0BC \uAE08\uC561",
|
|
2362
|
+
equivalent: "\uD658\uC0B0 \uAE08\uC561",
|
|
2363
|
+
network: "\uB124\uD2B8\uC6CC\uD06C",
|
|
2364
|
+
paymentAddress: "\uACB0\uC81C \uC8FC\uC18C",
|
|
2365
|
+
transactionHash: "\uAC70\uB798 \uD574\uC2DC",
|
|
2366
|
+
paymentId: "\uACB0\uC81C ID",
|
|
2367
|
+
orderId: "\uC8FC\uBB38 #",
|
|
2368
|
+
created: "\uC0DD\uC131\uC77C"
|
|
2369
|
+
},
|
|
2370
|
+
validation: {
|
|
2371
|
+
minimumDeposit: "\uCD5C\uC18C $1",
|
|
2372
|
+
minimumWithdrawal: "\uCD5C\uC18C $10",
|
|
2373
|
+
selectCurrency: "\uD1B5\uD654\uB97C \uC120\uD0DD\uD558\uC138\uC694",
|
|
2374
|
+
invalidWalletAddress: "\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC9C0\uAC11 \uC8FC\uC18C"
|
|
2375
|
+
},
|
|
2376
|
+
messages: {
|
|
2377
|
+
paymentCreated: "\uACB0\uC81C\uAC00 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
2378
|
+
paymentFailed: "\uACB0\uC81C \uC0DD\uC131\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4",
|
|
2379
|
+
withdrawalCreated: "\uCD9C\uAE08 \uC694\uCCAD\uC774 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
2380
|
+
withdrawalFailed: "\uCD9C\uAE08 \uC694\uCCAD \uC0DD\uC131\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4",
|
|
2381
|
+
withdrawalCancelled: "\uCD9C\uAE08\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
2382
|
+
addressCopied: "\uC8FC\uC18C\uAC00 \uD074\uB9BD\uBCF4\uB4DC\uC5D0 \uBCF5\uC0AC\uB418\uC5C8\uC2B5\uB2C8\uB2E4",
|
|
2383
|
+
failedToLoadPayment: "\uACB0\uC81C\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4",
|
|
2384
|
+
failedToCreateWithdrawal: "\uCD9C\uAE08 \uC694\uCCAD\uC744 \uC0DD\uC131\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4"
|
|
2385
|
+
},
|
|
2386
|
+
sheets: {
|
|
2387
|
+
addFundsTitle: "\uC785\uAE08",
|
|
2388
|
+
addFundsDescription: "\uC554\uD638\uD654\uD3D0\uB85C \uC9C0\uAC11\uC744 \uCDA9\uC804\uD558\uC138\uC694",
|
|
2389
|
+
withdrawTitle: "\uCD9C\uAE08",
|
|
2390
|
+
withdrawDescription: "\uC554\uD638\uD654\uD3D0 \uC9C0\uAC11\uC73C\uB85C \uC790\uAE08\uC744 \uCD9C\uAE08\uD558\uC138\uC694",
|
|
2391
|
+
paymentTitle: "\uACB0\uC81C \uC0C1\uC138",
|
|
2392
|
+
withdrawalTitle: "\uCD9C\uAE08 \uC0C1\uC138"
|
|
2393
|
+
},
|
|
2394
|
+
activity: {
|
|
2395
|
+
title: "\uCD5C\uADFC \uD65C\uB3D9",
|
|
2396
|
+
noActivity: "\uD65C\uB3D9 \uC5C6\uC74C",
|
|
2397
|
+
deposit: "\uC785\uAE08",
|
|
2398
|
+
withdrawal: "\uCD9C\uAE08",
|
|
2399
|
+
payment: "\uACB0\uC81C",
|
|
2400
|
+
transactionsWillAppear: "\uAC70\uB798 \uB0B4\uC5ED\uC774 \uC5EC\uAE30\uC5D0 \uD45C\uC2DC\uB429\uB2C8\uB2E4"
|
|
2401
|
+
},
|
|
2402
|
+
estimate: {
|
|
2403
|
+
gettingRate: "\uD658\uC728 \uC870\uD68C \uC911...",
|
|
2404
|
+
calculating: "\uC218\uC218\uB8CC \uACC4\uC0B0 \uC911...",
|
|
2405
|
+
enterAmountToSee: "\uAE08\uC561\uC744 \uC785\uB825\uD558\uC5EC \uD658\uC0B0\uC744 \uD655\uC778\uD558\uC138\uC694",
|
|
2406
|
+
youWillSend: "\uBCF4\uB0BC \uAE08\uC561",
|
|
2407
|
+
youWillReceive: "\uBC1B\uC744 \uAE08\uC561",
|
|
2408
|
+
serviceFee: "\uC11C\uBE44\uC2A4 \uC218\uC218\uB8CC",
|
|
2409
|
+
networkFee: "\uB124\uD2B8\uC6CC\uD06C \uC218\uC218\uB8CC",
|
|
2410
|
+
rate: "\uD658\uC728",
|
|
2411
|
+
minimumAmount: "\uCD5C\uC18C \uAE08\uC561"
|
|
2412
|
+
},
|
|
2413
|
+
withdraw: {
|
|
2414
|
+
insufficientBalance: "\uC794\uC561 \uBD80\uC871",
|
|
2415
|
+
approvalWarning: "\uCD9C\uAE08 \uC694\uCCAD\uC740 \uAD00\uB9AC\uC790 \uC2B9\uC778\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. \uCC98\uB9AC\uC5D0 24-48\uC2DC\uAC04\uC774 \uC18C\uC694\uB420 \uC218 \uC788\uC2B5\uB2C8\uB2E4.",
|
|
2416
|
+
submitting: "\uC81C\uCD9C \uC911...",
|
|
2417
|
+
creating: "\uC0DD\uC131 \uC911...",
|
|
2418
|
+
expiresIn: "\uB9CC\uB8CC\uAE4C\uC9C0"
|
|
2419
|
+
}
|
|
2420
|
+
};
|
|
2421
|
+
|
|
2422
|
+
// src/i18n/usePaymentsT.ts
|
|
2423
|
+
var translations = { en, ru, ko };
|
|
2424
|
+
function getNestedValue(obj, path) {
|
|
2425
|
+
const keys = path.split(".");
|
|
2426
|
+
let result = obj;
|
|
2427
|
+
for (const key of keys) {
|
|
2428
|
+
if (result && typeof result === "object" && key in result) {
|
|
2429
|
+
result = result[key];
|
|
2430
|
+
} else {
|
|
2431
|
+
return path;
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
return typeof result === "string" ? result : path;
|
|
2435
|
+
}
|
|
2436
|
+
function usePaymentsT() {
|
|
2437
|
+
const locale = useLocale();
|
|
2438
|
+
const t = useMemo(() => translations[locale] || translations.en, [locale]);
|
|
2439
|
+
return useCallback(
|
|
2440
|
+
(key) => getNestedValue(t, key),
|
|
2441
|
+
[t]
|
|
2442
|
+
);
|
|
2443
|
+
}
|
|
2048
2444
|
function BalanceHero({ onAddFunds, onWithdraw, className }) {
|
|
2445
|
+
const pt = usePaymentsT();
|
|
2049
2446
|
const { balance, balanceAmount, isLoadingBalance, refreshWallet } = useWallet();
|
|
2447
|
+
const labels = useMemo(() => ({
|
|
2448
|
+
available: pt("balance.available"),
|
|
2449
|
+
totalDeposited: pt("balance.totalDeposited"),
|
|
2450
|
+
totalWithdrawn: pt("balance.totalWithdrawn"),
|
|
2451
|
+
addFunds: pt("actions.addFunds"),
|
|
2452
|
+
withdraw: pt("actions.withdraw")
|
|
2453
|
+
}), [pt]);
|
|
2050
2454
|
const formattedBalance = new Intl.NumberFormat("en-US", {
|
|
2051
2455
|
style: "currency",
|
|
2052
2456
|
currency: "USD",
|
|
@@ -2059,7 +2463,7 @@ function BalanceHero({ onAddFunds, onWithdraw, className }) {
|
|
|
2059
2463
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-4 w-24 mx-auto" })
|
|
2060
2464
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2061
2465
|
/* @__PURE__ */ jsx("h1", { className: "text-5xl font-bold tracking-tight tabular-nums", children: formattedBalance }),
|
|
2062
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1", children:
|
|
2466
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1", children: labels.available })
|
|
2063
2467
|
] }) }),
|
|
2064
2468
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2065
2469
|
/* @__PURE__ */ jsxs(
|
|
@@ -2070,7 +2474,7 @@ function BalanceHero({ onAddFunds, onWithdraw, className }) {
|
|
|
2070
2474
|
className: "rounded-full px-6",
|
|
2071
2475
|
children: [
|
|
2072
2476
|
/* @__PURE__ */ jsx(Plus, { className: "h-5 w-5 mr-2" }),
|
|
2073
|
-
|
|
2477
|
+
labels.addFunds
|
|
2074
2478
|
]
|
|
2075
2479
|
}
|
|
2076
2480
|
),
|
|
@@ -2083,7 +2487,7 @@ function BalanceHero({ onAddFunds, onWithdraw, className }) {
|
|
|
2083
2487
|
className: "rounded-full px-6",
|
|
2084
2488
|
children: [
|
|
2085
2489
|
/* @__PURE__ */ jsx(ArrowUpRight, { className: "h-5 w-5 mr-2" }),
|
|
2086
|
-
|
|
2490
|
+
labels.withdraw
|
|
2087
2491
|
]
|
|
2088
2492
|
}
|
|
2089
2493
|
),
|
|
@@ -2104,7 +2508,7 @@ function BalanceHero({ onAddFunds, onWithdraw, className }) {
|
|
|
2104
2508
|
"$",
|
|
2105
2509
|
parseFloat(balance.total_deposited || "0").toFixed(2)
|
|
2106
2510
|
] }),
|
|
2107
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
2511
|
+
/* @__PURE__ */ jsx("span", { children: labels.totalDeposited })
|
|
2108
2512
|
] }),
|
|
2109
2513
|
/* @__PURE__ */ jsx("div", { className: "h-8 w-px bg-border" }),
|
|
2110
2514
|
/* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
@@ -2112,7 +2516,7 @@ function BalanceHero({ onAddFunds, onWithdraw, className }) {
|
|
|
2112
2516
|
"$",
|
|
2113
2517
|
parseFloat(balance.total_withdrawn || "0").toFixed(2)
|
|
2114
2518
|
] }),
|
|
2115
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
2519
|
+
/* @__PURE__ */ jsx("span", { children: labels.totalWithdrawn })
|
|
2116
2520
|
] })
|
|
2117
2521
|
] })
|
|
2118
2522
|
] });
|
|
@@ -2199,7 +2603,14 @@ function ActivityList({
|
|
|
2199
2603
|
limit = 10,
|
|
2200
2604
|
className
|
|
2201
2605
|
}) {
|
|
2606
|
+
const pt = usePaymentsT();
|
|
2202
2607
|
const { activity, isLoadingActivity, hasMoreActivity } = useWallet();
|
|
2608
|
+
const labels = useMemo(() => ({
|
|
2609
|
+
title: pt("activity.title"),
|
|
2610
|
+
noActivity: pt("activity.noActivity"),
|
|
2611
|
+
transactionsWillAppear: pt("activity.transactionsWillAppear"),
|
|
2612
|
+
viewAll: pt("actions.viewAll")
|
|
2613
|
+
}), [pt]);
|
|
2203
2614
|
const displayedActivity = limit ? activity.slice(0, limit) : activity;
|
|
2204
2615
|
if (isLoadingActivity) {
|
|
2205
2616
|
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), children: [
|
|
@@ -2217,15 +2628,15 @@ function ActivityList({
|
|
|
2217
2628
|
if (activity.length === 0) {
|
|
2218
2629
|
return /* @__PURE__ */ jsxs("div", { className: cn("text-center py-12", className), children: [
|
|
2219
2630
|
/* @__PURE__ */ jsx("div", { className: "inline-flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4", children: /* @__PURE__ */ jsx(History, { className: "h-8 w-8 text-muted-foreground" }) }),
|
|
2220
|
-
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-1", children:
|
|
2221
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children:
|
|
2631
|
+
/* @__PURE__ */ jsx("h3", { className: "font-semibold mb-1", children: labels.noActivity }),
|
|
2632
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: labels.transactionsWillAppear })
|
|
2222
2633
|
] });
|
|
2223
2634
|
}
|
|
2224
2635
|
return /* @__PURE__ */ jsxs("div", { className: cn("pt-6", className), children: [
|
|
2225
2636
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-2", children: [
|
|
2226
|
-
/* @__PURE__ */ jsx("h2", { className: "font-semibold text-lg", children:
|
|
2637
|
+
/* @__PURE__ */ jsx("h2", { className: "font-semibold text-lg", children: labels.title }),
|
|
2227
2638
|
hasMoreActivity && onViewAll && /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: onViewAll, className: "text-primary", children: [
|
|
2228
|
-
|
|
2639
|
+
labels.viewAll,
|
|
2229
2640
|
/* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4 ml-1" })
|
|
2230
2641
|
] })
|
|
2231
2642
|
] }),
|
|
@@ -2451,16 +2862,21 @@ function CurrencyCombobox({
|
|
|
2451
2862
|
value,
|
|
2452
2863
|
onChange,
|
|
2453
2864
|
disabled,
|
|
2454
|
-
placeholder
|
|
2865
|
+
placeholder
|
|
2455
2866
|
}) {
|
|
2867
|
+
const pt = usePaymentsT();
|
|
2868
|
+
const labels = useMemo(() => ({
|
|
2869
|
+
selectCurrency: pt("form.selectCurrency"),
|
|
2870
|
+
search: pt("form.search")
|
|
2871
|
+
}), [pt]);
|
|
2456
2872
|
return /* @__PURE__ */ jsx(
|
|
2457
2873
|
Combobox,
|
|
2458
2874
|
{
|
|
2459
2875
|
options,
|
|
2460
2876
|
value,
|
|
2461
2877
|
onValueChange: onChange,
|
|
2462
|
-
placeholder,
|
|
2463
|
-
searchPlaceholder:
|
|
2878
|
+
placeholder: placeholder || labels.selectCurrency,
|
|
2879
|
+
searchPlaceholder: labels.search,
|
|
2464
2880
|
disabled,
|
|
2465
2881
|
className: "h-14",
|
|
2466
2882
|
renderOption: (option) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 flex-1", children: [
|
|
@@ -2480,9 +2896,26 @@ var AddFundsSchema = z.object({
|
|
|
2480
2896
|
});
|
|
2481
2897
|
var STORAGE_KEY = "payments:addFunds";
|
|
2482
2898
|
function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
2899
|
+
const pt = usePaymentsT();
|
|
2483
2900
|
const { currencies, isLoadingCurrencies, addFunds } = useWallet();
|
|
2484
2901
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
2485
2902
|
const [error, setError] = useState(null);
|
|
2903
|
+
const labels = useMemo(() => ({
|
|
2904
|
+
title: pt("sheets.addFundsTitle"),
|
|
2905
|
+
description: pt("sheets.addFundsDescription"),
|
|
2906
|
+
amountUsd: pt("form.amountUsd"),
|
|
2907
|
+
payWith: pt("form.payWith"),
|
|
2908
|
+
amount: pt("form.amount"),
|
|
2909
|
+
serviceFee: pt("estimate.serviceFee"),
|
|
2910
|
+
rate: pt("estimate.rate"),
|
|
2911
|
+
youWillSend: pt("estimate.youWillSend"),
|
|
2912
|
+
youWillReceive: pt("estimate.youWillReceive"),
|
|
2913
|
+
gettingRate: pt("estimate.gettingRate"),
|
|
2914
|
+
enterAmountToSee: pt("estimate.enterAmountToSee"),
|
|
2915
|
+
minimumAmount: pt("estimate.minimumAmount"),
|
|
2916
|
+
continue: pt("actions.continue"),
|
|
2917
|
+
creating: pt("withdraw.creating")
|
|
2918
|
+
}), [pt]);
|
|
2486
2919
|
const [saved, setSaved] = useLocalStorage(STORAGE_KEY, {
|
|
2487
2920
|
currency: "",
|
|
2488
2921
|
amount: 100
|
|
@@ -2562,8 +2995,8 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2562
2995
|
}, [form, onOpenChange, saved]);
|
|
2563
2996
|
return /* @__PURE__ */ jsx(ResponsiveSheet, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs(ResponsiveSheetContent, { className: "sm:max-w-md", children: [
|
|
2564
2997
|
/* @__PURE__ */ jsxs(ResponsiveSheetHeader, { children: [
|
|
2565
|
-
/* @__PURE__ */ jsx(ResponsiveSheetTitle, { children:
|
|
2566
|
-
/* @__PURE__ */ jsx(ResponsiveSheetDescription, { children:
|
|
2998
|
+
/* @__PURE__ */ jsx(ResponsiveSheetTitle, { children: labels.title }),
|
|
2999
|
+
/* @__PURE__ */ jsx(ResponsiveSheetDescription, { children: labels.description })
|
|
2567
3000
|
] }),
|
|
2568
3001
|
/* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(handleSubmit), className: "space-y-6 p-4 sm:p-0 sm:mt-4", children: [
|
|
2569
3002
|
/* @__PURE__ */ jsx(
|
|
@@ -2572,7 +3005,7 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2572
3005
|
control: form.control,
|
|
2573
3006
|
name: "amount",
|
|
2574
3007
|
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
2575
|
-
/* @__PURE__ */ jsx(FormLabel, { children:
|
|
3008
|
+
/* @__PURE__ */ jsx(FormLabel, { children: labels.amountUsd }),
|
|
2576
3009
|
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2577
3010
|
/* @__PURE__ */ jsx("span", { className: "absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground text-lg", children: "$" }),
|
|
2578
3011
|
/* @__PURE__ */ jsx(
|
|
@@ -2598,7 +3031,7 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2598
3031
|
control: form.control,
|
|
2599
3032
|
name: "currency",
|
|
2600
3033
|
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
2601
|
-
/* @__PURE__ */ jsx(FormLabel, { children:
|
|
3034
|
+
/* @__PURE__ */ jsx(FormLabel, { children: labels.payWith }),
|
|
2602
3035
|
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
2603
3036
|
CurrencyCombobox,
|
|
2604
3037
|
{
|
|
@@ -2614,10 +3047,10 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2614
3047
|
),
|
|
2615
3048
|
selectedCurrency && watchedAmount >= 1 && /* @__PURE__ */ jsx("div", { className: "bg-muted rounded-xl p-4 space-y-2", children: isLoadingEstimate ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-2", children: [
|
|
2616
3049
|
/* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin text-muted-foreground" }),
|
|
2617
|
-
/* @__PURE__ */ jsx("span", { className: "ml-2 text-sm text-muted-foreground", children:
|
|
3050
|
+
/* @__PURE__ */ jsx("span", { className: "ml-2 text-sm text-muted-foreground", children: labels.gettingRate })
|
|
2618
3051
|
] }) : displayData ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2619
3052
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2620
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3053
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.amount }),
|
|
2621
3054
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
2622
3055
|
"$",
|
|
2623
3056
|
formatUsdAmount(displayData.amountToReceive)
|
|
@@ -2625,7 +3058,8 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2625
3058
|
] }),
|
|
2626
3059
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2627
3060
|
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
2628
|
-
|
|
3061
|
+
labels.serviceFee,
|
|
3062
|
+
" (",
|
|
2629
3063
|
displayData.serviceFeePercent,
|
|
2630
3064
|
"%)"
|
|
2631
3065
|
] }),
|
|
@@ -2635,7 +3069,7 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2635
3069
|
] })
|
|
2636
3070
|
] }),
|
|
2637
3071
|
displayData.showRate && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm text-muted-foreground", children: [
|
|
2638
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3072
|
+
/* @__PURE__ */ jsx("span", { children: labels.rate }),
|
|
2639
3073
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
2640
3074
|
"1 ",
|
|
2641
3075
|
displayData.token,
|
|
@@ -2644,7 +3078,7 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2644
3078
|
] })
|
|
2645
3079
|
] }),
|
|
2646
3080
|
/* @__PURE__ */ jsx("div", { className: "border-t pt-2 mt-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2647
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children:
|
|
3081
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: labels.youWillSend }),
|
|
2648
3082
|
/* @__PURE__ */ jsxs("div", { className: "text-right", children: [
|
|
2649
3083
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-end", children: [
|
|
2650
3084
|
/* @__PURE__ */ jsx(TokenIcon, { symbol: displayData.token, size: 20 }),
|
|
@@ -2661,17 +3095,18 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2661
3095
|
] })
|
|
2662
3096
|
] }) }),
|
|
2663
3097
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm pt-2", children: [
|
|
2664
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3098
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.youWillReceive }),
|
|
2665
3099
|
/* @__PURE__ */ jsxs("span", { className: "font-medium", children: [
|
|
2666
3100
|
"$",
|
|
2667
3101
|
formatUsdAmount(displayData.amountToReceive)
|
|
2668
3102
|
] })
|
|
2669
3103
|
] }),
|
|
2670
3104
|
displayData.belowMinimum && displayData.minAmount && /* @__PURE__ */ jsxs("div", { className: "text-sm text-destructive mt-2 pt-2 border-t border-destructive/20", children: [
|
|
2671
|
-
|
|
3105
|
+
labels.minimumAmount,
|
|
3106
|
+
": $",
|
|
2672
3107
|
displayData.minAmount
|
|
2673
3108
|
] })
|
|
2674
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "text-center text-sm text-muted-foreground py-2", children:
|
|
3109
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "text-center text-sm text-muted-foreground py-2", children: labels.enterAmountToSee }) }),
|
|
2675
3110
|
error && /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: error }) }),
|
|
2676
3111
|
/* @__PURE__ */ jsx(
|
|
2677
3112
|
Button,
|
|
@@ -2682,8 +3117,8 @@ function AddFundsSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2682
3117
|
disabled: isSubmitting || currencyOptions.length === 0 || isLoadingEstimate || displayData?.belowMinimum,
|
|
2683
3118
|
children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2684
3119
|
/* @__PURE__ */ jsx(RefreshCw, { className: "h-5 w-5 mr-2 animate-spin" }),
|
|
2685
|
-
|
|
2686
|
-
] }) :
|
|
3120
|
+
labels.creating
|
|
3121
|
+
] }) : labels.continue
|
|
2687
3122
|
}
|
|
2688
3123
|
)
|
|
2689
3124
|
] }) })
|
|
@@ -2696,9 +3131,27 @@ var WithdrawSchema = z.object({
|
|
|
2696
3131
|
});
|
|
2697
3132
|
var STORAGE_KEY2 = "payments:withdraw";
|
|
2698
3133
|
function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
3134
|
+
const pt = usePaymentsT();
|
|
2699
3135
|
const { currencies, isLoadingCurrencies, withdraw, balanceAmount } = useWallet();
|
|
2700
3136
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
2701
3137
|
const [error, setError] = useState(null);
|
|
3138
|
+
const labels = useMemo(() => ({
|
|
3139
|
+
title: pt("sheets.withdrawTitle"),
|
|
3140
|
+
description: pt("sheets.withdrawDescription"),
|
|
3141
|
+
amountUsd: pt("form.amountUsd"),
|
|
3142
|
+
withdrawAs: pt("form.withdrawAs"),
|
|
3143
|
+
walletAddress: pt("form.walletAddress"),
|
|
3144
|
+
enterWalletAddress: pt("form.enterWalletAddress"),
|
|
3145
|
+
amount: pt("form.amount"),
|
|
3146
|
+
serviceFee: pt("estimate.serviceFee"),
|
|
3147
|
+
networkFee: pt("estimate.networkFee"),
|
|
3148
|
+
youWillReceive: pt("estimate.youWillReceive"),
|
|
3149
|
+
calculating: pt("estimate.calculating"),
|
|
3150
|
+
insufficientBalance: pt("withdraw.insufficientBalance"),
|
|
3151
|
+
approvalWarning: pt("withdraw.approvalWarning"),
|
|
3152
|
+
submitting: pt("withdraw.submitting"),
|
|
3153
|
+
requestWithdrawal: pt("actions.requestWithdrawal")
|
|
3154
|
+
}), [pt]);
|
|
2702
3155
|
const [saved, setSaved] = useLocalStorage(STORAGE_KEY2, {
|
|
2703
3156
|
currency: "",
|
|
2704
3157
|
wallet: ""
|
|
@@ -2771,8 +3224,8 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2771
3224
|
}, [form, onOpenChange, saved]);
|
|
2772
3225
|
return /* @__PURE__ */ jsx(ResponsiveSheet, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs(ResponsiveSheetContent, { className: "sm:max-w-md", children: [
|
|
2773
3226
|
/* @__PURE__ */ jsxs(ResponsiveSheetHeader, { children: [
|
|
2774
|
-
/* @__PURE__ */ jsx(ResponsiveSheetTitle, { children:
|
|
2775
|
-
/* @__PURE__ */ jsx(ResponsiveSheetDescription, { children:
|
|
3227
|
+
/* @__PURE__ */ jsx(ResponsiveSheetTitle, { children: labels.title }),
|
|
3228
|
+
/* @__PURE__ */ jsx(ResponsiveSheetDescription, { children: labels.description })
|
|
2776
3229
|
] }),
|
|
2777
3230
|
/* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(handleSubmit), className: "space-y-6 p-4 sm:p-0 sm:mt-4", children: [
|
|
2778
3231
|
/* @__PURE__ */ jsx(
|
|
@@ -2781,7 +3234,7 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2781
3234
|
control: form.control,
|
|
2782
3235
|
name: "amount",
|
|
2783
3236
|
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
2784
|
-
/* @__PURE__ */ jsx(FormLabel, { children:
|
|
3237
|
+
/* @__PURE__ */ jsx(FormLabel, { children: labels.amountUsd }),
|
|
2785
3238
|
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2786
3239
|
/* @__PURE__ */ jsx("span", { className: "absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground text-lg", children: "$" }),
|
|
2787
3240
|
/* @__PURE__ */ jsx(
|
|
@@ -2799,7 +3252,8 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2799
3252
|
] }) }),
|
|
2800
3253
|
/* @__PURE__ */ jsx(FormMessage, {}),
|
|
2801
3254
|
insufficientBalance && /* @__PURE__ */ jsxs("p", { className: "text-sm text-destructive mt-1", children: [
|
|
2802
|
-
|
|
3255
|
+
labels.insufficientBalance,
|
|
3256
|
+
" (Available: $",
|
|
2803
3257
|
formatUsdAmount(balanceAmount),
|
|
2804
3258
|
")"
|
|
2805
3259
|
] })
|
|
@@ -2812,7 +3266,7 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2812
3266
|
control: form.control,
|
|
2813
3267
|
name: "currency",
|
|
2814
3268
|
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
2815
|
-
/* @__PURE__ */ jsx(FormLabel, { children:
|
|
3269
|
+
/* @__PURE__ */ jsx(FormLabel, { children: labels.withdrawAs }),
|
|
2816
3270
|
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
2817
3271
|
CurrencyCombobox,
|
|
2818
3272
|
{
|
|
@@ -2832,11 +3286,11 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2832
3286
|
control: form.control,
|
|
2833
3287
|
name: "wallet_address",
|
|
2834
3288
|
render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
2835
|
-
/* @__PURE__ */ jsx(FormLabel, { children:
|
|
3289
|
+
/* @__PURE__ */ jsx(FormLabel, { children: labels.walletAddress }),
|
|
2836
3290
|
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
2837
3291
|
Input,
|
|
2838
3292
|
{
|
|
2839
|
-
placeholder:
|
|
3293
|
+
placeholder: labels.enterWalletAddress,
|
|
2840
3294
|
className: "font-mono text-sm",
|
|
2841
3295
|
...field
|
|
2842
3296
|
}
|
|
@@ -2847,7 +3301,7 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2847
3301
|
),
|
|
2848
3302
|
amount >= 10 && selectedCurrency && /* @__PURE__ */ jsxs("div", { className: "bg-muted rounded-xl p-4 space-y-2", children: [
|
|
2849
3303
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2850
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3304
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.amount }),
|
|
2851
3305
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
2852
3306
|
"$",
|
|
2853
3307
|
formatUsdAmount(amount)
|
|
@@ -2855,11 +3309,12 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2855
3309
|
] }),
|
|
2856
3310
|
isLoadingEstimate ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground py-2", children: [
|
|
2857
3311
|
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
2858
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3312
|
+
/* @__PURE__ */ jsx("span", { children: labels.calculating })
|
|
2859
3313
|
] }) : estimate ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2860
3314
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2861
3315
|
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
2862
|
-
|
|
3316
|
+
labels.serviceFee,
|
|
3317
|
+
" (",
|
|
2863
3318
|
estimate.serviceFeePercent,
|
|
2864
3319
|
"%)"
|
|
2865
3320
|
] }),
|
|
@@ -2869,14 +3324,14 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2869
3324
|
] })
|
|
2870
3325
|
] }),
|
|
2871
3326
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2872
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3327
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.networkFee }),
|
|
2873
3328
|
/* @__PURE__ */ jsxs("span", { className: "text-destructive", children: [
|
|
2874
3329
|
"-$",
|
|
2875
3330
|
formatUsdAmount(estimate.networkFeeUsd)
|
|
2876
3331
|
] })
|
|
2877
3332
|
] }),
|
|
2878
3333
|
/* @__PURE__ */ jsx("div", { className: "border-t pt-2 mt-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2879
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children:
|
|
3334
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: labels.youWillReceive }),
|
|
2880
3335
|
/* @__PURE__ */ jsxs("div", { className: "text-right", children: [
|
|
2881
3336
|
/* @__PURE__ */ jsxs("div", { className: "font-semibold", children: [
|
|
2882
3337
|
"$",
|
|
@@ -2896,7 +3351,7 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2896
3351
|
] }),
|
|
2897
3352
|
/* @__PURE__ */ jsxs(Alert, { children: [
|
|
2898
3353
|
/* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
2899
|
-
/* @__PURE__ */ jsx(AlertDescription, { children:
|
|
3354
|
+
/* @__PURE__ */ jsx(AlertDescription, { children: labels.approvalWarning })
|
|
2900
3355
|
] }),
|
|
2901
3356
|
error && /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: error }) }),
|
|
2902
3357
|
/* @__PURE__ */ jsx(
|
|
@@ -2908,8 +3363,8 @@ function WithdrawSheet({ open, onOpenChange, onSuccess }) {
|
|
|
2908
3363
|
disabled: isSubmitting || currencyOptions.length === 0 || insufficientBalance || !estimate || estimate.amountToReceive <= 0 || isLoadingEstimate,
|
|
2909
3364
|
children: isSubmitting ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2910
3365
|
/* @__PURE__ */ jsx(RefreshCw, { className: "h-5 w-5 mr-2 animate-spin" }),
|
|
2911
|
-
|
|
2912
|
-
] }) :
|
|
3366
|
+
labels.submitting
|
|
3367
|
+
] }) : labels.requestWithdrawal
|
|
2913
3368
|
}
|
|
2914
3369
|
)
|
|
2915
3370
|
] }) })
|
|
@@ -2919,43 +3374,72 @@ var statusConfig2 = {
|
|
|
2919
3374
|
pending: {
|
|
2920
3375
|
icon: Clock,
|
|
2921
3376
|
color: "text-yellow-500",
|
|
2922
|
-
bg: "bg-yellow-500/10"
|
|
2923
|
-
label: "Pending Approval"
|
|
3377
|
+
bg: "bg-yellow-500/10"
|
|
2924
3378
|
},
|
|
2925
3379
|
approved: {
|
|
2926
3380
|
icon: CheckCircle2,
|
|
2927
3381
|
color: "text-blue-500",
|
|
2928
|
-
bg: "bg-blue-500/10"
|
|
2929
|
-
label: "Approved"
|
|
3382
|
+
bg: "bg-blue-500/10"
|
|
2930
3383
|
},
|
|
2931
3384
|
processing: {
|
|
2932
3385
|
icon: RefreshCw,
|
|
2933
3386
|
color: "text-blue-500",
|
|
2934
3387
|
bg: "bg-blue-500/10",
|
|
2935
|
-
label: "Processing",
|
|
2936
3388
|
animate: true
|
|
2937
3389
|
},
|
|
2938
3390
|
completed: {
|
|
2939
3391
|
icon: CheckCircle2,
|
|
2940
3392
|
color: "text-green-500",
|
|
2941
|
-
bg: "bg-green-500/10"
|
|
2942
|
-
label: "Completed"
|
|
3393
|
+
bg: "bg-green-500/10"
|
|
2943
3394
|
},
|
|
2944
3395
|
rejected: {
|
|
2945
3396
|
icon: XCircle,
|
|
2946
3397
|
color: "text-red-500",
|
|
2947
|
-
bg: "bg-red-500/10"
|
|
2948
|
-
label: "Rejected"
|
|
3398
|
+
bg: "bg-red-500/10"
|
|
2949
3399
|
},
|
|
2950
3400
|
cancelled: {
|
|
2951
3401
|
icon: Ban,
|
|
2952
3402
|
color: "text-muted-foreground",
|
|
2953
|
-
bg: "bg-muted"
|
|
2954
|
-
label: "Cancelled"
|
|
3403
|
+
bg: "bg-muted"
|
|
2955
3404
|
}
|
|
2956
3405
|
};
|
|
2957
3406
|
function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
3407
|
+
const pt = usePaymentsT();
|
|
2958
3408
|
const { getWithdrawalDetails, cancelWithdrawal, refreshWallet } = useWallet();
|
|
3409
|
+
const labels = useMemo(() => ({
|
|
3410
|
+
title: pt("sheets.withdrawalTitle"),
|
|
3411
|
+
// Status labels
|
|
3412
|
+
pending: pt("withdrawalStatus.pending"),
|
|
3413
|
+
approved: pt("withdrawalStatus.approved"),
|
|
3414
|
+
processing: pt("withdrawalStatus.processing"),
|
|
3415
|
+
completed: pt("withdrawalStatus.completed"),
|
|
3416
|
+
rejected: pt("withdrawalStatus.rejected"),
|
|
3417
|
+
cancelled: pt("withdrawalStatus.cancelled"),
|
|
3418
|
+
// Descriptions
|
|
3419
|
+
pendingApproval: pt("withdrawalDescriptions.pendingApproval"),
|
|
3420
|
+
processingDesc: pt("withdrawalDescriptions.processing"),
|
|
3421
|
+
completedDesc: pt("withdrawalDescriptions.completed"),
|
|
3422
|
+
rejectedDesc: pt("withdrawalDescriptions.rejected"),
|
|
3423
|
+
cancelledDesc: pt("withdrawalDescriptions.cancelled"),
|
|
3424
|
+
// Form
|
|
3425
|
+
amount: pt("form.amount"),
|
|
3426
|
+
totalFees: pt("estimate.serviceFee"),
|
|
3427
|
+
youReceive: pt("estimate.youWillReceive"),
|
|
3428
|
+
cryptoAmount: pt("form.amount"),
|
|
3429
|
+
destinationWallet: pt("form.walletAddress"),
|
|
3430
|
+
transactionHash: pt("form.transactionHash"),
|
|
3431
|
+
withdrawalId: pt("form.paymentId"),
|
|
3432
|
+
reference: pt("form.orderId"),
|
|
3433
|
+
created: pt("form.created"),
|
|
3434
|
+
network: pt("form.network"),
|
|
3435
|
+
// Actions
|
|
3436
|
+
viewOnExplorer: pt("actions.openInPaymentProvider"),
|
|
3437
|
+
cancel: pt("actions.cancel"),
|
|
3438
|
+
refreshStatus: pt("actions.refreshStatus"),
|
|
3439
|
+
tryAgain: pt("actions.tryAgain"),
|
|
3440
|
+
// Messages
|
|
3441
|
+
failedToLoad: pt("messages.failedToLoadPayment")
|
|
3442
|
+
}), [pt]);
|
|
2959
3443
|
const { data: withdrawal, isLoading, error, mutate } = useSWR(
|
|
2960
3444
|
open && withdrawalId ? ["withdrawal-details", withdrawalId] : null,
|
|
2961
3445
|
() => getWithdrawalDetails(withdrawalId),
|
|
@@ -2970,12 +3454,20 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
2970
3454
|
const isCancelled = s === "cancelled";
|
|
2971
3455
|
const isProcessing = s === "processing" || s === "approved";
|
|
2972
3456
|
const canCancel2 = isPending;
|
|
3457
|
+
const statusLabels = {
|
|
3458
|
+
pending: labels.pending,
|
|
3459
|
+
approved: labels.approved,
|
|
3460
|
+
processing: labels.processing,
|
|
3461
|
+
completed: labels.completed,
|
|
3462
|
+
rejected: labels.rejected,
|
|
3463
|
+
cancelled: labels.cancelled
|
|
3464
|
+
};
|
|
2973
3465
|
let description2 = "";
|
|
2974
|
-
if (isPending) description2 =
|
|
2975
|
-
else if (isProcessing) description2 =
|
|
2976
|
-
else if (isCompleted) description2 =
|
|
2977
|
-
else if (isRejected) description2 =
|
|
2978
|
-
else if (isCancelled) description2 =
|
|
3466
|
+
if (isPending) description2 = labels.pendingApproval;
|
|
3467
|
+
else if (isProcessing) description2 = labels.processingDesc;
|
|
3468
|
+
else if (isCompleted) description2 = labels.completedDesc;
|
|
3469
|
+
else if (isRejected) description2 = labels.rejectedDesc;
|
|
3470
|
+
else if (isCancelled) description2 = labels.cancelledDesc;
|
|
2979
3471
|
const amountUsd2 = withdrawal?.amount_usd ? `$${parseFloat(withdrawal.amount_usd).toFixed(2)}` : "";
|
|
2980
3472
|
const finalAmountUsd2 = withdrawal?.final_amount_usd ? `$${parseFloat(withdrawal.final_amount_usd).toFixed(2)}` : "";
|
|
2981
3473
|
const totalFeeUsd2 = withdrawal?.total_fee_usd ? `$${parseFloat(withdrawal.total_fee_usd).toFixed(2)}` : "";
|
|
@@ -2984,6 +3476,7 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
2984
3476
|
return {
|
|
2985
3477
|
status: s,
|
|
2986
3478
|
config: config2,
|
|
3479
|
+
statusLabel: statusLabels[s] || statusLabels.pending,
|
|
2987
3480
|
isPending,
|
|
2988
3481
|
isCompleted,
|
|
2989
3482
|
isRejected,
|
|
@@ -2997,8 +3490,8 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
2997
3490
|
createdAt: createdAt2,
|
|
2998
3491
|
completedAt: completedAt2
|
|
2999
3492
|
};
|
|
3000
|
-
}, [withdrawal]);
|
|
3001
|
-
const { config, canCancel, description, amountUsd, finalAmountUsd, totalFeeUsd, createdAt, completedAt } = displayData;
|
|
3493
|
+
}, [withdrawal, labels]);
|
|
3494
|
+
const { config, statusLabel, canCancel, description, amountUsd, finalAmountUsd, totalFeeUsd, createdAt, completedAt } = displayData;
|
|
3002
3495
|
const StatusIcon = config.icon;
|
|
3003
3496
|
const handleCancel = async () => {
|
|
3004
3497
|
if (!withdrawalId) return;
|
|
@@ -3012,7 +3505,7 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
3012
3505
|
};
|
|
3013
3506
|
return /* @__PURE__ */ jsx(ResponsiveSheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs(ResponsiveSheetContent, { className: "sm:max-w-lg", children: [
|
|
3014
3507
|
/* @__PURE__ */ jsxs(ResponsiveSheetHeader, { children: [
|
|
3015
|
-
/* @__PURE__ */ jsx(ResponsiveSheetTitle, { children:
|
|
3508
|
+
/* @__PURE__ */ jsx(ResponsiveSheetTitle, { children: labels.title }),
|
|
3016
3509
|
/* @__PURE__ */ jsx(ResponsiveSheetDescription, { children: description })
|
|
3017
3510
|
] }),
|
|
3018
3511
|
/* @__PURE__ */ jsxs("div", { className: "p-4 sm:p-0 sm:mt-4 overflow-y-auto max-h-[70vh]", children: [
|
|
@@ -3023,38 +3516,38 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
3023
3516
|
] }),
|
|
3024
3517
|
error && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-12", children: [
|
|
3025
3518
|
/* @__PURE__ */ jsx(XCircle, { className: "h-12 w-12 text-destructive mb-4" }),
|
|
3026
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children:
|
|
3027
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => mutate(), children:
|
|
3519
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children: labels.failedToLoad }),
|
|
3520
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => mutate(), children: labels.tryAgain })
|
|
3028
3521
|
] }),
|
|
3029
3522
|
withdrawal && !isLoading && /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
3030
3523
|
/* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3 p-4 rounded-xl", config.bg), children: [
|
|
3031
3524
|
/* @__PURE__ */ jsx(StatusIcon, { className: cn("h-6 w-6", config.color, config.animate && "animate-spin") }),
|
|
3032
3525
|
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
3033
|
-
/* @__PURE__ */ jsx("div", { className: "font-semibold", children:
|
|
3526
|
+
/* @__PURE__ */ jsx("div", { className: "font-semibold", children: statusLabel }),
|
|
3034
3527
|
withdrawal.admin_notes && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: withdrawal.admin_notes })
|
|
3035
3528
|
] })
|
|
3036
3529
|
] }),
|
|
3037
3530
|
/* @__PURE__ */ jsxs("div", { className: "bg-muted rounded-xl p-4 space-y-3", children: [
|
|
3038
3531
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3039
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3532
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.amount }),
|
|
3040
3533
|
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: amountUsd })
|
|
3041
3534
|
] }),
|
|
3042
3535
|
totalFeeUsd && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
3043
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3536
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.totalFees }),
|
|
3044
3537
|
/* @__PURE__ */ jsxs("span", { className: "text-destructive", children: [
|
|
3045
3538
|
"-",
|
|
3046
3539
|
totalFeeUsd
|
|
3047
3540
|
] })
|
|
3048
3541
|
] }),
|
|
3049
3542
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-2 border-t", children: [
|
|
3050
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3543
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.youReceive }),
|
|
3051
3544
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3052
3545
|
/* @__PURE__ */ jsx(TokenIcon, { symbol: withdrawal.currency_code, size: 24 }),
|
|
3053
3546
|
/* @__PURE__ */ jsx("span", { className: "font-mono font-bold text-lg", children: finalAmountUsd })
|
|
3054
3547
|
] })
|
|
3055
3548
|
] }),
|
|
3056
3549
|
withdrawal.crypto_amount && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
3057
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3550
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.cryptoAmount }),
|
|
3058
3551
|
/* @__PURE__ */ jsxs("span", { className: "font-mono", children: [
|
|
3059
3552
|
withdrawal.crypto_amount,
|
|
3060
3553
|
" ",
|
|
@@ -3063,14 +3556,14 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
3063
3556
|
] })
|
|
3064
3557
|
] }),
|
|
3065
3558
|
withdrawal.wallet_address && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3066
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children:
|
|
3559
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: labels.destinationWallet }),
|
|
3067
3560
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3068
3561
|
/* @__PURE__ */ jsx("div", { className: "flex-1 p-3 bg-muted rounded-xl font-mono text-sm break-all", children: withdrawal.wallet_address }),
|
|
3069
3562
|
/* @__PURE__ */ jsx(CopyButton, { value: withdrawal.wallet_address, variant: "outline", className: "shrink-0" })
|
|
3070
3563
|
] })
|
|
3071
3564
|
] }),
|
|
3072
3565
|
withdrawal.transaction_hash && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3073
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children:
|
|
3566
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: labels.transactionHash }),
|
|
3074
3567
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3075
3568
|
/* @__PURE__ */ jsx("div", { className: "flex-1 p-3 bg-muted rounded-xl font-mono text-sm break-all", children: withdrawal.transaction_hash }),
|
|
3076
3569
|
/* @__PURE__ */ jsx(CopyButton, { value: withdrawal.transaction_hash, variant: "outline", className: "shrink-0" })
|
|
@@ -3084,7 +3577,7 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
3084
3577
|
onClick: () => window.open(withdrawal.explorer_link, "_blank"),
|
|
3085
3578
|
children: [
|
|
3086
3579
|
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4 mr-2" }),
|
|
3087
|
-
|
|
3580
|
+
labels.viewOnExplorer
|
|
3088
3581
|
]
|
|
3089
3582
|
}
|
|
3090
3583
|
),
|
|
@@ -3096,29 +3589,29 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
3096
3589
|
onClick: handleCancel,
|
|
3097
3590
|
children: [
|
|
3098
3591
|
/* @__PURE__ */ jsx(Ban, { className: "h-4 w-4 mr-2" }),
|
|
3099
|
-
|
|
3592
|
+
labels.cancel
|
|
3100
3593
|
]
|
|
3101
3594
|
}
|
|
3102
3595
|
),
|
|
3103
3596
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2 text-xs text-muted-foreground pt-4 border-t", children: [
|
|
3104
3597
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
3105
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3598
|
+
/* @__PURE__ */ jsx("span", { children: labels.withdrawalId }),
|
|
3106
3599
|
/* @__PURE__ */ jsx("span", { className: "font-mono", children: withdrawal.id })
|
|
3107
3600
|
] }),
|
|
3108
3601
|
withdrawal.internal_withdrawal_id && /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
3109
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3602
|
+
/* @__PURE__ */ jsx("span", { children: labels.reference }),
|
|
3110
3603
|
/* @__PURE__ */ jsx("span", { className: "font-mono", children: withdrawal.internal_withdrawal_id })
|
|
3111
3604
|
] }),
|
|
3112
3605
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
3113
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3606
|
+
/* @__PURE__ */ jsx("span", { children: labels.created }),
|
|
3114
3607
|
/* @__PURE__ */ jsx("span", { children: createdAt })
|
|
3115
3608
|
] }),
|
|
3116
3609
|
completedAt && /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
3117
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3610
|
+
/* @__PURE__ */ jsx("span", { children: labels.completed }),
|
|
3118
3611
|
/* @__PURE__ */ jsx("span", { children: completedAt })
|
|
3119
3612
|
] }),
|
|
3120
3613
|
withdrawal.currency_network && /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
3121
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3614
|
+
/* @__PURE__ */ jsx("span", { children: labels.network }),
|
|
3122
3615
|
/* @__PURE__ */ jsx("span", { children: withdrawal.currency_network })
|
|
3123
3616
|
] })
|
|
3124
3617
|
] }),
|
|
@@ -3130,7 +3623,7 @@ function WithdrawalSheet({ withdrawalId, open, onOpenChange }) {
|
|
|
3130
3623
|
onClick: () => mutate(),
|
|
3131
3624
|
children: [
|
|
3132
3625
|
/* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4 mr-2" }),
|
|
3133
|
-
|
|
3626
|
+
labels.refreshStatus
|
|
3134
3627
|
]
|
|
3135
3628
|
}
|
|
3136
3629
|
)
|
|
@@ -3142,38 +3635,69 @@ var statusConfig3 = {
|
|
|
3142
3635
|
pending: {
|
|
3143
3636
|
icon: Clock,
|
|
3144
3637
|
color: "text-yellow-500",
|
|
3145
|
-
bg: "bg-yellow-500/10"
|
|
3146
|
-
label: "Waiting for payment"
|
|
3638
|
+
bg: "bg-yellow-500/10"
|
|
3147
3639
|
},
|
|
3148
3640
|
confirming: {
|
|
3149
3641
|
icon: RefreshCw,
|
|
3150
3642
|
color: "text-blue-500",
|
|
3151
3643
|
bg: "bg-blue-500/10",
|
|
3152
|
-
label: "Confirming",
|
|
3153
3644
|
animate: true
|
|
3154
3645
|
},
|
|
3155
3646
|
completed: {
|
|
3156
3647
|
icon: CheckCircle2,
|
|
3157
3648
|
color: "text-green-500",
|
|
3158
|
-
bg: "bg-green-500/10"
|
|
3159
|
-
label: "Completed"
|
|
3649
|
+
bg: "bg-green-500/10"
|
|
3160
3650
|
},
|
|
3161
3651
|
failed: {
|
|
3162
3652
|
icon: XCircle,
|
|
3163
3653
|
color: "text-red-500",
|
|
3164
|
-
bg: "bg-red-500/10"
|
|
3165
|
-
label: "Failed"
|
|
3654
|
+
bg: "bg-red-500/10"
|
|
3166
3655
|
},
|
|
3167
3656
|
expired: {
|
|
3168
3657
|
icon: AlertCircle,
|
|
3169
3658
|
color: "text-muted-foreground",
|
|
3170
|
-
bg: "bg-muted"
|
|
3171
|
-
label: "Expired"
|
|
3659
|
+
bg: "bg-muted"
|
|
3172
3660
|
}
|
|
3173
3661
|
};
|
|
3174
3662
|
function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
3663
|
+
const pt = usePaymentsT();
|
|
3175
3664
|
const { getPaymentDetails } = useWallet();
|
|
3176
3665
|
const [timeLeft, setTimeLeft] = useState("");
|
|
3666
|
+
const labels = useMemo(() => ({
|
|
3667
|
+
title: pt("sheets.paymentTitle"),
|
|
3668
|
+
// Status labels
|
|
3669
|
+
waiting: pt("paymentStatus.waiting"),
|
|
3670
|
+
confirming: pt("paymentStatus.confirming"),
|
|
3671
|
+
completed: pt("paymentStatus.completed"),
|
|
3672
|
+
failed: pt("paymentStatus.failed"),
|
|
3673
|
+
expired: pt("paymentStatus.expired"),
|
|
3674
|
+
paymentExpired: pt("paymentStatus.paymentExpired"),
|
|
3675
|
+
// Descriptions
|
|
3676
|
+
sendCrypto: pt("paymentDescriptions.sendCrypto"),
|
|
3677
|
+
expiredDesc: pt("paymentDescriptions.expired"),
|
|
3678
|
+
completedDesc: pt("paymentDescriptions.completed"),
|
|
3679
|
+
failedDesc: pt("paymentDescriptions.failed"),
|
|
3680
|
+
confirmingDesc: pt("paymentDescriptions.confirming"),
|
|
3681
|
+
createNew: pt("paymentDescriptions.createNew"),
|
|
3682
|
+
// Form
|
|
3683
|
+
amountToSend: pt("form.amountToSend"),
|
|
3684
|
+
equivalent: pt("form.equivalent"),
|
|
3685
|
+
network: pt("form.network"),
|
|
3686
|
+
paymentAddress: pt("form.paymentAddress"),
|
|
3687
|
+
transactionHash: pt("form.transactionHash"),
|
|
3688
|
+
paymentId: pt("form.paymentId"),
|
|
3689
|
+
orderId: pt("form.orderId"),
|
|
3690
|
+
created: pt("form.created"),
|
|
3691
|
+
// Actions
|
|
3692
|
+
tryAgain: pt("actions.tryAgain"),
|
|
3693
|
+
refreshStatus: pt("actions.refreshStatus"),
|
|
3694
|
+
createNewPayment: pt("actions.createNewPayment"),
|
|
3695
|
+
openInPaymentProvider: pt("actions.openInPaymentProvider"),
|
|
3696
|
+
// Withdraw
|
|
3697
|
+
expiresIn: pt("withdraw.expiresIn"),
|
|
3698
|
+
// Messages
|
|
3699
|
+
failedToLoadPayment: pt("messages.failedToLoadPayment")
|
|
3700
|
+
}), [pt]);
|
|
3177
3701
|
const { data: payment, isLoading, error, mutate } = useSWR(
|
|
3178
3702
|
open && paymentId ? ["payment-details", paymentId] : null,
|
|
3179
3703
|
() => getPaymentDetails(paymentId),
|
|
@@ -3214,18 +3738,25 @@ function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
|
3214
3738
|
const isFailed = status === "failed";
|
|
3215
3739
|
const isConfirming = status === "confirming";
|
|
3216
3740
|
const canPay2 = isPending && !isExpired2;
|
|
3741
|
+
const statusLabels = {
|
|
3742
|
+
pending: labels.waiting,
|
|
3743
|
+
confirming: labels.confirming,
|
|
3744
|
+
completed: labels.completed,
|
|
3745
|
+
failed: labels.failed,
|
|
3746
|
+
expired: labels.expired
|
|
3747
|
+
};
|
|
3217
3748
|
let description2 = "";
|
|
3218
|
-
if (canPay2) description2 =
|
|
3219
|
-
else if (isExpired2) description2 =
|
|
3220
|
-
else if (isCompleted) description2 =
|
|
3221
|
-
else if (isFailed) description2 =
|
|
3222
|
-
else if (isConfirming) description2 =
|
|
3749
|
+
if (canPay2) description2 = labels.sendCrypto;
|
|
3750
|
+
else if (isExpired2) description2 = labels.expiredDesc;
|
|
3751
|
+
else if (isCompleted) description2 = labels.completedDesc;
|
|
3752
|
+
else if (isFailed) description2 = labels.failedDesc;
|
|
3753
|
+
else if (isConfirming) description2 = labels.confirmingDesc;
|
|
3223
3754
|
const statusBadge2 = {
|
|
3224
3755
|
bg: isExpired2 ? "bg-muted" : config2.bg,
|
|
3225
3756
|
iconColor: isExpired2 ? "text-muted-foreground" : config2.color,
|
|
3226
3757
|
iconAnimate: config2.animate,
|
|
3227
|
-
label: isExpired2 ?
|
|
3228
|
-
subtitle: canPay2 && timeLeft ?
|
|
3758
|
+
label: isExpired2 ? labels.paymentExpired : statusLabels[status],
|
|
3759
|
+
subtitle: canPay2 && timeLeft ? `${labels.expiresIn} ${timeLeft}` : isExpired2 ? labels.createNew : null
|
|
3229
3760
|
};
|
|
3230
3761
|
const qrCodeUrl2 = payment?.pay_address && canPay2 ? `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(payment.pay_address)}` : null;
|
|
3231
3762
|
const amountUsd2 = payment?.amount_usd ? `$${parseFloat(payment.amount_usd).toFixed(2)} USD` : "";
|
|
@@ -3245,12 +3776,12 @@ function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
|
3245
3776
|
amountUsd: amountUsd2,
|
|
3246
3777
|
createdAt: createdAt2
|
|
3247
3778
|
};
|
|
3248
|
-
}, [payment, timeLeft]);
|
|
3779
|
+
}, [payment, timeLeft, labels]);
|
|
3249
3780
|
const { config, canPay, isExpired, description, statusBadge, qrCodeUrl, amountUsd, createdAt } = displayData;
|
|
3250
3781
|
const StatusIcon = config.icon;
|
|
3251
3782
|
return /* @__PURE__ */ jsx(ResponsiveSheet, { open, onOpenChange, children: /* @__PURE__ */ jsxs(ResponsiveSheetContent, { className: "sm:max-w-lg", children: [
|
|
3252
3783
|
/* @__PURE__ */ jsxs(ResponsiveSheetHeader, { children: [
|
|
3253
|
-
/* @__PURE__ */ jsx(ResponsiveSheetTitle, { children:
|
|
3784
|
+
/* @__PURE__ */ jsx(ResponsiveSheetTitle, { children: labels.title }),
|
|
3254
3785
|
/* @__PURE__ */ jsx(ResponsiveSheetDescription, { children: description })
|
|
3255
3786
|
] }),
|
|
3256
3787
|
/* @__PURE__ */ jsxs("div", { className: "p-4 sm:p-0 sm:mt-4 overflow-y-auto max-h-[70vh]", children: [
|
|
@@ -3261,8 +3792,8 @@ function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
|
3261
3792
|
] }),
|
|
3262
3793
|
error && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-12", children: [
|
|
3263
3794
|
/* @__PURE__ */ jsx(XCircle, { className: "h-12 w-12 text-destructive mb-4" }),
|
|
3264
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children:
|
|
3265
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => mutate(), children:
|
|
3795
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground mb-4", children: labels.failedToLoadPayment }),
|
|
3796
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => mutate(), children: labels.tryAgain })
|
|
3266
3797
|
] }),
|
|
3267
3798
|
payment && !isLoading && /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
3268
3799
|
/* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-3 p-4 rounded-xl", statusBadge.bg), children: [
|
|
@@ -3274,7 +3805,7 @@ function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
|
3274
3805
|
] }),
|
|
3275
3806
|
/* @__PURE__ */ jsxs("div", { className: "bg-muted rounded-xl p-4 space-y-3", children: [
|
|
3276
3807
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3277
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3808
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.amountToSend }),
|
|
3278
3809
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3279
3810
|
/* @__PURE__ */ jsx(TokenIcon, { symbol: payment.currency_code, size: 24 }),
|
|
3280
3811
|
/* @__PURE__ */ jsxs("span", { className: "font-mono font-bold text-lg", children: [
|
|
@@ -3285,17 +3816,17 @@ function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
|
3285
3816
|
] })
|
|
3286
3817
|
] }),
|
|
3287
3818
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
3288
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3819
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.equivalent }),
|
|
3289
3820
|
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: amountUsd })
|
|
3290
3821
|
] }),
|
|
3291
3822
|
payment.currency_network && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-sm pt-2 border-t", children: [
|
|
3292
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children:
|
|
3823
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: labels.network }),
|
|
3293
3824
|
/* @__PURE__ */ jsx("span", { className: "font-medium", children: payment.currency_network })
|
|
3294
3825
|
] })
|
|
3295
3826
|
] }),
|
|
3296
3827
|
qrCodeUrl && /* @__PURE__ */ jsx("div", { className: "flex justify-center p-6 bg-white rounded-xl", children: /* @__PURE__ */ jsx("img", { src: qrCodeUrl, alt: "Payment QR Code", className: "w-48 h-48" }) }),
|
|
3297
3828
|
payment.pay_address && canPay && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3298
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children:
|
|
3829
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: labels.paymentAddress }),
|
|
3299
3830
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3300
3831
|
/* @__PURE__ */ jsx("div", { className: "flex-1 p-3 bg-muted rounded-xl font-mono text-sm break-all", children: payment.pay_address }),
|
|
3301
3832
|
/* @__PURE__ */ jsx(CopyButton, { value: payment.pay_address, variant: "outline", className: "shrink-0" })
|
|
@@ -3310,11 +3841,11 @@ function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
|
3310
3841
|
onOpenChange(false);
|
|
3311
3842
|
onCreateNew();
|
|
3312
3843
|
},
|
|
3313
|
-
children:
|
|
3844
|
+
children: labels.createNewPayment
|
|
3314
3845
|
}
|
|
3315
3846
|
),
|
|
3316
3847
|
payment.transaction_hash && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3317
|
-
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children:
|
|
3848
|
+
/* @__PURE__ */ jsx("label", { className: "text-sm font-medium", children: labels.transactionHash }),
|
|
3318
3849
|
/* @__PURE__ */ jsx("div", { className: "p-3 bg-muted rounded-xl font-mono text-sm break-all", children: payment.transaction_hash })
|
|
3319
3850
|
] }),
|
|
3320
3851
|
payment.payment_url && canPay && /* @__PURE__ */ jsxs(
|
|
@@ -3325,21 +3856,21 @@ function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
|
3325
3856
|
onClick: () => window.open(payment.payment_url, "_blank"),
|
|
3326
3857
|
children: [
|
|
3327
3858
|
/* @__PURE__ */ jsx(ExternalLink, { className: "h-4 w-4 mr-2" }),
|
|
3328
|
-
|
|
3859
|
+
labels.openInPaymentProvider
|
|
3329
3860
|
]
|
|
3330
3861
|
}
|
|
3331
3862
|
),
|
|
3332
3863
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2 text-xs text-muted-foreground pt-4 border-t", children: [
|
|
3333
3864
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
3334
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3865
|
+
/* @__PURE__ */ jsx("span", { children: labels.paymentId }),
|
|
3335
3866
|
/* @__PURE__ */ jsx("span", { className: "font-mono", children: payment.id })
|
|
3336
3867
|
] }),
|
|
3337
3868
|
payment.internal_payment_id && /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
3338
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3869
|
+
/* @__PURE__ */ jsx("span", { children: labels.orderId }),
|
|
3339
3870
|
/* @__PURE__ */ jsx("span", { className: "font-mono", children: payment.internal_payment_id })
|
|
3340
3871
|
] }),
|
|
3341
3872
|
/* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
|
|
3342
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
3873
|
+
/* @__PURE__ */ jsx("span", { children: labels.created }),
|
|
3343
3874
|
/* @__PURE__ */ jsx("span", { children: createdAt })
|
|
3344
3875
|
] })
|
|
3345
3876
|
] }),
|
|
@@ -3351,7 +3882,7 @@ function PaymentSheet({ paymentId, open, onOpenChange, onCreateNew }) {
|
|
|
3351
3882
|
onClick: () => mutate(),
|
|
3352
3883
|
children: [
|
|
3353
3884
|
/* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4 mr-2" }),
|
|
3354
|
-
|
|
3885
|
+
labels.refreshStatus
|
|
3355
3886
|
]
|
|
3356
3887
|
}
|
|
3357
3888
|
)
|
|
@@ -3437,7 +3968,7 @@ function WalletPage() {
|
|
|
3437
3968
|
// package.json
|
|
3438
3969
|
var package_default = {
|
|
3439
3970
|
name: "@djangocfg/ext-payments",
|
|
3440
|
-
version: "1.0.
|
|
3971
|
+
version: "1.0.23",
|
|
3441
3972
|
description: "Payments system extension for DjangoCFG",
|
|
3442
3973
|
keywords: [
|
|
3443
3974
|
"django",
|
|
@@ -3488,6 +4019,11 @@ var package_default = {
|
|
|
3488
4019
|
types: "./dist/api/hooks.d.ts",
|
|
3489
4020
|
import: "./dist/api/hooks.js",
|
|
3490
4021
|
require: "./dist/api/hooks.cjs"
|
|
4022
|
+
},
|
|
4023
|
+
"./i18n": {
|
|
4024
|
+
types: "./dist/i18n.d.ts",
|
|
4025
|
+
import: "./dist/i18n.js",
|
|
4026
|
+
require: "./dist/i18n.cjs"
|
|
3491
4027
|
}
|
|
3492
4028
|
},
|
|
3493
4029
|
files: [
|
|
@@ -3503,27 +4039,31 @@ var package_default = {
|
|
|
3503
4039
|
peerDependencies: {
|
|
3504
4040
|
"@djangocfg/api": "workspace:*",
|
|
3505
4041
|
"@djangocfg/ext-base": "workspace:*",
|
|
4042
|
+
"@djangocfg/i18n": "workspace:*",
|
|
3506
4043
|
"@djangocfg/ui-core": "workspace:*",
|
|
3507
4044
|
"@djangocfg/ui-nextjs": "workspace:*",
|
|
4045
|
+
"@hookform/resolvers": "^5.2.2",
|
|
3508
4046
|
consola: "^3.4.2",
|
|
3509
4047
|
"lucide-react": "^0.545.0",
|
|
4048
|
+
moment: "^2.30.1",
|
|
3510
4049
|
next: "^16",
|
|
4050
|
+
"next-intl": "^4",
|
|
3511
4051
|
"p-retry": "^7.0.0",
|
|
3512
4052
|
react: "^19",
|
|
3513
|
-
swr: "^2.3.7",
|
|
3514
|
-
zod: "^4.3.4",
|
|
3515
|
-
moment: "^2.30.1",
|
|
3516
4053
|
"react-hook-form": "^7.69.0",
|
|
3517
|
-
|
|
4054
|
+
swr: "^2.3.7",
|
|
4055
|
+
zod: "^4.3.4"
|
|
3518
4056
|
},
|
|
3519
4057
|
devDependencies: {
|
|
3520
4058
|
"@djangocfg/api": "workspace:*",
|
|
3521
4059
|
"@djangocfg/ext-base": "workspace:*",
|
|
4060
|
+
"@djangocfg/i18n": "workspace:*",
|
|
3522
4061
|
"@djangocfg/typescript-config": "workspace:*",
|
|
3523
4062
|
"@djangocfg/ui-nextjs": "workspace:*",
|
|
3524
4063
|
"@types/node": "^24.7.2",
|
|
3525
4064
|
"@types/react": "^19.0.0",
|
|
3526
4065
|
consola: "^3.4.2",
|
|
4066
|
+
"next-intl": "^4.1.0",
|
|
3527
4067
|
"p-retry": "^7.0.0",
|
|
3528
4068
|
swr: "^2.3.7",
|
|
3529
4069
|
tsup: "^8.5.0",
|