@openreceive/browser 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-WLLNZH26.js → chunk-GA4FMG7L.js} +116 -29
- package/dist/headless.d.ts +116 -10
- package/dist/headless.js +7 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{status-B1vDOhvh.d.ts → status-D3VhJsUp.d.ts} +76 -3
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/dist/headless.js
CHANGED
|
@@ -93,6 +93,7 @@ import {
|
|
|
93
93
|
parseResolvedTheme,
|
|
94
94
|
parseThemePreference,
|
|
95
95
|
paymentAccentId,
|
|
96
|
+
paymentIconPaths,
|
|
96
97
|
paymentIconUrls,
|
|
97
98
|
paymentMethods,
|
|
98
99
|
prepareCheckout,
|
|
@@ -105,13 +106,15 @@ import {
|
|
|
105
106
|
sanitizeBrowserLogEntry,
|
|
106
107
|
selectCheckoutDisplayInvoice,
|
|
107
108
|
swapAssetMatchesRoute,
|
|
109
|
+
swapDepositRisk,
|
|
108
110
|
swapGroupLimitOption,
|
|
109
111
|
swapOptionLimitMessage,
|
|
112
|
+
swapOptionLimitSentence,
|
|
110
113
|
swapPickerKey,
|
|
111
114
|
updatePaymentWizardSelection,
|
|
112
115
|
updateSelectedSwapNetworks,
|
|
113
116
|
wizardNetworkGroupIds
|
|
114
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-GA4FMG7L.js";
|
|
115
118
|
|
|
116
119
|
// src/internal/checkout-props.ts
|
|
117
120
|
var CREATE_MODE_ONLY_PROPS = [
|
|
@@ -866,6 +869,7 @@ export {
|
|
|
866
869
|
parseResolvedTheme,
|
|
867
870
|
parseThemePreference,
|
|
868
871
|
paymentAccentId,
|
|
872
|
+
paymentIconPaths,
|
|
869
873
|
paymentIconUrls,
|
|
870
874
|
paymentMethods,
|
|
871
875
|
postJson,
|
|
@@ -878,8 +882,10 @@ export {
|
|
|
878
882
|
selectCheckoutDisplayInvoice,
|
|
879
883
|
startSwapRequest,
|
|
880
884
|
swapAssetMatchesRoute,
|
|
885
|
+
swapDepositRisk,
|
|
881
886
|
swapGroupLimitOption,
|
|
882
887
|
swapOptionLimitMessage,
|
|
888
|
+
swapOptionLimitSentence,
|
|
883
889
|
swapPickerKey,
|
|
884
890
|
syncStoredThemeControls,
|
|
885
891
|
toggleStoredThemeControls,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { aK as BrowserLogLevel } from './status-D3VhJsUp.js';
|
|
2
|
+
export { aL as BrowserLogEntry, X as BrowserLogger, B as BrowserLoggerOption, Y as BrowserRequestError, Z as CheckoutController, _ as CheckoutControllerOptions, l as CheckoutSnapshot, i as CheckoutState, aM as CopyInvoiceOptions, aN as GuestCheckoutResumeController, aO as GuestCheckoutResumeOptions, aP as OpenWalletOptions, aQ as PrepareCheckoutOptions, aR as QrOptions, aS as RequestCheckoutOptions, ak as Status, aT as StatusInvoiceLike, U as UnixSeconds, an as copyInvoice, ap as createCheckoutController, aU as createGuestCheckoutResume, aV as createGuestOrderFetcher, aW as createLightningUri, aX as createQrPngDataUrl, au as createQrSvg, ay as deriveStatus, az as enterCheckoutResumePath, aH as openWallet, aI as prepareCheckout, aJ as requestCheckout } from './status-D3VhJsUp.js';
|
|
3
3
|
import '@openreceive/provider-data';
|
|
4
4
|
import '@openreceive/core';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -312,6 +312,11 @@ interface CopyInvoiceOptions {
|
|
|
312
312
|
}
|
|
313
313
|
interface OpenWalletOptions {
|
|
314
314
|
invoice: string;
|
|
315
|
+
/**
|
|
316
|
+
* Where to send the `lightning:` URI. Omitted, {@link openWallet} calls
|
|
317
|
+
* `location.assign` on the CURRENT window, which navigates the payer off a
|
|
318
|
+
* still-polling checkout on any device that has a handler registered.
|
|
319
|
+
*/
|
|
315
320
|
open?: (uri: string) => void;
|
|
316
321
|
logger?: BrowserLoggerOption;
|
|
317
322
|
logContext?: BrowserLogContext;
|
|
@@ -385,17 +390,61 @@ interface SwapFeeBreakdown {
|
|
|
385
390
|
/** The fee as a percentage of the cart total, e.g. "5.9%", when computable. */
|
|
386
391
|
readonly feePercent?: string;
|
|
387
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* How a deposit on this rail can actually go missing, which is what decides how
|
|
395
|
+
* loud the deposit panel should be.
|
|
396
|
+
*
|
|
397
|
+
* The exposure comes from the deposit ADDRESS failing to pin the chain or the
|
|
398
|
+
* asset, never from whether the coin is native:
|
|
399
|
+
*
|
|
400
|
+
* - `chain_ambiguous` — the address is byte-identical on other chains, so a
|
|
401
|
+
* withdrawal can land somewhere unreachable. Every EVM rail (`ETH_ETH`,
|
|
402
|
+
* `USDT_ETH`, `USDC_ETH`): a `0x…` address is the same string on Ethereum,
|
|
403
|
+
* Arbitrum, Optimism, Base, BSC and Polygon and carries nothing that says
|
|
404
|
+
* which. A rail whose network OpenReceive cannot classify is reported here
|
|
405
|
+
* too — an unrecognized format has no rule proving it is safe.
|
|
406
|
+
* - `asset_only` — the address format pins the chain, but the asset is a token
|
|
407
|
+
* on it, and every exchange's withdrawal dropdown offers that ticker on a
|
|
408
|
+
* dozen networks (`USDT_TRON`).
|
|
409
|
+
* - `pinned` — the address format pins the chain AND the asset is that chain's
|
|
410
|
+
* native coin, so neither mistake is reachable (`SOL_SOL`). Sending an SPL
|
|
411
|
+
* token to a Solana address still will not credit the order, so the panel
|
|
412
|
+
* still states the exact amount — it just does not shout about lost funds.
|
|
413
|
+
*
|
|
414
|
+
* `chain_ambiguous` and `asset_only` both warrant the full alarm; they are kept
|
|
415
|
+
* apart because they are different mistakes and a custom UI may want to say so.
|
|
416
|
+
* Note the counter-intuitive half: `ETH_ETH` is a NATIVE coin and needs the
|
|
417
|
+
* alarm most of anything on the list.
|
|
418
|
+
*/
|
|
419
|
+
type SwapDepositRisk = "chain_ambiguous" | "asset_only" | "pinned";
|
|
388
420
|
interface SwapDisplayModel {
|
|
389
421
|
readonly provider: string;
|
|
390
422
|
readonly attemptId: string;
|
|
391
423
|
readonly payInAsset: string;
|
|
392
424
|
readonly assetLabel: string;
|
|
393
425
|
readonly networkLabel: string;
|
|
394
|
-
/**
|
|
426
|
+
/**
|
|
427
|
+
* Which of the two ways a deposit is lost is reachable on this rail. Drives
|
|
428
|
+
* `networkWarningTitle`/`networkWarning` below, and is exposed so a custom UI
|
|
429
|
+
* can pick its own chrome without re-deriving the asset table. See
|
|
430
|
+
* {@link SwapDepositRisk}.
|
|
431
|
+
*/
|
|
432
|
+
readonly depositRisk: SwapDepositRisk;
|
|
433
|
+
/**
|
|
434
|
+
* Deposit-panel heading. A strong alert ("Wrong currency or network = lost
|
|
435
|
+
* funds") when `depositRisk` is anything but `pinned`, and a quiet
|
|
436
|
+
* "Send the exact amount" when it is. A banner shown on every rail is read on
|
|
437
|
+
* none, and the rails where it is load-bearing are the ones that pay for it.
|
|
438
|
+
*/
|
|
395
439
|
readonly networkWarningTitle: string;
|
|
396
440
|
/** Exact amount + asset + network to emphasize, e.g. "15.01 USDT on the Solana network". */
|
|
397
441
|
readonly networkWarningEmphasis: string;
|
|
398
|
-
/**
|
|
442
|
+
/**
|
|
443
|
+
* Full plain-text network warning (accessible / non-HTML consumers). The
|
|
444
|
+
* lost-funds sentence is present only when `depositRisk` is not `pinned`; the
|
|
445
|
+
* "pay with one method only" sentence is on every rail, because double-paying
|
|
446
|
+
* is reachable on all of them.
|
|
447
|
+
*/
|
|
399
448
|
readonly networkWarning: string;
|
|
400
449
|
readonly depositAddress: string;
|
|
401
450
|
readonly depositMemo?: string;
|
|
@@ -828,6 +877,13 @@ interface WizardProviderDisplay {
|
|
|
828
877
|
readonly kind: string;
|
|
829
878
|
readonly url: string;
|
|
830
879
|
readonly icon: string;
|
|
880
|
+
/**
|
|
881
|
+
* The packaged path the icon came from (`assets/provider-icons/strike.png`).
|
|
882
|
+
* `icon` is only loadable when the host's bundler resolved it; this is the
|
|
883
|
+
* key a host that serves the files itself maps, without going back to
|
|
884
|
+
* `providerRegistry` for `icon_path`.
|
|
885
|
+
*/
|
|
886
|
+
readonly iconPath: string;
|
|
831
887
|
readonly tutorials: readonly WizardProviderTutorialDisplay[];
|
|
832
888
|
readonly copyLabel: string;
|
|
833
889
|
readonly copiedLabel: string;
|
|
@@ -901,6 +957,23 @@ declare function createQrSvg(invoice: string, options?: QrOptions): Promise<stri
|
|
|
901
957
|
declare function createQrPayloadSvg(payload: string, options?: QrOptions): Promise<string>;
|
|
902
958
|
declare function createQrPngDataUrl(invoice: string, options?: QrOptions): Promise<string>;
|
|
903
959
|
declare function copyInvoice(options: CopyInvoiceOptions): Promise<void>;
|
|
960
|
+
/**
|
|
961
|
+
* Hand the invoice to the payer's wallet as a `lightning:` URI, and return the
|
|
962
|
+
* URI. **Touch devices.**
|
|
963
|
+
*
|
|
964
|
+
* The default path is `location.assign` on the CURRENT window — the right
|
|
965
|
+
* primitive for a custom-scheme deep link on a phone, and the wrong thing
|
|
966
|
+
* anywhere else. With no registered `lightning:` handler the call does nothing
|
|
967
|
+
* visible; with one, it navigates the payer off a checkout that is still
|
|
968
|
+
* polling `/payments/check`. Pass `open` to route the URI somewhere that is not
|
|
969
|
+
* the checkout window.
|
|
970
|
+
*
|
|
971
|
+
* This is why the shipped `<Checkout>` renders no wallet button of its own and
|
|
972
|
+
* exposes `components.OpenWalletButton` as an opt-in slot instead: a desktop
|
|
973
|
+
* payer is never sent to a handler that does not exist, next to the QR code
|
|
974
|
+
* that IS the desktop payment path. A custom UI drawing its own button owns
|
|
975
|
+
* that decision — see docs/guides/headless-checkout.md.
|
|
976
|
+
*/
|
|
904
977
|
declare function openWallet(options: OpenWalletOptions): string;
|
|
905
978
|
|
|
906
979
|
declare function createCheckoutController(options: CheckoutControllerOptions): CheckoutController;
|
|
@@ -998,4 +1071,4 @@ declare function deriveStatus(invoice: StatusInvoiceLike, options?: {
|
|
|
998
1071
|
readonly now?: UnixSeconds;
|
|
999
1072
|
}): Status;
|
|
1000
1073
|
|
|
1001
|
-
export { type
|
|
1074
|
+
export { type CheckoutPhase as $, type ThemeToggleElementAttributeOptions as A, type BrowserLoggerOption as B, type CheckoutInvoiceSnapshot as C, type ThemeToggleElementAttributes as D, type StoredThemeModelOptions as E, type ThemeModel as F, type ThemeModelOptions as G, type ReadThemePreferenceOptions as H, type ThemeControlTargets as I, type ThemeStorageOptions as J, type PaymentWizardControllerOptions as K, type PaymentWizardController as L, type PaymentWizardSelection as M, type PaymentWizardModel as N, type WizardRouteDisplay as O, type ParseOpenReceiveOptionalIntegerOptions as P, type PaymentWizardSelectionAction as Q, type ResolvedTheme as R, type SwapDisplayModel as S, type ThemePreference as T, type UnixSeconds as U, type BrowserLogContext as V, type WizardRouteAssetDisplay as W, type BrowserLogger as X, BrowserRequestError as Y, type CheckoutController as Z, type CheckoutControllerOptions as _, type PaymentMethod as a, type CheckoutStatusRefresh as a0, OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES as a1, OPENRECEIVE_CHECKOUT_DATA_SELECTORS as a2, OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES as a3, OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS as a4, OPENRECEIVE_CHECKOUT_ELEMENT_PARTS as a5, OPENRECEIVE_CHECKOUT_ELEMENT_PART_SELECTORS as a6, OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME as a7, OPENRECEIVE_COPY_FEEDBACK_MS as a8, OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS as a9, escapeHtml as aA, formatAmountCaption as aB, formatDepositAmount as aC, formatFiatAmount as aD, formatMsats as aE, formatSwapLimit as aF, formatUnixTime as aG, openWallet as aH, prepareCheckout as aI, requestCheckout as aJ, type BrowserLogLevel as aK, type BrowserLogEntry as aL, type CopyInvoiceOptions as aM, type GuestCheckoutResumeController as aN, type GuestCheckoutResumeOptions as aO, type OpenWalletOptions as aP, type PrepareCheckoutOptions as aQ, type QrOptions as aR, type RequestCheckoutOptions as aS, type StatusInvoiceLike as aT, createGuestCheckoutResume as aU, createGuestOrderFetcher as aV, createLightningUri as aW, createQrPngDataUrl as aX, OPENRECEIVE_DEFAULT_PREFIX as aa, OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES as ab, OPENRECEIVE_PAYMENT_WIZARD_SELECTORS as ac, OPENRECEIVE_THEME_STORAGE_KEY as ad, OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES as ae, OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS as af, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PARTS as ag, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PART_SELECTORS as ah, OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME as ai, type QrEncoder as aj, type Status as ak, type WizardProviderDisplay as al, assertDisplayInvoice as am, copyInvoice as an, createCheckoutActionEvent as ao, createCheckoutController as ap, createCheckoutErrorEvent as aq, createCheckoutProviderCopyEvent as ar, createCheckoutStateEvent as as, createQrPayloadSvg as at, createQrSvg as au, createStatusFetcher as av, createThemeChangeEvent as aw, deriveCheckoutStateLabels as ax, deriveStatus as ay, enterCheckoutResumePath as az, type PaymentMethodOption as b, type TickingValueOptions as c, type TickingValueController as d, type TransientFeedbackOptions as e, type TransientFeedbackController as f, type SwapDepositRisk as g, type CheckoutInvoiceSwapSnapshot as h, type CheckoutState as i, type TransactionDetailsInput as j, type TransactionDetailRow as k, type CheckoutSnapshot as l, type CreateCheckoutStateOptions as m, type CheckoutStatusModelInput as n, type CheckoutStatusModel as o, type CheckoutPaymentMethod as p, type ThemeAttributeTarget as q, type CheckoutElementAttributes as r, type CheckoutElementAttributeOptions as s, type CheckoutElementEventHandlers as t, type CheckoutElementListeners as u, type CreateCheckoutShellOptions as v, type CheckoutShellElements as w, type CheckoutShellOptions as x, type CheckoutShellModel as y, type CreateOpenReceiveThemeToggleElementOptions as z };
|