@fantastic.dev/better-stripe 0.74.0 → 0.76.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 (73) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/capturedCheckoutPayment.d.ts +31 -0
  4. package/dist/client/billing/capturedCheckoutPayment.d.ts.map +1 -0
  5. package/dist/client/billing/capturedCheckoutPayment.js +91 -0
  6. package/dist/client/billing/capturedCheckoutPayment.js.map +1 -0
  7. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +32 -32
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
  9. package/dist/client/core/accountCloseOptions.d.ts +21 -0
  10. package/dist/client/core/accountCloseOptions.d.ts.map +1 -0
  11. package/dist/client/core/accountCloseOptions.js +15 -0
  12. package/dist/client/core/accountCloseOptions.js.map +1 -0
  13. package/dist/client/core/accountCloseScope.d.ts +9 -0
  14. package/dist/client/core/accountCloseScope.d.ts.map +1 -0
  15. package/dist/client/core/accountCloseScope.js +49 -0
  16. package/dist/client/core/accountCloseScope.js.map +1 -0
  17. package/dist/client/core/accountClosurePreview.d.ts +40 -0
  18. package/dist/client/core/accountClosurePreview.d.ts.map +1 -0
  19. package/dist/client/core/accountClosurePreview.js +98 -0
  20. package/dist/client/core/accountClosurePreview.js.map +1 -0
  21. package/dist/client/core/accounts.d.ts +3 -6
  22. package/dist/client/core/accounts.d.ts.map +1 -1
  23. package/dist/client/core/accounts.js +21 -5
  24. package/dist/client/core/accounts.js.map +1 -1
  25. package/dist/client/index.d.ts +10 -6
  26. package/dist/client/index.d.ts.map +1 -1
  27. package/dist/client/index.js +8 -0
  28. package/dist/client/index.js.map +1 -1
  29. package/dist/client/publicTypes.d.ts +2 -0
  30. package/dist/client/publicTypes.d.ts.map +1 -1
  31. package/dist/component/_generated/api.d.ts +2 -0
  32. package/dist/component/_generated/api.d.ts.map +1 -1
  33. package/dist/component/_generated/api.js.map +1 -1
  34. package/dist/component/_generated/component.d.ts +14 -0
  35. package/dist/component/_generated/component.d.ts.map +1 -1
  36. package/dist/component/accountClosure/blockers.d.ts +6 -0
  37. package/dist/component/accountClosure/blockers.d.ts.map +1 -0
  38. package/dist/component/accountClosure/blockers.js +43 -0
  39. package/dist/component/accountClosure/blockers.js.map +1 -0
  40. package/dist/component/accountClosure/mutations.d.ts.map +1 -1
  41. package/dist/component/accountClosure/mutations.js +6 -31
  42. package/dist/component/accountClosure/mutations.js.map +1 -1
  43. package/dist/component/accountClosure/queries.d.ts +48 -0
  44. package/dist/component/accountClosure/queries.d.ts.map +1 -1
  45. package/dist/component/accountClosure/queries.js +32 -0
  46. package/dist/component/accountClosure/queries.js.map +1 -1
  47. package/dist/component/balanceFunding/mutations.d.ts +43 -43
  48. package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
  49. package/dist/component/payoutRelease/queries.d.ts +2 -2
  50. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  51. package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
  52. package/dist/component/usage/allowance.fixtures.d.ts +16 -16
  53. package/docs/README.md +1 -0
  54. package/docs/captured-checkout-payment.md +136 -0
  55. package/docs/client-api.md +41 -0
  56. package/docs/react-workflows.md +37 -3
  57. package/package.json +1 -1
  58. package/src/client/billing/captured-checkout-payment.test.ts +272 -0
  59. package/src/client/billing/capturedCheckoutPayment.ts +120 -0
  60. package/src/client/core/account-close-guard.test.ts +349 -0
  61. package/src/client/core/account-closure-preview.test.ts +219 -0
  62. package/src/client/core/accountCloseOptions.ts +23 -0
  63. package/src/client/core/accountCloseScope.ts +87 -0
  64. package/src/client/core/accountClosurePreview.ts +149 -0
  65. package/src/client/core/accounts.ts +33 -7
  66. package/src/client/index.ts +19 -2
  67. package/src/client/publicTypes.ts +6 -0
  68. package/src/component/_generated/api.ts +2 -0
  69. package/src/component/_generated/component.ts +16 -0
  70. package/src/component/accountClosure/blockers.test.ts +114 -0
  71. package/src/component/accountClosure/blockers.ts +60 -0
  72. package/src/component/accountClosure/mutations.ts +6 -39
  73. package/src/component/accountClosure/queries.ts +41 -1
