@volr/react-ui 0.1.93 → 0.1.95
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 +270 -161
- package/dist/index.cjs +914 -242
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +106 -4
- package/dist/index.d.ts +106 -4
- package/dist/index.js +806 -139
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
-
import { KeyStorageType, VolrConfig, PaymentResult, PayOptions } from '@volr/react';
|
|
3
|
-
export { EvmClient, KeyStorageType, SendBatchOverloads, SignerType, VolrClient, VolrConfig, VolrProvider, VolrUser, useDepositListener, usePasskeyEnrollment, useVolr, useVolrLogin } from '@volr/react';
|
|
2
|
+
import { KeyStorageType, VolrConfig, PaymentResult, PayOptions as PayOptions$1, PaymentHistoryOptions, PaymentHistoryResult } from '@volr/react';
|
|
3
|
+
export { EvmClient, KeyStorageType, PaymentHistoryOptions, PaymentHistoryResult, PaymentResult, PaymentStatus, PaymentToken, SendBatchOverloads, SignerType, UseVolrPaymentApiReturn, VolrClient, VolrConfig, VolrProvider, VolrUser, useDepositListener, usePasskeyEnrollment, useVolr, useVolrLogin, useVolrPaymentApi } from '@volr/react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
interface BrandingConfig {
|
|
@@ -243,7 +243,7 @@ interface ModalAsset {
|
|
|
243
243
|
}
|
|
244
244
|
interface PaymentModalOptions {
|
|
245
245
|
payment: PaymentResult;
|
|
246
|
-
options: PayOptions;
|
|
246
|
+
options: PayOptions$1;
|
|
247
247
|
onComplete?: (result: PaymentResult) => void;
|
|
248
248
|
onProcessing?: (payment: PaymentResult & {
|
|
249
249
|
txHash: string;
|
|
@@ -298,4 +298,106 @@ declare function useSwitchNetwork(): (chainId: number) => Promise<void>;
|
|
|
298
298
|
*/
|
|
299
299
|
declare function getCurrentChainId(): Promise<number>;
|
|
300
300
|
|
|
301
|
-
|
|
301
|
+
/**
|
|
302
|
+
* useVolrPay hook - Payment with UI integration
|
|
303
|
+
*
|
|
304
|
+
* This hook provides payment functionality with PaymentModal integration.
|
|
305
|
+
* For headless API-only access, use useVolrPaymentApi from @volr/react
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Payment item displayed in modal
|
|
310
|
+
*/
|
|
311
|
+
interface PaymentItem {
|
|
312
|
+
/** Item name */
|
|
313
|
+
name: string;
|
|
314
|
+
/** Item description (optional) */
|
|
315
|
+
description?: string;
|
|
316
|
+
/** Item image URL (optional, falls back to project branding logo) */
|
|
317
|
+
image?: string;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Payment error
|
|
321
|
+
*/
|
|
322
|
+
interface PaymentError {
|
|
323
|
+
code: string;
|
|
324
|
+
message: string;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Payment handlers/callbacks
|
|
328
|
+
*/
|
|
329
|
+
interface PaymentHandlers {
|
|
330
|
+
/** Called when payment is created */
|
|
331
|
+
onCreated?: (payment: {
|
|
332
|
+
id: string;
|
|
333
|
+
}) => void;
|
|
334
|
+
/** Called when transaction is broadcasted */
|
|
335
|
+
onProcessing?: (payment: {
|
|
336
|
+
id: string;
|
|
337
|
+
txHash: string;
|
|
338
|
+
}) => void;
|
|
339
|
+
/** Called when payment is confirmed on-chain */
|
|
340
|
+
onSuccess?: (result: PaymentResult) => void;
|
|
341
|
+
/** Called when payment fails */
|
|
342
|
+
onError?: (error: PaymentError) => void;
|
|
343
|
+
/** Called when user cancels */
|
|
344
|
+
onCancel?: () => void;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Options for pay() function
|
|
348
|
+
*/
|
|
349
|
+
interface PayOptions {
|
|
350
|
+
/** Amount in token units (before decimals) */
|
|
351
|
+
amount: number;
|
|
352
|
+
/** Item information to display in modal */
|
|
353
|
+
item?: PaymentItem;
|
|
354
|
+
/** Client-side reference ID */
|
|
355
|
+
referenceId?: string;
|
|
356
|
+
/** Custom metadata (max 50 keys) */
|
|
357
|
+
metadata?: Record<string, string>;
|
|
358
|
+
/** Idempotency key to prevent duplicates */
|
|
359
|
+
idempotencyKey?: string;
|
|
360
|
+
/** Expiration time in seconds (default: 900 = 15 min) */
|
|
361
|
+
expiresInSec?: number;
|
|
362
|
+
/** Callback handlers */
|
|
363
|
+
handlers?: PaymentHandlers;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Payment handle returned from pay()
|
|
367
|
+
*/
|
|
368
|
+
interface PaymentHandle {
|
|
369
|
+
/** Payment ID */
|
|
370
|
+
id: string;
|
|
371
|
+
/** Current payment status */
|
|
372
|
+
status: PaymentResult['status'];
|
|
373
|
+
/** Wait for payment to complete */
|
|
374
|
+
wait: () => Promise<PaymentResult>;
|
|
375
|
+
/** Cancel the payment (only works for PENDING) */
|
|
376
|
+
cancel: () => Promise<void>;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* useVolrPay return type
|
|
380
|
+
*/
|
|
381
|
+
interface UseVolrPayReturn {
|
|
382
|
+
/**
|
|
383
|
+
* Initiate a payment with PaymentModal
|
|
384
|
+
* @param options Payment options including amount, item, handlers
|
|
385
|
+
* @returns PaymentHandle with id, status, wait(), cancel()
|
|
386
|
+
*/
|
|
387
|
+
pay: (options: PayOptions) => Promise<PaymentHandle>;
|
|
388
|
+
/**
|
|
389
|
+
* Check payment status by ID
|
|
390
|
+
*/
|
|
391
|
+
checkPayment: (paymentId: string) => Promise<PaymentResult>;
|
|
392
|
+
/**
|
|
393
|
+
* Get payment history for current user
|
|
394
|
+
*/
|
|
395
|
+
getPaymentHistory: (options?: PaymentHistoryOptions) => Promise<PaymentHistoryResult>;
|
|
396
|
+
/**
|
|
397
|
+
* Whether a payment is currently in progress
|
|
398
|
+
*/
|
|
399
|
+
isPaymentInProgress: boolean;
|
|
400
|
+
}
|
|
401
|
+
declare function useVolrPay(): UseVolrPayReturn;
|
|
402
|
+
|
|
403
|
+
export { I18nContext, type I18nContextValue, I18nProvider, type I18nProviderProps, type Locale, MpcConnectView, type MpcConnectViewProps, type NetworkWalletConfig, PasskeyEnrollView, type PasskeyEnrollViewProps, type PayOptions, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentItem, type Translations, type UseVolrPayReturn, type VolrTheme, type VolrUIConfig, VolrUIProvider, type VolrUIProviderProps, getCurrentChainId, useI18n, useSwitchNetwork, useTranslation, useVolrModal, useVolrPay, useVolrUI, useVolrUIOptional };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
-
import { KeyStorageType, VolrConfig, PaymentResult, PayOptions } from '@volr/react';
|
|
3
|
-
export { EvmClient, KeyStorageType, SendBatchOverloads, SignerType, VolrClient, VolrConfig, VolrProvider, VolrUser, useDepositListener, usePasskeyEnrollment, useVolr, useVolrLogin } from '@volr/react';
|
|
2
|
+
import { KeyStorageType, VolrConfig, PaymentResult, PayOptions as PayOptions$1, PaymentHistoryOptions, PaymentHistoryResult } from '@volr/react';
|
|
3
|
+
export { EvmClient, KeyStorageType, PaymentHistoryOptions, PaymentHistoryResult, PaymentResult, PaymentStatus, PaymentToken, SendBatchOverloads, SignerType, UseVolrPaymentApiReturn, VolrClient, VolrConfig, VolrProvider, VolrUser, useDepositListener, usePasskeyEnrollment, useVolr, useVolrLogin, useVolrPaymentApi } from '@volr/react';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
interface BrandingConfig {
|
|
@@ -243,7 +243,7 @@ interface ModalAsset {
|
|
|
243
243
|
}
|
|
244
244
|
interface PaymentModalOptions {
|
|
245
245
|
payment: PaymentResult;
|
|
246
|
-
options: PayOptions;
|
|
246
|
+
options: PayOptions$1;
|
|
247
247
|
onComplete?: (result: PaymentResult) => void;
|
|
248
248
|
onProcessing?: (payment: PaymentResult & {
|
|
249
249
|
txHash: string;
|
|
@@ -298,4 +298,106 @@ declare function useSwitchNetwork(): (chainId: number) => Promise<void>;
|
|
|
298
298
|
*/
|
|
299
299
|
declare function getCurrentChainId(): Promise<number>;
|
|
300
300
|
|
|
301
|
-
|
|
301
|
+
/**
|
|
302
|
+
* useVolrPay hook - Payment with UI integration
|
|
303
|
+
*
|
|
304
|
+
* This hook provides payment functionality with PaymentModal integration.
|
|
305
|
+
* For headless API-only access, use useVolrPaymentApi from @volr/react
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Payment item displayed in modal
|
|
310
|
+
*/
|
|
311
|
+
interface PaymentItem {
|
|
312
|
+
/** Item name */
|
|
313
|
+
name: string;
|
|
314
|
+
/** Item description (optional) */
|
|
315
|
+
description?: string;
|
|
316
|
+
/** Item image URL (optional, falls back to project branding logo) */
|
|
317
|
+
image?: string;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Payment error
|
|
321
|
+
*/
|
|
322
|
+
interface PaymentError {
|
|
323
|
+
code: string;
|
|
324
|
+
message: string;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Payment handlers/callbacks
|
|
328
|
+
*/
|
|
329
|
+
interface PaymentHandlers {
|
|
330
|
+
/** Called when payment is created */
|
|
331
|
+
onCreated?: (payment: {
|
|
332
|
+
id: string;
|
|
333
|
+
}) => void;
|
|
334
|
+
/** Called when transaction is broadcasted */
|
|
335
|
+
onProcessing?: (payment: {
|
|
336
|
+
id: string;
|
|
337
|
+
txHash: string;
|
|
338
|
+
}) => void;
|
|
339
|
+
/** Called when payment is confirmed on-chain */
|
|
340
|
+
onSuccess?: (result: PaymentResult) => void;
|
|
341
|
+
/** Called when payment fails */
|
|
342
|
+
onError?: (error: PaymentError) => void;
|
|
343
|
+
/** Called when user cancels */
|
|
344
|
+
onCancel?: () => void;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Options for pay() function
|
|
348
|
+
*/
|
|
349
|
+
interface PayOptions {
|
|
350
|
+
/** Amount in token units (before decimals) */
|
|
351
|
+
amount: number;
|
|
352
|
+
/** Item information to display in modal */
|
|
353
|
+
item?: PaymentItem;
|
|
354
|
+
/** Client-side reference ID */
|
|
355
|
+
referenceId?: string;
|
|
356
|
+
/** Custom metadata (max 50 keys) */
|
|
357
|
+
metadata?: Record<string, string>;
|
|
358
|
+
/** Idempotency key to prevent duplicates */
|
|
359
|
+
idempotencyKey?: string;
|
|
360
|
+
/** Expiration time in seconds (default: 900 = 15 min) */
|
|
361
|
+
expiresInSec?: number;
|
|
362
|
+
/** Callback handlers */
|
|
363
|
+
handlers?: PaymentHandlers;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Payment handle returned from pay()
|
|
367
|
+
*/
|
|
368
|
+
interface PaymentHandle {
|
|
369
|
+
/** Payment ID */
|
|
370
|
+
id: string;
|
|
371
|
+
/** Current payment status */
|
|
372
|
+
status: PaymentResult['status'];
|
|
373
|
+
/** Wait for payment to complete */
|
|
374
|
+
wait: () => Promise<PaymentResult>;
|
|
375
|
+
/** Cancel the payment (only works for PENDING) */
|
|
376
|
+
cancel: () => Promise<void>;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* useVolrPay return type
|
|
380
|
+
*/
|
|
381
|
+
interface UseVolrPayReturn {
|
|
382
|
+
/**
|
|
383
|
+
* Initiate a payment with PaymentModal
|
|
384
|
+
* @param options Payment options including amount, item, handlers
|
|
385
|
+
* @returns PaymentHandle with id, status, wait(), cancel()
|
|
386
|
+
*/
|
|
387
|
+
pay: (options: PayOptions) => Promise<PaymentHandle>;
|
|
388
|
+
/**
|
|
389
|
+
* Check payment status by ID
|
|
390
|
+
*/
|
|
391
|
+
checkPayment: (paymentId: string) => Promise<PaymentResult>;
|
|
392
|
+
/**
|
|
393
|
+
* Get payment history for current user
|
|
394
|
+
*/
|
|
395
|
+
getPaymentHistory: (options?: PaymentHistoryOptions) => Promise<PaymentHistoryResult>;
|
|
396
|
+
/**
|
|
397
|
+
* Whether a payment is currently in progress
|
|
398
|
+
*/
|
|
399
|
+
isPaymentInProgress: boolean;
|
|
400
|
+
}
|
|
401
|
+
declare function useVolrPay(): UseVolrPayReturn;
|
|
402
|
+
|
|
403
|
+
export { I18nContext, type I18nContextValue, I18nProvider, type I18nProviderProps, type Locale, MpcConnectView, type MpcConnectViewProps, type NetworkWalletConfig, PasskeyEnrollView, type PasskeyEnrollViewProps, type PayOptions, type PaymentError, type PaymentHandle, type PaymentHandlers, type PaymentItem, type Translations, type UseVolrPayReturn, type VolrTheme, type VolrUIConfig, VolrUIProvider, type VolrUIProviderProps, getCurrentChainId, useI18n, useSwitchNetwork, useTranslation, useVolrModal, useVolrPay, useVolrUI, useVolrUIOptional };
|