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