@@ -0,0 +1,6 @@
1
+ import type { MutationCtx, QueryCtx } from "../_generated/server.js";
2
+ export declare const closureBlocker: import("convex/values").VUnion<"prepaidCredits" | "usageCorrections" | "usageEnrollment", [import("convex/values").VLiteral<"usageCorrections", "required">, import("convex/values").VLiteral<"prepaidCredits", "required">, import("convex/values").VLiteral<"usageEnrollment", "required">], "required", never>;
3
+ export type ClosureBlocker = "usageCorrections" | "prepaidCredits" | "usageEnrollment";
4
+ /** Known indexed component blockers only; absence is not whole-account clearance. */
5
+ export declare function readClosureBlockers(ctx: QueryCtx | MutationCtx, stripeAccountId: string): Promise<ClosureBlocker[]>;
6
+ //# sourceMappingURL=blockers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockers.d.ts","sourceRoot":"","sources":["../../../src/component/accountClosure/blockers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAGrE,eAAO,MAAM,cAAc,mTAI1B,CAAC;AACF,MAAM,MAAM,cAAc,GACxB,kBAAkB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAE5D,qFAAqF;AACrF,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,QAAQ,GAAG,WAAW,EAC3B,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,cAAc,EAAE,CAAC,CA2C3B"}
@@ -0,0 +1,43 @@
1
+ import { v } from "convex/values";
2
+ import { unresolvedCorrectionStates } from "../usageCorrections/cancellation.js";
3
+ export const closureBlocker = v.union(v.literal("usageCorrections"), v.literal("prepaidCredits"), v.literal("usageEnrollment"));
4
+ /** Known indexed component blockers only; absence is not whole-account clearance. */
5
+ export async function readClosureBlockers(ctx, stripeAccountId) {
6
+ const result = [];
7
+ for (const state of unresolvedCorrectionStates) {
8
+ const payer = await ctx.db
9
+ .query("usageCorrections")
10
+ .withIndex("by_payer_state", (q) => q.eq("customerAccount", stripeAccountId).eq("state", state))
11
+ .first();
12
+ const realm = await ctx.db
13
+ .query("usageCorrections")
14
+ .withIndex("by_realm_state", (q) => q.eq("stripeAccountId", stripeAccountId).eq("state", state))
15
+ .first();
16
+ if (payer || realm) {
17
+ result.push("usageCorrections");
18
+ break;
19
+ }
20
+ }
21
+ const payerLock = await ctx.db
22
+ .query("usageSubscriptionLocks")
23
+ .withIndex("by_payer", (q) => q.eq("customerAccount", stripeAccountId))
24
+ .first();
25
+ const realmLock = await ctx.db
26
+ .query("usageSubscriptionLocks")
27
+ .withIndex("by_realm", (q) => q.eq("stripeAccountId", stripeAccountId))
28
+ .first();
29
+ const payerCredits = await ctx.db
30
+ .query("usageCreditAccounts")
31
+ .withIndex("by_payer_closed", (q) => q.eq("customerAccount", stripeAccountId).eq("closed", false))
32
+ .first();
33
+ const realmCredits = await ctx.db
34
+ .query("usageCreditAccounts")
35
+ .withIndex("by_realm_closed", (q) => q.eq("stripeAccountId", stripeAccountId).eq("closed", false))
36
+ .first();
37
+ if (payerCredits || realmCredits)
38
+ result.push("prepaidCredits");
39
+ if (payerLock || realmLock)
40
+ result.push("usageEnrollment");
41
+ return result;
42
+ }
43
+ //# sourceMappingURL=blockers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blockers.js","sourceRoot":"","sources":["../../../src/component/accountClosure/blockers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CACnC,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAC7B,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAC3B,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAC7B,CAAC;AAIF,qFAAqF;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;SACtE,KAAK,EAAE,CAAC;IACX,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,EAAE;SAC9B,KAAK,CAAC,qBAAqB,CAAC;SAC5B,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAClC,CAAC,CAAC,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAC7D;SACA,KAAK,EAAE,CAAC;IACX,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,EAAE;SAC9B,KAAK,CAAC,qBAAqB,CAAC;SAC5B,SAAS,CAAC,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAClC,CAAC,CAAC,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAC7D;SACA,KAAK,EAAE,CAAC;IACX,IAAI,YAAY,IAAI,YAAY;QAAE,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChE,IAAI,SAAS,IAAI,SAAS;QAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC3D,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/accountClosure/mutations.ts"],"names":[],"mappings":"AAKA,yFAAyF;AACzF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;GAiElB,CAAC;AAEH,eAAO,MAAM,QAAQ;;iBAyBnB,CAAC"}
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/accountClosure/mutations.ts"],"names":[],"mappings":"AAKA,yFAAyF;AACzF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;GAgClB,CAAC;AAEH,eAAO,MAAM,QAAQ;;iBAyBnB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { unresolvedCorrectionStates } from "../usageCorrections/cancellation.js";
1
+ import { readClosureBlockers } from "./blockers.js";
2
2
  import { v } from "convex/values";
