@daimo/pay 1.7.2 → 1.7.4

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/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React$1, { ReactNode } from 'react';
1
+ import React$1, { ReactNode, ReactElement } from 'react';
2
2
  export { version } from '../package.json';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { CreateConfigParameters } from '@wagmi/core';
@@ -150,11 +150,6 @@ type DaimoPayEvent = {
150
150
  * chain for payment_completed/payment_bounced.
151
151
  */
152
152
  chainId: number;
153
- /**
154
- * The transaction hash for this event. Hex for all EVM events, Base58 for
155
- * payment_started on Solana.
156
- */
157
- txHash: Hex | string;
158
153
  /**
159
154
  * Payment details.
160
155
  */
@@ -162,12 +157,22 @@ type DaimoPayEvent = {
162
157
  };
163
158
  type DaimoPayStartedEvent = DaimoPayEvent & {
164
159
  type: "payment_started";
160
+ /**
161
+ * The transaction hash sent by the user, if found. (There are rare edge cases
162
+ * where a payment can be paid without a txhash.) Hex for all EVM events,
163
+ * Base58 for payment_started on Solana.
164
+ */
165
+ txHash: Hex | string | null;
165
166
  };
166
167
  type DaimoPayCompletedEvent = DaimoPayEvent & {
167
168
  type: "payment_completed";
169
+ /** The transaction hash completing this payment. */
170
+ txHash: Hex;
168
171
  };
169
172
  type DaimoPayBouncedEvent = DaimoPayEvent & {
170
173
  type: "payment_bounced";
174
+ /** The transaction hash containing the reverted final call and refund. */
175
+ txHash: Hex;
171
176
  };
172
177
  /** Props for DaimoPayButton. */
173
178
  type PayButtonPaymentProps = {
@@ -228,6 +233,10 @@ type PayButtonPaymentProps = {
228
233
  * Developer metadata. E.g. correlation ID.
229
234
  * */
230
235
  metadata?: DaimoPayUserMetadata;
236
+ /**
237
+ * The address to refund to if the payment bounces or a refund is requested.
238
+ */
239
+ refundAddress?: Address;
231
240
  } | {
232
241
  /** The payment ID, generated via the Daimo Pay API. Replaces params above. */
233
242
  payId: string;
@@ -239,6 +248,10 @@ type PayButtonCommonProps = PayButtonPaymentProps & {
239
248
  onPaymentCompleted?: (event: DaimoPayCompletedEvent) => void;
240
249
  /** Called when destination call reverts and funds are refunded */
241
250
  onPaymentBounced?: (event: DaimoPayBouncedEvent) => void;
251
+ /** Called when the modal is opened. */
252
+ onOpen?: () => void;
253
+ /** Called when the modal is closed. */
254
+ onClose?: () => void;
242
255
  /** Automatically close the modal after a successful payment. */
243
256
  closeOnSuccess?: boolean;
244
257
  /** Open the modal by default. */
@@ -263,18 +276,18 @@ type DaimoPayButtonCustomProps = PayButtonCommonProps & {
263
276
  children: (renderProps: {
264
277
  show: () => void;
265
278
  hide: () => void;
266
- }) => React$1.ReactNode;
279
+ }) => ReactElement;
267
280
  };
268
281
  /**
269
282
  * A button that shows the Daimo Pay checkout. Replaces the traditional
270
283
  * Connect Wallet » approve » execute sequence with a single action.
271
284
  */
272
- declare function DaimoPayButton(props: DaimoPayButtonProps): react_jsx_runtime.JSX.Element;
285
+ declare function DaimoPayButton(props: DaimoPayButtonProps): JSX.Element;
273
286
  declare namespace DaimoPayButton {
274
287
  var Custom: typeof DaimoPayButtonCustom;
275
288
  }
276
289
  /** Like DaimoPayButton, but with custom styling. */
277
- declare function DaimoPayButtonCustom(props: DaimoPayButtonCustomProps): React$1.ReactNode;
290
+ declare function DaimoPayButtonCustom(props: DaimoPayButtonCustomProps): JSX.Element;
278
291
  declare namespace DaimoPayButtonCustom {
279
292
  var displayName: string;
280
293
  }
@@ -290,9 +303,10 @@ declare namespace DaimoPayButtonCustom {
290
303
  * to the payment's configured refund address on the destination chain.
291
304
  */
292
305
  declare function useDaimoPayStatus(): {
293
- paymentId: string;
294
- status: DaimoPayIntentStatus;
295
- } | undefined;
306
+ paymentId?: string;
307
+ status?: DaimoPayIntentStatus;
308
+ reset: () => void;
309
+ };
296
310
 
297
311
  /** Icon for an EVM chain, given chain ID. No ID shows a loading spinner. */
298
312
  declare const Chain: React$1.FC<{
@@ -453,6 +467,8 @@ interface PayParams {
453
467
  externalId?: string;
454
468
  /** Developer metadata. E.g. correlation ID. */
455
469
  metadata?: DaimoPayUserMetadata;
470
+ /** The address to refund to if the payment bounces or a refund is requested. */
471
+ refundAddress?: Address;
456
472
  }
457
473
  /** Creates (or loads) a payment and manages the corresponding modal. */
458
474
  interface PaymentState {
@@ -460,12 +476,14 @@ interface PaymentState {
460
476
  setPayParams: (payParams: PayParams | undefined) => void;
461
477
  payParams: PayParams | undefined;
462
478
  generatePreviewOrder: (payParams: PayParams) => void;
479
+ resetOrder: () => void;
463
480
  daimoPayOrder: DaimoPayOrder | undefined;
464
481
  isDepositFlow: boolean;
465
482
  modalOptions: DaimoPayModalOptions;
466
483
  setModalOptions: (modalOptions: DaimoPayModalOptions) => void;
467
484
  paymentWaitingMessage: string | undefined;
468
485
  externalPaymentOptions: ReturnType<typeof useExternalPaymentOptions>;
486
+ showSolanaPaymentMethod: boolean;
469
487
  walletPaymentOptions: ReturnType<typeof useWalletPaymentOptions>;
470
488
  solanaPaymentOptions: ReturnType<typeof useSolanaPaymentOptions>;
471
489
  depositAddressOptions: ReturnType<typeof useDepositAddressOptions>;
@@ -507,6 +525,8 @@ type PayContextValue = {
507
525
  setCustomTheme: React$1.Dispatch<React$1.SetStateAction<CustomTheme | undefined>>;
508
526
  lang: Languages$1;
509
527
  setLang: React$1.Dispatch<React$1.SetStateAction<Languages$1>>;
528
+ setOnOpen: (fn?: () => void) => void;
529
+ setOnClose: (fn?: () => void) => void;
510
530
  open: boolean;
511
531
  setOpen: (open: boolean, meta?: Record<string, any>) => void;
512
532
  route: string;
@@ -544,4 +564,4 @@ type PayContextValue = {
544
564
  } & useConnectCallbackProps;
545
565
 
546
566
  export { Avatar, Chain as ChainIcon, DaimoPayButton, PayContext as DaimoPayContext, DaimoPayProvider, types as Types, daimoPayVersion, defaultConfig as getDefaultConfig, useDaimoPayStatus, usePayContext, wallets };
547
- export type { DaimoPayBouncedEvent, DaimoPayButtonCustomProps, DaimoPayButtonProps, DaimoPayCompletedEvent, DaimoPayEvent, DaimoPayStartedEvent, DaimoPayment };
567
+ export type { All, CustomAvatarProps, CustomTheme, DaimoPayBouncedEvent, DaimoPayButtonCustomProps, DaimoPayButtonProps, DaimoPayCompletedEvent, DaimoPayContextOptions, DaimoPayEvent, DaimoPayModalOptions, DaimoPayStartedEvent, DaimoPayment, Languages, Mode, PaymentOption, Theme };