@openreceive/browser 0.3.2 → 0.4.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/dist/headless.js CHANGED
@@ -70,10 +70,13 @@ import {
70
70
  formatUnixTime,
71
71
  getExplorerNetwork,
72
72
  getNetworkIcon,
73
+ getNetworkIconId,
73
74
  getPaymentMethodIcon,
75
+ getPaymentMethodIconId,
74
76
  getRouteIconPath,
75
77
  getRouteNetworkLabel,
76
78
  getSwapOptionIcon,
79
+ getSwapOptionIconId,
77
80
  getSwapRefundFormError,
78
81
  getWizardEmptyMessage,
79
82
  isPaidCheckoutSnapshot,
@@ -96,6 +99,7 @@ import {
96
99
  parseThemePreference,
97
100
  paymentAccentId,
98
101
  paymentIconPaths,
102
+ paymentIconSvgs,
99
103
  paymentIconUrls,
100
104
  paymentMethods,
101
105
  postJson,
@@ -115,7 +119,7 @@ import {
115
119
  swapOptionLimitSentence,
116
120
  swapPickerKey,
117
121
  updatePaymentWizardSelection
118
- } from "./chunk-D4S2GCC4.js";
122
+ } from "./chunk-64ROVMMY.js";
119
123
 
120
124
  // src/headless.ts
121
125
  import { createAssetBaseUrlResolver, getPaymentWizardRoutes } from "@openreceive/provider-data";
@@ -328,7 +332,7 @@ function getNextThemePreference(theme, options = {}) {
328
332
  return resolveTheme(theme, options) === "dark" ? "light" : "dark";
329
333
  }
330
334
  function getThemeToggleLabel(resolvedTheme) {
331
- return `${resolvedTheme} mode`;
335
+ return `switch to ${resolvedTheme === "dark" ? "light" : "dark"} mode`;
332
336
  }
333
337
  function createThemeModel(theme, options = {}) {
334
338
  const resolvedTheme = resolveTheme(theme, options);
@@ -688,11 +692,14 @@ export {
688
692
  formatUnixTime,
689
693
  getExplorerNetwork,
690
694
  getNetworkIcon,
695
+ getNetworkIconId,
691
696
  getPaymentMethodIcon,
697
+ getPaymentMethodIconId,
692
698
  getPaymentWizardRoutes,
693
699
  getRouteIconPath,
694
700
  getRouteNetworkLabel,
695
701
  getSwapOptionIcon,
702
+ getSwapOptionIconId,
696
703
  getSwapRefundFormError,
697
704
  getWizardEmptyMessage,
698
705
  isReusableLightningInvoice,
@@ -713,6 +720,7 @@ export {
713
720
  parseThemePreference,
714
721
  paymentAccentId,
715
722
  paymentIconPaths,
723
+ paymentIconSvgs,
716
724
  paymentIconUrls,
717
725
  paymentMethods,
718
726
  postJson,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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';
1
+ import { aT as BrowserLogLevel } from './status-CzIEJWjS.js';
2
+ export { aU as BrowserLogEntry, X as BrowserLogger, B as BrowserLoggerOption, Y as BrowserRequestError, Z as CheckoutController, _ as CheckoutControllerOptions, h as CheckoutSnapshot, j as CheckoutState, aV as CopyInvoiceOptions, aW as GuestCheckoutResumeController, aX as GuestCheckoutResumeOptions, aY as OpenWalletOptions, aZ as PrepareCheckoutOptions, a_ as QrOptions, a$ as RequestCheckoutOptions, ao as Status, b0 as StatusInvoiceLike, U as UnixSeconds, at as copyInvoice, av as createCheckoutController, b1 as createGuestCheckoutResume, b2 as createGuestOrderFetcher, b3 as createLightningUri, b4 as createQrPngDataUrl, aA as createQrSvg, aG as deriveStatus, aH as enterCheckoutResumePath, aP as openWallet, aR as prepareCheckout, aS as requestCheckout } from './status-CzIEJWjS.js';
3
3
  import '@openreceive/provider-data';
4
4
  import '@openreceive/core';
5
5
 
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  openWallet,
14
14
  prepareCheckout,
15
15
  requestCheckout
16
- } from "./chunk-D4S2GCC4.js";
16
+ } from "./chunk-64ROVMMY.js";
17
17
  export {
18
18
  BrowserRequestError,
19
19
  copyInvoice,
@@ -1,6 +1,11 @@
1
1
  import { PaymentWizardRoute, AssetIndexEntry } from '@openreceive/provider-data';
2
2
  import { TransactionSettlementStatus } from '@openreceive/core';
3
3
 
4
+ declare const OPENRECEIVE_PAYMENT_ICON_IDS: readonly ["btc", "crypto", "eth", "lightning", "ltc", "sol", "trx", "usdc", "usdt", "xmr", "xrp"];
5
+ type PaymentIconId = (typeof OPENRECEIVE_PAYMENT_ICON_IDS)[number];
6
+ /** Each packaged payment icon as minified SVG markup, keyed by id. */
7
+ declare const paymentIconSvgs: Readonly<Record<PaymentIconId, string>>;
8
+
4
9
  /**
5
10
  * Trim insignificant trailing zeros from a decimal crypto amount for display,
6
11
  * e.g. "12.25900000" -> "12.259" and "5.000" -> "5". Only fractional digits are
@@ -282,9 +287,11 @@ declare const OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES: {
282
287
  * Vue/Svelte/Angular wrappers can reach it (a function cannot cross an HTML
283
288
  * attribute). Every packaged key is a relative path under one `assets/` root,
284
289
  * so the value is joined to it directly: `asset-base-url="/openreceive-assets"`
285
- * makes `assets/icons/btc.svg` load from
286
- * `/openreceive-assets/assets/icons/btc.svg`. A `resolveAssetUrl` passed to
287
- * `defineElements` wins over it.
290
+ * makes `assets/provider-icons/strike.png` load from
291
+ * `/openreceive-assets/assets/provider-icons/strike.png`. Only the provider
292
+ * images need it; the payment-method icons are compiled in and drawn inline
293
+ * unless a base URL is set, in which case they are served as files too. A
294
+ * `resolveAssetUrl` passed to `defineElements` wins over it.
288
295
  */
289
296
  readonly assetBaseUrl: "asset-base-url";
290
297
  /** `polling="false"` renders the snapshot without status polling (no POST /payments/check). */
@@ -1013,8 +1020,11 @@ interface WizardRouteAssetDisplay {
1013
1020
  readonly id: string;
1014
1021
  readonly label: string;
1015
1022
  readonly subtitle: string;
1023
+ /** The icon as a URL: the packaged `data:` URI, or the host resolver's answer. */
1016
1024
  readonly icon: string;
1017
- /** The packaged key behind `icon`, for a host serving the files itself. */
1025
+ /** The key behind `icon`, into `paymentIconSvgs` for a renderer drawing it inline. */
1026
+ readonly iconId: PaymentIconId;
1027
+ /** The packaged path behind `icon`, for a host serving the files itself. */
1018
1028
  readonly iconPath: string;
1019
1029
  readonly selected: boolean;
1020
1030
  }
@@ -1281,4 +1291,4 @@ declare function deriveStatus(invoice: StatusInvoiceLike, options?: {
1281
1291
  readonly now?: UnixSeconds;
1282
1292
  }): Status;
1283
1293
 
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 };
1294
+ 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 PaymentIconId 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 ParseOpenReceiveOptionalIntegerOptions as a, type RequestCheckoutOptions 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_SLOTS as a7, OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME as a8, OPENRECEIVE_COPY_FEEDBACK_MS as a9, createQrSvg as aA, createQrSvgController as aB, createStatusFetcher as aC, createThemeChangeEvent as aD, currentCheckoutUrl as aE, deriveCheckoutStateLabels as aF, deriveStatus as aG, enterCheckoutResumePath as aH, escapeHtml as aI, formatAmountCaption as aJ, formatDepositAmount as aK, formatFiatAmount as aL, formatMsats as aM, formatSwapLimit as aN, formatUnixTime as aO, openWallet as aP, paymentIconSvgs as aQ, prepareCheckout as aR, requestCheckout as aS, type BrowserLogLevel as aT, type BrowserLogEntry as aU, type CopyInvoiceOptions as aV, type GuestCheckoutResumeController as aW, type GuestCheckoutResumeOptions as aX, type OpenWalletOptions as aY, type PrepareCheckoutOptions as aZ, type QrOptions as a_, OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS as aa, OPENRECEIVE_DEFAULT_PREFIX as ab, OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES as ac, OPENRECEIVE_PAYMENT_WIZARD_SELECTORS as ad, OPENRECEIVE_PROVIDER_PREVIEW_LIMIT as ae, OPENRECEIVE_THEME_STORAGE_KEY as af, OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES as ag, OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS as ah, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PARTS as ai, OPENRECEIVE_THEME_TOGGLE_ELEMENT_PART_SELECTORS as aj, OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME as ak, type QrEncoder as al, type QrSvgController as am, type QrSvgControllerOptions as an, type Status as ao, type SwapCopyRow as ap, type SwapRefundStaging as aq, type WizardProviderDisplay as ar, assertDisplayInvoice as as, copyInvoice as at, createCheckoutActionEvent as au, createCheckoutController as av, createCheckoutErrorEvent as aw, createCheckoutProviderCopyEvent as ax, createCheckoutStateEvent as ay, createQrPayloadSvg as az, type PaymentMethod as b, type StatusInvoiceLike as b0, createGuestCheckoutResume as b1, createGuestOrderFetcher as b2, createLightningUri as b3, createQrPngDataUrl as b4, type PaymentMethodOption as c, type TickingValueOptions as d, type TickingValueController as e, type TransientFeedbackOptions as f, type TransientFeedbackController as g, type CheckoutSnapshot as h, type SwapDepositRisk as i, type CheckoutState as j, type TransactionDetailsInput as k, type TransactionDetailRow 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 };