@solvapay/react 2.1.1 → 2.2.0-preview-e3e546693c002c32f128d83bf6c5fe76ac182a79

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.
@@ -1,7 +1,7 @@
1
1
  import * as _solvapay_core from '@solvapay/core';
2
2
  import { TaxIdType, TaxBreakdown, PricingOptionLike, TaxBehavior } from '@solvapay/core';
3
3
  import * as _stripe_stripe_js from '@stripe/stripe-js';
4
- import { PaymentIntent } from '@stripe/stripe-js';
4
+ import { PaymentIntent, Appearance } from '@stripe/stripe-js';
5
5
  import { AuthAdapter } from './adapters/auth.cjs';
6
6
 
7
7
  interface components {
@@ -614,6 +614,42 @@ interface components {
614
614
  /** @default 1 */
615
615
  units: number;
616
616
  };
617
+ CreditActivityEntryDto: {
618
+ /**
619
+ * Signed credit units on the USD peg (100 credits = 1 USD cent)
620
+ * @example -200
621
+ */
622
+ amount: number;
623
+ /**
624
+ * Running credit balance after this event
625
+ * @example 599800
626
+ */
627
+ balance: number;
628
+ /** @description Product display name when the event is product-scoped */
629
+ productName?: string;
630
+ /** @description Product reference when the event is product-scoped */
631
+ productRef?: string;
632
+ /** @description Machine-readable reason when the ledger stored one */
633
+ reason?: string;
634
+ /**
635
+ * ISO-8601 timestamp
636
+ * @example 2026-09-05T14:22:00.000Z
637
+ */
638
+ timestamp: string;
639
+ /**
640
+ * Ledger event type
641
+ * @enum {string}
642
+ */
643
+ type: 'USAGE' | 'TOPUP' | 'GRANT' | 'REFUND' | 'ADJUSTMENT';
644
+ };
645
+ CreditActivityResponseDto: {
646
+ entries: components['schemas']['CreditActivityEntryDto'][];
647
+ /**
648
+ * True when more events exist beyond this page
649
+ * @example false
650
+ */
651
+ hasMore: boolean;
652
+ };
617
653
  CreditDebitSkippedResponse: {
618
654
  /** @enum {number} */
619
655
  debited: false;
@@ -845,6 +881,10 @@ interface components {
845
881
  creditsPerUnit?: number;
846
882
  /** @description ISO 4217 currency code for credit fields */
847
883
  currency?: string;
884
+ /**
885
+ * The effective finite cap for this meter. Present only when the backend measured a finite cap.
886
+ */
887
+ limit?: number;
848
888
  /**
849
889
  * The meter name to use when tracking usage events
850
890
  * @example requests
@@ -869,6 +909,10 @@ interface components {
869
909
  throttled?: boolean;
870
910
  /** @description The customer was auto-upgraded to the target pricing to restore access — `onExceed: auto_upgrade` succeeded. */
871
911
  upgraded?: boolean;
912
+ /**
913
+ * Consumed usage units this period. Present only when the backend measured a finite cap.
914
+ */
915
+ used?: number;
872
916
  /**
873
917
  * Whether the customer is within their usage limits
874
918
  * @example true
@@ -1273,6 +1317,11 @@ interface components {
1273
1317
  stripeAccountId?: string;
1274
1318
  };
1275
1319
  SdkMerchantResponseDto: {
1320
+ /**
1321
+ * City from the legal entity address
1322
+ * @example London
1323
+ */
1324
+ city?: string;
1276
1325
  /**
1277
1326
  * Company registration number (EIN, Companies House No, Org No)
1278
1327
  * @example HRB12345
@@ -1315,6 +1364,11 @@ interface components {
1315
1364
  * @example ACME INC
1316
1365
  */
1317
1366
  statementDescriptor?: string;
1367
+ /**
1368
+ * State, county, or region from the legal entity address. Free text — values like "Greater London" are valid.
1369
+ * @example Greater London
1370
+ */
1371
+ stateOrCounty?: string;
1318
1372
  /**
1319
1373
  * Full set of currencies a customer may pay credit topups in, including the default currency. Omitted/single-entry means single-currency behavior.
1320
1374
  * @example [
@@ -1340,6 +1394,11 @@ interface components {
1340
1394
  * @example DE123456789
1341
1395
  */
1342
1396
  vatNumber?: string;
1397
+ /**
1398
+ * Merchant public website. Distinct from supportUrl so the same URL is not emitted twice.
1399
+ * @example https://acme.com
1400
+ */
1401
+ websiteUrl?: string;
1343
1402
  };
1344
1403
  SdkPaymentIntentListItem: {
1345
1404
  /**
@@ -2261,6 +2320,43 @@ interface operations {
2261
2320
  };
2262
2321
  };
2263
2322
  };
2323
+ CreditActivitySdkController_getActivity: {
2324
+ parameters: {
2325
+ query: {
2326
+ customerRef: string;
2327
+ limit?: number;
2328
+ };
2329
+ header?: never;
2330
+ path?: never;
2331
+ cookie?: never;
2332
+ };
2333
+ requestBody?: never;
2334
+ responses: {
2335
+ /** @description Account-wide credit ledger page. */
2336
+ 200: {
2337
+ headers: {
2338
+ [name: string]: unknown;
2339
+ };
2340
+ content: {
2341
+ 'application/json': components['schemas']['CreditActivityResponseDto'];
2342
+ };
2343
+ };
2344
+ /** @description customerRef is required, or limit is invalid */
2345
+ 400: {
2346
+ headers: {
2347
+ [name: string]: unknown;
2348
+ };
2349
+ content?: never;
2350
+ };
2351
+ /** @description Customer not found */
2352
+ 404: {
2353
+ headers: {
2354
+ [name: string]: unknown;
2355
+ };
2356
+ content?: never;
2357
+ };
2358
+ };
2359
+ };
2264
2360
  CustomerSdkController_getCustomerByQuery: {
2265
2361
  parameters: {
2266
2362
  query?: {
@@ -2908,6 +3004,8 @@ interface operations {
2908
3004
  kind: 'card';
2909
3005
  /** @example 4242 */
2910
3006
  last4: string;
3007
+ /** @example true */
3008
+ reusable: boolean;
2911
3009
  } | {
2912
3010
  /** @enum {string} */
2913
3011
  kind: 'none';
@@ -3748,6 +3846,19 @@ interface operations {
3748
3846
 
3749
3847
  /** SDK purchase row. Generated from the OpenAPI `SdkPurchaseResponse` schema. */
3750
3848
  type PurchaseInfo = components['schemas']['SdkPurchaseResponse'];
3849
+ /**
3850
+ * Extended LimitResponse with SDK-added plan field.
3851
+ *
3852
+ * The backend `LimitResponse` now natively carries the `onExceed` outcome flags
3853
+ * (`throttled` / `overage` / `needsTopUp` / `needsUpgrade` / `upgraded`, resolved
3854
+ * by `decideLimit`), so they flow through from `generated.ts`. `throttled` /
3855
+ * `overage` ride the allow path (`withinLimits: true`) so a protected handler
3856
+ * can read them from `decision.limits` and degrade service or note overage; the
3857
+ * others accompany a gate outcome.
3858
+ */
3859
+ type LimitResponseWithPlan = components['schemas']['LimitResponse'] & {
3860
+ plan: string;
3861
+ };
3751
3862
  type OneTimePurchaseInfo = components['schemas']['OneTimePurchaseInfo'];
3752
3863
  /**
3753
3864
  * Result from processing a payment intent.
@@ -3848,6 +3959,26 @@ type AutoRechargeInput = Omit<components['schemas']['PutAutoRechargeSdkDto'], 'c
3848
3959
  type SaveAutoRechargeInput = Omit<components['schemas']['PutAutoRechargeSdkDto'], 'customerRef' | 'customerEmail' | 'customerName'>;
3849
3960
  type AutoRechargeResponse = components['schemas']['AutoRechargeGetResponse'];
3850
3961
  type SaveAutoRechargeResponse = components['schemas']['SaveAutoRechargeResponse'];
3962
+ /**
3963
+ * SDK-facing merchant identity (source: GET /v1/sdk/merchant).
3964
+ */
3965
+ type SdkMerchantResponse = components['schemas']['SdkMerchantResponseDto'];
3966
+ type CreditActivityType = components['schemas']['CreditActivityEntryDto']['type'];
3967
+ /**
3968
+ * One account-wide credit ledger row from `GET /v1/sdk/credits/activity`.
3969
+ * Seven fields only — amounts are credit units, not money.
3970
+ */
3971
+ type CreditActivityEntry = components['schemas']['CreditActivityEntryDto'];
3972
+ type CreditActivityResult = components['schemas']['CreditActivityResponseDto'];
3973
+ /**
3974
+ * Settled `get_history` / `useHistory` payload. Charges are product-scoped
3975
+ * purchases; credit activity is account-wide. History is not on bootstrap —
3976
+ * `checkPurchaseCore` only returns `status === 'active'`.
3977
+ */
3978
+ interface GetHistoryResult {
3979
+ charges: PurchaseInfo[];
3980
+ creditActivity: CreditActivityResult;
3981
+ }
3851
3982
 
3852
3983
  /**
3853
3984
  * Customer Helper (Core)
@@ -4014,7 +4145,7 @@ interface SolvaPayCopy {
4014
4145
  invalidThreshold: string;
4015
4146
  thresholdTooLow: string;
4016
4147
  minTopupAmount: string;
4017
- topupBelowThreshold: string;
4148
+ deepDrawdownExplainer: string;
4018
4149
  invalidMaxMonthlySpend: string;
4019
4150
  maxMonthlySpendBelowTopup: string;
4020
4151
  maxMonthlySpendLabel: string;
@@ -4030,6 +4161,24 @@ interface SolvaPayCopy {
4030
4161
  taxDisclosure: string;
4031
4162
  statusFailed: string;
4032
4163
  };
4164
+ autoRechargeView: {
4165
+ heading: string;
4166
+ description: string;
4167
+ thresholdLabel: string;
4168
+ topupLabel: string;
4169
+ maxMonthlySpendLabel: string;
4170
+ maxMonthlySpendPlaceholder: string;
4171
+ explainer: string;
4172
+ explainerNoEstimate: string;
4173
+ footerCaption: string;
4174
+ cancel: string;
4175
+ turnOn: string;
4176
+ save: string;
4177
+ turnOff: string;
4178
+ statusOn: string;
4179
+ back: string;
4180
+ setupUnexpected: string;
4181
+ };
4033
4182
  activationFlow: {
4034
4183
  heading: string;
4035
4184
  activateButton: string;
@@ -4074,6 +4223,15 @@ interface SolvaPayCopy {
4074
4223
  validIndefinitely: string;
4075
4224
  /** "Started {date}" — purchase start-date line on `<CurrentPlanCard>`. */
4076
4225
  startedOn: string;
4226
+ /**
4227
+ * Field labels rendered above the otherwise bare values on
4228
+ * `<CurrentPlanCard showFieldLabels>`. A price, a usage rate and a
4229
+ * credit balance are all "a number with a currency" — without a
4230
+ * label the customer cannot tell which one they are reading.
4231
+ */
4232
+ priceFieldLabel: string;
4233
+ rateFieldLabel: string;
4234
+ balanceFieldLabel: string;
4077
4235
  paymentMethod: string;
4078
4236
  paymentMethodExpires: string;
4079
4237
  noPaymentMethod: string;
@@ -4115,8 +4273,106 @@ interface SolvaPayCopy {
4115
4273
  noPlanBody: string;
4116
4274
  /** Inline CTA on the pay-as-you-go state that switches to the Plan tab. */
4117
4275
  seePlansButton: string;
4276
+ /** E upgrade link. Change plan stays the header label. */
4277
+ seePlans: string;
4118
4278
  /** Primary CTA on the no-plan state that switches to the Plan tab. */
4119
4279
  pickPlanButton: string;
4280
+ /** CTA on a free active plan that opens checkout to pick a paid plan. */
4281
+ upgradeButton: string;
4282
+ /** CTA on a non-free active plan that opens checkout to switch plans. */
4283
+ changePlanButton: string;
4284
+ /** Eyebrow above the balance hero. */
4285
+ creditBalance: string;
4286
+ /** Primary top-up CTA on the account strip. */
4287
+ addFunds: string;
4288
+ autoRechargeOn: string;
4289
+ autoRechargeOff: string;
4290
+ turnOn: string;
4291
+ /** On-state link that opens the dedicated auto-recharge view. */
4292
+ manage: string;
4293
+ /** Caption under auto-recharge off on a running credit plan (B). */
4294
+ autoRechargeOffCaption: string;
4295
+ /** Caption under auto-recharge off when calls are already failing (D). */
4296
+ autoRechargeOffFixCaption: string;
4297
+ /** Balance caption when the credit plan is at zero (D). */
4298
+ callsFailingCaption: string;
4299
+ activeProducts: string;
4300
+ /** Caption under the balance when a merchant name is known. */
4301
+ worksAcross: string;
4302
+ /** Fullscreen identity footer. `{merchant}`. No verified suffix. */
4303
+ soldBy: string;
4304
+ /** Portal text link. The button adds the external-link glyph. */
4305
+ fullHistory: string;
4306
+ /** Portal text link. The button adds the external-link glyph. */
4307
+ fullAccount: string;
4308
+ creditActivityEyebrow: string;
4309
+ chargesEyebrow: string;
4310
+ creditActivityCaption: string;
4311
+ creditActivityEmpty: string;
4312
+ creditActivityFailed: string;
4313
+ chargesEmpty: string;
4314
+ chargesFailed: string;
4315
+ eventColumn: string;
4316
+ whenColumn: string;
4317
+ creditsColumn: string;
4318
+ balanceColumn: string;
4319
+ chargeColumn: string;
4320
+ dateColumn: string;
4321
+ amountColumn: string;
4322
+ /** E upgrade prompt. `{total}` `{unit}` `{interval}`. */
4323
+ needMoreAllowance: string;
4324
+ /** E upgrade caption under the See plans link. */
4325
+ upgradePaygCaption: string;
4326
+ /** StatusDot label on state A. */
4327
+ noPlanStatus: string;
4328
+ /** Caption under the product on state A. */
4329
+ choosePlanCaption: string;
4330
+ /** Eyebrow above the A ladder. */
4331
+ plansEyebrow: string;
4332
+ /** Eyebrow above the F ladder. */
4333
+ carryOnEyebrow: string;
4334
+ /** Caption under the A ladder. */
4335
+ plansStartCaption: string;
4336
+ /** Per-row CTA on state A. */
4337
+ activatePlanButton: string;
4338
+ /** Per-row CTA on state F. */
4339
+ switchPlanButton: string;
4340
+ /** Busy label on the clicked A/F ladder row. */
4341
+ activatingPlanButton: string;
4342
+ /** F headline. `{plan}` `{unit}`. */
4343
+ usedUpTitle: string;
4344
+ /** F body when a reset date is known. `{date}` `{days}`. */
4345
+ usedUpBody: string;
4346
+ /** F body when the period has not started. */
4347
+ usedUpBodyNoDate: string;
4348
+ /** F anti-trap when credits > 0. `{credits}` `{plan}`. */
4349
+ antiTrapCredits: string;
4350
+ /** F wait line. `{date}` `{plan}`. */
4351
+ waitUntilReset: string;
4352
+ /** StatusDot label on state H. */
4353
+ notStartedStatus: string;
4354
+ /** H headline. `{total}` `{unit}` `{interval}`. */
4355
+ readyToClaim: string;
4356
+ /** H caption under the headline. */
4357
+ noCardCaption: string;
4358
+ /** H primary CTA. Wires `activatePlan`. */
4359
+ startFreePlan: string;
4360
+ /** I body — calls succeed; no money figure. */
4361
+ stillWorking: string;
4362
+ /** I upgrade link. Change plan stays off. */
4363
+ seeHigherLimit: string;
4364
+ /** I used-of-allowance line. `{used}` `{total}` `{unit}`. */
4365
+ usedOfAllowance: string;
4366
+ /** J StatusDot. `{date}` is month + day. */
4367
+ activeUntil: string;
4368
+ /** J plan line. `{plan}` `{date}`. */
4369
+ cancelledPlanLine: string;
4370
+ /** J headline. `{days}`. */
4371
+ daysLeftTitle: string;
4372
+ /** J body. `{date}` is month + day. */
4373
+ cancelledBody: string;
4374
+ /** J secondary CTA. `{plan}`. */
4375
+ reactivatePlan: string;
4120
4376
  };
4121
4377
  customerPortal: {
4122
4378
  launchButton: string;
@@ -4255,6 +4511,37 @@ interface SolvaPayCopy {
4255
4511
  topUpCta: string;
4256
4512
  upgradeCta: string;
4257
4513
  refreshCta: string;
4514
+ /** FactBand eyebrows. */
4515
+ remainingEyebrow: string;
4516
+ renewsEyebrow: string;
4517
+ resetsEyebrow: string;
4518
+ creditsEyebrow: string;
4519
+ usedEyebrow: string;
4520
+ /** "{remaining} {unit}" — wide Remaining headline. */
4521
+ remainingCalls: string;
4522
+ /** "{remaining} of {total} {unit}" — compact Remaining value. */
4523
+ remainingOfTotal: string;
4524
+ /** "Of {total} this period." */
4525
+ ofTotalThisPeriod: string;
4526
+ /** "{used} of {total} {unit} used, {percent}%." */
4527
+ usedOfTotalPercent: string;
4528
+ warningThresholdHint: string;
4529
+ lastCallHint: string;
4530
+ afterFirstCall: string;
4531
+ /** FactBand Renews/Resets caption. */
4532
+ inDays: string;
4533
+ notKnownYet: string;
4534
+ creditsNotUsed: string;
4535
+ creditsUntouched: string;
4536
+ /** Fullscreen C credits caption. Widget C/E keep `creditsUntouched`. */
4537
+ creditsDoNotSpend: string;
4538
+ rateConfirmedAtCheckout: string;
4539
+ fromCreditsPerCall: string;
4540
+ creditsPerCall: string;
4541
+ /** Accent pills: D / I / F. */
4542
+ callsFailing: string;
4543
+ overAllowance: string;
4544
+ limitReached: string;
4258
4545
  };
4259
4546
  }
4260
4547
  /**
@@ -4304,6 +4591,18 @@ interface TransportLimitsResult {
4304
4591
  needsUpgrade?: boolean;
4305
4592
  /** The customer was auto-upgraded and access was restored. */
4306
4593
  upgraded?: boolean;
4594
+ /**
4595
+ * Consumed units this period. Present only when the backend measured
4596
+ * a finite cap. Authoritative — do not reconstruct from
4597
+ * `purchase.usage.used`.
4598
+ */
4599
+ used?: number;
4600
+ /**
4601
+ * The effective finite cap for this meter. Present only when the
4602
+ * backend measured a finite cap. Authoritative — do not reconstruct
4603
+ * as `used + remaining`.
4604
+ */
4605
+ limit?: number;
4307
4606
  }
4308
4607
  interface TransportCheckoutSessionResult {
4309
4608
  checkoutUrl: string;
@@ -4323,11 +4622,12 @@ interface TransportCustomerSessionResult {
4323
4622
  interface SolvaPayTransport {
4324
4623
  /**
4325
4624
  * Read tools. HTTP transports implement these via `GET /api/*` routes.
4326
- * MCP adapters omit them because the data is delivered on the
4327
- * bootstrap payload (see `BootstrapPayload.customer` / `merchant` /
4328
- * `product` / `plans` in `@solvapay/mcp`). Hooks consume these via
4329
- * module-level caches that the MCP host seeds at mount time, so the
4330
- * transport path is only exercised on HTTP.
4625
+ * MCP adapters omit reads for data the bootstrap already holds
4626
+ * (purchase, merchant, product, plans, payment method, balance,
4627
+ * usage, limits) — `seedMcpCaches` hydrates those. That invariant is
4628
+ * "do not refetch what bootstrap already has", not a blanket ban.
4629
+ * `getHistory` is the exception: charge / credit activity is not on
4630
+ * bootstrap (`checkPurchaseCore` is active-only).
4331
4631
  */
4332
4632
  checkPurchase?: () => Promise<CustomerPurchaseData>;
4333
4633
  getBalance?: () => Promise<TransportBalanceResult>;
@@ -4356,16 +4656,24 @@ interface SolvaPayTransport {
4356
4656
  /**
4357
4657
  * Optional: fetch the customer's runtime allowance for a (product, meter)
4358
4658
  * pair. HTTP transports implement via
4359
- * `GET /api/limits?productRef=…&meterName=…`. MCP adapters typically omit
4360
- * — the value lives on the bootstrap payload and refreshes via
4361
- * `refreshBootstrap()`. When undefined, `useLimits()` returns `null` for
4362
- * `remaining` / `withinLimits` with `loading: false` (graceful fallback,
4363
- * matching `useUsage`'s behaviour when `getUsage` is absent).
4659
+ * `GET /api/limits?productRef=…&meterName=…`. MCP adapters omit the
4660
+ * method — bootstrap seeds `limitsCache` and `useUsage` prefers the
4661
+ * seeded snapshot. When undefined and nothing is seeded, `useLimits()`
4662
+ * returns `null` for `remaining` / `withinLimits` with `loading: false`.
4364
4663
  */
4365
4664
  getLimits?: (params: {
4366
4665
  productRef: string;
4367
4666
  meterName?: string;
4368
4667
  }) => Promise<TransportLimitsResult>;
4668
+ /**
4669
+ * Product-scoped charges plus account-wide credit activity. Fetch on
4670
+ * history-section mount, not app mount. HTTP: `GET /api/history`.
4671
+ * MCP: `get_history` UI-only tool.
4672
+ */
4673
+ getHistory?: (params?: {
4674
+ productRef?: string;
4675
+ limit?: number;
4676
+ }) => Promise<GetHistoryResult>;
4369
4677
  createPayment: (params: {
4370
4678
  planRef?: string;
4371
4679
  productRef?: string;
@@ -4409,6 +4717,10 @@ interface SolvaPayTransport {
4409
4717
  isBusiness: boolean;
4410
4718
  businessName?: string;
4411
4719
  country?: string;
4720
+ customerCountry?: string;
4721
+ customerName?: string;
4722
+ customerState?: string;
4723
+ customerPostalCode?: string;
4412
4724
  taxId?: string;
4413
4725
  taxIdType?: TaxIdType;
4414
4726
  }) => Promise<{
@@ -4451,40 +4763,10 @@ interface PaymentIntentResult {
4451
4763
  processorPaymentId?: string;
4452
4764
  }
4453
4765
  /**
4454
- * Subset of merchant identity surfaced by `GET /v1/sdk/merchant`.
4766
+ * Merchant identity surfaced by `GET /v1/sdk/merchant`.
4455
4767
  * Used by `<MandateText>` and customer-facing trust signals.
4456
4768
  */
4457
- interface Merchant {
4458
- displayName: string;
4459
- legalName: string;
4460
- supportEmail?: string;
4461
- supportUrl?: string;
4462
- termsUrl?: string;
4463
- privacyUrl?: string;
4464
- country?: string;
4465
- /** Company registration number (EIN, Companies House No, Org No). */
4466
- companyNumber?: string;
4467
- /** Tax identification number (US: EIN). */
4468
- taxId?: string;
4469
- /** VAT identification number (UK/EU). */
4470
- vatNumber?: string;
4471
- defaultCurrency?: string;
4472
- /**
4473
- * Full set of currencies (including `defaultCurrency`) the customer may
4474
- * pay credit topups in. Surfaced only when the merchant enabled more than
4475
- * one — single-currency merchants leave this undefined and keep today's
4476
- * behavior. Drives the topup currency switcher in the PAYG amount step.
4477
- */
4478
- supportedTopupCurrencies?: string[];
4479
- statementDescriptor?: string;
4480
- logoUrl?: string;
4481
- /**
4482
- * Absolute URL to a square app icon / logomark. Preferred over
4483
- * `logoUrl` for avatar slots and chrome-strip icons that can't
4484
- * letterbox a landscape mark.
4485
- */
4486
- iconUrl?: string;
4487
- }
4769
+ type Merchant = SdkMerchantResponse;
4488
4770
  interface UseMerchantReturn {
4489
4771
  merchant: Merchant | null;
4490
4772
  loading: boolean;
@@ -4583,6 +4865,12 @@ interface TopupFormProps {
4583
4865
  submitButtonText?: string;
4584
4866
  className?: string;
4585
4867
  buttonClassName?: string;
4868
+ /**
4869
+ * Stripe Elements appearance. When omitted, the form reads `--solvapay-*`
4870
+ * tokens from the form root and builds a host-matched appearance. Pass
4871
+ * `null` to restore Stripe's default theme.
4872
+ */
4873
+ appearance?: Appearance | null;
4586
4874
  }
4587
4875
  interface PurchaseStatus {
4588
4876
  loading: boolean;
@@ -4663,6 +4951,7 @@ interface SolvaPayProviderInitial {
4663
4951
  paymentMethod: PaymentMethodInfo | null;
4664
4952
  balance: CustomerBalanceResult | null;
4665
4953
  usage: GetUsageResult | null;
4954
+ limits: LimitResponseWithPlan | null;
4666
4955
  merchant: Merchant;
4667
4956
  product: Product;
4668
4957
  plans: Plan[];
@@ -4692,6 +4981,7 @@ interface SolvaPayConfig {
4692
4981
  autoRecharge?: string;
4693
4982
  getUsage?: string;
4694
4983
  getLimits?: string;
4984
+ getHistory?: string;
4695
4985
  };
4696
4986
  /**
4697
4987
  * Data-access transport. Replaces the default HTTP calls with any
@@ -4843,6 +5133,10 @@ interface SolvaPayContextValue {
4843
5133
  isBusiness: boolean;
4844
5134
  businessName?: string;
4845
5135
  country?: string;
5136
+ customerCountry?: string;
5137
+ customerName?: string;
5138
+ customerState?: string;
5139
+ customerPostalCode?: string;
4846
5140
  taxId?: string;
4847
5141
  taxIdType?: _solvapay_core.TaxIdType;
4848
5142
  }) => Promise<{
@@ -5134,6 +5428,12 @@ interface PaymentFormProps {
5134
5428
  requireTermsAcceptance?: boolean;
5135
5429
  /** Fired when business-details attach returns an updated tax breakdown. */
5136
5430
  onTaxChange?: (breakdown: _solvapay_core.TaxBreakdown) => void;
5431
+ /**
5432
+ * Stripe Elements appearance. When omitted, the form reads `--solvapay-*`
5433
+ * tokens from the form root and builds a host-matched appearance. Pass
5434
+ * `null` to restore Stripe's default theme.
5435
+ */
5436
+ appearance?: Appearance | null;
5137
5437
  }
5138
5438
  interface UseTopupAmountSelectorOptions {
5139
5439
  currency: string;
@@ -5171,16 +5471,17 @@ type CheckoutStep = 'plan' | 'amount' | 'payment' | 'success';
5171
5471
  *
5172
5472
  * Mirrors what the API actually sends: pricing lives in `options[]`, and
5173
5473
  * the only derived scalars on the wire are `type`, `price`, `currency`
5174
- * and `requiresPayment`.
5474
+ * and `requiresPayment`. Every field admits `null` because frozen plan
5475
+ * snapshots send it explicitly; it is read as "absent" throughout.
5175
5476
  */
5176
5477
  interface BootstrapPlanLike {
5177
- reference?: string;
5178
- name?: string;
5179
- type?: string;
5180
- price?: number;
5181
- currency?: string;
5182
- requiresPayment?: boolean;
5183
- options?: PricingOptionLike[];
5478
+ reference?: string | null;
5479
+ name?: string | null;
5480
+ type?: string | null;
5481
+ price?: number | null;
5482
+ currency?: string | null;
5483
+ requiresPayment?: boolean | null;
5484
+ options?: PricingOptionLike[] | null;
5184
5485
  pricingOptions?: Array<{
5185
5486
  currency: string;
5186
5487
  price: number;
@@ -5210,4 +5511,37 @@ type SuccessMeta = {
5210
5511
  nextRenewalLabel: string | null;
5211
5512
  };
5212
5513
 
5213
- export { type components as $, type ActivationResult as A, type BalanceStatus as B, type CheckoutResult as C, type BootstrapPlanLike as D, type CheckoutStep as E, type CustomerPurchaseData as F, type MandateTemplate as G, type Merchant as H, type PaymentError as I, type PaymentIntentResult as J, type PaymentMethodInfo as K, type PaymentResult as L, type MandateContext as M, type PurchaseStatusValue as N, type SuccessMeta as O, type PaymentFormProps as P, type TopupPaymentResult as Q, type ReactivateResult as R, type SolvaPayProviderProps as S, type TopupFormProps as T, type UsePlansOptions as U, type TransportBalanceResult as V, type TransportCheckoutSessionResult as W, type TransportCustomerSessionResult as X, type TransportLimitsResult as Y, UnsupportedTransportMethodError as Z, type SolvaPayProviderInitial as _, type PrefillCustomer as a, type AutoRechargeInput as a0, type AutoRechargeDisplayBlock as a1, type Plan as b, type SaveAutoRechargeResponse as c, type PurchaseStatus as d, type SolvaPayContextValue as e, type UsePlansReturn as f, type UsePlanOptions as g, type UsePlanReturn as h, type UseProductReturn as i, type UseMerchantReturn as j, type SolvaPayCopy as k, type PurchaseStatusReturn as l, type CancelResult as m, type ActivatePlanResult as n, type UseTopupOptions as o, type UseTopupReturn as p, type UseTopupAmountSelectorOptions as q, type UseTopupAmountSelectorReturn as r, type UsePaymentMethodReturn as s, type AutoRechargeConfig as t, type SaveAutoRechargeInput as u, type SolvaPayTransport as v, type PartialSolvaPayCopy as w, type PurchaseInfo as x, type Product as y, type SolvaPayConfig as z };
5514
+ interface UseUsageReturn {
5515
+ /** Raw usage snapshot (`null` when no usage-based plan is active). */
5516
+ usage: UsageSnapshot | null;
5517
+ loading: boolean;
5518
+ error: Error | null;
5519
+ refetch: () => Promise<void>;
5520
+ /** 0-100, rounded to 2dp. `null` when total is unknown (unlimited/empty). */
5521
+ percentUsed: number | null;
5522
+ /** Plan is usage-based, `percentUsed >= 80`. */
5523
+ isApproachingLimit: boolean;
5524
+ /** Plan is usage-based, `percentUsed >= 100`. */
5525
+ isAtLimit: boolean;
5526
+ /**
5527
+ * True when the backend reports no finite cap on this meter. Sourced
5528
+ * from `useLimits().unlimited`, never inferred from a missing `total`
5529
+ * — an unknown cap is not an absent one.
5530
+ */
5531
+ isUnlimited: boolean;
5532
+ /** The meter reference (e.g. `'tokens'`). `null` when not usage-based. */
5533
+ meterRef: string | null;
5534
+ }
5535
+ interface UsageSnapshot {
5536
+ meterRef: string | null;
5537
+ total: number | null;
5538
+ used: number;
5539
+ remaining: number | null;
5540
+ percentUsed: number | null;
5541
+ periodStart?: string;
5542
+ periodEnd?: string;
5543
+ purchaseRef?: string;
5544
+ }
5545
+ declare function useUsage(): UseUsageReturn;
5546
+
5547
+ export { type UseUsageReturn as $, type ActivationResult as A, type BootstrapPlanLike as B, type CheckoutResult as C, type SolvaPayConfig as D, type CheckoutStep as E, type CustomerPurchaseData as F, type MandateTemplate as G, type Merchant as H, type PaymentError as I, type PaymentIntentResult as J, type PaymentMethodInfo as K, type PaymentResult as L, type MandateContext as M, type PurchaseStatusValue as N, type SuccessMeta as O, type PaymentFormProps as P, type TopupPaymentResult as Q, type ReactivateResult as R, type SolvaPayProviderProps as S, type TopupFormProps as T, type UsePlansOptions as U, type TransportBalanceResult as V, type TransportCheckoutSessionResult as W, type TransportCustomerSessionResult as X, type TransportLimitsResult as Y, UnsupportedTransportMethodError as Z, type UsageSnapshot as _, type PrefillCustomer as a, useUsage as a0, type SolvaPayProviderInitial as a1, type CreditActivityType as a2, type CreditActivityEntry as a3, type components as a4, type AutoRechargeInput as a5, type AutoRechargeDisplayBlock as a6, type Plan as b, type SaveAutoRechargeResponse as c, type PurchaseStatus as d, type SolvaPayContextValue as e, type UsePlansReturn as f, type UsePlanOptions as g, type UsePlanReturn as h, type UseProductReturn as i, type UseMerchantReturn as j, type SolvaPayCopy as k, type PurchaseStatusReturn as l, type CancelResult as m, type ActivatePlanResult as n, type UseTopupOptions as o, type UseTopupReturn as p, type BalanceStatus as q, type UseTopupAmountSelectorOptions as r, type UseTopupAmountSelectorReturn as s, type UsePaymentMethodReturn as t, type AutoRechargeConfig as u, type SaveAutoRechargeInput as v, type SolvaPayTransport as w, type PartialSolvaPayCopy as x, type PurchaseInfo as y, type Product as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solvapay/react",
3
- "version": "2.1.1",
3
+ "version": "2.2.0-preview-e3e546693c002c32f128d83bf6c5fe76ac182a79",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -57,7 +57,7 @@
57
57
  "directory": "packages/react"
58
58
  },
59
59
  "peerDependencies": {
60
- "@solvapay/mcp-core": "^0.2.8 || ^0.3.0",
60
+ "@solvapay/mcp-core": "0.4.0-preview-e3e546693c002c32f128d83bf6c5fe76ac182a79",
61
61
  "react": "^18.2.0 || ^19.0.0",
62
62
  "react-dom": "^18.2.0 || ^19.0.0"
63
63
  },
@@ -69,7 +69,7 @@
69
69
  "dependencies": {
70
70
  "@stripe/react-stripe-js": "^6.0.0",
71
71
  "@stripe/stripe-js": "^9.0.0",
72
- "@solvapay/core": "1.6.0"
72
+ "@solvapay/core": "1.6.0-preview-e3e546693c002c32f128d83bf6c5fe76ac182a79"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@testing-library/dom": "^10.4.1",
@@ -85,8 +85,8 @@
85
85
  "react-dom": "^19.2.5",
86
86
  "typescript": "^5.9.3",
87
87
  "vitest": "^4.1.2",
88
- "@solvapay/mcp-core": "0.3.4",
89
- "@solvapay/server": "2.3.1",
88
+ "@solvapay/mcp-core": "0.4.0-preview-e3e546693c002c32f128d83bf6c5fe76ac182a79",
89
+ "@solvapay/server": "2.4.0-preview-e3e546693c002c32f128d83bf6c5fe76ac182a79",
90
90
  "@solvapay/test-utils": "0.0.0"
91
91
  },
92
92
  "scripts": {