@openreceive/browser 0.3.1 → 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/dist/{chunk-JR3DCSHN.js → chunk-D4S2GCC4.js} +143 -18
- package/dist/headless.d.ts +156 -20
- package/dist/headless.js +17 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{status-BZEGi6Ca.d.ts → status-BMYd00Xn.d.ts} +42 -13
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/dist/headless.js
CHANGED
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
createTransientFeedbackController,
|
|
55
55
|
createWizardRouteAssetDisplays,
|
|
56
56
|
createWizardRouteDisplays,
|
|
57
|
+
currentCheckoutUrl,
|
|
57
58
|
deriveCheckoutStateLabels,
|
|
58
59
|
deriveStatus,
|
|
59
60
|
enterCheckoutResumePath,
|
|
@@ -62,6 +63,7 @@ import {
|
|
|
62
63
|
formatAmountCaption,
|
|
63
64
|
formatDepositAmount,
|
|
64
65
|
formatFiatAmount,
|
|
66
|
+
formatMethodNetworkDetail,
|
|
65
67
|
formatMsats,
|
|
66
68
|
formatNetworkSummary,
|
|
67
69
|
formatSwapLimit,
|
|
@@ -100,8 +102,10 @@ import {
|
|
|
100
102
|
prepareCheckout,
|
|
101
103
|
requestCheckout,
|
|
102
104
|
requestSwapRefund,
|
|
105
|
+
requestSwapStatus,
|
|
103
106
|
resolveTransactionDetailRows,
|
|
104
107
|
resolveWizardSelection,
|
|
108
|
+
resumeSwapAttempt,
|
|
105
109
|
selectCheckoutDisplayInvoice,
|
|
106
110
|
selectCurrentSwapInvoice,
|
|
107
111
|
startSwapRequest,
|
|
@@ -111,14 +115,18 @@ import {
|
|
|
111
115
|
swapOptionLimitSentence,
|
|
112
116
|
swapPickerKey,
|
|
113
117
|
updatePaymentWizardSelection
|
|
114
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-D4S2GCC4.js";
|
|
119
|
+
|
|
120
|
+
// src/headless.ts
|
|
121
|
+
import { createAssetBaseUrlResolver, getPaymentWizardRoutes } from "@openreceive/provider-data";
|
|
115
122
|
|
|
116
123
|
// src/internal/checkout-props.ts
|
|
117
124
|
var CREATE_MODE_ONLY_PROPS = [
|
|
118
125
|
"metadata",
|
|
119
126
|
"syncUrl",
|
|
120
127
|
"resumePathPrefix",
|
|
121
|
-
"routeReference"
|
|
128
|
+
"routeReference",
|
|
129
|
+
"resumePaymentHash"
|
|
122
130
|
];
|
|
123
131
|
var warnedSnapshotModeProps = /* @__PURE__ */ new Set();
|
|
124
132
|
function validateCheckoutProps(props) {
|
|
@@ -412,6 +420,9 @@ function createModeAttributes(options) {
|
|
|
412
420
|
if (options.routeReference !== void 0) {
|
|
413
421
|
attributes[OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES.routeReference] = options.routeReference;
|
|
414
422
|
}
|
|
423
|
+
if (options.resumePaymentHash !== void 0) {
|
|
424
|
+
attributes[OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES.resumePaymentHash] = options.resumePaymentHash;
|
|
425
|
+
}
|
|
415
426
|
return attributes;
|
|
416
427
|
}
|
|
417
428
|
function sharedElementAttributes(options) {
|
|
@@ -595,10 +606,6 @@ function createCheckoutShell(snapshot, options = {}) {
|
|
|
595
606
|
themeToggle
|
|
596
607
|
};
|
|
597
608
|
}
|
|
598
|
-
|
|
599
|
-
// src/headless.ts
|
|
600
|
-
import { createAssetBaseUrlResolver } from "@openreceive/provider-data";
|
|
601
|
-
import { getPaymentWizardRoutes } from "@openreceive/provider-data";
|
|
602
609
|
export {
|
|
603
610
|
BrowserRequestError,
|
|
604
611
|
OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES,
|
|
@@ -666,6 +673,7 @@ export {
|
|
|
666
673
|
createTransientFeedbackController,
|
|
667
674
|
createWizardRouteAssetDisplays,
|
|
668
675
|
createWizardRouteDisplays,
|
|
676
|
+
currentCheckoutUrl,
|
|
669
677
|
deriveCheckoutStateLabels,
|
|
670
678
|
deriveStatus,
|
|
671
679
|
enterCheckoutResumePath,
|
|
@@ -673,6 +681,7 @@ export {
|
|
|
673
681
|
formatAmountCaption,
|
|
674
682
|
formatDepositAmount,
|
|
675
683
|
formatFiatAmount,
|
|
684
|
+
formatMethodNetworkDetail,
|
|
676
685
|
formatMsats,
|
|
677
686
|
formatNetworkSummary,
|
|
678
687
|
formatSwapLimit,
|
|
@@ -711,8 +720,10 @@ export {
|
|
|
711
720
|
readThemePreference,
|
|
712
721
|
requestCheckout,
|
|
713
722
|
requestSwapRefund,
|
|
723
|
+
requestSwapStatus,
|
|
714
724
|
resolveTransactionDetailRows,
|
|
715
725
|
resolveWizardSelection,
|
|
726
|
+
resumeSwapAttempt,
|
|
716
727
|
selectCheckoutDisplayInvoice,
|
|
717
728
|
selectCurrentSwapInvoice,
|
|
718
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
|
|
@@ -268,6 +256,12 @@ declare const OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES: {
|
|
|
268
256
|
* push/replace the URL via the History API.
|
|
269
257
|
*/
|
|
270
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";
|
|
271
265
|
/**
|
|
272
266
|
* Does a payer who closes this tab have a URL that brings them back to this
|
|
273
267
|
* checkout? Only the refund screen's copy depends on it — see
|
|
@@ -305,6 +299,18 @@ declare const OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES: {
|
|
|
305
299
|
readonly storageKey: "storage-key";
|
|
306
300
|
};
|
|
307
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
|
+
|
|
308
314
|
interface TransientFeedbackOptions<T> {
|
|
309
315
|
readonly resetValue: T;
|
|
310
316
|
readonly delayMs?: number;
|
|
@@ -537,6 +543,13 @@ interface SwapDisplayModel {
|
|
|
537
543
|
* to notice: render this string, never either label directly.
|
|
538
544
|
*/
|
|
539
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;
|
|
540
553
|
readonly refundTxId?: string;
|
|
541
554
|
readonly refundReason?: string;
|
|
542
555
|
readonly depositReceivedAmount?: string;
|
|
@@ -640,6 +653,12 @@ interface CheckoutElementAttributeOptions {
|
|
|
640
653
|
* Order id from the app router (e.g. Next.js). When set, skip History API URL sync.
|
|
641
654
|
*/
|
|
642
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;
|
|
643
662
|
/**
|
|
644
663
|
* Does a payer who closes this tab have a URL that brings them back? Emitted
|
|
645
664
|
* in every mode, because the refund screen it governs shows in every mode.
|
|
@@ -1221,6 +1240,16 @@ declare function enterCheckoutResumePath(reference: string, options?: {
|
|
|
1221
1240
|
/** When set, skip History API sync (Next.js / file-based routes own the URL). */
|
|
1222
1241
|
readonly routeReference?: string;
|
|
1223
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;
|
|
1224
1253
|
/**
|
|
1225
1254
|
* Guest resume fetch for a host-owned order endpoint. OpenReceive ships no order-read route.
|
|
1226
1255
|
* Pass the result as `fetchOrder` to {@link createGuestCheckoutResume}.
|
|
@@ -1252,4 +1281,4 @@ declare function deriveStatus(invoice: StatusInvoiceLike, options?: {
|
|
|
1252
1281
|
readonly now?: UnixSeconds;
|
|
1253
1282
|
}): Status;
|
|
1254
1283
|
|
|
1255
|
-
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,
|
|
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 };
|