@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/fonts.css
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "Gilroy";
|
|
3
|
+
src: url("https://binodex.app/fonts/Gilroy-Regular.woff2") format("woff2");
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
font-style: normal;
|
|
6
|
+
font-display: swap;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@font-face {
|
|
10
|
+
font-family: "Gilroy";
|
|
11
|
+
src: url("https://binodex.app/fonts/Gilroy-Medium.woff2") format("woff2");
|
|
12
|
+
font-weight: 500;
|
|
13
|
+
font-style: normal;
|
|
14
|
+
font-display: swap;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@font-face {
|
|
18
|
+
font-family: "Gilroy";
|
|
19
|
+
src: url("https://binodex.app/fonts/Gilroy-SemiBold.woff2") format("woff2");
|
|
20
|
+
font-weight: 600;
|
|
21
|
+
font-style: normal;
|
|
22
|
+
font-display: swap;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@font-face {
|
|
26
|
+
font-family: "Gilroy";
|
|
27
|
+
src: url("https://binodex.app/fonts/Gilroy-Bold.woff2") format("woff2");
|
|
28
|
+
font-weight: 700;
|
|
29
|
+
font-style: normal;
|
|
30
|
+
font-display: swap;
|
|
31
|
+
}
|
package/dist/frame.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CreditedEvent, FrameOptions, PayError, PayStatus, PayWidgetOptions } from "./types.js";
|
|
2
|
+
export declare const FRAME_ANSWER_TIMEOUT_MS = 8000;
|
|
2
3
|
export interface FrameEvents {
|
|
3
4
|
status: (status: PayStatus, error: PayError | null) => void;
|
|
4
5
|
height: (height: number) => void;
|
package/dist/frame.js
CHANGED
|
@@ -2,8 +2,9 @@ import { createChannel } from "./channel.js";
|
|
|
2
2
|
import { PaySdkError, toPayError } from "./errors.js";
|
|
3
3
|
import { initMessage, readWidgetMessage, } from "./protocol.js";
|
|
4
4
|
import { holdSession, requestSession } from "./session.js";
|
|
5
|
-
import { resolveWidgetLocation } from "./widget-url.js";
|
|
5
|
+
import { alternateLocations, resolveWidgetLocation, } from "./widget-url.js";
|
|
6
6
|
const DEFAULT_HEIGHTS = { initial: 720, min: 520, max: 900 };
|
|
7
|
+
export const FRAME_ANSWER_TIMEOUT_MS = 8000;
|
|
7
8
|
const FRAME_FEATURES = ["payment", "clipboard-write"];
|
|
8
9
|
const finiteSize = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0
|
|
9
10
|
? value
|
|
@@ -42,6 +43,14 @@ export const runPayFrame = (container, options, events) => {
|
|
|
42
43
|
let initInFlight = false;
|
|
43
44
|
let shown = false;
|
|
44
45
|
let status = "idle";
|
|
46
|
+
let answered = false;
|
|
47
|
+
let alternates = [];
|
|
48
|
+
let answerTimer = null;
|
|
49
|
+
const clearAnswerTimer = () => {
|
|
50
|
+
if (answerTimer !== null)
|
|
51
|
+
clearTimeout(answerTimer);
|
|
52
|
+
answerTimer = null;
|
|
53
|
+
};
|
|
45
54
|
const setStatus = (next, error = null) => {
|
|
46
55
|
if (stopped || (next === status && next !== "error"))
|
|
47
56
|
return;
|
|
@@ -132,12 +141,36 @@ export const runPayFrame = (container, options, events) => {
|
|
|
132
141
|
else {
|
|
133
142
|
protocol = 1;
|
|
134
143
|
}
|
|
144
|
+
answered = true;
|
|
145
|
+
clearAnswerTimer();
|
|
135
146
|
handle(envelope.event);
|
|
136
147
|
};
|
|
137
148
|
const onLoad = () => {
|
|
138
149
|
if (status === "loading")
|
|
139
150
|
setStatus("handshake");
|
|
140
151
|
};
|
|
152
|
+
const mountFrame = (location) => {
|
|
153
|
+
if (frame) {
|
|
154
|
+
frame.removeEventListener("load", onLoad);
|
|
155
|
+
frame.remove();
|
|
156
|
+
}
|
|
157
|
+
widgetOrigin = location.origin;
|
|
158
|
+
protocol = null;
|
|
159
|
+
frame = createFrame(location.src, location.origin, options.title || (options.mode === "withdraw" ? "Withdraw" : "Deposit"), bounds.initial);
|
|
160
|
+
frame.addEventListener("load", onLoad);
|
|
161
|
+
setStatus("loading");
|
|
162
|
+
container.appendChild(frame);
|
|
163
|
+
if (alternates.length > 0) {
|
|
164
|
+
answerTimer = setTimeout(failOver, FRAME_ANSWER_TIMEOUT_MS);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const failOver = () => {
|
|
168
|
+
answerTimer = null;
|
|
169
|
+
const next = alternates.shift();
|
|
170
|
+
if (stopped || answered || !next)
|
|
171
|
+
return;
|
|
172
|
+
mountFrame(next);
|
|
173
|
+
};
|
|
141
174
|
events.height(bounds.initial);
|
|
142
175
|
setStatus("session");
|
|
143
176
|
requestSession(options, abort.signal)
|
|
@@ -158,12 +191,9 @@ export const runPayFrame = (container, options, events) => {
|
|
|
158
191
|
throw new PaySdkError("invalid_widget_url", "The widget session has no usable widget URL");
|
|
159
192
|
}
|
|
160
193
|
held = holdSession(session, Date.now());
|
|
161
|
-
|
|
162
|
-
frame = createFrame(location.src, location.origin, options.title || (options.mode === "withdraw" ? "Withdraw" : "Deposit"), bounds.initial);
|
|
163
|
-
frame.addEventListener("load", onLoad);
|
|
194
|
+
alternates = alternateLocations(location, session.widget_origins, options.allowedWidgetOrigins);
|
|
164
195
|
window.addEventListener("message", onMessage);
|
|
165
|
-
|
|
166
|
-
container.appendChild(frame);
|
|
196
|
+
mountFrame(location);
|
|
167
197
|
})
|
|
168
198
|
.catch(fail);
|
|
169
199
|
return () => {
|
|
@@ -171,6 +201,7 @@ export const runPayFrame = (container, options, events) => {
|
|
|
171
201
|
return;
|
|
172
202
|
stopped = true;
|
|
173
203
|
abort.abort();
|
|
204
|
+
clearAnswerTimer();
|
|
174
205
|
window.removeEventListener("message", onMessage);
|
|
175
206
|
if (frame) {
|
|
176
207
|
frame.removeEventListener("load", onLoad);
|
package/dist/types.d.ts
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const CHAIN_NAMES = {
|
|
2
|
+
bsc: "BSC",
|
|
3
|
+
eth: "Ethereum",
|
|
4
|
+
polygon: "Polygon",
|
|
5
|
+
arbitrum: "Arbitrum",
|
|
6
|
+
optimism: "Optimism",
|
|
7
|
+
base: "Base",
|
|
8
|
+
solana: "Solana",
|
|
9
|
+
tron: "Tron",
|
|
10
|
+
bitcoin: "Bitcoin",
|
|
11
|
+
ton: "TON",
|
|
12
|
+
sui: "Sui",
|
|
13
|
+
};
|
|
14
|
+
const EXPLORERS = {
|
|
15
|
+
eth: "https://etherscan.io/tx/",
|
|
16
|
+
bsc: "https://bscscan.com/tx/",
|
|
17
|
+
polygon: "https://polygonscan.com/tx/",
|
|
18
|
+
arbitrum: "https://arbiscan.io/tx/",
|
|
19
|
+
optimism: "https://optimistic.etherscan.io/tx/",
|
|
20
|
+
base: "https://basescan.org/tx/",
|
|
21
|
+
solana: "https://solscan.io/tx/",
|
|
22
|
+
tron: "https://tronscan.org/#/transaction/",
|
|
23
|
+
bitcoin: "https://mempool.space/tx/",
|
|
24
|
+
};
|
|
25
|
+
const TX_HASH = /^[A-Za-z0-9]{16,128}$/;
|
|
26
|
+
export const chainName = (chainId) => CHAIN_NAMES[chainId] ?? chainId.charAt(0).toUpperCase() + chainId.slice(1);
|
|
27
|
+
export const explorerUrl = (chainId, hash) => {
|
|
28
|
+
if (!hash || !TX_HASH.test(hash))
|
|
29
|
+
return null;
|
|
30
|
+
const base = EXPLORERS[chainId];
|
|
31
|
+
return base ? `${base}${hash}` : null;
|
|
32
|
+
};
|
|
33
|
+
export const orderBy = (items, key, order) => {
|
|
34
|
+
const rank = (item) => {
|
|
35
|
+
const index = order.indexOf(key(item));
|
|
36
|
+
return index === -1 ? order.length : index;
|
|
37
|
+
};
|
|
38
|
+
return items
|
|
39
|
+
.map((item, index) => ({ item, index }))
|
|
40
|
+
.sort((a, b) => rank(a.item) - rank(b.item) || a.index - b.index)
|
|
41
|
+
.map(({ item }) => item);
|
|
42
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import { type MessageKey, type PayLocale, type Translate } from "../core/i18n/base.js";
|
|
3
|
+
export declare const DEFAULT_ASSET_BASE_URL = "https://binodex.app";
|
|
4
|
+
export interface PayUiFormatters {
|
|
5
|
+
money: (value: number | string | null | undefined, currency: string) => string;
|
|
6
|
+
usd: (value: number | string | null | undefined) => string;
|
|
7
|
+
percent: (value: number | string | null | undefined) => string;
|
|
8
|
+
decimal: (value: number | string | null | undefined, maximumFractionDigits?: number) => string;
|
|
9
|
+
balance: (value: number | string | null | undefined) => string;
|
|
10
|
+
}
|
|
11
|
+
export interface PayUiValue {
|
|
12
|
+
t: Translate;
|
|
13
|
+
locale: PayLocale;
|
|
14
|
+
intl: string;
|
|
15
|
+
dir: "ltr" | "rtl";
|
|
16
|
+
formatters: PayUiFormatters;
|
|
17
|
+
assetBaseUrl: string;
|
|
18
|
+
unstyled: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const balanceText: (value: number | string | null | undefined) => string;
|
|
21
|
+
export declare const createFormatters: (t: Translate, intl: string) => PayUiFormatters;
|
|
22
|
+
export declare const usePayUi: () => PayUiValue;
|
|
23
|
+
export declare const useClasses: (unstyled?: boolean) => {
|
|
24
|
+
ui: PayUiValue;
|
|
25
|
+
off: boolean;
|
|
26
|
+
c: (...names: (string | false | null | undefined)[]) => string | undefined;
|
|
27
|
+
};
|
|
28
|
+
export interface PayUiProviderProps {
|
|
29
|
+
locale?: string;
|
|
30
|
+
messages?: Partial<Record<MessageKey, string>>;
|
|
31
|
+
t?: Translate;
|
|
32
|
+
intl?: string;
|
|
33
|
+
dir?: "ltr" | "rtl";
|
|
34
|
+
formatters?: Partial<PayUiFormatters>;
|
|
35
|
+
assetBaseUrl?: string;
|
|
36
|
+
unstyled?: boolean;
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export declare const usePayUiValue: ({ locale: localeProp, messages, t: tProp, intl: intlProp, dir: dirProp, formatters, assetBaseUrl, unstyled, }: Omit<PayUiProviderProps, "children">) => PayUiValue;
|
|
40
|
+
export declare function PayUiProvider({ children, ...options }: PayUiProviderProps): import("react").JSX.Element;
|
|
41
|
+
export declare function PayUiValueProvider({ value, children }: {
|
|
42
|
+
value: PayUiValue;
|
|
43
|
+
children?: ReactNode;
|
|
44
|
+
}): import("react").JSX.Element;
|
|
45
|
+
export type PayUiTheme = "light" | "dark" | "auto";
|
|
46
|
+
export type PayUiSkin = "classic" | "black";
|
|
47
|
+
export interface PayUiRootProps extends Omit<PayUiProviderProps, "children">, Omit<HTMLAttributes<HTMLDivElement>, "dir" | "lang"> {
|
|
48
|
+
theme?: PayUiTheme;
|
|
49
|
+
skin?: PayUiSkin;
|
|
50
|
+
}
|
|
51
|
+
export declare const PayUiRoot: import("react").ForwardRefExoticComponent<PayUiRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, forwardRef, useContext, useMemo, } from "react";
|
|
4
|
+
import { intlLocale, isRtlLocale, resolveLocale, translatorFrom, } from "../core/i18n/base.js";
|
|
5
|
+
import { formatDecimal, formatMoney, formatPercentValue, formatUsd } from "../core/money.js";
|
|
6
|
+
import { classes, cx } from "./part.js";
|
|
7
|
+
import { resolveBaseUrl } from "./urls.js";
|
|
8
|
+
export const DEFAULT_ASSET_BASE_URL = "https://binodex.app";
|
|
9
|
+
const toNumber = (value) => value === null || value === undefined ? Number.NaN : Number(value);
|
|
10
|
+
export const balanceText = (value) => {
|
|
11
|
+
const num = toNumber(value);
|
|
12
|
+
return Number.isFinite(num) ? `$${num.toFixed(2)}` : "—";
|
|
13
|
+
};
|
|
14
|
+
export const createFormatters = (t, intl) => ({
|
|
15
|
+
money: (value, currency) => formatMoney(value, currency, intl),
|
|
16
|
+
usd: (value) => formatUsd(value),
|
|
17
|
+
percent: (value) => t("common.percent", { value: formatPercentValue(value, intl) }),
|
|
18
|
+
decimal: (value, maximumFractionDigits = 2) => formatDecimal(value, intl, { maximumFractionDigits }),
|
|
19
|
+
balance: balanceText,
|
|
20
|
+
});
|
|
21
|
+
const defaultT = translatorFrom({});
|
|
22
|
+
const DEFAULT_VALUE = {
|
|
23
|
+
t: defaultT,
|
|
24
|
+
locale: "en",
|
|
25
|
+
intl: "en-US",
|
|
26
|
+
dir: "ltr",
|
|
27
|
+
formatters: createFormatters(defaultT, "en-US"),
|
|
28
|
+
assetBaseUrl: DEFAULT_ASSET_BASE_URL,
|
|
29
|
+
unstyled: false,
|
|
30
|
+
};
|
|
31
|
+
const PayUiContext = createContext(DEFAULT_VALUE);
|
|
32
|
+
export const usePayUi = () => useContext(PayUiContext);
|
|
33
|
+
export const useClasses = (unstyled) => {
|
|
34
|
+
const ui = usePayUi();
|
|
35
|
+
const off = unstyled ?? ui.unstyled;
|
|
36
|
+
return { ui, off, c: classes(off) };
|
|
37
|
+
};
|
|
38
|
+
export const usePayUiValue = ({ locale: localeProp, messages, t: tProp, intl: intlProp, dir: dirProp, formatters, assetBaseUrl, unstyled = false, }) => {
|
|
39
|
+
const locale = useMemo(() => resolveLocale(localeProp ?? "en"), [localeProp]);
|
|
40
|
+
const messagesKey = JSON.stringify(messages ?? {});
|
|
41
|
+
const t = useMemo(() => tProp ?? translatorFrom({}, JSON.parse(messagesKey)), [tProp, messagesKey]);
|
|
42
|
+
const intl = intlProp ?? intlLocale(locale);
|
|
43
|
+
return useMemo(() => ({
|
|
44
|
+
t,
|
|
45
|
+
locale,
|
|
46
|
+
intl,
|
|
47
|
+
dir: dirProp ?? (isRtlLocale(locale) ? "rtl" : "ltr"),
|
|
48
|
+
formatters: { ...createFormatters(t, intl), ...formatters },
|
|
49
|
+
assetBaseUrl: resolveBaseUrl("assetBaseUrl", assetBaseUrl, DEFAULT_ASSET_BASE_URL),
|
|
50
|
+
unstyled,
|
|
51
|
+
}), [t, locale, intl, dirProp, formatters, assetBaseUrl, unstyled]);
|
|
52
|
+
};
|
|
53
|
+
export function PayUiProvider({ children, ...options }) {
|
|
54
|
+
const value = usePayUiValue(options);
|
|
55
|
+
return _jsx(PayUiContext.Provider, { value: value, children: children });
|
|
56
|
+
}
|
|
57
|
+
export function PayUiValueProvider({ value, children }) {
|
|
58
|
+
return _jsx(PayUiContext.Provider, { value: value, children: children });
|
|
59
|
+
}
|
|
60
|
+
export const PayUiRoot = forwardRef(function PayUiRoot({ locale, messages, t, intl, dir, formatters, assetBaseUrl, unstyled = false, theme = "auto", skin = "classic", className, children, ...rest }, ref) {
|
|
61
|
+
const value = usePayUiValue({ locale, messages, t, intl, dir, formatters, assetBaseUrl, unstyled });
|
|
62
|
+
return (_jsx("div", { ...rest, ref: ref, className: cx(!unstyled && "bp-root", className), "data-binodex-pay": "root", "data-theme": theme, "data-skin": skin, dir: value.dir, lang: value.intl, children: _jsx(PayUiContext.Provider, { value: value, children: children }) }));
|
|
63
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode, type SVGAttributes } from "react";
|
|
2
|
+
import { type PartStyleProps } from "./part.js";
|
|
3
|
+
import { type QrEcc } from "./qr-encode.js";
|
|
4
|
+
type DivProps = Omit<HTMLAttributes<HTMLDivElement>, "className" | "style" | "children" | "title"> & PartStyleProps;
|
|
5
|
+
export declare const useCopy: (resetMs?: number) => {
|
|
6
|
+
copied: boolean;
|
|
7
|
+
copy: (value: string) => Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare const LTR_ISOLATE: {
|
|
10
|
+
readonly unicodeBidi: "isolate";
|
|
11
|
+
};
|
|
12
|
+
export type QrSvgProps = Omit<SVGAttributes<SVGSVGElement>, "className" | "style" | "children"> & PartStyleProps & {
|
|
13
|
+
value: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
ecc?: QrEcc;
|
|
16
|
+
margin?: number;
|
|
17
|
+
label?: string;
|
|
18
|
+
part?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const qrMatrixOf: (value: string, ecc: QrEcc, margin: number) => {
|
|
21
|
+
side: number;
|
|
22
|
+
path: string;
|
|
23
|
+
} | null;
|
|
24
|
+
export declare const QrSvg: import("react").ForwardRefExoticComponent<Omit<SVGAttributes<SVGSVGElement>, "style" | "children" | "className"> & PartStyleProps & {
|
|
25
|
+
value: string;
|
|
26
|
+
size?: number;
|
|
27
|
+
ecc?: QrEcc;
|
|
28
|
+
margin?: number;
|
|
29
|
+
label?: string;
|
|
30
|
+
part?: string;
|
|
31
|
+
} & import("react").RefAttributes<SVGSVGElement>>;
|
|
32
|
+
export interface QrCodeProps extends DivProps {
|
|
33
|
+
value: string;
|
|
34
|
+
overlay?: ReactNode;
|
|
35
|
+
badge?: ReactNode;
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare const QrCode: import("react").ForwardRefExoticComponent<QrCodeProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
39
|
+
export interface CopyButtonProps extends PartStyleProps {
|
|
40
|
+
value: string;
|
|
41
|
+
label?: string;
|
|
42
|
+
variant?: "address" | "requisite";
|
|
43
|
+
}
|
|
44
|
+
export declare function CopyButton({ value, label, variant, className, style, unstyled }: CopyButtonProps): import("react").JSX.Element;
|
|
45
|
+
export interface CreditBannerProps extends DivProps {
|
|
46
|
+
title: ReactNode;
|
|
47
|
+
subtitle?: ReactNode;
|
|
48
|
+
part?: string;
|
|
49
|
+
children?: ReactNode;
|
|
50
|
+
}
|
|
51
|
+
export declare const CreditBanner: import("react").ForwardRefExoticComponent<CreditBannerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
52
|
+
export interface CryptoAddressCardProps extends DivProps {
|
|
53
|
+
address: string | null;
|
|
54
|
+
loading?: boolean;
|
|
55
|
+
label?: ReactNode;
|
|
56
|
+
overlay?: ReactNode;
|
|
57
|
+
badge?: ReactNode;
|
|
58
|
+
warning?: ReactNode;
|
|
59
|
+
highFee?: ReactNode;
|
|
60
|
+
error?: ReactNode;
|
|
61
|
+
details?: ReactNode;
|
|
62
|
+
showQr?: boolean;
|
|
63
|
+
part?: string;
|
|
64
|
+
children?: ReactNode;
|
|
65
|
+
}
|
|
66
|
+
export declare const CryptoAddressCard: import("react").ForwardRefExoticComponent<CryptoAddressCardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
4
|
+
import { useClasses } from "./context.js";
|
|
5
|
+
import { ErrorBox, Skeleton } from "./fields.js";
|
|
6
|
+
import { CopiedIcon, CopyIcon, CreditCheckIcon, WarningIcon } from "./icons.js";
|
|
7
|
+
import { SENSITIVE_CLASS, SENSITIVE_PROPS, cx, partProps, viewProps } from "./part.js";
|
|
8
|
+
import { encodeQr, qrPath } from "./qr-encode.js";
|
|
9
|
+
export const useCopy = (resetMs = 1200) => {
|
|
10
|
+
const [copied, setCopied] = useState(false);
|
|
11
|
+
const timer = useRef(null);
|
|
12
|
+
useEffect(() => () => {
|
|
13
|
+
if (timer.current)
|
|
14
|
+
clearTimeout(timer.current);
|
|
15
|
+
}, []);
|
|
16
|
+
const copy = useCallback(async (value) => {
|
|
17
|
+
try {
|
|
18
|
+
await navigator.clipboard.writeText(value);
|
|
19
|
+
setCopied(true);
|
|
20
|
+
if (timer.current)
|
|
21
|
+
clearTimeout(timer.current);
|
|
22
|
+
timer.current = setTimeout(() => setCopied(false), resetMs);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
setCopied(false);
|
|
26
|
+
}
|
|
27
|
+
}, [resetMs]);
|
|
28
|
+
return { copied, copy };
|
|
29
|
+
};
|
|
30
|
+
export const LTR_ISOLATE = { unicodeBidi: "isolate" };
|
|
31
|
+
export const qrMatrixOf = (value, ecc, margin) => {
|
|
32
|
+
if (!value)
|
|
33
|
+
return null;
|
|
34
|
+
try {
|
|
35
|
+
const matrix = encodeQr(value, ecc);
|
|
36
|
+
return { side: matrix.size + margin * 2, path: qrPath(matrix, margin) };
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export const QrSvg = forwardRef(function QrSvg({ value, size = 176, ecc = "M", margin = 4, label, part = "qr", className, style, unstyled, ...rest }, ref) {
|
|
43
|
+
const { ui, off } = useClasses(unstyled);
|
|
44
|
+
const encoded = useMemo(() => qrMatrixOf(value, ecc, margin), [value, ecc, margin]);
|
|
45
|
+
if (!encoded)
|
|
46
|
+
return null;
|
|
47
|
+
return (_jsxs("svg", { role: "img", "aria-label": label ?? ui.t("qr.label"), viewBox: `0 0 ${encoded.side} ${encoded.side}`, width: size, height: size, shapeRendering: "crispEdges", ...rest, ref: ref, ...partProps(part, { className, style, unstyled }, off, { sensitive: true }), ...SENSITIVE_PROPS, children: [_jsx("rect", { width: encoded.side, height: encoded.side, fill: "#ffffff" }), _jsx("path", { d: encoded.path, fill: "#000000" })] }));
|
|
48
|
+
});
|
|
49
|
+
export const QrCode = forwardRef(function QrCode({ value, overlay, badge, label, className, style, unstyled, ...rest }, ref) {
|
|
50
|
+
const { c, off } = useClasses(unstyled);
|
|
51
|
+
return (_jsxs("div", { ...rest, ref: ref, ...partProps("qr-code", { className, style, unstyled }, off), children: [_jsx(QrSvg, { value: value, size: 193, ecc: "H", margin: 0, label: label, unstyled: true }), overlay && (_jsxs("div", { className: c("qr-overlay"), children: [_jsx("span", { className: c("qr-token"), children: overlay }), badge && _jsx("span", { className: c("qr-chain"), children: badge })] }))] }));
|
|
52
|
+
});
|
|
53
|
+
export function CopyButton({ value, label, variant = "address", className, style, unstyled }) {
|
|
54
|
+
const { ui, off } = useClasses(unstyled);
|
|
55
|
+
const { copied, copy } = useCopy();
|
|
56
|
+
const copyText = ui.t("common.copy");
|
|
57
|
+
return (_jsx("button", { type: "button", ...viewProps("copy", "copy", { className, style, unstyled }, off), "data-variant": variant, "data-copied": copied ? "" : undefined, title: copyText, "aria-label": label ? `${copyText}: ${label}` : copyText, onClick: () => void copy(value), children: variant === "requisite" ? (copied ? (_jsx("svg", { width: 14, height: 14, viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M2 6.2 4.8 9 10 3.4", stroke: "currentColor", strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })) : (_jsx(CopyIcon, { size: 16 }))) : copied ? (_jsx(CopiedIcon, {})) : (_jsx(CopyIcon, {})) }));
|
|
58
|
+
}
|
|
59
|
+
export const CreditBanner = forwardRef(function CreditBanner({ title, subtitle, part = "credit-banner", children, className, style, unstyled, ...rest }, ref) {
|
|
60
|
+
const { c, off } = useClasses(unstyled);
|
|
61
|
+
return (_jsxs("div", { role: "status", ...rest, ref: ref, ...viewProps(part, "credit-banner", { className, style, unstyled }, off), children: [_jsx("span", { className: c("credit-icon"), children: _jsx(CreditCheckIcon, {}) }), _jsxs("div", { className: c("credit-body"), children: [_jsx("div", { className: c("credit-title"), children: title }), subtitle && _jsx("div", { className: c("credit-subtitle"), children: subtitle }), children] })] }));
|
|
62
|
+
});
|
|
63
|
+
export const CryptoAddressCard = forwardRef(function CryptoAddressCard({ address, loading = false, label, overlay, badge, warning, highFee, error, details, showQr = true, part = "crypto-address-card", children, className, style, unstyled, ...rest }, ref) {
|
|
64
|
+
const { ui, c, off } = useClasses(unstyled);
|
|
65
|
+
const ready = !loading && !!address;
|
|
66
|
+
const addressLabel = label ?? ui.t("address.yours");
|
|
67
|
+
return (_jsxs("div", { ...rest, ref: ref, ...viewProps(part, "crypto-address-card", { className, style, unstyled }, off), children: [error && _jsx(ErrorBox, { unstyled: unstyled, children: error }), showQr && (_jsx("div", { className: c("qr-wrapper"), children: ready ? (_jsx(QrCode, { value: address, overlay: overlay, badge: badge, unstyled: unstyled }, address)) : (_jsx("div", { className: c("qr-skeleton"), children: _jsx("div", { className: c("qr-skeleton-box"), children: _jsx(Skeleton, { height: "100%", radius: 5, unstyled: unstyled }) }) })) })), _jsxs("div", { children: [_jsx("div", { className: c("address-label"), "data-binodex-pay": "label", children: addressLabel }), _jsx("div", { className: c("address-field"), children: ready ? (_jsxs("div", { className: c("address-row"), "data-binodex-pay": "address-row", children: [_jsx("span", { className: cx(c("address-text"), SENSITIVE_CLASS), "data-binodex-pay": "address", dir: "ltr", style: LTR_ISOLATE, ...SENSITIVE_PROPS, children: address }), _jsx(CopyButton, { value: address, label: typeof addressLabel === "string" ? addressLabel : undefined, unstyled: unstyled })] }, address)) : (_jsx(Skeleton, { height: 48, radius: 5, unstyled: unstyled })) })] }), warning && (_jsxs("div", { className: c("address-warning"), "data-binodex-pay": "warning", children: [_jsx("span", { className: c("address-warning-icon"), children: _jsx(WarningIcon, {}) }), _jsx("span", { children: warning })] })), highFee && (_jsxs("div", { className: c("high-fee"), "data-binodex-pay": "warning", "data-variant": "fee", children: ["\u203c\ufe0f ", highFee] })), details, children] }));
|
|
68
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
+
import { type PartStyleProps } from "./part.js";
|
|
3
|
+
import type { EntryOption, EntryTab } from "./types.js";
|
|
4
|
+
type DivProps = Omit<HTMLAttributes<HTMLDivElement>, "className" | "style" | "children" | "onChange" | "onSelect"> & PartStyleProps;
|
|
5
|
+
export interface EntryTabsProps extends DivProps {
|
|
6
|
+
tabs: EntryTab[];
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (id: string) => void;
|
|
9
|
+
ariaLabel?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const EntryTabs: import("react").ForwardRefExoticComponent<EntryTabsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export interface EntryOptionsProps extends DivProps {
|
|
13
|
+
options: EntryOption[];
|
|
14
|
+
onSelect?: (id: string) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const IconStack: ({ icons, unstyled }: {
|
|
17
|
+
icons: ReactNode[];
|
|
18
|
+
unstyled?: boolean;
|
|
19
|
+
}) => import("react").JSX.Element;
|
|
20
|
+
export declare const EntryOptions: import("react").ForwardRefExoticComponent<EntryOptionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export declare const CardTab: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "children" | "className" | "onChange" | "onSelect"> & PartStyleProps & {
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
|
+
export declare const cryptoStackIcons: (symbols?: readonly string[]) => ReactNode[];
|
|
25
|
+
export {};
|
package/dist/ui/entry.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { useClasses } from "./context.js";
|
|
5
|
+
import { CRYPTO_STACK, TokenIcon, TransferCryptoIcon } from "./icons.js";
|
|
6
|
+
import { partProps } from "./part.js";
|
|
7
|
+
export const EntryTabs = forwardRef(function EntryTabs({ tabs, value, onChange, ariaLabel, className, style, unstyled, ...rest }, ref) {
|
|
8
|
+
const { c, off } = useClasses(unstyled);
|
|
9
|
+
return (_jsx("div", { role: "group", "aria-label": ariaLabel, ...rest, ref: ref, ...partProps("tabs", { className, style, unstyled }, off), children: tabs.map((tab) => {
|
|
10
|
+
const active = tab.id === value;
|
|
11
|
+
return (_jsx("button", { type: "button", "aria-pressed": active, className: c("tab", active && "tab-active"), "data-binodex-pay": "tab", "data-tab": tab.id, "data-active": active ? "" : undefined, onClick: () => onChange(tab.id), ...tab.attrs, children: tab.label }, tab.id));
|
|
12
|
+
}) }));
|
|
13
|
+
});
|
|
14
|
+
export const IconStack = ({ icons, unstyled }) => {
|
|
15
|
+
const { c } = useClasses(unstyled);
|
|
16
|
+
return (_jsx("div", { className: c("icon-stack"), "data-binodex-pay": "icon-stack", children: icons.map((icon, index) => (_jsx("div", { className: c("icon-badge"), children: icon }, index))) }));
|
|
17
|
+
};
|
|
18
|
+
export const EntryOptions = forwardRef(function EntryOptions({ options, onSelect, className, style, unstyled, ...rest }, ref) {
|
|
19
|
+
const { c, off } = useClasses(unstyled);
|
|
20
|
+
return (_jsx("div", { ...rest, ref: ref, ...partProps("entry-options", { className, style, unstyled }, off), children: options.map((option) => (_jsxs("button", { type: "button", className: c("entry-option"), "data-binodex-pay": "entry-option", "data-option": option.id, disabled: option.disabled, onClick: onSelect ? () => onSelect(option.id) : undefined, ...option.attrs, children: [_jsx("span", { className: c("entry-option-icon"), "aria-hidden": "true", children: option.icon ?? _jsx(TransferCryptoIcon, {}) }), _jsxs("span", { className: c("entry-option-body"), children: [_jsxs("span", { className: c("entry-option-text"), children: [_jsx("span", { className: c("entry-option-title"), "data-binodex-pay": "option-label", children: option.title }), option.subtitle !== undefined && option.subtitle !== null && (_jsx("span", { className: c("entry-option-subtitle"), "data-binodex-pay": "option-subtitle", children: option.subtitle }))] }), option.icons && option.icons.length > 0 && _jsx(IconStack, { icons: option.icons, unstyled: unstyled })] })] }, option.id))) }));
|
|
21
|
+
});
|
|
22
|
+
export const CardTab = forwardRef(function CardTab({ children, className, style, unstyled, ...rest }, ref) {
|
|
23
|
+
const { off } = useClasses(unstyled);
|
|
24
|
+
return (_jsx("div", { ...rest, ref: ref, ...partProps("card-tab", { className, style, unstyled }, off), children: children }));
|
|
25
|
+
});
|
|
26
|
+
export const cryptoStackIcons = (symbols = CRYPTO_STACK) => symbols.map((symbol) => _jsx(TokenIcon, { symbol: symbol, size: 20 }, symbol));
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type FormHTMLAttributes, type HTMLAttributes, type ReactNode, type Ref } from "react";
|
|
2
|
+
import { type PartStyleProps } from "./part.js";
|
|
3
|
+
import type { RequisiteRow, StatusTone } from "./types.js";
|
|
4
|
+
type DivProps = Omit<HTMLAttributes<HTMLDivElement>, "className" | "style" | "children" | "title" | "onSubmit"> & PartStyleProps;
|
|
5
|
+
export interface RequisitesProps extends DivProps {
|
|
6
|
+
rows: RequisiteRow[];
|
|
7
|
+
note?: ReactNode;
|
|
8
|
+
testId?: string;
|
|
9
|
+
part?: string;
|
|
10
|
+
sensitive?: boolean;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const Requisites: import("react").ForwardRefExoticComponent<RequisitesProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const PayingPanel: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "title" | "children" | "className" | "onSubmit"> & PartStyleProps & {
|
|
15
|
+
part?: string;
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
export declare const StatusPill: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "title" | "children" | "className" | "onSubmit"> & PartStyleProps & {
|
|
19
|
+
tone: StatusTone;
|
|
20
|
+
label: ReactNode;
|
|
21
|
+
part?: string;
|
|
22
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
23
|
+
export declare const PanelAmount: ({ children, unstyled }: {
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
unstyled?: boolean;
|
|
26
|
+
}) => import("react").JSX.Element;
|
|
27
|
+
export declare const PanelHint: ({ children, unstyled }: {
|
|
28
|
+
children?: ReactNode;
|
|
29
|
+
unstyled?: boolean;
|
|
30
|
+
}) => import("react").JSX.Element;
|
|
31
|
+
export declare const ExpiresLine: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "title" | "children" | "className" | "onSubmit"> & PartStyleProps & {
|
|
32
|
+
part?: string;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
35
|
+
export declare const PayActions: ({ children, unstyled }: {
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
unstyled?: boolean;
|
|
38
|
+
}) => import("react").JSX.Element;
|
|
39
|
+
export interface StatusPanelProps extends DivProps {
|
|
40
|
+
tone: StatusTone;
|
|
41
|
+
statusLabel: ReactNode;
|
|
42
|
+
amountLabel: ReactNode;
|
|
43
|
+
hint?: ReactNode;
|
|
44
|
+
expiresLabel?: ReactNode;
|
|
45
|
+
actions?: ReactNode;
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
}
|
|
48
|
+
export declare const StatusPanel: import("react").ForwardRefExoticComponent<StatusPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
49
|
+
export declare const ReceiptBlock: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "title" | "children" | "className" | "onSubmit"> & PartStyleProps & {
|
|
50
|
+
part?: string;
|
|
51
|
+
children?: ReactNode;
|
|
52
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
53
|
+
export declare const QrImageCard: ({ children, variant, unstyled, }: {
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
variant?: "card" | "box";
|
|
56
|
+
unstyled?: boolean;
|
|
57
|
+
}) => import("react").JSX.Element;
|
|
58
|
+
export declare const RailForm: import("react").ForwardRefExoticComponent<Omit<FormHTMLAttributes<HTMLFormElement>, "style" | "children" | "className"> & PartStyleProps & {
|
|
59
|
+
as?: "form" | "div";
|
|
60
|
+
variant?: "default" | "stack";
|
|
61
|
+
part?: string;
|
|
62
|
+
children?: ReactNode;
|
|
63
|
+
} & import("react").RefAttributes<HTMLFormElement>>;
|
|
64
|
+
export declare const PdfReceiptWarning: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "title" | "children" | "className" | "onSubmit"> & PartStyleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
65
|
+
export declare const ReceiptAttached: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "title" | "children" | "className" | "onSubmit"> & PartStyleProps & {
|
|
66
|
+
title?: ReactNode;
|
|
67
|
+
body?: ReactNode;
|
|
68
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
69
|
+
export declare const RECEIPT_MAX_BYTES: number;
|
|
70
|
+
export declare const isPdfFile: (file: {
|
|
71
|
+
type: string;
|
|
72
|
+
name: string;
|
|
73
|
+
}) => boolean;
|
|
74
|
+
export interface ReceiptFormProps extends DivProps {
|
|
75
|
+
onSubmit: (file: File) => void | Promise<void>;
|
|
76
|
+
file?: File | null;
|
|
77
|
+
onFileChange?: (file: File | null | undefined) => void;
|
|
78
|
+
onPreview?: () => void;
|
|
79
|
+
pdfOnly?: boolean;
|
|
80
|
+
sending?: boolean;
|
|
81
|
+
error?: ReactNode;
|
|
82
|
+
maxBytes?: number;
|
|
83
|
+
accept?: string;
|
|
84
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
85
|
+
}
|
|
86
|
+
export declare const ReceiptForm: import("react").ForwardRefExoticComponent<ReceiptFormProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
87
|
+
export type PollHealth = "ok" | "retrying" | "unreachable";
|
|
88
|
+
export declare const PollNotice: import("react").ForwardRefExoticComponent<PartStyleProps & {
|
|
89
|
+
health: PollHealth;
|
|
90
|
+
} & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
91
|
+
export declare const GeoBlock: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "style" | "title" | "children" | "className" | "onSubmit"> & PartStyleProps & {
|
|
92
|
+
onClose?: () => void;
|
|
93
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
94
|
+
export {};
|