@volr/react-ui 0.1.97 → 0.1.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React$1 from 'react';
2
- import { KeyStorageType, VolrConfig, PaymentResult, PayOptions as PayOptions$1, PaymentHistoryOptions, PaymentHistoryResult } from '@volr/react';
2
+ import { KeyStorageType, VolrConfig, PayOptions as PayOptions$1, PaymentResult, PaymentHistoryOptions, PaymentHistoryResult } from '@volr/react';
3
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
 
@@ -241,17 +241,24 @@ interface ModalAsset {
241
241
  chainId: number;
242
242
  symbol: string;
243
243
  }
244
+ /**
245
+ * Payment modal options - payment is created when user clicks Pay button, not when modal opens
246
+ */
244
247
  interface PaymentModalOptions {
245
- payment: PaymentResult;
248
+ /** Payment options (amount, item, etc.) - NOT a created payment record */
246
249
  options: PayOptions$1;
250
+ /** Called when payment is successfully confirmed */
247
251
  onComplete?: (result: PaymentResult) => void;
252
+ /** Called when transaction is broadcasted */
248
253
  onProcessing?: (payment: PaymentResult & {
249
254
  txHash: string;
250
255
  }) => void;
256
+ /** Called when payment fails */
251
257
  onError?: (error: {
252
258
  code: string;
253
259
  message: string;
254
260
  }) => void;
261
+ /** Called when user cancels (before Pay button click) */
255
262
  onCancel?: () => void;
256
263
  }
257
264
  interface OpenModalOptions {
@@ -327,7 +334,7 @@ interface PaymentError {
327
334
  * Payment handlers/callbacks
328
335
  */
329
336
  interface PaymentHandlers {
330
- /** Called when payment is created */
337
+ /** Called when payment is created (after user clicks Pay) */
331
338
  onCreated?: (payment: {
332
339
  id: string;
333
340
  }) => void;
@@ -366,14 +373,10 @@ interface PayOptions {
366
373
  * Payment handle returned from pay()
367
374
  */
368
375
  interface PaymentHandle {
369
- /** Payment ID */
370
- id: string;
371
- /** Current payment status */
372
- status: PaymentResult['status'];
373
- /** Wait for payment to complete */
376
+ /** Wait for payment to complete (resolves when confirmed, cancelled, or failed) */
374
377
  wait: () => Promise<PaymentResult>;
375
- /** Cancel the payment (only works for PENDING) */
376
- cancel: () => Promise<void>;
378
+ /** Cancel the modal (only works before Pay button is clicked) */
379
+ cancel: () => void;
377
380
  }
378
381
  /**
379
382
  * useVolrPay return type
@@ -381,10 +384,11 @@ interface PaymentHandle {
381
384
  interface UseVolrPayReturn {
382
385
  /**
383
386
  * Initiate a payment with PaymentModal
387
+ * Payment is created in DB only when user clicks Pay button
384
388
  * @param options Payment options including amount, item, handlers
385
- * @returns PaymentHandle with id, status, wait(), cancel()
389
+ * @returns PaymentHandle with wait(), cancel()
386
390
  */
387
- pay: (options: PayOptions) => Promise<PaymentHandle>;
391
+ pay: (options: PayOptions) => PaymentHandle;
388
392
  /**
389
393
  * Check payment status by ID
390
394
  */
@@ -394,7 +398,7 @@ interface UseVolrPayReturn {
394
398
  */
395
399
  getPaymentHistory: (options?: PaymentHistoryOptions) => Promise<PaymentHistoryResult>;
396
400
  /**
397
- * Whether a payment is currently in progress
401
+ * Whether a payment modal is currently open
398
402
  */
399
403
  isPaymentInProgress: boolean;
400
404
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import React$1 from 'react';
2
- import { KeyStorageType, VolrConfig, PaymentResult, PayOptions as PayOptions$1, PaymentHistoryOptions, PaymentHistoryResult } from '@volr/react';
2
+ import { KeyStorageType, VolrConfig, PayOptions as PayOptions$1, PaymentResult, PaymentHistoryOptions, PaymentHistoryResult } from '@volr/react';
3
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
 
@@ -241,17 +241,24 @@ interface ModalAsset {
241
241
  chainId: number;
242
242
  symbol: string;
243
243
  }
244
+ /**
245
+ * Payment modal options - payment is created when user clicks Pay button, not when modal opens
246
+ */
244
247
  interface PaymentModalOptions {
245
- payment: PaymentResult;
248
+ /** Payment options (amount, item, etc.) - NOT a created payment record */
246
249
  options: PayOptions$1;
250
+ /** Called when payment is successfully confirmed */
247
251
  onComplete?: (result: PaymentResult) => void;
252
+ /** Called when transaction is broadcasted */
248
253
  onProcessing?: (payment: PaymentResult & {
249
254
  txHash: string;
250
255
  }) => void;
256
+ /** Called when payment fails */
251
257
  onError?: (error: {
252
258
  code: string;
253
259
  message: string;
254
260
  }) => void;
261
+ /** Called when user cancels (before Pay button click) */
255
262
  onCancel?: () => void;
256
263
  }
257
264
  interface OpenModalOptions {
@@ -327,7 +334,7 @@ interface PaymentError {
327
334
  * Payment handlers/callbacks
328
335
  */
329
336
  interface PaymentHandlers {
330
- /** Called when payment is created */
337
+ /** Called when payment is created (after user clicks Pay) */
331
338
  onCreated?: (payment: {
332
339
  id: string;
333
340
  }) => void;
@@ -366,14 +373,10 @@ interface PayOptions {
366
373
  * Payment handle returned from pay()
367
374
  */
368
375
  interface PaymentHandle {
369
- /** Payment ID */
370
- id: string;
371
- /** Current payment status */
372
- status: PaymentResult['status'];
373
- /** Wait for payment to complete */
376
+ /** Wait for payment to complete (resolves when confirmed, cancelled, or failed) */
374
377
  wait: () => Promise<PaymentResult>;
375
- /** Cancel the payment (only works for PENDING) */
376
- cancel: () => Promise<void>;
378
+ /** Cancel the modal (only works before Pay button is clicked) */
379
+ cancel: () => void;
377
380
  }
378
381
  /**
379
382
  * useVolrPay return type
@@ -381,10 +384,11 @@ interface PaymentHandle {
381
384
  interface UseVolrPayReturn {
382
385
  /**
383
386
  * Initiate a payment with PaymentModal
387
+ * Payment is created in DB only when user clicks Pay button
384
388
  * @param options Payment options including amount, item, handlers
385
- * @returns PaymentHandle with id, status, wait(), cancel()
389
+ * @returns PaymentHandle with wait(), cancel()
386
390
  */
387
- pay: (options: PayOptions) => Promise<PaymentHandle>;
391
+ pay: (options: PayOptions) => PaymentHandle;
388
392
  /**
389
393
  * Check payment status by ID
390
394
  */
@@ -394,7 +398,7 @@ interface UseVolrPayReturn {
394
398
  */
395
399
  getPaymentHistory: (options?: PaymentHistoryOptions) => Promise<PaymentHistoryResult>;
396
400
  /**
397
- * Whether a payment is currently in progress
401
+ * Whether a payment modal is currently open
398
402
  */
399
403
  isPaymentInProgress: boolean;
400
404
  }