@solvapay/react 2.2.1 → 2.2.2-preview-253dcb103840555309a5ff5e4ccfa6a07f7ca6ae

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.
@@ -89,7 +89,7 @@ import {
89
89
  useCreditGate,
90
90
  usePaywallNotice,
91
91
  usePurchaseGate
92
- } from "../chunk-AW5PCAYK.js";
92
+ } from "../chunk-KUH3SNWZ.js";
93
93
  import {
94
94
  AmountPicker,
95
95
  AmountPickerConfirm,
@@ -175,7 +175,7 @@ import {
175
175
  usePlanSelector,
176
176
  useTopupForm,
177
177
  useUsageMeter
178
- } from "../chunk-LCBCOFXZ.js";
178
+ } from "../chunk-GPP4MY3I.js";
179
179
  import "../chunk-UMXOAUW7.js";
180
180
  import "../chunk-MLKGABMK.js";
181
181
  export {
@@ -829,9 +829,13 @@ interface components {
829
829
  LimitBalanceDto: {
830
830
  /** @description Credit balance in credits (100 credits = 1 minor currency unit) */
831
831
  creditBalance: number;
832
+ /** @description Credits per minor unit of `currency` (typically 100) */
833
+ creditsPerMinorUnit?: number;
832
834
  /** @description Credits deducted per metered item (wallet coverage: remainingUnits = balance / creditsPerUnit) */
833
835
  creditsPerUnit: number;
834
836
  currency: string;
837
+ /** @description USD → display-currency rate used with creditsPerMinorUnit */
838
+ displayExchangeRate?: number;
835
839
  /** @description How many metered items the credit balance still covers (`balance / creditsPerUnit`) */
836
840
  remainingUnits?: number;
837
841
  };
@@ -1204,17 +1208,17 @@ interface components {
1204
1208
  };
1205
1209
  ProcessPaymentCancelled: {
1206
1210
  /**
1207
- * discriminator enum property added by openapi-typescript
1211
+ * @example cancelled
1208
1212
  * @enum {string}
1209
1213
  */
1210
- status: 'ProcessPaymentCancelled';
1214
+ status: 'cancelled';
1211
1215
  };
1212
1216
  ProcessPaymentFailed: {
1213
1217
  /**
1214
- * discriminator enum property added by openapi-typescript
1218
+ * @example failed
1215
1219
  * @enum {string}
1216
1220
  */
1217
- status: 'ProcessPaymentFailed';
1221
+ status: 'failed';
1218
1222
  };
1219
1223
  ProcessPaymentIntentDto: {
1220
1224
  customerRef: string;
@@ -1223,25 +1227,25 @@ interface components {
1223
1227
  };
1224
1228
  ProcessPaymentProcessing: {
1225
1229
  /**
1226
- * discriminator enum property added by openapi-typescript
1230
+ * @example processing
1227
1231
  * @enum {string}
1228
1232
  */
1229
- status: 'ProcessPaymentProcessing';
1233
+ status: 'processing';
1230
1234
  };
1231
1235
  ProcessPaymentSucceededBare: {
1232
1236
  /**
1233
- * discriminator enum property added by openapi-typescript
1237
+ * @example succeeded
1234
1238
  * @enum {string}
1235
1239
  */
1236
- status: 'ProcessPaymentSucceededBare';
1240
+ status: 'succeeded';
1237
1241
  };
1238
1242
  ProcessPaymentSucceededOneTime: {
1239
1243
  oneTimePurchase: components['schemas']['OneTimePurchaseInfo'];
1240
1244
  /**
1241
- * discriminator enum property added by openapi-typescript
1245
+ * @example succeeded
1242
1246
  * @enum {string}
1243
1247
  */
1244
- status: 'ProcessPaymentSucceededOneTime';
1248
+ status: 'succeeded';
1245
1249
  /**
1246
1250
  * @example one-time
1247
1251
  * @enum {string}
@@ -1251,10 +1255,10 @@ interface components {
1251
1255
  ProcessPaymentSucceededRecurring: {
1252
1256
  purchase: components['schemas']['SdkPurchaseResponse'];
1253
1257
  /**
1254
- * discriminator enum property added by openapi-typescript
1258
+ * @example succeeded
1255
1259
  * @enum {string}
1256
1260
  */
1257
- status: 'ProcessPaymentSucceededRecurring';
1261
+ status: 'succeeded';
1258
1262
  /**
1259
1263
  * @example recurring
1260
1264
  * @enum {string}
@@ -1265,10 +1269,10 @@ interface components {
1265
1269
  /** @description Detail message describing the timeout */
1266
1270
  message?: string;
1267
1271
  /**
1268
- * discriminator enum property added by openapi-typescript
1272
+ * @example timeout
1269
1273
  * @enum {string}
1270
1274
  */
1271
- status: 'ProcessPaymentTimeout';
1275
+ status: 'timeout';
1272
1276
  };
1273
1277
  ProductConfigDto: {
1274
1278
  /**
@@ -3210,10 +3214,10 @@ interface operations {
3210
3214
  content: {
3211
3215
  'application/json': {
3212
3216
  /**
3213
- * Outcome of the delete: hard delete in sandbox, soft-delete or deactivation in live depending on existing purchases
3217
+ * Outcome of the delete: deactivation when purchases exist, otherwise soft-delete. Same in sandbox and live.
3214
3218
  * @enum {string}
3215
3219
  */
3216
- action?: 'deleted' | 'deactivated' | 'soft_deleted';
3220
+ action?: 'deactivated' | 'soft_deleted';
3217
3221
  success?: boolean;
3218
3222
  };
3219
3223
  };
@@ -3880,42 +3884,23 @@ type LimitResponseWithPlan = components['schemas']['LimitResponse'] & {
3880
3884
  /** @deprecated Never populated by the backend. Read `planRef` instead. */
3881
3885
  plan?: string;
3882
3886
  };
3883
- type OneTimePurchaseInfo = components['schemas']['OneTimePurchaseInfo'];
3884
3887
  /**
3885
3888
  * Result from processing a payment intent.
3886
3889
  *
3887
- * Mirrors the backend's discriminated `oneOf` response. The `succeeded`
3888
- * branches are further discriminated on `type` so consumers can route to
3889
- * recurring vs one-time purchase handling without guarding against
3890
- * `purchase === undefined`. A bare `{ status: 'succeeded' }` is returned
3891
- * when the webhook race means the backend can't yet enrich the response
3892
- * with the created purchase — callers should fall back to refetching.
3890
+ * Derived from the generated `/v1/sdk/payment-intents/{id}/process` 200
3891
+ * response. The `succeeded` branches further discriminate on `type` so
3892
+ * consumers can route to recurring vs one-time handling without guarding
3893
+ * against `purchase === undefined`. A bare `{ status: 'succeeded' }` is
3894
+ * returned when the webhook race means the backend can't yet enrich the
3895
+ * response with the created purchase — callers should fall back to
3896
+ * refetching.
3893
3897
  *
3894
- * `failed` and `cancelled` are returned by the backend when the Stripe
3895
- * PaymentIntent is in a terminal non-success state and are routed to
3896
- * `onError` by `reconcilePayment`. `timeout` carries a retry hint and is
3897
- * routed to the timeout branch.
3898
+ * `failed` and `cancelled` are returned when the Stripe PaymentIntent is
3899
+ * in a terminal non-success state and are routed to `onError` by
3900
+ * `reconcilePayment`. `timeout` carries a retry hint and is routed to
3901
+ * the timeout branch.
3898
3902
  */
3899
- type ProcessPaymentResult = {
3900
- status: 'succeeded';
3901
- type: 'recurring';
3902
- purchase: PurchaseInfo;
3903
- } | {
3904
- status: 'succeeded';
3905
- type: 'one-time';
3906
- oneTimePurchase: OneTimePurchaseInfo;
3907
- } | {
3908
- status: 'succeeded';
3909
- } | {
3910
- status: 'processing';
3911
- } | {
3912
- status: 'timeout';
3913
- message?: string;
3914
- } | {
3915
- status: 'failed';
3916
- } | {
3917
- status: 'cancelled';
3918
- };
3903
+ type ProcessPaymentResult = operations['PaymentIntentSdkController_processPaymentIntent']['responses']['200']['content']['application/json'];
3919
3904
  /**
3920
3905
  * Result from processing a credit-topup payment intent.
3921
3906
  *
@@ -5310,6 +5295,11 @@ interface UsePlansOptions {
5310
5295
  * Auto-select first paid plan on load
5311
5296
  */
5312
5297
  autoSelectFirstPaid?: boolean;
5298
+ /**
5299
+ * Skip this plan when auto-selecting the first paid plan. Used so
5300
+ * the customer's already-active plan is not preselected.
5301
+ */
5302
+ excludePlanRef?: string | null;
5313
5303
  /**
5314
5304
  * Plan reference to select initially when plans load.
5315
5305
  * Applied at most once when selectionReady is true.
@@ -829,9 +829,13 @@ interface components {
829
829
  LimitBalanceDto: {
830
830
  /** @description Credit balance in credits (100 credits = 1 minor currency unit) */
831
831
  creditBalance: number;
832
+ /** @description Credits per minor unit of `currency` (typically 100) */
833
+ creditsPerMinorUnit?: number;
832
834
  /** @description Credits deducted per metered item (wallet coverage: remainingUnits = balance / creditsPerUnit) */
833
835
  creditsPerUnit: number;
834
836
  currency: string;
837
+ /** @description USD → display-currency rate used with creditsPerMinorUnit */
838
+ displayExchangeRate?: number;
835
839
  /** @description How many metered items the credit balance still covers (`balance / creditsPerUnit`) */
836
840
  remainingUnits?: number;
837
841
  };
@@ -1204,17 +1208,17 @@ interface components {
1204
1208
  };
1205
1209
  ProcessPaymentCancelled: {
1206
1210
  /**
1207
- * discriminator enum property added by openapi-typescript
1211
+ * @example cancelled
1208
1212
  * @enum {string}
1209
1213
  */
1210
- status: 'ProcessPaymentCancelled';
1214
+ status: 'cancelled';
1211
1215
  };
1212
1216
  ProcessPaymentFailed: {
1213
1217
  /**
1214
- * discriminator enum property added by openapi-typescript
1218
+ * @example failed
1215
1219
  * @enum {string}
1216
1220
  */
1217
- status: 'ProcessPaymentFailed';
1221
+ status: 'failed';
1218
1222
  };
1219
1223
  ProcessPaymentIntentDto: {
1220
1224
  customerRef: string;
@@ -1223,25 +1227,25 @@ interface components {
1223
1227
  };
1224
1228
  ProcessPaymentProcessing: {
1225
1229
  /**
1226
- * discriminator enum property added by openapi-typescript
1230
+ * @example processing
1227
1231
  * @enum {string}
1228
1232
  */
1229
- status: 'ProcessPaymentProcessing';
1233
+ status: 'processing';
1230
1234
  };
1231
1235
  ProcessPaymentSucceededBare: {
1232
1236
  /**
1233
- * discriminator enum property added by openapi-typescript
1237
+ * @example succeeded
1234
1238
  * @enum {string}
1235
1239
  */
1236
- status: 'ProcessPaymentSucceededBare';
1240
+ status: 'succeeded';
1237
1241
  };
1238
1242
  ProcessPaymentSucceededOneTime: {
1239
1243
  oneTimePurchase: components['schemas']['OneTimePurchaseInfo'];
1240
1244
  /**
1241
- * discriminator enum property added by openapi-typescript
1245
+ * @example succeeded
1242
1246
  * @enum {string}
1243
1247
  */
1244
- status: 'ProcessPaymentSucceededOneTime';
1248
+ status: 'succeeded';
1245
1249
  /**
1246
1250
  * @example one-time
1247
1251
  * @enum {string}
@@ -1251,10 +1255,10 @@ interface components {
1251
1255
  ProcessPaymentSucceededRecurring: {
1252
1256
  purchase: components['schemas']['SdkPurchaseResponse'];
1253
1257
  /**
1254
- * discriminator enum property added by openapi-typescript
1258
+ * @example succeeded
1255
1259
  * @enum {string}
1256
1260
  */
1257
- status: 'ProcessPaymentSucceededRecurring';
1261
+ status: 'succeeded';
1258
1262
  /**
1259
1263
  * @example recurring
1260
1264
  * @enum {string}
@@ -1265,10 +1269,10 @@ interface components {
1265
1269
  /** @description Detail message describing the timeout */
1266
1270
  message?: string;
1267
1271
  /**
1268
- * discriminator enum property added by openapi-typescript
1272
+ * @example timeout
1269
1273
  * @enum {string}
1270
1274
  */
1271
- status: 'ProcessPaymentTimeout';
1275
+ status: 'timeout';
1272
1276
  };
1273
1277
  ProductConfigDto: {
1274
1278
  /**
@@ -3210,10 +3214,10 @@ interface operations {
3210
3214
  content: {
3211
3215
  'application/json': {
3212
3216
  /**
3213
- * Outcome of the delete: hard delete in sandbox, soft-delete or deactivation in live depending on existing purchases
3217
+ * Outcome of the delete: deactivation when purchases exist, otherwise soft-delete. Same in sandbox and live.
3214
3218
  * @enum {string}
3215
3219
  */
3216
- action?: 'deleted' | 'deactivated' | 'soft_deleted';
3220
+ action?: 'deactivated' | 'soft_deleted';
3217
3221
  success?: boolean;
3218
3222
  };
3219
3223
  };
@@ -3880,42 +3884,23 @@ type LimitResponseWithPlan = components['schemas']['LimitResponse'] & {
3880
3884
  /** @deprecated Never populated by the backend. Read `planRef` instead. */
3881
3885
  plan?: string;
3882
3886
  };
3883
- type OneTimePurchaseInfo = components['schemas']['OneTimePurchaseInfo'];
3884
3887
  /**
3885
3888
  * Result from processing a payment intent.
3886
3889
  *
3887
- * Mirrors the backend's discriminated `oneOf` response. The `succeeded`
3888
- * branches are further discriminated on `type` so consumers can route to
3889
- * recurring vs one-time purchase handling without guarding against
3890
- * `purchase === undefined`. A bare `{ status: 'succeeded' }` is returned
3891
- * when the webhook race means the backend can't yet enrich the response
3892
- * with the created purchase — callers should fall back to refetching.
3890
+ * Derived from the generated `/v1/sdk/payment-intents/{id}/process` 200
3891
+ * response. The `succeeded` branches further discriminate on `type` so
3892
+ * consumers can route to recurring vs one-time handling without guarding
3893
+ * against `purchase === undefined`. A bare `{ status: 'succeeded' }` is
3894
+ * returned when the webhook race means the backend can't yet enrich the
3895
+ * response with the created purchase — callers should fall back to
3896
+ * refetching.
3893
3897
  *
3894
- * `failed` and `cancelled` are returned by the backend when the Stripe
3895
- * PaymentIntent is in a terminal non-success state and are routed to
3896
- * `onError` by `reconcilePayment`. `timeout` carries a retry hint and is
3897
- * routed to the timeout branch.
3898
+ * `failed` and `cancelled` are returned when the Stripe PaymentIntent is
3899
+ * in a terminal non-success state and are routed to `onError` by
3900
+ * `reconcilePayment`. `timeout` carries a retry hint and is routed to
3901
+ * the timeout branch.
3898
3902
  */
3899
- type ProcessPaymentResult = {
3900
- status: 'succeeded';
3901
- type: 'recurring';
3902
- purchase: PurchaseInfo;
3903
- } | {
3904
- status: 'succeeded';
3905
- type: 'one-time';
3906
- oneTimePurchase: OneTimePurchaseInfo;
3907
- } | {
3908
- status: 'succeeded';
3909
- } | {
3910
- status: 'processing';
3911
- } | {
3912
- status: 'timeout';
3913
- message?: string;
3914
- } | {
3915
- status: 'failed';
3916
- } | {
3917
- status: 'cancelled';
3918
- };
3903
+ type ProcessPaymentResult = operations['PaymentIntentSdkController_processPaymentIntent']['responses']['200']['content']['application/json'];
3919
3904
  /**
3920
3905
  * Result from processing a credit-topup payment intent.
3921
3906
  *
@@ -5310,6 +5295,11 @@ interface UsePlansOptions {
5310
5295
  * Auto-select first paid plan on load
5311
5296
  */
5312
5297
  autoSelectFirstPaid?: boolean;
5298
+ /**
5299
+ * Skip this plan when auto-selecting the first paid plan. Used so
5300
+ * the customer's already-active plan is not preselected.
5301
+ */
5302
+ excludePlanRef?: string | null;
5313
5303
  /**
5314
5304
  * Plan reference to select initially when plans load.
5315
5305
  * Applied at most once when selectionReady is true.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solvapay/react",
3
- "version": "2.2.1",
3
+ "version": "2.2.2-preview-253dcb103840555309a5ff5e4ccfa6a07f7ca6ae",
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 || ^0.4.0",
60
+ "@solvapay/mcp-core": "0.4.2-preview-253dcb103840555309a5ff5e4ccfa6a07f7ca6ae",
61
61
  "react": "^18.2.0 || ^19.0.0",
62
62
  "react-dom": "^18.2.0 || ^19.0.0"
63
63
  },
@@ -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.4.1",
89
- "@solvapay/server": "2.5.0",
88
+ "@solvapay/mcp-core": "0.4.2-preview-253dcb103840555309a5ff5e4ccfa6a07f7ca6ae",
89
+ "@solvapay/server": "2.6.0-preview-253dcb103840555309a5ff5e4ccfa6a07f7ca6ae",
90
90
  "@solvapay/test-utils": "0.0.0"
91
91
  },
92
92
  "scripts": {