@tuwaio/nova-payments 0.0.1 → 0.2.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 +11 -6
- package/dist/chunk-4HBN6N7D.cjs +1 -0
- package/dist/chunk-7FQXTBOY.cjs +1 -0
- package/dist/chunk-7HSDAUKN.js +1 -0
- package/dist/chunk-A2WIFZQB.js +1 -0
- package/dist/de-5UOOKHHH.cjs +1 -0
- package/dist/de-U3SERR3Y.js +1 -0
- package/dist/es-J6MJIGEI.js +1 -0
- package/dist/es-WSJ36B6Y.cjs +1 -0
- package/dist/evm/index.cjs +1 -1
- package/dist/evm/index.d.cts +13 -5
- package/dist/evm/index.d.ts +13 -5
- package/dist/evm/index.js +1 -1
- package/dist/i18n/index.cjs +1 -1
- package/dist/i18n/index.d.cts +2 -2
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.css +198 -50
- package/dist/index.d.cts +197 -177
- package/dist/index.d.ts +197 -177
- package/dist/index.js +2 -2
- package/dist/it-KX7WWME3.js +1 -0
- package/dist/it-QORQLELA.cjs +1 -0
- package/dist/{locales-DzMinYsr.d.cts → locales-dTcrLl9B.d.cts} +69 -97
- package/dist/{locales-DzMinYsr.d.ts → locales-dTcrLl9B.d.ts} +69 -97
- package/dist/solana/index.cjs +1 -1
- package/dist/solana/index.js +1 -1
- package/dist/{types-Bp6JUt56.d.cts → types-DkYd2XhD.d.cts} +1 -49
- package/dist/{types-Bp6JUt56.d.ts → types-DkYd2XhD.d.ts} +1 -49
- package/dist/uk-GMKBC44N.js +1 -0
- package/dist/uk-R2A3XIGT.cjs +1 -0
- package/dist/zhCN-5JP4MWXH.cjs +1 -0
- package/dist/zhCN-AX2E4I6A.js +1 -0
- package/package.json +10 -11
- package/dist/chunk-PUMIYLSN.js +0 -1
- package/dist/chunk-S3L4QDPT.cjs +0 -1
- package/dist/chunk-WOAPFVQF.js +0 -1
- package/dist/chunk-XOVRZTAM.cjs +0 -1
- package/dist/de-53SSE6O2.js +0 -1
- package/dist/de-LB5XSRMX.cjs +0 -1
- package/dist/es-LP3HJ4KB.js +0 -1
- package/dist/es-VDW2RZMP.cjs +0 -1
- package/dist/it-6IQFXLAR.cjs +0 -1
- package/dist/it-JJ5Z5EUF.js +0 -1
- package/dist/uk-EI4N5BMM.js +0 -1
- package/dist/uk-FVCYLYSB.cjs +0 -1
- package/dist/zhCN-BZBMKUUA.js +0 -1
- package/dist/zhCN-TA7WU5XS.cjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { P as PaymentsAdapter, a as PaymentFamily, C as CheckoutWallet, N as NativeFee } from './types-
|
|
2
|
-
export { b as PulsarTransactionParams, c as canPayWithQr, d as connectedWallet, f as familyOf, i as isWalletIconUrl, m as methodFamily, e as methodToken, n as networkName, p as payerFor, g as priceAdjustment, w as walletLabel } from './types-
|
|
1
|
+
import { P as PaymentsAdapter, a as PaymentFamily, C as CheckoutWallet, N as NativeFee } from './types-DkYd2XhD.js';
|
|
2
|
+
export { b as PulsarTransactionParams, c as canPayWithQr, d as connectedWallet, f as familyOf, i as isWalletIconUrl, m as methodFamily, e as methodToken, n as networkName, p as payerFor, g as priceAdjustment, w as walletLabel } from './types-DkYd2XhD.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode, ComponentType, ButtonHTMLAttributes, Context } from 'react';
|
|
5
|
-
import { CheckoutMethod, CheckoutView, CheckoutPhase, CheckoutQuote, CheckoutError, CheckoutState, PaymentInstructions, CheckoutApi, EventSourceConstructor, CheckoutStore, RefundPhase, RefundState, RefundStore, PayerProofMessage,
|
|
5
|
+
import { CheckoutMethod, CheckoutView, CheckoutPhase, CheckoutQuote, CheckoutError, CheckoutState, PaymentInstructions, CheckoutApi, EventSourceConstructor, CheckoutStore, RefundPhase, RefundState, RefundStore, PayerProofMessage, CheckoutMerchant } from '@tuwaio/quasar-sdk/checkout';
|
|
6
6
|
import { NovaPaymentsLabels, CheckoutLocale, NovaPaymentsLabelOverrides } from './i18n/index.js';
|
|
7
7
|
import { Transaction } from '@tuwaio/pulsar-core';
|
|
8
8
|
import { StatusTone, StatusEdgeProps } from '@tuwaio/nova-core';
|
|
@@ -12,26 +12,6 @@ import { NovaConnectProviderPropsWithCustomization } from '@tuwaio/nova-connect'
|
|
|
12
12
|
import { SatelliteConnectProviderProps } from '@tuwaio/satellite-react';
|
|
13
13
|
export { shortAddress } from '@tuwaio/orbit-core';
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* The automatic payments offer of a subscription, after a paid period: the limit the seller may take each period, the
|
|
17
|
-
* period, the paying wallet and the seller's wallet the charges are paid to, until when, that Quasar sends each charge
|
|
18
|
-
* for the seller, and how to turn it off. "Allow" takes the wallet through what it needs: to the network of the
|
|
19
|
-
* permission, from a plain account to its smart account (see `smartAccountStatus`: the offer says so first, and MetaMask
|
|
20
|
-
* asks only then), then the ERC-7715 permission, which Quasar takes (the paid outcome then says automatic payments are
|
|
21
|
-
* on); "Not now" keeps paying each invoice. Without a wallet the main button connects one.
|
|
22
|
-
*
|
|
23
|
-
* Each press is a try with a number: Cancel closes the window, and an answer the wallet gives later changes nothing on
|
|
24
|
-
* the page, except that a permission it grants still reaches Quasar. A request still open in the wallet is not asked
|
|
25
|
-
* again, so the buyer never approves two; what the wallet already granted is not asked again after a refusal of the free
|
|
26
|
-
* confirmation.
|
|
27
|
-
*
|
|
28
|
-
* Side effects: wallet prompts and, for a plain account, a transaction whose fee the buyer pays; `POST permission` of
|
|
29
|
-
* the checkout; network and wallet reads for the kind of account.
|
|
30
|
-
*
|
|
31
|
-
* @returns The automatic payments step.
|
|
32
|
-
*/
|
|
33
|
-
declare function AutoPayScreen(): react.JSX.Element | null;
|
|
34
|
-
|
|
35
15
|
/**
|
|
36
16
|
* The buyer details step, shown when the merchant's settings ask for the buyer and the invoice was issued without
|
|
37
17
|
* them: the email, then a company invoice on request (a card under the email), then the details — the name, the
|
|
@@ -49,18 +29,15 @@ declare function BuyerScreen(): react.JSX.Element | null;
|
|
|
49
29
|
|
|
50
30
|
/**
|
|
51
31
|
* A screen of the checkout: the steps of a payment (`buyer`, `method`, `confirmWallet` — the paying wallet confirms the
|
|
52
|
-
* invoice with a free signature before the price —, `pay` or `qr`, `confirm
|
|
53
|
-
* confirm (`unconfirmed`: it may still arrive, so the buyer checks the wallet before paying again)
|
|
32
|
+
* invoice with a free signature before the price —, `pay` or `qr`, `confirm`), a payment Quasar could not
|
|
33
|
+
* confirm (`unconfirmed`: it may still arrive, so the buyer checks the wallet before paying again), a payment that
|
|
34
|
+
* failed for good while the invoice still takes one (`failed`: the buyer may pay again) or its outcome.
|
|
54
35
|
*/
|
|
55
|
-
type CheckoutScreen = 'loading' | 'error' | 'buyer' | 'method' | 'confirmWallet' | 'pay' | 'qr' | 'confirm' | 'unconfirmed' | '
|
|
36
|
+
type CheckoutScreen = 'loading' | 'error' | 'buyer' | 'method' | 'confirmWallet' | 'pay' | 'qr' | 'confirm' | 'unconfirmed' | 'failed' | 'paid' | 'underpaid' | 'held' | 'refunded' | 'expired' | 'cancelled' | 'replaced' | 'blocked';
|
|
56
37
|
/** Choices of the buyer that the checkout store does not hold. */
|
|
57
38
|
interface CheckoutScreenChoices {
|
|
58
39
|
/** Pay from a wallet in this browser (default) or scan a QR code with a phone. */
|
|
59
40
|
payWith?: 'wallet' | 'qr';
|
|
60
|
-
/** The buyer opened the automatic payments offer after paying the first period of a subscription. */
|
|
61
|
-
autoPay?: boolean;
|
|
62
|
-
/** The buyer opened the screen that turns automatic payments off, while they are on. */
|
|
63
|
-
autoPayOff?: boolean;
|
|
64
41
|
/**
|
|
65
42
|
* The buyer continues on a phone: with `payWith` `qr`, the QR code of the payment page shows before any price is
|
|
66
43
|
* locked (an EVM method, paid from the phone's wallet on that page).
|
|
@@ -77,15 +54,12 @@ interface CheckoutScreenChoices {
|
|
|
77
54
|
* after it.
|
|
78
55
|
*/
|
|
79
56
|
confirmWallet?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* A payment this page followed has just failed for good, and the buyer has not gone on yet: the `failed` step shows
|
|
59
|
+
* what became of it, in place of the step the store went back to, until the buyer chooses to pay again.
|
|
60
|
+
*/
|
|
61
|
+
afterFailure?: boolean;
|
|
80
62
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Whether the permission screen can open from this phase: another wallet takes over a permission from the steps before a
|
|
83
|
-
* payment, not from an outcome that keeps its own screen.
|
|
84
|
-
*
|
|
85
|
-
* @param phase - The phase of the checkout store.
|
|
86
|
-
* @returns Whether "Use this wallet" leads somewhere.
|
|
87
|
-
*/
|
|
88
|
-
declare const takeOverOpens: (phase: string | undefined) => boolean;
|
|
89
63
|
/**
|
|
90
64
|
* The screen for the state of a checkout store.
|
|
91
65
|
*
|
|
@@ -103,7 +77,7 @@ declare const takeOverOpens: (phase: string | undefined) => boolean;
|
|
|
103
77
|
* confirm the invoice or confirms it, and after it until the price is locked (unless it was refused), also on an
|
|
104
78
|
* underpaid invoice whose rest another wallet pays, `qr` instead of `pay` when the buyer pays
|
|
105
79
|
* with a QR code (or the price was locked without a payer), `replaced` for an invoice the seller
|
|
106
|
-
* corrected, `
|
|
80
|
+
* corrected, `loading` until
|
|
107
81
|
* the labels of the invoice's language are loaded, `unconfirmed` in the phase of that name of a current
|
|
108
82
|
* `@tuwaio/quasar-sdk` (Quasar could not confirm the payment, which may still arrive). While the store hands a transaction
|
|
109
83
|
* over again (`submit_retrying`) it is `confirm`: only Quasar is out of reach, and the payment goes on.
|
|
@@ -117,8 +91,8 @@ declare function checkoutScreen(state: {
|
|
|
117
91
|
}, choices?: CheckoutScreenChoices): CheckoutScreen;
|
|
118
92
|
/** A step of the stepper in the checkout header. */
|
|
119
93
|
interface CheckoutStep {
|
|
120
|
-
/** `details` (buyer details), `method`, `pay`, `confirm
|
|
121
|
-
key: 'details' | 'method' | 'pay' | 'confirm'
|
|
94
|
+
/** `details` (buyer details), `method`, `pay`, `confirm`. */
|
|
95
|
+
key: 'details' | 'method' | 'pay' | 'confirm';
|
|
122
96
|
/** Before, at or after the current step. */
|
|
123
97
|
state: 'done' | 'current' | 'upcoming';
|
|
124
98
|
}
|
|
@@ -134,8 +108,8 @@ declare function checkoutSteps(screen: CheckoutScreen, options?: {
|
|
|
134
108
|
withDetails?: boolean;
|
|
135
109
|
}): CheckoutStep[] | null;
|
|
136
110
|
/**
|
|
137
|
-
* The steps of the stepper on the paid screen
|
|
138
|
-
*
|
|
111
|
+
* The steps of the stepper on the paid screen, all done: the row stays as the payment confirms ({@link checkoutSteps}
|
|
112
|
+
* gives none for an outcome).
|
|
139
113
|
*
|
|
140
114
|
* @param options - Steps that apply to this invoice.
|
|
141
115
|
* @param options.withDetails - The checkout asked for the buyer details first.
|
|
@@ -179,8 +153,8 @@ declare function groupMethodsByToken(methods: CheckoutMethod[], walletChainId?:
|
|
|
179
153
|
* @returns `paying` while the buyer can still pay (the countdown shows and screen readers hear the minutes left),
|
|
180
154
|
* `confirming` while the payment is on its way (the countdown shows; at zero the confirm step says that the payment
|
|
181
155
|
* sent in time is being confirmed) and while Quasar could not confirm it (`unconfirmed`: the buyer checks the wallet
|
|
182
|
-
* before paying again, so no minutes left to pay are announced), or `null` once the payment succeeded (`paid
|
|
183
|
-
*
|
|
156
|
+
* before paying again, so no minutes left to pay are announced), or `null` once the payment succeeded (`paid`), on the
|
|
157
|
+
* outcomes in
|
|
184
158
|
* which a deadline means nothing (`held`, `refunded`, `expired`, `cancelled`, `replaced`) and for an invoice that can
|
|
185
159
|
* no longer be paid. `closed` while part of an underpaid invoice arrived and its rest cannot be paid: the countdown still
|
|
186
160
|
* shows, as the time after which the seller can refund, and no minutes left to pay are announced.
|
|
@@ -201,18 +175,15 @@ declare function deadlineAnnouncement(previousMs: number | null, ms: number, ann
|
|
|
201
175
|
/** How long before a locked price ends the checkout offers to keep it (WCAG 2.2.1: 20 seconds at least). */
|
|
202
176
|
declare const QUOTE_WARNING_MS = 60000;
|
|
203
177
|
/**
|
|
204
|
-
* What the active wallet changing does to a locked price.
|
|
205
|
-
* nothing, so it changes nothing while that screen is open; back on the payment, what follows applies.
|
|
178
|
+
* What the active wallet changing does to a locked price.
|
|
206
179
|
*
|
|
207
180
|
* @param params - What the change happens over.
|
|
208
|
-
* @param params.autoPayOffOpen - The screen that turns automatic payments off is open.
|
|
209
181
|
* @param params.phase - The phase of the payment; a price is locked only in `awaitingPayment`.
|
|
210
182
|
* @param params.quotePayer - The payer the price is locked for.
|
|
211
183
|
* @param params.payer - The payer the active wallet gives for the method of that price, or `null`.
|
|
212
184
|
* @returns `keep`: nothing changes; `lock`: lock the price again for `payer`; `release`: release it, back to the methods.
|
|
213
185
|
*/
|
|
214
186
|
declare function lockedPriceOnWallet(params: {
|
|
215
|
-
autoPayOffOpen: boolean;
|
|
216
187
|
phase: string;
|
|
217
188
|
quotePayer: string | null | undefined;
|
|
218
189
|
payer: string | null;
|
|
@@ -402,13 +373,34 @@ declare function unconfirmedFollowUp(error: CheckoutError | null | undefined): U
|
|
|
402
373
|
declare function unconfirmedTxKey(state: Pick<CheckoutState, 'txKey' | 'txHash'> & {
|
|
403
374
|
error?: object | null;
|
|
404
375
|
}, checkout: CheckoutView | null): string | null;
|
|
376
|
+
/**
|
|
377
|
+
* The language a checkout shows. The buyer's pick in the language menu comes first, as long as the page around the
|
|
378
|
+
* checkout still has the language it had then: a page that changes its language is followed again. Then the language of
|
|
379
|
+
* that page (`locale` of `PaymentCheckout`), then the language of the invoice, then English.
|
|
380
|
+
*
|
|
381
|
+
* @param params - What is known.
|
|
382
|
+
* @param params.picked - The language the buyer picked in the menu during this visit, with the language the page had
|
|
383
|
+
* then; `null` before a pick.
|
|
384
|
+
* @param params.page - The language of the page around the checkout, as a language of the checkout; `null` when the
|
|
385
|
+
* app gave none or the checkout does not have it.
|
|
386
|
+
* @param params.invoice - The language of the invoice; `null` before the invoice is read.
|
|
387
|
+
* @returns The language, a BCP 47 tag.
|
|
388
|
+
*/
|
|
389
|
+
declare function shownLocale({ picked, page, invoice, }: {
|
|
390
|
+
picked: {
|
|
391
|
+
locale: string;
|
|
392
|
+
page: string | null;
|
|
393
|
+
} | null;
|
|
394
|
+
page: string | null;
|
|
395
|
+
invoice: string | null | undefined;
|
|
396
|
+
}): string;
|
|
405
397
|
|
|
406
398
|
/**
|
|
407
|
-
* @file Handing a payment
|
|
408
|
-
*
|
|
399
|
+
* @file Handing a payment of a checkout over to the app's Pulsar store: Pulsar tracks it and keeps it in the history,
|
|
400
|
+
* and Nova Transactions shows its toast.
|
|
409
401
|
*/
|
|
410
402
|
|
|
411
|
-
/** A payment the
|
|
403
|
+
/** A payment of the checkout: one the wallet sent, or one Quasar found and recorded. */
|
|
412
404
|
interface SentPayment {
|
|
413
405
|
/** The transaction hash (EVM) or signature (Solana). */
|
|
414
406
|
txKey: string;
|
|
@@ -432,20 +424,6 @@ interface PaymentsPulsar {
|
|
|
432
424
|
*/
|
|
433
425
|
injectExternalPendingTxs(transactions: Transaction[]): Promise<void>;
|
|
434
426
|
}
|
|
435
|
-
/**
|
|
436
|
-
* Whether a sent payment still needs tracking when the checkout closes: Quasar has not settled it, and it did not
|
|
437
|
-
* fail on-chain or turn out not to pay the invoice.
|
|
438
|
-
*
|
|
439
|
-
* @param state - The `phase` and `error` of the checkout store.
|
|
440
|
-
* @param state.phase - Where the payment stands.
|
|
441
|
-
* @param state.error - The last failure; `payment_failed` means the transaction failed on-chain, `payment_mismatch`
|
|
442
|
-
* that it succeeded without paying the invoice: Quasar already has the final word on both.
|
|
443
|
-
* @returns `true` to hand it over.
|
|
444
|
-
*/
|
|
445
|
-
declare function shouldHandOver(state: {
|
|
446
|
-
phase: CheckoutPhase;
|
|
447
|
-
error: CheckoutError | null;
|
|
448
|
-
}): boolean;
|
|
449
427
|
/** What {@link handOverPayment} needs. */
|
|
450
428
|
interface HandOverParams {
|
|
451
429
|
/** The adapter of the payment's chain family. */
|
|
@@ -529,6 +507,8 @@ declare function CheckoutStepper({ steps, labels, className, stepClassName }: Ch
|
|
|
529
507
|
|
|
530
508
|
/** The outcomes this screen shows. */
|
|
531
509
|
type OutcomeKind = Extract<CheckoutScreen, 'unconfirmed' | 'underpaid' | 'held' | 'refunded' | 'expired' | 'cancelled' | 'replaced' | 'blocked'>;
|
|
510
|
+
/** "Contact <seller>": the seller's support email about the invoice, its site, or the app's handler. @internal */
|
|
511
|
+
declare function ContactLink(): react.JSX.Element | null;
|
|
532
512
|
/**
|
|
533
513
|
* An outcome other than paid: a payment Quasar could not confirm (`unconfirmed`: it may still arrive, so the buyer
|
|
534
514
|
* checks the wallet before paying again; only while Quasar still reads it again, `error.rechecked` of the checkout
|
|
@@ -635,7 +615,7 @@ interface PaymentCheckoutClassNames {
|
|
|
635
615
|
*/
|
|
636
616
|
body?: (params: CheckoutPartState) => string | undefined;
|
|
637
617
|
/**
|
|
638
|
-
* The content of a step screen (buyer details, method, QR code
|
|
618
|
+
* The content of a step screen (buyer details, method, QR code), with its heading.
|
|
639
619
|
*
|
|
640
620
|
* @param params - The state of the checkout.
|
|
641
621
|
* @returns Classes to add.
|
|
@@ -719,7 +699,7 @@ interface PaymentCheckoutClassNames {
|
|
|
719
699
|
required: boolean;
|
|
720
700
|
}) => string | undefined;
|
|
721
701
|
/**
|
|
722
|
-
* A card of grouped facts (the transaction, the rate and fees
|
|
702
|
+
* A card of grouped facts (the transaction, the rate and fees).
|
|
723
703
|
*
|
|
724
704
|
* @param params - The state of the checkout.
|
|
725
705
|
* @returns Classes to add.
|
|
@@ -756,6 +736,16 @@ interface PaymentCheckoutClassNames {
|
|
|
756
736
|
statusIcon?: (params: CheckoutPartState & {
|
|
757
737
|
kind: OutcomeKind;
|
|
758
738
|
}) => string | undefined;
|
|
739
|
+
/**
|
|
740
|
+
* The chip over the heading of a status screen (Pending, Paid, Failed and the other outcomes).
|
|
741
|
+
*
|
|
742
|
+
* @param params - The state of the checkout, and `tone`, the state the chip shows.
|
|
743
|
+
* @param params.tone - `pending`, `success`, `error` or `neutral`.
|
|
744
|
+
* @returns Classes to add.
|
|
745
|
+
*/
|
|
746
|
+
statusChip?: (params: CheckoutPartState & {
|
|
747
|
+
tone: 'pending' | 'success' | 'error' | 'neutral';
|
|
748
|
+
}) => string | undefined;
|
|
759
749
|
/**
|
|
760
750
|
* The strip and the wash of the status color along the top of the checkout, on a payment on its way and its outcome.
|
|
761
751
|
*
|
|
@@ -896,6 +886,19 @@ interface PaymentCheckoutHandlers {
|
|
|
896
886
|
locale: CheckoutLocale;
|
|
897
887
|
proceed: () => Promise<void>;
|
|
898
888
|
}) => void | Promise<void>;
|
|
889
|
+
/**
|
|
890
|
+
* The language the checkout is shown in: called once it is known (the invoice is read, or the app gave the language of
|
|
891
|
+
* its page with `locale`) and on every change, whoever made it: the buyer in the menu, the page with a new `locale`,
|
|
892
|
+
* or the invoice. For a page that keeps `<html lang>`, the labels of Nova or its own texts on the language of the
|
|
893
|
+
* checkout.
|
|
894
|
+
*
|
|
895
|
+
* @param params - The language.
|
|
896
|
+
* @param params.locale - The language shown, a BCP 47 tag: one of the checkout's, or the language of an invoice the
|
|
897
|
+
* checkout has no labels for (it shows English then).
|
|
898
|
+
*/
|
|
899
|
+
onLocaleShown?: (params: {
|
|
900
|
+
locale: string;
|
|
901
|
+
}) => void;
|
|
899
902
|
/**
|
|
900
903
|
* The phase of the checkout or the status of the invoice changed; also called once with the first ones.
|
|
901
904
|
*
|
|
@@ -1058,6 +1061,13 @@ interface PaymentCheckoutProps {
|
|
|
1058
1061
|
autoReturnSeconds?: number;
|
|
1059
1062
|
/** Replaces the link of "Contact <seller>" (the seller's support email, else site) with the app's own handler. */
|
|
1060
1063
|
onContact?: () => void;
|
|
1064
|
+
/**
|
|
1065
|
+
* The language of the page around the checkout, a BCP 47 tag (for example the `lang` of `<html>`). The checkout opens
|
|
1066
|
+
* in it instead of the language of the invoice; a language the checkout does not have is left to the invoice. The
|
|
1067
|
+
* language the buyer picks in the menu wins until this value changes. It changes what the buyer reads, not the
|
|
1068
|
+
* invoice: the documents keep the language of the invoice unless the buyer picks one in the menu.
|
|
1069
|
+
*/
|
|
1070
|
+
locale?: string;
|
|
1061
1071
|
/** Classes added to the checkout block. */
|
|
1062
1072
|
className?: string;
|
|
1063
1073
|
/**
|
|
@@ -1113,7 +1123,7 @@ declare function CheckoutFrame({ className, withDetails, leave, }: {
|
|
|
1113
1123
|
* }
|
|
1114
1124
|
* ```
|
|
1115
1125
|
*/
|
|
1116
|
-
declare function PaymentCheckout({ token, display, open, onOpenChange, onClose, baseUrl, api, EventSource, pollMs, payUrl, onConnectWallet, onPaid, autoReturnSeconds, onContact, className, customization, }: PaymentCheckoutProps): react.JSX.Element;
|
|
1126
|
+
declare function PaymentCheckout({ token, display, open, onOpenChange, onClose, baseUrl, api, EventSource, pollMs, payUrl, onConnectWallet, onPaid, autoReturnSeconds, onContact, locale: pageLanguage, className, customization, }: PaymentCheckoutProps): react.JSX.Element;
|
|
1117
1127
|
/**
|
|
1118
1128
|
* The checkout as a whole page: the block, centered from a floor (`styles/app.css`) and not from its own height, so that
|
|
1119
1129
|
* no step can move its top.
|
|
@@ -1140,6 +1150,14 @@ interface CheckoutContextValue {
|
|
|
1140
1150
|
locale: string;
|
|
1141
1151
|
/** The labels of that language. */
|
|
1142
1152
|
labels: NovaPaymentsLabels;
|
|
1153
|
+
/**
|
|
1154
|
+
* Switches the checkout to the language the buyer picked in the menu and saves it on the invoice, for the documents
|
|
1155
|
+
* still to be issued (`setLocale` of the checkout store). The pick stays the language shown, also over the language of
|
|
1156
|
+
* the page (`locale` of `PaymentCheckout`), until that page changes its language; a pick Quasar did not save is undone.
|
|
1157
|
+
*
|
|
1158
|
+
* @param locale - The language picked.
|
|
1159
|
+
*/
|
|
1160
|
+
setLocale: (locale: CheckoutLocale) => Promise<void>;
|
|
1143
1161
|
/** `Date.now()` of the latest second tick. */
|
|
1144
1162
|
now: number;
|
|
1145
1163
|
/**
|
|
@@ -1201,6 +1219,11 @@ interface CheckoutContextValue {
|
|
|
1201
1219
|
setHandoff: (handoff: boolean) => void;
|
|
1202
1220
|
/** Goes back to the method step: forgets the locked price and the phone hand-off. */
|
|
1203
1221
|
backToMethods: () => void;
|
|
1222
|
+
/**
|
|
1223
|
+
* Leaves the failed step for the step that pays again (the locked price while it holds, else the methods), and drops
|
|
1224
|
+
* the failure it showed: the buyer has read it.
|
|
1225
|
+
*/
|
|
1226
|
+
payAfterFailure: () => void;
|
|
1204
1227
|
/**
|
|
1205
1228
|
* Whether the buyer continued with a wallet that must confirm the invoice before the price: the step that confirms
|
|
1206
1229
|
* it shows while the checkout store waits for the signature (`ConfirmWalletScreen`).
|
|
@@ -1220,36 +1243,12 @@ interface CheckoutContextValue {
|
|
|
1220
1243
|
*/
|
|
1221
1244
|
lockPrice: () => Promise<void>;
|
|
1222
1245
|
/**
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1246
|
+
* Takes the payment the wallet sent: the checkout follows it, and hands it over to the app's Pulsar store at once,
|
|
1247
|
+
* where Nova Transactions shows its toast.
|
|
1225
1248
|
*
|
|
1226
1249
|
* @param payment - The transaction and what it pays.
|
|
1227
1250
|
*/
|
|
1228
1251
|
onPaymentSent: (payment: SentPayment) => void;
|
|
1229
|
-
/** The buyer opened the automatic payments offer after paying a subscription period. */
|
|
1230
|
-
autoPay: boolean;
|
|
1231
|
-
/**
|
|
1232
|
-
* Opens or closes the automatic payments offer.
|
|
1233
|
-
*
|
|
1234
|
-
* @param autoPay - Whether it shows.
|
|
1235
|
-
*/
|
|
1236
|
-
setAutoPay: (autoPay: boolean) => void;
|
|
1237
|
-
/** The screen that turns automatic payments off is open (`open`), or they were turned off (`done`). */
|
|
1238
|
-
autoPayOff: 'open' | 'done' | null;
|
|
1239
|
-
/**
|
|
1240
|
-
* Opens or closes the screen that turns automatic payments off, or says they were turned off.
|
|
1241
|
-
*
|
|
1242
|
-
* @param autoPayOff - The new state.
|
|
1243
|
-
*/
|
|
1244
|
-
setAutoPayOff: (autoPayOff: 'open' | 'done' | null) => void;
|
|
1245
|
-
/** Whether the wallet has sent the transaction that revokes the permission of this invoice's subscription. */
|
|
1246
|
-
revokeSent: boolean;
|
|
1247
|
-
/**
|
|
1248
|
-
* Keeps that for as long as the page shows the invoice, so the buyer leaving the screen does not send it twice.
|
|
1249
|
-
*
|
|
1250
|
-
* @param sent - Whether it was sent.
|
|
1251
|
-
*/
|
|
1252
|
-
setRevokeSent: (sent: boolean) => void;
|
|
1253
1252
|
/**
|
|
1254
1253
|
* Opens another invoice in this checkout: the one that replaced a corrected invoice.
|
|
1255
1254
|
*
|
|
@@ -1322,9 +1321,10 @@ declare function CompactSummary({ className }?: {
|
|
|
1322
1321
|
}): react.JSX.Element | null;
|
|
1323
1322
|
|
|
1324
1323
|
/**
|
|
1325
|
-
* The confirm step: the transaction is on its way and Quasar follows it until it is final.
|
|
1326
|
-
*
|
|
1327
|
-
*
|
|
1324
|
+
* The confirm step: the transaction is on its way and Quasar follows it until it is final. Its head is the one of every
|
|
1325
|
+
* status screen (the Quasar loader, the chip "Pending", the heading and the amount, which the paid and the failed step
|
|
1326
|
+
* go on from), with the progress of Nova Transactions (Sent → Confirming → Paid, in the language of the checkout), the
|
|
1327
|
+
* network, the transaction with its explorer link and the sender. The buyer may close the window: the payment keeps
|
|
1328
1328
|
* going. It also shows a payment of the invoice that this page did not hand over while Quasar reports it on its way
|
|
1329
1329
|
* (the page was reopened or reloaded, another tab paid, Quasar found a Solana Pay transfer), instead of offering to pay
|
|
1330
1330
|
* again: its note asks the buyer to wait for it. When the invoice deadline passes while a payment is on its way (the
|
|
@@ -1361,6 +1361,18 @@ declare function ConfirmScreen(): react.JSX.Element;
|
|
|
1361
1361
|
*/
|
|
1362
1362
|
declare function ConfirmWalletScreen(): react.JSX.Element | null;
|
|
1363
1363
|
|
|
1364
|
+
/**
|
|
1365
|
+
* The failed step: a payment this page showed on its way failed for good (the network reverted it, the wallet
|
|
1366
|
+
* cancelled it, a Solana transaction expired), and the invoice still takes a payment. It stays where the confirm step
|
|
1367
|
+
* was, with the same head, so the buyer sees what became of the payment they were watching: the mark and the chip turn
|
|
1368
|
+
* to a failure, the last step says "Failed", and under the network, the transaction with its explorer link and the
|
|
1369
|
+
* sender stands why, in the words of the reason. "Pay again" goes on to the step the checkout store went back to (the
|
|
1370
|
+
* locked price while it holds, else the methods); "Contact" reaches the seller.
|
|
1371
|
+
*
|
|
1372
|
+
* @returns The failed step, or nothing without the failure of a payment.
|
|
1373
|
+
*/
|
|
1374
|
+
declare function FailedScreen(): react.JSX.Element | null;
|
|
1375
|
+
|
|
1364
1376
|
/**
|
|
1365
1377
|
* The question when the buyer closes the checkout before anything is sent: the invoice stays open until its deadline,
|
|
1366
1378
|
* reopened from the email or the seller's site, and the locked price is released. It is a Nova dialog of its own, over
|
|
@@ -1424,10 +1436,10 @@ declare function LocaleSwitcher({ locale, labels, receiptIssued, onSelect, class
|
|
|
1424
1436
|
declare function MethodScreen(): react.JSX.Element | null;
|
|
1425
1437
|
|
|
1426
1438
|
/**
|
|
1427
|
-
* The paid outcome: the amount, network, time and transaction
|
|
1428
|
-
*
|
|
1429
|
-
* visible countdown and "Stay here" (WCAG 2.2.1). In a modal it offers Close
|
|
1430
|
-
* seller's, and loading it again would close everything at once.
|
|
1439
|
+
* The paid outcome: the amount, network, time and transaction (every transfer of an invoice paid in parts, each with
|
|
1440
|
+
* its time, amount and explorer link), the steps done, a refund made later, the receipt to download, and the way back
|
|
1441
|
+
* to the seller (`successUrl`) with a visible countdown and "Stay here" (WCAG 2.2.1). In a modal it offers Close
|
|
1442
|
+
* instead: the page under it is the seller's, and loading it again would close everything at once.
|
|
1431
1443
|
*
|
|
1432
1444
|
* Side effects: navigates to the seller's `successUrl` when the countdown ends.
|
|
1433
1445
|
*
|
|
@@ -1730,10 +1742,10 @@ declare function ConfirmStep({ flow, labels, locale, values, details, recordActi
|
|
|
1730
1742
|
}): react.JSX.Element;
|
|
1731
1743
|
|
|
1732
1744
|
/**
|
|
1733
|
-
* What the wallet asks for: a gasless signature, a transaction, a network switch, the
|
|
1734
|
-
*
|
|
1745
|
+
* What the wallet asks for: a gasless signature, a transaction, a network switch, the signature that confirms the
|
|
1746
|
+
* paying wallet (`proof`), or Quasar takes the payment.
|
|
1735
1747
|
*/
|
|
1736
|
-
type WalletPromptKind = 'sign' | 'confirm' | 'switch' | '
|
|
1748
|
+
type WalletPromptKind = 'sign' | 'confirm' | 'switch' | 'proof' | 'submitting';
|
|
1737
1749
|
/** Props of {@link WalletPrompt}. */
|
|
1738
1750
|
interface WalletPromptProps {
|
|
1739
1751
|
/** What the wallet asks for. */
|
|
@@ -1840,19 +1852,22 @@ interface UseCheckoutEventsParams {
|
|
|
1840
1852
|
screen: CheckoutScreen;
|
|
1841
1853
|
/** `Date.now()` of the latest second tick of the checkout. */
|
|
1842
1854
|
now: number;
|
|
1855
|
+
/** The language the checkout shows; `null` while it is not known yet (the invoice is not read, the app gave none). */
|
|
1856
|
+
locale?: string | null;
|
|
1843
1857
|
/** The handlers of `customization.handlers` of `PaymentCheckout`. */
|
|
1844
1858
|
handlers?: PaymentCheckoutHandlers;
|
|
1845
1859
|
}
|
|
1846
1860
|
/**
|
|
1847
1861
|
* Tells the app what happened in a checkout through its handlers: `onStatusChange` with the first phase and invoice
|
|
1848
|
-
* status and on every change, `
|
|
1862
|
+
* status and on every change, `onLocaleShown` with the language shown once it is known and on every change, `onError`
|
|
1863
|
+
* once per new error, and `onExpire` when the locked price runs out (at the
|
|
1849
1864
|
* tick that crosses its end) and when the invoice expires, with whether a payment is on its way (one this page handed
|
|
1850
1865
|
* over, one of the invoice Quasar reports, as on a reopened page, or one Quasar could not confirm yet and reads again).
|
|
1851
1866
|
* Handlers that change between renders are called in their latest version.
|
|
1852
1867
|
*
|
|
1853
1868
|
* @param params - See {@link UseCheckoutEventsParams}.
|
|
1854
1869
|
*/
|
|
1855
|
-
declare function useCheckoutEvents({ state, screen, now, handlers }: UseCheckoutEventsParams): void;
|
|
1870
|
+
declare function useCheckoutEvents({ state, screen, now, locale, handlers }: UseCheckoutEventsParams): void;
|
|
1856
1871
|
|
|
1857
1872
|
/** What {@link useCheckoutStore} takes. */
|
|
1858
1873
|
interface UseCheckoutStoreOptions {
|
|
@@ -1991,9 +2006,10 @@ interface NovaPaymentsProviderProps {
|
|
|
1991
2006
|
*/
|
|
1992
2007
|
adapters?: PaymentsAdapter[];
|
|
1993
2008
|
/**
|
|
1994
|
-
* The app's Pulsar store (`injectExternalPendingTxs` of `createPulsarStore` from `@tuwaio/pulsar-core`).
|
|
1995
|
-
* checkout
|
|
1996
|
-
*
|
|
2009
|
+
* The app's Pulsar store (`injectExternalPendingTxs` of `createPulsarStore` from `@tuwaio/pulsar-core`). Every payment
|
|
2010
|
+
* of a checkout goes to it, which tracks it and keeps it in the history, and Nova Transactions shows its toast: one the
|
|
2011
|
+
* wallet sends at once, one the page did not send (a QR code, a relayed signature) once Quasar records it, with its
|
|
2012
|
+
* hash.
|
|
1997
2013
|
*/
|
|
1998
2014
|
pulsar?: PaymentsPulsar;
|
|
1999
2015
|
/**
|
|
@@ -2168,13 +2184,19 @@ type PaymentWalletErrorKind = 'declined' | 'unsupported' | 'wrongNetwork' | 'swi
|
|
|
2168
2184
|
/** The error a payments adapter throws when it knows why the wallet did not pay. */
|
|
2169
2185
|
declare class PaymentWalletError extends Error {
|
|
2170
2186
|
readonly kind: PaymentWalletErrorKind;
|
|
2187
|
+
/**
|
|
2188
|
+
* `switch` when the refusal or failure is of the network switch the adapter asked for before the request: the
|
|
2189
|
+
* request itself was never shown (a `declined` one is not a refused signature).
|
|
2190
|
+
*/
|
|
2191
|
+
readonly step?: 'switch';
|
|
2171
2192
|
/**
|
|
2172
2193
|
* @param kind - Why: see {@link PaymentWalletErrorKind}.
|
|
2173
2194
|
* @param message - What to log.
|
|
2174
|
-
* @param options - The original error as `cause
|
|
2195
|
+
* @param options - The original error as `cause`, and `step: 'switch'` for a network switch the adapter asked for.
|
|
2175
2196
|
*/
|
|
2176
2197
|
constructor(kind: PaymentWalletErrorKind, message: string, options?: {
|
|
2177
2198
|
cause?: unknown;
|
|
2199
|
+
step?: 'switch';
|
|
2178
2200
|
});
|
|
2179
2201
|
}
|
|
2180
2202
|
/**
|
|
@@ -2460,9 +2482,22 @@ interface Payment {
|
|
|
2460
2482
|
*/
|
|
2461
2483
|
declare function usePayment({ adapter, store, quote, wallet, path, paymasterUrl, invoiceId, onSent, }: UsePaymentParams): Payment;
|
|
2462
2484
|
|
|
2485
|
+
/** A transfer credited to the invoice, as the paid step lists it. */
|
|
2486
|
+
interface PaymentTransfer {
|
|
2487
|
+
/** The transaction: its hash, or its Solana signature. */
|
|
2488
|
+
txKey: string;
|
|
2489
|
+
/** What it credited with its token (`40.00 USDC`); `null` when Quasar names no token for it. */
|
|
2490
|
+
amount: string | null;
|
|
2491
|
+
/** When the network included it, in milliseconds. */
|
|
2492
|
+
at: number;
|
|
2493
|
+
/** Its page in the explorer of its network, from the chain adapter; `undefined` without one. */
|
|
2494
|
+
explorerUrl: string | undefined;
|
|
2495
|
+
}
|
|
2463
2496
|
/**
|
|
2464
2497
|
* What the confirm and paid steps show of the payment: its network and amount (from the locked quote), the
|
|
2465
|
-
* transaction (Quasar's hash, else the submitted key) with its explorer link from the chain adapter,
|
|
2498
|
+
* transaction (Quasar's hash, else the submitted key) with its explorer link from the chain adapter, the sender, and
|
|
2499
|
+
* every transfer Quasar credited to the invoice (`transfers`, oldest first; empty with a Quasar that does not list
|
|
2500
|
+
* them).
|
|
2466
2501
|
*
|
|
2467
2502
|
* @returns The facts; each is `null` (or `undefined` for the link) when unknown.
|
|
2468
2503
|
*/
|
|
@@ -2472,20 +2507,25 @@ declare function usePaymentFacts(): {
|
|
|
2472
2507
|
paidAmount: string | null;
|
|
2473
2508
|
txKey: string | null;
|
|
2474
2509
|
lastOfParts: boolean;
|
|
2510
|
+
transfers: PaymentTransfer[];
|
|
2475
2511
|
explorerUrl: string | undefined;
|
|
2476
2512
|
from: string | null;
|
|
2477
2513
|
fromAddress: string | null;
|
|
2478
2514
|
fromUrl: string | undefined;
|
|
2479
2515
|
};
|
|
2480
2516
|
|
|
2517
|
+
/**
|
|
2518
|
+
* The part of the checkout store {@link usePaymentHandOver} reads: the invoice's state, its payment's hash, the price
|
|
2519
|
+
* and the checkout.
|
|
2520
|
+
*/
|
|
2521
|
+
type PaymentHandOverState = Pick<CheckoutState, 'invoiceStatus' | 'txHash' | 'quote' | 'checkout'>;
|
|
2481
2522
|
/** What {@link usePaymentHandOver} needs. */
|
|
2482
2523
|
interface UsePaymentHandOverParams {
|
|
2483
|
-
/** The checkout store
|
|
2524
|
+
/** The checkout store: read when a payment is handed over, and followed for the payments Quasar finds. */
|
|
2484
2525
|
store: {
|
|
2485
|
-
getState: () =>
|
|
2526
|
+
getState: () => PaymentHandOverState;
|
|
2527
|
+
subscribe: (listener: (state: PaymentHandOverState, previous: PaymentHandOverState) => void) => () => void;
|
|
2486
2528
|
};
|
|
2487
|
-
/** Whether the checkout is open (a modal); an inline checkout stays open while it is shown. */
|
|
2488
|
-
open: boolean;
|
|
2489
2529
|
/**
|
|
2490
2530
|
* The adapter of a chain family.
|
|
2491
2531
|
*
|
|
@@ -2501,17 +2541,20 @@ interface UsePaymentHandOverParams {
|
|
|
2501
2541
|
locale: string;
|
|
2502
2542
|
}
|
|
2503
2543
|
/**
|
|
2504
|
-
*
|
|
2505
|
-
*
|
|
2506
|
-
*
|
|
2507
|
-
*
|
|
2544
|
+
* Hands the invoice's payments to the app's Pulsar store, where Nova Transactions shows their toasts (owner test
|
|
2545
|
+
* 2026-11-09, finding 3: no toast for any crypto payment, as a payment went over only when the checkout closed before
|
|
2546
|
+
* Quasar settled it). A payment the wallet sends goes over at once, the checkout open or not. A payment the page did not
|
|
2547
|
+
* send (a QR code, a relayed signature, another tab) goes over once Quasar records it, with its hash and the wallet that
|
|
2548
|
+
* paid: only while the page watched the invoice take it, never for an invoice paid before the page opened it, and not
|
|
2549
|
+
* when this page sent a payment of its own (a new hash is a speed-up, which Pulsar's tracker of that payment follows).
|
|
2550
|
+
* Each payment goes over once.
|
|
2508
2551
|
*
|
|
2509
2552
|
* Side effects: on hand-over, a pending transaction in the Pulsar store and its tracker.
|
|
2510
2553
|
*
|
|
2511
2554
|
* @param params - See {@link UsePaymentHandOverParams}.
|
|
2512
2555
|
* @returns The function to call with the payment the wallet sent.
|
|
2513
2556
|
*/
|
|
2514
|
-
declare function usePaymentHandOver({ store,
|
|
2557
|
+
declare function usePaymentHandOver({ store, adapterFor, pulsar, labels, locale, }: UsePaymentHandOverParams): (payment: SentPayment) => void;
|
|
2515
2558
|
|
|
2516
2559
|
/**
|
|
2517
2560
|
* Whose wallet connection the checkouts and refunds use: the choice of the nearest {@link NovaPaymentsProvider}
|
|
@@ -2682,8 +2725,8 @@ declare function baseUnitsToDecimal(baseUnits: string, decimals: number): string
|
|
|
2682
2725
|
declare function formatCountdown(ms: number): string;
|
|
2683
2726
|
|
|
2684
2727
|
/**
|
|
2685
|
-
* @file What the outcome steps show: how to reach the seller, when to ask before leaving, what a refusal means,
|
|
2686
|
-
*
|
|
2728
|
+
* @file What the outcome steps show: how to reach the seller, when to ask before leaving, what a refusal means, what an
|
|
2729
|
+
* underpaid invoice still needs, and what arrived on an invoice.
|
|
2687
2730
|
*/
|
|
2688
2731
|
|
|
2689
2732
|
/**
|
|
@@ -2696,13 +2739,36 @@ declare function formatCountdown(ms: number): string;
|
|
|
2696
2739
|
* @returns The link, or `null` when the seller gave neither.
|
|
2697
2740
|
*/
|
|
2698
2741
|
declare function contactHref(merchant: Pick<CheckoutMerchant, 'supportEmail' | 'website'>, subject: string): string | null;
|
|
2742
|
+
/**
|
|
2743
|
+
* What the checkout says about a payment Quasar ended as failed for good (`payment_failed`), by the reason Quasar gives.
|
|
2744
|
+
* Only a transaction that reverted on the network spent a fee, and only that one is said to have: a transaction whose
|
|
2745
|
+
* time ran out before it landed (`expired`, a Solana blockhash) sent nothing, one the buyer cancelled in the wallet
|
|
2746
|
+
* (`cancelled`) was their own doing, and for anything else (a relay operation that was lost, a cause Quasar does not
|
|
2747
|
+
* name, an older Quasar that gives no reason) the page knows only that the invoice is not paid.
|
|
2748
|
+
*
|
|
2749
|
+
* @param error - The store's `payment_failed` error.
|
|
2750
|
+
* @param labels - The labels of the checkout language.
|
|
2751
|
+
* @param network - The name of the network of the payment, on the pay step; the method step does not know it.
|
|
2752
|
+
* @returns The text.
|
|
2753
|
+
*/
|
|
2754
|
+
declare function paymentFailedText(error: CheckoutError, labels: NovaPaymentsLabels, network?: string): string;
|
|
2755
|
+
/**
|
|
2756
|
+
* The transaction of a payment that ended without paying the invoice, when the store's error names one: a transaction
|
|
2757
|
+
* the network has (it reverted, or it succeeded and sent something else), which the page shows with a link to the
|
|
2758
|
+
* explorer next to what it says.
|
|
2759
|
+
*
|
|
2760
|
+
* @param error - The store's error, if any.
|
|
2761
|
+
* @returns The transaction's key, or `null` for any other error, or one that names no transaction.
|
|
2762
|
+
*/
|
|
2763
|
+
declare function failedPaymentTx(error: CheckoutError | null | undefined): string | null;
|
|
2699
2764
|
/**
|
|
2700
2765
|
* What the checkout says about a payment that left the wallet, or may have, from the store's error: a transaction that
|
|
2701
2766
|
* does not pay the invoice (`pay.mismatch`; `pay.mismatchTakenElsewhere` when Quasar credited it to another invoice;
|
|
2702
2767
|
* `pay.mismatchHeldElsewhere` when another invoice holds it for a refund only, `held`;
|
|
2703
2768
|
* `pay.mismatchOtherWallet` for a transfer from a wallet that did not confirm the invoice, `pay.mismatchOtherWalletHeld`
|
|
2704
|
-
* when Quasar recorded it as a held transfer the seller returns, `held`; `pay.
|
|
2705
|
-
*
|
|
2769
|
+
* when Quasar recorded it as a held transfer the seller returns, `held`; `pay.mismatchNoReferenceHeld` for a Solana Pay
|
|
2770
|
+
* transfer without the invoice's reference held on this invoice, `held`; `pay.mismatchChargeHeld` for a payment sent
|
|
2771
|
+
* under an earlier price of the invoice, `quote_changed`), a payment Quasar closed after 24 hours without a result on chain
|
|
2706
2772
|
* (`outcome.unconfirmedClosed`), a transaction another invoice handed over first (`outcome.unconfirmedTakenElsewhere`)
|
|
2707
2773
|
* and a payment the network confirmed that Quasar has not recorded yet (`outcome.unconfirmedSettlementRetrying` while
|
|
2708
2774
|
* Quasar settles it again daily, for 30 days, else `outcome.unconfirmedSettlementFailed`). Never "it failed", "only the
|
|
@@ -2737,54 +2803,6 @@ declare function needsLeaveConfirm(phase: CheckoutPhase, error?: CheckoutError |
|
|
|
2737
2803
|
* @returns The text.
|
|
2738
2804
|
*/
|
|
2739
2805
|
declare function methodErrorText(error: CheckoutError, labels: NovaPaymentsLabels, merchant?: string): string;
|
|
2740
|
-
/** The terms of an automatic payments offer, as the checkout shows them. */
|
|
2741
|
-
interface AutoPayTerms {
|
|
2742
|
-
/** The CAIP-2 chain of the charges. */
|
|
2743
|
-
chainId: string;
|
|
2744
|
-
/**
|
|
2745
|
-
* The wallet the charges are paid to: the merchant's, as the `payee` rule of the request names it (the app's
|
|
2746
|
-
* collector, which sends the charges, when the request names no payee).
|
|
2747
|
-
*/
|
|
2748
|
-
to: string;
|
|
2749
|
-
/** The most it takes in a period, in base units of the token. */
|
|
2750
|
-
limit: string;
|
|
2751
|
-
/** Decimals of the token. */
|
|
2752
|
-
decimals: number;
|
|
2753
|
-
/** Symbol of the token. */
|
|
2754
|
-
symbol: string;
|
|
2755
|
-
/** The length of a period, in seconds. */
|
|
2756
|
-
periodSeconds: number;
|
|
2757
|
-
/** When the permission ends, in milliseconds; `null` without an expiry rule. */
|
|
2758
|
-
expiresAt: number | null;
|
|
2759
|
-
}
|
|
2760
|
-
/**
|
|
2761
|
-
* What the connected wallet may ask its wallet for: the offer, or taking over an active permission that holds nothing.
|
|
2762
|
-
*
|
|
2763
|
-
* @param offer - The automatic-charge offer of the checkout.
|
|
2764
|
-
* @returns The method and the request, or `null` when nothing can be given now.
|
|
2765
|
-
*/
|
|
2766
|
-
declare function grantableOffer(offer: AutoChargeOffer | null): Extract<AutoChargeOffer, {
|
|
2767
|
-
status: 'available';
|
|
2768
|
-
}> | NonNullable<Extract<AutoChargeOffer, {
|
|
2769
|
-
status: 'active';
|
|
2770
|
-
}>['replacement']> | null;
|
|
2771
|
-
/**
|
|
2772
|
-
* The terms of an ERC-7715 automatic payments offer: the periodic limit in the token of the method, the period, the
|
|
2773
|
-
* expiry and the merchant's wallet the charges are paid to.
|
|
2774
|
-
*
|
|
2775
|
-
* @param offer - The view's `autoCharge`.
|
|
2776
|
-
* @param methods - The view's methods (for the token of the offer).
|
|
2777
|
-
* @returns The terms, or `null` when the offer is not available or its method is unknown.
|
|
2778
|
-
*/
|
|
2779
|
-
declare function autoPayTerms(offer: AutoChargeOffer | null, methods: CheckoutMethod[]): AutoPayTerms | null;
|
|
2780
|
-
/**
|
|
2781
|
-
* A period as words of the language: whole days in days, otherwise in hours.
|
|
2782
|
-
*
|
|
2783
|
-
* @param seconds - The period.
|
|
2784
|
-
* @param locale - BCP 47 language of the page.
|
|
2785
|
-
* @returns For example `30 days`, `2 hours`, `30 днів`.
|
|
2786
|
-
*/
|
|
2787
|
-
declare function formatPeriod(seconds: number, locale: string): string;
|
|
2788
2806
|
/**
|
|
2789
2807
|
* What an underpaid invoice still needs, in base units of the locked token.
|
|
2790
2808
|
*
|
|
@@ -2895,7 +2913,8 @@ interface LockPriceStore {
|
|
|
2895
2913
|
declare function lockPrice(store: LockPriceStore, showConfirmWallet: (show: boolean) => void): Promise<CheckoutQuote | null>;
|
|
2896
2914
|
/**
|
|
2897
2915
|
* Whether the error is a refusal of the wallet's confirmation (`payer_proof_*`, `payer_chain_mismatch`,
|
|
2898
|
-
* `too_many_payers`): the pay step shows only these under the confirmation, its other errors
|
|
2916
|
+
* `too_many_payers`, `payer_is_recipient`): the pay step shows only these under the confirmation, its other errors
|
|
2917
|
+
* have texts of their own.
|
|
2899
2918
|
*
|
|
2900
2919
|
* @param error - The checkout store's error, if any.
|
|
2901
2920
|
* @returns `true` for a refusal of the confirmation.
|
|
@@ -2913,7 +2932,8 @@ declare function isConfirmationError(error: CheckoutError | null | undefined): b
|
|
|
2913
2932
|
/**
|
|
2914
2933
|
* What the step that confirms the wallet says about a refusal, with what to do: the wallet's (the buyer declined, the
|
|
2915
2934
|
* wallet cannot sign messages, it failed) or Quasar's (`payer_proof_invalid`, `payer_proof_unavailable`,
|
|
2916
|
-
* `payer_chain_mismatch`, `too_many_payers`, `rate_limited`…). The buyer stays on the step and
|
|
2935
|
+
* `payer_chain_mismatch`, `too_many_payers`, `payer_is_recipient`, `rate_limited`…). The buyer stays on the step and
|
|
2936
|
+
* can try again.
|
|
2917
2937
|
*
|
|
2918
2938
|
* @param error - The checkout store's error, if any.
|
|
2919
2939
|
* @param problem - Why the wallet did not sign, when the checkout knows it.
|
|
@@ -2974,5 +2994,5 @@ declare function invoiceTotals(invoice: CheckoutView['invoice']): {
|
|
|
2974
2994
|
total: string;
|
|
2975
2995
|
};
|
|
2976
2996
|
|
|
2977
|
-
export { AmountStep,
|
|
2978
|
-
export type {
|
|
2997
|
+
export { AmountStep, BuyerScreen, CheckoutContext, CheckoutContextProvider, CheckoutFrame, CheckoutHeader, CheckoutPageRoot, CheckoutStepper, CheckoutSummary, CheckoutWallet, CompactSummary, ConfirmScreen, ConfirmStep, ConfirmWalletScreen, ContactLink, DEADLINE_ANNOUNCEMENTS, DeadlineTimer, Disclosure, FailedScreen, FailedStep, LeaveDialog, LocaleSwitcher, MerchantBadge, MethodScreen, MobileSteps, NativeFee, NovaPaymentsContext, NovaPaymentsProvider, OPEN_REQUEST_MS, OrderLines, OrderTotal, OutcomeScreen, PaidScreen, PayScreen, PaymentCheckout, PaymentFamily, PaymentWalletError, PaymentsAdapter, QUOTE_WARNING_MS, QrScreen, RefundButton, RefundDialog, RefundSteps, ScreenBody, SellerDetailsContent, SummaryFooter, WalletPrompt, addressOfWallet, balanceShortfall, baseUnitsToDecimal, buyerFields, buyerIssues, checkoutClassName, checkoutScreen, checkoutSteps, cleanBuyer, contactHref, countryOptions, deadlineAnnouncement, deadlineState, failedPaymentTx, formatCountdown, formatFeeAmount, formatFiat, formatTokenAmount, groupMethodsByToken, handOverPayment, instructionsChainId, invoiceTotals, isConfirmationError, isFinalPaymentFailure, isInvoicePaymentOnTheWay, isInvoicePaymentUnresolved, isMovedMoneyFailure, isPaidElsewhere, isPayerProofError, isPaymentAccepted, isPaymentOnTheWay, isQuoteEnding, isSameWallet, isSlow, isSmartWallet, leftTheWalletText, lockPrice, lockedPriceOnWallet, methodErrorText, minorToDecimal, needsLeaveConfirm, needsPayerProof, needsTheClock, paidSteps, payInvoice, payPath, payerProofErrorText, paymentFailedText, qrPath, quoteAmounts, quoteRate, receivedAmount, refundRateMoved, refundTransfer, refusalText, restRateText, screensPayingWallets, sentBeforeDeadline, shownLocale, unconfirmedFollowUp, unconfirmedTxKey, underpaidRest, useAsyncValue, useAutoReturn, useCheckoutContext, useCheckoutEvents, useCheckoutState, useCheckoutStore, useConnectedWallet, useNovaPayments, useNow, useOptionalCheckoutContext, usePaidCallback, usePayerProof, usePayment, usePaymentFacts, usePaymentHandOver, usePaymentsConnection, usePaymentsLabels, useRefund, useRereadValue, useWalletConnection, walletErrorKind, walletOnConfirmStep };
|
|
2998
|
+
export type { BalanceShortfall, BuyerCollect, BuyerField, BuyerIssue, CheckoutContextValue, CheckoutHeaderProps, CheckoutNetworkOptionProps, CheckoutPartState, CheckoutPrimaryButtonProps, CheckoutQrCodeProps, CheckoutScreen, CheckoutScreenChoices, CheckoutScreenProps, CheckoutStatusIconProps, CheckoutStep, CheckoutStepperProps, CheckoutTokenGroup, CheckoutTokenOptionProps, ConfirmProblem, HandOverParams, LocaleSwitcherProps, LockPriceStore, NovaPaymentsLabelsContext, NovaPaymentsOwnConnection, NovaPaymentsProviderCustomization, NovaPaymentsProviderProps, NovaPaymentsSettings, OutcomeKind, PayInvoiceParams, PayPath, PayerProofFlow, PayerProofProblem, PayerProofStep, Payment, PaymentCheckoutChildCustomizations, PaymentCheckoutClassNames, PaymentCheckoutComponents, PaymentCheckoutConfig, PaymentCheckoutCustomization, PaymentCheckoutDisplay, PaymentCheckoutHandlers, PaymentCheckoutProps, PaymentHandOverState, PaymentStatus, PaymentTransfer, PaymentWalletErrorKind, PaymentsConnectionMode, PaymentsPulsar, QuoteAmounts, RefundButtonProps, RefundDialogProps, RefundFlow, RefundInstructions, RefundProblem, RefundRequest, RefundStep, SentBeforeDeadlineParams, SentPayment, UnconfirmedFollowUp, UseAutoReturnParams, UseCheckoutEventsParams, UseCheckoutStoreOptions, UsePayerProofParams, UsePaymentHandOverParams, UsePaymentParams, UseRefundParams, WalletConnection, WalletPromptKind, WalletPromptProps };
|