@openreceive/react 0.2.3 → 0.3.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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { CheckoutComponentProps, CheckoutState, QrEncoder, BrowserLoggerOption, CheckoutStatusRefresh, Status, CheckoutSnapshot, BrowserLogContext, CheckoutInvoiceSnapshot, ThemePreference, ResolvedTheme, ThemeModel, PaymentDataSource, CheckoutPhase, CheckoutStatusModel, UnixSeconds, BrowserLogger, TransactionDetailsSource } from '@openreceive/browser/headless';
2
+ import { CheckoutComponentProps, CheckoutState, QrEncoder, BrowserLoggerOption, CheckoutStatusRefresh, Status, SwapRefundStaging, CheckoutSnapshot, AssetUrlResolver, BrowserLogContext, CheckoutInvoiceSnapshot, ThemePreference, ResolvedTheme, ThemeModel, CheckoutPhase, CheckoutStatusModel, UnixSeconds, BrowserLogger, TransactionDetailsSource } from '@openreceive/browser/headless';
3
3
  export { TransactionDetailsSource, resolveTransactionDetailRows } from '@openreceive/browser/headless';
4
4
 
5
5
  interface CheckoutData {
@@ -49,7 +49,7 @@ interface UseCheckoutOptions extends CheckoutData, Omit<CheckoutEventHandlers, "
49
49
  readonly polling?: boolean;
50
50
  readonly pollIntervalMs?: number;
51
51
  }