3
3
  import { mutation } from "../_generated/server.js";
4
4
  import { closureByStripeId } from "./helpers.js";
@@ -8,37 +8,12 @@ export const prepare = mutation({
8
8
  args: { stripeAccountId: v.string() },
9
9
  returns: v.object({ closure: closureDoc, isRetry: v.boolean() }),
10
10
  handler: async (ctx, { stripeAccountId }) => {
11
- for (const state of unresolvedCorrectionStates) {
12
- const payerCorrection = await ctx.db
13
- .query("usageCorrections")
14
- .withIndex("by_payer_state", (q) => q.eq("customerAccount", stripeAccountId).eq("state", state))
15
- .first();
16
- const realmCorrection = await ctx.db
17
- .query("usageCorrections")
18
- .withIndex("by_realm_state", (q) => q.eq("stripeAccountId", stripeAccountId).eq("state", state))
19
- .first();
20
- if (payerCorrection || realmCorrection)
21
- throw new Error("Resolve usage corrections before account closure");
22
- }
23
- const payerLock = await ctx.db
24
- .query("usageSubscriptionLocks")
25
- .withIndex("by_payer", (q) => q.eq("customerAccount", stripeAccountId))
26
- .first();
27
- const realmLock = await ctx.db
28
- .query("usageSubscriptionLocks")
29
- .withIndex("by_realm", (q) => q.eq("stripeAccountId", stripeAccountId))
30
- .first();
31
- const payerCredits = await ctx.db
32
- .query("usageCreditAccounts")
33
- .withIndex("by_payer_closed", (q) => q.eq("customerAccount", stripeAccountId).eq("closed", false))
34
- .first();
35
- const realmCredits = await ctx.db
36
- .query("usageCreditAccounts")
37
- .withIndex("by_realm_closed", (q) => q.eq("stripeAccountId", stripeAccountId).eq("closed", false))
38
- .first();
39
- if (payerCredits || realmCredits)
11
+ const blockers = await readClosureBlockers(ctx, stripeAccountId);
12
+ if (blockers.includes("usageCorrections"))
13
+ throw new Error("Resolve usage corrections before account closure");
14
+ if (blockers.includes("prepaidCredits"))
40
15
  throw new Error("Close out prepaid credits before account closure");
41
- if (payerLock || realmLock)
16
+ if (blockers.includes("usageEnrollment"))
42
17
  throw new Error("Close out managed usage enrollment before account closure");
43
18
  const existing = await closureByStripeId(ctx, stripeAccountId);
44
19
  if (existing)
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/accountClosure/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,yFAAyF;AACzF,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;IAC9B,IAAI,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;IAChE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;QAC1C,KAAK,MAAM,KAAK,IAAI,0BAA0B,EAAE,CAAC;YAC/C,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,EAAE;iBACjC,KAAK,CAAC,kBAAkB,CAAC;iBACzB,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CACjC,CAAC,CAAC,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAC5D;iBACA,KAAK,EAAE,CAAC;YACX,MAAM,eAAe,GAAG,MAAM,GAAG,CAAC,EAAE;iBACjC,KAAK,CAAC,kBAAkB,CAAC;iBACzB,SAAS,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,CACjC,CAAC,CAAC,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,OAAO,EAA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AAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,EAAE;YACjD,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE;SACrB,CAAC,CAAC;QACH,IAAI,OAAO;YAAE,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
@@ -1,3 +1,50 @@
1
+ import { type Infer } from "convex/values";
2
+ declare const currentOwnerResult: import("convex/values").VUnion<{
3
+ status: "missing";
4
+ } | {
5
+ status: "ambiguous";
6
+ } | {
7
+ orgId?: string | undefined;
8
+ status: "unique";
9
+ userId: string;
10
+ }, [import("convex/values").VObject<{
11
+ status: "missing";
12
+ }, {
13
+ status: import("convex/values").VLiteral<"missing", "required">;
14
+ }, "required", "status">, import("convex/values").VObject<{
15
+ status: "ambiguous";
16
+ }, {
17
+ status: import("convex/values").VLiteral<"ambiguous", "required">;
18
+ }, "required", "status">, import("convex/values").VObject<{
19
+ orgId?: string | undefined;
20
+ status: "unique";
21
+ userId: string;
22
+ }, {
23
+ status: import("convex/values").VLiteral<"unique", "required">;
24
+ userId: import("convex/values").VString<string, "required">;
25
+ orgId: import("convex/values").VString<string | undefined, "optional">;
26
+ }, "required", "orgId" | "status" | "userId">], "required", "orgId" | "status" | "userId">;
27
+ export type CurrentClosureOwner = Infer<typeof currentOwnerResult>;
28
+ /** Missing live mapping and contradictory/duplicate ownership are distinct observations. */
29
+ export declare const currentOwner: import("convex/server").RegisteredQuery<"public", {
30
+ stripeAccountId: string;
31
+ }, Promise<{
32
+ status: "missing";
33
+ userId?: undefined;
34
+ orgId?: undefined;
35
+ } | {
36
+ status: "ambiguous";
37
+ userId?: undefined;
38
+ orgId?: undefined;
39
+ } | {
40
+ status: "unique";
41
+ userId: string;
42
+ orgId: string | undefined;
43
+ }>>;
44
+ /** Trusted host read; no mutation, authorization or positive clearance. */
45
+ export declare const knownBlockers: import("convex/server").RegisteredQuery<"public", {
46
+ stripeAccountId: string;
47
+ }, Promise<import("./blockers.js").ClosureBlocker[]>>;
1
48
  /** This is provenance, not end-user authentication; hosts must compare the authenticated owner. */
2
49
  export declare const getClosedAccountByStripeId: import("convex/server").RegisteredQuery<"public", {
3
50
  stripeAccountId: string;
@@ -31,4 +78,5 @@ export declare const listClosedAccountsByUserId: import("convex/server").Registe
31
78
  stripeAccountId: string;
32
79
  userId?: string | undefined;
33
80
  }>>>;
81
+ export {};
34
82
  //# sourceMappingURL=queries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/accountClosure/queries.ts"],"names":[],"mappings":"AAUA,mGAAmG;AACnG,eAAO,MAAM,0BAA0B;;;;;;;;;;;UAOrC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;IAsBrC,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/accountClosure/queries.ts"],"names":[],"mappings":"AAKA,OAAO,EAAK,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAO9C,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;0FAQvB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEnE,4FAA4F;AAC5F,eAAO,MAAM,YAAY;;;YAUc,SAAS;;;;YACJ,WAAW;;;;YAEzC,QAAQ;;;GAKpB,CAAC;AAEH,2EAA2E;AAC3E,eAAO,MAAM,aAAa;;qDAIxB,CAAC;AACH,mGAAmG;AACnG,eAAO,MAAM,0BAA0B;;;;;;;;;;;UAOrC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;IAsBrC,CAAC"}
@@ -5,6 +5,38 @@ import { query } from "../_generated/server.js";
5
5
  import schema from "../schema.js";
6
6
  import { closureByStripeId } from "./helpers.js";
7
7
  import { closureDoc } from "./schema.js";
8
+ import { closureBlocker, readClosureBlockers } from "./blockers.js";
9
+ const currentOwnerResult = v.union(v.object({ status: v.literal("missing") }), v.object({ status: v.literal("ambiguous") }), v.object({
10
+ status: v.literal("unique"),
11
+ userId: v.string(),
12
+ orgId: v.optional(v.string()),
13
+ }));
14
+ /** Missing live mapping and contradictory/duplicate ownership are distinct observations. */
15
+ export const currentOwner = query({
16
+ args: { stripeAccountId: v.string() },
17
+ returns: currentOwnerResult,
18
+ handler: async (ctx, args) => {
19
+ const rows = await ctx.db
20
+ .query("accounts")
21
+ .withIndex("by_stripe_account_id", (q) => q.eq("stripeAccountId", args.stripeAccountId))
22
+ .take(2);
23
+ if (!rows.length)
24
+ return { status: "missing" };
25
+ if (rows.length !== 1)
26
+ return { status: "ambiguous" };
27
+ return {
28
+ status: "unique",
29
+ userId: rows[0].userId,
30
+ orgId: rows[0].orgId,
31
+ };
32
+ },
33
+ });
34
+ /** Trusted host read; no mutation, authorization or positive clearance. */
35
+ export const knownBlockers = query({
36
+ args: { stripeAccountId: v.string() },
37
+ returns: v.array(closureBlocker),
38
+ handler: (ctx, args) => readClosureBlockers(ctx, args.stripeAccountId),
39
+ });
8
40
  /** This is provenance, not end-user authentication; hosts must compare the authenticated owner. */
9
41
  export const getClosedAccountByStripeId = query({
10
42
  args: { stripeAccountId: v.string() },
@@ -1 +1 @@
1
- {"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/accountClosure/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,MAAM,MAAM,cAAc,CAA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cAAc;YACjB,eAAe,EAAE,GAAG;YACpB,gBAAgB,EAAE,SAAS;SAC5B,CAAC,CAAC;IACP,CAAC;CACF,CAAC,CAAC"}
@@ -22,6 +22,14 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
22
22
  requestKey: string;
23
23
  scopeKey: string;
24
24
  }, Promise<{
25
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
26
+ retryable: false;
27
+ status: "conflict";
28
+ } | {
29
+ reason: "policy_invalid";
30
+ retryable: false;
31
+ status: "rejected";
32
+ } | {
25
33
  operation: {
26
34
  accountId: string;
27
35
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -32,14 +40,6 @@ export declare const begin: import("convex/server").RegisteredMutation<"public",
32
40
  } | {
33
41
  enabled: boolean;
34
42
  status: "unchanged";
35
- } | {
36
- reason: "identity_changed" | "revision_changed" | "scope_busy";
37
- retryable: false;
38
- status: "conflict";
39
- } | {
40
- reason: "policy_invalid";
41
- retryable: false;
42
- status: "rejected";
43
43
  } | {
44
44
  reason: "provider_pending";
45
45
  retryable: true;
@@ -395,6 +395,14 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
395
395
  requestKey: string;
396
396
  scopeKey: string;
397
397
  }, Promise<{
398
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
399
+ retryable: false;
400
+ status: "conflict";
401
+ } | {
402
+ reason: "policy_invalid";
403
+ retryable: false;
404
+ status: "rejected";
405
+ } | {
398
406
  operation: {
399
407
  accountId: string;
400
408
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -405,14 +413,6 @@ export declare const prepare: import("convex/server").RegisteredMutation<"public
405
413
  } | {
406
414
  enabled: boolean;
407
415
  status: "unchanged";
408
- } | {
409
- reason: "identity_changed" | "revision_changed" | "scope_busy";
410
- retryable: false;
411
- status: "conflict";
412
- } | {
413
- reason: "policy_invalid";
414
- retryable: false;
415
- status: "rejected";
416
416
  } | {
417
417
  reason: "provider_pending";
418
418
  retryable: true;
@@ -595,22 +595,6 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
595
595
  } & {
596
596
  providerAction: string;
597
597
  }, Promise<{
598
- reason: "history_incomplete" | "provider_outcome_unknown";
599
- retryable: false;
600
- status: "unknown";
601
- } | {
602
- reason: "identity_changed" | "revision_changed" | "scope_busy";
603
- retryable: false;
604
- status: "conflict";
605
- } | {
606
- reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
607
- retryable: false;
608
- status: "rejected";
609
- } | {
610
- reason: "provider_pending";
611
- retryable: true;
612
- status: "not_ready";
613
- } | {
614
598
  operation: {
615
599
  accountId: string;
616
600
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -627,16 +611,7 @@ export declare const startWorkflow: import("convex/server").RegisteredMutation<"
627
611
  version: number;
628
612
  };
629
613
  status: "canceled";
630
- }>>;
631
- export declare const resumeWorkflow: import("convex/server").RegisteredMutation<"public", {
632
- accountId: string;
633
- definitionVersion: string;
634
- operationId: import("convex/values").GenericId<"balanceFundingOperations">;
635
- providerApiVersion: string;
636
- scopeKey: string;
637
- stripeSubscriptionId: string;
638
- version: number;
639
- }, Promise<{
614
+ } | {
640
615
  reason: "history_incomplete" | "provider_outcome_unknown";
641
616
  retryable: false;
642
617
  status: "unknown";
@@ -652,7 +627,16 @@ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<
652
627
  reason: "provider_pending";
653
628
  retryable: true;
654
629
  status: "not_ready";
655
- } | {
630
+ }>>;
631
+ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<"public", {
632
+ accountId: string;
633
+ definitionVersion: string;
634
+ operationId: import("convex/values").GenericId<"balanceFundingOperations">;
635
+ providerApiVersion: string;
636
+ scopeKey: string;
637
+ stripeSubscriptionId: string;
638
+ version: number;
639
+ }, Promise<{
656
640
  operation: {
657
641
  accountId: string;
658
642
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -669,6 +653,22 @@ export declare const resumeWorkflow: import("convex/server").RegisteredMutation<
669
653
  version: number;
670
654
  };
671
655
  status: "canceled";
656
+ } | {
657
+ reason: "history_incomplete" | "provider_outcome_unknown";
658
+ retryable: false;
659
+ status: "unknown";
660
+ } | {
661
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
662
+ retryable: false;
663
+ status: "conflict";
664
+ } | {
665
+ reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
666
+ retryable: false;
667
+ status: "rejected";
668
+ } | {
669
+ reason: "provider_pending";
670
+ retryable: true;
671
+ status: "not_ready";
672
672
  }>>;
673
673
  export declare const cancelWorkflow: import("convex/server").RegisteredMutation<"public", {
674
674
  accountId: string;
@@ -2,6 +2,14 @@ import type { Infer } from "convex/values";
2
2
  import type { MutationCtx } from "../_generated/server.js";
3
3
  import { prepareArgs, finishPreparationArgs } from "./mutationValidators.js";
4
4
  export declare function prepareHandler(ctx: MutationCtx, args: Infer<typeof prepareArgs>): Promise<{
5
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
6
+ retryable: false;
7
+ status: "conflict";
8
+ } | {
9
+ reason: "policy_invalid";
10
+ retryable: false;
11
+ status: "rejected";
12
+ } | {
5
13
  operation: {
6
14
  accountId: string;
7
15
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -12,14 +20,6 @@ export declare function prepareHandler(ctx: MutationCtx, args: Infer<typeof prep
12
20
  } | {
13
21
  enabled: boolean;
14
22
  status: "unchanged";
15
- } | {
16
- reason: "identity_changed" | "revision_changed" | "scope_busy";
17
- retryable: false;
18
- status: "conflict";
19
- } | {
20
- reason: "policy_invalid";
21
- retryable: false;
22
- status: "rejected";
23
23
  } | {
24
24
  reason: "provider_pending";
25
25
  retryable: true;
@@ -163,10 +163,10 @@ export declare const snapshot: import("convex/server").RegisteredQuery<"public",
163
163
  accountId: string;
164
164
  ownerKey: string;
165
165
  }, Promise<{
166
- status: "held";
167
- reason: "snapshot_limit";
168
166
  transfers?: undefined;
169
167
  claims?: undefined;
168
+ status: "held";
169
+ reason: "snapshot_limit";
170
170
  } | {
171
171
  reason?: undefined;
172
172
  status: "ready";
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutRelease/queries.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIlB,CAAC;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAiBd,CAAC;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BlB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;GAQf,CAAC;AAEH,4FAA4F;AAC5F,eAAO,MAAM,QAAQ;;;;;;YAsBE,MAAM;YAAmB,gBAAgB;;;YAS3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAC"}
@@ -14,7 +14,7 @@ export declare function checkRollback(ctx: MutationCtx, op: Doc<"processingCostR
14
14
  readonly bindFunding?: undefined;
15
15
  } | {
16
16
  reason?: undefined;
17
- readonly retryable?: undefined;
17
+ retryable?: undefined;
18
18
  readonly status: "ready";
19
19
  readonly bindFunding: boolean;
20
20
  }>;
@@ -2351,14 +2351,6 @@ export declare function setupAllowance(): Promise<{
2351
2351
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
2352
2352
  requestKey: string;
2353
2353
  result?: {
2354
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2355
- retryable: false;
2356
- status: "conflict";
2357
- } | {
2358
- reason: "policy_invalid";
2359
- retryable: false;
2360
- status: "rejected";
2361
- } | {
2362
2354
  operation: {
2363
2355
  accountId: string;
2364
2356
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2369,6 +2361,14 @@ export declare function setupAllowance(): Promise<{
2369
2361
  } | {
2370
2362
  enabled: boolean;
2371
2363
  status: "unchanged";
2364
+ } | {
2365
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2366
+ retryable: false;
2367
+ status: "conflict";
2368
+ } | {
2369
+ reason: "policy_invalid";
2370
+ retryable: false;
2371
+ status: "rejected";
2372
2372
  } | {
2373
2373
  reason: "provider_pending";
2374
2374
  retryable: true;
@@ -2379,14 +2379,6 @@ export declare function setupAllowance(): Promise<{
2379
2379
  payload: import("convex/values").VString<string, "required">;
2380
2380
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
2381
2381
  result: import("convex/values").VUnion<{
2382
- reason: "identity_changed" | "revision_changed" | "scope_busy";
2383
- retryable: false;
2384
- status: "conflict";
2385
- } | {
2386
- reason: "policy_invalid";
2387
- retryable: false;
2388
- status: "rejected";
2389
- } | {
2390
2382
  operation: {
2391
2383
  accountId: string;
2392
2384
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -2397,6 +2389,14 @@ export declare function setupAllowance(): Promise<{
2397
2389
  } | {
2398
2390
  enabled: boolean;
2399
2391
  status: "unchanged";
2392
+ } | {
2393
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
2394
+ retryable: false;
2395
+ status: "conflict";
2396
+ } | {
2397
+ reason: "policy_invalid";
2398
+ retryable: false;
2399
+ status: "rejected";
2400
2400
  } | {
2401
2401
  reason: "provider_pending";
2402
2402
  retryable: true;
package/docs/README.md CHANGED
@@ -20,6 +20,7 @@ guide for your integration.
20
20
  - [Billing history](billing-history.md).
21
21
  - [Invoice payment pages](invoice-payment-pages.md).
22
22
  - [Checkout session pages](checkout-session-pages.md).
23
+ - [Captured Checkout payment observations](captured-checkout-payment.md), expanded provider evidence without fee or access authority.
23
24
  - [Subscription payment methods](subscription-payment-methods.md).
24
25
  - [SetupIntent recovery](setup-intent-recovery.md).
25
26
  - [Balance funding state](balance-funding-state.md) and [workflow](balance-funding-workflow.md).