@fantastic.dev/better-stripe 0.81.0 → 0.83.0

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAggregate/configure.d.ts +35 -0
  4. package/dist/client/billing/renewalAggregate/configure.d.ts.map +1 -0
  5. package/dist/client/billing/renewalAggregate/configure.js +96 -0
  6. package/dist/client/billing/renewalAggregate/configure.js.map +1 -0
  7. package/dist/client/billing/renewalAggregate/index.d.ts +3 -0
  8. package/dist/client/billing/renewalAggregate/index.d.ts.map +1 -0
  9. package/dist/client/billing/renewalAggregate/index.js +3 -0
  10. package/dist/client/billing/renewalAggregate/index.js.map +1 -0
  11. package/dist/client/billing/renewalAggregate/phaseContext.d.ts +176 -0
  12. package/dist/client/billing/renewalAggregate/phaseContext.d.ts.map +1 -0
  13. package/dist/client/billing/renewalAggregate/phaseContext.js +112 -0
  14. package/dist/client/billing/renewalAggregate/phaseContext.js.map +1 -0
  15. package/dist/client/billing/renewalAggregate/phases.d.ts +7 -0
  16. package/dist/client/billing/renewalAggregate/phases.d.ts.map +1 -0
  17. package/dist/client/billing/renewalAggregate/phases.js +192 -0
  18. package/dist/client/billing/renewalAggregate/phases.js.map +1 -0
  19. package/dist/client/billing/renewalAggregate/preflight.d.ts +594 -0
  20. package/dist/client/billing/renewalAggregate/preflight.d.ts.map +1 -0
  21. package/dist/client/billing/renewalAggregate/preflight.js +164 -0
  22. package/dist/client/billing/renewalAggregate/preflight.js.map +1 -0
  23. package/dist/client/billing/renewalAggregate/profile.d.ts +8 -0
  24. package/dist/client/billing/renewalAggregate/profile.d.ts.map +1 -0
  25. package/dist/client/billing/renewalAggregate/profile.js +60 -0
  26. package/dist/client/billing/renewalAggregate/profile.js.map +1 -0
  27. package/dist/client/billing/renewalAggregate/receipt.d.ts +40 -0
  28. package/dist/client/billing/renewalAggregate/receipt.d.ts.map +1 -0
  29. package/dist/client/billing/renewalAggregate/receipt.js +62 -0
  30. package/dist/client/billing/renewalAggregate/receipt.js.map +1 -0
  31. package/dist/client/billing/renewalAggregate/shared.d.ts +51 -0
  32. package/dist/client/billing/renewalAggregate/shared.d.ts.map +1 -0
  33. package/dist/client/billing/renewalAggregate/shared.js +87 -0
  34. package/dist/client/billing/renewalAggregate/shared.js.map +1 -0
  35. package/dist/client/billing/renewalAggregate/sourceDiscounts.d.ts +42 -0
  36. package/dist/client/billing/renewalAggregate/sourceDiscounts.d.ts.map +1 -0
  37. package/dist/client/billing/renewalAggregate/sourceDiscounts.js +90 -0
  38. package/dist/client/billing/renewalAggregate/sourceDiscounts.js.map +1 -0
  39. package/dist/client/billing/renewalAggregate/sourceSettings.d.ts +136 -0
  40. package/dist/client/billing/renewalAggregate/sourceSettings.d.ts.map +1 -0
  41. package/dist/client/billing/renewalAggregate/sourceSettings.js +82 -0
  42. package/dist/client/billing/renewalAggregate/sourceSettings.js.map +1 -0
  43. package/dist/client/billing/renewalAggregate/taxRetention.d.ts +8 -0
  44. package/dist/client/billing/renewalAggregate/taxRetention.d.ts.map +1 -0
  45. package/dist/client/billing/renewalAggregate/taxRetention.js +23 -0
  46. package/dist/client/billing/renewalAggregate/taxRetention.js.map +1 -0
  47. package/dist/client/billing/renewalAttach/couponJoins.d.ts +23 -0
  48. package/dist/client/billing/renewalAttach/couponJoins.d.ts.map +1 -0
  49. package/dist/client/billing/renewalAttach/couponJoins.js +76 -0
  50. package/dist/client/billing/renewalAttach/couponJoins.js.map +1 -0
  51. package/dist/client/billing/renewalAttach/index.d.ts +3 -0
  52. package/dist/client/billing/renewalAttach/index.d.ts.map +1 -0
  53. package/dist/client/billing/renewalAttach/index.js +3 -0
  54. package/dist/client/billing/renewalAttach/index.js.map +1 -0
  55. package/dist/client/billing/renewalAttach/reader.d.ts +141 -0
  56. package/dist/client/billing/renewalAttach/reader.d.ts.map +1 -0
  57. package/dist/client/billing/renewalAttach/reader.js +80 -0
  58. package/dist/client/billing/renewalAttach/reader.js.map +1 -0
  59. package/dist/client/billing/renewalAttach/request.d.ts +30 -0
  60. package/dist/client/billing/renewalAttach/request.d.ts.map +1 -0
  61. package/dist/client/billing/renewalAttach/request.js +39 -0
  62. package/dist/client/billing/renewalAttach/request.js.map +1 -0
  63. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +32 -32
  64. package/dist/client/connect/payoutSyncTestHelpers.d.ts +16 -16
  65. package/dist/client/index.d.ts +3 -5
  66. package/dist/client/index.d.ts.map +1 -1
  67. package/dist/client/index.js +3 -3
  68. package/dist/client/index.js.map +1 -1
  69. package/dist/client/renewal.d.ts +8 -0
  70. package/dist/client/renewal.d.ts.map +1 -0
  71. package/dist/client/renewal.js +4 -0
  72. package/dist/client/renewal.js.map +1 -0
  73. package/dist/client/renewalContextClient.d.ts +130 -0
  74. package/dist/client/renewalContextClient.d.ts.map +1 -0
  75. package/dist/client/renewalContextClient.js +10 -0
  76. package/dist/client/renewalContextClient.js.map +1 -0
  77. package/dist/client/usage/observationClient.d.ts +2 -2
  78. package/dist/client/usage/observationClient.d.ts.map +1 -1
  79. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  80. package/dist/component/balanceFunding/mutations.d.ts +43 -43
  81. package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
  82. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  83. package/dist/component/earnings/triggers.d.ts +16 -16
  84. package/docs/renewal-context-reads.md +113 -0
  85. package/docs/renewal-phase-assembly.md +180 -0
  86. package/docs/renewal-price-replacements.md +57 -16
  87. package/package.json +1 -1
  88. package/src/client/billing/renewalAggregate/configure.test.ts +372 -0
  89. package/src/client/billing/renewalAggregate/configure.ts +164 -0
  90. package/src/client/billing/renewalAggregate/index.ts +2 -0
  91. package/src/client/billing/renewalAggregate/phaseContext.ts +144 -0
  92. package/src/client/billing/renewalAggregate/phases.ts +247 -0
  93. package/src/client/billing/renewalAggregate/preflight.test.ts +233 -0
  94. package/src/client/billing/renewalAggregate/preflight.ts +211 -0
  95. package/src/client/billing/renewalAggregate/profile.ts +76 -0
  96. package/src/client/billing/renewalAggregate/receipt.ts +76 -0
  97. package/src/client/billing/renewalAggregate/shared.ts +106 -0
  98. package/src/client/billing/renewalAggregate/sourceAndTaxRetention.test.ts +247 -0
  99. package/src/client/billing/renewalAggregate/sourceDiscounts.ts +112 -0
  100. package/src/client/billing/renewalAggregate/sourceSettings.ts +88 -0
  101. package/src/client/billing/renewalAggregate/taxRetention.ts +28 -0
  102. package/src/client/billing/renewalAttach/couponEvidence.test.ts +104 -0
  103. package/src/client/billing/renewalAttach/couponJoins.ts +95 -0
  104. package/src/client/billing/renewalAttach/index.ts +9 -0
  105. package/src/client/billing/renewalAttach/reader.test.ts +409 -0
  106. package/src/client/billing/renewalAttach/reader.ts +131 -0
  107. package/src/client/billing/renewalAttach/request.ts +49 -0
  108. package/src/client/index.ts +3 -8
  109. package/src/client/renewal.ts +13 -0
  110. package/src/client/renewalContextClient.ts +23 -0