52
- interface UseCheckoutResult extends CheckoutViewModel {
52
+ interface UseCheckoutResult extends CheckoutViewModel, SwapRefundStaging {
53
53
  readonly checkout: CheckoutSnapshot;
54
54
  readonly copied: boolean;
55
55
  readonly countdownLabel?: string;
@@ -115,7 +115,9 @@ interface CheckoutClassNames extends InvoiceSummaryClassNames {
115
115
  readonly satsDetail?: string;
116
116
  readonly lightningPane?: string;
117
117
  readonly invoiceTitle?: string;
118
- /** Applied to the settled payment-data disclosure. */
118
+ /** Applied to the host-supplied order description above the amount. */
119
+ readonly orderDescription?: string;
120
+ /** Applied to the settled transaction-details disclosure. */
119
121
  readonly details?: string;
120
122
  readonly waiting?: string;
121
123
  readonly countdown?: string;
@@ -152,7 +154,16 @@ interface CheckoutProps extends CheckoutComponentProps, CheckoutEventHandlers, O
152
154
  readonly refreshStatus?: CheckoutStatusRefresh;
153
155
  readonly components?: CheckoutComponents;
154
156
  readonly classNames?: CheckoutClassNames;
157
+ /**
158
+ * Render-prop or plain node rendered inside the checkout, above the payment
159
+ * panel. The slot for order context — a line-item summary, a thumbnail, a
160
+ * "you are buying" strip — which the shipped checkout otherwise never shows:
161
+ * it renders the amount, never the order. The function form receives the live
162
+ * `useCheckout` model.
163
+ */
155
164
  readonly children?: CheckoutChildren;
165
+ /** Passed through to the payment wizard. See {@link PaymentWizardProps.resolveAssetUrl}. */
166
+ readonly resolveAssetUrl?: AssetUrlResolver;
156
167
  }
157
168
  interface UseThemeOptions {
158
169
  readonly defaultTheme?: ThemePreference;
@@ -212,6 +223,27 @@ interface PaymentWizardProps {
212
223
  readonly qrEncoder?: QrEncoder;
213
224
  /** Base URL of an external bolt11 decoder; omitted, no "Decode" link is rendered. */
214
225
  readonly decodeLinkUrl?: string;
226
+ /**
227
+ * Rewrite a packaged asset path (`assets/provider-icons/strike.png`,
228
+ * `assets/icons/btc.svg`) into a URL this host can serve. The packaged URLs
229
+ * only resolve under Vite/Rollup; every other bundler needs this, or the
230
+ * method icons, provider logos and pay tutorials come out as dead `file://`
231
+ * links. See docs/guides/provider-registry.md.
232
+ */
233
+ readonly resolveAssetUrl?: AssetUrlResolver;
234
+ /**
235
+ * The string form of the same seam: where this host serves the packages'
236
+ * `dist/assets` trees. `resolveAssetUrl` wins when both are set.
237
+ */
238
+ readonly assetBaseUrl?: string;
239
+ /**
240
+ * The two-step refund, from whoever owns the checkout controller —
241
+ * `<Checkout>` passes its `useCheckout` model. Given one, the wizard stages
242
+ * and confirms through it, so the address the payer is reviewing survives
243
+ * every poll. Standalone (a host driving its own snapshot), the wizard falls
244
+ * back to posting the refund itself and carrying the staging locally.
245
+ */
246
+ readonly swapRefund?: SwapRefundStaging;
215
247
  readonly onError?: (error: unknown) => void;
216
248
  /**
217
249
  * Called when the payer enters or leaves the focused swap flow (a pay-in coin is
@@ -266,11 +298,6 @@ declare function QRCode(props: QRCodeProps): React.ReactElement;
266
298
  declare function CopyInvoiceButton(props: CopyInvoiceButtonProps): React.ReactElement;
267
299
  declare function OpenWalletButton(props: OpenWalletButtonProps): React.ReactElement;
268
300
  declare function PaymentState(props: PaymentStateProps): React.ReactElement;
269
- /** Collapsible "everything the client knows about this payment" panel, shown once settled. */
270
- declare function PaymentData(props: {
271
- readonly source: PaymentDataSource;
272
- readonly className?: string;
273
- }): React.ReactElement | null;
274
301
  declare function WaitingState(props: {
275
302
  readonly waiting?: boolean;
276
303
  readonly phase?: CheckoutPhase;
@@ -332,4 +359,4 @@ declare function createCheckoutViewModel(data: CheckoutData): CheckoutViewModel;
332
359
 
333
360
  declare function PaymentWizard(props: PaymentWizardProps): React.ReactElement;
334
361
 
335
- export { type ButtonComponent, Checkout, type CheckoutChildren, type CheckoutClassNames, type CheckoutComponents, type CheckoutData, type CheckoutProps, CheckoutProvider, type CheckoutProviderProps, type CheckoutViewModel, CopyInvoiceButton, type CopyInvoiceButtonProps, InvoiceSummary, type InvoiceSummaryClassNames, type InvoiceSummaryProps, OpenWalletButton, type OpenWalletButtonProps, PaymentData, PaymentState, type PaymentStateProps, PaymentWizard, type PaymentWizardProps, QRCode, type QRCodeProps, SatsDetail, type SatsDetailProps, ThemeScope, type ThemeScopeChildren, type ThemeScopeProps, ThemeToggle, type ThemeToggleProps, TransactionDetails, type TransactionDetailsProps, type UseCheckoutOptions, type UseCheckoutResult, type UseThemeOptions, type UseThemeResult, WaitingState, createCheckoutViewModel, renderSwapDepositPanel, useCheckout, useCheckoutContext, useTheme };
362
+ export { type ButtonComponent, Checkout, type CheckoutChildren, type CheckoutClassNames, type CheckoutComponents, type CheckoutData, type CheckoutProps, CheckoutProvider, type CheckoutProviderProps, type CheckoutViewModel, CopyInvoiceButton, type CopyInvoiceButtonProps, InvoiceSummary, type InvoiceSummaryClassNames, type InvoiceSummaryProps, OpenWalletButton, type OpenWalletButtonProps, PaymentState, type PaymentStateProps, PaymentWizard, type PaymentWizardProps, QRCode, type QRCodeProps, SatsDetail, type SatsDetailProps, ThemeScope, type ThemeScopeChildren, type ThemeScopeProps, ThemeToggle, type ThemeToggleProps, TransactionDetails, type TransactionDetailsProps, type UseCheckoutOptions, type UseCheckoutResult, type UseThemeOptions, type UseThemeResult, WaitingState, createCheckoutViewModel, renderSwapDepositPanel, useCheckout, useCheckoutContext, useTheme };