@openreceive/elements 0.4.5 → 0.4.8

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
@@ -1,6 +1,30 @@
1
1
  # @openreceive/elements
2
2
 
3
- The OpenReceive checkout custom element (`<openreceive-checkout>`) and theme toggle (`<openreceive-theme-toggle>`).
3
+ Add Bitcoin Lightning checkout to any website with
4
+ `<openreceive-checkout>`. The custom element displays payment choices, QR
5
+ codes, and live payment status, with no frontend framework required. It also
6
+ ships `<openreceive-theme-toggle>` for switching the checkout theme.
7
+
8
+ OpenReceive supports optional swaps from **USDT, USDC, SOL, and ETH** through
9
+ a configured swap provider. The provider converts the payment to **BTC over
10
+ Lightning**, which settles into the merchant's connected wallet. Available
11
+ assets and networks depend on the provider; swaps are optional.
12
+
13
+ Pair this browser package with an OpenReceive server integration. Your server
14
+ authorizes the order, sets the amount, configures swaps, and verifies
15
+ settlement; wallet and provider credentials stay on the server.
16
+
17
+ ## Install
18
+
19
+ Use Node.js 22 or later for package tooling.
20
+
21
+ ```sh
22
+ npm install @openreceive/elements
23
+ ```
24
+
25
+ Follow the [frontend checkout guide](https://github.com/openreceive/openreceive/blob/master/docs/guides/frontend-checkout.md)
26
+ to connect the component to your server routes. Use the server-side payment
27
+ hook to fulfill orders; browser callbacks update the interface.
4
28
 
5
29
  ## Mount
6
30
 
@@ -1250,7 +1250,7 @@ function renderElementCompactPaymentSelectorHtml(swapAssetOptions, view) {
1250
1250
  <h2 id="payment-method-heading" class="${orClasses5.wizardHeaderTitle}">${escapeHtml6(checkoutLabels5.wizardTitle)}</h2>
1251
1251
  <p class="${orClasses5.wizardHeaderSubtitle}">${escapeHtml6(checkoutLabels5.wizardSubtitle)}</p>
1252
1252
  </header>
1253
- <div class="${orClasses5.wizardBody}" aria-labelledby="payment-method-heading">
1253
+ <div class="${orClasses5.methodBody}" aria-labelledby="payment-method-heading">
1254
1254
  <div part="method-grid" role="group" aria-label="${escapeHtml6(checkoutLabels5.paymentMethod)}" class="${orClasses5.methodGrid}">
1255
1255
  ${tiles}${loadingTile}
1256
1256
  </div>
@@ -1284,7 +1284,7 @@ function renderElementNetworkSelectorHtml(group, view, continueButtonHtml, mobil
1284
1284
  label: option.network_label
1285
1285
  })}
1286
1286
  </span>
1287
- <span class="truncate">${escapeHtml6(option.network_label)}</span>
1287
+ <span class="${orClasses5.methodNetworkLabel}">${escapeHtml6(option.network_label)}</span>
1288
1288
  ${optionSelected ? `<span aria-hidden="true" class="${networkCheckClasses(accent)}">\u2713</span>` : ""}
1289
1289
  </button>
1290
1290
  ${optionDisabled && optionLimit !== void 0 ? `<span class="${orClasses5.methodLimitHint}">${escapeHtml6(optionLimit)}</span>` : ""}
@@ -1503,6 +1503,10 @@ function renderCheckoutHtml(view) {
1503
1503
  <section part="root" data-theme="${escapeHtml7(resolvedTheme)}" class="${orClasses6.root}">
1504
1504
  <slot name="${OPENRECEIVE_CHECKOUT_ELEMENT_SLOTS.order}"></slot>
1505
1505
  ${orderDescription}
1506
+ ${view.mintingLightning ? `<div part="status" role="status" aria-live="polite" class="${orClasses6.creating}">
1507
+ <span part="spinner" class="${orClasses6.spinner}" aria-hidden="true"></span>
1508
+ <p>${escapeHtml7(checkoutLabels6.preparingPayment)}</p>
1509
+ </div>` : ""}
1506
1510
  ${hideLightning ? "" : `<div part="payment-layout" class="${paymentLayoutClass}">
1507
1511
  ${lightningPane}
1508
1512
  <div part="payment-info" class="${orClasses6.paymentInfo}">
@@ -1919,6 +1923,7 @@ function defineElements(options = {}) {
1919
1923
  this.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.paymentWizard)
1920
1924
  ),
1921
1925
  lightningRequested: this.session.mintingLightning ? false : lightningRequested,
1926
+ mintingLightning: this.session.mintingLightning,
1922
1927
  wizard: {
1923
1928
  selectedMethod: this.selection.selectedMethod,
1924
1929
  selectedBitcoinRoute: this.selection.selectedBitcoinRoute,
@@ -30,6 +30,8 @@ interface CheckoutView {
30
30
  readonly inlineStyles?: boolean;
31
31
  /** False until the payer selects Bitcoin in create-mode (deferred Lightning mint). */
32
32
  readonly lightningRequested?: boolean;
33
+ /** True while the session is creating the Lightning invoice. */
34
+ readonly mintingLightning?: boolean;
33
35
  readonly wizard?: ElementsWizardView;
34
36
  /**
35
37
  * Live controller state, when the element has one. Preferred over the
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TransactionDetailsSource } from '@openreceive/browser/headless';
2
2
  export { OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES, OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS, OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME, OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES, OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS, OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME, TransactionDetailsSource, createThemeToggleElement } from '@openreceive/browser/headless';
3
- import { C as CheckoutView } from './define-elements-bLhlu_xC.js';
4
- export { D as DefineElementsOptions, E as ElementsWizardView, d as defineElements } from './define-elements-bLhlu_xC.js';
3
+ import { C as CheckoutView } from './define-elements-CdcAT6pW.js';
4
+ export { D as DefineElementsOptions, E as ElementsWizardView, d as defineElements } from './define-elements-CdcAT6pW.js';
5
5
 
6
6
  declare function renderCheckoutHtml(view: CheckoutView): string;
7
7
  /**
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  renderCheckoutHtml,
13
13
  renderThemeToggleHtml,
14
14
  renderTransactionDetailsHtml
15
- } from "./chunk-4APDZW7L.js";
15
+ } from "./chunk-YRVW5RLP.js";
16
16
  export {
17
17
  OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES,
18
18
  OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS,