@solvapay/react 1.4.0 → 1.6.0-preview-5bb1081562f1b721265d11760bc427a1d0977d73

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/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # @solvapay/react changelog
2
2
 
3
+ ## 1.6.0-preview-5bb1081562f1b721265d11760bc427a1d0977d73
4
+
5
+ ### Minor Changes
6
+
7
+ - ede9365: Add business purchase support for credit top-ups: shared BusinessDetails validation in core, TopupForm.BusinessDetails/Summary primitives, attachTopupBusinessDetails server SDK method, and checkout-demo example wiring.
8
+ - 215d045: Add business purchase / VAT support to plan checkout (`PaymentForm.BusinessDetails`, tax-aware summary, attach-before-confirm) and MCP embedded surfaces via the new `attach_business_details` transport tool.
9
+ - 6de3d97: Surface seller VAT / tax identity in the SDK. The merchant contract now exposes optional `companyNumber`, `taxId`, and `vatNumber`, and `McpSellerDetailsCard` renders a country-smart tax-identifier row (VAT number for EU/GB, EIN/Tax ID otherwise) plus a company-number line with org-vs-tax de-duplication.
10
+
11
+ ### Patch Changes
12
+
13
+ - b5515d3: Fix PAYG plan display in `CurrentPlanCard` and `UsageMeter`: show the plan name and credit-based usage instead of misleading unlimited usage for usage-based purchases.
14
+ - ee15454: Restore topup-first activation for usage-based (PAYG) plans. This reverses the eager plan-step activation shipped earlier (changelog `d4183ba`): a zero-balance PAYG customer now receives `topup_required` from `activatePlan` and the active purchase only materializes after a successful top-up.
15
+ - **`@solvapay/react`**: `useCheckoutFlow` no longer treats a PAYG plan as active at the plan step. The plan-step `activatePlan` call is expected to return `topup_required` (it creates no purchase); the flow re-activates after the top-up lands so the active purchase is created only once credits cover a unit — mirroring the `ActivationFlow` primitive's self-healing behavior.
16
+ - **`@solvapay/server`**: the `/v1/sdk/activate` OpenAPI description in the generated types now documents the topup-first policy (usage-based plans return `topup_required` at zero balance) instead of eager activation.
17
+
18
+ - Updated dependencies [ede9365]
19
+ - Updated dependencies [215d045]
20
+ - @solvapay/core@1.2.0-preview-5bb1081562f1b721265d11760bc427a1d0977d73
21
+ - @solvapay/mcp-core@0.2.8-preview-5bb1081562f1b721265d11760bc427a1d0977d73
22
+
23
+ ## 1.5.0
24
+
25
+ ### Minor Changes
26
+
27
+ - 853e13f: Gate payment success on real confirmation while keeping legacy Card Element APIs as deprecated compatibility shims.
28
+
29
+ **Deprecated (`@solvapay/react`):**
30
+ - `StripePaymentFormWrapper`, `PaymentForm.CardElement` / `PaymentFormCardElement`, and `ConfirmPaymentMode: 'card-element'` remain available but are deprecated — migrate to `PaymentForm.PaymentElement` with the Payment Element. These APIs will be removed in the next major release.
31
+ - `errors.cardElementMissing` is restored alongside `errors.paymentElementMissing` for Card Element callers.
32
+
33
+ **Added:**
34
+ - `paymentIntentReturn` helpers and return-path resume in `PaymentForm` / `TopupForm`.
35
+ - `processing` is treated as pending (not error) in `confirmPayment`, `reconcilePayment`, and backend `/process`.
36
+ - `ConfirmPaymentResult` adds a `pending` status for async payment methods.
37
+ - `confirmPayment` accepts optional `mode` (defaults to `'payment-element'`).
38
+
39
+ **`@solvapay/server`:**
40
+ - `ProcessPaymentResult` and `TopupProcessResult` include a `processing` status.
41
+
3
42
  ## 1.4.0
4
43
 
5
44
  ### Minor Changes
@@ -14,7 +14,7 @@ import {
14
14
  usePurchaseStatus,
15
15
  useSolvaPay,
16
16
  useTransport
17
- } from "./chunk-6RR4J74H.js";
17
+ } from "./chunk-S6UFWKBW.js";
18
18
 
19
19
  // src/components/CancelledPlanNotice.tsx
20
20
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -433,8 +433,9 @@ var CurrentPlanCard = ({
433
433
  const isUsageBased = planType === "usage-based";
434
434
  const amount = activePurchase.originalAmount ?? activePurchase.amount ?? 0;
435
435
  const currency = activePurchase.currency ?? "usd";
436
- const cycleKey = activePurchase.billingCycle ?? activePurchase.planSnapshot?.billingCycle ?? void 0;
437
- const intervalLabel = cycleKey ? copy.currentPlan.cycleUnit[cycleKey] ?? cycleKey : void 0;
436
+ const rawCycle = activePurchase.billingCycle ?? activePurchase.planSnapshot?.billingCycle ?? void 0;
437
+ const cycleKey = rawCycle && rawCycle in copy.currentPlan.cycleUnit ? rawCycle : void 0;
438
+ const intervalLabel = cycleKey ? copy.currentPlan.cycleUnit[cycleKey] ?? rawCycle : rawCycle;
438
439
  const priceLabel = formatPrice(amount, currency, {
439
440
  interval: intervalLabel
440
441
  });
@@ -448,7 +449,7 @@ var CurrentPlanCard = ({
448
449
  const shouldShowPaymentMethod = !hidePaymentMethod && paymentMethod !== null;
449
450
  const showCancelButton = !hideCancelButton && !activePurchase.cancelledAt && !shouldShowCancelledNotice;
450
451
  return /* @__PURE__ */ jsxs4(
451
- "div",
452
+ "section",
452
453
  {
453
454
  className: rootClass,
454
455
  "data-solvapay-current-plan-card": "",
@@ -464,7 +465,7 @@ var CurrentPlanCard = ({
464
465
  }
465
466
  ),
466
467
  productContext && !hideProductContext && /* @__PURE__ */ jsx5(
467
- "div",
468
+ "p",
468
469
  {
469
470
  className: overrides?.productContext ?? "solvapay-current-plan-product-context",
470
471
  "data-solvapay-current-plan-product-context": "",
@@ -472,7 +473,7 @@ var CurrentPlanCard = ({
472
473
  }
473
474
  ),
474
475
  /* @__PURE__ */ jsx5(
475
- "div",
476
+ "h3",
476
477
  {
477
478
  className: overrides?.planName ?? "solvapay-current-plan-name",
478
479
  "data-solvapay-current-plan-name": "",
@@ -480,7 +481,7 @@ var CurrentPlanCard = ({
480
481
  }
481
482
  ),
482
483
  /* @__PURE__ */ jsx5(
483
- "div",
484
+ "p",
484
485
  {
485
486
  className: overrides?.price ?? "solvapay-current-plan-price",
486
487
  "data-solvapay-current-plan-price": "",
@@ -516,7 +517,7 @@ var CurrentPlanCard = ({
516
517
  }
517
518
  ),
518
519
  isUsageBased && !hideUsageMeter && /* @__PURE__ */ jsx5(
519
- "div",
520
+ "section",
520
521
  {
521
522
  className: overrides?.usageMeter ?? "solvapay-current-plan-usage-meter",
522
523
  "data-solvapay-current-plan-usage-meter": "",
@@ -530,7 +531,7 @@ var CurrentPlanCard = ({
530
531
  }
531
532
  ),
532
533
  isUsageBased && /* @__PURE__ */ jsx5(
533
- "div",
534
+ "p",
534
535
  {
535
536
  className: overrides?.balanceLine ?? "solvapay-current-plan-balance-line",
536
537
  "data-solvapay-current-plan-balance-line": "",
@@ -545,7 +546,7 @@ var CurrentPlanCard = ({
545
546
  }
546
547
  ),
547
548
  /* @__PURE__ */ jsxs4(
548
- "div",
549
+ "section",
549
550
  {
550
551
  className: overrides?.actions ?? "solvapay-current-plan-actions",
551
552
  "data-solvapay-current-plan-actions": "",
@@ -35,7 +35,7 @@ import {
35
35
  useSolvaPay,
36
36
  useTopupAmountSelector,
37
37
  withPaymentElementDefaults
38
- } from "./chunk-6RR4J74H.js";
38
+ } from "./chunk-S6UFWKBW.js";
39
39
 
40
40
  // src/TopupForm.tsx
41
41
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -2672,9 +2672,12 @@ function PaygPayment({ className }) {
2672
2672
  onSuccess: (intent, extras) => flow.notifyPaymentSuccess(intent, extras),
2673
2673
  children: [
2674
2674
  /* @__PURE__ */ jsx7(TopupForm.Loading, {}),
2675
+ /* @__PURE__ */ jsx7(TopupForm.BusinessDetails.Root, { className: "solvapay-checkout-business-details", children: /* @__PURE__ */ jsx7(TopupForm.BusinessDetails.Fields, {}) }),
2676
+ /* @__PURE__ */ jsx7(TopupForm.Summary.Root, { className: "solvapay-checkout-tax-summary", children: /* @__PURE__ */ jsx7(TopupForm.Summary.Rows, {}) }),
2675
2677
  /* @__PURE__ */ jsx7(TopupForm.PaymentElement, {}),
2676
2678
  /* @__PURE__ */ jsx7(TopupForm.Error, { className: "solvapay-checkout-error" }),
2677
2679
  /* @__PURE__ */ jsx7(MandateText, { mode: "topup", amountMinor, currency }),
2680
+ /* @__PURE__ */ jsx7("span", { className: "solvapay-secure-note", children: "Secure payment processed by Stripe" }),
2678
2681
  /* @__PURE__ */ jsxs3(TopupForm.SubmitButton, { className: "solvapay-checkout-pay-button", children: [
2679
2682
  "Pay ",
2680
2683
  formatPrice(amountMinor, currency, { locale })
@@ -2713,9 +2716,12 @@ function RecurringPayment({ className }) {
2713
2716
  onSuccess: (intent) => flow.notifyPaymentSuccess(intent),
2714
2717
  children: [
2715
2718
  /* @__PURE__ */ jsx7(PaymentForm.Loading, {}),
2719
+ /* @__PURE__ */ jsx7(PaymentForm.BusinessDetails.Root, { className: "solvapay-checkout-business-details", children: /* @__PURE__ */ jsx7(PaymentForm.BusinessDetails.Fields, {}) }),
2720
+ /* @__PURE__ */ jsx7(PaymentForm.TaxSummary.Root, { className: "solvapay-checkout-tax-summary", children: /* @__PURE__ */ jsx7(PaymentForm.TaxSummary.Rows, {}) }),
2716
2721
  /* @__PURE__ */ jsx7(PaymentForm.PaymentElement, {}),
2717
2722
  /* @__PURE__ */ jsx7(PaymentForm.Error, { className: "solvapay-checkout-error" }),
2718
2723
  /* @__PURE__ */ jsx7(PaymentForm.MandateText, {}),
2724
+ /* @__PURE__ */ jsx7("span", { className: "solvapay-secure-note", children: "Secure payment processed by Stripe" }),
2719
2725
  /* @__PURE__ */ jsx7(PaymentForm.SubmitButton, { className: "solvapay-checkout-pay-button", children: isRecurring ? `Subscribe \u2014 ${priceLine}` : `Pay ${formattedAmount}` })
2720
2726
  ]
2721
2727
  }