@solvapay/react 1.2.1 → 1.3.0-preview-cb8ad16e16ce8f8f357bd7f2e7068d85159df587

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.
@@ -33,6 +33,15 @@ interface components {
33
33
  * @example usd
34
34
  */
35
35
  defaultCurrency?: string;
36
+ /**
37
+ * Full set of currencies a customer may pay credit topups in, including the default currency. Omitted/single-entry means single-currency behavior.
38
+ * @example [
39
+ * "USD",
40
+ * "EUR",
41
+ * "GBP"
42
+ * ]
43
+ */
44
+ supportedTopupCurrencies?: string[];
36
45
  /**
37
46
  * Descriptor appearing on the customer card statement
38
47
  * @example ACME INC
@@ -250,6 +259,33 @@ interface components {
250
259
  */
251
260
  checkoutUrl: string;
252
261
  };
262
+ PlanPricingOptionDto: {
263
+ /**
264
+ * ISO 4217 currency code
265
+ * @example USD
266
+ */
267
+ currency: string;
268
+ /**
269
+ * Price in smallest currency unit (e.g. cents)
270
+ * @example 2999
271
+ */
272
+ price: number;
273
+ /**
274
+ * Base price in smallest currency unit (hybrid plans)
275
+ * @example 1999
276
+ */
277
+ basePrice?: number;
278
+ /**
279
+ * One-time setup fee in smallest currency unit
280
+ * @example 500
281
+ */
282
+ setupFee?: number;
283
+ /**
284
+ * Whether this is the default currency option for the plan
285
+ * @example true
286
+ */
287
+ default?: boolean;
288
+ };
253
289
  Plan: {
254
290
  /**
255
291
  * Plan type exposed in SDK
@@ -287,6 +323,8 @@ interface components {
287
323
  * @example USD
288
324
  */
289
325
  currency: string;
326
+ /** @description Per-currency price options for this plan */
327
+ pricingOptions?: components["schemas"]["PlanPricingOptionDto"][];
290
328
  /**
291
329
  * Currency symbol (derived from currency)
292
330
  * @example $
@@ -380,6 +418,13 @@ interface components {
380
418
  price?: number;
381
419
  creditsPerUnit?: number;
382
420
  currency?: string;
421
+ pricingOptions?: {
422
+ currency: string;
423
+ price: number;
424
+ basePrice?: number;
425
+ setupFee?: number;
426
+ default?: boolean;
427
+ }[];
383
428
  /** @enum {string} */
384
429
  billingModel?: "pre-paid" | "post-paid";
385
430
  freeUnits?: number;
@@ -418,6 +463,13 @@ interface components {
418
463
  price?: number;
419
464
  creditsPerUnit?: number;
420
465
  currency?: string;
466
+ pricingOptions?: {
467
+ currency: string;
468
+ price: number;
469
+ basePrice?: number;
470
+ setupFee?: number;
471
+ default?: boolean;
472
+ }[];
421
473
  /** @enum {string} */
422
474
  billingModel?: "pre-paid" | "post-paid";
423
475
  freeUnits?: number;
@@ -662,6 +714,13 @@ interface components {
662
714
  name: string;
663
715
  price: number;
664
716
  currency: string;
717
+ pricingOptions?: {
718
+ currency: string;
719
+ price: number;
720
+ basePrice?: number;
721
+ setupFee?: number;
722
+ default?: boolean;
723
+ }[];
665
724
  /** @enum {string} */
666
725
  billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
667
726
  /** @enum {string} */
@@ -730,6 +789,13 @@ interface components {
730
789
  name: string;
731
790
  price: number;
732
791
  currency: string;
792
+ pricingOptions?: {
793
+ currency: string;
794
+ price: number;
795
+ basePrice?: number;
796
+ setupFee?: number;
797
+ default?: boolean;
798
+ }[];
733
799
  /** @enum {string} */
734
800
  billingCycle?: "weekly" | "monthly" | "quarterly" | "yearly" | "custom";
735
801
  /** @enum {string} */
@@ -763,6 +829,52 @@ interface components {
763
829
  CloneProductDto: {
764
830
  name?: string;
765
831
  };
832
+ CreditDebitSuccessResponse: {
833
+ /** @enum {number} */
834
+ debited: true;
835
+ /**
836
+ * Credits debited for this usage event
837
+ * @example 10
838
+ */
839
+ amount: number;
840
+ /**
841
+ * Estimated remaining units after debit
842
+ * @example 99
843
+ */
844
+ unitsRemaining: number;
845
+ };
846
+ CreditDebitSkippedResponse: {
847
+ /** @enum {number} */
848
+ debited: false;
849
+ /**
850
+ * Reason no credit debit was recorded
851
+ * @example duplicate
852
+ * @enum {string}
853
+ */
854
+ reason: "duplicate" | "no_product_ref" | "customer_not_found" | "no_active_purchase" | "plan_not_credit_based";
855
+ };
856
+ UsageRecordResponse: {
857
+ /** @example true */
858
+ success: boolean;
859
+ /** @example usage_A1B2C3D4 */
860
+ reference: string;
861
+ creditDebit?: components["schemas"]["CreditDebitSuccessResponse"] | components["schemas"]["CreditDebitSkippedResponse"];
862
+ };
863
+ BulkUsageResultResponse: {
864
+ /** @example usage_A1B2C3D4 */
865
+ reference: string;
866
+ creditDebit?: components["schemas"]["CreditDebitSuccessResponse"] | components["schemas"]["CreditDebitSkippedResponse"];
867
+ };
868
+ BulkUsageResponse: {
869
+ /** @example true */
870
+ success: boolean;
871
+ /**
872
+ * Number of usage events inserted
873
+ * @example 2
874
+ */
875
+ inserted: number;
876
+ results: components["schemas"]["BulkUsageResultResponse"][];
877
+ };
766
878
  CreateUsageRequest: {
767
879
  customerRef: string;
768
880
  /**
@@ -1032,6 +1144,8 @@ interface components {
1032
1144
  creditsPerUnit?: number;
1033
1145
  billingModel?: string;
1034
1146
  billingCycle?: string;
1147
+ /** @description Per-currency price options for this plan */
1148
+ pricingOptions?: components["schemas"]["PlanPricingOptionDto"][];
1035
1149
  };
1036
1150
  LimitBalanceDto: {
1037
1151
  /** @description Credit balance in mils */
@@ -1115,6 +1229,22 @@ interface components {
1115
1229
  };
1116
1230
  externalRef?: string;
1117
1231
  };
1232
+ GrantCustomerCreditsRequest: {
1233
+ credits: number;
1234
+ reason?: string;
1235
+ };
1236
+ GrantCustomerCreditsResponse: {
1237
+ /** @description Whether the grant was recorded */
1238
+ success: boolean;
1239
+ /** @description Customer reference identifier */
1240
+ customerRef: string;
1241
+ /** @description Granted credit amount */
1242
+ credits: number;
1243
+ /** @description Customer credit balance after the grant */
1244
+ balance: number;
1245
+ /** @description Machine-readable grant reason */
1246
+ reason?: string;
1247
+ };
1118
1248
  CreateCustomerSessionRequest: {
1119
1249
  customerRef: string;
1120
1250
  productRef?: string;
@@ -2018,12 +2148,7 @@ interface operations {
2018
2148
  [name: string]: unknown;
2019
2149
  };
2020
2150
  content: {
2021
- "application/json": {
2022
- /** @example true */
2023
- success?: boolean;
2024
- /** @example usage_A1B2C3D4 */
2025
- reference?: string;
2026
- };
2151
+ "application/json": components["schemas"]["UsageRecordResponse"];
2027
2152
  };
2028
2153
  };
2029
2154
  /** @description Validation failed */
@@ -2053,7 +2178,9 @@ interface operations {
2053
2178
  headers: {
2054
2179
  [name: string]: unknown;
2055
2180
  };
2056
- content?: never;
2181
+ content: {
2182
+ "application/json": components["schemas"]["BulkUsageResponse"];
2183
+ };
2057
2184
  };
2058
2185
  /** @description Validation failed */
2059
2186
  400: {
@@ -2585,6 +2712,43 @@ interface operations {
2585
2712
  };
2586
2713
  };
2587
2714
  };
2715
+ CustomerSdkController_grantCredits: {
2716
+ parameters: {
2717
+ query?: never;
2718
+ header?: {
2719
+ /** @description Provider-scoped idempotency key for safe grant retries */
2720
+ "Idempotency-Key"?: string;
2721
+ };
2722
+ path: {
2723
+ /** @description Customer reference identifier */
2724
+ reference: string;
2725
+ };
2726
+ cookie?: never;
2727
+ };
2728
+ requestBody: {
2729
+ content: {
2730
+ "application/json": components["schemas"]["GrantCustomerCreditsRequest"];
2731
+ };
2732
+ };
2733
+ responses: {
2734
+ /** @description Credits granted successfully */
2735
+ 200: {
2736
+ headers: {
2737
+ [name: string]: unknown;
2738
+ };
2739
+ content: {
2740
+ "application/json": components["schemas"]["GrantCustomerCreditsResponse"];
2741
+ };
2742
+ };
2743
+ /** @description Customer not found */
2744
+ 404: {
2745
+ headers: {
2746
+ [name: string]: unknown;
2747
+ };
2748
+ content?: never;
2749
+ };
2750
+ };
2751
+ };
2588
2752
  CustomerSdkController_createCustomerSession: {
2589
2753
  parameters: {
2590
2754
  query?: never;
@@ -3022,6 +3186,7 @@ interface SolvaPayCopy {
3022
3186
  currentBadge: string;
3023
3187
  popularBadge: string;
3024
3188
  freeBadge: string;
3189
+ usageRateLabel: string;
3025
3190
  perIntervalShort: string;
3026
3191
  continueButton: string;
3027
3192
  backButton: string;
@@ -3363,6 +3528,7 @@ interface SolvaPayTransport {
3363
3528
  createPayment: (params: {
3364
3529
  planRef?: string;
3365
3530
  productRef?: string;
3531
+ currency?: string;
3366
3532
  customer?: PrefillCustomer;
3367
3533
  }) => Promise<PaymentIntentResult>;
3368
3534
  processPayment: (params: {
@@ -3486,6 +3652,13 @@ interface Merchant {
3486
3652
  privacyUrl?: string;
3487
3653
  country?: string;
3488
3654
  defaultCurrency?: string;
3655
+ /**
3656
+ * Full set of currencies (including `defaultCurrency`) the customer may
3657
+ * pay credit topups in. Surfaced only when the merchant enabled more than
3658
+ * one — single-currency merchants leave this undefined and keep today's
3659
+ * behavior. Drives the topup currency switcher in the PAYG amount step.
3660
+ */
3661
+ supportedTopupCurrencies?: string[];
3489
3662
  statementDescriptor?: string;
3490
3663
  logoUrl?: string;
3491
3664
  /**
@@ -3794,6 +3967,7 @@ interface SolvaPayContextValue {
3794
3967
  createPayment: (params: {
3795
3968
  planRef?: string;
3796
3969
  productRef?: string;
3970
+ currency?: string;
3797
3971
  customer?: PrefillCustomer;
3798
3972
  }) => Promise<PaymentIntentResult>;
3799
3973
  processPayment?: (params: {
@@ -3872,6 +4046,13 @@ interface PaymentError extends Error {
3872
4046
  * All fields are optional except `reference` so the type stays compatible
3873
4047
  * with partial JSON responses from custom fetcher functions.
3874
4048
  */
4049
+ interface PlanPricingOption {
4050
+ currency: string;
4051
+ price: number;
4052
+ basePrice?: number;
4053
+ setupFee?: number;
4054
+ default?: boolean;
4055
+ }
3875
4056
  interface Plan {
3876
4057
  type?: 'recurring' | 'one-time' | 'usage-based';
3877
4058
  reference: string;
@@ -3879,6 +4060,7 @@ interface Plan {
3879
4060
  description?: string;
3880
4061
  price?: number;
3881
4062
  currency?: string;
4063
+ pricingOptions?: PlanPricingOption[];
3882
4064
  currencySymbol?: string;
3883
4065
  freeUnits?: number;
3884
4066
  setupFee?: number;
@@ -4117,6 +4299,13 @@ interface BootstrapPlanLike {
4117
4299
  meterRef?: string | null;
4118
4300
  creditsPerUnit?: number | null;
4119
4301
  requiresPayment?: boolean;
4302
+ pricingOptions?: Array<{
4303
+ currency: string;
4304
+ price: number;
4305
+ basePrice?: number;
4306
+ setupFee?: number;
4307
+ default?: boolean;
4308
+ }>;
4120
4309
  }
4121
4310
  type SuccessMeta = {
4122
4311
  branch: 'payg';
package/dist/styles.css CHANGED
@@ -305,6 +305,31 @@
305
305
  background: color-mix(in srgb, var(--solvapay-destructive) 6%, transparent);
306
306
  }
307
307
 
308
+ [data-solvapay-plan-selector-currency-switcher],
309
+ .solvapay-plan-selector-currency-switcher {
310
+ align-self: flex-end;
311
+ font: inherit;
312
+ font-size: 0.8125rem;
313
+ font-weight: 500;
314
+ color: var(--solvapay-accent);
315
+ background: var(--solvapay-surface);
316
+ border: 1px solid var(--solvapay-border);
317
+ border-radius: var(--solvapay-radius);
318
+ padding: 0.375rem 0.625rem;
319
+ cursor: pointer;
320
+ }
321
+
322
+ [data-solvapay-plan-selector-card-currency] {
323
+ font: inherit;
324
+ font-size: 0.75rem;
325
+ color: var(--solvapay-muted-foreground);
326
+ background: transparent;
327
+ border: 1px solid var(--solvapay-border);
328
+ border-radius: calc(var(--solvapay-radius) - 2px);
329
+ padding: 0.125rem 0.375rem;
330
+ cursor: pointer;
331
+ }
332
+
308
333
  /* -----------------------------------------------------------------------------
309
334
  * CheckoutSteps namespace — baseline styling for `<CheckoutSteps.*>`
310
335
  * parts so the recommended-default `<PaywallNotice.EmbeddedCheckout>`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solvapay/react",
3
- "version": "1.2.1",
3
+ "version": "1.3.0-preview-cb8ad16e16ce8f8f357bd7f2e7068d85159df587",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -26,6 +26,11 @@
26
26
  "import": "./dist/adapters/auth.js",
27
27
  "require": "./dist/adapters/auth.cjs"
28
28
  },
29
+ "./auth0": {
30
+ "types": "./dist/adapters/auth0.d.ts",
31
+ "import": "./dist/adapters/auth0.js",
32
+ "require": "./dist/adapters/auth0.cjs"
33
+ },
29
34
  "./mcp": {
30
35
  "types": "./dist/mcp/index.d.ts",
31
36
  "import": "./dist/mcp/index.js",
@@ -54,7 +59,7 @@
54
59
  "peerDependencies": {
55
60
  "react": "^18.2.0 || ^19.0.0",
56
61
  "react-dom": "^18.2.0 || ^19.0.0",
57
- "@solvapay/mcp-core": "0.2.5"
62
+ "@solvapay/mcp-core": "^0.2.5"
58
63
  },
59
64
  "peerDependenciesMeta": {
60
65
  "@solvapay/mcp-core": {
@@ -80,14 +85,14 @@
80
85
  "typescript": "^5.9.3",
81
86
  "vitest": "^4.1.2",
82
87
  "@solvapay/mcp-core": "0.2.5",
83
- "@solvapay/server": "1.2.0",
88
+ "@solvapay/server": "1.2.1-preview-cb8ad16e16ce8f8f357bd7f2e7068d85159df587",
84
89
  "@solvapay/test-utils": "0.0.0"
85
90
  },
86
91
  "scripts": {
87
- "build": "tsup src/index.tsx src/primitives/index.ts src/adapters/auth.ts src/mcp/index.ts --format esm,cjs --dts --tsconfig tsconfig.build.json && cp src/styles.css dist/styles.css && mkdir -p dist/mcp && cp src/mcp/styles.css dist/mcp/styles.css",
88
- "dev": "tsup src/index.tsx src/primitives/index.ts src/adapters/auth.ts src/mcp/index.ts --format esm,cjs --dts --tsconfig tsconfig.build.json --watch --onSuccess \"cp src/styles.css dist/styles.css && mkdir -p dist/mcp && cp src/mcp/styles.css dist/mcp/styles.css\"",
89
- "test": "vitest run || exit 0",
90
- "test:unit": "vitest run || exit 0",
92
+ "build": "tsup src/index.tsx src/primitives/index.ts src/adapters/auth.ts src/adapters/auth0.ts src/adapters/session-auth.ts src/mcp/index.ts --format esm,cjs --dts --tsconfig tsconfig.build.json && cp src/styles.css dist/styles.css && mkdir -p dist/mcp && cp src/mcp/styles.css dist/mcp/styles.css",
93
+ "dev": "tsup src/index.tsx src/primitives/index.ts src/adapters/auth.ts src/adapters/auth0.ts src/adapters/session-auth.ts src/mcp/index.ts --format esm,cjs --dts --tsconfig tsconfig.build.json --watch --onSuccess \"cp src/styles.css dist/styles.css && mkdir -p dist/mcp && cp src/mcp/styles.css dist/mcp/styles.css\"",
94
+ "test": "vitest run",
95
+ "test:unit": "vitest run",
91
96
  "test:types": "tsc --noEmit -p __tests__/tsconfig.types.json",
92
97
  "test:watch": "vitest",
93
98
  "lint": "eslint src --config ../../eslint.config.react.mjs",