@solvapay/server 2.8.0 → 2.9.0-preview-0b7998345be4ea7f15666fa77c72ea02a914ea65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/edge.d.ts +22 -92
- package/dist/edge.js +1 -12
- package/dist/fetch/index.cjs +1 -12
- package/dist/fetch/index.d.cts +11 -77
- package/dist/fetch/index.d.ts +11 -77
- package/dist/fetch/index.js +1 -12
- package/dist/index.cjs +1 -12
- package/dist/index.d.cts +22 -92
- package/dist/index.d.ts +22 -92
- package/dist/index.js +1 -12
- package/package.json +1 -1
package/dist/fetch/index.d.ts
CHANGED
|
@@ -317,12 +317,9 @@ interface components {
|
|
|
317
317
|
label?: string;
|
|
318
318
|
meter: string;
|
|
319
319
|
/** @enum {string} */
|
|
320
|
-
onExceed: 'block' | '
|
|
321
|
-
onExceedPricingId?: string;
|
|
320
|
+
onExceed: 'block' | 'top_up';
|
|
322
321
|
/** @enum {string} */
|
|
323
322
|
scope: 'billing_period' | 'lifetime' | 'rolling_window';
|
|
324
|
-
/** @enum {string} */
|
|
325
|
-
uiHint?: 'upgrade_prompt' | 'soft_warning';
|
|
326
323
|
windowDays?: number;
|
|
327
324
|
} | {
|
|
328
325
|
feature: string;
|
|
@@ -333,12 +330,11 @@ interface components {
|
|
|
333
330
|
value: boolean | number | string;
|
|
334
331
|
} | {
|
|
335
332
|
days: number;
|
|
336
|
-
downgradeToPricingId?: string;
|
|
337
333
|
/** @enum {string} */
|
|
338
334
|
kind: 'trial';
|
|
339
335
|
label?: string;
|
|
340
336
|
/** @enum {string} */
|
|
341
|
-
onEnd: 'convert' | 'cancel'
|
|
337
|
+
onEnd: 'convert' | 'cancel';
|
|
342
338
|
} | {
|
|
343
339
|
/** @enum {string} */
|
|
344
340
|
appliesTo?: 'recurring' | 'setup' | 'usage' | 'all';
|
|
@@ -352,17 +348,6 @@ interface components {
|
|
|
352
348
|
/** @enum {string} */
|
|
353
349
|
mode: 'percentage' | 'fixed';
|
|
354
350
|
value: number;
|
|
355
|
-
} | {
|
|
356
|
-
capUnits?: number;
|
|
357
|
-
currency?: string;
|
|
358
|
-
/** @enum {string} */
|
|
359
|
-
kind: 'rollover';
|
|
360
|
-
label?: string;
|
|
361
|
-
maxCycles?: number;
|
|
362
|
-
meter: string;
|
|
363
|
-
rateMinor?: number;
|
|
364
|
-
/** @enum {string} */
|
|
365
|
-
treatment: 'forfeit' | 'carry_forward' | 'credit_units' | 'credit_money';
|
|
366
351
|
} | {
|
|
367
352
|
/** @enum {string} */
|
|
368
353
|
kind: 'autoAssigned';
|
|
@@ -513,12 +498,9 @@ interface components {
|
|
|
513
498
|
label?: string;
|
|
514
499
|
meter: string;
|
|
515
500
|
/** @enum {string} */
|
|
516
|
-
onExceed: 'block' | '
|
|
517
|
-
onExceedPricingId?: string;
|
|
501
|
+
onExceed: 'block' | 'top_up';
|
|
518
502
|
/** @enum {string} */
|
|
519
503
|
scope: 'billing_period' | 'lifetime' | 'rolling_window';
|
|
520
|
-
/** @enum {string} */
|
|
521
|
-
uiHint?: 'upgrade_prompt' | 'soft_warning';
|
|
522
504
|
windowDays?: number;
|
|
523
505
|
} | {
|
|
524
506
|
feature: string;
|
|
@@ -529,12 +511,11 @@ interface components {
|
|
|
529
511
|
value: boolean | number | string;
|
|
530
512
|
} | {
|
|
531
513
|
days: number;
|
|
532
|
-
downgradeToPricingId?: string;
|
|
533
514
|
/** @enum {string} */
|
|
534
515
|
kind: 'trial';
|
|
535
516
|
label?: string;
|
|
536
517
|
/** @enum {string} */
|
|
537
|
-
onEnd: 'convert' | 'cancel'
|
|
518
|
+
onEnd: 'convert' | 'cancel';
|
|
538
519
|
} | {
|
|
539
520
|
/** @enum {string} */
|
|
540
521
|
appliesTo?: 'recurring' | 'setup' | 'usage' | 'all';
|
|
@@ -548,17 +529,6 @@ interface components {
|
|
|
548
529
|
/** @enum {string} */
|
|
549
530
|
mode: 'percentage' | 'fixed';
|
|
550
531
|
value: number;
|
|
551
|
-
} | {
|
|
552
|
-
capUnits?: number;
|
|
553
|
-
currency?: string;
|
|
554
|
-
/** @enum {string} */
|
|
555
|
-
kind: 'rollover';
|
|
556
|
-
label?: string;
|
|
557
|
-
maxCycles?: number;
|
|
558
|
-
meter: string;
|
|
559
|
-
rateMinor?: number;
|
|
560
|
-
/** @enum {string} */
|
|
561
|
-
treatment: 'forfeit' | 'carry_forward' | 'credit_units' | 'credit_money';
|
|
562
532
|
} | {
|
|
563
533
|
/** @enum {string} */
|
|
564
534
|
kind: 'autoAssigned';
|
|
@@ -661,7 +631,7 @@ interface components {
|
|
|
661
631
|
* @example duplicate
|
|
662
632
|
* @enum {string}
|
|
663
633
|
*/
|
|
664
|
-
reason: 'duplicate' | 'no_product_ref' | 'customer_not_found' | 'no_active_purchase' | 'plan_not_credit_based' | '
|
|
634
|
+
reason: 'duplicate' | 'no_product_ref' | 'customer_not_found' | 'no_active_purchase' | 'plan_not_credit_based' | 'not_credit_drawn' | 'within_included';
|
|
665
635
|
};
|
|
666
636
|
CreditDebitSuccessResponse: {
|
|
667
637
|
/**
|
|
@@ -905,11 +875,9 @@ interface components {
|
|
|
905
875
|
* @example requests
|
|
906
876
|
*/
|
|
907
877
|
meterName?: string;
|
|
908
|
-
/** @description Access is blocked
|
|
878
|
+
/** @description Access is blocked until prepaid credits cover the next unit — past an included cap with `onExceed: top_up`, or from the first unit on a recurring meter with no limit. */
|
|
909
879
|
needsTopUp?: boolean;
|
|
910
|
-
/** @description Access is
|
|
911
|
-
needsUpgrade?: boolean;
|
|
912
|
-
/** @description Access is granted and usage beyond the included cap accrues an overage charge — `onExceed: charge`. */
|
|
880
|
+
/** @description Access is granted past the included cap and the usage is paid from prepaid credits — `onExceed: top_up`. */
|
|
913
881
|
overage?: boolean;
|
|
914
882
|
/**
|
|
915
883
|
* Authoritative paywall classification shared with Managed MCP. Present on denial responses only.
|
|
@@ -931,10 +899,6 @@ interface components {
|
|
|
931
899
|
* @example 997
|
|
932
900
|
*/
|
|
933
901
|
remaining: number;
|
|
934
|
-
/** @description Access is granted but the caller should degrade/throttle service — the limit was exceeded with `onExceed: throttle`. */
|
|
935
|
-
throttled?: boolean;
|
|
936
|
-
/** @description The customer was auto-upgraded to the target pricing to restore access — `onExceed: auto_upgrade` succeeded. */
|
|
937
|
-
upgraded?: boolean;
|
|
938
902
|
/** @description Consumed usage units this period. Present only when the backend measured a finite cap. */
|
|
939
903
|
used?: number;
|
|
940
904
|
/**
|
|
@@ -1002,12 +966,9 @@ interface components {
|
|
|
1002
966
|
label?: string;
|
|
1003
967
|
meter: string;
|
|
1004
968
|
/** @enum {string} */
|
|
1005
|
-
onExceed: 'block' | '
|
|
1006
|
-
onExceedPricingId?: string;
|
|
969
|
+
onExceed: 'block' | 'top_up';
|
|
1007
970
|
/** @enum {string} */
|
|
1008
971
|
scope: 'billing_period' | 'lifetime' | 'rolling_window';
|
|
1009
|
-
/** @enum {string} */
|
|
1010
|
-
uiHint?: 'upgrade_prompt' | 'soft_warning';
|
|
1011
972
|
windowDays?: number;
|
|
1012
973
|
} | {
|
|
1013
974
|
feature: string;
|
|
@@ -1018,12 +979,11 @@ interface components {
|
|
|
1018
979
|
value: boolean | number | string;
|
|
1019
980
|
} | {
|
|
1020
981
|
days: number;
|
|
1021
|
-
downgradeToPricingId?: string;
|
|
1022
982
|
/** @enum {string} */
|
|
1023
983
|
kind: 'trial';
|
|
1024
984
|
label?: string;
|
|
1025
985
|
/** @enum {string} */
|
|
1026
|
-
onEnd: 'convert' | 'cancel'
|
|
986
|
+
onEnd: 'convert' | 'cancel';
|
|
1027
987
|
} | {
|
|
1028
988
|
/** @enum {string} */
|
|
1029
989
|
appliesTo?: 'recurring' | 'setup' | 'usage' | 'all';
|
|
@@ -1037,17 +997,6 @@ interface components {
|
|
|
1037
997
|
/** @enum {string} */
|
|
1038
998
|
mode: 'percentage' | 'fixed';
|
|
1039
999
|
value: number;
|
|
1040
|
-
} | {
|
|
1041
|
-
capUnits?: number;
|
|
1042
|
-
currency?: string;
|
|
1043
|
-
/** @enum {string} */
|
|
1044
|
-
kind: 'rollover';
|
|
1045
|
-
label?: string;
|
|
1046
|
-
maxCycles?: number;
|
|
1047
|
-
meter: string;
|
|
1048
|
-
rateMinor?: number;
|
|
1049
|
-
/** @enum {string} */
|
|
1050
|
-
treatment: 'forfeit' | 'carry_forward' | 'credit_units' | 'credit_money';
|
|
1051
1000
|
} | {
|
|
1052
1001
|
/** @enum {string} */
|
|
1053
1002
|
kind: 'autoAssigned';
|
|
@@ -1918,12 +1867,9 @@ interface components {
|
|
|
1918
1867
|
label?: string;
|
|
1919
1868
|
meter: string;
|
|
1920
1869
|
/** @enum {string} */
|
|
1921
|
-
onExceed: 'block' | '
|
|
1922
|
-
onExceedPricingId?: string;
|
|
1870
|
+
onExceed: 'block' | 'top_up';
|
|
1923
1871
|
/** @enum {string} */
|
|
1924
1872
|
scope: 'billing_period' | 'lifetime' | 'rolling_window';
|
|
1925
|
-
/** @enum {string} */
|
|
1926
|
-
uiHint?: 'upgrade_prompt' | 'soft_warning';
|
|
1927
1873
|
windowDays?: number;
|
|
1928
1874
|
} | {
|
|
1929
1875
|
feature: string;
|
|
@@ -1934,12 +1880,11 @@ interface components {
|
|
|
1934
1880
|
value: boolean | number | string;
|
|
1935
1881
|
} | {
|
|
1936
1882
|
days: number;
|
|
1937
|
-
downgradeToPricingId?: string;
|
|
1938
1883
|
/** @enum {string} */
|
|
1939
1884
|
kind: 'trial';
|
|
1940
1885
|
label?: string;
|
|
1941
1886
|
/** @enum {string} */
|
|
1942
|
-
onEnd: 'convert' | 'cancel'
|
|
1887
|
+
onEnd: 'convert' | 'cancel';
|
|
1943
1888
|
} | {
|
|
1944
1889
|
/** @enum {string} */
|
|
1945
1890
|
appliesTo?: 'recurring' | 'setup' | 'usage' | 'all';
|
|
@@ -1953,17 +1898,6 @@ interface components {
|
|
|
1953
1898
|
/** @enum {string} */
|
|
1954
1899
|
mode: 'percentage' | 'fixed';
|
|
1955
1900
|
value: number;
|
|
1956
|
-
} | {
|
|
1957
|
-
capUnits?: number;
|
|
1958
|
-
currency?: string;
|
|
1959
|
-
/** @enum {string} */
|
|
1960
|
-
kind: 'rollover';
|
|
1961
|
-
label?: string;
|
|
1962
|
-
maxCycles?: number;
|
|
1963
|
-
meter: string;
|
|
1964
|
-
rateMinor?: number;
|
|
1965
|
-
/** @enum {string} */
|
|
1966
|
-
treatment: 'forfeit' | 'carry_forward' | 'credit_units' | 'credit_money';
|
|
1967
1901
|
} | {
|
|
1968
1902
|
/** @enum {string} */
|
|
1969
1903
|
kind: 'autoAssigned';
|
package/dist/fetch/index.js
CHANGED
|
@@ -834,9 +834,6 @@ function classifyPaywallState(limits) {
|
|
|
834
834
|
if (limits.needsTopUp === true) {
|
|
835
835
|
return { kind: "topup_required" };
|
|
836
836
|
}
|
|
837
|
-
if (limits.needsUpgrade === true) {
|
|
838
|
-
return { kind: "upgrade_required" };
|
|
839
|
-
}
|
|
840
837
|
const signals = creditSignals(limits);
|
|
841
838
|
if (signals.isCreditBased) {
|
|
842
839
|
if (signals.creditBalance !== void 0 && signals.creditsPerCall !== void 0 && signals.creditBalance < signals.creditsPerCall) {
|
|
@@ -964,14 +961,6 @@ function buildGateMessage(state, gate) {
|
|
|
964
961
|
return `${lead}${topup}${auto}${switchLine}`;
|
|
965
962
|
}
|
|
966
963
|
case "upgrade_required": {
|
|
967
|
-
if (hasActivePlan(gate)) {
|
|
968
|
-
const planName = gate.planName ?? "This plan";
|
|
969
|
-
const lead = `${planName} is active but its included usage is exhausted, and the automatic switch to the next plan did not complete.`;
|
|
970
|
-
if (ladder) {
|
|
971
|
-
return `${lead} Switch here: ${ladder}. ${callViewer("account").replace(/^c/, "C")} for usage and recovery.`;
|
|
972
|
-
}
|
|
973
|
-
return `${lead}${recoverClause(url, "switch plan", "checkout")}`;
|
|
974
|
-
}
|
|
975
964
|
if (ladder) {
|
|
976
965
|
return `You don't have an active plan for this tool. Pick a plan to use this tool: ${ladder} (links expire in ${CHECKOUT_SESSION_TTL_MINUTES} minutes), or ${callViewer("checkout")}. ${callViewer("account").replace(/^c/, "C")} for usage and recovery.`;
|
|
977
966
|
}
|
|
@@ -1487,7 +1476,7 @@ var SolvaPayPaywall = class {
|
|
|
1487
1476
|
requestId
|
|
1488
1477
|
};
|
|
1489
1478
|
}
|
|
1490
|
-
const consequence = lastLimitsCheck.
|
|
1479
|
+
const consequence = lastLimitsCheck.overage ? "overage" : void 0;
|
|
1491
1480
|
return {
|
|
1492
1481
|
outcome: "allow",
|
|
1493
1482
|
args,
|
package/dist/index.cjs
CHANGED
|
@@ -769,9 +769,6 @@ function classifyPaywallState(limits) {
|
|
|
769
769
|
if (limits.needsTopUp === true) {
|
|
770
770
|
return { kind: "topup_required" };
|
|
771
771
|
}
|
|
772
|
-
if (limits.needsUpgrade === true) {
|
|
773
|
-
return { kind: "upgrade_required" };
|
|
774
|
-
}
|
|
775
772
|
const signals = creditSignals(limits);
|
|
776
773
|
if (signals.isCreditBased) {
|
|
777
774
|
if (signals.creditBalance !== void 0 && signals.creditsPerCall !== void 0 && signals.creditBalance < signals.creditsPerCall) {
|
|
@@ -899,14 +896,6 @@ function buildGateMessage(state, gate) {
|
|
|
899
896
|
return `${lead}${topup}${auto}${switchLine}`;
|
|
900
897
|
}
|
|
901
898
|
case "upgrade_required": {
|
|
902
|
-
if (hasActivePlan(gate)) {
|
|
903
|
-
const planName = gate.planName ?? "This plan";
|
|
904
|
-
const lead = `${planName} is active but its included usage is exhausted, and the automatic switch to the next plan did not complete.`;
|
|
905
|
-
if (ladder) {
|
|
906
|
-
return `${lead} Switch here: ${ladder}. ${callViewer("account").replace(/^c/, "C")} for usage and recovery.`;
|
|
907
|
-
}
|
|
908
|
-
return `${lead}${recoverClause(url, "switch plan", "checkout")}`;
|
|
909
|
-
}
|
|
910
899
|
if (ladder) {
|
|
911
900
|
return `You don't have an active plan for this tool. Pick a plan to use this tool: ${ladder} (links expire in ${CHECKOUT_SESSION_TTL_MINUTES} minutes), or ${callViewer("checkout")}. ${callViewer("account").replace(/^c/, "C")} for usage and recovery.`;
|
|
912
901
|
}
|
|
@@ -1446,7 +1435,7 @@ var SolvaPayPaywall = class {
|
|
|
1446
1435
|
requestId
|
|
1447
1436
|
};
|
|
1448
1437
|
}
|
|
1449
|
-
const consequence = lastLimitsCheck.
|
|
1438
|
+
const consequence = lastLimitsCheck.overage ? "overage" : void 0;
|
|
1450
1439
|
return {
|
|
1451
1440
|
outcome: "allow",
|
|
1452
1441
|
args,
|
package/dist/index.d.cts
CHANGED
|
@@ -320,12 +320,9 @@ interface components {
|
|
|
320
320
|
label?: string;
|
|
321
321
|
meter: string;
|
|
322
322
|
/** @enum {string} */
|
|
323
|
-
onExceed: 'block' | '
|
|
324
|
-
onExceedPricingId?: string;
|
|
323
|
+
onExceed: 'block' | 'top_up';
|
|
325
324
|
/** @enum {string} */
|
|
326
325
|
scope: 'billing_period' | 'lifetime' | 'rolling_window';
|
|
327
|
-
/** @enum {string} */
|
|
328
|
-
uiHint?: 'upgrade_prompt' | 'soft_warning';
|
|
329
326
|
windowDays?: number;
|
|
330
327
|
} | {
|
|
331
328
|
feature: string;
|
|
@@ -336,12 +333,11 @@ interface components {
|
|
|
336
333
|
value: boolean | number | string;
|
|
337
334
|
} | {
|
|
338
335
|
days: number;
|
|
339
|
-
downgradeToPricingId?: string;
|
|
340
336
|
/** @enum {string} */
|
|
341
337
|
kind: 'trial';
|
|
342
338
|
label?: string;
|
|
343
339
|
/** @enum {string} */
|
|
344
|
-
onEnd: 'convert' | 'cancel'
|
|
340
|
+
onEnd: 'convert' | 'cancel';
|
|
345
341
|
} | {
|
|
346
342
|
/** @enum {string} */
|
|
347
343
|
appliesTo?: 'recurring' | 'setup' | 'usage' | 'all';
|
|
@@ -355,17 +351,6 @@ interface components {
|
|
|
355
351
|
/** @enum {string} */
|
|
356
352
|
mode: 'percentage' | 'fixed';
|
|
357
353
|
value: number;
|
|
358
|
-
} | {
|
|
359
|
-
capUnits?: number;
|
|
360
|
-
currency?: string;
|
|
361
|
-
/** @enum {string} */
|
|
362
|
-
kind: 'rollover';
|
|
363
|
-
label?: string;
|
|
364
|
-
maxCycles?: number;
|
|
365
|
-
meter: string;
|
|
366
|
-
rateMinor?: number;
|
|
367
|
-
/** @enum {string} */
|
|
368
|
-
treatment: 'forfeit' | 'carry_forward' | 'credit_units' | 'credit_money';
|
|
369
354
|
} | {
|
|
370
355
|
/** @enum {string} */
|
|
371
356
|
kind: 'autoAssigned';
|
|
@@ -516,12 +501,9 @@ interface components {
|
|
|
516
501
|
label?: string;
|
|
517
502
|
meter: string;
|
|
518
503
|
/** @enum {string} */
|
|
519
|
-
onExceed: 'block' | '
|
|
520
|
-
onExceedPricingId?: string;
|
|
504
|
+
onExceed: 'block' | 'top_up';
|
|
521
505
|
/** @enum {string} */
|
|
522
506
|
scope: 'billing_period' | 'lifetime' | 'rolling_window';
|
|
523
|
-
/** @enum {string} */
|
|
524
|
-
uiHint?: 'upgrade_prompt' | 'soft_warning';
|
|
525
507
|
windowDays?: number;
|
|
526
508
|
} | {
|
|
527
509
|
feature: string;
|
|
@@ -532,12 +514,11 @@ interface components {
|
|
|
532
514
|
value: boolean | number | string;
|
|
533
515
|
} | {
|
|
534
516
|
days: number;
|
|
535
|
-
downgradeToPricingId?: string;
|
|
536
517
|
/** @enum {string} */
|
|
537
518
|
kind: 'trial';
|
|
538
519
|
label?: string;
|
|
539
520
|
/** @enum {string} */
|
|
540
|
-
onEnd: 'convert' | 'cancel'
|
|
521
|
+
onEnd: 'convert' | 'cancel';
|
|
541
522
|
} | {
|
|
542
523
|
/** @enum {string} */
|
|
543
524
|
appliesTo?: 'recurring' | 'setup' | 'usage' | 'all';
|
|
@@ -551,17 +532,6 @@ interface components {
|
|
|
551
532
|
/** @enum {string} */
|
|
552
533
|
mode: 'percentage' | 'fixed';
|
|
553
534
|
value: number;
|
|
554
|
-
} | {
|
|
555
|
-
capUnits?: number;
|
|
556
|
-
currency?: string;
|
|
557
|
-
/** @enum {string} */
|
|
558
|
-
kind: 'rollover';
|
|
559
|
-
label?: string;
|
|
560
|
-
maxCycles?: number;
|
|
561
|
-
meter: string;
|
|
562
|
-
rateMinor?: number;
|
|
563
|
-
/** @enum {string} */
|
|
564
|
-
treatment: 'forfeit' | 'carry_forward' | 'credit_units' | 'credit_money';
|
|
565
535
|
} | {
|
|
566
536
|
/** @enum {string} */
|
|
567
537
|
kind: 'autoAssigned';
|
|
@@ -664,7 +634,7 @@ interface components {
|
|
|
664
634
|
* @example duplicate
|
|
665
635
|
* @enum {string}
|
|
666
636
|
*/
|
|
667
|
-
reason: 'duplicate' | 'no_product_ref' | 'customer_not_found' | 'no_active_purchase' | 'plan_not_credit_based' | '
|
|
637
|
+
reason: 'duplicate' | 'no_product_ref' | 'customer_not_found' | 'no_active_purchase' | 'plan_not_credit_based' | 'not_credit_drawn' | 'within_included';
|
|
668
638
|
};
|
|
669
639
|
CreditDebitSuccessResponse: {
|
|
670
640
|
/**
|
|
@@ -908,11 +878,9 @@ interface components {
|
|
|
908
878
|
* @example requests
|
|
909
879
|
*/
|
|
910
880
|
meterName?: string;
|
|
911
|
-
/** @description Access is blocked
|
|
881
|
+
/** @description Access is blocked until prepaid credits cover the next unit — past an included cap with `onExceed: top_up`, or from the first unit on a recurring meter with no limit. */
|
|
912
882
|
needsTopUp?: boolean;
|
|
913
|
-
/** @description Access is
|
|
914
|
-
needsUpgrade?: boolean;
|
|
915
|
-
/** @description Access is granted and usage beyond the included cap accrues an overage charge — `onExceed: charge`. */
|
|
883
|
+
/** @description Access is granted past the included cap and the usage is paid from prepaid credits — `onExceed: top_up`. */
|
|
916
884
|
overage?: boolean;
|
|
917
885
|
/**
|
|
918
886
|
* Authoritative paywall classification shared with Managed MCP. Present on denial responses only.
|
|
@@ -934,10 +902,6 @@ interface components {
|
|
|
934
902
|
* @example 997
|
|
935
903
|
*/
|
|
936
904
|
remaining: number;
|
|
937
|
-
/** @description Access is granted but the caller should degrade/throttle service — the limit was exceeded with `onExceed: throttle`. */
|
|
938
|
-
throttled?: boolean;
|
|
939
|
-
/** @description The customer was auto-upgraded to the target pricing to restore access — `onExceed: auto_upgrade` succeeded. */
|
|
940
|
-
upgraded?: boolean;
|
|
941
905
|
/** @description Consumed usage units this period. Present only when the backend measured a finite cap. */
|
|
942
906
|
used?: number;
|
|
943
907
|
/**
|
|
@@ -1005,12 +969,9 @@ interface components {
|
|
|
1005
969
|
label?: string;
|
|
1006
970
|
meter: string;
|
|
1007
971
|
/** @enum {string} */
|
|
1008
|
-
onExceed: 'block' | '
|
|
1009
|
-
onExceedPricingId?: string;
|
|
972
|
+
onExceed: 'block' | 'top_up';
|
|
1010
973
|
/** @enum {string} */
|
|
1011
974
|
scope: 'billing_period' | 'lifetime' | 'rolling_window';
|
|
1012
|
-
/** @enum {string} */
|
|
1013
|
-
uiHint?: 'upgrade_prompt' | 'soft_warning';
|
|
1014
975
|
windowDays?: number;
|
|
1015
976
|
} | {
|
|
1016
977
|
feature: string;
|
|
@@ -1021,12 +982,11 @@ interface components {
|
|
|
1021
982
|
value: boolean | number | string;
|
|
1022
983
|
} | {
|
|
1023
984
|
days: number;
|
|
1024
|
-
downgradeToPricingId?: string;
|
|
1025
985
|
/** @enum {string} */
|
|
1026
986
|
kind: 'trial';
|
|
1027
987
|
label?: string;
|
|
1028
988
|
/** @enum {string} */
|
|
1029
|
-
onEnd: 'convert' | 'cancel'
|
|
989
|
+
onEnd: 'convert' | 'cancel';
|
|
1030
990
|
} | {
|
|
1031
991
|
/** @enum {string} */
|
|
1032
992
|
appliesTo?: 'recurring' | 'setup' | 'usage' | 'all';
|
|
@@ -1040,17 +1000,6 @@ interface components {
|
|
|
1040
1000
|
/** @enum {string} */
|
|
1041
1001
|
mode: 'percentage' | 'fixed';
|
|
1042
1002
|
value: number;
|
|
1043
|
-
} | {
|
|
1044
|
-
capUnits?: number;
|
|
1045
|
-
currency?: string;
|
|
1046
|
-
/** @enum {string} */
|
|
1047
|
-
kind: 'rollover';
|
|
1048
|
-
label?: string;
|
|
1049
|
-
maxCycles?: number;
|
|
1050
|
-
meter: string;
|
|
1051
|
-
rateMinor?: number;
|
|
1052
|
-
/** @enum {string} */
|
|
1053
|
-
treatment: 'forfeit' | 'carry_forward' | 'credit_units' | 'credit_money';
|
|
1054
1003
|
} | {
|
|
1055
1004
|
/** @enum {string} */
|
|
1056
1005
|
kind: 'autoAssigned';
|
|
@@ -1921,12 +1870,9 @@ interface components {
|
|
|
1921
1870
|
label?: string;
|
|
1922
1871
|
meter: string;
|
|
1923
1872
|
/** @enum {string} */
|
|
1924
|
-
onExceed: 'block' | '
|
|
1925
|
-
onExceedPricingId?: string;
|
|
1873
|
+
onExceed: 'block' | 'top_up';
|
|
1926
1874
|
/** @enum {string} */
|
|
1927
1875
|
scope: 'billing_period' | 'lifetime' | 'rolling_window';
|
|
1928
|
-
/** @enum {string} */
|
|
1929
|
-
uiHint?: 'upgrade_prompt' | 'soft_warning';
|
|
1930
1876
|
windowDays?: number;
|
|
1931
1877
|
} | {
|
|
1932
1878
|
feature: string;
|
|
@@ -1937,12 +1883,11 @@ interface components {
|
|
|
1937
1883
|
value: boolean | number | string;
|
|
1938
1884
|
} | {
|
|
1939
1885
|
days: number;
|
|
1940
|
-
downgradeToPricingId?: string;
|
|
1941
1886
|
/** @enum {string} */
|
|
1942
1887
|
kind: 'trial';
|
|
1943
1888
|
label?: string;
|
|
1944
1889
|
/** @enum {string} */
|
|
1945
|
-
onEnd: 'convert' | 'cancel'
|
|
1890
|
+
onEnd: 'convert' | 'cancel';
|
|
1946
1891
|
} | {
|
|
1947
1892
|
/** @enum {string} */
|
|
1948
1893
|
appliesTo?: 'recurring' | 'setup' | 'usage' | 'all';
|
|
@@ -1956,17 +1901,6 @@ interface components {
|
|
|
1956
1901
|
/** @enum {string} */
|
|
1957
1902
|
mode: 'percentage' | 'fixed';
|
|
1958
1903
|
value: number;
|
|
1959
|
-
} | {
|
|
1960
|
-
capUnits?: number;
|
|
1961
|
-
currency?: string;
|
|
1962
|
-
/** @enum {string} */
|
|
1963
|
-
kind: 'rollover';
|
|
1964
|
-
label?: string;
|
|
1965
|
-
maxCycles?: number;
|
|
1966
|
-
meter: string;
|
|
1967
|
-
rateMinor?: number;
|
|
1968
|
-
/** @enum {string} */
|
|
1969
|
-
treatment: 'forfeit' | 'carry_forward' | 'credit_units' | 'credit_money';
|
|
1970
1904
|
} | {
|
|
1971
1905
|
/** @enum {string} */
|
|
1972
1906
|
kind: 'autoAssigned';
|
|
@@ -3941,12 +3875,11 @@ type FreeLimit = Required<Omit<GeneratedFreeAllowance, 'windowDays'>> & Pick<Gen
|
|
|
3941
3875
|
/**
|
|
3942
3876
|
* `LimitResponse` plus a deprecated SDK-only `plan` alias.
|
|
3943
3877
|
*
|
|
3944
|
-
* The backend `LimitResponse`
|
|
3945
|
-
* (`
|
|
3946
|
-
*
|
|
3947
|
-
*
|
|
3948
|
-
*
|
|
3949
|
-
* others accompany a gate outcome.
|
|
3878
|
+
* The backend `LimitResponse` carries the `onExceed` outcome flags
|
|
3879
|
+
* (`overage` / `needsTopUp`, resolved by `decideLimit`), so they flow
|
|
3880
|
+
* through from `generated.ts`. `overage` rides the allow path
|
|
3881
|
+
* (`withinLimits: true`) so a protected handler can read it from
|
|
3882
|
+
* `decision.limits`; `needsTopUp` accompanies a gate outcome.
|
|
3950
3883
|
*
|
|
3951
3884
|
* Read `planRef` for the active plan. `plan` is never populated by the
|
|
3952
3885
|
* backend — it remains optional so older fixtures and callers still type-check.
|
|
@@ -4397,13 +4330,11 @@ type PaywallDecision<T> = {
|
|
|
4397
4330
|
limits: LimitResponseWithPlan;
|
|
4398
4331
|
customerRef: string;
|
|
4399
4332
|
/**
|
|
4400
|
-
* Set when access is granted
|
|
4401
|
-
* `onExceed:
|
|
4402
|
-
*
|
|
4403
|
-
* cap. Absent on a plain allow. Derived from `limits`; not new
|
|
4404
|
-
* wire data.
|
|
4333
|
+
* Set when access is granted past the included cap and the usage
|
|
4334
|
+
* is paid from prepaid credits (`onExceed: top_up`). Absent on a
|
|
4335
|
+
* plain allow. Derived from `limits`; not new wire data.
|
|
4405
4336
|
*/
|
|
4406
|
-
consequence?: '
|
|
4337
|
+
consequence?: 'overage';
|
|
4407
4338
|
/**
|
|
4408
4339
|
* Id minted by `decide()` and reused by `runAllow()` so success /
|
|
4409
4340
|
* fail tracking shares one idempotency key with the decision.
|
|
@@ -5056,8 +4987,7 @@ interface SolvaPay {
|
|
|
5056
4987
|
* @param params.customerRef - Customer reference
|
|
5057
4988
|
* @param params.productRef - Product reference
|
|
5058
4989
|
* @returns Full `LimitResponseWithPlan`, including the `onExceed` outcome
|
|
5059
|
-
* flags (`
|
|
5060
|
-
* `upgraded`) the backend already sends on `/v1/sdk/limits`
|
|
4990
|
+
* flags (`overage` / `needsTopUp`) the backend sends on `/v1/sdk/limits`
|
|
5061
4991
|
*
|
|
5062
4992
|
* @example
|
|
5063
4993
|
* ```typescript
|
|
@@ -5755,7 +5685,7 @@ declare function nextActionFor(state: PaywallState): PaywallNextAction;
|
|
|
5755
5685
|
* (no purchaseRef / planRef) must not fall through to upgrade_required.
|
|
5756
5686
|
* 3. `paywallReason === 'topup_required'` — backend stays authoritative
|
|
5757
5687
|
* for credit-based denials (same rule as Managed MCP).
|
|
5758
|
-
* 3. Authoritative `needsTopUp`
|
|
5688
|
+
* 3. Authoritative `needsTopUp` flag from `decideLimit`.
|
|
5759
5689
|
* 4. Credit-field presence + a real shortfall (`balance < cost`).
|
|
5760
5690
|
* 5. Active purchase / plan at included cap → `limit_reached`.
|
|
5761
5691
|
* 6. Floor: never `upgrade_required` when credit fields or a purchase
|