@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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/client/billing/capturedCheckoutPayment.d.ts +31 -0
- package/dist/client/billing/capturedCheckoutPayment.d.ts.map +1 -0
- package/dist/client/billing/capturedCheckoutPayment.js +91 -0
- package/dist/client/billing/capturedCheckoutPayment.js.map +1 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +32 -32
- 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 +10 -6
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +8 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/publicTypes.d.ts +2 -0
- package/dist/client/publicTypes.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/mutations.d.ts +43 -43
- package/dist/component/balanceFunding/preparationHandlers.d.ts +8 -8
- 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/dist/component/usage/allowance.fixtures.d.ts +16 -16
- package/docs/README.md +1 -0
- package/docs/captured-checkout-payment.md +136 -0
- package/docs/client-api.md +41 -0
- package/docs/react-workflows.md +37 -3
- package/package.json +1 -1
- package/src/client/billing/captured-checkout-payment.test.ts +272 -0
- package/src/client/billing/capturedCheckoutPayment.ts +120 -0
- 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 +19 -2
- 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
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.76.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.75.0...v0.76.0) (2026-10-24)
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
- **checkout:** expose fee-independent captured payment observations ([#384](https://github.com/FantasticDevHQ/better-stripe/issues/384)) ([bae2e74](https://github.com/FantasticDevHQ/better-stripe/commit/bae2e7412f3ec8f2a70ba0ceb1cb26b952bae7e1))
|
|
34
|
+
|
|
35
|
+
## [0.75.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.74.0...v0.75.0) (2026-10-23)
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
- preview account closure blockers and guard confirmed scope ([#382](https://github.com/FantasticDevHQ/better-stripe/issues/382)) ([4289300](https://github.com/FantasticDevHQ/better-stripe/commit/428930012022a51734570e8849eff0bb53aa8d6a))
|
|
40
|
+
|
|
29
41
|
## [0.74.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.73.0...v0.74.0) (2026-10-21)
|
|
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.
|
|
8
|
+
**Version**: `0.76.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,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const expectedSchema: z.ZodObject<{
|
|
3
|
+
stripeSessionId: z.ZodString;
|
|
4
|
+
customerAccountId: z.ZodString;
|
|
5
|
+
livemode: z.ZodBoolean;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
/** Server-owned original selectors, not browser authorization or signed-event proof. */
|
|
8
|
+
export type CapturedCheckoutPaymentExpected = z.infer<typeof expectedSchema>;
|
|
9
|
+
export type CapturedCheckoutPaymentObservation = {
|
|
10
|
+
status: "ready";
|
|
11
|
+
stripeSessionId: string;
|
|
12
|
+
stripePaymentIntentId: string;
|
|
13
|
+
stripeChargeId: string;
|
|
14
|
+
customerAccountId: string;
|
|
15
|
+
livemode: boolean;
|
|
16
|
+
/** Integer original provider minor units, never converted to major-unit decimals. */
|
|
17
|
+
amount: number;
|
|
18
|
+
currency: string;
|
|
19
|
+
sessionMetadata: Record<string, string>;
|
|
20
|
+
paymentIntentMetadata: Record<string, string>;
|
|
21
|
+
} | {
|
|
22
|
+
status: "unavailable";
|
|
23
|
+
reason: "invalid_context" | "invalid_evidence" | "identity_mismatch";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Qualify an already retrieved Session with payment_intent.latest_charge expanded.
|
|
27
|
+
* No I/O or writes. Captured history is not fulfillment, refund or settlement authority.
|
|
28
|
+
*/
|
|
29
|
+
export declare function qualifyCapturedCheckoutPayment(session: unknown, expected: CapturedCheckoutPaymentExpected): CapturedCheckoutPaymentObservation;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=capturedCheckoutPayment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capturedCheckoutPayment.d.ts","sourceRoot":"","sources":["../../../src/client/billing/capturedCheckoutPayment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,QAAA,MAAM,cAAc;;;;iBAIlB,CAAC;AAsCH,wFAAwF;AACxF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7E,MAAM,MAAM,kCAAkC,GAC1C;IACE,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,qFAAqF;IACrF,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C,GACD;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;CACtE,CAAC;AAEN;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,+BAA+B,GACxC,kCAAkC,CAsCpC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const id = (prefix) => z
|
|
3
|
+
.string()
|
|
4
|
+
.max(255)
|
|
5
|
+
.regex(new RegExp(`^${prefix}_[A-Za-z0-9_]+$`));
|
|
6
|
+
const amount = z.number().int().positive().max(Number.MAX_SAFE_INTEGER);
|
|
7
|
+
const currency = z.string().regex(/^[a-z]{3}$/);
|
|
8
|
+
const metadata = z.record(z.string(), z.string());
|
|
9
|
+
const expectedSchema = z.object({
|
|
10
|
+
stripeSessionId: id("cs"),
|
|
11
|
+
customerAccountId: id("acct"),
|
|
12
|
+
livemode: z.boolean(),
|
|
13
|
+
});
|
|
14
|
+
const evidenceSchema = z.object({
|
|
15
|
+
id: id("cs"),
|
|
16
|
+
object: z.literal("checkout.session"),
|
|
17
|
+
mode: z.literal("payment"),
|
|
18
|
+
subscription: z.null(),
|
|
19
|
+
status: z.literal("complete"),
|
|
20
|
+
payment_status: z.literal("paid"),
|
|
21
|
+
customer_account: id("acct"),
|
|
22
|
+
livemode: z.boolean(),
|
|
23
|
+
amount_total: amount,
|
|
24
|
+
currency,
|
|
25
|
+
metadata,
|
|
26
|
+
payment_intent: z.object({
|
|
27
|
+
id: id("pi"),
|
|
28
|
+
object: z.literal("payment_intent"),
|
|
29
|
+
status: z.literal("succeeded"),
|
|
30
|
+
customer_account: id("acct"),
|
|
31
|
+
livemode: z.boolean(),
|
|
32
|
+
amount,
|
|
33
|
+
amount_received: amount,
|
|
34
|
+
currency,
|
|
35
|
+
metadata,
|
|
36
|
+
latest_charge: z.object({
|
|
37
|
+
id: id("ch"),
|
|
38
|
+
object: z.literal("charge"),
|
|
39
|
+
payment_intent: id("pi"),
|
|
40
|
+
status: z.literal("succeeded"),
|
|
41
|
+
paid: z.literal(true),
|
|
42
|
+
captured: z.literal(true),
|
|
43
|
+
livemode: z.boolean(),
|
|
44
|
+
amount,
|
|
45
|
+
amount_captured: amount,
|
|
46
|
+
currency,
|
|
47
|
+
}),
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Qualify an already retrieved Session with payment_intent.latest_charge expanded.
|
|
52
|
+
* No I/O or writes. Captured history is not fulfillment, refund or settlement authority.
|
|
53
|
+
*/
|
|
54
|
+
export function qualifyCapturedCheckoutPayment(session, expected) {
|
|
55
|
+
const scope = expectedSchema.safeParse(expected);
|
|
56
|
+
if (!scope.success)
|
|
57
|
+
return { status: "unavailable", reason: "invalid_context" };
|
|
58
|
+
const parsed = evidenceSchema.safeParse(session);
|
|
59
|
+
if (!parsed.success)
|
|
60
|
+
return { status: "unavailable", reason: "invalid_evidence" };
|
|
61
|
+
const paid = parsed.data;
|
|
62
|
+
const pi = paid.payment_intent;
|
|
63
|
+
const charge = pi.latest_charge;
|
|
64
|
+
if (paid.id !== scope.data.stripeSessionId ||
|
|
65
|
+
paid.customer_account !== scope.data.customerAccountId ||
|
|
66
|
+
pi.customer_account !== scope.data.customerAccountId ||
|
|
67
|
+
paid.livemode !== scope.data.livemode ||
|
|
68
|
+
pi.livemode !== scope.data.livemode ||
|
|
69
|
+
charge.livemode !== scope.data.livemode ||
|
|
70
|
+
charge.payment_intent !== pi.id ||
|
|
71
|
+
pi.amount !== paid.amount_total ||
|
|
72
|
+
pi.amount_received !== paid.amount_total ||
|
|
73
|
+
charge.amount !== paid.amount_total ||
|
|
74
|
+
charge.amount_captured !== paid.amount_total ||
|
|
75
|
+
pi.currency !== paid.currency ||
|
|
76
|
+
charge.currency !== paid.currency)
|
|
77
|
+
return { status: "unavailable", reason: "identity_mismatch" };
|
|
78
|
+
return {
|
|
79
|
+
status: "ready",
|
|
80
|
+
stripeSessionId: paid.id,
|
|
81
|
+
stripePaymentIntentId: pi.id,
|
|
82
|
+
stripeChargeId: charge.id,
|
|
83
|
+
customerAccountId: paid.customer_account,
|
|
84
|
+
livemode: paid.livemode,
|
|
85
|
+
amount: paid.amount_total,
|
|
86
|
+
currency: paid.currency,
|
|
87
|
+
sessionMetadata: paid.metadata,
|
|
88
|
+
paymentIntentMetadata: pi.metadata,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=capturedCheckoutPayment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capturedCheckoutPayment.js","sourceRoot":"","sources":["../../../src/client/billing/capturedCheckoutPayment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,EAAE,GAAG,CAAC,MAAc,EAAE,EAAE,CAC5B,CAAC;KACE,MAAM,EAAE;KACR,GAAG,CAAC,GAAG,CAAC;KACR,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,MAAM,iBAAiB,CAAC,CAAC,CAAC;AACpD,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AACxE,MAAM,QAAQ,GAAG,CAAC,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C,QAAQ,KAAK,KAAK,CAAC,IAAI,CAAC,QAAQ;QACrC,EAAE,CAAC,QAAQ,KAAK,KAAK,CAAC,IAAI,CAAC,QAAQ;QACnC,MAAM,CAAC,QAAQ,KAAK,KAAK,CAAC,IAAI,CAAC,QAAQ;QACvC,MAAM,CAAC,cAAc,KAAK,EAAE,CAAC,EAAE;QAC/B,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,YAAY;QAC/B,EAAE,CAAC,eAAe,KAAK,IAAI,CAAC,YAAY;QACxC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,YAAY;QACnC,MAAM,CAAC,eAAe,KAAK,IAAI,CAAC,YAAY;QAC5C,EAAE,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ;QAC7B,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ;QAEjC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAChE,OAAO;QACL,MAAM,EAAE,OAAO;QACf,eAAe,EAAE,IAAI,CAAC,EAAE;QACxB,qBAAqB,EAAE,EAAE,CAAC,EAAE;QAC5B,cAAc,EAAE,MAAM,CAAC,EAAE;QACzB,iBAAiB,EAAE,IAAI,CAAC,gBAAgB;QACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,YAAY;QACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,eAAe,EAAE,IAAI,CAAC,QAAQ;QAC9B,qBAAqB,EAAE,EAAE,CAAC,QAAQ;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -2360,6 +2360,14 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
2360
2360
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
2361
2361
|
requestKey: string;
|
|
2362
2362
|
result?: {
|
|
2363
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2364
|
+
retryable: false;
|
|
2365
|
+
status: "conflict";
|
|
2366
|
+
} | {
|
|
2367
|
+
reason: "policy_invalid";
|
|
2368
|
+
retryable: false;
|
|
2369
|
+
status: "rejected";
|
|
2370
|
+
} | {
|
|
2363
2371
|
operation: {
|
|
2364
2372
|
accountId: string;
|
|
2365
2373
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2370,14 +2378,6 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
2370
2378
|
} | {
|
|
2371
2379
|
enabled: boolean;
|
|
2372
2380
|
status: "unchanged";
|
|
2373
|
-
} | {
|
|
2374
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2375
|
-
retryable: false;
|
|
2376
|
-
status: "conflict";
|
|
2377
|
-
} | {
|
|
2378
|
-
reason: "policy_invalid";
|
|
2379
|
-
retryable: false;
|
|
2380
|
-
status: "rejected";
|
|
2381
2381
|
} | {
|
|
2382
2382
|
reason: "provider_pending";
|
|
2383
2383
|
retryable: true;
|
|
@@ -2388,6 +2388,14 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
2388
2388
|
payload: import("convex/values").VString<string, "required">;
|
|
2389
2389
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
2390
2390
|
result: import("convex/values").VUnion<{
|
|
2391
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2392
|
+
retryable: false;
|
|
2393
|
+
status: "conflict";
|
|
2394
|
+
} | {
|
|
2395
|
+
reason: "policy_invalid";
|
|
2396
|
+
retryable: false;
|
|
2397
|
+
status: "rejected";
|
|
2398
|
+
} | {
|
|
2391
2399
|
operation: {
|
|
2392
2400
|
accountId: string;
|
|
2393
2401
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -2398,14 +2406,6 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
2398
2406
|
} | {
|
|
2399
2407
|
enabled: boolean;
|
|
2400
2408
|
status: "unchanged";
|
|
2401
|
-
} | {
|
|
2402
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
2403
|
-
retryable: false;
|
|
2404
|
-
status: "conflict";
|
|
2405
|
-
} | {
|
|
2406
|
-
reason: "policy_invalid";
|
|
2407
|
-
retryable: false;
|
|
2408
|
-
status: "rejected";
|
|
2409
2409
|
} | {
|
|
2410
2410
|
reason: "provider_pending";
|
|
2411
2411
|
retryable: true;
|
|
@@ -7215,6 +7215,14 @@ export declare function historical(currency?: string): Promise<{
|
|
|
7215
7215
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
7216
7216
|
requestKey: string;
|
|
7217
7217
|
result?: {
|
|
7218
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7219
|
+
retryable: false;
|
|
7220
|
+
status: "conflict";
|
|
7221
|
+
} | {
|
|
7222
|
+
reason: "policy_invalid";
|
|
7223
|
+
retryable: false;
|
|
7224
|
+
status: "rejected";
|
|
7225
|
+
} | {
|
|
7218
7226
|
operation: {
|
|
7219
7227
|
accountId: string;
|
|
7220
7228
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -7225,14 +7233,6 @@ export declare function historical(currency?: string): Promise<{
|
|
|
7225
7233
|
} | {
|
|
7226
7234
|
enabled: boolean;
|
|
7227
7235
|
status: "unchanged";
|
|
7228
|
-
} | {
|
|
7229
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7230
|
-
retryable: false;
|
|
7231
|
-
status: "conflict";
|
|
7232
|
-
} | {
|
|
7233
|
-
reason: "policy_invalid";
|
|
7234
|
-
retryable: false;
|
|
7235
|
-
status: "rejected";
|
|
7236
7236
|
} | {
|
|
7237
7237
|
reason: "provider_pending";
|
|
7238
7238
|
retryable: true;
|
|
@@ -7243,6 +7243,14 @@ export declare function historical(currency?: string): Promise<{
|
|
|
7243
7243
|
payload: import("convex/values").VString<string, "required">;
|
|
7244
7244
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
7245
7245
|
result: import("convex/values").VUnion<{
|
|
7246
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7247
|
+
retryable: false;
|
|
7248
|
+
status: "conflict";
|
|
7249
|
+
} | {
|
|
7250
|
+
reason: "policy_invalid";
|
|
7251
|
+
retryable: false;
|
|
7252
|
+
status: "rejected";
|
|
7253
|
+
} | {
|
|
7246
7254
|
operation: {
|
|
7247
7255
|
accountId: string;
|
|
7248
7256
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -7253,14 +7261,6 @@ export declare function historical(currency?: string): Promise<{
|
|
|
7253
7261
|
} | {
|
|
7254
7262
|
enabled: boolean;
|
|
7255
7263
|
status: "unchanged";
|
|
7256
|
-
} | {
|
|
7257
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7258
|
-
retryable: false;
|
|
7259
|
-
status: "conflict";
|
|
7260
|
-
} | {
|
|
7261
|
-
reason: "policy_invalid";
|
|
7262
|
-
retryable: false;
|
|
7263
|
-
status: "rejected";
|
|
7264
7264
|
} | {
|
|
7265
7265
|
reason: "provider_pending";
|
|
7266
7266
|
retryable: true;
|
|
@@ -2351,14 +2351,6 @@ export declare function large(count?: number, amount?: number): 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 large(count?: number, amount?: number): 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 large(count?: number, amount?: number): 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 large(count?: number, amount?: number): 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;
|
|
@@ -7207,14 +7207,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
|
|
|
7207
7207
|
preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
|
|
7208
7208
|
requestKey: string;
|
|
7209
7209
|
result?: {
|
|
7210
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7211
|
-
retryable: false;
|
|
7212
|
-
status: "conflict";
|
|
7213
|
-
} | {
|
|
7214
|
-
reason: "policy_invalid";
|
|
7215
|
-
retryable: false;
|
|
7216
|
-
status: "rejected";
|
|
7217
|
-
} | {
|
|
7218
7210
|
operation: {
|
|
7219
7211
|
accountId: string;
|
|
7220
7212
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -7225,6 +7217,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
|
|
|
7225
7217
|
} | {
|
|
7226
7218
|
enabled: boolean;
|
|
7227
7219
|
status: "unchanged";
|
|
7220
|
+
} | {
|
|
7221
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7222
|
+
retryable: false;
|
|
7223
|
+
status: "conflict";
|
|
7224
|
+
} | {
|
|
7225
|
+
reason: "policy_invalid";
|
|
7226
|
+
retryable: false;
|
|
7227
|
+
status: "rejected";
|
|
7228
7228
|
} | {
|
|
7229
7229
|
reason: "provider_pending";
|
|
7230
7230
|
retryable: true;
|
|
@@ -7235,14 +7235,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
|
|
|
7235
7235
|
payload: import("convex/values").VString<string, "required">;
|
|
7236
7236
|
preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
|
|
7237
7237
|
result: import("convex/values").VUnion<{
|
|
7238
|
-
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7239
|
-
retryable: false;
|
|
7240
|
-
status: "conflict";
|
|
7241
|
-
} | {
|
|
7242
|
-
reason: "policy_invalid";
|
|
7243
|
-
retryable: false;
|
|
7244
|
-
status: "rejected";
|
|
7245
|
-
} | {
|
|
7246
7238
|
operation: {
|
|
7247
7239
|
accountId: string;
|
|
7248
7240
|
operationId: import("convex/values").GenericId<"balanceFundingOperations">;
|
|
@@ -7253,6 +7245,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
|
|
|
7253
7245
|
} | {
|
|
7254
7246
|
enabled: boolean;
|
|
7255
7247
|
status: "unchanged";
|
|
7248
|
+
} | {
|
|
7249
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
7250
|
+
retryable: false;
|
|
7251
|
+
status: "conflict";
|
|
7252
|
+
} | {
|
|
7253
|
+
reason: "policy_invalid";
|
|
7254
|
+
retryable: false;
|
|
7255
|
+
status: "rejected";
|
|
7256
7256
|
} | {
|
|
7257
7257
|
reason: "provider_pending";
|
|
7258
7258
|
retryable: true;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AppliedConfiguration } from "../../component/core/validators.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export declare const closureConfigurations: z.ZodArray<z.ZodEnum<{
|
|
4
|
+
customer: "customer";
|
|
5
|
+
merchant: "merchant";
|
|
6
|
+
recipient: "recipient";
|
|
7
|
+
}>>;
|
|
8
|
+
export declare const closeAccountOptionsSchema: z.ZodObject<{
|
|
9
|
+
stripeAccountId: z.ZodString;
|
|
10
|
+
expectedAppliedConfigurations: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
11
|
+
customer: "customer";
|
|
12
|
+
merchant: "merchant";
|
|
13
|
+
recipient: "recipient";
|
|
14
|
+
}>>>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
/** Host-authenticated scope confirmation, not financial clearance. */
|
|
17
|
+
export type CloseAccountOptions = {
|
|
18
|
+
stripeAccountId: string;
|
|
19
|
+
expectedAppliedConfigurations?: AppliedConfiguration[];
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=accountCloseOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountCloseOptions.d.ts","sourceRoot":"","sources":["../../../src/client/core/accountCloseOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB;;;;GAG2B,CAAC;AAE9D,eAAO,MAAM,yBAAyB;;;;;;;kBAQ3B,CAAC;AAEZ,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,6BAA6B,CAAC,EAAE,oBAAoB,EAAE,CAAC;CACxD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const closureConfigurations = z
|
|
3
|
+
.array(z.enum(["customer", "merchant", "recipient"]))
|
|
4
|
+
.max(3)
|
|
5
|
+
.refine((values) => new Set(values).size === values.length);
|
|
6
|
+
export const closeAccountOptionsSchema = z
|
|
7
|
+
.object({
|
|
8
|
+
stripeAccountId: z
|
|
9
|
+
.string()
|
|
10
|
+
.regex(/^acct_[A-Za-z0-9_]+$/)
|
|
11
|
+
.max(128),
|
|
12
|
+
expectedAppliedConfigurations: closureConfigurations.optional(),
|
|
13
|
+
})
|
|
14
|
+
.strict();
|
|
15
|
+
//# sourceMappingURL=accountCloseOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountCloseOptions.js","sourceRoot":"","sources":["../../../src/client/core/accountCloseOptions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;KACpD,GAAG,CAAC,CAAC,CAAC;KACN,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC;AAE9D,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,CAAC;IACN,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,KAAK,CAAC,sBAAsB,CAAC;SAC7B,GAAG,CAAC,GAAG,CAAC;IACX,6BAA6B,EAAE,qBAAqB,CAAC,QAAQ,EAAE;CAChE,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
import type { Component, RunCtx } from "../helpers.js";
|
|
3
|
+
import type { StripeAccountClosure } from "./accountClosures.js";
|
|
4
|
+
import { type CloseAccountOptions } from "./accountCloseOptions.js";
|
|
5
|
+
export declare function confirmedClosureScope(opts: CloseAccountOptions, closure: StripeAccountClosure): ("customer" | "merchant" | "recipient")[];
|
|
6
|
+
/** Point-in-time scope observation, not financial clearance or provider-side fencing. */
|
|
7
|
+
export declare function guardedAccountIsClosed(stripe: Stripe, component: Component, ctx: RunCtx, opts: CloseAccountOptions, closure: StripeAccountClosure): Promise<boolean>;
|
|
8
|
+
export declare function assertGuardedCloseAcknowledgement(value: unknown, stripeAccountId: string): void;
|
|
9
|
+
//# sourceMappingURL=accountCloseScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountCloseScope.d.ts","sourceRoot":"","sources":["../../../src/client/core/accountCloseScope.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,oBAAoB,6CAkB9B;AAED,yFAAyF;AACzF,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,oBAAoB,oBA+B9B;AAQD,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,MAAM,QAKxB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { componentRef } from "../webhooks/helpers.js";
|
|
3
|
+
import { closureConfigurations, closeAccountOptionsSchema, } from "./accountCloseOptions.js";
|
|
4
|
+
export function confirmedClosureScope(opts, closure) {
|
|
5
|
+
const expected = closeAccountOptionsSchema.parse(opts).expectedAppliedConfigurations;
|
|
6
|
+
const original = closureConfigurations.safeParse(closure.appliedConfigurations);
|
|
7
|
+
if (!expected ||
|
|
8
|
+
!original.success ||
|
|
9
|
+
closure.stripeAccountId !== opts.stripeAccountId ||
|
|
10
|
+
(!closure.userId && !closure.orgId) ||
|
|
11
|
+
!sameScope(expected, original.data))
|
|
12
|
+
throw new Error("Account closure original scope does not match confirmation");
|
|
13
|
+
return expected;
|
|
14
|
+
}
|
|
15
|
+
/** Point-in-time scope observation, not financial clearance or provider-side fencing. */
|
|
16
|
+
export async function guardedAccountIsClosed(stripe, component, ctx, opts, closure) {
|
|
17
|
+
const expected = confirmedClosureScope(opts, closure);
|
|
18
|
+
const current = z
|
|
19
|
+
.object({
|
|
20
|
+
id: z.literal(opts.stripeAccountId),
|
|
21
|
+
closed: z.boolean(),
|
|
22
|
+
applied_configurations: closureConfigurations.optional(),
|
|
23
|
+
})
|
|
24
|
+
.passthrough()
|
|
25
|
+
.parse(await stripe.v2.core.accounts.retrieve(opts.stripeAccountId));
|
|
26
|
+
const account = await ctx.runQuery(componentRef(component, "accountClosure/queries/currentOwner"), { stripeAccountId: opts.stripeAccountId });
|
|
27
|
+
if (account.status === "ambiguous" ||
|
|
28
|
+
(account.status === "unique" &&
|
|
29
|
+
(account.userId !== closure.userId || account.orgId !== closure.orgId)))
|
|
30
|
+
throw new Error("Account closure original ownership changed or is unknown");
|
|
31
|
+
// Terminal account state may clear roles. This observation does not attribute its cause.
|
|
32
|
+
if (current.closed)
|
|
33
|
+
return true;
|
|
34
|
+
if (account.status !== "unique")
|
|
35
|
+
throw new Error("Account closure current ownership is unavailable");
|
|
36
|
+
if (!current.applied_configurations ||
|
|
37
|
+
!sameScope(expected, current.applied_configurations))
|
|
38
|
+
throw new Error("Account closure provider scope changed or is unknown");
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
function sameScope(left, right) {
|
|
42
|
+
return (left.length === right.length && left.every((value) => right.includes(value)));
|
|
43
|
+
}
|
|
44
|
+
export function assertGuardedCloseAcknowledgement(value, stripeAccountId) {
|
|
45
|
+
z.object({ id: z.literal(stripeAccountId), closed: z.literal(true) })
|
|
46
|
+
.passthrough()
|
|
47
|
+
.parse(value);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=accountCloseScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountCloseScope.js","sourceRoot":"","sources":["../../../src/client/core/accountCloseScope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAE1B,MAAM,0BAA0B,CAAC;AAElC,MAAM,UAAU,qBAAqB,CACnC,IAAyB,EACzB,OAA6B;IAE7B,MAAM,QAAQ,GACZ,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,6BAA6B,CAAC;IACtE,MAAM,QAAQ,GAAG,qBAAqB,CAAC,SAAS,CAC9C,OAAO,CAAC,qBAAqB,CAC9B,C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MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,yFAAyF;IACzF,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAChC,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ;QAC7B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,IACE,CAAC,OAAO,CAAC,sBAAsB;QAC/B,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,sBAAsB,CAAC;QAEpD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,SAAS,CAAC,IAAc,EAAE,KAAe;IAChD,OAAO,CACL,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAC7E,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,KAAc,EACd,eAAuB;IAEvB,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;SAClE,WAAW,EAAE;SACb,KAAK,CAAC,KAAK,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type Stripe from "stripe";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { Component, RunCtx } from "../helpers.js";
|
|
4
|
+
import type { AccountBalance } from "../connect/payouts.js";
|
|
5
|
+
import type { ClosureBlocker } from "../../component/accountClosure/blockers.js";
|
|
6
|
+
import type { AppliedConfiguration } from "../../component/core/validators.js";
|
|
7
|
+
export type ClosureObservation<T> = {
|
|
8
|
+
status: "observed";
|
|
9
|
+
value: T;
|
|
10
|
+
} | {
|
|
11
|
+
status: "unknown";
|
|
12
|
+
};
|
|
13
|
+
export type AccountClosurePreview = {
|
|
14
|
+
stripeAccountId: string;
|
|
15
|
+
observedAt: number;
|
|
16
|
+
financialCoverage: "unknown";
|
|
17
|
+
account: ClosureObservation<{
|
|
18
|
+
appliedConfigurations: AppliedConfiguration[];
|
|
19
|
+
closed: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
balances: ClosureObservation<AccountBalance[]>;
|
|
22
|
+
openSessions: ClosureObservation<{
|
|
23
|
+
sessionIds: string[];
|
|
24
|
+
hasMore: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
componentBlockers: ClosureObservation<ClosureBlocker[]>;
|
|
27
|
+
knownBlockers: string[];
|
|
28
|
+
unknownReasons: string[];
|
|
29
|
+
};
|
|
30
|
+
export type AccountClosurePreviewOptions = {
|
|
31
|
+
stripeAccountId: string;
|
|
32
|
+
sessionLimit?: number;
|
|
33
|
+
};
|
|
34
|
+
export declare const accountClosurePreviewOptionsSchema: z.ZodObject<{
|
|
35
|
+
stripeAccountId: z.ZodString;
|
|
36
|
+
sessionLimit: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
/** Point-in-time known blockers; never a positive closure authorization. */
|
|
39
|
+
export declare function previewAccountClosure(stripe: Stripe, component: Component, ctx: RunCtx, input: AccountClosurePreviewOptions): Promise<AccountClosurePreview>;
|
|
40
|
+
//# sourceMappingURL=accountClosurePreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountClosurePreview.d.ts","sourceRoot":"","sources":["../../../src/client/core/accountClosurePreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE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