@openreceive/react 0.4.30 → 0.4.32

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
@@ -286,6 +286,12 @@ interface PaymentWizardProps {
286
286
  * Used by the create-mode deferred flow; safe to omit in snapshot mode.
287
287
  */
288
288
  readonly onRequestLightning?: () => void | Promise<void>;
289
+ /**
290
+ * Why the last `onRequestLightning` mint failed, in words for the payer. The
291
+ * wizard shows it above the methods with a Try again button that requests
292
+ * Lightning again. Create mode passes it; snapshot mode has no mint.
293
+ */
294
+ readonly lightningMintError?: string;
289
295
  /**
290
296
  * Called after a swap deposit attempt is created or reused so create-mode can poll
291
297
  * the shadow Lightning payment_hash for settlement.
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ import {
9
9
  OPENRECEIVE_DEFAULT_PREFIX,
10
10
  OPENRECEIVE_STYLE_ROOT_ATTRIBUTE as OPENRECEIVE_STYLE_ROOT_ATTRIBUTE2,
11
11
  orClasses as orClasses7,
12
+ payerErrorMessage,
12
13
  prepareCheckout,
13
14
  requestCheckout,
14
15
  resumeCheckoutAttempt,
@@ -2255,6 +2256,33 @@ function PaymentWizardSession(props) {
2255
2256
  {
2256
2257
  className: joinClassNames(orClasses6.wizard, props.className)
2257
2258
  },
2259
+ // The Lightning mint failed. Try again picks Bitcoin again, as the method
2260
+ // button does, so the payer does not have to walk back to the list first.
2261
+ props.lightningMintError === void 0 ? null : React9.createElement(
2262
+ "div",
2263
+ { key: "wizard-error", role: "alert", className: orClasses6.paymentStatus },
2264
+ React9.createElement(
2265
+ "div",
2266
+ { className: orClasses6.paymentStatusBody },
2267
+ React9.createElement(
2268
+ "p",
2269
+ { className: orClasses6.paymentStatusDetail },
2270
+ props.lightningMintError
2271
+ ),
2272
+ React9.createElement(
2273
+ "button",
2274
+ {
2275
+ className: orClasses6.btn,
2276
+ type: "button",
2277
+ onClick: () => {
2278
+ updateWizardSelection((controller) => controller.selectMethod("bitcoin"));
2279
+ void props.onRequestLightning?.();
2280
+ }
2281
+ },
2282
+ checkoutLabels5.tryAgain
2283
+ )
2284
+ )
2285
+ ),
2258
2286
  selection.selectedMethod === null ? renderCompactPaymentMethodSelector({
2259
2287
  swapAssetOptions,
2260
2288
  // Create-checkout snapshot has no payment_methods yet; order status fills them
@@ -3076,7 +3104,7 @@ function CheckoutCreate(props) {
3076
3104
  onErrorRef.current?.(error);
3077
3105
  setCreated({
3078
3106
  status: "error",
3079
- ...error instanceof Error && error.message.length > 0 ? { errorMessage: error.message } : {}
3107
+ errorMessage: payerErrorMessage(error, checkoutLabels6.startCheckoutFailedDetail)
3080
3108
  });
3081
3109
  });
3082
3110
  return () => {
@@ -3102,6 +3130,7 @@ function CheckoutCreate(props) {
3102
3130
  checkout: created.checkout,
3103
3131
  prefix: resolvedPrefix,
3104
3132
  mintingLightning: session.mintingLightning,
3133
+ ...session.wizardError === void 0 ? {} : { lightningMintError: session.wizardError },
3105
3134
  onRequestLightning: session.ensureLightning,
3106
3135
  onSwapStarted
3107
3136
  });
@@ -3125,7 +3154,9 @@ function CheckoutCreate(props) {
3125
3154
  { className: orClasses7.creating },
3126
3155
  React10.createElement("p", { role: "alert" }, "Could not start checkout."),
3127
3156
  // The thrown error carries the server's payer-facing text (e.g. the
3128
- // rate-limit message or "Exchange rates are temporarily unavailable").
3157
+ // rate-limit message or "Exchange rates are temporarily unavailable");
3158
+ // payerErrorMessage swaps an operator-facing wallet message for one
3159
+ // the payer can act on.
3129
3160
  created.errorMessage === void 0 ? null : React10.createElement("p", null, created.errorMessage),
3130
3161
  React10.createElement(
3131
3162
  "button",
@@ -3191,6 +3222,7 @@ function CheckoutView(props) {
3191
3222
  onRequestLightning,
3192
3223
  onSwapStarted,
3193
3224
  mintingLightning = false,
3225
+ lightningMintError,
3194
3226
  qrEncoder,
3195
3227
  logger,
3196
3228
  decodeLinkUrl,
@@ -3488,6 +3520,7 @@ function CheckoutView(props) {
3488
3520
  onProviderCopy,
3489
3521
  onCopy,
3490
3522
  onRequestLightning,
3523
+ ...lightningMintError === void 0 ? {} : { lightningMintError },
3491
3524
  onSwapStarted,
3492
3525
  // Whether a payer who closes the tab has a URL to come back
3493
3526
  // to. Explicit wins — only the host knows about a per-order
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openreceive/react",
3
- "version": "0.4.30",
3
+ "version": "0.4.32",
4
4
  "description": "React components and hooks for Bitcoin Lightning checkout and optional USDT, USDC, SOL and ETH swaps.",
5
5
  "keywords": [
6
6
  "bitcoin",
@@ -10,7 +10,13 @@
10
10
  "bolt11",
11
11
  "openreceive",
12
12
  "react",
13
- "checkout"
13
+ "checkout",
14
+ "stablecoin",
15
+ "usdt",
16
+ "usdc",
17
+ "payment-gateway",
18
+ "self-hosted",
19
+ "bitcoin-payments"
14
20
  ],
15
21
  "type": "module",
16
22
  "sideEffects": [
@@ -19,8 +25,8 @@
19
25
  "main": "./dist/index.js",
20
26
  "types": "./dist/index.d.ts",
21
27
  "dependencies": {
22
- "@openreceive/browser": "0.4.30",
23
- "@openreceive/core": "0.4.30"
28
+ "@openreceive/browser": "0.4.32",
29
+ "@openreceive/core": "0.4.32"
24
30
  },
25
31
  "peerDependencies": {
26
32
  "react": ">=18.0.0"