@openreceive/browser 0.3.3 → 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/README.md CHANGED
@@ -25,39 +25,21 @@ will move without notice.
25
25
 
26
26
  ## Icon assets
27
27
 
28
- The checkout UI (used directly or via `@openreceive/react` /
29
- `@openreceive/elements`) loads its payment-method icons from
30
- `dist/assets/icons/*.svg` **by URL at runtime** — the SVGs are not inlined into
31
- the JS. Each URL is resolved with `new URL()` against the module's own
32
- `import.meta.url`:
33
-
34
- - module emitted as `…/assets/<chunk>.js` (typical Vite/Rollup output) →
35
- icons resolve to a sibling `…/assets/icons/*.svg`;
36
- - any other module URL → `./assets/icons/*.svg` next to the module file.
37
-
38
- Bundlers do not follow these dynamic URLs, so your app must serve the icon
39
- files where the resolution lands. Per setup:
40
-
41
- - **Plain `<script type="module">` / import map**: serve the package's `dist/`
42
- directory as-is (e.g. `/vendor/openreceive/dist/index.js`). The icons already
43
- sit at `dist/assets/icons/`, so nothing to copy.
44
- - **Vite / Rollup**: chunks are emitted under `assets/`, so serve the icons at
45
- `assets/icons/` in the same output — either copy
46
- `node_modules/@openreceive/browser/dist/assets/icons` into
47
- `public/assets/icons/`, or copy it into the build output from a small
48
- `writeBundle` plugin (the repo demos use
49
- `examples/buttons/shared/copy-openreceive-payment-icons-plugin.ts`).
50
- - **webpack / Next.js**: copy the icons next to your emitted bundles with
51
- `copy-webpack-plugin` (the repo's Rails Shakapacker demo copies
52
- `node_modules/@openreceive/browser/dist/assets/icons` to
53
- `<packs output>/js/assets/icons`). Note webpack can compile `import.meta.url`
54
- to a build-machine `file://` URL; always confirm the URLs the page actually
55
- requests (see below) and place — or serve — the icons at that path.
56
-
57
- To verify a setup, check the DevTools network panel for `…/icons/*.svg`
58
- requests, or log `paymentIconUrls` (exported from
59
- `@openreceive/browser/headless`) to see every resolved URL.
60
-
61
- `@openreceive/provider-data` follows the same contract for its runtime images
62
- (`dist/assets/provider-icons`, `dist/assets/pay_tutorials`); the copy recipes
63
- above handle those directories the same way.
28
+ The payment-method icons (`btc`, `lightning`, `usdt`, …) are compiled into
29
+ this package's JavaScript — nothing to copy, serve, or configure, under any
30
+ bundler:
31
+
32
+ - The custom element (`@openreceive/elements`, and the Vue/Svelte/Angular
33
+ wrappers over it) draws them inline in its shadow root from
34
+ `paymentIconSvgs`.
35
+ - Everything that wants a URL — `@openreceive/react`, the display models,
36
+ `getPaymentMethodIcon` and friends, your own `<img>` — gets the same icons
37
+ from `paymentIconUrls` as `data:image/svg+xml` URIs. If your
38
+ Content-Security-Policy `img-src` forbids `data:`, allow it, or pass
39
+ `assetBaseUrl` / `resolveAssetUrl` and the icons are served as files
40
+ instead (`dist/assets/icons/*.svg` still ships, keyed by
41
+ `paymentIconPaths`).
42
+
43
+ `@openreceive/provider-data`'s wallet logos and pay tutorials are files
44
+ (PNG/WebP) your host serves; see
45
+ [docs/guides/provider-registry.md](../../../docs/guides/provider-registry.md#assets).
@@ -181,9 +181,11 @@ var OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES = {
181
181
  * Vue/Svelte/Angular wrappers can reach it (a function cannot cross an HTML
182
182
  * attribute). Every packaged key is a relative path under one `assets/` root,
183
183
  * so the value is joined to it directly: `asset-base-url="/openreceive-assets"`
184
- * makes `assets/icons/btc.svg` load from
185
- * `/openreceive-assets/assets/icons/btc.svg`. A `resolveAssetUrl` passed to
186
- * `defineElements` wins over it.
184
+ * makes `assets/provider-icons/strike.png` load from
185
+ * `/openreceive-assets/assets/provider-icons/strike.png`. Only the provider
186
+ * images need it; the payment-method icons are compiled in and drawn inline
187
+ * unless a base URL is set, in which case they are served as files too. A
188
+ * `resolveAssetUrl` passed to `defineElements` wins over it.
187
189
  */
188
190
  assetBaseUrl: "asset-base-url",
189
191
  /** `polling="false"` renders the snapshot without status polling (no POST /payments/check). */
@@ -198,8 +200,7 @@ var OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES = {
198
200
  storageKey: "storage-key"
199
201
  };
200
202
 
201
- // src/internal/icons.ts
202
- import { lazyAssetUrlTable, warnOnFileAssetUrl } from "@openreceive/provider-data";
203
+ // src/generated/payment-icon-svgs.ts
203
204
  var OPENRECEIVE_PAYMENT_ICON_IDS = [
204
205
  "btc",
205
206
  "crypto",
@@ -213,33 +214,34 @@ var OPENRECEIVE_PAYMENT_ICON_IDS = [
213
214
  "xmr",
214
215
  "xrp"
215
216
  ];
217
+ var paymentIconSvgs = Object.freeze({
218
+ btc: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g fill="none" fill-rule="evenodd"><circle cx="16" cy="16" r="16" fill="#F7931A"/><path fill="#FFF" fill-rule="nonzero" d="M23.189 14.02c.314-2.096-1.283-3.223-3.465-3.975l.708-2.84-1.728-.43-.69 2.765c-.454-.114-.92-.22-1.385-.326l.695-2.783L15.596 6l-.708 2.839c-.376-.086-.746-.17-1.104-.26l.002-.009-2.384-.595-.46 1.846s1.283.294 1.256.312c.7.175.826.638.805 1.006l-.806 3.235c.048.012.11.03.18.057l-.183-.045-1.13 4.532c-.086.212-.303.531-.793.41.018.025-1.256-.313-1.256-.313l-.858 1.978 2.25.561c.418.105.828.215 1.231.318l-.715 2.872 1.727.43.708-2.84c.472.127.93.245 1.378.357l-.706 2.828 1.728.43.715-2.866c2.948.558 5.164.333 6.097-2.333.752-2.146-.037-3.385-1.588-4.192 1.13-.26 1.98-1.003 2.207-2.538zm-3.95 5.538c-.533 2.147-4.148.986-5.32.695l.95-3.805c1.172.293 4.929.872 4.37 3.11zm.535-5.569c-.487 1.953-3.495.96-4.47.717l.86-3.45c.975.243 4.118.696 3.61 2.733z"/></g></svg>',
219
+ crypto: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Crypto"><defs><linearGradient id="crypto-g" x1="8" x2="56" y1="8" y2="56" gradientUnits="userSpaceOnUse"><stop stop-color="#A78BFA"/><stop offset=".5" stop-color="#06B6D4"/><stop offset="1" stop-color="#22C55E"/></linearGradient></defs><rect width="64" height="64" rx="16" fill="#F5F3FF"/><path fill="url(#crypto-g)" d="M31.8 9 50 19.5v21L31.8 51 14 40.5v-21L31.8 9Z"/><path fill="#FFFFFF" fill-opacity=".92" d="m32 17 10.8 6.2v12.5L32 42l-10.8-6.3V23.2L32 17Zm0 6.8-5 2.9v5.8l5 2.9 5-2.9v-5.8l-5-2.9Z"/></svg>',
220
+ eth: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g fill="none" fill-rule="evenodd"><circle cx="16" cy="16" r="16" fill="#627EEA"/><g fill="#FFF" fill-rule="nonzero"><path fill-opacity=".602" d="M16.498 4v8.87l7.497 3.35z"/><path d="M16.498 4L9 16.22l7.498-3.35z"/><path fill-opacity=".602" d="M16.498 21.968v6.027L24 17.616z"/><path d="M16.498 27.995v-6.028L9 17.616z"/><path fill-opacity=".2" d="M16.498 20.573l7.497-4.353-7.497-3.348z"/><path fill-opacity=".602" d="M9 16.22l7.498 4.353v-7.701z"/></g></g></svg>',
221
+ lightning: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" role="img" aria-label="Lightning"><defs><linearGradient id="ln-g" x1="18" x2="46" y1="8" y2="58" gradientUnits="userSpaceOnUse"><stop stop-color="#FDE047"/><stop offset=".55" stop-color="#F59E0B"/><stop offset="1" stop-color="#EA580C"/></linearGradient></defs><rect width="64" height="64" rx="16" fill="#FFFBEB"/><path fill="url(#ln-g)" d="M37.6 7 17 36h13.6L26.4 57 47 28H33.3L37.6 7Z"/></svg>',
222
+ ltc: '<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="none" fill-rule="evenodd"><circle cx="16" cy="16" r="16" fill="#BFBBBB"/><path fill="#FFF" d="M10.427 19.214L9 19.768l.688-2.759 1.444-.58L13.213 8h5.129l-1.519 6.196 1.41-.571-.68 2.75-1.427.571-.848 3.483H23L22.127 24H9.252z"/></g></svg>',
223
+ sol: '<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><g fill="none"><circle fill="#66F9A1" cx="16" cy="16" r="16"/><path d="M9.925 19.687a.59.59 0 01.415-.17h14.366a.29.29 0 01.207.497l-2.838 2.815a.59.59 0 01-.415.171H7.294a.291.291 0 01-.207-.498l2.838-2.815zm0-10.517A.59.59 0 0110.34 9h14.366c.261 0 .392.314.207.498l-2.838 2.815a.59.59 0 01-.415.17H7.294a.291.291 0 01-.207-.497L9.925 9.17zm12.15 5.225a.59.59 0 00-.415-.17H7.294a.291.291 0 00-.207.498l2.838 2.815c.11.109.26.17.415.17h14.366a.291.291 0 00.207-.498l-2.838-2.815z" fill="#FFF"/></g></svg>',
224
+ trx: '<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><g fill="none"><circle fill="#EF0027" cx="16" cy="16" r="16"/><path d="M21.932 9.913L7.5 7.257l7.595 19.112 10.583-12.894-3.746-3.562zm-.232 1.17l2.208 2.099-6.038 1.093 3.83-3.192zm-5.142 2.973l-6.364-5.278 10.402 1.914-4.038 3.364zm-.453.934l-1.038 8.58L9.472 9.487l6.633 5.502zm.96.455l6.687-1.21-7.67 9.343.983-8.133z" fill="#FFF"/></g></svg>',
225
+ usdc: '<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><g fill="none"><circle fill="#3E73C4" cx="16" cy="16" r="16"/><g fill="#FFF"><path d="M20.022 18.124c0-2.124-1.28-2.852-3.84-3.156-1.828-.243-2.193-.728-2.193-1.578 0-.85.61-1.396 1.828-1.396 1.097 0 1.707.364 2.011 1.275a.458.458 0 00.427.303h.975a.416.416 0 00.427-.425v-.06a3.04 3.04 0 00-2.743-2.489V9.142c0-.243-.183-.425-.487-.486h-.915c-.243 0-.426.182-.487.486v1.396c-1.829.242-2.986 1.456-2.986 2.974 0 2.002 1.218 2.791 3.778 3.095 1.707.303 2.255.668 2.255 1.639 0 .97-.853 1.638-2.011 1.638-1.585 0-2.133-.667-2.316-1.578-.06-.242-.244-.364-.427-.364h-1.036a.416.416 0 00-.426.425v.06c.243 1.518 1.219 2.61 3.23 2.914v1.457c0 .242.183.425.487.485h.915c.243 0 .426-.182.487-.485V21.34c1.829-.303 3.047-1.578 3.047-3.217z"/><path d="M12.892 24.497c-4.754-1.7-7.192-6.98-5.424-11.653.914-2.55 2.925-4.491 5.424-5.402.244-.121.365-.303.365-.607v-.85c0-.242-.121-.424-.365-.485-.061 0-.183 0-.244.06a10.895 10.895 0 00-7.13 13.717c1.096 3.4 3.717 6.01 7.13 7.102.244.121.488 0 .548-.243.061-.06.061-.122.061-.243v-.85c0-.182-.182-.424-.365-.546zm6.46-18.936c-.244-.122-.488 0-.548.242-.061.061-.061.122-.061.243v.85c0 .243.182.485.365.607 4.754 1.7 7.192 6.98 5.424 11.653-.914 2.55-2.925 4.491-5.424 5.402-.244.121-.365.303-.365.607v.85c0 .242.121.424.365.485.061 0 .183 0 .244-.06a10.895 10.895 0 007.13-13.717c-1.096-3.46-3.778-6.07-7.13-7.162z"/></g></g></svg>',
226
+ usdt: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g fill="none" fill-rule="evenodd"><circle cx="16" cy="16" r="16" fill="#26A17B"/><path fill="#FFF" d="M17.922 17.383v-.002c-.11.008-.677.042-1.942.042-1.01 0-1.721-.03-1.971-.042v.003c-3.888-.171-6.79-.848-6.79-1.658 0-.809 2.902-1.486 6.79-1.66v2.644c.254.018.982.061 1.988.061 1.207 0 1.812-.05 1.925-.06v-2.643c3.88.173 6.775.85 6.775 1.658 0 .81-2.895 1.485-6.775 1.657m0-3.59v-2.366h5.414V7.819H8.595v3.608h5.414v2.365c-4.4.202-7.709 1.074-7.709 2.118 0 1.044 3.309 1.915 7.709 2.118v7.582h3.913v-7.584c4.393-.202 7.694-1.073 7.694-2.116 0-1.043-3.301-1.914-7.694-2.117"/></g></svg>',
227
+ xmr: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><g fill="none" fill-rule="evenodd"><circle cx="16" cy="16" r="16" fill="#F60"/><path fill="#FFF" fill-rule="nonzero" d="M15.97 5.235c5.985 0 10.825 4.84 10.825 10.824a11.07 11.07 0 01-.558 3.432h-3.226v-9.094l-7.04 7.04-7.04-7.04v9.094H5.704a11.07 11.07 0 01-.557-3.432c0-5.984 4.84-10.824 10.824-10.824zM14.358 19.02L16 20.635l1.613-1.614 3.051-3.08v5.72h4.547a10.806 10.806 0 01-9.24 5.192c-3.902 0-7.334-2.082-9.24-5.192h4.546v-5.72l3.08 3.08z"/></g></svg>',
228
+ xrp: '<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"><g fill="none"><circle cx="16" cy="16" r="16" fill="#23292F"/><path d="M23.07 8h2.89l-6.015 5.957a5.621 5.621 0 01-7.89 0L6.035 8H8.93l4.57 4.523a3.556 3.556 0 004.996 0L23.07 8zM8.895 24.563H6l6.055-5.993a5.621 5.621 0 017.89 0L26 24.562h-2.895L18.5 20a3.556 3.556 0 00-4.996 0l-4.61 4.563z" fill="#FFF"/></g></svg>'
229
+ });
230
+
231
+ // src/internal/icons.ts
216
232
  var PACKAGED_ICON_PREFIX = "assets/icons/";
217
- var moduleUrl = typeof import.meta.url === "string" && import.meta.url.length > 0 ? import.meta.url : fileUrlFromPath(__filename);
218
- function fileUrlFromPath(path) {
219
- const normalized = path.replace(/\\/g, "/");
220
- const absolute = normalized.startsWith("/") ? normalized : `/${normalized}`;
221
- return `file://${encodeURI(absolute).replace(/#/g, "%23").replace(/\?/g, "%3F")}`;
222
- }
223
- function paymentIconRoot() {
224
- if (moduleUrl.includes("/src/internal/")) return "../assets/icons/";
225
- try {
226
- const { pathname } = new URL(moduleUrl);
227
- if (/\/assets\/[^/]+\.js$/i.test(pathname)) return "./icons/";
228
- } catch {
229
- }
230
- return "./assets/icons/";
231
- }
232
- function paymentIconUrl(file) {
233
- const resolved = new URL(`${paymentIconRoot()}${file}`, moduleUrl).href;
234
- warnOnFileAssetUrl(`${PACKAGED_ICON_PREFIX}${file}`, resolved);
235
- return resolved;
236
- }
237
- var paymentIconPaths = Object.fromEntries(
238
- OPENRECEIVE_PAYMENT_ICON_IDS.map((id) => [id, `${PACKAGED_ICON_PREFIX}${id}.svg`])
233
+ var paymentIconPaths = Object.freeze(
234
+ Object.fromEntries(
235
+ OPENRECEIVE_PAYMENT_ICON_IDS.map((id) => [id, `${PACKAGED_ICON_PREFIX}${id}.svg`])
236
+ )
239
237
  );
240
- var paymentIconUrls = lazyAssetUrlTable(
241
- OPENRECEIVE_PAYMENT_ICON_IDS,
242
- (id) => paymentIconUrl(`${id}.svg`)
238
+ function svgDataUri(svg) {
239
+ return `data:image/svg+xml,${svg.replace(/[%#"<>&]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`)}`;
240
+ }
241
+ var paymentIconUrls = Object.freeze(
242
+ Object.fromEntries(
243
+ OPENRECEIVE_PAYMENT_ICON_IDS.map((id) => [id, svgDataUri(paymentIconSvgs[id])])
244
+ )
243
245
  );
244
246
  var paymentMethodIconIds = {
245
247
  bitcoin: "btc"
@@ -1378,12 +1380,14 @@ function getRouteNetworkLabel(routeId) {
1378
1380
  function createWizardRouteAssetDisplays(assets, options = {}) {
1379
1381
  return assets.map((asset) => {
1380
1382
  const id = asset.route ?? asset.symbol;
1383
+ const iconId = routeIconId(asset);
1381
1384
  return {
1382
1385
  id,
1383
1386
  label: asset.label,
1384
1387
  subtitle: getRouteNetworkLabel(id),
1385
- icon: getRouteIcon(asset, options.resolveAssetUrl),
1386
- iconPath: getRouteIconPath(asset),
1388
+ icon: resolvePaymentIcon(iconId, options.resolveAssetUrl),
1389
+ iconId,
1390
+ iconPath: paymentIconPaths[iconId],
1387
1391
  selected: options.selectedRoute === id
1388
1392
  };
1389
1393
  });
@@ -1423,21 +1427,30 @@ function createWizardProviderDisplay(entry, resolveAssetUrl) {
1423
1427
  openLabel: getCheckoutProviderOpenLabel()
1424
1428
  };
1425
1429
  }
1430
+ function getPaymentMethodIconId(method) {
1431
+ return paymentMethodIconIds[method];
1432
+ }
1426
1433
  function getPaymentMethodIcon(method, resolveAssetUrl) {
1427
- return resolvePaymentIcon(paymentMethodIconIds[method], resolveAssetUrl);
1434
+ return resolvePaymentIcon(getPaymentMethodIconId(method), resolveAssetUrl);
1428
1435
  }
1429
- function getAssetIcon(symbol, resolveAssetUrl) {
1430
- return resolvePaymentIcon(assetIconIds[symbol] ?? "crypto", resolveAssetUrl);
1436
+ function assetIconId(symbol) {
1437
+ return assetIconIds[symbol] ?? "crypto";
1431
1438
  }
1432
- function getNetworkIcon(networkLabel, resolveAssetUrl) {
1439
+ function getNetworkIconId(networkLabel) {
1433
1440
  const key = networkLabel.trim().toLowerCase();
1434
- if (key === "tron" || key === "trx") return resolvePaymentIcon("trx", resolveAssetUrl);
1435
- if (key === "solana" || key === "sol") return resolvePaymentIcon("sol", resolveAssetUrl);
1436
- if (key === "ethereum" || key === "eth") return resolvePaymentIcon("eth", resolveAssetUrl);
1437
- return resolvePaymentIcon("crypto", resolveAssetUrl);
1441
+ if (key === "tron" || key === "trx") return "trx";
1442
+ if (key === "solana" || key === "sol") return "sol";
1443
+ if (key === "ethereum" || key === "eth") return "eth";
1444
+ return "crypto";
1445
+ }
1446
+ function getNetworkIcon(networkLabel, resolveAssetUrl) {
1447
+ return resolvePaymentIcon(getNetworkIconId(networkLabel), resolveAssetUrl);
1448
+ }
1449
+ function getSwapOptionIconId(option) {
1450
+ return assetIconId(option.label.trim().toLowerCase());
1438
1451
  }
1439
1452
  function getSwapOptionIcon(option, resolveAssetUrl) {
1440
- return getAssetIcon(option.label.trim().toLowerCase(), resolveAssetUrl);
1453
+ return resolvePaymentIcon(getSwapOptionIconId(option), resolveAssetUrl);
1441
1454
  }
1442
1455
  function groupSwapOptionsByLabel(options) {
1443
1456
  const groups = [];
@@ -1797,16 +1810,13 @@ function getSwapRefundFormError(payInAsset, address, networkLabel) {
1797
1810
  if (address.length === 0) return "Enter a refund address.";
1798
1811
  return getSwapRefundAddressError(payInAsset, address, networkLabel);
1799
1812
  }
1800
- function getRouteIcon(asset, resolveAssetUrl) {
1801
- return resolvePaymentIcon(routeIconId(asset), resolveAssetUrl);
1802
- }
1803
1813
  function getRouteIconPath(asset) {
1804
1814
  return paymentIconPaths[routeIconId(asset)];
1805
1815
  }
1806
1816
  function routeIconId(asset) {
1807
1817
  const routeId = asset.route ?? asset.symbol;
1808
1818
  if (asset.symbol === "btc" && routeId.includes("lightning")) return "lightning";
1809
- return assetIconIds[asset.symbol] ?? "crypto";
1819
+ return assetIconId(asset.symbol);
1810
1820
  }
1811
1821
  function createPaymentWizardState(request) {
1812
1822
  const selectedRouteId = request.selectedMethod === "bitcoin" ? request.selectedBitcoinRoute ?? getDefaultBitcoinRoute() : null;
@@ -3675,6 +3685,7 @@ export {
3675
3685
  createThemeChangeEvent,
3676
3686
  OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES,
3677
3687
  OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES,
3688
+ paymentIconSvgs,
3678
3689
  paymentIconPaths,
3679
3690
  paymentIconUrls,
3680
3691
  orClasses,
@@ -3713,8 +3724,11 @@ export {
3713
3724
  getRouteNetworkLabel,
3714
3725
  createWizardRouteAssetDisplays,
3715
3726
  createWizardRouteDisplays,
3727
+ getPaymentMethodIconId,
3716
3728
  getPaymentMethodIcon,
3729
+ getNetworkIconId,
3717
3730
  getNetworkIcon,
3731
+ getSwapOptionIconId,
3718
3732
  getSwapOptionIcon,
3719
3733
  buildMethodGridEntries,
3720
3734
  swapPickerKey,
@@ -1,18 +1,15 @@
1
1
  import { AssetIndexEntry, AssetUrlResolver, PaymentWizardRoute } from '@openreceive/provider-data';
2
2
  export { AssetUrlResolver, PaymentWizardRoute, PaymentWizardRouteRequest, createAssetBaseUrlResolver, getPaymentWizardRoutes } from '@openreceive/provider-data';
3
- import { P as ParseOpenReceiveOptionalIntegerOptions, a as PaymentMethod, R as ResolvedTheme, T as ThemePreference, b as PaymentMethodOption, c as TickingValueOptions, d as TickingValueController, e as TransientFeedbackOptions, f as TransientFeedbackController, C as CheckoutInvoiceSnapshot, U as UnixSeconds, S as SwapDisplayModel, g as CheckoutSnapshot, h as SwapDepositRisk, i as CheckoutState, j as TransactionDetailsInput, k as TransactionDetailRow, l as CreateCheckoutStateOptions, m as CheckoutStatusModelInput, n as CheckoutStatusModel, o as CheckoutPaymentMethod, B as BrowserLoggerOption, p as ThemeAttributeTarget, q as CheckoutElementAttributes, r as CheckoutElementAttributeOptions, s as CheckoutElementEventHandlers, t as CheckoutElementListeners, u as CreateCheckoutShellOptions, v as CheckoutShellElements, w as CheckoutShellOptions, x as CheckoutShellModel, y as CreateOpenReceiveThemeToggleElementOptions, z as ThemeToggleElementAttributeOptions, A as ThemeToggleElementAttributes, D as StoredThemeModelOptions, E as ThemeModel, F as ThemeModelOptions, G as ReadThemePreferenceOptions, H as ThemeControlTargets, I as ThemeStorageOptions, J as PaymentWizardControllerOptions, K as PaymentWizardController, L as PaymentWizardSelection, M as PaymentWizardModel, W as WizardRouteAssetDisplay, N as WizardRouteDisplay, O as PaymentWizardSelectionAction } from './status-BMYd00Xn.js';
4
- export { Q as BrowserLogContext, V as BrowserLogger, X as BrowserRequestError, Y as CheckoutController, Z as CheckoutControllerOptions, _ as CheckoutPhase, $ as CheckoutStatusRefresh, a0 as OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES, a1 as OPENRECEIVE_CHECKOUT_DATA_SELECTORS, a2 as OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES, a3 as OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS, a4 as OPENRECEIVE_CHECKOUT_ELEMENT_PARTS, a5 as OPENRECEIVE_CHECKOUT_ELEMENT_PART_SELECTORS, a6 as OPENRECEIVE_CHECKOUT_ELEMENT_SLOTS, a7 as OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME, a8 as OPENRECEIVE_COPY_FEEDBACK_MS, a9 as OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS, aa as OPENRECEIVE_DEFAULT_PREFIX, ab as OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES, ac as OPENRECEIVE_PAYMENT_WIZARD_SELECTORS, ad as OPENRECEIVE_PROVIDER_PREVIEW_LIMIT, ae as OPENRECEIVE_THEME_STORAGE_KEY, af as OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES, ag as OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS, ah as OPENRECEIVE_THEME_TOGGLE_ELEMENT_PARTS, ai as OPENRECEIVE_THEME_TOGGLE_ELEMENT_PART_SELECTORS, aj as OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME, ak as QrEncoder, al as QrSvgController, am as QrSvgControllerOptions, an as Status, ao as SwapCopyRow, ap as SwapRefundStaging, aq as WizardProviderDisplay, ar as assertDisplayInvoice, as as copyInvoice, at as createCheckoutActionEvent, au as createCheckoutController, av as createCheckoutErrorEvent, aw as createCheckoutProviderCopyEvent, ax as createCheckoutStateEvent, ay as createQrPayloadSvg, az as createQrSvg, aA as createQrSvgController, aB as createStatusFetcher, aC as createThemeChangeEvent, aD as currentCheckoutUrl, aE as deriveCheckoutStateLabels, aF as deriveStatus, aG as enterCheckoutResumePath, aH as escapeHtml, aI as formatAmountCaption, aJ as formatDepositAmount, aK as formatFiatAmount, aL as formatMsats, aM as formatSwapLimit, aN as formatUnixTime, aO as openWallet, aP as prepareCheckout, aQ as requestCheckout } from './status-BMYd00Xn.js';
3
+ import { P as PaymentIconId, a as ParseOpenReceiveOptionalIntegerOptions, b as PaymentMethod, R as ResolvedTheme, T as ThemePreference, c as PaymentMethodOption, d as TickingValueOptions, e as TickingValueController, f as TransientFeedbackOptions, g as TransientFeedbackController, C as CheckoutInvoiceSnapshot, U as UnixSeconds, S as SwapDisplayModel, h as CheckoutSnapshot, i as SwapDepositRisk, j as CheckoutState, k as TransactionDetailsInput, l as TransactionDetailRow, m as CreateCheckoutStateOptions, n as CheckoutStatusModelInput, o as CheckoutStatusModel, p as CheckoutPaymentMethod, B as BrowserLoggerOption, q as ThemeAttributeTarget, r as CheckoutElementAttributes, s as CheckoutElementAttributeOptions, t as CheckoutElementEventHandlers, u as CheckoutElementListeners, v as CreateCheckoutShellOptions, w as CheckoutShellElements, x as CheckoutShellOptions, y as CheckoutShellModel, z as CreateOpenReceiveThemeToggleElementOptions, A as ThemeToggleElementAttributeOptions, D as ThemeToggleElementAttributes, E as StoredThemeModelOptions, F as ThemeModel, G as ThemeModelOptions, H as ReadThemePreferenceOptions, I as ThemeControlTargets, J as ThemeStorageOptions, K as PaymentWizardControllerOptions, L as PaymentWizardController, M as PaymentWizardSelection, N as PaymentWizardModel, W as WizardRouteAssetDisplay, O as WizardRouteDisplay, Q as PaymentWizardSelectionAction } from './status-CzIEJWjS.js';
4
+ export { V as BrowserLogContext, X as BrowserLogger, Y as BrowserRequestError, Z as CheckoutController, _ as CheckoutControllerOptions, $ as CheckoutPhase, a0 as CheckoutStatusRefresh, a1 as OPENRECEIVE_CHECKOUT_DATA_ATTRIBUTES, a2 as OPENRECEIVE_CHECKOUT_DATA_SELECTORS, a3 as OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES, a4 as OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS, a5 as OPENRECEIVE_CHECKOUT_ELEMENT_PARTS, a6 as OPENRECEIVE_CHECKOUT_ELEMENT_PART_SELECTORS, a7 as OPENRECEIVE_CHECKOUT_ELEMENT_SLOTS, a8 as OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME, a9 as OPENRECEIVE_COPY_FEEDBACK_MS, aa as OPENRECEIVE_DEFAULT_POLL_INTERVAL_MS, ab as OPENRECEIVE_DEFAULT_PREFIX, ac as OPENRECEIVE_PAYMENT_WIZARD_ATTRIBUTES, ad as OPENRECEIVE_PAYMENT_WIZARD_SELECTORS, ae as OPENRECEIVE_PROVIDER_PREVIEW_LIMIT, af as OPENRECEIVE_THEME_STORAGE_KEY, ag as OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES, ah as OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS, ai as OPENRECEIVE_THEME_TOGGLE_ELEMENT_PARTS, aj as OPENRECEIVE_THEME_TOGGLE_ELEMENT_PART_SELECTORS, ak as OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME, al as QrEncoder, am as QrSvgController, an as QrSvgControllerOptions, ao as Status, ap as SwapCopyRow, aq as SwapRefundStaging, ar as WizardProviderDisplay, as as assertDisplayInvoice, at as copyInvoice, au as createCheckoutActionEvent, av as createCheckoutController, aw as createCheckoutErrorEvent, ax as createCheckoutProviderCopyEvent, ay as createCheckoutStateEvent, az as createQrPayloadSvg, aA as createQrSvg, aB as createQrSvgController, aC as createStatusFetcher, aD as createThemeChangeEvent, aE as currentCheckoutUrl, aF as deriveCheckoutStateLabels, aG as deriveStatus, aH as enterCheckoutResumePath, aI as escapeHtml, aJ as formatAmountCaption, aK as formatDepositAmount, aL as formatFiatAmount, aM as formatMsats, aN as formatSwapLimit, aO as formatUnixTime, aP as openWallet, aQ as paymentIconSvgs, aR as prepareCheckout, aS as requestCheckout } from './status-CzIEJWjS.js';
5
5
  import '@openreceive/core';
6
6
 
7
- declare const OPENRECEIVE_PAYMENT_ICON_IDS: readonly ["btc", "crypto", "eth", "lightning", "ltc", "sol", "trx", "usdc", "usdt", "xmr", "xrp"];
8
- type PaymentIconId = (typeof OPENRECEIVE_PAYMENT_ICON_IDS)[number];
9
7
  /**
10
- * The packaged PATH of each icon, independent of how (or whether) this module
11
- * managed to resolve it to a URL. A host whose bundler leaves
12
- * `import.meta.url` alone serves these files itself and maps them by path —
8
+ * The packaged PATH of each icon, for a host serving `dist/assets` itself —
13
9
  * see `AssetUrlResolver`.
14
10
  */
15
11
  declare const paymentIconPaths: Readonly<Record<PaymentIconId, string>>;
12
+ /** Each packaged payment icon as a `data:image/svg+xml` URI, keyed by id. */
16
13
  declare const paymentIconUrls: Readonly<Record<PaymentIconId, string>>;
17
14
 
18
15
  /**
@@ -610,8 +607,11 @@ interface CheckoutComponentProps {
610
607
  * the string form of the `resolveAssetUrl` seam. Packaged icon and tutorial
611
608
  * keys are relative paths under one `assets/` root, so the value is joined to
612
609
  * them directly: `assetBaseUrl="/openreceive-assets"` loads
613
- * `assets/icons/btc.svg` from `/openreceive-assets/assets/icons/btc.svg`.
614
- * Needed under every bundler that does not rewrite `import.meta.url` — see
610
+ * `assets/provider-icons/strike.png` from
611
+ * `/openreceive-assets/assets/provider-icons/strike.png`. Needed for the
612
+ * provider images under every bundler that does not rewrite
613
+ * `import.meta.url`; the payment-method icons are compiled in and need
614
+ * nothing (a base URL, when set, serves them as files too) — see
615
615
  * docs/guides/provider-registry.md.
616
616
  */
617
617
  readonly assetBaseUrl?: string;
@@ -930,14 +930,19 @@ declare function createWizardRouteDisplays(routes: readonly PaymentWizardRoute[]
930
930
  /** Host-side rewrite of the packaged icon and tutorial paths. See {@link AssetUrlResolver}. */
931
931
  readonly resolveAssetUrl?: AssetUrlResolver;
932
932
  }): readonly WizardRouteDisplay[];
933
+ declare function getPaymentMethodIconId(method: PaymentMethod): PaymentIconId;
933
934
  declare function getPaymentMethodIcon(method: PaymentMethod, resolveAssetUrl?: AssetUrlResolver): string;
934
- /** Icon for a swap network label (Tron → trx, Solana → sol, Ethereum → eth). */
935
+ /** Icon id for a swap network label (Tron → trx, Solana → sol, Ethereum → eth). */
936
+ declare function getNetworkIconId(networkLabel: string): PaymentIconId;
935
937
  declare function getNetworkIcon(networkLabel: string, resolveAssetUrl?: AssetUrlResolver): string;
936
938
  /**
937
- * Icon for a swap pay-in option card. Always the token/coin mark (USDT, USDC, SOL, …).
938
- * Network marks (Tron/Solana/Ethereum) belong only in the network reveal via
939
- * {@link getNetworkIcon}.
939
+ * Icon id for a swap pay-in option card. Always the token/coin mark (USDT,
940
+ * USDC, SOL, …). Network marks (Tron/Solana/Ethereum) belong only in the
941
+ * network reveal via {@link getNetworkIconId}.
940
942
  */
943
+ declare function getSwapOptionIconId(option: {
944
+ readonly label: string;
945
+ }): PaymentIconId;
941
946
  declare function getSwapOptionIcon(option: {
942
947
  readonly label: string;
943
948
  }, resolveAssetUrl?: AssetUrlResolver): string;
@@ -1224,4 +1229,4 @@ declare function createPaymentWizardModel(selection: PaymentWizardSelection): Pa
1224
1229
  declare function updatePaymentWizardSelection(selection: PaymentWizardSelection, action: PaymentWizardSelectionAction): PaymentWizardSelection;
1225
1230
  declare function createPaymentWizardController(options?: PaymentWizardControllerOptions): PaymentWizardController;
1226
1231
 
1227
- export { BrowserLoggerOption, type CheckoutComponentProps, CheckoutElementAttributeOptions, CheckoutElementAttributes, CheckoutElementEventHandlers, CheckoutElementListeners, CheckoutInvoiceSnapshot, CheckoutPaymentMethod, type CheckoutPropsValidation, type CheckoutSession, type CheckoutSessionOptions, CheckoutShellElements, CheckoutShellModel, CheckoutShellOptions, CheckoutSnapshot, CheckoutState, CheckoutStatusModel, type CheckoutSwapOptions, CreateCheckoutShellOptions, type DetailLinkKind, type MethodGridContinueDisplay, type MethodGridDisplay, type MethodGridDisplayEntry, type MethodGridEntry, type MethodGridGroupDisplay, PaymentMethod, PaymentWizardController, PaymentWizardModel, PaymentWizardSelection, ResolvedTheme, StoredThemeModelOptions, SwapDepositRisk, SwapDisplayModel, type SwapLimitContext, type SwapMethodGroup, type SwapSelection, type SwapUnavailableModel, ThemeModel, ThemeModelOptions, ThemePreference, ThemeToggleElementAttributeOptions, ThemeToggleElementAttributes, TransactionDetailRow, TransactionDetailsInput, type TransactionDetailsSource, TransientFeedbackController, UnixSeconds, WizardRouteAssetDisplay, WizardRouteDisplay, type WizardSelection, applyCheckoutElementAttributes, assetButtonClasses, buildMethodGridEntries, checkoutElementStyles, checkoutLabels, createBlockExplorerUrl, createCheckoutElementAttributes, createCheckoutElementListeners, createCheckoutSession, createCheckoutShell, createCheckoutShellModel, createCheckoutSnapshotFromInvoice, createCheckoutState, createCheckoutStatusModel, createDetailExternalLink, createLightningInvoiceDecodeUrl, createMethodGridDisplay, createPaymentWizardController, createPaymentWizardModel, createPaymentWizardSelection, createStoredThemeModel, createSwapDisplayModel, createSwapUnavailableModel, createThemeModel, createThemeToggleElement, createThemeToggleElementAttributes, createTickingValueController, createTransactionDetails, createTransactionDetailsFromState, createTransientFeedbackController, createWizardRouteAssetDisplays, createWizardRouteDisplays, formatMethodNetworkDetail, formatNetworkSummary, getExplorerNetwork, getNetworkIcon, getPaymentMethodIcon, getRouteIconPath, getRouteNetworkLabel, getSwapOptionIcon, getSwapRefundFormError, getWizardEmptyMessage, isReusableLightningInvoice, mergeAttemptIntoCheckout, mergeAttemptIntoSnapshot, networkButtonClasses, networkCheckClasses, networkMobileRevealClasses, networkSummaryIconClasses, normalizeSwapStartInvoice, orClasses, parseBooleanAttribute, parseMethodPickerKey, parseOptionalInteger, parsePaymentMethod, parseResolvedTheme, parseThemePreference, paymentAccentId, paymentIconPaths, paymentIconUrls, paymentMethods, postJson, readThemePreference, requestSwapRefund, requestSwapStatus, resolveTransactionDetailRows, resolveWizardSelection, resumeSwapAttempt, selectCheckoutDisplayInvoice, selectCurrentSwapInvoice, startSwapRequest, swapAssetMatchesRoute, swapDepositRisk, swapOptionLimitMessage, swapOptionLimitSentence, swapPickerKey, syncStoredThemeControls, toggleStoredThemeControls, updatePaymentWizardSelection, validateCheckoutProps, writeThemePreference };
1232
+ export { BrowserLoggerOption, type CheckoutComponentProps, CheckoutElementAttributeOptions, CheckoutElementAttributes, CheckoutElementEventHandlers, CheckoutElementListeners, CheckoutInvoiceSnapshot, CheckoutPaymentMethod, type CheckoutPropsValidation, type CheckoutSession, type CheckoutSessionOptions, CheckoutShellElements, CheckoutShellModel, CheckoutShellOptions, CheckoutSnapshot, CheckoutState, CheckoutStatusModel, type CheckoutSwapOptions, CreateCheckoutShellOptions, type DetailLinkKind, type MethodGridContinueDisplay, type MethodGridDisplay, type MethodGridDisplayEntry, type MethodGridEntry, type MethodGridGroupDisplay, PaymentIconId, PaymentMethod, PaymentWizardController, PaymentWizardModel, PaymentWizardSelection, ResolvedTheme, StoredThemeModelOptions, SwapDepositRisk, SwapDisplayModel, type SwapLimitContext, type SwapMethodGroup, type SwapSelection, type SwapUnavailableModel, ThemeModel, ThemeModelOptions, ThemePreference, ThemeToggleElementAttributeOptions, ThemeToggleElementAttributes, TransactionDetailRow, TransactionDetailsInput, type TransactionDetailsSource, TransientFeedbackController, UnixSeconds, WizardRouteAssetDisplay, WizardRouteDisplay, type WizardSelection, applyCheckoutElementAttributes, assetButtonClasses, buildMethodGridEntries, checkoutElementStyles, checkoutLabels, createBlockExplorerUrl, createCheckoutElementAttributes, createCheckoutElementListeners, createCheckoutSession, createCheckoutShell, createCheckoutShellModel, createCheckoutSnapshotFromInvoice, createCheckoutState, createCheckoutStatusModel, createDetailExternalLink, createLightningInvoiceDecodeUrl, createMethodGridDisplay, createPaymentWizardController, createPaymentWizardModel, createPaymentWizardSelection, createStoredThemeModel, createSwapDisplayModel, createSwapUnavailableModel, createThemeModel, createThemeToggleElement, createThemeToggleElementAttributes, createTickingValueController, createTransactionDetails, createTransactionDetailsFromState, createTransientFeedbackController, createWizardRouteAssetDisplays, createWizardRouteDisplays, formatMethodNetworkDetail, formatNetworkSummary, getExplorerNetwork, getNetworkIcon, getNetworkIconId, getPaymentMethodIcon, getPaymentMethodIconId, getRouteIconPath, getRouteNetworkLabel, getSwapOptionIcon, getSwapOptionIconId, getSwapRefundFormError, getWizardEmptyMessage, isReusableLightningInvoice, mergeAttemptIntoCheckout, mergeAttemptIntoSnapshot, networkButtonClasses, networkCheckClasses, networkMobileRevealClasses, networkSummaryIconClasses, normalizeSwapStartInvoice, orClasses, parseBooleanAttribute, parseMethodPickerKey, parseOptionalInteger, parsePaymentMethod, parseResolvedTheme, parseThemePreference, paymentAccentId, paymentIconPaths, paymentIconUrls, paymentMethods, postJson, readThemePreference, requestSwapRefund, requestSwapStatus, resolveTransactionDetailRows, resolveWizardSelection, resumeSwapAttempt, selectCheckoutDisplayInvoice, selectCurrentSwapInvoice, startSwapRequest, swapAssetMatchesRoute, swapDepositRisk, swapOptionLimitMessage, swapOptionLimitSentence, swapPickerKey, syncStoredThemeControls, toggleStoredThemeControls, updatePaymentWizardSelection, validateCheckoutProps, writeThemePreference };
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-AOX3YX2W.js";
122
+ } from "./chunk-64ROVMMY.js";
119
123
 
120
124
  // src/headless.ts
121
125
  import { createAssetBaseUrlResolver, getPaymentWizardRoutes } from "@openreceive/provider-data";
@@ -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-AOX3YX2W.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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openreceive/browser",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "Framework-free browser helpers for OpenReceive checkout: prepare/create calls, status polling, QR and wallet helpers.",
5
5
  "keywords": [
6
6
  "bitcoin",
@@ -31,8 +31,8 @@
31
31
  "./assets/*": "./dist/assets/*"
32
32
  },
33
33
  "dependencies": {
34
- "@openreceive/core": "0.3.3",
35
- "@openreceive/provider-data": "0.3.3",
34
+ "@openreceive/core": "0.4.0",
35
+ "@openreceive/provider-data": "0.4.0",
36
36
  "qrcode": "^1.5.4"
37
37
  },
38
38
  "devDependencies": {
@@ -48,7 +48,8 @@
48
48
  ],
49
49
  "scripts": {
50
50
  "build:css": "node ../../../tools/package/build-browser-css.mjs",
51
- "build": "npm run build:css && tsup src/index.ts src/headless.ts --format esm --dts --clean --target es2022 --out-dir dist && node ../../../tools/package/copy-static.mjs src dist styles.css assets",
51
+ "build:icons": "node ../../../tools/package/generate-payment-icons.mjs",
52
+ "build": "npm run build:icons && npm run build:css && tsup src/index.ts src/headless.ts --format esm --dts --clean --target es2022 --out-dir dist && node ../../../tools/package/copy-static.mjs src dist styles.css assets",
52
53
  "prepack": "npm run build"
53
54
  },
54
55
  "license": "MIT",
@@ -40,6 +40,7 @@ same diagnostics redacted, always exit 0 — safe to share.
40
40
  | Status | Meaning | Where to look |
41
41
  | --- | --- | --- |
42
42
  | 403 FORBIDDEN | Your own `authorize` hook denied it, or the request looked cross-site. Check the session/cookie actually reaches the checkout routes. https://openreceive.org/guides/authorization.md |
43
+ | Never 403s — any visitor can mint, poll, or refund for any reference | The opposite failure: on Rails the generated `config.authorize = OpenReceive::ALLOW_ALL_AUTHORIZE` placeholder is still installed (the engine warns at boot; `bin/rails openreceive:doctor` reports it). Replace it with the app's real ownership check. https://openreceive.org/guides/authorization.md |
43
44
  | 404 NOT_FOUND | `amountFor` returned `null` (unknown reference), or the `payment_hash` does not belong to that reference. |
44
45
  | 409 CONFLICT | **Normal state, not a bug**: the reference already settled, or an unpaid checkout for that method is already live. Show it as order state; never retry-loop. |
45
46
  | 503 retryable | The host hook failed while persisting the attempt (instructions withheld), or the wallet is unavailable. Read the server log for the underlying error. |
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (Node.js)
2
2
 
3
- These directions describe OpenReceive 0.3.3.
3
+ These directions describe OpenReceive 0.4.0.
4
4
 
5
5
  Add OpenReceive to a Node application — the app you are already working in. You
6
6
  do not need a copy of the OpenReceive source: the packages are on npm, and the
@@ -374,6 +374,8 @@ const openreceive = openReceiveExpress({
374
374
  : null;
375
375
  },
376
376
  // Your own access check: may this caller do this action to this reference?
377
+ // `resource.reference` is your own order id, sent back by the payer's
378
+ // browser — a claim, not proof — already validated as a non-empty string.
377
379
  authorize: async ({ action, request, resource }) =>
378
380
  orders.viewerMay(
379
381
  await sessions.currentUser(request),
@@ -451,11 +453,13 @@ so a white card never lands on a dark page. The checkout is styled by CSS
451
453
  variables under `data-theme`; [Frontend checkout](https://openreceive.org/guides/frontend-checkout.md) has
452
454
  the knobs.
453
455
 
454
- Outside Vite/Rollup (esbuild, webpack, a plain script tag) the packaged
455
- payment-method icons cannot resolve their own URLs — the drop-in needs this
456
- exactly as a custom UI does. Serve the two packages' `dist/assets` trees and
457
- pass the base as `assetBaseUrl="/openreceive-assets"`
458
- ([Provider registry](https://openreceive.org/guides/provider-registry.md#assets-are-files-your-host-serves)).
456
+ The payment-method icons are compiled into `@openreceive/browser` and need
457
+ nothing from your bundler. The wallet logos and pay tutorials are files in
458
+ `@openreceive/provider-data`, and outside Vite/Rollup (esbuild, webpack, a
459
+ plain script tag) they cannot resolve their own URLs — the drop-in needs this
460
+ exactly as a custom UI does. Serve that package's `dist/assets` tree and pass
461
+ the base as `assetBaseUrl="/openreceive-assets"`
462
+ ([Provider registry](https://openreceive.org/guides/provider-registry.md#assets)).
459
463
 
460
464
  That is the whole loop: your server owns the price and the order, the payer gets
461
465
  an invoice, and `onPaid` runs once inside the settlement transaction.
@@ -1,6 +1,6 @@
1
1
  # OpenReceive agent directions (Rails)
2
2
 
3
- These directions describe OpenReceive 0.3.3.
3
+ These directions describe OpenReceive 0.4.0.
4
4
 
5
5
  Add OpenReceive to a Rails application — the app you are already working in. You
6
6
  do not need a copy of the OpenReceive source: the gem is on RubyGems, the
@@ -106,7 +106,9 @@ itself, and they hold for every integration.
106
106
  reject payer-supplied amounts.
107
107
  - `config.authorize` runs on every request, and the `resource` it receives is a
108
108
  CLAIM the payer made, not proof. Read the framework session; never trust a
109
- body field.
109
+ body field. The generator installs `OpenReceive::ALLOW_ALL_AUTHORIZE`, a
110
+ placeholder that allows everything (the engine warns at boot while it is
111
+ set) — replace it with this app's real ownership check, same as `on_paid`.
110
112
  - `config.on_paid` must be idempotent. It runs once per `reference` — your order
111
113
  id, one per thing you fulfill, created before checkout, kept across retries,
112
114
  never reused. A fresh id per page load lets one order be paid twice.
@@ -409,7 +411,9 @@ OpenReceive.configure do |config|
409
411
  # cookies, or headers from it, as in a controller
410
412
  # context[:resource] — { reference:, payment_hash: } copied from the
411
413
  # payer's JSON body. It names an order; it does not
412
- # prove this caller owns it.
414
+ # prove this caller owns it. reference is always a
415
+ # validated non-empty String (≤200 chars); payment_hash
416
+ # is nil except on payment.check / swap.read / swap.refund.
413
417
  # Return true to allow, false for a 403. Here: only the signed-in customer
414
418
  # who placed the order may act on it.
415
419
  config.authorize = lambda do |context|
@@ -455,7 +459,12 @@ The generated initializer ships
455
459
  the settlement and fulfills nothing. Replace it with your real fulfillment (as
456
460
  above); the engine warns every time your application boots while the
457
461
  placeholder is still configured, because orders would otherwise be recorded as settled without ever
458
- being fulfilled.
462
+ being fulfilled. The same applies to
463
+ `config.authorize = OpenReceive::ALLOW_ALL_AUTHORIZE`, the generated
464
+ allow-all placeholder: it treats possession of the reference as
465
+ authorization, which is safe only while references are unguessable, and the
466
+ engine warns at boot until you replace it with your own ownership check (as
467
+ above). Replace both, not just `on_paid`.
459
468
 
460
469
  The amount always comes from your own order record; payer-supplied amounts are
461
470
  rejected. Advanced hooks (`resolve_checkout`, `on_checkout_created`) remain as
@@ -510,13 +519,13 @@ Bundling with esbuild (jsbundling-rails)? Two things:
510
519
  <%= javascript_include_tag "application", type: "module" %>
511
520
  ```
512
521
 
513
- 2. Serve the payment-method icons. They are files shipped in
514
- `@openreceive/browser` and `@openreceive/provider-data` — not in
515
- `@openreceive/elements` — and only Vite-style bundlers resolve them from
516
- the import. Merge both packages' `dist/assets` trees into
517
- `public/openreceive-assets/assets/` and set
522
+ 2. Serve the provider images. The payment-method icons are compiled into
523
+ `@openreceive/browser` and need nothing, but the wallet logos and pay
524
+ tutorials are files shipped in `@openreceive/provider-data`, and only
525
+ Vite-style bundlers resolve them from the import. Copy that package's
526
+ `dist/assets` tree to `public/openreceive-assets/assets/` and set
518
527
  `asset-base-url="/openreceive-assets"` on the element
519
- ([Provider registry](https://openreceive.org/guides/provider-registry.md#assets-are-files-your-host-serves)).
528
+ ([Provider registry](https://openreceive.org/guides/provider-registry.md#assets)).
520
529
 
521
530
  The element creates the checkout for `reference`, then renders and polls
522
531
  itself. React/Vue/Svelte/Angular apps use the matching wrapper package