@openreceive/browser 0.3.0 → 0.3.2
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 +2 -2
- package/dist/{chunk-NVEGYGZ5.js → chunk-D4S2GCC4.js} +222 -36
- package/dist/headless.d.ts +262 -40
- package/dist/headless.js +44 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{status-C-zvqBau.d.ts → status-BMYd00Xn.d.ts} +115 -13
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/dist/headless.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
OPENRECEIVE_DEFAULT_PREFIX,
|
|
14
14
|
OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES,
|
|
15
15
|
OPENRECEIVE_PAYMENT_WIZARD_SELECTORS,
|
|
16
|
+
OPENRECEIVE_PROVIDER_PREVIEW_LIMIT,
|
|
16
17
|
OPENRECEIVE_THEME_STORAGE_KEY,
|
|
17
18
|
OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES,
|
|
18
19
|
OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS,
|
|
@@ -42,6 +43,7 @@ import {
|
|
|
42
43
|
createPaymentWizardSelection,
|
|
43
44
|
createQrPayloadSvg,
|
|
44
45
|
createQrSvg,
|
|
46
|
+
createQrSvgController,
|
|
45
47
|
createStatusFetcher,
|
|
46
48
|
createSwapDisplayModel,
|
|
47
49
|
createSwapUnavailableModel,
|
|
@@ -52,6 +54,7 @@ import {
|
|
|
52
54
|
createTransientFeedbackController,
|
|
53
55
|
createWizardRouteAssetDisplays,
|
|
54
56
|
createWizardRouteDisplays,
|
|
57
|
+
currentCheckoutUrl,
|
|
55
58
|
deriveCheckoutStateLabels,
|
|
56
59
|
deriveStatus,
|
|
57
60
|
enterCheckoutResumePath,
|
|
@@ -60,6 +63,7 @@ import {
|
|
|
60
63
|
formatAmountCaption,
|
|
61
64
|
formatDepositAmount,
|
|
62
65
|
formatFiatAmount,
|
|
66
|
+
formatMethodNetworkDetail,
|
|
63
67
|
formatMsats,
|
|
64
68
|
formatNetworkSummary,
|
|
65
69
|
formatSwapLimit,
|
|
@@ -98,8 +102,10 @@ import {
|
|
|
98
102
|
prepareCheckout,
|
|
99
103
|
requestCheckout,
|
|
100
104
|
requestSwapRefund,
|
|
105
|
+
requestSwapStatus,
|
|
101
106
|
resolveTransactionDetailRows,
|
|
102
107
|
resolveWizardSelection,
|
|
108
|
+
resumeSwapAttempt,
|
|
103
109
|
selectCheckoutDisplayInvoice,
|
|
104
110
|
selectCurrentSwapInvoice,
|
|
105
111
|
startSwapRequest,
|
|
@@ -109,14 +115,18 @@ import {
|
|
|
109
115
|
swapOptionLimitSentence,
|
|
110
116
|
swapPickerKey,
|
|
111
117
|
updatePaymentWizardSelection
|
|
112
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-D4S2GCC4.js";
|
|
119
|
+
|
|
120
|
+
// src/headless.ts
|
|
121
|
+
import { createAssetBaseUrlResolver, getPaymentWizardRoutes } from "@openreceive/provider-data";
|
|
113
122
|
|
|
114
123
|
// src/internal/checkout-props.ts
|
|
115
124
|
var CREATE_MODE_ONLY_PROPS = [
|
|
116
125
|
"metadata",
|
|
117
126
|
"syncUrl",
|
|
118
127
|
"resumePathPrefix",
|
|
119
|
-
"routeReference"
|
|
128
|
+
"routeReference",
|
|
129
|
+
"resumePaymentHash"
|
|
120
130
|
];
|
|
121
131
|
var warnedSnapshotModeProps = /* @__PURE__ */ new Set();
|
|
122
132
|
function validateCheckoutProps(props) {
|
|
@@ -141,6 +151,8 @@ function validateCheckoutProps(props) {
|
|
|
141
151
|
// src/internal/checkout-session.ts
|
|
142
152
|
import { recordOrEmpty } from "@openreceive/core";
|
|
143
153
|
var SWAP_START_FAILED = "Could not prepare the payment address. Please try again.";
|
|
154
|
+
var MISSING_SWAP_OPTIONS = "startSwap needs the session's `swap` options (selection, prefix, fetch) \u2014 this session was created without them, so it cannot start a swap. See docs/guides/headless-checkout.md.";
|
|
155
|
+
var MISSING_SWAP_WIRING = "startSwap cannot start a swap: the session was given no";
|
|
144
156
|
var MINT_FAILED = "Could not create the Lightning invoice. Please try again.";
|
|
145
157
|
function normalizeSwapQuote(body) {
|
|
146
158
|
const quote = recordOrEmpty(recordOrEmpty(body).quote ?? body);
|
|
@@ -190,11 +202,23 @@ function createCheckoutSession(options) {
|
|
|
190
202
|
}
|
|
191
203
|
async function startSwap(payInAsset) {
|
|
192
204
|
if (startingSwapAsset !== null) return;
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
205
|
+
const swap = options.swap;
|
|
206
|
+
if (swap === void 0) {
|
|
207
|
+
options.onError(new Error(MISSING_SWAP_OPTIONS));
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const selection = swap.selection;
|
|
211
|
+
const prefix = swap.prefix();
|
|
212
|
+
const fetcher = swap.fetch();
|
|
196
213
|
const reference = options.reference();
|
|
197
|
-
if (
|
|
214
|
+
if (prefix === void 0 || fetcher === void 0) {
|
|
215
|
+
const missing = [
|
|
216
|
+
...prefix === void 0 ? ["swap.prefix()"] : [],
|
|
217
|
+
...fetcher === void 0 ? ["swap.fetch()"] : []
|
|
218
|
+
];
|
|
219
|
+
options.onError(new Error(`${MISSING_SWAP_WIRING} ${missing.join(" and ")}.`));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
198
222
|
if (reference === void 0 || reference.length === 0) return;
|
|
199
223
|
const alreadyStarted = selection.started();
|
|
200
224
|
if (alreadyStarted?.swap?.pay_in_asset === payInAsset && alreadyStarted.invoice_id !== selection.dismissedInvoiceId()) {
|
|
@@ -217,7 +241,7 @@ function createCheckoutSession(options) {
|
|
|
217
241
|
});
|
|
218
242
|
selection.setStarted(started);
|
|
219
243
|
selection.setDismissedInvoiceId(null);
|
|
220
|
-
|
|
244
|
+
swap.onStarted?.(started);
|
|
221
245
|
selection.setSelectedAsset(payInAsset);
|
|
222
246
|
options.onChange();
|
|
223
247
|
} catch (error) {
|
|
@@ -396,6 +420,9 @@ function createModeAttributes(options) {
|
|
|
396
420
|
if (options.routeReference !== void 0) {
|
|
397
421
|
attributes[OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES.routeReference] = options.routeReference;
|
|
398
422
|
}
|
|
423
|
+
if (options.resumePaymentHash !== void 0) {
|
|
424
|
+
attributes[OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES.resumePaymentHash] = options.resumePaymentHash;
|
|
425
|
+
}
|
|
399
426
|
return attributes;
|
|
400
427
|
}
|
|
401
428
|
function sharedElementAttributes(options) {
|
|
@@ -418,6 +445,9 @@ function sharedElementAttributes(options) {
|
|
|
418
445
|
if (isSet(options.assetBaseUrl)) {
|
|
419
446
|
attributes[OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES.assetBaseUrl] = options.assetBaseUrl;
|
|
420
447
|
}
|
|
448
|
+
if (options.resumable !== void 0) {
|
|
449
|
+
attributes[OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES.resumable] = String(options.resumable);
|
|
450
|
+
}
|
|
421
451
|
if (options.polling !== void 0) {
|
|
422
452
|
attributes[OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES.polling] = String(options.polling);
|
|
423
453
|
}
|
|
@@ -576,9 +606,6 @@ function createCheckoutShell(snapshot, options = {}) {
|
|
|
576
606
|
themeToggle
|
|
577
607
|
};
|
|
578
608
|
}
|
|
579
|
-
|
|
580
|
-
// src/headless.ts
|
|
581
|
-
import { createAssetBaseUrlResolver } from "@openreceive/provider-data";
|
|
582
609
|
export {
|
|
583
610
|
BrowserRequestError,
|
|
584
611
|
OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES,
|
|
@@ -594,6 +621,7 @@ export {
|
|
|
594
621
|
OPENRECEIVE_DEFAULT_PREFIX,
|
|
595
622
|
OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES,
|
|
596
623
|
OPENRECEIVE_PAYMENT_WIZARD_SELECTORS,
|
|
624
|
+
OPENRECEIVE_PROVIDER_PREVIEW_LIMIT,
|
|
597
625
|
OPENRECEIVE_THEME_STORAGE_KEY,
|
|
598
626
|
OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES,
|
|
599
627
|
OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS,
|
|
@@ -630,6 +658,7 @@ export {
|
|
|
630
658
|
createPaymentWizardSelection,
|
|
631
659
|
createQrPayloadSvg,
|
|
632
660
|
createQrSvg,
|
|
661
|
+
createQrSvgController,
|
|
633
662
|
createStatusFetcher,
|
|
634
663
|
createStoredThemeModel,
|
|
635
664
|
createSwapDisplayModel,
|
|
@@ -644,6 +673,7 @@ export {
|
|
|
644
673
|
createTransientFeedbackController,
|
|
645
674
|
createWizardRouteAssetDisplays,
|
|
646
675
|
createWizardRouteDisplays,
|
|
676
|
+
currentCheckoutUrl,
|
|
647
677
|
deriveCheckoutStateLabels,
|
|
648
678
|
deriveStatus,
|
|
649
679
|
enterCheckoutResumePath,
|
|
@@ -651,6 +681,7 @@ export {
|
|
|
651
681
|
formatAmountCaption,
|
|
652
682
|
formatDepositAmount,
|
|
653
683
|
formatFiatAmount,
|
|
684
|
+
formatMethodNetworkDetail,
|
|
654
685
|
formatMsats,
|
|
655
686
|
formatNetworkSummary,
|
|
656
687
|
formatSwapLimit,
|
|
@@ -658,6 +689,7 @@ export {
|
|
|
658
689
|
getExplorerNetwork,
|
|
659
690
|
getNetworkIcon,
|
|
660
691
|
getPaymentMethodIcon,
|
|
692
|
+
getPaymentWizardRoutes,
|
|
661
693
|
getRouteIconPath,
|
|
662
694
|
getRouteNetworkLabel,
|
|
663
695
|
getSwapOptionIcon,
|
|
@@ -688,8 +720,10 @@ export {
|
|
|
688
720
|
readThemePreference,
|
|
689
721
|
requestCheckout,
|
|
690
722
|
requestSwapRefund,
|
|
723
|
+
requestSwapStatus,
|
|
691
724
|
resolveTransactionDetailRows,
|
|
692
725
|
resolveWizardSelection,
|
|
726
|
+
resumeSwapAttempt,
|
|
693
727
|
selectCheckoutDisplayInvoice,
|
|
694
728
|
selectCurrentSwapInvoice,
|
|
695
729
|
startSwapRequest,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { aR as BrowserLogLevel } from './status-BMYd00Xn.js';
|
|
2
|
+
export { aS as BrowserLogEntry, V as BrowserLogger, B as BrowserLoggerOption, X as BrowserRequestError, Y as CheckoutController, Z as CheckoutControllerOptions, g as CheckoutSnapshot, i as CheckoutState, aT as CopyInvoiceOptions, aU as GuestCheckoutResumeController, aV as GuestCheckoutResumeOptions, aW as OpenWalletOptions, aX as PrepareCheckoutOptions, aY as QrOptions, aZ as RequestCheckoutOptions, an as Status, a_ as StatusInvoiceLike, U as UnixSeconds, as as copyInvoice, au as createCheckoutController, a$ as createGuestCheckoutResume, b0 as createGuestOrderFetcher, b1 as createLightningUri, b2 as createQrPngDataUrl, az as createQrSvg, aF as deriveStatus, aG as enterCheckoutResumePath, aO as openWallet, aP as prepareCheckout, aQ as requestCheckout } from './status-BMYd00Xn.js';
|
|
3
3
|
import '@openreceive/provider-data';
|
|
4
4
|
import '@openreceive/core';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import { PaymentWizardRoute, AssetIndexEntry } from '@openreceive/provider-data';
|
|
2
2
|
import { TransactionSettlementStatus } from '@openreceive/core';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* A unix timestamp in **seconds** — the unit every OpenReceive wire field uses
|
|
6
|
-
* (`expires_at`, `provider_expires_at`, `settled_at`, `paid_at`) and therefore
|
|
7
|
-
* the unit every `now` option compares against.
|
|
8
|
-
*
|
|
9
|
-
* It is a plain `number`; the alias exists so the unit shows up where the
|
|
10
|
-
* option does. `Date.now()` is MILLISECONDS and is the wrong value here —
|
|
11
|
-
* {@link resolveNow} rejects it rather than letting every invoice read as
|
|
12
|
-
* expired. Use `Math.floor(Date.now() / 1000)`.
|
|
13
|
-
*/
|
|
14
|
-
type UnixSeconds = number;
|
|
15
|
-
|
|
16
4
|
/**
|
|
17
5
|
* Trim insignificant trailing zeros from a decimal crypto amount for display,
|
|
18
6
|
* e.g. "12.25900000" -> "12.259" and "5.000" -> "5". Only fractional digits are
|
|
@@ -102,6 +90,7 @@ declare const OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS: 3000;
|
|
|
102
90
|
*/
|
|
103
91
|
declare const OPENRECEIVE_DEFAULT_PREFIX: "/openreceive";
|
|
104
92
|
declare const OPENRECEIVE_COPY_FEEDBACK_MS: 1800;
|
|
93
|
+
declare const OPENRECEIVE_PROVIDER_PREVIEW_LIMIT: 4;
|
|
105
94
|
declare const OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME: "openreceive-checkout";
|
|
106
95
|
declare const OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME: "openreceive-theme-toggle";
|
|
107
96
|
declare const OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS: {
|
|
@@ -267,6 +256,20 @@ declare const OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES: {
|
|
|
267
256
|
* push/replace the URL via the History API.
|
|
268
257
|
*/
|
|
269
258
|
readonly routeReference: "route-reference";
|
|
259
|
+
/**
|
|
260
|
+
* Create mode only. Payment hash of a swap attempt this order already has in
|
|
261
|
+
* flight; the element reopens it after prepare instead of showing the method
|
|
262
|
+
* grid. A hash the server will not serve is ignored.
|
|
263
|
+
*/
|
|
264
|
+
readonly resumePaymentHash: "resume-payment-hash";
|
|
265
|
+
/**
|
|
266
|
+
* Does a payer who closes this tab have a URL that brings them back to this
|
|
267
|
+
* checkout? Only the refund screen's copy depends on it — see
|
|
268
|
+
* `SwapDisplayModel.refundReturnLabel`. Unset, the element infers it from
|
|
269
|
+
* `sync-url` / `route-reference`; set it when the host owns a per-order route
|
|
270
|
+
* of its own, which the element cannot see.
|
|
271
|
+
*/
|
|
272
|
+
readonly resumable: "resumable";
|
|
270
273
|
/**
|
|
271
274
|
* Base URL of an external bolt11 decoder. When set, the checkout shows a
|
|
272
275
|
* "Decode" link to `{decode-link-url}?invoice={bolt11}`. Omitted (the
|
|
@@ -296,6 +299,18 @@ declare const OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES: {
|
|
|
296
299
|
readonly storageKey: "storage-key";
|
|
297
300
|
};
|
|
298
301
|
|
|
302
|
+
/**
|
|
303
|
+
* A unix timestamp in **seconds** — the unit every OpenReceive wire field uses
|
|
304
|
+
* (`expires_at`, `provider_expires_at`, `settled_at`, `paid_at`) and therefore
|
|
305
|
+
* the unit every `now` option compares against.
|
|
306
|
+
*
|
|
307
|
+
* It is a plain `number`; the alias exists so the unit shows up where the
|
|
308
|
+
* option does. `Date.now()` is MILLISECONDS and is the wrong value here —
|
|
309
|
+
* {@link resolveNow} rejects it rather than letting every invoice read as
|
|
310
|
+
* expired. Use `Math.floor(Date.now() / 1000)`.
|
|
311
|
+
*/
|
|
312
|
+
type UnixSeconds = number;
|
|
313
|
+
|
|
299
314
|
interface TransientFeedbackOptions<T> {
|
|
300
315
|
readonly resetValue: T;
|
|
301
316
|
readonly delayMs?: number;
|
|
@@ -516,6 +531,25 @@ interface SwapDisplayModel {
|
|
|
516
531
|
* refund_address.
|
|
517
532
|
*/
|
|
518
533
|
readonly refundAllowed: boolean;
|
|
534
|
+
/**
|
|
535
|
+
* What to tell the payer about getting BACK to this refund screen, already
|
|
536
|
+
* decided from whether the host said the checkout is resumable.
|
|
537
|
+
*
|
|
538
|
+
* `checkoutLabels.refundReturnWarning` — "Bookmark this page…" — is only true
|
|
539
|
+
* if the checkout HAS a URL. A swap checkout that lives at one route with no
|
|
540
|
+
* per-order path (a single-page shop, a modal) sends that payer back to an
|
|
541
|
+
* empty checkout and their deposit is unreachable through the UI. So the
|
|
542
|
+
* choice is made here, from one declared fact, rather than left to every host
|
|
543
|
+
* to notice: render this string, never either label directly.
|
|
544
|
+
*/
|
|
545
|
+
readonly refundReturnLabel: string;
|
|
546
|
+
/**
|
|
547
|
+
* Whether the host declared this checkout resumable — the fact
|
|
548
|
+
* {@link SwapDisplayModel.refundReturnLabel} was chosen from. Exposed so a UI
|
|
549
|
+
* can render the affordance the sentence names (a copy button for the URL)
|
|
550
|
+
* without re-deriving the decision or string-matching the label.
|
|
551
|
+
*/
|
|
552
|
+
readonly resumable: boolean;
|
|
519
553
|
readonly refundTxId?: string;
|
|
520
554
|
readonly refundReason?: string;
|
|
521
555
|
readonly depositReceivedAmount?: string;
|
|
@@ -619,6 +653,17 @@ interface CheckoutElementAttributeOptions {
|
|
|
619
653
|
* Order id from the app router (e.g. Next.js). When set, skip History API URL sync.
|
|
620
654
|
*/
|
|
621
655
|
readonly routeReference?: string;
|
|
656
|
+
/**
|
|
657
|
+
* Payment hash of a swap attempt this order already has in flight. Create
|
|
658
|
+
* mode reopens it after prepare instead of showing the method grid; a hash
|
|
659
|
+
* the server will not serve is ignored.
|
|
660
|
+
*/
|
|
661
|
+
readonly resumePaymentHash?: string;
|
|
662
|
+
/**
|
|
663
|
+
* Does a payer who closes this tab have a URL that brings them back? Emitted
|
|
664
|
+
* in every mode, because the refund screen it governs shows in every mode.
|
|
665
|
+
*/
|
|
666
|
+
readonly resumable?: boolean;
|
|
622
667
|
/**
|
|
623
668
|
* Base URL of an external bolt11 decoder. Omitted (the default), the element
|
|
624
669
|
* renders no "Decode" link and the invoice is never sent to a third party.
|
|
@@ -1001,7 +1046,18 @@ interface WizardRouteDisplay {
|
|
|
1001
1046
|
readonly key: string;
|
|
1002
1047
|
readonly title: string;
|
|
1003
1048
|
readonly subtitle: string;
|
|
1049
|
+
/**
|
|
1050
|
+
* The providers to draw — every one the route has, or the first
|
|
1051
|
+
* `providerPreviewLimit` of them.
|
|
1052
|
+
*/
|
|
1004
1053
|
readonly providers: readonly WizardProviderDisplay[];
|
|
1054
|
+
/**
|
|
1055
|
+
* How many the route has in total, before any preview limit. The registry
|
|
1056
|
+
* carries ~37 wallets for Lightning, so a host that renders them beside a QR
|
|
1057
|
+
* needs a limit and a "show all N" affordance; this is the N, and
|
|
1058
|
+
* {@link WizardRouteDisplay.providers}.length is what it is showing.
|
|
1059
|
+
*/
|
|
1060
|
+
readonly providerCount: number;
|
|
1005
1061
|
}
|
|
1006
1062
|
/**
|
|
1007
1063
|
* One display row for post-settlement transaction details. Values are already
|
|
@@ -1083,6 +1139,42 @@ declare function copyInvoice(options: CopyInvoiceOptions): Promise<void>;
|
|
|
1083
1139
|
* that decision — see docs/guides/headless-checkout.md.
|
|
1084
1140
|
*/
|
|
1085
1141
|
declare function openWallet(options: OpenWalletOptions): string;
|
|
1142
|
+
/**
|
|
1143
|
+
* A QR that follows a changing payload, without every host rewriting the same
|
|
1144
|
+
* effect.
|
|
1145
|
+
*
|
|
1146
|
+
* {@link createQrSvg} and {@link createQrPayloadSvg} are ASYNC, and that is the
|
|
1147
|
+
* trap: `dangerouslySetInnerHTML={{ __html: createQrSvg(invoice) }}` type-checks
|
|
1148
|
+
* (React types `__html` as `string | TrustedHTML`, and `TrustedHTML` is an empty
|
|
1149
|
+
* interface every object satisfies) and paints the literal text
|
|
1150
|
+
* "[object Promise]" inside the QR box. Resolving it by hand then needs the
|
|
1151
|
+
* other half nobody writes the first time: a slow encode that lands AFTER the
|
|
1152
|
+
* payload changed must not paint the old QR over the new one.
|
|
1153
|
+
*
|
|
1154
|
+
* So: call `show`/`showPayload` whenever the payload changes and render what
|
|
1155
|
+
* `onValue` last handed you. Only the newest call can publish — an earlier
|
|
1156
|
+
* encode still in flight is dropped, resolved or rejected. `stop()` drops the
|
|
1157
|
+
* one in flight, for a host going away. Same shape as
|
|
1158
|
+
* {@link createTickingValueController}: DOM-free, framework-free, one
|
|
1159
|
+
* implementation instead of one per renderer.
|
|
1160
|
+
*/
|
|
1161
|
+
interface QrSvgControllerOptions {
|
|
1162
|
+
/** The newest encoded SVG. Not called for a superseded or stopped encode. */
|
|
1163
|
+
onValue(svg: string): void;
|
|
1164
|
+
/** Encode failures, on the same terms. */
|
|
1165
|
+
onError?(error: unknown): void;
|
|
1166
|
+
readonly encoder?: QrEncoder;
|
|
1167
|
+
readonly width?: number;
|
|
1168
|
+
}
|
|
1169
|
+
interface QrSvgController {
|
|
1170
|
+
/** Encode a bolt11, as the `lightning:` URI a wallet expects. */
|
|
1171
|
+
show(invoice: string): void;
|
|
1172
|
+
/** Encode a payload verbatim — a swap deposit URI, say. */
|
|
1173
|
+
showPayload(payload: string): void;
|
|
1174
|
+
/** Publish nothing further; the encode in flight is abandoned. */
|
|
1175
|
+
stop(): void;
|
|
1176
|
+
}
|
|
1177
|
+
declare function createQrSvgController(options: QrSvgControllerOptions): QrSvgController;
|
|
1086
1178
|
|
|
1087
1179
|
declare function createCheckoutController(options: CheckoutControllerOptions): CheckoutController;
|
|
1088
1180
|
|
|
@@ -1148,6 +1240,16 @@ declare function enterCheckoutResumePath(reference: string, options?: {
|
|
|
1148
1240
|
/** When set, skip History API sync (Next.js / file-based routes own the URL). */
|
|
1149
1241
|
readonly routeReference?: string;
|
|
1150
1242
|
}): void;
|
|
1243
|
+
/**
|
|
1244
|
+
* The URL a resumable checkout tells the payer to copy, or `undefined` off a
|
|
1245
|
+
* browser.
|
|
1246
|
+
*
|
|
1247
|
+
* `checkoutLabels.refundReturnWarning` says "Bookmark this page, or copy its
|
|
1248
|
+
* URL", and a sentence that names an affordance should be next to one. Both
|
|
1249
|
+
* renderers read it through this function so the refund screens cannot disagree
|
|
1250
|
+
* about what "its URL" means.
|
|
1251
|
+
*/
|
|
1252
|
+
declare function currentCheckoutUrl(): string | undefined;
|
|
1151
1253
|
/**
|
|
1152
1254
|
* Guest resume fetch for a host-owned order endpoint. OpenReceive ships no order-read route.
|
|
1153
1255
|
* Pass the result as `fetchOrder` to {@link createGuestCheckoutResume}.
|
|
@@ -1179,4 +1281,4 @@ declare function deriveStatus(invoice: StatusInvoiceLike, options?: {
|
|
|
1179
1281
|
readonly now?: UnixSeconds;
|
|
1180
1282
|
}): Status;
|
|
1181
1283
|
|
|
1182
|
-
export { type CheckoutStatusRefresh as $, type ThemeToggleElementAttributes as A, type BrowserLoggerOption as B, type CheckoutInvoiceSnapshot as C, type StoredThemeModelOptions as D, type ThemeModel as E, type ThemeModelOptions as F, type ReadThemePreferenceOptions as G, type ThemeControlTargets as H, type ThemeStorageOptions as I, type PaymentWizardControllerOptions as J, type PaymentWizardController as K, type PaymentWizardSelection as L, type PaymentWizardModel as M, type WizardRouteDisplay as N, type PaymentWizardSelectionAction as O, type ParseOpenReceiveOptionalIntegerOptions as P, type BrowserLogContext as Q, type ResolvedTheme as R, type SwapDisplayModel as S, type ThemePreference as T, type UnixSeconds as U, type BrowserLogger as V, type WizardRouteAssetDisplay as W, BrowserRequestError as X, type CheckoutController as Y, type CheckoutControllerOptions as Z, type CheckoutPhase as _, type PaymentMethod as a, OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES as a0, OPENRECEIVE_CHECKOUT_DATA_SELECTORS as a1, OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES as a2, OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS as a3, OPENRECEIVE_CHECKOUT_ELEMENT_PARTS as a4, OPENRECEIVE_CHECKOUT_ELEMENT_PART_SELECTORS as a5, OPENRECEIVE_CHECKOUT_ELEMENT_SLOTS as a6, OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME as a7, OPENRECEIVE_COPY_FEEDBACK_MS as a8, OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS as a9,
|
|
1284
|
+
export { type CheckoutStatusRefresh as $, type ThemeToggleElementAttributes as A, type BrowserLoggerOption as B, type CheckoutInvoiceSnapshot as C, type StoredThemeModelOptions as D, type ThemeModel as E, type ThemeModelOptions as F, type ReadThemePreferenceOptions as G, type ThemeControlTargets as H, type ThemeStorageOptions as I, type PaymentWizardControllerOptions as J, type PaymentWizardController as K, type PaymentWizardSelection as L, type PaymentWizardModel as M, type WizardRouteDisplay as N, type PaymentWizardSelectionAction as O, type ParseOpenReceiveOptionalIntegerOptions as P, type BrowserLogContext as Q, type ResolvedTheme as R, type SwapDisplayModel as S, type ThemePreference as T, type UnixSeconds as U, type BrowserLogger as V, type WizardRouteAssetDisplay as W, BrowserRequestError as X, type CheckoutController as Y, type CheckoutControllerOptions as Z, type CheckoutPhase as _, type PaymentMethod as a, createGuestCheckoutResume as a$, OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES as a0, OPENRECEIVE_CHECKOUT_DATA_SELECTORS as a1, OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES as a2, OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS as a3, OPENRECEIVE_CHECKOUT_ELEMENT_PARTS as a4, OPENRECEIVE_CHECKOUT_ELEMENT_PART_SELECTORS as a5, OPENRECEIVE_CHECKOUT_ELEMENT_SLOTS as a6, OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME as a7, OPENRECEIVE_COPY_FEEDBACK_MS as a8, OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS as a9, createQrSvgController as aA, createStatusFetcher as aB, createThemeChangeEvent as aC, currentCheckoutUrl as aD, deriveCheckoutStateLabels as aE, deriveStatus as aF, enterCheckoutResumePath as aG, escapeHtml as aH, formatAmountCaption as aI, formatDepositAmount as aJ, formatFiatAmount as aK, formatMsats as aL, formatSwapLimit as aM, formatUnixTime as aN, openWallet as aO, prepareCheckout as aP, requestCheckout as aQ, type BrowserLogLevel as aR, type BrowserLogEntry as aS, type CopyInvoiceOptions as aT, type GuestCheckoutResumeController as aU, type GuestCheckoutResumeOptions as aV, type OpenWalletOptions as aW, type PrepareCheckoutOptions as aX, type QrOptions as aY, type RequestCheckoutOptions as aZ, type StatusInvoiceLike as a_, OPENRECEIVE_DEFAULT_PREFIX as aa, OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES as ab, OPENRECEIVE_PAYMENT_WIZARD_SELECTORS as ac, OPENRECEIVE_PROVIDER_PREVIEW_LIMIT as ad, OPENRECEIVE_THEME_STORAGE_KEY as ae, OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES as af, OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS as ag, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PARTS as ah, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PART_SELECTORS as ai, OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME as aj, type QrEncoder as ak, type QrSvgController as al, type QrSvgControllerOptions as am, type Status as an, type SwapCopyRow as ao, type SwapRefundStaging as ap, type WizardProviderDisplay as aq, assertDisplayInvoice as ar, copyInvoice as as, createCheckoutActionEvent as at, createCheckoutController as au, createCheckoutErrorEvent as av, createCheckoutProviderCopyEvent as aw, createCheckoutStateEvent as ax, createQrPayloadSvg as ay, createQrSvg as az, type PaymentMethodOption as b, createGuestOrderFetcher as b0, createLightningUri as b1, createQrPngDataUrl as b2, type TickingValueOptions as c, type TickingValueController as d, type TransientFeedbackOptions as e, type TransientFeedbackController as f, type CheckoutSnapshot as g, type SwapDepositRisk as h, type CheckoutState as i, type TransactionDetailsInput as j, type TransactionDetailRow as k, type CreateCheckoutStateOptions as l, type CheckoutStatusModelInput as m, type CheckoutStatusModel as n, type CheckoutPaymentMethod as o, type ThemeAttributeTarget as p, type CheckoutElementAttributes as q, type CheckoutElementAttributeOptions as r, type CheckoutElementEventHandlers as s, type CheckoutElementListeners as t, type CreateCheckoutShellOptions as u, type CheckoutShellElements as v, type CheckoutShellOptions as w, type CheckoutShellModel as x, type CreateOpenReceiveThemeToggleElementOptions as y, type ThemeToggleElementAttributeOptions as z };
|