@fantastic.dev/better-stripe 0.73.0 → 0.75.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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
- package/dist/client/core/accountCloseOptions.d.ts +21 -0
- package/dist/client/core/accountCloseOptions.d.ts.map +1 -0
- package/dist/client/core/accountCloseOptions.js +15 -0
- package/dist/client/core/accountCloseOptions.js.map +1 -0
- package/dist/client/core/accountCloseScope.d.ts +9 -0
- package/dist/client/core/accountCloseScope.d.ts.map +1 -0
- package/dist/client/core/accountCloseScope.js +49 -0
- package/dist/client/core/accountCloseScope.js.map +1 -0
- package/dist/client/core/accountClosurePreview.d.ts +40 -0
- package/dist/client/core/accountClosurePreview.d.ts.map +1 -0
- package/dist/client/core/accountClosurePreview.js +98 -0
- package/dist/client/core/accountClosurePreview.js.map +1 -0
- package/dist/client/core/accounts.d.ts +3 -6
- package/dist/client/core/accounts.d.ts.map +1 -1
- package/dist/client/core/accounts.js +21 -5
- package/dist/client/core/accounts.js.map +1 -1
- package/dist/client/index.d.ts +8 -6
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/products/catalogClient.d.ts +2 -0
- package/dist/client/products/catalogClient.d.ts.map +1 -1
- package/dist/client/products/catalogClient.js.map +1 -1
- package/dist/client/products/products.d.ts +2 -0
- package/dist/client/products/products.d.ts.map +1 -1
- package/dist/client/products/products.js +3 -1
- package/dist/client/products/products.js.map +1 -1
- package/dist/client/publicTypes.d.ts +2 -0
- package/dist/client/publicTypes.d.ts.map +1 -1
- package/dist/client/usage/observationClient.d.ts +2 -2
- package/dist/client/usage/observationClient.d.ts.map +1 -1
- package/dist/component/_generated/api.d.ts +2 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +14 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/accountClosure/blockers.d.ts +6 -0
- package/dist/component/accountClosure/blockers.d.ts.map +1 -0
- package/dist/component/accountClosure/blockers.js +43 -0
- package/dist/component/accountClosure/blockers.js.map +1 -0
- package/dist/component/accountClosure/mutations.d.ts.map +1 -1
- package/dist/component/accountClosure/mutations.js +6 -31
- package/dist/component/accountClosure/mutations.js.map +1 -1
- package/dist/component/accountClosure/queries.d.ts +48 -0
- package/dist/component/accountClosure/queries.d.ts.map +1 -1
- package/dist/component/accountClosure/queries.js +32 -0
- package/dist/component/accountClosure/queries.js.map +1 -1
- package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
- package/docs/client-api.md +74 -0
- package/docs/react-workflows.md +31 -0
- package/package.json +1 -1
- package/src/client/core/account-close-guard.test.ts +349 -0
- package/src/client/core/account-closure-preview.test.ts +219 -0
- package/src/client/core/accountCloseOptions.ts +23 -0
- package/src/client/core/accountCloseScope.ts +87 -0
- package/src/client/core/accountClosurePreview.ts +149 -0
- package/src/client/core/accounts.ts +33 -7
- package/src/client/index.ts +14 -2
- package/src/client/products/catalogClient.ts +2 -0
- package/src/client/products/product-descriptor-inheritance.test.ts +245 -0
- package/src/client/products/products.ts +9 -4
- package/src/client/publicTypes.ts +6 -0
- package/src/component/_generated/api.ts +2 -0
- package/src/component/_generated/component.ts +16 -0
- package/src/component/accountClosure/blockers.test.ts +114 -0
- package/src/component/accountClosure/blockers.ts +60 -0
- package/src/component/accountClosure/mutations.ts +6 -39
- 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,MA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EAAE,CAAC;IACX,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,EAAE;SAC3B,KAAK,CAAC,wBAAwB,CAAC;SAC/B,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;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;;;;;;;;;;;;;;
|
|
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 {
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 (
|
|
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,
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/accountClosure/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,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,MAAM,QAAQ,GAAG,MA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@
|
|
|
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":"
|
|
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,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Object<{
|
|
|
60
60
|
}, "required", "accountId" | "definitionVersion" | "operationId" | "phase" | "providerApiVersion" | "providerKey" | "scopeKey" | "stripeSubscriptionId" | "version">;
|
|
61
61
|
export type FundingPhaseRef = Infer<typeof phaseRef>;
|
|
62
62
|
export declare const workflowStartResult: import("convex/values").VUnion<{
|
|
63
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
64
|
+
retryable: false;
|
|
65
|
+
status: "unknown";
|
|
66
|
+
} | {
|
|
67
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
68
|
+
retryable: false;
|
|
69
|
+
status: "conflict";
|
|
70
|
+
} | {
|
|
71
|
+
reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
|
|
72
|
+
retryable: false;
|
|
73
|
+
status: "rejected";
|
|
74
|
+
} | {
|
|
75
|
+
reason: "provider_pending";
|
|
76
|
+
retryable: true;
|
|
77
|
+
status: "not_ready";
|
|
78
|
+
} | {
|
|
63
79
|
operation: {
|
|
64
80
|
accountId: string;
|
|
65
81
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -76,22 +92,6 @@ export declare const workflowStartResult: import("convex/values").VUnion<{
|
|
|
76
92
|
version: number;
|
|
77
93
|
};
|
|
78
94
|
status: "canceled";
|
|
79
|
-
} | {
|
|
80
|
-
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
81
|
-
retryable: false;
|
|
82
|
-
status: "unknown";
|
|
83
|
-
} | {
|
|
84
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
85
|
-
retryable: false;
|
|
86
|
-
status: "conflict";
|
|
87
|
-
} | {
|
|
88
|
-
reason: "invalid_scope" | "policy_invalid" | "unsupported_source";
|
|
89
|
-
retryable: false;
|
|
90
|
-
status: "rejected";
|
|
91
|
-
} | {
|
|
92
|
-
reason: "provider_pending";
|
|
93
|
-
retryable: true;
|
|
94
|
-
status: "not_ready";
|
|
95
95
|
}, [import("convex/values").VObject<{
|
|
96
96
|
operation: {
|
|
97
97
|
accountId: string;
|
|
@@ -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
|
|
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
|
-
|
|
17
|
+
retryable?: undefined;
|
|
18
18
|
readonly status: "ready";
|
|
19
19
|
readonly bindFunding: boolean;
|
|
20
20
|
}>;
|
package/docs/client-api.md
CHANGED
|
@@ -37,6 +37,47 @@ retain original financial references. The Vite reference's
|
|
|
37
37
|
[closed-account authorization example](https://github.com/FantasticDevHQ/better-stripe/blob/main/example/README.md#closed-account-history)
|
|
38
38
|
shows where the host's authenticated-actor check belongs.
|
|
39
39
|
|
|
40
|
+
#### Closure observations and confirmed scope
|
|
41
|
+
|
|
42
|
+
`previewAccountClosure(ctx, { stripeAccountId, sessionLimit? })` is a bounded,
|
|
43
|
+
read-only action for an exact host-authorized account. It freshly reads provider
|
|
44
|
+
account configurations and closed state, the existing account balance reader,
|
|
45
|
+
one `status: "open"` Checkout page (default 25, maximum 100), and the indexed
|
|
46
|
+
component usage blockers shared with closure. It creates no closure intent and
|
|
47
|
+
makes no provider write. Do not pass an arbitrary browser account ID as authority.
|
|
48
|
+
|
|
49
|
+
Each observation is `{ status: "observed", value }` or `{ status: "unknown" }`.
|
|
50
|
+
Balances retain every returned currency's separate available and pending amounts.
|
|
51
|
+
Any nonzero amount, including negative amounts, produces `nonzero_balance`;
|
|
52
|
+
currencies and available/pending amounts are not netted. Open sessions produce
|
|
53
|
+
`open_checkout_sessions`. Usage corrections, open prepaid credits and managed
|
|
54
|
+
usage enrollment retain their component blocker names. A truncated session page
|
|
55
|
+
adds `open_sessions_truncated`; unavailable or malformed sources remain unknown.
|
|
56
|
+
The result always has `financialCoverage: "unknown"` and
|
|
57
|
+
`financial_coverage_unknown`. Zero balances and an empty complete page establish
|
|
58
|
+
only those observations, never settlement of all liabilities. There is no
|
|
59
|
+
`eligible` flag or host-provided completeness override.
|
|
60
|
+
|
|
61
|
+
After independent host authorization, financial clearance and explicit whole-account
|
|
62
|
+
confirmation, pass `expectedAppliedConfigurations` to `closeAccount` (or its alias).
|
|
63
|
+
The guarded path requires exact original stored scope/ownership and a fresh exact-ID
|
|
64
|
+
provider observation before an active-account close POST. Changed, missing,
|
|
65
|
+
duplicate or unsupported scope fails without a POST. It never rewrites the saved
|
|
66
|
+
original role set on retry. A legacy original with unknown scope stays held.
|
|
67
|
+
An observed same-account terminal `closed: true` can reconcile retained original
|
|
68
|
+
ownership/history without another POST, including after a lost response or a
|
|
69
|
+
pre-dispatch crash. This proves observed account state, not that our request caused
|
|
70
|
+
closure. A close acknowledgement must match the original ID and closed state.
|
|
71
|
+
|
|
72
|
+
This is a point-in-time scope guard. Provider changes between read and close are
|
|
73
|
+
not atomically fenced; financial writers and outstanding obligations require
|
|
74
|
+
separate host/component contracts. Omitting the option preserves the existing
|
|
75
|
+
unguarded behavior, including first-call cached configurations. Integrations
|
|
76
|
+
adopting this guard must pass it explicitly. The public
|
|
77
|
+
`closeAccountOptionsSchema` and `accountClosurePreviewOptionsSchema` validate
|
|
78
|
+
these SDK inputs; `CloseAccountOptions` and `AccountClosurePreview` expose the
|
|
79
|
+
matching types. Restarting onboarding remains closure, never reopening an account.
|
|
80
|
+
|
|
40
81
|
| Method | Description |
|
|
41
82
|
| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
42
83
|
| `createAccount(ctx, { userId, email?, name?, country?, orgId?, metadata? })` | Create a V2 account in Stripe and the component database |
|
|
@@ -111,6 +152,39 @@ await stripe.updateProduct(ctx, {
|
|
|
111
152
|
});
|
|
112
153
|
```
|
|
113
154
|
|
|
155
|
+
#### Omit inherited update descriptors
|
|
156
|
+
|
|
157
|
+
This additive option is not part of published 0.73.0. The update-only
|
|
158
|
+
`inheritStatementDescriptor?: boolean` defaults to the existing behavior.
|
|
159
|
+
With `false` and no explicit descriptor, the update omits
|
|
160
|
+
`statement_descriptor` without reading mutable Product or account defaults.
|
|
161
|
+
An explicit string still overrides with its validated value; explicit `null`
|
|
162
|
+
still clears the provider field. Null is not an omission workaround.
|
|
163
|
+
|
|
164
|
+
| Inheritance option | Explicit descriptor | Update behavior |
|
|
165
|
+
| ------------------ | ------------------- | --------------------------------------------------- |
|
|
166
|
+
| Omitted or `true` | Omitted | Existing store/platform fallback |
|
|
167
|
+
| `false` | Omitted | No descriptor field or ambient Product/account read |
|
|
168
|
+
| `false` | Valid string | Existing validated explicit value |
|
|
169
|
+
| `false` | `null` | Intentional empty-field clear |
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
await stripe.updateProduct(ctx, {
|
|
173
|
+
stripeProductId: originalProductId,
|
|
174
|
+
name: originalNormalizedName,
|
|
175
|
+
inheritStatementDescriptor: false,
|
|
176
|
+
idempotencyKey: originalOperationKey,
|
|
177
|
+
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The matching Vite update action validates and forwards the optional boolean;
|
|
181
|
+
create/deactivate operations and UI flows are unchanged. The host must retain
|
|
182
|
+
its authorized immutable command and stable key for an identical retry. This
|
|
183
|
+
option suppresses ambient inheritance; it adds no authorization, command
|
|
184
|
+
ledger, automatic retry, provider-cache or unknown-ACK guarantee. Tests use
|
|
185
|
+
controlled HTTP, not live provider verification. Public release, exact artifact
|
|
186
|
+
verification and accepted consumer adoption precede application consumption.
|
|
187
|
+
|
|
114
188
|
The matching Vite `example/convex/products/actions.ts` forwards the same optional
|
|
115
189
|
inputs. Its demo actions do not supply host authorization. A host must authorize
|
|
116
190
|
the operator, bind its community to the exact original product and reject shared
|
package/docs/react-workflows.md
CHANGED
|
@@ -8,6 +8,37 @@ Components render semantic HTML without package CSS. Use their render props or
|
|
|
8
8
|
companion hooks to supply your own design system. Stripe iframe contents use
|
|
9
9
|
Stripe's `appearance` options and retain Stripe's own styling.
|
|
10
10
|
|
|
11
|
+
## Whole-account closure confirmation
|
|
12
|
+
|
|
13
|
+
`AccountCloseCard` supplies a headless confirmation surface. Use its render prop
|
|
14
|
+
with your own styles and translated text, as in the Vite seller onboarding page.
|
|
15
|
+
Obtain `previewAccountClosure` through an authenticated host action for the exact
|
|
16
|
+
original account. Display the observed customer/merchant/recipient configurations,
|
|
17
|
+
known blockers and unknown sources. Re-read on account or session changes; do not
|
|
18
|
+
reuse another account's preview or infer eligibility from an exhausted page.
|
|
19
|
+
|
|
20
|
+
Keep the destructive control disabled until your server independently authorizes
|
|
21
|
+
the actor, original account and financial clearance, and the person explicitly
|
|
22
|
+
confirms the displayed whole-account scope. A preview's financial coverage remains
|
|
23
|
+
unknown even when all its known blockers are absent. The host close action must
|
|
24
|
+
recheck that authority and pass the confirmed original configuration set:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
await stripe.closeAccount(ctx, {
|
|
28
|
+
stripeAccountId: originalAccountId,
|
|
29
|
+
expectedAppliedConfigurations: confirmedConfigurations,
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Supply `titleLabel`, `descriptionLabel` and `closeLabel` to describe irreversible
|
|
34
|
+
whole-account closure rather than a recipient-only stop-withdrawals action.
|
|
35
|
+
The existing `restartAccountOnboarding` alias also closes; it cannot reopen the
|
|
36
|
+
account or authorize creating a replacement. A scope drift or unknown response
|
|
37
|
+
must retain the same account and original request for recovery. Freshly observing
|
|
38
|
+
that original account closed can reconcile history without another POST; it
|
|
39
|
+
does not attribute closure to our request. See the
|
|
40
|
+
[server contract](./client-api.md#closure-observations-and-confirmed-scope).
|
|
41
|
+
|
|
11
42
|
## Charge and Price currency units
|
|
12
43
|
|
|
13
44
|
`getChargeCurrencyMetadata`, `chargeAmountToDecimal`, `parseChargeAmount` and `formatChargeAmount` are
|
package/package.json
CHANGED