@solvapay/react 2.7.1 → 2.7.2-preview-57b3a29d622ec889a6e8af99ed3fc94518a24f7c

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.
@@ -803,7 +803,6 @@ var import_react7 = require("react");
803
803
 
804
804
  // ../server/src/index.ts
805
805
  var import_node_crypto = __toESM(require("crypto"), 1);
806
- var import_core = require("@solvapay/core");
807
806
 
808
807
  // ../server/src/helpers/balance-poll.ts
809
808
  var BALANCE_RECONCILE_DELAYS_MS = [500, 1e3, 2e3, 4e3, 8e3, 16e3];
@@ -2836,7 +2835,7 @@ function useLimits(options) {
2836
2835
  }
2837
2836
 
2838
2837
  // src/hooks/useUsage.ts
2839
- var import_core2 = require("@solvapay/core");
2838
+ var import_core = require("@solvapay/core");
2840
2839
  var import_react15 = require("react");
2841
2840
 
2842
2841
  // src/hooks/usePurchase.ts
@@ -2858,7 +2857,7 @@ function seedUsageSnapshot(usage) {
2858
2857
  function deriveUsage(purchase, limits) {
2859
2858
  if (!purchase) return null;
2860
2859
  const usage = purchase.usage;
2861
- if (!(0, import_core2.countsUsage)(purchase.planSnapshot) && purchase.planSnapshot?.isMetered !== true && !usage) {
2860
+ if (!(0, import_core.countsUsage)(purchase.planSnapshot) && purchase.planSnapshot?.isMetered !== true && !usage) {
2862
2861
  return null;
2863
2862
  }
2864
2863
  const hasFiniteCap = limits.unlimited === false && limits.remaining !== null;
@@ -2888,7 +2887,7 @@ function useUsage() {
2888
2887
  setSeedGeneration(usageSeedGeneration);
2889
2888
  setOverride(seededUsage);
2890
2889
  }
2891
- const usageCounted = (0, import_core2.countsUsage)(activePurchase?.planSnapshot) || activePurchase?.planSnapshot?.isMetered === true;
2890
+ const usageCounted = (0, import_core.countsUsage)(activePurchase?.planSnapshot) || activePurchase?.planSnapshot?.isMetered === true;
2892
2891
  const {
2893
2892
  remaining: limitRemaining,
2894
2893
  unlimited,
@@ -3030,24 +3029,24 @@ function useLocale() {
3030
3029
  }
3031
3030
 
3032
3031
  // src/mcp/account-state.ts
3033
- var import_core4 = require("@solvapay/core");
3032
+ var import_core3 = require("@solvapay/core");
3034
3033
 
3035
3034
  // src/mcp/plan-actions.ts
3036
- var import_core3 = require("@solvapay/core");
3035
+ var import_core2 = require("@solvapay/core");
3037
3036
  function isPaidPlan(plan) {
3038
3037
  if (plan.requiresPayment === false) return false;
3039
- if ((0, import_core3.charges)(plan).some((charge) => charge.amountMinor > 0)) return true;
3038
+ if ((0, import_core2.charges)(plan).some((charge) => charge.amountMinor > 0)) return true;
3040
3039
  return (plan.price ?? 0) > 0;
3041
3040
  }
3042
3041
  function isMeteredPlan(plan) {
3043
- return (0, import_core3.countsUsage)(plan);
3042
+ return (0, import_core2.countsUsage)(plan);
3044
3043
  }
3045
3044
  function resolvePlanShape(plan) {
3046
3045
  if (!plan) return null;
3047
- if (((0, import_core3.trialDays)(plan) ?? 0) > 0) return "trial";
3046
+ if (((0, import_core2.trialDays)(plan) ?? 0) > 0) return "trial";
3048
3047
  if (!isPaidPlan(plan)) return "free";
3049
3048
  const metered = isMeteredPlan(plan);
3050
- if ((0, import_core3.billingCycle)(plan)) return metered ? "recurring-metered" : "recurring-unlimited";
3049
+ if ((0, import_core2.billingCycle)(plan)) return metered ? "recurring-metered" : "recurring-unlimited";
3051
3050
  return metered ? "usage-based" : "recurring-unlimited";
3052
3051
  }
3053
3052
  function resolveActivationStrategy(plan) {
@@ -3158,9 +3157,9 @@ function resolveMeterTone(input) {
3158
3157
  return "ok";
3159
3158
  }
3160
3159
  function resolveRateDisplay(plan, balance, meter) {
3161
- const rate = (0, import_core4.usageRate)(plan, meter);
3160
+ const rate = (0, import_core3.usageRate)(plan, meter);
3162
3161
  if (!rate) return { kind: "none", label: null, showRunway: false };
3163
- const credits = (0, import_core4.creditsPerUnitFromBalance)(plan, balance, meter);
3162
+ const credits = (0, import_core3.creditsPerUnitFromBalance)(plan, balance, meter);
3164
3163
  if (credits === null) {
3165
3164
  return { kind: "unconvertible", label: "Rate confirmed at checkout", showRunway: false };
3166
3165
  }
@@ -3184,7 +3183,7 @@ function resolvePeriodDisplay(periodEnd) {
3184
3183
  return { kind: "date", periodEnd };
3185
3184
  }
3186
3185
  function resolveOneTimeDisplay(plan) {
3187
- if ((0, import_core4.billingCycle)(plan)) return { showRenews: true, planQualifier: null };
3186
+ if ((0, import_core3.billingCycle)(plan)) return { showRenews: true, planQualifier: null };
3188
3187
  if (resolvePlanShape(plan) === "usage-based") {
3189
3188
  return { showRenews: false, planQualifier: null };
3190
3189
  }
@@ -3194,7 +3193,7 @@ function resolveMerchantStrip() {
3194
3193
  return { required: false };
3195
3194
  }
3196
3195
  function remainingCap(plan, meter) {
3197
- return (0, import_core4.includedUnits)(plan, meter);
3196
+ return (0, import_core3.includedUnits)(plan, meter);
3198
3197
  }
3199
3198
  var MS_PER_DAY = 24 * 60 * 60 * 1e3;
3200
3199
  function daysUntil(iso, now = /* @__PURE__ */ new Date()) {
@@ -3380,10 +3379,10 @@ function useDisplayMode() {
3380
3379
  }
3381
3380
 
3382
3381
  // src/mcp/views/AllowanceAccountPanel.tsx
3383
- var import_core8 = require("@solvapay/core");
3382
+ var import_core7 = require("@solvapay/core");
3384
3383
 
3385
3384
  // src/primitives/checkout/shared.ts
3386
- var import_core6 = require("@solvapay/core");
3385
+ var import_core5 = require("@solvapay/core");
3387
3386
 
3388
3387
  // src/utils/isPayg.ts
3389
3388
  function isPaygPlan(plan) {
@@ -3391,13 +3390,13 @@ function isPaygPlan(plan) {
3391
3390
  }
3392
3391
 
3393
3392
  // src/utils/planPricing.ts
3394
- var import_core5 = require("@solvapay/core");
3393
+ var import_core4 = require("@solvapay/core");
3395
3394
  function getPlanPricingOptions(plan) {
3396
3395
  if (plan.pricingOptions && plan.pricingOptions.length > 0) {
3397
3396
  return plan.pricingOptions;
3398
3397
  }
3399
3398
  const defaultCurrency = (plan.currency ?? "USD").toUpperCase();
3400
- const charges2 = (0, import_core5.headlineCharges)(plan);
3399
+ const charges2 = (0, import_core4.headlineCharges)(plan);
3401
3400
  if (charges2.length > 0) {
3402
3401
  return charges2.map((charge) => ({
3403
3402
  currency: charge.currency,
@@ -3446,7 +3445,7 @@ function formatContinueLabel(plan, locale, pricingOption) {
3446
3445
  return `Continue with ${plan.name ?? "Plan"} \u2014 ${priceLabel}`;
3447
3446
  }
3448
3447
  function planBillingCycle(plan) {
3449
- return (0, import_core6.billingCycle)(plan);
3448
+ return (0, import_core5.billingCycle)(plan);
3450
3449
  }
3451
3450
  function formatCycleSuffix(cycle) {
3452
3451
  if (!cycle) return "";
@@ -3455,7 +3454,7 @@ function formatCycleSuffix(cycle) {
3455
3454
  return `/${short}`;
3456
3455
  }
3457
3456
  function formatPlanPriceLabel(plan, locale, pricingOption) {
3458
- const shape = (0, import_core6.planPricingShape)(plan);
3457
+ const shape = (0, import_core5.planPricingShape)(plan);
3459
3458
  switch (shape.shape) {
3460
3459
  case "free":
3461
3460
  return "Free";
@@ -3484,27 +3483,27 @@ function singularMeterNoun(unit) {
3484
3483
  return unit;
3485
3484
  }
3486
3485
  function formatPaygRate(plan, locale, balance) {
3487
- const rate = (0, import_core6.usageRate)(plan);
3486
+ const rate = (0, import_core5.usageRate)(plan);
3488
3487
  if (!rate || !(rate.amountMinor > 0)) return null;
3489
3488
  const prefix = rate.tiered ? "from " : "";
3490
- const credits = (0, import_core6.creditsPerUnitFromBalance)(plan, balance);
3491
- const unit = singularMeterNoun(rate.meter ?? (0, import_core6.meterName)(plan) ?? "unit");
3489
+ const credits = (0, import_core5.creditsPerUnitFromBalance)(plan, balance);
3490
+ const unit = singularMeterNoun(rate.meter ?? (0, import_core5.meterName)(plan) ?? "unit");
3492
3491
  if (credits != null) {
3493
3492
  return `${prefix}${credits.toLocaleString(locale)} ${credits === 1 ? "credit" : "credits"} / ${unit}`;
3494
3493
  }
3495
3494
  return `${prefix}${formatPrice(rate.amountMinor, rate.currency.toUpperCase(), { locale })} / ${unit}`;
3496
3495
  }
3497
3496
  function inferIncludedUnits(plan) {
3498
- const cap = (0, import_core6.includedUnits)(plan);
3497
+ const cap = (0, import_core5.includedUnits)(plan);
3499
3498
  return cap != null && cap > 0 ? cap : null;
3500
3499
  }
3501
3500
  function planMeterName(plan) {
3502
- return (0, import_core6.meterName)(plan);
3501
+ return (0, import_core5.meterName)(plan);
3503
3502
  }
3504
3503
  function recurringCreditNote(plan) {
3505
- const [meter] = (0, import_core6.creditDrawnMeters)(plan);
3504
+ const [meter] = (0, import_core5.creditDrawnMeters)(plan);
3506
3505
  if (!meter) return null;
3507
- const cap = (0, import_core6.includedUnits)(plan, meter);
3506
+ const cap = (0, import_core5.includedUnits)(plan, meter);
3508
3507
  if (cap != null && cap > 0) {
3509
3508
  return `Usage past your ${cap.toLocaleString()} included ${meter} is paid from credits. Your balance is 0.`;
3510
3509
  }
@@ -4668,7 +4667,7 @@ function PortalTextLink({ children }) {
4668
4667
  }
4669
4668
 
4670
4669
  // src/mcp/views/accountViewShared.tsx
4671
- var import_core7 = require("@solvapay/core");
4670
+ var import_core6 = require("@solvapay/core");
4672
4671
 
4673
4672
  // src/hooks/useBalance.ts
4674
4673
  var import_react22 = require("react");
@@ -4752,14 +4751,14 @@ function formatFiatEquivalent({
4752
4751
  locale
4753
4752
  }) {
4754
4753
  if (!displayCurrency || !creditsPerMinorUnit) return null;
4755
- const displayMinor = (0, import_core7.creditsToDisplayMinorUnits)({
4754
+ const displayMinor = (0, import_core6.creditsToDisplayMinorUnits)({
4756
4755
  credits,
4757
4756
  creditsPerMinorUnit,
4758
4757
  displayExchangeRate: displayExchangeRate ?? 1,
4759
4758
  displayCurrency
4760
4759
  });
4761
4760
  if (displayMinor === null) return null;
4762
- const minorPerMajor = (0, import_core7.minorUnitsPerMajor)(displayCurrency);
4761
+ const minorPerMajor = (0, import_core6.minorUnitsPerMajor)(displayCurrency);
4763
4762
  return new Intl.NumberFormat(locale, {
4764
4763
  style: "currency",
4765
4764
  currency: displayCurrency,
@@ -4915,7 +4914,7 @@ function AllowanceAccountPanel({
4915
4914
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: interpolate(copy.account.needMoreAllowance, {
4916
4915
  total: new Intl.NumberFormat(locale).format(total ?? cap ?? 0),
4917
4916
  unit: allowanceMeterUnit(meter, total ?? cap ?? 0),
4918
- interval: (0, import_core8.billingCycle)(planForActions)?.interval ?? "month"
4917
+ interval: (0, import_core7.billingCycle)(planForActions)?.interval ?? "month"
4919
4918
  }) }),
4920
4919
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: cx2.muted, children: copy.account.upgradePaygCaption })
4921
4920
  ] }),
@@ -5146,7 +5145,7 @@ function CreditAccountPanel({
5146
5145
  }
5147
5146
 
5148
5147
  // src/mcp/views/ForcedAccountPanel.tsx
5149
- var import_core9 = require("@solvapay/core");
5148
+ var import_core8 = require("@solvapay/core");
5150
5149
 
5151
5150
  // src/hooks/useActivation.ts
5152
5151
  var import_react23 = require("react");
@@ -5305,7 +5304,7 @@ function usePurchaseActions() {
5305
5304
 
5306
5305
  // src/utils/errors.ts
5307
5306
  var DOCS_BASE_URL = "https://solvapay.com/docs";
5308
- var SolvaPayError2 = class extends Error {
5307
+ var SolvaPayError = class extends Error {
5309
5308
  code;
5310
5309
  docsUrl;
5311
5310
  constructor(code, message, docsUrl) {
@@ -5315,7 +5314,7 @@ var SolvaPayError2 = class extends Error {
5315
5314
  this.docsUrl = docsUrl;
5316
5315
  }
5317
5316
  };
5318
- var MissingProviderError = class extends SolvaPayError2 {
5317
+ var MissingProviderError = class extends SolvaPayError {
5319
5318
  constructor(primitiveName) {
5320
5319
  const docsUrl = `${DOCS_BASE_URL}/troubleshooting/missing-provider`;
5321
5320
  super(
@@ -5326,7 +5325,7 @@ var MissingProviderError = class extends SolvaPayError2 {
5326
5325
  this.name = "MissingProviderError";
5327
5326
  }
5328
5327
  };
5329
- var MissingProductRefError = class extends SolvaPayError2 {
5328
+ var MissingProductRefError = class extends SolvaPayError {
5330
5329
  constructor(primitiveName) {
5331
5330
  const docsUrl = `${DOCS_BASE_URL}/primitives/product-ref`;
5332
5331
  super(
@@ -5591,11 +5590,11 @@ function ActivateAccountPanel({
5591
5590
  if (!productRef) {
5592
5591
  throw new Error("McpAccountView: state H requires productRef");
5593
5592
  }
5594
- const cap = (0, import_core9.includedUnits)(freePlan);
5593
+ const cap = (0, import_core8.includedUnits)(freePlan);
5595
5594
  if (cap == null || cap <= 0) {
5596
5595
  throw new Error("McpAccountView: state H free plan has no included cap");
5597
5596
  }
5598
- const cycle = (0, import_core9.billingCycle)(freePlan);
5597
+ const cycle = (0, import_core8.billingCycle)(freePlan);
5599
5598
  const unit = allowanceMeterUnit(null, cap);
5600
5599
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "solvapay-mcp-account", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: cx2.card, children: [
5601
5600
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -5811,17 +5810,17 @@ function formatCount2(value, locale) {
5811
5810
 
5812
5811
  // src/mcp/views/LadderAccountPanel.tsx
5813
5812
  var import_react27 = require("react");
5814
- var import_core12 = require("@solvapay/core");
5813
+ var import_core11 = require("@solvapay/core");
5815
5814
 
5816
5815
  // src/mcp/views/checkout/LadderPlanRow.tsx
5817
- var import_core11 = require("@solvapay/core");
5816
+ var import_core10 = require("@solvapay/core");
5818
5817
 
5819
5818
  // src/mcp/plan-consequence.ts
5820
- var import_core10 = require("@solvapay/core");
5819
+ var import_core9 = require("@solvapay/core");
5821
5820
  function planConsequence(plan, locale, balance, extras = {}) {
5822
5821
  const shape = resolvePlanShape(plan);
5823
- const meter = (0, import_core10.meterName)(plan);
5824
- const interval = (0, import_core10.billingCycle)(plan)?.interval ?? "month";
5822
+ const meter = (0, import_core9.meterName)(plan);
5823
+ const interval = (0, import_core9.billingCycle)(plan)?.interval ?? "month";
5825
5824
  if (shape === "usage-based") {
5826
5825
  return paygConsequence(plan, locale, balance, extras.merchantName);
5827
5826
  }
@@ -5846,7 +5845,7 @@ function planConsequence(plan, locale, balance, extras = {}) {
5846
5845
  return `Unlimited ${unit}. No credits used. Cancel any time.`;
5847
5846
  }
5848
5847
  function paygConsequence(plan, locale, balance, merchantName) {
5849
- const credits = (0, import_core10.creditsPerUnitFromBalance)(plan, balance);
5848
+ const credits = (0, import_core9.creditsPerUnitFromBalance)(plan, balance);
5850
5849
  const across = merchantName ? ` Credits work across every ${merchantName} product.` : "";
5851
5850
  if (credits == null) {
5852
5851
  return `Drawn from your credit balance.${across}`;
@@ -5891,7 +5890,7 @@ function ladderTitle(plan, locale, option) {
5891
5890
  return `${name} \xB7 ${price}`;
5892
5891
  }
5893
5892
  function optionFromPlan(plan) {
5894
- const headline = (0, import_core11.headlineCharges)(plan)[0];
5893
+ const headline = (0, import_core10.headlineCharges)(plan)[0];
5895
5894
  return {
5896
5895
  price: headline?.amountMinor ?? plan.price ?? 0,
5897
5896
  currency: headline?.currency ?? plan.currency ?? "usd"
@@ -6042,8 +6041,8 @@ function listLadderPlans(plans, {
6042
6041
  function formatCapLine(product, plan, locale) {
6043
6042
  const name = product?.planName ?? plan?.name;
6044
6043
  if (!name) return null;
6045
- const cap = (0, import_core12.includedUnits)(plan);
6046
- const cycle = (0, import_core12.billingCycle)(plan);
6044
+ const cap = (0, import_core11.includedUnits)(plan);
6045
+ const cycle = (0, import_core11.billingCycle)(plan);
6047
6046
  if (cap == null || cap <= 0) return name;
6048
6047
  const unit = allowanceMeterUnit(null, cap);
6049
6048
  const interval = cycle?.interval ?? "month";
@@ -7413,7 +7412,7 @@ function PresetAmountGrid({
7413
7412
  var import_react34 = require("react");
7414
7413
 
7415
7414
  // src/utils/credit-estimation.ts
7416
- var import_core13 = require("@solvapay/core");
7415
+ var import_core12 = require("@solvapay/core");
7417
7416
  function estimateCredits(resolvedAmountMajor, currency, creditsPerMinorUnit, displayExchangeRate) {
7418
7417
  if (resolvedAmountMajor == null || resolvedAmountMajor <= 0) return null;
7419
7418
  if (creditsPerMinorUnit == null || creditsPerMinorUnit <= 0) return null;
@@ -7425,7 +7424,7 @@ function estimateCurrencyMajorFromCredits(credits, currency, creditsPerMinorUnit
7425
7424
  if (credits == null || credits <= 0) return null;
7426
7425
  if (creditsPerMinorUnit == null || creditsPerMinorUnit <= 0) return null;
7427
7426
  const rate = displayExchangeRate ?? 1;
7428
- const displayMinor = (0, import_core13.creditsToDisplayMinorUnits)({
7427
+ const displayMinor = (0, import_core12.creditsToDisplayMinorUnits)({
7429
7428
  credits,
7430
7429
  creditsPerMinorUnit,
7431
7430
  displayExchangeRate: rate,
@@ -8482,7 +8481,7 @@ var Spinner = ({ className, size = "md" }) => {
8482
8481
  };
8483
8482
 
8484
8483
  // src/primitives/TopupForm.tsx
8485
- var import_core16 = require("@solvapay/core");
8484
+ var import_core15 = require("@solvapay/core");
8486
8485
 
8487
8486
  // src/utils/confirmPayment.ts
8488
8487
  function buildConfirmBillingDetails(input) {
@@ -8584,14 +8583,14 @@ function mapIntent(paymentIntent, copy) {
8584
8583
 
8585
8584
  // src/hooks/useBusinessDetailsAttach.ts
8586
8585
  var import_react42 = require("react");
8587
- var import_core15 = require("@solvapay/core");
8586
+ var import_core14 = require("@solvapay/core");
8588
8587
 
8589
8588
  // src/components/businessCheckoutParts.tsx
8590
8589
  var import_react41 = require("react");
8591
- var import_core14 = require("@solvapay/core");
8590
+ var import_core13 = require("@solvapay/core");
8592
8591
  var import_jsx_runtime34 = require("react/jsx-runtime");
8593
8592
  function mapBusinessFieldErrors(input) {
8594
- const result = (0, import_core14.validateBusinessDetails)(input);
8593
+ const result = (0, import_core13.validateBusinessDetails)(input);
8595
8594
  if (result.success) return {};
8596
8595
  const errors = {};
8597
8596
  for (const issue of result.error.issues) {
@@ -8608,25 +8607,25 @@ function isBusinessDetailsKey(key) {
8608
8607
  function attr(prefix, suffix) {
8609
8608
  return `data-solvapay-${prefix}-${suffix}`;
8610
8609
  }
8611
- var SUPPORTED_BUSINESS_COUNTRIES_SET = new Set(import_core14.SUPPORTED_BUSINESS_COUNTRIES);
8610
+ var SUPPORTED_BUSINESS_COUNTRIES_SET = new Set(import_core13.SUPPORTED_BUSINESS_COUNTRIES);
8612
8611
  function isSupportedBusinessCountry(value) {
8613
8612
  return SUPPORTED_BUSINESS_COUNTRIES_SET.has(value);
8614
8613
  }
8615
8614
  function resolveTaxIdLabel(country) {
8616
8615
  if (country && isSupportedBusinessCountry(country)) {
8617
- return (0, import_core14.getTaxIdFieldLabel)(country);
8616
+ return (0, import_core13.getTaxIdFieldLabel)(country);
8618
8617
  }
8619
8618
  return "Tax ID";
8620
8619
  }
8621
8620
  function resolveTaxIdPlaceholder(country) {
8622
8621
  if (country && isSupportedBusinessCountry(country)) {
8623
- return (0, import_core14.getTaxIdExample)(country);
8622
+ return (0, import_core13.getTaxIdExample)(country);
8624
8623
  }
8625
8624
  return "Enter tax ID";
8626
8625
  }
8627
8626
  function resolveTaxIdHelperText(country) {
8628
8627
  if (country && isSupportedBusinessCountry(country)) {
8629
- return (0, import_core14.getTaxIdHelperText)(country);
8628
+ return (0, import_core13.getTaxIdHelperText)(country);
8630
8629
  }
8631
8630
  return "";
8632
8631
  }
@@ -8705,14 +8704,14 @@ function createBusinessDetailsParts(useCtx, prefix) {
8705
8704
  ctx.setBusinessDetails({
8706
8705
  customerCountry: nextCountry || void 0,
8707
8706
  ...ctx.businessDetails.isBusiness ? { country: nextCountry || void 0 } : {},
8708
- ...!(0, import_core14.isStateRequired)(nextCountry) ? { customerState: void 0 } : {},
8709
- ...!(0, import_core14.isPostalCodeRequired)(nextCountry) ? { customerPostalCode: void 0 } : {}
8707
+ ...!(0, import_core13.isStateRequired)(nextCountry) ? { customerState: void 0 } : {},
8708
+ ...!(0, import_core13.isPostalCodeRequired)(nextCountry) ? { customerPostalCode: void 0 } : {}
8710
8709
  });
8711
8710
  })
8712
8711
  };
8713
8712
  const defaultOptions = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
8714
8713
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value: "", children: "Select country" }),
8715
- import_core14.BUSINESS_COUNTRY_OPTIONS.map(({ value, label }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value, children: label }, value))
8714
+ import_core13.BUSINESS_COUNTRY_OPTIONS.map(({ value, label }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("option", { value, children: label }, value))
8716
8715
  ] });
8717
8716
  if (asChild) {
8718
8717
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Slot, { ref: forwardedRef, ...commonProps, children: children ?? defaultOptions });
@@ -8721,15 +8720,15 @@ function createBusinessDetailsParts(useCtx, prefix) {
8721
8720
  });
8722
8721
  const State = (0, import_react41.forwardRef)(function BusinessDetailsState({ asChild, onChange, ...rest }, forwardedRef) {
8723
8722
  const ctx = useCtx("BusinessDetails.State");
8724
- const country = (0, import_core14.resolveBuyerCountry)(ctx.businessDetails);
8725
- if (!country || !(0, import_core14.isStateRequired)(country)) return null;
8723
+ const country = (0, import_core13.resolveBuyerCountry)(ctx.businessDetails);
8724
+ if (!country || !(0, import_core13.isStateRequired)(country)) return null;
8726
8725
  const commonProps = {
8727
8726
  ...rest,
8728
8727
  [attr(prefix, "business-details-state")]: "",
8729
8728
  type: "text",
8730
8729
  value: ctx.businessDetails.customerState ?? "",
8731
8730
  "aria-invalid": ctx.fieldErrors.customerState ? true : void 0,
8732
- "aria-label": rest["aria-label"] ?? (0, import_core14.getStateFieldLabel)(country),
8731
+ "aria-label": rest["aria-label"] ?? (0, import_core13.getStateFieldLabel)(country),
8733
8732
  onChange: composeEventHandlers(onChange, (e) => {
8734
8733
  ctx.setBusinessDetails({ customerState: e.target.value || void 0 });
8735
8734
  })
@@ -8741,16 +8740,16 @@ function createBusinessDetailsParts(useCtx, prefix) {
8741
8740
  });
8742
8741
  const PostalCode = (0, import_react41.forwardRef)(function BusinessDetailsPostalCode({ asChild, onChange, ...rest }, forwardedRef) {
8743
8742
  const ctx = useCtx("BusinessDetails.PostalCode");
8744
- const country = (0, import_core14.resolveBuyerCountry)(ctx.businessDetails);
8745
- if (!country || !(0, import_core14.isPostalCodeRequired)(country)) return null;
8743
+ const country = (0, import_core13.resolveBuyerCountry)(ctx.businessDetails);
8744
+ if (!country || !(0, import_core13.isPostalCodeRequired)(country)) return null;
8746
8745
  const commonProps = {
8747
8746
  ...rest,
8748
8747
  [attr(prefix, "business-details-postal")]: "",
8749
8748
  type: "text",
8750
8749
  value: ctx.businessDetails.customerPostalCode ?? "",
8751
- placeholder: rest.placeholder ?? (0, import_core14.getPostalCodePlaceholder)(country),
8750
+ placeholder: rest.placeholder ?? (0, import_core13.getPostalCodePlaceholder)(country),
8752
8751
  "aria-invalid": ctx.fieldErrors.customerPostalCode ? true : void 0,
8753
- "aria-label": rest["aria-label"] ?? (0, import_core14.getPostalCodeFieldLabel)(country),
8752
+ "aria-label": rest["aria-label"] ?? (0, import_core13.getPostalCodeFieldLabel)(country),
8754
8753
  onChange: composeEventHandlers(onChange, (e) => {
8755
8754
  ctx.setBusinessDetails({ customerPostalCode: e.target.value || void 0 });
8756
8755
  })
@@ -8780,23 +8779,23 @@ function createBusinessDetailsParts(useCtx, prefix) {
8780
8779
  });
8781
8780
  const Fields = (0, import_react41.forwardRef)(function BusinessDetailsFields({ asChild, children, ...rest }, forwardedRef) {
8782
8781
  const ctx = useCtx("BusinessDetails.Fields");
8783
- const country = (0, import_core14.resolveBuyerCountry)(ctx.businessDetails) ?? "";
8782
+ const country = (0, import_core13.resolveBuyerCountry)(ctx.businessDetails) ?? "";
8784
8783
  const taxIdLabel = resolveTaxIdLabel(country);
8785
8784
  const taxIdPlaceholder = resolveTaxIdPlaceholder(country);
8786
8785
  const taxIdHelperText = resolveTaxIdHelperText(country);
8787
- const showState = !!country && (0, import_core14.isStateRequired)(country);
8788
- const showPostal = !!country && (0, import_core14.isPostalCodeRequired)(country);
8786
+ const showState = !!country && (0, import_core13.isStateRequired)(country);
8787
+ const showPostal = !!country && (0, import_core13.isPostalCodeRequired)(country);
8789
8788
  const content = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
8790
8789
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-business-field", children: [
8791
8790
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: "Country" }),
8792
8791
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Country, {})
8793
8792
  ] }),
8794
8793
  showState ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-business-field", children: [
8795
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: (0, import_core14.getStateFieldLabel)(country) }),
8794
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: (0, import_core13.getStateFieldLabel)(country) }),
8796
8795
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(State, {})
8797
8796
  ] }) : null,
8798
8797
  showPostal ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-business-field", children: [
8799
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: (0, import_core14.getPostalCodeFieldLabel)(country) }),
8798
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "solvapay-business-field-label", children: (0, import_core13.getPostalCodeFieldLabel)(country) }),
8800
8799
  /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(PostalCode, {})
8801
8800
  ] }) : null,
8802
8801
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: "solvapay-checkout-business-toggle", children: [
@@ -8980,9 +8979,9 @@ function useBusinessDetailsAttach(options) {
8980
8979
  if (!processorPaymentId || !attachBusinessDetails) {
8981
8980
  return !attachBusinessDetails;
8982
8981
  }
8983
- const addressErrors = (0, import_core15.getCustomerAddressFieldErrors)(input);
8984
- const validation = (0, import_core15.validateBusinessDetails)(input);
8985
- if (!validation.success || !(0, import_core15.isCustomerAddressComplete)(input)) {
8982
+ const addressErrors = (0, import_core14.getCustomerAddressFieldErrors)(input);
8983
+ const validation = (0, import_core14.validateBusinessDetails)(input);
8984
+ if (!validation.success || !(0, import_core14.isCustomerAddressComplete)(input)) {
8986
8985
  setFieldErrors({
8987
8986
  ...mapBusinessFieldErrors(input),
8988
8987
  ...addressErrors
@@ -9023,12 +9022,12 @@ function useBusinessDetailsAttach(options) {
9023
9022
  );
9024
9023
  (0, import_react42.useEffect)(() => {
9025
9024
  if (!processorPaymentId || !attachBusinessDetails) return;
9026
- const validation = (0, import_core15.validateBusinessDetails)(businessDetails);
9027
- if (!validation.success || !(0, import_core15.isCustomerAddressComplete)(businessDetails)) {
9025
+ const validation = (0, import_core14.validateBusinessDetails)(businessDetails);
9026
+ if (!validation.success || !(0, import_core14.isCustomerAddressComplete)(businessDetails)) {
9028
9027
  const countrySelected = !!(businessDetails.customerCountry?.trim() || businessDetails.isBusiness && businessDetails.country?.trim());
9029
9028
  setFieldErrors({
9030
9029
  ...mapBusinessFieldErrors(businessDetails),
9031
- ...countrySelected ? (0, import_core15.getCustomerAddressFieldErrors)(businessDetails) : {}
9030
+ ...countrySelected ? (0, import_core14.getCustomerAddressFieldErrors)(businessDetails) : {}
9032
9031
  });
9033
9032
  setBusinessDetailsAttached(false);
9034
9033
  return;
@@ -9291,7 +9290,7 @@ var Inner = ({
9291
9290
  runAttach
9292
9291
  } = businessAttach;
9293
9292
  const isReady = !!(stripe && elements);
9294
- const canSubmit = isReady && paymentInputComplete && !isProcessing && !!clientSecret && (!requiresBusinessAttach || businessDetailsAttached) && (0, import_core16.isCustomerAddressComplete)(businessDetails) && !businessDetailsAttaching;
9293
+ const canSubmit = isReady && paymentInputComplete && !isProcessing && !!clientSecret && (!requiresBusinessAttach || businessDetailsAttached) && (0, import_core15.isCustomerAddressComplete)(businessDetails) && !businessDetailsAttaching;
9295
9294
  const submit = (0, import_react43.useCallback)(async () => {
9296
9295
  if (!stripe || !elements || !clientSecret) {
9297
9296
  const msg = copy.errors.stripeUnavailable;
@@ -9318,7 +9317,7 @@ var Inner = ({
9318
9317
  billingDetails: buildConfirmBillingDetails({
9319
9318
  name: customer.name,
9320
9319
  email: customer.email,
9321
- country: (0, import_core16.resolveBuyerCountry)(businessDetails),
9320
+ country: (0, import_core15.resolveBuyerCountry)(businessDetails),
9322
9321
  state: businessDetails.customerState,
9323
9322
  postalCode: businessDetails.customerPostalCode
9324
9323
  }),
@@ -10255,7 +10254,7 @@ function resolveCta(input) {
10255
10254
  }
10256
10255
 
10257
10256
  // src/primitives/PaymentForm.tsx
10258
- var import_core17 = require("@solvapay/core");
10257
+ var import_core16 = require("@solvapay/core");
10259
10258
  var import_jsx_runtime43 = require("react/jsx-runtime");
10260
10259
  function toSubmitVariant(variant) {
10261
10260
  switch (variant) {
@@ -10564,7 +10563,7 @@ var PaidInner = ({
10564
10563
  onError
10565
10564
  ]);
10566
10565
  const isReady = !!(stripe && elements);
10567
- const canSubmit = isReady && !!clientSecret && !!elementKind && paymentInputComplete && (!requireTermsAcceptance || termsAccepted) && (!requiresBusinessAttach || businessDetailsAttached) && (0, import_core17.isCustomerAddressComplete)(businessDetails) && !businessDetailsAttaching && !isProcessing;
10566
+ const canSubmit = isReady && !!clientSecret && !!elementKind && paymentInputComplete && (!requireTermsAcceptance || termsAccepted) && (!requiresBusinessAttach || businessDetailsAttached) && (0, import_core16.isCustomerAddressComplete)(businessDetails) && !businessDetailsAttaching && !isProcessing;
10568
10567
  const submit = (0, import_react48.useCallback)(async () => {
10569
10568
  if (!stripe || !elements || !clientSecret || !elementKind) {
10570
10569
  const msg = !stripe || !elements ? copy.errors.stripeUnavailable : copy.errors.paymentIntentUnavailable;
@@ -10595,7 +10594,7 @@ var PaidInner = ({
10595
10594
  billingDetails: buildConfirmBillingDetails({
10596
10595
  name: customerName.trim() || customer.name,
10597
10596
  email: customer.email ?? prefillCustomer?.email,
10598
- country: (0, import_core17.resolveBuyerCountry)(businessDetails),
10597
+ country: (0, import_core16.resolveBuyerCountry)(businessDetails),
10599
10598
  state: businessDetails.customerState,
10600
10599
  postalCode: businessDetails.customerPostalCode
10601
10600
  }),
@@ -11942,7 +11941,7 @@ var import_react54 = require("react");
11942
11941
 
11943
11942
  // src/primitives/BalanceBadge.tsx
11944
11943
  var import_react53 = require("react");
11945
- var import_core18 = require("@solvapay/core");
11944
+ var import_core17 = require("@solvapay/core");
11946
11945
  var import_jsx_runtime49 = require("react/jsx-runtime");
11947
11946
  var BalanceBadge = (0, import_react53.forwardRef)(function BalanceBadge2({ asChild, numberOnly, lowThreshold = 10, children, ...rest }, forwardedRef) {
11948
11947
  const solva = (0, import_react53.useContext)(SolvaPayContext);
@@ -11971,14 +11970,14 @@ var BalanceBadge = (0, import_react53.forwardRef)(function BalanceBadge2({ asChi
11971
11970
  const formattedCredits = new Intl.NumberFormat(locale).format(credits);
11972
11971
  let currencyEquivalent = "";
11973
11972
  if (!numberOnly && displayCurrency && creditsPerMinorUnit) {
11974
- const displayMinor = (0, import_core18.creditsToDisplayMinorUnits)({
11973
+ const displayMinor = (0, import_core17.creditsToDisplayMinorUnits)({
11975
11974
  credits,
11976
11975
  creditsPerMinorUnit,
11977
11976
  displayExchangeRate: displayExchangeRate ?? 1,
11978
11977
  displayCurrency
11979
11978
  });
11980
11979
  if (displayMinor !== null) {
11981
- const minorPerMajor = (0, import_core18.minorUnitsPerMajor)(displayCurrency);
11980
+ const minorPerMajor = (0, import_core17.minorUnitsPerMajor)(displayCurrency);
11982
11981
  const formatted = new Intl.NumberFormat(locale, {
11983
11982
  style: "currency",
11984
11983
  currency: displayCurrency,
@@ -1,10 +1,10 @@
1
- import { w as SolvaPayTransport, a1 as SolvaPayProviderInitial, D as SolvaPayConfig, B as BootstrapPlanLike, y as PurchaseInfo, a2 as CreditActivityType, a3 as CreditActivityEntry, H as Merchant } from '../useUsage-C7I5dNGM.cjs';
1
+ import { w as SolvaPayTransport, a1 as SolvaPayProviderInitial, D as SolvaPayConfig, B as BootstrapPlanLike, y as PurchaseInfo, a2 as CreditActivityType, a3 as CreditActivityEntry, H as Merchant } from '../useUsage-DOe2M1fn.cjs';
2
2
  import { TOOL_FOR_VIEW, SolvaPayMcpViewKind, BootstrapMerchant, BootstrapProduct, BootstrapPlan, BootstrapCustomer } from '@solvapay/mcp-core';
3
3
  export { MCP_TOOL_NAMES, McpToolName } from '@solvapay/mcp-core';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import React from 'react';
6
6
  import { PricingOptionLike, PricedLike, BalancePegLike } from '@solvapay/core';
7
- import { U as UsageMeterRootProps } from '../UsageMeter-7TlUFO4f.cjs';
7
+ import { U as UsageMeterRootProps } from '../UsageMeter-Cklwe5NS.cjs';
8
8
  import '@stripe/stripe-js';
9
9
  import '../adapters/auth.cjs';
10
10
 
@@ -1,10 +1,10 @@
1
- import { w as SolvaPayTransport, a1 as SolvaPayProviderInitial, D as SolvaPayConfig, B as BootstrapPlanLike, y as PurchaseInfo, a2 as CreditActivityType, a3 as CreditActivityEntry, H as Merchant } from '../useUsage-Chx6wiUC.js';
1
+ import { w as SolvaPayTransport, a1 as SolvaPayProviderInitial, D as SolvaPayConfig, B as BootstrapPlanLike, y as PurchaseInfo, a2 as CreditActivityType, a3 as CreditActivityEntry, H as Merchant } from '../useUsage-BHYCir12.js';
2
2
  import { TOOL_FOR_VIEW, SolvaPayMcpViewKind, BootstrapMerchant, BootstrapProduct, BootstrapPlan, BootstrapCustomer } from '@solvapay/mcp-core';
3
3
  export { MCP_TOOL_NAMES, McpToolName } from '@solvapay/mcp-core';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import React from 'react';
6
6
  import { PricingOptionLike, PricedLike, BalancePegLike } from '@solvapay/core';
7
- import { U as UsageMeterRootProps } from '../UsageMeter-DMXIqN6R.js';
7
+ import { U as UsageMeterRootProps } from '../UsageMeter-DPLCVJD4.js';
8
8
  import '@stripe/stripe-js';
9
9
  import '../adapters/auth.js';
10
10
 
package/dist/mcp/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  ExternalLinkGlyph,
3
3
  LaunchCustomerPortalButton,
4
4
  paymentMethodCache
5
- } from "../chunk-A4RMDNX2.js";
5
+ } from "../chunk-P4KEZ4D4.js";
6
6
  import {
7
7
  AmountPicker,
8
8
  BalanceBadge,
@@ -57,7 +57,7 @@ import {
57
57
  useTransport,
58
58
  useUsage,
59
59
  validateAutoRechargeForm
60
- } from "../chunk-NVIMOERI.js";
60
+ } from "../chunk-WWYACUNM.js";
61
61
  import "../chunk-UMXOAUW7.js";
62
62
  import "../chunk-MLKGABMK.js";
63
63
 
@@ -1,13 +1,13 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { Ref } from 'react';
3
- import { b as Plan, z as Product, s as UseTopupAmountSelectorReturn, y as PurchaseInfo, T as TopupFormProps, c as SaveAutoRechargeResponse, u as AutoRechargeConfig } from '../useUsage-C7I5dNGM.cjs';
4
- export { B as BootstrapPlanLike, E as CheckoutStep, O as SuccessMeta } from '../useUsage-C7I5dNGM.cjs';
3
+ import { b as Plan, z as Product, s as UseTopupAmountSelectorReturn, y as PurchaseInfo, T as TopupFormProps, c as SaveAutoRechargeResponse, u as AutoRechargeConfig } from '../useUsage-DOe2M1fn.cjs';
4
+ export { B as BootstrapPlanLike, E as CheckoutStep, O as SuccessMeta } from '../useUsage-DOe2M1fn.cjs';
5
5
  import { TaxBreakdown, BusinessDetailsInput } from '@solvapay/core';
6
- import { A as AutoRechargeInputPayload, F as AmountInputUnit, G as AutoRechargeFormState, l as PaywallStructuredContent } from '../index-FASAoYDW.cjs';
7
- export { H as ActivationFlow, I as ActivationFlowActivateButton, J as ActivationFlowActivated, K as ActivationFlowAmountPicker, L as ActivationFlowContinueButton, N as ActivationFlowError, O as ActivationFlowLoading, Q as ActivationFlowRetrying, R as ActivationFlowRoot, m as ActivationFlowStep, S as ActivationFlowSummary, B as BalanceBadge, n as CancelPlanButton, p as CheckoutStatus, q as CheckoutSteps, T as CheckoutStepsAmountContinueButton, V as CheckoutStepsAmountPicker, W as CheckoutStepsBackLink, X as CheckoutStepsIfStep, Y as CheckoutStepsPayment, Z as CheckoutStepsPlanContinueButton, _ as CheckoutStepsPlanGrid, $ as CheckoutStepsRoot, a0 as CheckoutStepsStepHeading, a1 as CheckoutStepsStepMessage, a2 as CheckoutStepsSuccess, M as MandateText, t as MandateTextProps, a3 as PaymentForm, j as PaymentFormBusinessDetails, c as PaymentFormCardElement, a as PaymentFormCustomerFields, h as PaymentFormError, i as PaymentFormLegalFooter, g as PaymentFormLoading, d as PaymentFormMandateText, b as PaymentFormPaymentElement, a4 as PaymentFormRoot, f as PaymentFormSubmitButton, P as PaymentFormSummary, k as PaymentFormTaxSummary, e as PaymentFormTermsCheckbox, u as PlanBadge, v as ProductBadge, w as PurchaseGate, a5 as PurchaseGateAllowed, a6 as PurchaseGateBlocked, a7 as PurchaseGateError, a8 as PurchaseGateLoading, a9 as PurchaseGateRoot, aa as useActivationFlow, E as useCheckoutStepsContext, ab as usePurchaseGate } from '../index-FASAoYDW.cjs';
6
+ import { A as AutoRechargeInputPayload, F as AmountInputUnit, G as AutoRechargeFormState, l as PaywallStructuredContent } from '../index-O2JsPD87.cjs';
7
+ export { H as ActivationFlow, I as ActivationFlowActivateButton, J as ActivationFlowActivated, K as ActivationFlowAmountPicker, L as ActivationFlowContinueButton, N as ActivationFlowError, O as ActivationFlowLoading, Q as ActivationFlowRetrying, R as ActivationFlowRoot, m as ActivationFlowStep, S as ActivationFlowSummary, B as BalanceBadge, n as CancelPlanButton, p as CheckoutStatus, q as CheckoutSteps, T as CheckoutStepsAmountContinueButton, V as CheckoutStepsAmountPicker, W as CheckoutStepsBackLink, X as CheckoutStepsIfStep, Y as CheckoutStepsPayment, Z as CheckoutStepsPlanContinueButton, _ as CheckoutStepsPlanGrid, $ as CheckoutStepsRoot, a0 as CheckoutStepsStepHeading, a1 as CheckoutStepsStepMessage, a2 as CheckoutStepsSuccess, M as MandateText, t as MandateTextProps, a3 as PaymentForm, j as PaymentFormBusinessDetails, c as PaymentFormCardElement, a as PaymentFormCustomerFields, h as PaymentFormError, i as PaymentFormLegalFooter, g as PaymentFormLoading, d as PaymentFormMandateText, b as PaymentFormPaymentElement, a4 as PaymentFormRoot, f as PaymentFormSubmitButton, P as PaymentFormSummary, k as PaymentFormTaxSummary, e as PaymentFormTermsCheckbox, u as PlanBadge, v as ProductBadge, w as PurchaseGate, a5 as PurchaseGateAllowed, a6 as PurchaseGateBlocked, a7 as PurchaseGateError, a8 as PurchaseGateLoading, a9 as PurchaseGateRoot, aa as useActivationFlow, E as useCheckoutStepsContext, ab as usePurchaseGate } from '../index-O2JsPD87.cjs';
8
8
  import { PaymentElement } from '@stripe/react-stripe-js';
9
9
  import { Stripe, StripeElements } from '@stripe/stripe-js';
10
- export { a as UsageMeter, B as UsageMeterBar, b as UsageMeterClassNames, E as UsageMeterEmpty, L as UsageMeterLabel, c as UsageMeterLoading, P as UsageMeterPercentage, R as UsageMeterResetsIn, d as UsageMeterRoot, U as UsageMeterRootProps, u as useUsageMeter } from '../UsageMeter-7TlUFO4f.cjs';
10
+ export { a as UsageMeter, B as UsageMeterBar, b as UsageMeterClassNames, E as UsageMeterEmpty, L as UsageMeterLabel, c as UsageMeterLoading, P as UsageMeterPercentage, R as UsageMeterResetsIn, d as UsageMeterRoot, U as UsageMeterRootProps, u as useUsageMeter } from '../UsageMeter-Cklwe5NS.cjs';
11
11
  import '../adapters/auth.cjs';
12
12
 
13
13
  type PlanPricingOption = {