package/CHANGELOG.md CHANGED
@@ -26,6 +26,18 @@
26
26
  - Remove internal tracker references from public documentation and add a
27
27
  regression check that prevents their reintroduction.
28
28
 
29
+ ## [0.83.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.82.0...v0.83.0) (2026-10-27)
30
+
31
+ ### Features
32
+
33
+ - read bound renewal context and prepare attach requests ([#400](https://github.com/FantasticDevHQ/better-stripe/issues/400)) ([d0621ec](https://github.com/FantasticDevHQ/better-stripe/commit/d0621ec0e8118b7ad86097c9425e63313b0a3d80))
34
+
35
+ ## [0.82.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.81.0...v0.82.0) (2026-10-27)
36
+
37
+ ### Features
38
+
39
+ - **billing:** assemble bound renewal configuration candidates ([46919da](https://github.com/FantasticDevHQ/better-stripe/commit/46919da1abccec07b28b972165a1e2e166d3aa5c))
40
+
29
41
  ## [0.81.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.80.0...v0.81.0) (2026-10-27)
30
42
 
31
43
  ### Features
package/README.md CHANGED
@@ -5,7 +5,7 @@ billing, and Connect marketplaces. It provides checkout, subscriptions, webhook
5
5
  syncing, marketplace fees and splits, payouts, refunds, and disputes, with React
6
6
  hooks and headless UI components.
7
7
 
8
- **Version**: `0.81.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
8
+ **Version**: `0.83.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
9
9
 
10
10
  Connect platforms use the default GA API version. Non-Connect merchants using
11
11
  customer-only Accounts v2 need preview access and an explicit preview version.
@@ -0,0 +1,35 @@
1
+ import type Stripe from "stripe";
2
+ import type { RenewalProfile } from "./profile.js";
3
+ import { type Failure } from "./shared.js";
4
+ export type ProjectedRenewalConfiguration = {
5
+ version: 1;
6
+ stage: "configure";
7
+ scope: "platform";
8
+ apiVersion: string;
9
+ logicalBinding: string;
10
+ scheduleId: string;
11
+ method: "POST";
12
+ path: string;
13
+ key: string;
14
+ payload: {
15
+ end_behavior: "release";
16
+ proration_behavior: "none";
17
+ phases: [
18
+ Stripe.SubscriptionScheduleUpdateParams.Phase,
19
+ Stripe.SubscriptionScheduleUpdateParams.Phase
20
+ ];
21
+ };
22
+ firstDispatchedAt: number;
23
+ attachReceiptBinding: string;
24
+ baselineBinding: string;
25
+ defaultSettingsBinding: string;
26
+ status: "projected_configure_request";
27
+ providerQualification: "required";
28
+ profile: RenewalProfile;
29
+ requestIdentity: {
30
+ key: string;
31
+ binding: string;
32
+ };
33
+ };
34
+ export declare function projectRenewalConfiguration(input: unknown): ProjectedRenewalConfiguration | Failure;
35
+ //# sourceMappingURL=configure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalAggregate/configure.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAMjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EASL,KAAK,OAAO,EACb,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,6BAA6B,GAAG;IAC1C,OAAO,EAAE,CAAC,CAAC;IACX,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE;QACP,YAAY,EAAE,SAAS,CAAC;QACxB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,MAAM,EAAE;YACN,MAAM,CAAC,gCAAgC,CAAC,KAAK;YAC7C,MAAM,CAAC,gCAAgC,CAAC,KAAK;SAC9C,CAAC;KACH,CAAC;IACF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,MAAM,EAAE,6BAA6B,CAAC;IACtC,qBAAqB,EAAE,UAAU,CAAC;IAClC,OAAO,EAAE,cAAc,CAAC;IACxB,eAAe,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD,CAAC;AAEF,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,OAAO,GACb,6BAA6B,GAAG,OAAO,CAiHzC"}
@@ -0,0 +1,96 @@
1
+ import { z } from "zod";
2
+ import { idempotencyOptions } from "../../core/idempotency.js";
3
+ import { renewalSnapshot } from "../renewalReplacementSnapshot.js";
4
+ import { retainedPreparation, validateReads } from "./preflight.js";
5
+ import { validateAttachReceipt } from "./receipt.js";
6
+ import { assemblePhases } from "./phases.js";
7
+ import { binding, object, configureInput, equal, conflict, unsupported, failure, referenceId, } from "./shared.js";
8
+ export function projectRenewalConfiguration(input) {
9
+ let ownedScheduleId;
10
+ try {
11
+ const args = configureInput.parse(renewalSnapshot(input));
12
+ const prepared = retainedPreparation(args.prepared);
13
+ const receipt = validateAttachReceipt(args.attachReceipt, prepared, args.apiVersion, args.observedAt);
14
+ ownedScheduleId = receipt.scheduleId;
15
+ const key = idempotencyOptions(args.configureKey)?.idempotencyKey;
16
+ if (!key || key === receipt.request.requestIdentity.key)
17
+ unsupported("configure_key_must_be_distinct");
18
+ if (args.firstDispatchedAt > args.observedAt ||
19
+ args.firstDispatchedAt < receipt.request.firstDispatchedAt)
20
+ unsupported("invalid_retained_dispatch_time");
21
+ const rawSubscription = object(args.freshSubscription);
22
+ if (rawSubscription.schedule == null ||
23
+ referenceId(rawSubscription.schedule, "sub_sched", "subscription_schedule") !== receipt.scheduleId)
24
+ conflict("schedule_association_mismatch");
25
+ const reads = validateReads(args, receipt.scheduleId);
26
+ const schedule = object(args.schedule);
27
+ if (!equal(schedule, receipt.providerSnapshot))
28
+ conflict("acknowledged_baseline_or_defaults_drift");
29
+ const expected = prepared.expected;
30
+ const referenceContext = {
31
+ livemode: expected.livemode,
32
+ customerAccountId: expected.customerAccountId,
33
+ };
34
+ if (schedule.id !== receipt.scheduleId ||
35
+ schedule.object !== "subscription_schedule" ||
36
+ schedule.customer_account !== expected.customerAccountId ||
37
+ schedule.livemode !== expected.livemode ||
38
+ referenceId(schedule.customer, "cus", "customer", referenceContext) !==
39
+ reads.customer.id ||
40
+ referenceId(schedule.subscription, "sub", "subscription", referenceContext) !== expected.subscriptionId)
41
+ conflict("acknowledged_schedule_identity_mismatch");
42
+ if (schedule.status !== "active" ||
43
+ schedule.end_behavior !== "release" ||
44
+ schedule.application !== null ||
45
+ schedule.canceled_at !== null ||
46
+ schedule.completed_at !== null ||
47
+ schedule.released_at !== null ||
48
+ schedule.released_subscription !== null ||
49
+ (schedule.pause_schedules !== undefined &&
50
+ (!Array.isArray(schedule.pause_schedules) ||
51
+ schedule.pause_schedules.length)))
52
+ unsupported("unsupported_acknowledged_schedule_state");
53
+ if (!equal(schedule.billing_mode, reads.subscription.billing_mode))
54
+ unsupported("schedule_billing_mode_mismatch");
55
+ const current = z
56
+ .object({ start_date: z.number(), end_date: z.number() })
57
+ .strict()
58
+ .parse(schedule.current_phase);
59
+ if (current.start_date !== expected.periodStart ||
60
+ current.end_date !== expected.periodEnd)
61
+ conflict("current_phase_period_drift");
62
+ const phases = assemblePhases(reads, schedule);
63
+ const payload = {
64
+ end_behavior: "release",
65
+ proration_behavior: "none",
66
+ phases,
67
+ };
68
+ const request = {
69
+ version: 1,
70
+ stage: "configure",
71
+ scope: "platform",
72
+ apiVersion: args.apiVersion,
73
+ logicalBinding: prepared.requestIdentity.binding,
74
+ scheduleId: receipt.scheduleId,
75
+ method: "POST",
76
+ path: `/v1/subscription_schedules/${receipt.scheduleId}`,
77
+ key,
78
+ payload,
79
+ firstDispatchedAt: args.firstDispatchedAt,
80
+ attachReceiptBinding: receipt.binding,
81
+ baselineBinding: binding("renewal-baseline", receipt.providerSnapshot),
82
+ defaultSettingsBinding: binding("renewal-defaults", schedule.default_settings),
83
+ };
84
+ return renewalSnapshot({
85
+ ...request,
86
+ status: "projected_configure_request",
87
+ providerQualification: "required",
88
+ profile: reads.profile,
89
+ requestIdentity: { key, binding: binding("renewal-configure", request) },
90
+ });
91
+ }
92
+ catch (error) {
93
+ return failure(error, ownedScheduleId);
94
+ }
95
+ }
96
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalAggregate/configure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,gBAAgB,C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CAAC,kBAAkB,EAAE,OAAO,CAAC,gBAAgB,CAAC;YACtE,sBAAsB,EAAE,OAAO,CAC7B,kBAAkB,EAClB,QAAQ,CAAC,gBAAgB,CAC1B;SACF,CAAC;QACF,OAAO,eAAe,CAAC;YACrB,GAAG,OAAO;YACV,MAAM,EAAE,6BAAsC;YAC9C,qBAAqB,EAAE,UAAmB;YAC1C,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,eAAe,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,EAAE;SACzE,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { preflightRenewalReplacement } from "./preflight.js";
2
+ export { projectRenewalConfiguration } from "./configure.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalAggregate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { preflightRenewalReplacement } from "./preflight.js";
2
+ export { projectRenewalConfiguration } from "./configure.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalAggregate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,176 @@
1
+ import { z } from "zod";
2
+ import type { qualifyOriginalSettings } from "./sourceSettings.js";
3
+ export declare const defaultsSchema: z.ZodObject<{
4
+ application_fee_percent: z.ZodNull;
5
+ billing_thresholds: z.ZodNull;
6
+ collection_method: z.ZodNullable<z.ZodEnum<{
7
+ charge_automatically: "charge_automatically";
8
+ send_invoice: "send_invoice";
9
+ }>>;
10
+ default_payment_method: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
11
+ id: z.ZodString;
12
+ object: z.ZodLiteral<string>;
13
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
14
+ livemode: z.ZodOptional<z.ZodBoolean>;
15
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
16
+ id: z.ZodString;
17
+ object: z.ZodLiteral<"customer">;
18
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
19
+ livemode: z.ZodOptional<z.ZodBoolean>;
20
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ }, z.core.$loose>]>>>;
22
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ }, z.core.$loose>]>>;
24
+ on_behalf_of: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
25
+ id: z.ZodString;
26
+ object: z.ZodLiteral<string>;
27
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
28
+ livemode: z.ZodOptional<z.ZodBoolean>;
29
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
30
+ id: z.ZodString;
31
+ object: z.ZodLiteral<"customer">;
32
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
33
+ livemode: z.ZodOptional<z.ZodBoolean>;
34
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
35
+ }, z.core.$loose>]>>>;
36
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ }, z.core.$loose>]>>;
38
+ transfer_data: z.ZodNullable<z.ZodObject<{
39
+ destination: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
40
+ id: z.ZodString;
41
+ object: z.ZodLiteral<string>;
42
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
43
+ livemode: z.ZodOptional<z.ZodBoolean>;
44
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
45
+ id: z.ZodString;
46
+ object: z.ZodLiteral<"customer">;
47
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
48
+ livemode: z.ZodOptional<z.ZodBoolean>;
49
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ }, z.core.$loose>]>>>;
51
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ }, z.core.$loose>]>;
53
+ amount_percent: z.ZodNullable<z.ZodNumber>;
54
+ }, z.core.$strict>>;
55
+ automatic_tax: z.ZodOptional<z.ZodObject<{
56
+ enabled: z.ZodBoolean;
57
+ liability: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
58
+ type: z.ZodLiteral<"self">;
59
+ account: z.ZodOptional<z.ZodNull>;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ type: z.ZodLiteral<"account">;
62
+ account: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
63
+ id: z.ZodString;
64
+ object: z.ZodLiteral<string>;
65
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
66
+ livemode: z.ZodOptional<z.ZodBoolean>;
67
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
68
+ id: z.ZodString;
69
+ object: z.ZodLiteral<"customer">;
70
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
71
+ livemode: z.ZodOptional<z.ZodBoolean>;
72
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
+ }, z.core.$loose>]>>>;
74
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
+ }, z.core.$loose>]>;
76
+ }, z.core.$strict>], "type">>>;
77
+ disabled_reason: z.ZodOptional<z.ZodNull>;
78
+ }, z.core.$strict>>;
79
+ description: z.ZodNullable<z.ZodString>;
80
+ billing_cycle_anchor: z.ZodEnum<{
81
+ automatic: "automatic";
82
+ phase_start: "phase_start";
83
+ }>;
84
+ invoice_settings: z.ZodObject<{
85
+ account_tax_ids: z.ZodNullable<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
86
+ id: z.ZodString;
87
+ object: z.ZodLiteral<"tax_id">;
88
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
89
+ livemode: z.ZodBoolean;
90
+ customer: z.ZodOptional<z.ZodNull>;
91
+ customer_account: z.ZodOptional<z.ZodNull>;
92
+ owner: z.ZodDiscriminatedUnion<[z.ZodObject<{
93
+ type: z.ZodLiteral<"self">;
94
+ customer_account: z.ZodNull;
95
+ account: z.ZodOptional<z.ZodNull>;
96
+ customer: z.ZodOptional<z.ZodNull>;
97
+ }, z.core.$strict>, z.ZodObject<{
98
+ type: z.ZodLiteral<"account">;
99
+ account: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
100
+ id: z.ZodString;
101
+ object: z.ZodLiteral<string>;
102
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
103
+ livemode: z.ZodOptional<z.ZodBoolean>;
104
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
105
+ id: z.ZodString;
106
+ object: z.ZodLiteral<"customer">;
107
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
108
+ livemode: z.ZodOptional<z.ZodBoolean>;
109
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
110
+ }, z.core.$loose>]>>>;
111
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
112
+ }, z.core.$loose>]>;
113
+ customer_account: z.ZodNull;
114
+ customer: z.ZodOptional<z.ZodNull>;
115
+ }, z.core.$strict>], "type">;
116
+ }, z.core.$loose>]>>>;
117
+ custom_fields: z.ZodNullable<z.ZodArray<z.ZodObject<{
118
+ name: z.ZodString;
119
+ value: z.ZodString;
120
+ }, z.core.$strict>>>;
121
+ days_until_due: z.ZodNullable<z.ZodNumber>;
122
+ description: z.ZodNullable<z.ZodString>;
123
+ footer: z.ZodNullable<z.ZodString>;
124
+ issuer: z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
125
+ type: z.ZodLiteral<"self">;
126
+ account: z.ZodOptional<z.ZodNull>;
127
+ }, z.core.$strict>, z.ZodObject<{
128
+ type: z.ZodLiteral<"account">;
129
+ account: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
130
+ id: z.ZodString;
131
+ object: z.ZodLiteral<string>;
132
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
133
+ livemode: z.ZodOptional<z.ZodBoolean>;
134
+ customer: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
135
+ id: z.ZodString;
136
+ object: z.ZodLiteral<"customer">;
137
+ deleted: z.ZodOptional<z.ZodLiteral<false>>;
138
+ livemode: z.ZodOptional<z.ZodBoolean>;
139
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
140
+ }, z.core.$loose>]>>>;
141
+ customer_account: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
+ }, z.core.$loose>]>;
143
+ }, z.core.$strict>], "type">>;
144
+ }, z.core.$strict>;
145
+ }, z.core.$strict>;
146
+ export type Defaults = z.infer<typeof defaultsSchema>;
147
+ export declare function contextFor(phase: Record<string, unknown>, defaults: Defaults, subscription: Record<string, unknown>, customerId: string, customerAccountId: string, livemode: boolean, originalSettings: ReturnType<typeof qualifyOriginalSettings>): {
148
+ customerAccountId: string;
149
+ customerId: string;
150
+ livemode: boolean;
151
+ effectiveCollectionMethod: "charge_automatically" | "send_invoice";
152
+ effectiveAutomaticTax: boolean;
153
+ effectiveInvoiceIssuer: {
154
+ type: "self";
155
+ account?: null | undefined;
156
+ } | {
157
+ type: "account";
158
+ account: string | {
159
+ [x: string]: unknown;
160
+ id: string;
161
+ object: string;
162
+ deleted?: false | undefined;
163
+ livemode?: boolean | undefined;
164
+ customer?: string | {
165
+ [x: string]: unknown;
166
+ id: string;
167
+ object: "customer";
168
+ deleted?: false | undefined;
169
+ livemode?: boolean | undefined;
170
+ customer_account?: string | null | undefined;
171
+ } | null | undefined;
172
+ customer_account?: string | null | undefined;
173
+ };
174
+ };
175
+ };
176
+ //# sourceMappingURL=phaseContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phaseContext.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalAggregate/phaseContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAUhB,CAAC;AACZ,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAWtD,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,UAAU,EAAE,MAAM,EAClB,iBAAiB,EAAE,MAAM,EACzB,QAAQ,EAAE,OAAO,EACjB,gBAAgB,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4G7D"}
@@ -0,0 +1,112 @@
1
+ import { z } from "zod";
2
+ import { settingsInput } from "../renewalProjection/settingsSchema.js";
3
+ import { projectRenewalPhaseSettings } from "../renewalProjection/settings.js";
4
+ import { object, equal, referenceId, unsupported } from "./shared.js";
5
+ export const defaultsSchema = settingsInput.shape.settings
6
+ .omit({
7
+ metadata: true,
8
+ default_tax_rates: true,
9
+ })
10
+ .extend({
11
+ billing_cycle_anchor: z.enum(["automatic", "phase_start"]),
12
+ invoice_settings: settingsInput.shape.settings.shape.invoice_settings.unwrap(),
13
+ })
14
+ .strict();
15
+ const issuerId = (value) => {
16
+ const issuer = object(value);
17
+ return issuer.type === "self"
18
+ ? "self"
19
+ : referenceId(issuer.account, "acct", "account");
20
+ };
21
+ const refOrNull = (value, prefix, kind) => value == null ? null : referenceId(value, prefix, kind);
22
+ export function contextFor(phase, defaults, subscription, customerId, customerAccountId, livemode, originalSettings) {
23
+ const phaseInvoice = phase.invoice_settings == null ? null : object(phase.invoice_settings);
24
+ const sourceInvoice = originalSettings.invoice;
25
+ const sourceTax = originalSettings.automaticTax;
26
+ const phaseTax = phase.automatic_tax === undefined ? undefined : object(phase.automatic_tax);
27
+ const effectiveCollectionMethod = phase.collection_method ??
28
+ defaults.collection_method ??
29
+ subscription.collection_method;
30
+ const effectiveAutomaticTax = phaseTax?.enabled ?? defaults.automatic_tax?.enabled ?? sourceTax.enabled;
31
+ const effectiveInvoiceIssuer = phaseInvoice?.issuer ??
32
+ defaults.invoice_settings.issuer ??
33
+ sourceInvoice.issuer;
34
+ const context = settingsInput.shape.context.parse({
35
+ customerId,
36
+ customerAccountId,
37
+ livemode,
38
+ effectiveCollectionMethod,
39
+ effectiveAutomaticTax,
40
+ effectiveInvoiceIssuer,
41
+ });
42
+ if (context.effectiveCollectionMethod !== subscription.collection_method ||
43
+ context.effectiveAutomaticTax !== sourceTax.enabled ||
44
+ issuerId(context.effectiveInvoiceIssuer) !== issuerId(sourceInvoice.issuer))
45
+ unsupported("effective_phase_context_mismatch");
46
+ const liability = phaseTax?.liability ?? defaults.automatic_tax?.liability ?? null;
47
+ const liabilityId = (value) => value == null ? null : issuerId(value);
48
+ if (liabilityId(liability) !== liabilityId(sourceTax.liability))
49
+ unsupported("unproven_tax_liability_retention");
50
+ const defaultProjection = projectRenewalPhaseSettings({
51
+ context,
52
+ settings: {
53
+ application_fee_percent: defaults.application_fee_percent,
54
+ billing_thresholds: defaults.billing_thresholds,
55
+ collection_method: defaults.collection_method,
56
+ default_payment_method: defaults.default_payment_method,
57
+ on_behalf_of: defaults.on_behalf_of,
58
+ transfer_data: defaults.transfer_data,
59
+ ...(defaults.automatic_tax === undefined
60
+ ? {}
61
+ : { automatic_tax: defaults.automatic_tax }),
62
+ default_tax_rates: null,
63
+ invoice_settings: defaults.invoice_settings,
64
+ description: defaults.description,
65
+ metadata: null,
66
+ },
67
+ });
68
+ if (defaultProjection.status !== "projected")
69
+ unsupported(`unsupported_defaults_${defaultProjection.reason}`);
70
+ for (const [field, prefix, kind] of [
71
+ ["default_payment_method", "pm", "payment_method"],
72
+ ["on_behalf_of", "acct", "account"],
73
+ ]) {
74
+ const effective = phase[field] ?? defaults[field];
75
+ if (refOrNull(effective, prefix, kind) !==
76
+ refOrNull(subscription[field], prefix, kind))
77
+ unsupported(`unproven_${field}_retention`);
78
+ }
79
+ const effectiveTransfer = phase.transfer_data ?? defaults.transfer_data;
80
+ const normalizeTransfer = (value) => {
81
+ if (value == null)
82
+ return null;
83
+ const transfer = object(value);
84
+ return {
85
+ destination: referenceId(transfer.destination, "acct", "account"),
86
+ amount_percent: transfer.amount_percent,
87
+ };
88
+ };
89
+ if (!equal(normalizeTransfer(effectiveTransfer), normalizeTransfer(subscription.transfer_data)))
90
+ unsupported("unproven_transfer_data_retention");
91
+ if ((phase.description ?? defaults.description) !== subscription.description)
92
+ unsupported("unproven_description_retention");
93
+ const due = phaseInvoice?.days_until_due ?? defaults.invoice_settings.days_until_due;
94
+ if (due !== subscription.days_until_due)
95
+ unsupported("unproven_invoice_due_retention");
96
+ for (const field of ["custom_fields", "description", "footer"]) {
97
+ const effective = phaseInvoice?.[field] ?? defaults.invoice_settings[field];
98
+ if (!equal(effective, sourceInvoice[field]))
99
+ unsupported(`unproven_invoice_${field}_retention`);
100
+ }
101
+ const effectiveTaxIds = phaseInvoice?.account_tax_ids ?? defaults.invoice_settings.account_tax_ids;
102
+ const taxIds = (value) => value == null
103
+ ? null
104
+ : z
105
+ .array(z.unknown())
106
+ .parse(value)
107
+ .map((tax) => referenceId(tax, "txi", "tax_id"));
108
+ if (!equal(taxIds(effectiveTaxIds), taxIds(sourceInvoice.account_tax_ids)))
109
+ unsupported("unproven_invoice_tax_id_retention");
110
+ return context;
111
+ }
112
+ //# sourceMappingURL=phaseContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phaseContext.js","sourceRoot":"","sources":["../../../../src/client/billing/renewalAggregate/phaseContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGtE,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC,KAAK,CAAC,QAAQ;KACvD,IAAI,CAAC;IACJ,QAAQ,EAAE,IAAI;IACd,iBAAiB,EAAE,IAAI;CACxB,CAAC;KACD,MAAM,CAAC;IACN,oBAAoB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC1D,gBAAgB,EACd,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,EAAE;CAC/D,CAAC;KACD,MAAM,EAAE,CAAC;AAGZ,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAE,EAAE;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,IAAI,KAAK,MAAM;QAC3B,CAA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blePhases(reads: ReturnType<typeof validateReads>, schedule: Record<string, unknown>): [
4
+ Stripe.SubscriptionScheduleUpdateParams.Phase,
5
+ Stripe.SubscriptionScheduleUpdateParams.Phase
6
+ ];
7
+ //# sourceMappingURL=phases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phases.d.ts","sourceRoot":"","sources":["../../../../src/client/billing/renewalAggregate/phases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAejC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAuEpD,wBAAgB,cAAc,CAC5B,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,EACvC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC;IACD,MAAM,CAAC,gCAAgC,CAAC,KAAK;IAC7C,MAAM,CAAC,gCAAgC,CAAC,KAAK;CAC9C,CA0JA"}