@binopartner/pay-sdk 0.1.1 → 0.3.0
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/README.md +145 -2
- package/dist/core/api-base.d.ts +49 -0
- package/dist/core/api-base.js +196 -0
- package/dist/core/appearance.d.ts +17 -0
- package/dist/core/appearance.js +122 -0
- package/dist/core/auth.d.ts +32 -0
- package/dist/core/auth.js +233 -0
- package/dist/core/client.d.ts +71 -0
- package/dist/core/client.js +307 -0
- package/dist/core/clock.d.ts +7 -0
- package/dist/core/clock.js +17 -0
- package/dist/core/errors.d.ts +29 -0
- package/dist/core/errors.js +87 -0
- package/dist/core/events.d.ts +50 -0
- package/dist/core/events.js +1 -0
- package/dist/core/flows/deposit.d.ts +63 -0
- package/dist/core/flows/deposit.js +502 -0
- package/dist/core/flows/withdraw.d.ts +51 -0
- package/dist/core/flows/withdraw.js +413 -0
- package/dist/core/i18n/ar.d.ts +2 -0
- package/dist/core/i18n/ar.js +314 -0
- package/dist/core/i18n/base.d.ts +14 -0
- package/dist/core/i18n/base.js +86 -0
- package/dist/core/i18n/cs.d.ts +2 -0
- package/dist/core/i18n/cs.js +314 -0
- package/dist/core/i18n/de.d.ts +2 -0
- package/dist/core/i18n/de.js +314 -0
- package/dist/core/i18n/en-ui.d.ts +39 -0
- package/dist/core/i18n/en-ui.js +39 -0
- package/dist/core/i18n/en.d.ts +316 -0
- package/dist/core/i18n/en.js +280 -0
- package/dist/core/i18n/es.d.ts +2 -0
- package/dist/core/i18n/es.js +314 -0
- package/dist/core/i18n/fr.d.ts +2 -0
- package/dist/core/i18n/fr.js +314 -0
- package/dist/core/i18n/hi.d.ts +2 -0
- package/dist/core/i18n/hi.js +314 -0
- package/dist/core/i18n/index.d.ts +16 -0
- package/dist/core/i18n/index.js +39 -0
- package/dist/core/i18n/it.d.ts +2 -0
- package/dist/core/i18n/it.js +314 -0
- package/dist/core/i18n/ru.d.ts +2 -0
- package/dist/core/i18n/ru.js +314 -0
- package/dist/core/i18n/tr.d.ts +2 -0
- package/dist/core/i18n/tr.js +314 -0
- package/dist/core/i18n/ua.d.ts +2 -0
- package/dist/core/i18n/ua.js +314 -0
- package/dist/core/index.d.ts +37 -0
- package/dist/core/index.js +19 -0
- package/dist/core/intent.d.ts +13 -0
- package/dist/core/intent.js +45 -0
- package/dist/core/money.d.ts +22 -0
- package/dist/core/money.js +178 -0
- package/dist/core/poll.d.ts +16 -0
- package/dist/core/poll.js +100 -0
- package/dist/core/requisites-frame.d.ts +32 -0
- package/dist/core/requisites-frame.js +202 -0
- package/dist/core/rules/address.d.ts +3 -0
- package/dist/core/rules/address.js +29 -0
- package/dist/core/rules/limits.d.ts +17 -0
- package/dist/core/rules/limits.js +19 -0
- package/dist/core/rules/paying.d.ts +10 -0
- package/dist/core/rules/paying.js +32 -0
- package/dist/core/rules/receipt.d.ts +6 -0
- package/dist/core/rules/receipt.js +33 -0
- package/dist/core/rules/requisites.d.ts +42 -0
- package/dist/core/rules/requisites.js +68 -0
- package/dist/core/rules/slippage.d.ts +1 -0
- package/dist/core/rules/slippage.js +7 -0
- package/dist/core/store.d.ts +15 -0
- package/dist/core/store.js +53 -0
- package/dist/core/types.d.ts +244 -0
- package/dist/core/types.js +1 -0
- package/dist/core/wire.d.ts +178 -0
- package/dist/core/wire.js +602 -0
- package/dist/elements/Root.d.ts +37 -0
- package/dist/elements/Root.js +143 -0
- package/dist/elements/chains.d.ts +1 -0
- package/dist/elements/chains.js +1 -0
- package/dist/elements/components/Qr.d.ts +17 -0
- package/dist/elements/components/Qr.js +28 -0
- package/dist/elements/components/basic.d.ts +42 -0
- package/dist/elements/components/basic.js +129 -0
- package/dist/elements/components/deposit.d.ts +61 -0
- package/dist/elements/components/deposit.js +272 -0
- package/dist/elements/components/inputs.d.ts +24 -0
- package/dist/elements/components/inputs.js +92 -0
- package/dist/elements/components/pickers.d.ts +32 -0
- package/dist/elements/components/pickers.js +267 -0
- package/dist/elements/components/status.d.ts +25 -0
- package/dist/elements/components/status.js +221 -0
- package/dist/elements/context.d.ts +47 -0
- package/dist/elements/context.js +33 -0
- package/dist/elements/hooks/deposit.d.ts +52 -0
- package/dist/elements/hooks/deposit.js +215 -0
- package/dist/elements/hooks/root.d.ts +70 -0
- package/dist/elements/hooks/root.js +125 -0
- package/dist/elements/hooks/withdraw.d.ts +30 -0
- package/dist/elements/hooks/withdraw.js +145 -0
- package/dist/elements/index.d.ts +28 -0
- package/dist/elements/index.js +14 -0
- package/dist/elements/part.d.ts +2 -0
- package/dist/elements/part.js +1 -0
- package/dist/elements/presets/DepositForm.d.ts +32 -0
- package/dist/elements/presets/DepositForm.js +97 -0
- package/dist/elements/presets/WithdrawForm.d.ts +25 -0
- package/dist/elements/presets/WithdrawForm.js +44 -0
- package/dist/elements/presets/focus.d.ts +2 -0
- package/dist/elements/presets/focus.js +26 -0
- package/dist/elements.css +2777 -0
- package/dist/fonts.css +31 -0
- package/dist/frame.d.ts +1 -0
- package/dist/frame.js +37 -6
- package/dist/types.d.ts +1 -0
- package/dist/ui/chains.d.ts +3 -0
- package/dist/ui/chains.js +42 -0
- package/dist/ui/context.d.ts +51 -0
- package/dist/ui/context.js +63 -0
- package/dist/ui/crypto.d.ts +67 -0
- package/dist/ui/crypto.js +68 -0
- package/dist/ui/entry.d.ts +25 -0
- package/dist/ui/entry.js +26 -0
- package/dist/ui/fiat.d.ts +94 -0
- package/dist/ui/fiat.js +149 -0
- package/dist/ui/fields.d.ts +76 -0
- package/dist/ui/fields.js +71 -0
- package/dist/ui/fonts.d.ts +4 -0
- package/dist/ui/fonts.js +31 -0
- package/dist/ui/icons.d.ts +39 -0
- package/dist/ui/icons.js +116 -0
- package/dist/ui/index.d.ts +31 -0
- package/dist/ui/index.js +17 -0
- package/dist/ui/layout.d.ts +36 -0
- package/dist/ui/layout.js +44 -0
- package/dist/ui/logos.d.ts +14 -0
- package/dist/ui/logos.js +61 -0
- package/dist/ui/part.d.ts +32 -0
- package/dist/ui/part.js +33 -0
- package/dist/ui/pickers.d.ts +71 -0
- package/dist/ui/pickers.js +167 -0
- package/dist/ui/qr-encode.d.ts +30 -0
- package/dist/ui/qr-encode.js +340 -0
- package/dist/ui/summary.d.ts +31 -0
- package/dist/ui/summary.js +36 -0
- package/dist/ui/types.d.ts +67 -0
- package/dist/ui/types.js +1 -0
- package/dist/ui/urls.d.ts +4 -0
- package/dist/ui/urls.js +41 -0
- package/dist/ui/withdraw.d.ts +38 -0
- package/dist/ui/withdraw.js +30 -0
- package/dist/ui.css +2699 -0
- package/dist/widget-url.d.ts +1 -0
- package/dist/widget-url.js +16 -0
- package/package.json +46 -5
package/dist/ui/fiat.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useEffect, useRef, useState, } from "react";
|
|
4
|
+
import { useClasses } from "./context.js";
|
|
5
|
+
import { CopyButton, LTR_ISOLATE } from "./crypto.js";
|
|
6
|
+
import { SubmitButton } from "./fields.js";
|
|
7
|
+
import { CheckIcon, GeoIcon, PaperclipIcon } from "./icons.js";
|
|
8
|
+
import { SENSITIVE_PROPS, partProps, viewProps } from "./part.js";
|
|
9
|
+
export const Requisites = forwardRef(function Requisites({ rows, note, testId, part = "requisites-block", sensitive = true, children, className, style, unstyled, ...rest }, ref) {
|
|
10
|
+
const { c, off } = useClasses(unstyled);
|
|
11
|
+
return (_jsxs("div", { "data-testid": testId, ...rest, ref: ref, ...viewProps(part, "requisites-block", { className, style, unstyled }, off, { sensitive }), ...(sensitive ? SENSITIVE_PROPS : {}), children: [rows.map((row) => {
|
|
12
|
+
const ltr = row.mono || row.accent;
|
|
13
|
+
return (_jsxs("div", { className: c("requisite-row"), "data-binodex-pay": "requisites-row", "data-kind": row.key, ...row.attrs, children: [_jsxs("span", { className: c("requisite-text"), children: [_jsx("span", { className: c("requisite-label"), children: row.label }), _jsx("span", { className: c("requisite-value", row.mono && "requisite-mono", row.accent && "requisite-accent"), "data-binodex-pay": "requisite-value", dir: ltr ? "ltr" : undefined, style: ltr ? LTR_ISOLATE : undefined, children: row.value })] }), row.copy !== undefined && _jsx(CopyButton, { value: row.copy, label: row.label, variant: "requisite", unstyled: unstyled })] }, row.key ?? row.label));
|
|
14
|
+
}), note && (_jsx("div", { className: c("requisites-note"), role: "note", "data-binodex-pay": "hint", children: note })), children] }));
|
|
15
|
+
});
|
|
16
|
+
export const PayingPanel = forwardRef(function PayingPanel({ part = "paying-panel", className, style, unstyled, children, ...rest }, ref) {
|
|
17
|
+
const { off } = useClasses(unstyled);
|
|
18
|
+
return (_jsx("div", { ...rest, ref: ref, ...viewProps(part, "paying-panel", { className, style, unstyled }, off), children: children }));
|
|
19
|
+
});
|
|
20
|
+
export const StatusPill = forwardRef(function StatusPill({ tone, label, part = "status-pill", className, style, unstyled, ...rest }, ref) {
|
|
21
|
+
const { c, off } = useClasses(unstyled);
|
|
22
|
+
return (_jsxs("div", { ...rest, ref: ref, ...viewProps(part, "status-pill", { className, style, unstyled }, off), "data-tone": tone, children: [_jsx("span", { className: c("status-dot") }), _jsx("span", { "data-binodex-pay": "status-label", children: label })] }));
|
|
23
|
+
});
|
|
24
|
+
export const PanelAmount = ({ children, unstyled }) => {
|
|
25
|
+
const { c } = useClasses(unstyled);
|
|
26
|
+
return (_jsx("div", { className: c("amount-big"), "data-binodex-pay": "status-amount", dir: "ltr", style: LTR_ISOLATE, children: children }));
|
|
27
|
+
};
|
|
28
|
+
export const PanelHint = ({ children, unstyled }) => {
|
|
29
|
+
const { c } = useClasses(unstyled);
|
|
30
|
+
return (_jsx("div", { className: c("pay-hint"), "data-binodex-pay": "status-hint", children: children }));
|
|
31
|
+
};
|
|
32
|
+
export const ExpiresLine = forwardRef(function ExpiresLine({ part = "expires", className, style, unstyled, children, ...rest }, ref) {
|
|
33
|
+
const { off } = useClasses(unstyled);
|
|
34
|
+
return (_jsx("div", { ...rest, ref: ref, ...viewProps(part, "expires", { className, style, unstyled }, off), children: children }));
|
|
35
|
+
});
|
|
36
|
+
export const PayActions = ({ children, unstyled }) => {
|
|
37
|
+
const { c } = useClasses(unstyled);
|
|
38
|
+
return (_jsx("div", { className: c("pay-actions"), "data-binodex-pay": "actions", children: children }));
|
|
39
|
+
};
|
|
40
|
+
export const StatusPanel = forwardRef(function StatusPanel({ tone, statusLabel, amountLabel, hint, expiresLabel, actions, children, unstyled, ...rest }, ref) {
|
|
41
|
+
return (_jsxs(PayingPanel, { ...rest, ref: ref, unstyled: unstyled, children: [_jsx(StatusPill, { tone: tone, label: statusLabel, unstyled: unstyled }), _jsx(PanelAmount, { unstyled: unstyled, children: amountLabel }), hint && _jsx(PanelHint, { unstyled: unstyled, children: hint }), children, expiresLabel && _jsx(ExpiresLine, { unstyled: unstyled, children: expiresLabel }), actions && _jsx(PayActions, { unstyled: unstyled, children: actions })] }));
|
|
42
|
+
});
|
|
43
|
+
export const ReceiptBlock = forwardRef(function ReceiptBlock({ part = "receipt", className, style, unstyled, children, ...rest }, ref) {
|
|
44
|
+
const { off } = useClasses(unstyled);
|
|
45
|
+
return (_jsx("div", { ...rest, ref: ref, ...viewProps(part, "receipt-block", { className, style, unstyled }, off), children: children }));
|
|
46
|
+
});
|
|
47
|
+
export const QrImageCard = ({ children, variant = "card", unstyled, }) => {
|
|
48
|
+
const { c } = useClasses(unstyled);
|
|
49
|
+
return (_jsx("div", { className: c("qr-card"), "data-binodex-pay": "qr-card", "data-variant": variant, children: children }));
|
|
50
|
+
};
|
|
51
|
+
export const RailForm = forwardRef(function RailForm({ as = "form", variant = "default", part = "rail-form", className, style, unstyled, children, ...rest }, ref) {
|
|
52
|
+
const { off } = useClasses(unstyled);
|
|
53
|
+
const props = {
|
|
54
|
+
...viewProps(part, "rail-form", { className, style, unstyled }, off),
|
|
55
|
+
"data-variant": variant,
|
|
56
|
+
};
|
|
57
|
+
if (as === "div") {
|
|
58
|
+
return (_jsx("div", { ref: ref, ...props, children: children }));
|
|
59
|
+
}
|
|
60
|
+
return (_jsx("form", { ...rest, ref: ref, ...props, children: children }));
|
|
61
|
+
});
|
|
62
|
+
export const PdfReceiptWarning = forwardRef(function PdfReceiptWarning({ className, style, unstyled, ...rest }, ref) {
|
|
63
|
+
const { ui, c, off } = useClasses(unstyled);
|
|
64
|
+
return (_jsxs("div", { role: "note", ...rest, ref: ref, ...partProps("receipt-warning", { className, style, unstyled }, off), children: [_jsx("span", { className: c("receipt-warning-title"), children: ui.t("receipt.pdfTitle") }), _jsxs("ul", { className: c("receipt-warning-list"), children: [_jsx("li", { children: ui.t("receipt.pdfCredit") }), _jsx("li", { children: ui.t("receipt.pdfFormat") }), _jsx("li", { children: ui.t("receipt.pdfOnce") })] })] }));
|
|
65
|
+
});
|
|
66
|
+
export const ReceiptAttached = forwardRef(function ReceiptAttached({ title, body, className, style, unstyled, ...rest }, ref) {
|
|
67
|
+
const { ui, c, off } = useClasses(unstyled);
|
|
68
|
+
return (_jsxs("div", { role: "status", ...rest, ref: ref, ...partProps("receipt-attached", { className, style, unstyled }, off), children: [_jsx("span", { className: c("receipt-attached-mark"), "aria-hidden": "true", children: _jsx(CheckIcon, { size: 13 }) }), _jsxs("span", { children: [_jsx("span", { className: c("receipt-attached-title"), children: title ?? ui.t("receipt.successTitle") }), body ?? ui.t("receipt.successBody")] })] }));
|
|
69
|
+
});
|
|
70
|
+
const RECEIPT_ACCEPT = "application/pdf,image/jpeg,image/png,image/webp,image/heic";
|
|
71
|
+
const RECEIPT_ACCEPT_PDF = "application/pdf";
|
|
72
|
+
export const RECEIPT_MAX_BYTES = 8 * 1024 * 1024;
|
|
73
|
+
export const isPdfFile = (file) => file.type === "application/pdf" || /\.pdf$/i.test(file.name);
|
|
74
|
+
export const ReceiptForm = forwardRef(function ReceiptForm({ onSubmit, file: fileProp, onFileChange, onPreview, pdfOnly = false, sending = false, error, maxBytes = RECEIPT_MAX_BYTES, accept, inputRef, className, style, unstyled, ...rest }, ref) {
|
|
75
|
+
const { ui, c, off } = useClasses(unstyled);
|
|
76
|
+
const [ownFile, setFile] = useState(null);
|
|
77
|
+
const file = onFileChange ? (fileProp ?? null) : ownFile;
|
|
78
|
+
const [localError, setLocalError] = useState(null);
|
|
79
|
+
const [dragOver, setDragOver] = useState(false);
|
|
80
|
+
const [previewUrl, setPreviewUrl] = useState(null);
|
|
81
|
+
const input = useRef(null);
|
|
82
|
+
const isImage = !!file && file.type.startsWith("image/");
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
if (!file || !file.type.startsWith("image/") || typeof URL.createObjectURL !== "function") {
|
|
85
|
+
setPreviewUrl(null);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const url = URL.createObjectURL(file);
|
|
89
|
+
setPreviewUrl(url);
|
|
90
|
+
return () => URL.revokeObjectURL(url);
|
|
91
|
+
}, [file]);
|
|
92
|
+
const acceptFile = (next) => {
|
|
93
|
+
if (onFileChange) {
|
|
94
|
+
onFileChange(next);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
setLocalError(null);
|
|
98
|
+
if (!next)
|
|
99
|
+
return;
|
|
100
|
+
if (next.size > maxBytes) {
|
|
101
|
+
setLocalError(ui.t("receipt.tooLarge"));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (pdfOnly && !isPdfFile(next)) {
|
|
105
|
+
setLocalError(ui.t("receipt.pdfOnlyError"));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
setFile(next);
|
|
109
|
+
};
|
|
110
|
+
const shownError = localError ?? error;
|
|
111
|
+
return (_jsxs("div", { ...rest, ref: ref, ...partProps("receipt-form", { className, style, unstyled }, off), children: [_jsxs("div", { className: c("drop", dragOver && "drop-active", file && "drop-filled"), "data-binodex-pay": "receipt-drop", role: "button", tabIndex: 0, onClick: () => input.current?.click(), onKeyDown: (event) => {
|
|
112
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
input.current?.click();
|
|
115
|
+
}
|
|
116
|
+
}, onDragOver: (event) => {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
setDragOver(true);
|
|
119
|
+
}, onDragLeave: () => setDragOver(false), onDrop: (event) => {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
setDragOver(false);
|
|
122
|
+
acceptFile(event.dataTransfer.files?.[0]);
|
|
123
|
+
}, children: [_jsx("input", { ref: (element) => {
|
|
124
|
+
input.current = element;
|
|
125
|
+
if (typeof inputRef === "function")
|
|
126
|
+
inputRef(element);
|
|
127
|
+
else if (inputRef)
|
|
128
|
+
inputRef.current = element;
|
|
129
|
+
}, type: "file", accept: pdfOnly ? RECEIPT_ACCEPT_PDF : (accept ?? RECEIPT_ACCEPT), className: c("file-input"), hidden: off ? true : undefined, "aria-label": ui.t("receipt.label"), disabled: sending, onClick: (event) => event.stopPropagation(), onChange: (event) => {
|
|
130
|
+
acceptFile(event.target.files?.[0]);
|
|
131
|
+
event.target.value = "";
|
|
132
|
+
} }), file && isImage && previewUrl && onPreview ? (_jsxs("button", { type: "button", className: c("preview-chip"), onClick: (event) => {
|
|
133
|
+
event.stopPropagation();
|
|
134
|
+
onPreview();
|
|
135
|
+
}, children: [_jsx("img", { className: c("preview-thumb"), src: previewUrl, alt: "" }), _jsxs("span", { className: c("preview-meta"), children: [_jsx("span", { className: c("file-name"), children: file.name }), _jsx("span", { className: c("preview-hint"), children: ui.t("receipt.viewHint") })] })] })) : file && isImage && previewUrl ? (_jsxs("span", { className: c("preview-chip"), onClick: (event) => event.stopPropagation(), children: [_jsx("img", { className: c("preview-thumb"), src: previewUrl, alt: "" }), _jsx("span", { className: c("preview-meta"), children: _jsx("span", { className: c("file-name"), children: file.name }) })] })) : file ? (_jsxs("span", { className: c("file-chip"), children: [_jsx("span", { className: c("file-icon"), "aria-hidden": "true", children: _jsx(PaperclipIcon, {}) }), _jsx("span", { className: c("file-name"), children: file.name }), _jsxs("span", { className: c("file-size"), children: [(file.size / (1024 * 1024)).toFixed(1), " MB"] })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: c("drop-icon"), "aria-hidden": "true", children: "⇪" }), _jsx("span", { className: c("drop-text"), children: ui.t("receipt.drop") }), _jsx("span", { className: c("drop-hint"), children: ui.t(pdfOnly ? "receipt.formatsPdf" : "receipt.formats") })] }))] }), shownError && (_jsx("div", { className: c("receipt-error"), role: "alert", "data-binodex-pay": "field-error", children: shownError })), _jsx(SubmitButton, { variant: "receipt", part: "receipt-submit", disabled: !file || sending, pending: sending, onClick: () => {
|
|
136
|
+
if (file && !sending)
|
|
137
|
+
void onSubmit(file);
|
|
138
|
+
}, unstyled: unstyled, children: ui.t(sending ? "receipt.sending" : "receipt.submit") })] }));
|
|
139
|
+
});
|
|
140
|
+
export const PollNotice = forwardRef(function PollNotice({ health, className, style, unstyled }, ref) {
|
|
141
|
+
const { ui, off } = useClasses(unstyled);
|
|
142
|
+
if (health === "ok")
|
|
143
|
+
return null;
|
|
144
|
+
return (_jsx("p", { ref: ref, role: "status", ...partProps("poll-notice", { className, style, unstyled }, off), "data-health": health, children: ui.t(health === "retrying" ? "poll.reconnecting" : "poll.unavailable") }));
|
|
145
|
+
});
|
|
146
|
+
export const GeoBlock = forwardRef(function GeoBlock({ onClose, className, style, unstyled, ...rest }, ref) {
|
|
147
|
+
const { ui, c, off } = useClasses(unstyled);
|
|
148
|
+
return (_jsxs("div", { ...rest, ref: ref, ...partProps("geo-block", { className, style, unstyled }, off), children: [_jsx("div", { className: c("geo-icon"), "aria-hidden": "true", children: _jsx(GeoIcon, {}) }), _jsx("h3", { className: c("geo-title"), children: ui.t("geo.title") }), _jsx("p", { className: c("geo-text"), children: ui.t("geo.text") }), _jsx("p", { className: c("geo-note"), children: ui.t("geo.note") }), onClose && (_jsx("button", { type: "button", className: c("geo-button"), onClick: onClose, children: ui.t("geo.ok") }))] }));
|
|
149
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type HTMLAttributes, type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import { type PartStyleProps } from "./part.js";
|
|
3
|
+
type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "className" | "style" | "value" | "onChange" | "children" | "size">;
|
|
4
|
+
export type FieldVariant = "pay" | "withdraw";
|
|
5
|
+
interface BaseFieldProps extends PartStyleProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
value: string;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
hint?: ReactNode;
|
|
11
|
+
error?: ReactNode;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
part?: string;
|
|
15
|
+
variant?: FieldVariant;
|
|
16
|
+
inputProps?: InputProps;
|
|
17
|
+
}
|
|
18
|
+
export interface AmountFieldProps extends BaseFieldProps {
|
|
19
|
+
suffix?: ReactNode;
|
|
20
|
+
onMax?: () => void;
|
|
21
|
+
maxLabel?: ReactNode;
|
|
22
|
+
footer?: [ReactNode, ReactNode];
|
|
23
|
+
sanitize?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare const AmountField: import("react").ForwardRefExoticComponent<AmountFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
26
|
+
export interface TextFieldProps extends BaseFieldProps {
|
|
27
|
+
type?: string;
|
|
28
|
+
code?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
31
|
+
export interface TwoFactorFieldProps extends Omit<TextFieldProps, "code" | "type"> {
|
|
32
|
+
}
|
|
33
|
+
export declare const TwoFactorField: import("react").ForwardRefExoticComponent<TwoFactorFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
34
|
+
export type ButtonVariant = "pay" | "withdraw" | "receipt" | "trade";
|
|
35
|
+
type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "className" | "style"> & PartStyleProps & {
|
|
36
|
+
variant?: ButtonVariant;
|
|
37
|
+
part?: string;
|
|
38
|
+
pending?: boolean;
|
|
39
|
+
};
|
|
40
|
+
export declare const SubmitButton: import("react").ForwardRefExoticComponent<Omit<ButtonHTMLAttributes<HTMLButtonElement>, "style" | "className"> & PartStyleProps & {
|
|
41
|
+
variant?: ButtonVariant;
|
|
42
|
+
part?: string;
|
|
43
|
+
pending?: boolean;
|
|
44
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
45
|
+
export declare const SubmitLink: import("react").ForwardRefExoticComponent<Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "style" | "className"> & PartStyleProps & {
|
|
46
|
+
variant?: ButtonVariant;
|
|
47
|
+
part?: string;
|
|
48
|
+
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
49
|
+
export declare const RetryButton: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "pending" | "variant"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
50
|
+
export declare const LinkButton: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "pending" | "variant"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
51
|
+
export type ErrorBoxVariant = "deposit" | "rail" | "withdraw";
|
|
52
|
+
export declare const ErrorBox: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "children" | "className"> & PartStyleProps & {
|
|
53
|
+
variant?: ErrorBoxVariant;
|
|
54
|
+
part?: string;
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
57
|
+
export interface SkeletonProps extends PartStyleProps {
|
|
58
|
+
width?: number | string;
|
|
59
|
+
height: number | string;
|
|
60
|
+
radius?: number | string;
|
|
61
|
+
}
|
|
62
|
+
export declare const Skeleton: ({ width, height, radius, className, style, unstyled }: SkeletonProps) => import("react").JSX.Element;
|
|
63
|
+
export declare const Loader: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "children" | "className"> & PartStyleProps & {
|
|
64
|
+
label?: ReactNode;
|
|
65
|
+
part?: string;
|
|
66
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
67
|
+
export declare const Hint: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "children" | "className"> & PartStyleProps & {
|
|
68
|
+
part?: string;
|
|
69
|
+
children?: ReactNode;
|
|
70
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
71
|
+
export declare const Notice: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "children" | "className"> & PartStyleProps & {
|
|
72
|
+
variant?: "hint" | "receipt" | "warning" | "info";
|
|
73
|
+
part?: string;
|
|
74
|
+
children?: ReactNode;
|
|
75
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useId, } from "react";
|
|
4
|
+
import { useClasses } from "./context.js";
|
|
5
|
+
import { partProps, viewProps } from "./part.js";
|
|
6
|
+
const describedBy = (id, error, hint) => error ? `${id}-error` : hint ? `${id}-hint` : undefined;
|
|
7
|
+
function FieldMessages({ inputId, hint, error, variant, unstyled, }) {
|
|
8
|
+
const { c } = useClasses(unstyled);
|
|
9
|
+
if (error) {
|
|
10
|
+
return (_jsx("div", { className: c("field-error"), "data-binodex-pay": "field-error", id: `${inputId}-error`, role: "alert", children: error }));
|
|
11
|
+
}
|
|
12
|
+
if (hint) {
|
|
13
|
+
return (_jsx("div", { className: c(variant === "withdraw" ? "code-hint" : "hint"), "data-binodex-pay": "hint", id: `${inputId}-hint`, children: hint }));
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
export const AmountField = forwardRef(function AmountField({ id, label, value, onChange, hint, error, disabled = false, placeholder, part = "amount-field", variant = "pay", suffix, onMax, maxLabel, footer, sanitize = true, inputProps, className, style, unstyled, }, ref) {
|
|
18
|
+
const { ui, c, off } = useClasses(unstyled);
|
|
19
|
+
const generated = useId();
|
|
20
|
+
const inputId = id ?? `bp-amount-${generated}`;
|
|
21
|
+
const withdraw = variant === "withdraw";
|
|
22
|
+
const inputStyle = !withdraw && !off ? { paddingRight: 56 } : undefined;
|
|
23
|
+
return (_jsxs("div", { ...viewProps(part, "amount-field", { className, style, unstyled }, off), "data-variant": variant, "data-invalid": error ? "" : undefined, children: [_jsx("label", { className: c("field-label"), htmlFor: inputId, "data-binodex-pay": "label", children: label }), _jsxs("div", { className: c("amount-row"), "data-binodex-pay": "control", children: [_jsx("input", { type: "text", inputMode: "decimal", autoComplete: "off", placeholder: placeholder ?? (withdraw ? "$0.00" : "0"), maxLength: withdraw ? 12 : undefined, ...inputProps, ref: ref, id: inputId, className: c("input", withdraw && "input-raised", error ? "input-error" : null), style: inputStyle, value: value, disabled: disabled || inputProps?.disabled, "aria-invalid": error ? true : undefined, "aria-describedby": describedBy(inputId, error, hint), onChange: (event) => onChange(sanitize ? event.target.value.replace(/[^\d.,]/g, "") : event.target.value) }), withdraw ? (_jsxs("div", { className: c("amount-right"), children: [suffix !== undefined && (_jsx("span", { className: c("amount-unit"), "data-binodex-pay": "amount-currency", children: suffix })), onMax && (_jsx("button", { type: "button", className: c("max-button"), "data-binodex-pay": "max", onClick: onMax, disabled: disabled, children: maxLabel ?? ui.t("withdraw.max") }))] })) : (suffix !== undefined && (_jsx("span", { className: c("amount-suffix"), "data-binodex-pay": "amount-currency", children: suffix })))] }), footer && (_jsxs("div", { className: c("amount-footer"), "data-binodex-pay": "amount-footer", children: [_jsx("span", { children: footer[0] }), _jsx("span", { children: footer[1] })] })), _jsx(FieldMessages, { inputId: inputId, hint: hint, error: error, variant: variant, unstyled: unstyled })] }));
|
|
24
|
+
});
|
|
25
|
+
export const TextField = forwardRef(function TextField({ id, label, value, onChange, hint, error, disabled = false, placeholder, part = "text-field", variant = "withdraw", type = "text", code = false, inputProps, className, style, unstyled, }, ref) {
|
|
26
|
+
const { c, off } = useClasses(unstyled);
|
|
27
|
+
const generated = useId();
|
|
28
|
+
const inputId = id ?? `bp-field-${generated}`;
|
|
29
|
+
return (_jsxs("div", { ...viewProps(part, "text-field", { className, style, unstyled }, off), "data-variant": variant, "data-invalid": error ? "" : undefined, children: [_jsx("label", { className: c("field-label"), htmlFor: inputId, "data-binodex-pay": "label", children: label }), _jsx("input", { type: type, placeholder: placeholder, ...inputProps, ref: ref, id: inputId, className: c("input", variant === "withdraw" && "input-raised", code && "input-code", error ? "input-error" : null), value: value, disabled: disabled || inputProps?.disabled, "aria-invalid": error ? true : undefined, "aria-describedby": describedBy(inputId, error, hint), onChange: (event) => onChange(event.target.value) }), _jsx(FieldMessages, { inputId: inputId, hint: hint, error: error, variant: variant, unstyled: unstyled })] }));
|
|
30
|
+
});
|
|
31
|
+
export const TwoFactorField = forwardRef(function TwoFactorField({ label, hint, placeholder = "000000", part = "two-factor-field", inputProps, onChange, ...rest }, ref) {
|
|
32
|
+
const { ui } = useClasses(rest.unstyled);
|
|
33
|
+
return (_jsx(TextField, { ...rest, ref: ref, part: part, code: true, label: label ?? ui.t("withdraw.twoFactor"), hint: hint ?? ui.t("withdraw.twoFactorHint"), placeholder: placeholder, onChange: (value) => onChange(value.replace(/\D/g, "").slice(0, 6)), inputProps: { inputMode: "numeric", autoComplete: "one-time-code", pattern: "[0-9]*", maxLength: 6, ...inputProps } }));
|
|
34
|
+
});
|
|
35
|
+
export const SubmitButton = forwardRef(function SubmitButton({ variant = "pay", part = "submit", pending = false, type = "button", className, style, unstyled, children, ...rest }, ref) {
|
|
36
|
+
const { off } = useClasses(unstyled);
|
|
37
|
+
return (_jsx("button", { type: type, "aria-busy": pending || undefined, ...rest, ref: ref, ...viewProps(part, "submit", { className, style, unstyled }, off), "data-variant": variant, "data-pending": pending ? "" : undefined, children: children }));
|
|
38
|
+
});
|
|
39
|
+
export const SubmitLink = forwardRef(function SubmitLink({ variant = "pay", part = "submit-link", className, style, unstyled, children, ...rest }, ref) {
|
|
40
|
+
const { off } = useClasses(unstyled);
|
|
41
|
+
return (_jsx("a", { target: "_blank", rel: "noopener noreferrer", referrerPolicy: "no-referrer", ...rest, ref: ref, ...viewProps(part, "submit", { className, style, unstyled }, off), "data-variant": variant, children: children }));
|
|
42
|
+
});
|
|
43
|
+
export const RetryButton = forwardRef(function RetryButton({ part = "retry", type = "button", className, style, unstyled, children, ...rest }, ref) {
|
|
44
|
+
const { ui, off } = useClasses(unstyled);
|
|
45
|
+
return (_jsx("button", { type: type, ...rest, ref: ref, ...viewProps(part, "max-button", { className, style, unstyled }, off), children: children ?? ui.t("withdraw.retry") }));
|
|
46
|
+
});
|
|
47
|
+
export const LinkButton = forwardRef(function LinkButton({ part = "link-button", type = "button", className, style, unstyled, children, ...rest }, ref) {
|
|
48
|
+
const { off } = useClasses(unstyled);
|
|
49
|
+
return (_jsx("button", { type: type, ...rest, ref: ref, ...viewProps(part, "link-button", { className, style, unstyled }, off), children: children }));
|
|
50
|
+
});
|
|
51
|
+
export const ErrorBox = forwardRef(function ErrorBox({ variant = "deposit", part = "error-box", className, style, unstyled, children, ...rest }, ref) {
|
|
52
|
+
const { off } = useClasses(unstyled);
|
|
53
|
+
return (_jsx("div", { role: "alert", ...rest, ref: ref, ...viewProps(part, "error-box", { className, style, unstyled }, off), "data-variant": variant, children: children }));
|
|
54
|
+
});
|
|
55
|
+
const length = (value) => (typeof value === "number" ? `${value}px` : value);
|
|
56
|
+
export const Skeleton = ({ width = "100%", height, radius = 5, className, style, unstyled }) => {
|
|
57
|
+
const { off } = useClasses(unstyled);
|
|
58
|
+
return (_jsx("span", { "aria-hidden": "true", ...partProps("skeleton", { className, style: { width: length(width), height: length(height), borderRadius: radius === "circle" ? "50%" : length(radius), ...style }, unstyled }, off) }));
|
|
59
|
+
};
|
|
60
|
+
export const Loader = forwardRef(function Loader({ label, part = "loader", className, style, unstyled, ...rest }, ref) {
|
|
61
|
+
const { ui, c, off } = useClasses(unstyled);
|
|
62
|
+
return (_jsxs("div", { role: "status", "aria-live": "polite", ...rest, ref: ref, ...viewProps(part, "loader", { className, style, unstyled }, off), children: [!off && _jsx("span", { className: c("spinner"), "aria-hidden": "true" }), _jsx("span", { children: label ?? ui.t("common.loading") })] }));
|
|
63
|
+
});
|
|
64
|
+
export const Hint = forwardRef(function Hint({ part = "hint", className, style, unstyled, children, ...rest }, ref) {
|
|
65
|
+
const { off } = useClasses(unstyled);
|
|
66
|
+
return (_jsx("div", { ...rest, ref: ref, ...viewProps(part, "hint", { className, style, unstyled }, off), children: children }));
|
|
67
|
+
});
|
|
68
|
+
export const Notice = forwardRef(function Notice({ variant = "hint", part = "notice", className, style, unstyled, children, ...rest }, ref) {
|
|
69
|
+
const { off } = useClasses(unstyled);
|
|
70
|
+
return (_jsx("div", { role: "note", ...rest, ref: ref, ...viewProps(part, "notice", { className, style, unstyled }, off), "data-variant": variant, children: children }));
|
|
71
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const DEFAULT_FONT_BASE_URL = "https://binodex.app/fonts";
|
|
2
|
+
export declare const FONT_FAMILY_STACK = "\"Gilroy\", system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif";
|
|
3
|
+
export declare const fontFaceCss: (baseUrl?: string) => string;
|
|
4
|
+
export declare const registerFontFaces: (baseUrls: readonly string[]) => void;
|
package/dist/ui/fonts.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { cssString, resolveBaseUrl, safeBaseUrl } from "./urls.js";
|
|
2
|
+
export const DEFAULT_FONT_BASE_URL = "https://binodex.app/fonts";
|
|
3
|
+
export const FONT_FAMILY_STACK = '"Gilroy", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif';
|
|
4
|
+
const WEIGHTS = [
|
|
5
|
+
[400, "Regular"],
|
|
6
|
+
[500, "Medium"],
|
|
7
|
+
[600, "SemiBold"],
|
|
8
|
+
[700, "Bold"],
|
|
9
|
+
];
|
|
10
|
+
export const fontFaceCss = (baseUrl = DEFAULT_FONT_BASE_URL) => {
|
|
11
|
+
const base = resolveBaseUrl("fontFaceCss baseUrl", baseUrl, DEFAULT_FONT_BASE_URL);
|
|
12
|
+
return WEIGHTS.map(([weight, name]) => `@font-face{font-family:"Gilroy";src:url(${cssString(`${base}/Gilroy-${name}.woff2`)}) format("woff2");font-weight:${weight};font-style:normal;font-display:swap;}`).join("\n");
|
|
13
|
+
};
|
|
14
|
+
const registeredFonts = new WeakMap();
|
|
15
|
+
export const registerFontFaces = (baseUrls) => {
|
|
16
|
+
if (typeof FontFace === "undefined" || typeof document === "undefined" || !document.fonts)
|
|
17
|
+
return;
|
|
18
|
+
const bases = [...new Set(baseUrls.map((url) => safeBaseUrl(url)).filter((url) => !!url))];
|
|
19
|
+
const key = bases.join(" ");
|
|
20
|
+
const registered = registeredFonts.get(document.fonts) ?? new Set();
|
|
21
|
+
if (!key || registered.has(key))
|
|
22
|
+
return;
|
|
23
|
+
registered.add(key);
|
|
24
|
+
registeredFonts.set(document.fonts, registered);
|
|
25
|
+
for (const [weight, name] of WEIGHTS) {
|
|
26
|
+
const source = bases
|
|
27
|
+
.map((base) => `url(${cssString(`${base}/Gilroy-${name}.woff2`)}) format("woff2")`)
|
|
28
|
+
.join(", ");
|
|
29
|
+
document.fonts.add(new FontFace("Gilroy", source, { weight: String(weight), style: "normal", display: "swap" }));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface IconProps {
|
|
2
|
+
size?: number;
|
|
3
|
+
className?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const CloseIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
6
|
+
export declare const BackIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
7
|
+
export declare const CopyIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
8
|
+
export declare const CheckIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
9
|
+
export declare const CopiedIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
10
|
+
export declare const RowCheckIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
11
|
+
export declare const CreditCheckIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
12
|
+
export declare const ChevronIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
13
|
+
export declare const WarningIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
14
|
+
export declare const ExplorerIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
15
|
+
export declare const PaperclipIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
16
|
+
export declare const GeoIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
17
|
+
export declare const SuccessIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
18
|
+
export declare const FailIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
19
|
+
export declare const TransferCryptoIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
20
|
+
export declare const WalletIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
21
|
+
export declare const CardIcon: ({ size, className }: IconProps) => import("react").JSX.Element;
|
|
22
|
+
export declare const tokenIconPath: (symbol: string) => string;
|
|
23
|
+
export declare const chainIconPath: (chainId: string) => string | null;
|
|
24
|
+
export declare const hasTokenIcon: (symbol: string) => boolean;
|
|
25
|
+
export declare const hasChainIcon: (chainId: string) => boolean;
|
|
26
|
+
export declare const needsChainBadge: (chainId: string, symbol: string) => boolean;
|
|
27
|
+
export declare function TokenIcon({ symbol, size, className, alt }: IconProps & {
|
|
28
|
+
symbol: string;
|
|
29
|
+
alt?: string;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
export declare function ChainIcon({ chainId, size, className, alt }: IconProps & {
|
|
32
|
+
chainId: string;
|
|
33
|
+
alt?: string;
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
export declare function BadgeIcon({ badge, className }: {
|
|
36
|
+
badge: "qr" | "pdf";
|
|
37
|
+
className?: string;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
export declare const CRYPTO_STACK: readonly ["USDT", "USDC", "BTC", "ETH", "SOL", "BNB", "MATIC"];
|
package/dist/ui/icons.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { usePayUi } from "./context.js";
|
|
5
|
+
const svgId = (raw) => `bp${raw.replace(/[^a-zA-Z0-9_-]/g, "")}`;
|
|
6
|
+
export const CloseIcon = ({ size = 14, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M2 2l10 10M12 2L2 12", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" }) }));
|
|
7
|
+
export const BackIcon = ({ size = 16, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M13.3346 8H2.66797M6.66797 12L2.66797 8L6.66797 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
8
|
+
export const CopyIcon = ({ size = 20, className }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", className: className, children: [_jsx("path", { d: "M5.5 9.49774C5.5 7.22591 5.5 6.09 6.20294 5.38423C6.90589 4.67847 8.03726 4.67847 10.3 4.67847H12.7C14.9627 4.67847 16.0941 4.67847 16.7971 5.38423C17.5 6.09 17.5 7.22591 17.5 9.49774V13.5138C17.5 15.7856 17.5 16.9216 16.7971 17.6273C16.0941 18.3331 14.9627 18.3331 12.7 18.3331H10.3C8.03726 18.3331 6.90589 18.3331 6.20294 17.6273C5.5 16.9216 5.5 15.7856 5.5 13.5138V9.49774Z", fill: "currentColor" }), _jsx("path", { opacity: "0.5", d: "M3.47631 2.64306C2.5 3.61937 2.5 5.19072 2.5 8.33341V10.0001C2.5 13.1428 2.5 14.7141 3.47631 15.6904C3.99094 16.2051 4.67091 16.4484 5.65921 16.5635C5.49968 15.8629 5.49967 14.8997 5.49967 13.514V9.49791C5.49967 7.22608 5.49967 6.09016 6.20262 5.3844C6.90556 4.67863 8.03693 4.67863 10.2997 4.67863H12.6997C14.0762 4.67863 15.034 4.67863 15.7314 4.83753C15.6169 3.84297 15.3737 3.1597 14.857 2.64306C13.8807 1.66675 12.3094 1.66675 9.16667 1.66675C6.02397 1.66675 4.45262 1.66675 3.47631 2.64306Z", fill: "currentColor" })] }));
|
|
9
|
+
export const CheckIcon = ({ size = 12, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M2 6.2 4.8 9 10 3.4", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
10
|
+
export const CopiedIcon = ({ size = 20, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M4 10l4.5 4.5L16 6", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
11
|
+
export const RowCheckIcon = ({ size = 14, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M2 7l3.5 3.5L12 4", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
12
|
+
export const CreditCheckIcon = ({ size = 16, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M3.5 8l3 3 6-7", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
13
|
+
export const ChevronIcon = ({ size = 12, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M9.34061 6.99012L7.73561 5.38512L6.75561 4.40012C6.34061 3.98512 5.66561 3.98512 5.25061 4.40012L2.66061 6.99012C2.32061 7.33012 2.56561 7.91012 3.04061 7.91012L5.84561 7.91012L8.96061 7.91012C9.44061 7.91012 9.68061 7.33012 9.34061 6.99012Z", fill: "currentColor" }) }));
|
|
14
|
+
export const WarningIcon = ({ size = 20, className }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", className: className, children: [_jsx("path", { opacity: "0.5", d: "M10.0013 2.5C8.07568 2.5 6.8597 4.65597 4.42773 8.96791L4.12468 9.50523C2.10373 13.0884 1.09325 14.88 2.00652 16.19C2.91978 17.5 5.17927 17.5 9.69825 17.5H10.3044C14.8233 17.5 17.0828 17.5 17.9961 16.19C18.9093 14.88 17.8989 13.0884 15.8779 9.50522L15.5749 8.96791C13.1429 4.65597 11.9269 2.5 10.0013 2.5Z", fill: "currentColor" }), _jsx("path", { d: "M10.0013 6.04175C10.3465 6.04175 10.6263 6.32157 10.6263 6.66675V10.8334C10.6263 11.1786 10.3465 11.4584 10.0013 11.4584C9.65612 11.4584 9.3763 11.1786 9.3763 10.8334V6.66675C9.3763 6.32157 9.65612 6.04175 10.0013 6.04175Z", fill: "currentColor" }), _jsx("path", { d: "M10.0013 14.1667C10.4615 14.1667 10.8346 13.7937 10.8346 13.3334C10.8346 12.8732 10.4615 12.5001 10.0013 12.5001C9.54106 12.5001 9.16797 12.8732 9.16797 13.3334C9.16797 13.7937 9.54106 14.1667 10.0013 14.1667Z", fill: "currentColor" })] }));
|
|
15
|
+
export const ExplorerIcon = ({ size = 14, className }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", className: className, children: [_jsx("path", { d: "M5.5 3H3.5a1 1 0 0 0-1 1v6.5a1 1 0 0 0 1 1H10a1 1 0 0 0 1-1v-2", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M8 2.5h3.5V6", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }), _jsx("path", { d: "M11.3 2.7 6.5 7.5", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })] }));
|
|
16
|
+
export const PaperclipIcon = ({ size = 14, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M13.5 7.4 8.1 12.8a3.3 3.3 0 0 1-4.7-4.7l5.6-5.6a2.2 2.2 0 0 1 3.1 3.1L6.5 11.2a1.1 1.1 0 0 1-1.6-1.6l5-5", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
17
|
+
export const GeoIcon = ({ size = 36, className }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", className: className, children: [_jsx("path", { d: "M12 21s6.5-5.2 6.5-10.5a6.5 6.5 0 1 0-13 0C5.5 15.8 12 21 12 21Z", stroke: "currentColor", strokeWidth: "1.6", strokeLinejoin: "round" }), _jsx("path", { d: "M9.7 8.2l4.6 4.6M14.3 8.2l-4.6 4.6", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })] }));
|
|
18
|
+
export const SuccessIcon = ({ size = 58, className }) => {
|
|
19
|
+
const id = svgId(useId());
|
|
20
|
+
return (_jsxs("svg", { width: size, height: size, viewBox: "0 0 58 58", fill: "none", "aria-hidden": "true", className: className, children: [_jsx("rect", { width: "58", height: "58", rx: "29", fill: `url(#${id})`, fillOpacity: "0.3" }), _jsx("path", { opacity: "0.5", d: "M49 29C49 40.0457 40.0457 49 29 49C17.9543 49 9 40.0457 9 29C9 17.9543 17.9543 9 29 9C40.0457 9 49 17.9543 49 29Z", fill: "var(--bp-color-accent-text, #80F6BC)" }), _jsx("path", { d: "M37.0607 22.9393C37.6464 23.5251 37.6464 24.4749 37.0607 25.0607L27.0607 35.0607C26.4749 35.6464 25.5251 35.6464 24.9393 35.0607L20.9393 31.0607C20.3536 30.4749 20.3536 29.5251 20.9393 28.9393C21.5251 28.3536 22.4749 28.3536 23.0607 28.9393L26 31.8787L30.4697 27.409L34.9393 22.9393C35.5251 22.3536 36.4749 22.3536 37.0607 22.9393Z", fill: "var(--bp-color-accent-text, #80F6BC)" }), _jsx("defs", { children: _jsxs("linearGradient", { id: id, x1: "29", y1: "0", x2: "29", y2: "58", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "var(--bp-color-accent-text, #80F6BC)" }), _jsx("stop", { offset: "1", stopColor: "var(--bp-color-accent-text, #80F6BC)", stopOpacity: "0.2" })] }) })] }));
|
|
21
|
+
};
|
|
22
|
+
export const FailIcon = ({ size = 28, className }) => (_jsx("svg", { width: size, height: size, viewBox: "0 0 28 28", fill: "none", "aria-hidden": "true", className: className, children: _jsx("path", { d: "M8 8l12 12M20 8L8 20", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round" }) }));
|
|
23
|
+
export const TransferCryptoIcon = ({ size = 28, className }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", className: className, children: [_jsxs("g", { opacity: "0.5", fill: "currentColor", children: [_jsx("path", { d: "M10.5531 13.4469C10.1294 13.0232 9.60212 12.8505 9.01812 12.772C8.46484 12.6976 7.76789 12.6976 6.93209 12.6977L5.82717 12.6977C5.24648 12.6977 4.76184 12.6976 4.36823 12.7351C3.95674 12.7742 3.57325 12.8591 3.22152 13.0746C2.87731 13.2856 2.5879 13.575 2.37697 13.9192C2.16142 14.2709 2.07653 14.6544 2.0374 15.0659C1.99998 15.4595 1.99999 15.9442 2 16.5249V16.5932C1.99999 17.477 1.99999 18.1897 2.05454 18.7635C2.1108 19.3552 2.22996 19.8707 2.51405 20.3343C2.80168 20.8037 3.19632 21.1983 3.6657 21.486C4.12929 21.77 4.64482 21.8892 5.23653 21.9455C5.8103 22 6.52304 22 7.40683 22H7.47507C8.05577 22 8.54048 22 8.9341 21.9626C9.34559 21.9235 9.72907 21.8386 10.0808 21.623C10.425 21.4121 10.7144 21.1227 10.9254 20.7785C11.1409 20.4267 11.2258 20.0433 11.2649 19.6318C11.3024 19.2382 11.3023 18.7535 11.3023 18.1728L11.3023 17.0679C11.3024 16.2321 11.3024 15.5352 11.228 14.9819C11.1495 14.3979 10.9768 13.8706 10.5531 13.4469Z" }), _jsx("path", { d: "M8.9341 2.0374C9.34559 2.07653 9.72907 2.16142 10.0808 2.37697C10.425 2.5879 10.7144 2.87731 10.9254 3.22152C11.1409 3.57325 11.2258 3.95674 11.2649 4.36823C11.3024 4.76183 11.3023 5.24658 11.3023 5.82726L11.3023 6.93212C11.3024 7.7679 11.3024 8.46484 11.228 9.01812C11.1495 9.60212 10.9768 10.1294 10.5531 10.5531C10.1294 10.9768 9.60212 11.1495 9.01812 11.228C8.46484 11.3024 7.76787 11.3024 6.93209 11.3023L5.82711 11.3023C5.24643 11.3023 4.76183 11.3024 4.36823 11.2649C3.95674 11.2258 3.57325 11.1409 3.22152 10.9254C2.87731 10.7144 2.5879 10.425 2.37697 10.0808C2.16142 9.72907 2.07653 9.34559 2.0374 8.9341C1.99998 8.54047 1.99999 8.05579 2 7.47506V7.40679C1.99999 6.52302 1.99999 5.81029 2.05454 5.23653C2.1108 4.64482 2.22996 4.12929 2.51405 3.6657C2.80168 3.19632 3.19632 2.80168 3.6657 2.51405C4.12929 2.22996 4.64482 2.1108 5.23653 2.05454C5.81029 1.99999 6.52307 1.99999 7.40684 2H7.4751C8.05583 1.99999 8.54047 1.99998 8.9341 2.0374Z" }), _jsx("path", { d: "M16.5932 2H16.5249C15.9442 1.99999 15.4595 1.99998 15.0659 2.0374C14.6544 2.07653 14.2709 2.16142 13.9192 2.37697C13.575 2.5879 13.2856 2.87731 13.0746 3.22152C12.8591 3.57325 12.7742 3.95674 12.7351 4.36823C12.6976 4.76185 12.6977 5.24654 12.6977 5.82725L12.6977 6.93209C12.6976 7.76789 12.6976 8.46484 12.772 9.01812C12.8505 9.60212 13.0232 10.1294 13.4469 10.5531C13.8706 10.9768 14.3979 11.1495 14.9819 11.228C15.5352 11.3024 16.2321 11.3024 17.0679 11.3023L18.1728 11.3023C18.7535 11.3023 19.2382 11.3024 19.6318 11.2649C20.0433 11.2258 20.4267 11.1409 20.7785 10.9254C21.1227 10.7144 21.4121 10.425 21.623 10.0808C21.8386 9.72907 21.9235 9.34559 21.9626 8.9341C22 8.54048 22 8.05587 22 7.47517V7.40683C22 6.52304 22 5.8103 21.9455 5.23653C21.8892 4.64482 21.77 4.12929 21.486 3.6657C21.1983 3.19632 20.8037 2.80168 20.3343 2.51405C19.8707 2.22996 19.3552 2.1108 18.7635 2.05454C18.1897 1.99999 17.477 1.99999 16.5932 2Z" })] }), _jsx("path", { opacity: "0.4", d: "M14.0946 21.3024C14.0946 21.6877 13.7822 22.0001 13.3969 22.0001C13.0116 22.0001 12.6992 21.6877 12.6992 21.3024V18.5117H14.0946V21.3024Z", fill: "currentColor" }), _jsx("path", { opacity: "0.5", d: "M21.3031 12.6978C20.9178 12.6978 20.6055 13.0101 20.6055 13.3954V16.6512H22.0008V13.3954C22.0008 13.0101 21.6885 12.6978 21.3031 12.6978Z", fill: "currentColor" }), _jsx("path", { d: "M16.0761 16.6173C16 16.8011 16 17.0341 16 17.5C16 17.9659 16 18.1989 16.0761 18.3827C16.1776 18.6277 16.3723 18.8224 16.6173 18.9239C16.8011 19 17.0341 19 17.5 19C17.9659 19 18.1989 19 18.3827 18.9239C18.6277 18.8224 18.8224 18.6277 18.9239 18.3827C19 18.1989 19 17.9659 19 17.5C19 17.0341 19 16.8011 18.9239 16.6173C18.8224 16.3723 18.6277 16.1776 18.3827 16.0761C18.1989 16 17.9659 16 17.5 16C17.0341 16 16.8011 16 16.6173 16.0761C16.3723 16.1776 16.1776 16.3723 16.0761 16.6173Z", fill: "currentColor" }), _jsx("path", { opacity: "0.7", d: "M22.0012 18.5352V18.5117H20.6058C20.6058 18.9547 20.6055 19.252 20.5897 19.4822C20.5745 19.7061 20.547 19.8152 20.5173 19.8869C20.3993 20.1718 20.1729 20.3982 19.888 20.5162C19.8163 20.546 19.7072 20.5734 19.4833 20.5887C19.2531 20.6044 18.9558 20.6047 18.5128 20.6047H16.6523V22.0001H18.5363C18.9498 22.0001 19.2949 22.0001 19.5783 21.9808C19.8732 21.9606 20.1519 21.9173 20.422 21.8054C21.0488 21.5457 21.5468 21.0477 21.8065 20.4209C21.9183 20.1508 21.9617 19.8722 21.9819 19.5772C22.0012 19.2938 22.0012 18.9487 22.0012 18.5352Z", fill: "currentColor" }), _jsx("path", { opacity: "0.6", d: "M12.6953 16.6156V16.6512H14.0907C14.0907 15.9835 14.0915 15.5352 14.1263 15.1934C14.1599 14.8633 14.2192 14.7108 14.2866 14.6099C14.3715 14.4829 14.4805 14.3739 14.6074 14.2891C14.7083 14.2217 14.8609 14.1623 15.191 14.1287C15.5327 14.0939 15.981 14.0931 16.6488 14.0931H18.5093V12.6978H16.6131C15.9903 12.6977 15.4705 12.6977 15.0498 12.7405C14.6093 12.7853 14.2006 12.8827 13.8322 13.1289C13.5529 13.3155 13.3131 13.5553 13.1264 13.8347C12.8803 14.203 12.7829 14.6118 12.7381 15.0522C12.6953 15.473 12.6953 15.9927 12.6953 16.6156Z", fill: "currentColor" }), _jsx("path", { d: "M5.51017 18.6903C5.72852 18.8452 6.03776 18.8452 6.65625 18.8452C7.27474 18.8452 7.58398 18.8452 7.80233 18.6903C7.87938 18.6356 7.94665 18.5683 8.00132 18.4913C8.15625 18.2729 8.15625 17.9637 8.15625 17.3452C8.15625 16.7267 8.15625 16.4175 8.00132 16.1991C7.94665 16.1221 7.87938 16.0548 7.80233 16.0001C7.58398 15.8452 7.27471 15.8452 6.65624 15.8452C6.03776 15.8452 5.72852 15.8452 5.51017 16.0001C5.43312 16.0548 5.36585 16.1221 5.31118 16.1991C5.15625 16.4175 5.15625 16.7267 5.15625 17.3452C5.15625 17.9637 5.15625 18.2729 5.31118 18.4913C5.36585 18.5683 5.43312 18.6356 5.51017 18.6903Z", fill: "currentColor" }), _jsx("path", { d: "M6.65625 8.15479C6.03776 8.15479 5.72852 8.15479 5.51017 7.99986C5.43312 7.94519 5.36585 7.87792 5.31118 7.80087C5.15625 7.58252 5.15625 7.27327 5.15625 6.65479C5.15625 6.0363 5.15625 5.72705 5.31118 5.5087C5.36585 5.43165 5.43312 5.36438 5.51017 5.30971C5.72852 5.15479 6.03776 5.15479 6.65625 5.15479C7.27474 5.15479 7.58398 5.15479 7.80233 5.30971C7.87938 5.36438 7.94665 5.43165 8.00132 5.5087C8.15625 5.72705 8.15625 6.0363 8.15625 6.65479C8.15625 7.27327 8.15625 7.58252 8.00132 7.80087C7.94665 7.87792 7.87938 7.94519 7.80233 7.99986C7.58398 8.15479 7.27474 8.15479 6.65625 8.15479Z", fill: "currentColor" }), _jsx("path", { d: "M16.1977 8.00024C16.416 8.15517 16.7253 8.15517 17.3437 8.15517C17.9622 8.15517 18.2715 8.15517 18.4898 8.00024C18.5669 7.94558 18.6342 7.8783 18.6888 7.80126C18.8438 7.58291 18.8438 7.27366 18.8438 6.65517C18.8438 6.03668 18.8438 5.72744 18.6888 5.50909C18.6342 5.43204 18.5669 5.36477 18.4898 5.3101C18.2715 5.15517 17.9622 5.15517 17.3437 5.15517C16.7253 5.15517 16.416 5.15517 16.1977 5.3101C16.1206 5.36477 16.0533 5.43204 15.9987 5.50909C15.8438 5.72744 15.8438 6.03671 15.8438 6.65519C15.8438 7.27367 15.8438 7.58291 15.9987 7.80126C16.0533 7.8783 16.1206 7.94558 16.1977 8.00024Z", fill: "currentColor" })] }));
|
|
24
|
+
export const WalletIcon = ({ size = 28, className }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", className: className, children: [_jsx("path", { d: "M4.89062 9.61431C4.89062 9.21193 5.21427 8.88574 5.61352 8.88574H9.46894C9.86818 8.88574 10.1918 9.21193 10.1918 9.61431C10.1918 10.0167 9.86818 10.3429 9.46894 10.3429H5.61352C5.21427 10.3429 4.89062 10.0167 4.89062 9.61431Z", fill: "currentColor" }), _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M21.1884 10.0038C21.1262 9.99995 21.0584 9.99998 20.9881 10L20.9706 10H18.2149C15.9435 10 14 11.7361 14 14C14 16.2639 15.9435 18 18.2149 18H20.9706L20.9881 18C21.0584 18 21.1262 18 21.1884 17.9962C22.111 17.9397 22.927 17.2386 22.9956 16.2594C23.0001 16.1952 23 16.126 23 16.0619L23 16.0444V11.9556L23 11.9381C23 11.874 23.0001 11.8048 22.9956 11.7406C22.927 10.7614 22.111 10.0603 21.1884 10.0038ZM17.9706 15.0667C18.5554 15.0667 19.0294 14.5891 19.0294 14C19.0294 13.4109 18.5554 12.9333 17.9706 12.9333C17.3858 12.9333 16.9118 13.4109 16.9118 14C16.9118 14.5891 17.3858 15.0667 17.9706 15.0667Z", fill: "currentColor" }), _jsx("path", { opacity: "0.5", d: "M21.1394 10.0015C21.1394 8.82091 21.0965 7.55447 20.3418 6.64658C20.2689 6.55894 20.1914 6.47384 20.1088 6.39124C19.3604 5.64288 18.4114 5.31076 17.239 5.15314C16.0998 4.99997 14.6442 4.99999 12.8064 5H10.6936C8.85583 4.99999 7.40019 4.99997 6.26098 5.15314C5.08856 5.31076 4.13961 5.64288 3.39124 6.39124C2.64288 7.13961 2.31076 8.08856 2.15314 9.26098C1.99997 10.4002 1.99999 11.8558 2 13.6936V13.8064C1.99999 15.6442 1.99997 17.0998 2.15314 18.239C2.31076 19.4114 2.64288 20.3604 3.39124 21.1088C4.13961 21.8571 5.08856 22.1892 6.26098 22.3469C7.40018 22.5 8.8558 22.5 10.6935 22.5H12.8064C14.6442 22.5 16.0998 22.5 17.239 22.3469C18.4114 22.1892 19.3604 21.8571 20.1088 21.1088C20.3133 20.9042 20.487 20.6844 20.6346 20.4486C21.0851 19.7291 21.1394 18.8473 21.1394 17.9985C21.0912 18 21.0404 18 20.9882 18L18.2149 18C15.9435 18 14 16.2639 14 14C14 11.7361 15.9435 10 18.2149 10L20.9881 10C21.0403 9.99999 21.0912 9.99997 21.1394 10.0015Z", fill: "currentColor" }), _jsx("path", { d: "M10.1004 2.57211L7.9989 3.99253L6.26562 5.15237C7.40398 4.99997 8.85782 4.99999 10.6925 5H12.8053C14.6431 4.99998 16.0987 4.99997 17.2379 5.15314C17.4671 5.18394 17.6877 5.22142 17.9 5.26737L15.9989 4L13.8864 2.57211C12.7578 1.8093 11.2289 1.8093 10.1004 2.57211Z", fill: "currentColor" })] }));
|
|
25
|
+
export const CardIcon = ({ size = 28, className }) => (_jsxs("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", className: className, children: [_jsx("path", { opacity: "0.5", d: "M2 9.5C2 7.01472 2 5.77208 2.73223 5.04604C3.46447 4.32 4.64298 4.32 7 4.32H17C19.357 4.32 20.5355 4.32 21.2678 5.04604C22 5.77208 22 7.01472 22 9.5V14.5C22 16.9853 22 18.2279 21.2678 18.954C20.5355 19.68 19.357 19.68 17 19.68H7C4.64298 19.68 3.46447 19.68 2.73223 18.954C2 18.2279 2 16.9853 2 14.5V9.5Z", fill: "currentColor" }), _jsx("path", { d: "M2 8.5H22V10.5H2V8.5Z", fill: "currentColor" }), _jsx("path", { d: "M5.5 15C5.5 14.5858 5.83579 14.25 6.25 14.25H10.25C10.6642 14.25 11 14.5858 11 15C11 15.4142 10.6642 15.75 10.25 15.75H6.25C5.83579 15.75 5.5 15.4142 5.5 15Z", fill: "currentColor" })] }));
|
|
26
|
+
const TOKEN_ICON_PATHS = {
|
|
27
|
+
USDT: "/img/coins/USDT.svg",
|
|
28
|
+
USDC: "/img/coins/USDC.svg",
|
|
29
|
+
ETH: "/img/coins/ETH.png",
|
|
30
|
+
BTC: "/img/coins/BTC.png",
|
|
31
|
+
BNB: "/img/coins/BNB.png",
|
|
32
|
+
SOL: "/img/coins/SOL.png",
|
|
33
|
+
MATIC: "/img/coins/MATIC.svg",
|
|
34
|
+
TRX: "/img/deposit/tokens/trx.svg",
|
|
35
|
+
XRP: "/img/deposit/tokens/xrp.svg",
|
|
36
|
+
DOGE: "/img/deposit/tokens/doge.svg",
|
|
37
|
+
LTC: "/img/deposit/tokens/ltc.svg",
|
|
38
|
+
SHIB: "/img/deposit/tokens/shib.svg",
|
|
39
|
+
};
|
|
40
|
+
const CHAIN_ICON_PATHS = {
|
|
41
|
+
bsc: "/img/coins/BNB.png",
|
|
42
|
+
eth: "/img/coins/ETH.png",
|
|
43
|
+
arbitrum: "/img/coins/ARB.png",
|
|
44
|
+
optimism: "/img/coins/OP.png",
|
|
45
|
+
base: "/img/coins/BASE.png",
|
|
46
|
+
polygon: "/img/coins/MATIC.svg",
|
|
47
|
+
solana: "/img/coins/SOL.png",
|
|
48
|
+
bitcoin: "/img/coins/BTC.png",
|
|
49
|
+
tron: "/img/deposit/tokens/trx.svg",
|
|
50
|
+
};
|
|
51
|
+
const TOKEN_VISUALS = {
|
|
52
|
+
USDT: ["#26A17B", "T"],
|
|
53
|
+
USDC: ["#2775CA", "C"],
|
|
54
|
+
ETH: ["#627EEA", "\u039E"],
|
|
55
|
+
BTC: ["#F7931A", "\u20BF"],
|
|
56
|
+
BNB: ["#F0B90B", "B"],
|
|
57
|
+
SOL: ["#9945FF", "S"],
|
|
58
|
+
MATIC: ["#8247E5", "M"],
|
|
59
|
+
TRX: ["#EC0928", "X"],
|
|
60
|
+
TON: ["#0098EA", "T"],
|
|
61
|
+
SUI: ["#4DA2FF", "S"],
|
|
62
|
+
};
|
|
63
|
+
const CHAIN_VISUALS = {
|
|
64
|
+
bsc: ["#F0B90B", "B"],
|
|
65
|
+
eth: ["#627EEA", "\u039E"],
|
|
66
|
+
polygon: ["#8247E5", "P"],
|
|
67
|
+
arbitrum: ["#28A0F0", "A"],
|
|
68
|
+
optimism: ["#FF0420", "O"],
|
|
69
|
+
base: ["#0052FF", "B"],
|
|
70
|
+
solana: ["#9945FF", "S"],
|
|
71
|
+
tron: ["#EC0928", "T"],
|
|
72
|
+
bitcoin: ["#F7931A", "\u20BF"],
|
|
73
|
+
ton: ["#0098EA", "T"],
|
|
74
|
+
sui: ["#4DA2FF", "S"],
|
|
75
|
+
};
|
|
76
|
+
export const tokenIconPath = (symbol) => TOKEN_ICON_PATHS[symbol.toUpperCase()] ?? `/img/coins/${symbol.toUpperCase()}.png`;
|
|
77
|
+
export const chainIconPath = (chainId) => CHAIN_ICON_PATHS[chainId] ?? null;
|
|
78
|
+
export const hasTokenIcon = (symbol) => symbol.toUpperCase() in TOKEN_ICON_PATHS;
|
|
79
|
+
export const hasChainIcon = (chainId) => chainId in CHAIN_ICON_PATHS;
|
|
80
|
+
export const needsChainBadge = (chainId, symbol) => {
|
|
81
|
+
const chain = chainIconPath(chainId);
|
|
82
|
+
return chain !== null && chain !== tokenIconPath(symbol);
|
|
83
|
+
};
|
|
84
|
+
function RemoteIcon({ path, visual, size, alt = "", className, }) {
|
|
85
|
+
const ui = usePayUi();
|
|
86
|
+
const [failed, setFailed] = useState(false);
|
|
87
|
+
if (!path || failed) {
|
|
88
|
+
return (_jsx("span", { "aria-hidden": "true", className: className, "data-binodex-pay": "icon-fallback", style: {
|
|
89
|
+
display: "inline-flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
justifyContent: "center",
|
|
92
|
+
width: size,
|
|
93
|
+
height: size,
|
|
94
|
+
borderRadius: "50%",
|
|
95
|
+
background: visual[0],
|
|
96
|
+
color: "#ffffff",
|
|
97
|
+
fontSize: Math.round(size * 0.5),
|
|
98
|
+
fontWeight: 700,
|
|
99
|
+
lineHeight: 1,
|
|
100
|
+
flexShrink: 0,
|
|
101
|
+
}, children: visual[1] }));
|
|
102
|
+
}
|
|
103
|
+
return (_jsx("img", { src: `${ui.assetBaseUrl}${path}`, alt: alt, width: size, height: size, className: className, referrerPolicy: "no-referrer", loading: "lazy", onError: () => setFailed(true), style: { borderRadius: "50%", objectFit: "contain", flexShrink: 0 } }));
|
|
104
|
+
}
|
|
105
|
+
export function TokenIcon({ symbol, size = 18, className, alt }) {
|
|
106
|
+
const upper = symbol.toUpperCase();
|
|
107
|
+
return (_jsx(RemoteIcon, { path: tokenIconPath(upper), visual: TOKEN_VISUALS[upper] ?? ["#2A3550", upper.charAt(0)], size: size, alt: alt, className: className }, upper));
|
|
108
|
+
}
|
|
109
|
+
export function ChainIcon({ chainId, size = 18, className, alt }) {
|
|
110
|
+
return (_jsx(RemoteIcon, { path: chainIconPath(chainId), visual: CHAIN_VISUALS[chainId] ?? ["#2A3550", chainId.charAt(0).toUpperCase()], size: size, alt: alt, className: className }, chainId));
|
|
111
|
+
}
|
|
112
|
+
export function BadgeIcon({ badge, className }) {
|
|
113
|
+
const ui = usePayUi();
|
|
114
|
+
return (_jsx("img", { className: className, src: `${ui.assetBaseUrl}/img/badges/${badge}.svg`, alt: "", "aria-hidden": "true", referrerPolicy: "no-referrer" }));
|
|
115
|
+
}
|
|
116
|
+
export const CRYPTO_STACK = ["USDT", "USDC", "BTC", "ETH", "SOL", "BNB", "MATIC"];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export { DEFAULT_ASSET_BASE_URL, PayUiProvider, PayUiRoot, PayUiValueProvider, balanceText, createFormatters, usePayUi, usePayUiValue, } from "./context.js";
|
|
2
|
+
export type { PayUiFormatters, PayUiProviderProps, PayUiRootProps, PayUiSkin, PayUiTheme, PayUiValue, } from "./context.js";
|
|
3
|
+
export { BackButton, BrandLogo, CloseButton, Divider, PayBody, PayCard, PayHeader } from "./layout.js";
|
|
4
|
+
export type { PayCardProps, PayHeaderProps } from "./layout.js";
|
|
5
|
+
export { CardTab, EntryOptions, EntryTabs, IconStack, cryptoStackIcons } from "./entry.js";
|
|
6
|
+
export type { EntryOptionsProps, EntryTabsProps } from "./entry.js";
|
|
7
|
+
export { CountrySelect, Field, MethodGrid, MethodsNotice, RouteColumn, RouteGrid, RoutePicker } from "./pickers.js";
|
|
8
|
+
export type { CountrySelectProps, FieldProps, MethodGridProps, RouteColumnProps, RoutePickerProps } from "./pickers.js";
|
|
9
|
+
export { AmountField, ErrorBox, Hint, LinkButton, Loader, RetryButton, Notice, Skeleton, SubmitButton, SubmitLink, TextField, TwoFactorField, } from "./fields.js";
|
|
10
|
+
export type { AmountFieldProps, ButtonVariant, ErrorBoxVariant, FieldVariant, SkeletonProps, TextFieldProps, TwoFactorFieldProps, } from "./fields.js";
|
|
11
|
+
export { DetailsAccordion, QuoteRows, Summary } from "./summary.js";
|
|
12
|
+
export type { DetailsAccordionProps, QuoteRowsProps, SummaryProps } from "./summary.js";
|
|
13
|
+
export { CopyButton, CreditBanner, CryptoAddressCard, LTR_ISOLATE, QrCode, QrSvg, useCopy } from "./crypto.js";
|
|
14
|
+
export type { CopyButtonProps, CreditBannerProps, CryptoAddressCardProps, QrCodeProps, QrSvgProps } from "./crypto.js";
|
|
15
|
+
export { ExpiresLine, GeoBlock, PanelAmount, PanelHint, PayActions, PayingPanel, PdfReceiptWarning, PollNotice, QrImageCard, RailForm, RECEIPT_MAX_BYTES, ReceiptAttached, ReceiptBlock, ReceiptForm, Requisites, StatusPanel, StatusPill, isPdfFile, } from "./fiat.js";
|
|
16
|
+
export type { PollHealth, ReceiptFormProps, RequisitesProps, StatusPanelProps } from "./fiat.js";
|
|
17
|
+
export { ResultIcon, SlippageWarning, StatusCard, StatusSteps, StatusText, WithdrawResult } from "./withdraw.js";
|
|
18
|
+
export type { SlippageWarningProps, StatusCardProps, WithdrawResultProps } from "./withdraw.js";
|
|
19
|
+
export * as icons from "./icons.js";
|
|
20
|
+
export { chainName, explorerUrl, orderBy } from "./chains.js";
|
|
21
|
+
export { BadgeIcon, CardIcon, ChainIcon, FailIcon, SuccessIcon, TokenIcon, TransferCryptoIcon, WalletIcon, chainIconPath, hasChainIcon, hasTokenIcon, needsChainBadge, tokenIconPath, } from "./icons.js";
|
|
22
|
+
export type { IconProps } from "./icons.js";
|
|
23
|
+
export { COUNTRY_CODES, FALLBACK_LOGO, METHOD_LOGOS, countryFlagPath, getMethodLogo, isSupportedCountry, } from "./logos.js";
|
|
24
|
+
export type { MethodLogo } from "./logos.js";
|
|
25
|
+
export { DEFAULT_FONT_BASE_URL, FONT_FAMILY_STACK, fontFaceCss, registerFontFaces } from "./fonts.js";
|
|
26
|
+
export { SENSITIVE_CLASS, SENSITIVE_PROPS, cx, partProps } from "./part.js";
|
|
27
|
+
export type { DataAttributes, PartStyleProps } from "./part.js";
|
|
28
|
+
export { encodeQr, qrPath } from "./qr-encode.js";
|
|
29
|
+
export type { QrEcc } from "./qr-encode.js";
|
|
30
|
+
export type * from "./types.js";
|
|
31
|
+
export type { MessageKey, PayLocale, Translate } from "../core/i18n/base.js";
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { DEFAULT_ASSET_BASE_URL, PayUiProvider, PayUiRoot, PayUiValueProvider, balanceText, createFormatters, usePayUi, usePayUiValue, } from "./context.js";
|
|
3
|
+
export { BackButton, BrandLogo, CloseButton, Divider, PayBody, PayCard, PayHeader } from "./layout.js";
|
|
4
|
+
export { CardTab, EntryOptions, EntryTabs, IconStack, cryptoStackIcons } from "./entry.js";
|
|
5
|
+
export { CountrySelect, Field, MethodGrid, MethodsNotice, RouteColumn, RouteGrid, RoutePicker } from "./pickers.js";
|
|
6
|
+
export { AmountField, ErrorBox, Hint, LinkButton, Loader, RetryButton, Notice, Skeleton, SubmitButton, SubmitLink, TextField, TwoFactorField, } from "./fields.js";
|
|
7
|
+
export { DetailsAccordion, QuoteRows, Summary } from "./summary.js";
|
|
8
|
+
export { CopyButton, CreditBanner, CryptoAddressCard, LTR_ISOLATE, QrCode, QrSvg, useCopy } from "./crypto.js";
|
|
9
|
+
export { ExpiresLine, GeoBlock, PanelAmount, PanelHint, PayActions, PayingPanel, PdfReceiptWarning, PollNotice, QrImageCard, RailForm, RECEIPT_MAX_BYTES, ReceiptAttached, ReceiptBlock, ReceiptForm, Requisites, StatusPanel, StatusPill, isPdfFile, } from "./fiat.js";
|
|
10
|
+
export { ResultIcon, SlippageWarning, StatusCard, StatusSteps, StatusText, WithdrawResult } from "./withdraw.js";
|
|
11
|
+
export * as icons from "./icons.js";
|
|
12
|
+
export { chainName, explorerUrl, orderBy } from "./chains.js";
|
|
13
|
+
export { BadgeIcon, CardIcon, ChainIcon, FailIcon, SuccessIcon, TokenIcon, TransferCryptoIcon, WalletIcon, chainIconPath, hasChainIcon, hasTokenIcon, needsChainBadge, tokenIconPath, } from "./icons.js";
|
|
14
|
+
export { COUNTRY_CODES, FALLBACK_LOGO, METHOD_LOGOS, countryFlagPath, getMethodLogo, isSupportedCountry, } from "./logos.js";
|
|
15
|
+
export { DEFAULT_FONT_BASE_URL, FONT_FAMILY_STACK, fontFaceCss, registerFontFaces } from "./fonts.js";
|
|
16
|
+
export { SENSITIVE_CLASS, SENSITIVE_PROPS, cx, partProps } from "./part.js";
|
|
17
|
+
export { encodeQr, qrPath } from "./qr-encode.js";
|