@fantastic.dev/better-stripe 0.4.0-bootstrap.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 +318 -0
- package/README.md +1117 -0
- package/dist/client/billing/checkout.d.ts +75 -0
- package/dist/client/billing/checkout.d.ts.map +1 -0
- package/dist/client/billing/checkout.js +260 -0
- package/dist/client/billing/checkout.js.map +1 -0
- package/dist/client/billing/invoices.d.ts +37 -0
- package/dist/client/billing/invoices.d.ts.map +1 -0
- package/dist/client/billing/invoices.js +29 -0
- package/dist/client/billing/invoices.js.map +1 -0
- package/dist/client/billing/subscriptions.d.ts +179 -0
- package/dist/client/billing/subscriptions.d.ts.map +1 -0
- package/dist/client/billing/subscriptions.js +346 -0
- package/dist/client/billing/subscriptions.js.map +1 -0
- package/dist/client/connect/disputes.d.ts +112 -0
- package/dist/client/connect/disputes.d.ts.map +1 -0
- package/dist/client/connect/disputes.js +186 -0
- package/dist/client/connect/disputes.js.map +1 -0
- package/dist/client/connect/paymentMethodUtils.d.ts +17 -0
- package/dist/client/connect/paymentMethodUtils.d.ts.map +1 -0
- package/dist/client/connect/paymentMethodUtils.js +24 -0
- package/dist/client/connect/paymentMethodUtils.js.map +1 -0
- package/dist/client/connect/paymentMethods.d.ts +23 -0
- package/dist/client/connect/paymentMethods.d.ts.map +1 -0
- package/dist/client/connect/paymentMethods.js +27 -0
- package/dist/client/connect/paymentMethods.js.map +1 -0
- package/dist/client/connect/payouts.d.ts +47 -0
- package/dist/client/connect/payouts.d.ts.map +1 -0
- package/dist/client/connect/payouts.js +52 -0
- package/dist/client/connect/payouts.js.map +1 -0
- package/dist/client/connect/refundActor.d.ts +50 -0
- package/dist/client/connect/refundActor.d.ts.map +1 -0
- package/dist/client/connect/refundActor.js +17 -0
- package/dist/client/connect/refundActor.js.map +1 -0
- package/dist/client/connect/refunds.d.ts +75 -0
- package/dist/client/connect/refunds.d.ts.map +1 -0
- package/dist/client/connect/refunds.js +141 -0
- package/dist/client/connect/refunds.js.map +1 -0
- package/dist/client/connect/transfers.d.ts +189 -0
- package/dist/client/connect/transfers.d.ts.map +1 -0
- package/dist/client/connect/transfers.js +347 -0
- package/dist/client/connect/transfers.js.map +1 -0
- package/dist/client/constants.d.ts +15 -0
- package/dist/client/constants.d.ts.map +1 -0
- package/dist/client/constants.js +14 -0
- package/dist/client/constants.js.map +1 -0
- package/dist/client/core/accountLinks.d.ts +68 -0
- package/dist/client/core/accountLinks.d.ts.map +1 -0
- package/dist/client/core/accountLinks.js +131 -0
- package/dist/client/core/accountLinks.js.map +1 -0
- package/dist/client/core/accountStatus.d.ts +12 -0
- package/dist/client/core/accountStatus.d.ts.map +1 -0
- package/dist/client/core/accountStatus.js +56 -0
- package/dist/client/core/accountStatus.js.map +1 -0
- package/dist/client/core/accounts.d.ts +181 -0
- package/dist/client/core/accounts.d.ts.map +1 -0
- package/dist/client/core/accounts.js +359 -0
- package/dist/client/core/accounts.js.map +1 -0
- package/dist/client/core/config.d.ts +5 -0
- package/dist/client/core/config.d.ts.map +1 -0
- package/dist/client/core/config.js +11 -0
- package/dist/client/core/config.js.map +1 -0
- package/dist/client/core/descriptors.d.ts +24 -0
- package/dist/client/core/descriptors.d.ts.map +1 -0
- package/dist/client/core/descriptors.js +43 -0
- package/dist/client/core/descriptors.js.map +1 -0
- package/dist/client/core/fees.d.ts +83 -0
- package/dist/client/core/fees.d.ts.map +1 -0
- package/dist/client/core/fees.js +178 -0
- package/dist/client/core/fees.js.map +1 -0
- package/dist/client/errors.d.ts +20 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +31 -0
- package/dist/client/errors.js.map +1 -0
- package/dist/client/helpers.d.ts +20 -0
- package/dist/client/helpers.d.ts.map +1 -0
- package/dist/client/helpers.js +46 -0
- package/dist/client/helpers.js.map +1 -0
- package/dist/client/index.d.ts +880 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +791 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/products/prices.d.ts +61 -0
- package/dist/client/products/prices.d.ts.map +1 -0
- package/dist/client/products/prices.js +92 -0
- package/dist/client/products/prices.js.map +1 -0
- package/dist/client/products/products.d.ts +65 -0
- package/dist/client/products/products.d.ts.map +1 -0
- package/dist/client/products/products.js +186 -0
- package/dist/client/products/products.js.map +1 -0
- package/dist/client/stripe-types.d.ts +44 -0
- package/dist/client/stripe-types.d.ts.map +1 -0
- package/dist/client/stripe-types.js +2 -0
- package/dist/client/stripe-types.js.map +1 -0
- package/dist/client/types/documents.d.ts +195 -0
- package/dist/client/types/documents.d.ts.map +1 -0
- package/dist/client/types/documents.js +2 -0
- package/dist/client/types/documents.js.map +1 -0
- package/dist/client/types/events.d.ts +43 -0
- package/dist/client/types/events.d.ts.map +1 -0
- package/dist/client/types/events.js +2 -0
- package/dist/client/types/events.js.map +1 -0
- package/dist/client/types/index.d.ts +5 -0
- package/dist/client/types/index.d.ts.map +1 -0
- package/dist/client/types/index.js +2 -0
- package/dist/client/types/index.js.map +1 -0
- package/dist/client/types/options.d.ts +79 -0
- package/dist/client/types/options.d.ts.map +1 -0
- package/dist/client/types/options.js +2 -0
- package/dist/client/types/options.js.map +1 -0
- package/dist/client/types/triggers.d.ts +101 -0
- package/dist/client/types/triggers.d.ts.map +1 -0
- package/dist/client/types/triggers.js +2 -0
- package/dist/client/types/triggers.js.map +1 -0
- package/dist/client/types.d.ts +2 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/client/utils/data.d.ts +10 -0
- package/dist/client/utils/data.d.ts.map +1 -0
- package/dist/client/utils/data.js +13 -0
- package/dist/client/utils/data.js.map +1 -0
- package/dist/client/utils/owner.d.ts +22 -0
- package/dist/client/utils/owner.d.ts.map +1 -0
- package/dist/client/utils/owner.js +20 -0
- package/dist/client/utils/owner.js.map +1 -0
- package/dist/client/utils/stripeDashboardUrl.d.ts +12 -0
- package/dist/client/utils/stripeDashboardUrl.d.ts.map +1 -0
- package/dist/client/utils/stripeDashboardUrl.js +39 -0
- package/dist/client/utils/stripeDashboardUrl.js.map +1 -0
- package/dist/client/utils/webhookEndpoints.d.ts +83 -0
- package/dist/client/utils/webhookEndpoints.d.ts.map +1 -0
- package/dist/client/utils/webhookEndpoints.js +185 -0
- package/dist/client/utils/webhookEndpoints.js.map +1 -0
- package/dist/client/webhooks/handler.d.ts +4 -0
- package/dist/client/webhooks/handler.d.ts.map +1 -0
- package/dist/client/webhooks/handler.js +170 -0
- package/dist/client/webhooks/handler.js.map +1 -0
- package/dist/client/webhooks/helpers.d.ts +56 -0
- package/dist/client/webhooks/helpers.d.ts.map +1 -0
- package/dist/client/webhooks/helpers.js +229 -0
- package/dist/client/webhooks/helpers.js.map +1 -0
- package/dist/client/webhooks/hooks.d.ts +11 -0
- package/dist/client/webhooks/hooks.d.ts.map +1 -0
- package/dist/client/webhooks/hooks.js +134 -0
- package/dist/client/webhooks/hooks.js.map +1 -0
- package/dist/client/webhooks/index.d.ts +23 -0
- package/dist/client/webhooks/index.d.ts.map +1 -0
- package/dist/client/webhooks/index.js +35 -0
- package/dist/client/webhooks/index.js.map +1 -0
- package/dist/client/webhooks/processors.d.ts +4 -0
- package/dist/client/webhooks/processors.d.ts.map +1 -0
- package/dist/client/webhooks/processors.js +932 -0
- package/dist/client/webhooks/processors.js.map +1 -0
- package/dist/client/webhooks/v2.d.ts +11 -0
- package/dist/client/webhooks/v2.d.ts.map +1 -0
- package/dist/client/webhooks/v2.js +94 -0
- package/dist/client/webhooks/v2.js.map +1 -0
- package/dist/client/webhooks.d.ts +2 -0
- package/dist/client/webhooks.d.ts.map +1 -0
- package/dist/client/webhooks.js +4 -0
- package/dist/client/webhooks.js.map +1 -0
- package/dist/component/_generated/component.d.ts +1262 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +129 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +79 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/billing/mutations.d.ts +86 -0
- package/dist/component/billing/mutations.d.ts.map +1 -0
- package/dist/component/billing/mutations.js +131 -0
- package/dist/component/billing/mutations.js.map +1 -0
- package/dist/component/billing/queries.d.ts +425 -0
- package/dist/component/billing/queries.d.ts.map +1 -0
- package/dist/component/billing/queries.js +304 -0
- package/dist/component/billing/queries.js.map +1 -0
- package/dist/component/billing/schema.d.ts +228 -0
- package/dist/component/billing/schema.d.ts.map +1 -0
- package/dist/component/billing/schema.js +33 -0
- package/dist/component/billing/schema.js.map +1 -0
- package/dist/component/billing/validators.d.ts +364 -0
- package/dist/component/billing/validators.d.ts.map +1 -0
- package/dist/component/billing/validators.js +98 -0
- package/dist/component/billing/validators.js.map +1 -0
- package/dist/component/connect/mutations.d.ts +182 -0
- package/dist/component/connect/mutations.d.ts.map +1 -0
- package/dist/component/connect/mutations.js +480 -0
- package/dist/component/connect/mutations.js.map +1 -0
- package/dist/component/connect/queries.d.ts +347 -0
- package/dist/component/connect/queries.d.ts.map +1 -0
- package/dist/component/connect/queries.js +449 -0
- package/dist/component/connect/queries.js.map +1 -0
- package/dist/component/connect/schema.d.ts +258 -0
- package/dist/component/connect/schema.d.ts.map +1 -0
- package/dist/component/connect/schema.js +70 -0
- package/dist/component/connect/schema.js.map +1 -0
- package/dist/component/connect/validators.d.ts +468 -0
- package/dist/component/connect/validators.d.ts.map +1 -0
- package/dist/component/connect/validators.js +250 -0
- package/dist/component/connect/validators.js.map +1 -0
- package/dist/component/convex.config.d.ts +5 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +17 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/core/mutations.d.ts +52 -0
- package/dist/component/core/mutations.d.ts.map +1 -0
- package/dist/component/core/mutations.js +153 -0
- package/dist/component/core/mutations.js.map +1 -0
- package/dist/component/core/queries.d.ts +95 -0
- package/dist/component/core/queries.d.ts.map +1 -0
- package/dist/component/core/queries.js +86 -0
- package/dist/component/core/queries.js.map +1 -0
- package/dist/component/core/schema.d.ts +41 -0
- package/dist/component/core/schema.d.ts.map +1 -0
- package/dist/component/core/schema.js +12 -0
- package/dist/component/core/schema.js.map +1 -0
- package/dist/component/core/validators.d.ts +65 -0
- package/dist/component/core/validators.d.ts.map +1 -0
- package/dist/component/core/validators.js +35 -0
- package/dist/component/core/validators.js.map +1 -0
- package/dist/component/lib/fees.d.ts +74 -0
- package/dist/component/lib/fees.d.ts.map +1 -0
- package/dist/component/lib/fees.js +51 -0
- package/dist/component/lib/fees.js.map +1 -0
- package/dist/component/lib/idempotency.d.ts +9 -0
- package/dist/component/lib/idempotency.d.ts.map +1 -0
- package/dist/component/lib/idempotency.js +18 -0
- package/dist/component/lib/idempotency.js.map +1 -0
- package/dist/component/lib/reversals.d.ts +48 -0
- package/dist/component/lib/reversals.d.ts.map +1 -0
- package/dist/component/lib/reversals.js +79 -0
- package/dist/component/lib/reversals.js.map +1 -0
- package/dist/component/lib/stripeFactory.d.ts +7 -0
- package/dist/component/lib/stripeFactory.d.ts.map +1 -0
- package/dist/component/lib/stripeFactory.js +28 -0
- package/dist/component/lib/stripeFactory.js.map +1 -0
- package/dist/component/products/mutations.d.ts +22 -0
- package/dist/component/products/mutations.d.ts.map +1 -0
- package/dist/component/products/mutations.js +63 -0
- package/dist/component/products/mutations.js.map +1 -0
- package/dist/component/products/queries.d.ts +109 -0
- package/dist/component/products/queries.d.ts.map +1 -0
- package/dist/component/products/queries.js +122 -0
- package/dist/component/products/queries.js.map +1 -0
- package/dist/component/products/schema.d.ts +58 -0
- package/dist/component/products/schema.d.ts.map +1 -0
- package/dist/component/products/schema.js +20 -0
- package/dist/component/products/schema.js.map +1 -0
- package/dist/component/products/validators.d.ts +86 -0
- package/dist/component/products/validators.d.ts.map +1 -0
- package/dist/component/products/validators.js +47 -0
- package/dist/component/products/validators.js.map +1 -0
- package/dist/component/schema.d.ts +555 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +28 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/webhooks/mutations.d.ts +30 -0
- package/dist/component/webhooks/mutations.d.ts.map +1 -0
- package/dist/component/webhooks/mutations.js +124 -0
- package/dist/component/webhooks/mutations.js.map +1 -0
- package/dist/component/webhooks/queries.d.ts +35 -0
- package/dist/component/webhooks/queries.d.ts.map +1 -0
- package/dist/component/webhooks/queries.js +41 -0
- package/dist/component/webhooks/queries.js.map +1 -0
- package/dist/component/webhooks/schema.d.ts +22 -0
- package/dist/component/webhooks/schema.d.ts.map +1 -0
- package/dist/component/webhooks/schema.js +9 -0
- package/dist/component/webhooks/schema.js.map +1 -0
- package/dist/component/webhooks/validators.d.ts +37 -0
- package/dist/component/webhooks/validators.d.ts.map +1 -0
- package/dist/component/webhooks/validators.js +22 -0
- package/dist/component/webhooks/validators.js.map +1 -0
- package/dist/react/components/AccountCloseButton.d.ts +42 -0
- package/dist/react/components/AccountCloseButton.d.ts.map +1 -0
- package/dist/react/components/AccountCloseButton.js +33 -0
- package/dist/react/components/AccountCloseButton.js.map +1 -0
- package/dist/react/components/AccountCloseCard.d.ts +31 -0
- package/dist/react/components/AccountCloseCard.d.ts.map +1 -0
- package/dist/react/components/AccountCloseCard.js +22 -0
- package/dist/react/components/AccountCloseCard.js.map +1 -0
- package/dist/react/components/AccountCreateButton.d.ts +37 -0
- package/dist/react/components/AccountCreateButton.d.ts.map +1 -0
- package/dist/react/components/AccountCreateButton.js +30 -0
- package/dist/react/components/AccountCreateButton.js.map +1 -0
- package/dist/react/components/AccountCreateCard.d.ts +48 -0
- package/dist/react/components/AccountCreateCard.d.ts.map +1 -0
- package/dist/react/components/AccountCreateCard.js +29 -0
- package/dist/react/components/AccountCreateCard.js.map +1 -0
- package/dist/react/components/AccountLoginButton.d.ts +31 -0
- package/dist/react/components/AccountLoginButton.d.ts.map +1 -0
- package/dist/react/components/AccountLoginButton.js +31 -0
- package/dist/react/components/AccountLoginButton.js.map +1 -0
- package/dist/react/components/AccountLoginCard.d.ts +33 -0
- package/dist/react/components/AccountLoginCard.d.ts.map +1 -0
- package/dist/react/components/AccountLoginCard.js +19 -0
- package/dist/react/components/AccountLoginCard.js.map +1 -0
- package/dist/react/components/AccountOnboardingButton.d.ts +37 -0
- package/dist/react/components/AccountOnboardingButton.d.ts.map +1 -0
- package/dist/react/components/AccountOnboardingButton.js +30 -0
- package/dist/react/components/AccountOnboardingButton.js.map +1 -0
- package/dist/react/components/AccountOnboardingCard.d.ts +56 -0
- package/dist/react/components/AccountOnboardingCard.d.ts.map +1 -0
- package/dist/react/components/AccountOnboardingCard.js +36 -0
- package/dist/react/components/AccountOnboardingCard.js.map +1 -0
- package/dist/react/components/AddCardForm.d.ts +18 -0
- package/dist/react/components/AddCardForm.d.ts.map +1 -0
- package/dist/react/components/AddCardForm.js +49 -0
- package/dist/react/components/AddCardForm.js.map +1 -0
- package/dist/react/components/BillingPortalLink.d.ts +23 -0
- package/dist/react/components/BillingPortalLink.d.ts.map +1 -0
- package/dist/react/components/BillingPortalLink.js +55 -0
- package/dist/react/components/BillingPortalLink.js.map +1 -0
- package/dist/react/components/BuyerBillingView.d.ts +80 -0
- package/dist/react/components/BuyerBillingView.d.ts.map +1 -0
- package/dist/react/components/BuyerBillingView.js +44 -0
- package/dist/react/components/BuyerBillingView.js.map +1 -0
- package/dist/react/components/CheckoutSessionProvider.d.ts +34 -0
- package/dist/react/components/CheckoutSessionProvider.d.ts.map +1 -0
- package/dist/react/components/CheckoutSessionProvider.js +38 -0
- package/dist/react/components/CheckoutSessionProvider.js.map +1 -0
- package/dist/react/components/CheckoutSessionProviderWithKey.d.ts +36 -0
- package/dist/react/components/CheckoutSessionProviderWithKey.d.ts.map +1 -0
- package/dist/react/components/CheckoutSessionProviderWithKey.js +36 -0
- package/dist/react/components/CheckoutSessionProviderWithKey.js.map +1 -0
- package/dist/react/components/CheckoutStatus.d.ts +25 -0
- package/dist/react/components/CheckoutStatus.d.ts.map +1 -0
- package/dist/react/components/CheckoutStatus.js +22 -0
- package/dist/react/components/CheckoutStatus.js.map +1 -0
- package/dist/react/components/ConnectProvider.d.ts +29 -0
- package/dist/react/components/ConnectProvider.d.ts.map +1 -0
- package/dist/react/components/ConnectProvider.js +25 -0
- package/dist/react/components/ConnectProvider.js.map +1 -0
- package/dist/react/components/ConnectRequirements.d.ts +55 -0
- package/dist/react/components/ConnectRequirements.d.ts.map +1 -0
- package/dist/react/components/ConnectRequirements.js +58 -0
- package/dist/react/components/ConnectRequirements.js.map +1 -0
- package/dist/react/components/ConnectStatusBadge.d.ts +26 -0
- package/dist/react/components/ConnectStatusBadge.d.ts.map +1 -0
- package/dist/react/components/ConnectStatusBadge.js +20 -0
- package/dist/react/components/ConnectStatusBadge.js.map +1 -0
- package/dist/react/components/DeletePaymentMethodDialog.d.ts +25 -0
- package/dist/react/components/DeletePaymentMethodDialog.d.ts.map +1 -0
- package/dist/react/components/DeletePaymentMethodDialog.js +16 -0
- package/dist/react/components/DeletePaymentMethodDialog.js.map +1 -0
- package/dist/react/components/DisputeDetail.d.ts +42 -0
- package/dist/react/components/DisputeDetail.d.ts.map +1 -0
- package/dist/react/components/DisputeDetail.js +34 -0
- package/dist/react/components/DisputeDetail.js.map +1 -0
- package/dist/react/components/DisputesList.d.ts +42 -0
- package/dist/react/components/DisputesList.d.ts.map +1 -0
- package/dist/react/components/DisputesList.js +47 -0
- package/dist/react/components/DisputesList.js.map +1 -0
- package/dist/react/components/EarningsSummary.d.ts +53 -0
- package/dist/react/components/EarningsSummary.d.ts.map +1 -0
- package/dist/react/components/EarningsSummary.js +37 -0
- package/dist/react/components/EarningsSummary.js.map +1 -0
- package/dist/react/components/EmbeddedCheckout.d.ts +18 -0
- package/dist/react/components/EmbeddedCheckout.d.ts.map +1 -0
- package/dist/react/components/EmbeddedCheckout.js +17 -0
- package/dist/react/components/EmbeddedCheckout.js.map +1 -0
- package/dist/react/components/EmbeddedDisputes.d.ts +21 -0
- package/dist/react/components/EmbeddedDisputes.d.ts.map +1 -0
- package/dist/react/components/EmbeddedDisputes.js +17 -0
- package/dist/react/components/EmbeddedDisputes.js.map +1 -0
- package/dist/react/components/EvidenceForm.d.ts +63 -0
- package/dist/react/components/EvidenceForm.d.ts.map +1 -0
- package/dist/react/components/EvidenceForm.js +79 -0
- package/dist/react/components/EvidenceForm.js.map +1 -0
- package/dist/react/components/IntervalSelector.d.ts +20 -0
- package/dist/react/components/IntervalSelector.d.ts.map +1 -0
- package/dist/react/components/IntervalSelector.js +15 -0
- package/dist/react/components/IntervalSelector.js.map +1 -0
- package/dist/react/components/PaymentMethodActions.d.ts +27 -0
- package/dist/react/components/PaymentMethodActions.d.ts.map +1 -0
- package/dist/react/components/PaymentMethodActions.js +23 -0
- package/dist/react/components/PaymentMethodActions.js.map +1 -0
- package/dist/react/components/PaymentMethodsList.d.ts +32 -0
- package/dist/react/components/PaymentMethodsList.d.ts.map +1 -0
- package/dist/react/components/PaymentMethodsList.js +18 -0
- package/dist/react/components/PaymentMethodsList.js.map +1 -0
- package/dist/react/components/PayoutSchedule.d.ts +55 -0
- package/dist/react/components/PayoutSchedule.d.ts.map +1 -0
- package/dist/react/components/PayoutSchedule.js +51 -0
- package/dist/react/components/PayoutSchedule.js.map +1 -0
- package/dist/react/components/PriceBadge.d.ts +19 -0
- package/dist/react/components/PriceBadge.d.ts.map +1 -0
- package/dist/react/components/PriceBadge.js +25 -0
- package/dist/react/components/PriceBadge.js.map +1 -0
- package/dist/react/components/PriceCard.d.ts +34 -0
- package/dist/react/components/PriceCard.d.ts.map +1 -0
- package/dist/react/components/PriceCard.js +20 -0
- package/dist/react/components/PriceCard.js.map +1 -0
- package/dist/react/components/PricePicker.d.ts +28 -0
- package/dist/react/components/PricePicker.d.ts.map +1 -0
- package/dist/react/components/PricePicker.js +32 -0
- package/dist/react/components/PricePicker.js.map +1 -0
- package/dist/react/components/SplitBreakdown.d.ts +45 -0
- package/dist/react/components/SplitBreakdown.d.ts.map +1 -0
- package/dist/react/components/SplitBreakdown.js +48 -0
- package/dist/react/components/SplitBreakdown.js.map +1 -0
- package/dist/react/components/StripeProvider.d.ts +30 -0
- package/dist/react/components/StripeProvider.d.ts.map +1 -0
- package/dist/react/components/StripeProvider.js +38 -0
- package/dist/react/components/StripeProvider.js.map +1 -0
- package/dist/react/components/StripeProviderWithKey.d.ts +33 -0
- package/dist/react/components/StripeProviderWithKey.d.ts.map +1 -0
- package/dist/react/components/StripeProviderWithKey.js +44 -0
- package/dist/react/components/StripeProviderWithKey.js.map +1 -0
- package/dist/react/components/SubscriptionActions.d.ts +31 -0
- package/dist/react/components/SubscriptionActions.d.ts.map +1 -0
- package/dist/react/components/SubscriptionActions.js +30 -0
- package/dist/react/components/SubscriptionActions.js.map +1 -0
- package/dist/react/components/SubscriptionCard.d.ts +41 -0
- package/dist/react/components/SubscriptionCard.d.ts.map +1 -0
- package/dist/react/components/SubscriptionCard.js +18 -0
- package/dist/react/components/SubscriptionCard.js.map +1 -0
- package/dist/react/components/SubscriptionLineItems.d.ts +23 -0
- package/dist/react/components/SubscriptionLineItems.d.ts.map +1 -0
- package/dist/react/components/SubscriptionLineItems.js +20 -0
- package/dist/react/components/SubscriptionLineItems.js.map +1 -0
- package/dist/react/components/TrialAlert.d.ts +19 -0
- package/dist/react/components/TrialAlert.d.ts.map +1 -0
- package/dist/react/components/TrialAlert.js +16 -0
- package/dist/react/components/TrialAlert.js.map +1 -0
- package/dist/react/hooks/useAccount.d.ts +14 -0
- package/dist/react/hooks/useAccount.d.ts.map +1 -0
- package/dist/react/hooks/useAccount.js +18 -0
- package/dist/react/hooks/useAccount.js.map +1 -0
- package/dist/react/hooks/useAccountOnboarding.d.ts +15 -0
- package/dist/react/hooks/useAccountOnboarding.d.ts.map +1 -0
- package/dist/react/hooks/useAccountOnboarding.js +19 -0
- package/dist/react/hooks/useAccountOnboarding.js.map +1 -0
- package/dist/react/hooks/useCheckout.d.ts +14 -0
- package/dist/react/hooks/useCheckout.d.ts.map +1 -0
- package/dist/react/hooks/useCheckout.js +18 -0
- package/dist/react/hooks/useCheckout.js.map +1 -0
- package/dist/react/hooks/useCheckoutSession.d.ts +62 -0
- package/dist/react/hooks/useCheckoutSession.d.ts.map +1 -0
- package/dist/react/hooks/useCheckoutSession.js +68 -0
- package/dist/react/hooks/useCheckoutSession.js.map +1 -0
- package/dist/react/hooks/useConfirmPayment.d.ts +38 -0
- package/dist/react/hooks/useConfirmPayment.d.ts.map +1 -0
- package/dist/react/hooks/useConfirmPayment.js +91 -0
- package/dist/react/hooks/useConfirmPayment.js.map +1 -0
- package/dist/react/hooks/useDisputeWithCountdown.d.ts +25 -0
- package/dist/react/hooks/useDisputeWithCountdown.d.ts.map +1 -0
- package/dist/react/hooks/useDisputeWithCountdown.js +19 -0
- package/dist/react/hooks/useDisputeWithCountdown.js.map +1 -0
- package/dist/react/hooks/useDisputes.d.ts +14 -0
- package/dist/react/hooks/useDisputes.d.ts.map +1 -0
- package/dist/react/hooks/useDisputes.js +15 -0
- package/dist/react/hooks/useDisputes.js.map +1 -0
- package/dist/react/hooks/useEarnings.d.ts +92 -0
- package/dist/react/hooks/useEarnings.d.ts.map +1 -0
- package/dist/react/hooks/useEarnings.js +35 -0
- package/dist/react/hooks/useEarnings.js.map +1 -0
- package/dist/react/hooks/useInvoices.d.ts +11 -0
- package/dist/react/hooks/useInvoices.d.ts.map +1 -0
- package/dist/react/hooks/useInvoices.js +11 -0
- package/dist/react/hooks/useInvoices.js.map +1 -0
- package/dist/react/hooks/usePaymentMethodActions.d.ts +74 -0
- package/dist/react/hooks/usePaymentMethodActions.d.ts.map +1 -0
- package/dist/react/hooks/usePaymentMethodActions.js +156 -0
- package/dist/react/hooks/usePaymentMethodActions.js.map +1 -0
- package/dist/react/hooks/usePaymentMethods.d.ts +23 -0
- package/dist/react/hooks/usePaymentMethods.d.ts.map +1 -0
- package/dist/react/hooks/usePaymentMethods.js +18 -0
- package/dist/react/hooks/usePaymentMethods.js.map +1 -0
- package/dist/react/hooks/usePrices.d.ts +12 -0
- package/dist/react/hooks/usePrices.d.ts.map +1 -0
- package/dist/react/hooks/usePrices.js +16 -0
- package/dist/react/hooks/usePrices.js.map +1 -0
- package/dist/react/hooks/useProducts.d.ts +10 -0
- package/dist/react/hooks/useProducts.d.ts.map +1 -0
- package/dist/react/hooks/useProducts.js +11 -0
- package/dist/react/hooks/useProducts.js.map +1 -0
- package/dist/react/hooks/useSplitBreakdown.d.ts +58 -0
- package/dist/react/hooks/useSplitBreakdown.d.ts.map +1 -0
- package/dist/react/hooks/useSplitBreakdown.js +59 -0
- package/dist/react/hooks/useSplitBreakdown.js.map +1 -0
- package/dist/react/hooks/useStripeConfig.d.ts +14 -0
- package/dist/react/hooks/useStripeConfig.d.ts.map +1 -0
- package/dist/react/hooks/useStripeConfig.js +21 -0
- package/dist/react/hooks/useStripeConfig.js.map +1 -0
- package/dist/react/hooks/useStripeMode.d.ts +3 -0
- package/dist/react/hooks/useStripeMode.d.ts.map +1 -0
- package/dist/react/hooks/useStripeMode.js +6 -0
- package/dist/react/hooks/useStripeMode.js.map +1 -0
- package/dist/react/hooks/useStripePublishableKey.d.ts +2 -0
- package/dist/react/hooks/useStripePublishableKey.d.ts.map +1 -0
- package/dist/react/hooks/useStripePublishableKey.js +6 -0
- package/dist/react/hooks/useStripePublishableKey.js.map +1 -0
- package/dist/react/hooks/useSubscription.d.ts +17 -0
- package/dist/react/hooks/useSubscription.d.ts.map +1 -0
- package/dist/react/hooks/useSubscription.js +30 -0
- package/dist/react/hooks/useSubscription.js.map +1 -0
- package/dist/react/hooks/useSubscriptions.d.ts +11 -0
- package/dist/react/hooks/useSubscriptions.d.ts.map +1 -0
- package/dist/react/hooks/useSubscriptions.js +13 -0
- package/dist/react/hooks/useSubscriptions.js.map +1 -0
- package/dist/react/index.d.ts +108 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +87 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/lib/connect-requirement-keys.d.ts +14 -0
- package/dist/react/lib/connect-requirement-keys.d.ts.map +1 -0
- package/dist/react/lib/connect-requirement-keys.js +57 -0
- package/dist/react/lib/connect-requirement-keys.js.map +1 -0
- package/dist/react/lib/price-helpers.d.ts +31 -0
- package/dist/react/lib/price-helpers.d.ts.map +1 -0
- package/dist/react/lib/price-helpers.js +46 -0
- package/dist/react/lib/price-helpers.js.map +1 -0
- package/dist/react/lib/stripe-element-styles.d.ts +91 -0
- package/dist/react/lib/stripe-element-styles.d.ts.map +1 -0
- package/dist/react/lib/stripe-element-styles.js +131 -0
- package/dist/react/lib/stripe-element-styles.js.map +1 -0
- package/dist/react/lib/subscription-helpers.d.ts +33 -0
- package/dist/react/lib/subscription-helpers.d.ts.map +1 -0
- package/dist/react/lib/subscription-helpers.js +47 -0
- package/dist/react/lib/subscription-helpers.js.map +1 -0
- package/dist/react/types.d.ts +20 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react/types.js +2 -0
- package/dist/react/types.js.map +1 -0
- package/dist/testing/assert-test-env.d.ts +6 -0
- package/dist/testing/assert-test-env.d.ts.map +1 -0
- package/dist/testing/assert-test-env.js +15 -0
- package/dist/testing/assert-test-env.js.map +1 -0
- package/dist/testing/fixtures.d.ts +38 -0
- package/dist/testing/fixtures.d.ts.map +1 -0
- package/dist/testing/fixtures.js +54 -0
- package/dist/testing/fixtures.js.map +1 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-webhooks.d.ts +19 -0
- package/dist/testing/mock-webhooks.d.ts.map +1 -0
- package/dist/testing/mock-webhooks.js +81 -0
- package/dist/testing/mock-webhooks.js.map +1 -0
- package/package.json +131 -0
- package/src/client/billing/checkout.test.ts +1234 -0
- package/src/client/billing/checkout.ts +416 -0
- package/src/client/billing/invoices.test.ts +237 -0
- package/src/client/billing/invoices.ts +93 -0
- package/src/client/billing/subscriptions.test.ts +987 -0
- package/src/client/billing/subscriptions.ts +604 -0
- package/src/client/component-api-types.test.ts +137 -0
- package/src/client/connect/disputes.test.ts +487 -0
- package/src/client/connect/disputes.ts +302 -0
- package/src/client/connect/paymentMethodUtils.test.ts +83 -0
- package/src/client/connect/paymentMethodUtils.ts +28 -0
- package/src/client/connect/paymentMethods.test.ts +66 -0
- package/src/client/connect/paymentMethods.ts +55 -0
- package/src/client/connect/payouts.test.ts +132 -0
- package/src/client/connect/payouts.ts +105 -0
- package/src/client/connect/refundActor.test.ts +121 -0
- package/src/client/connect/refundActor.ts +60 -0
- package/src/client/connect/refunds.test.ts +341 -0
- package/src/client/connect/refunds.ts +256 -0
- package/src/client/connect/transfers.test.ts +492 -0
- package/src/client/connect/transfers.ts +572 -0
- package/src/client/constants.ts +15 -0
- package/src/client/core/accountLinks.test.ts +378 -0
- package/src/client/core/accountLinks.ts +211 -0
- package/src/client/core/accountStatus.test.ts +102 -0
- package/src/client/core/accountStatus.ts +91 -0
- package/src/client/core/accounts.test.ts +1496 -0
- package/src/client/core/accounts.ts +667 -0
- package/src/client/core/config.test.ts +68 -0
- package/src/client/core/config.ts +27 -0
- package/src/client/core/descriptors.test.ts +68 -0
- package/src/client/core/descriptors.ts +46 -0
- package/src/client/core/fees.test.ts +377 -0
- package/src/client/core/fees.ts +268 -0
- package/src/client/errors.test.ts +66 -0
- package/src/client/errors.ts +70 -0
- package/src/client/helpers.test.ts +74 -0
- package/src/client/helpers.ts +94 -0
- package/src/client/index.test.ts +1848 -0
- package/src/client/index.ts +1872 -0
- package/src/client/products/prices.test.ts +345 -0
- package/src/client/products/prices.ts +194 -0
- package/src/client/products/products.test.ts +476 -0
- package/src/client/products/products.ts +335 -0
- package/src/client/setup.test.ts +47 -0
- package/src/client/stripe-types.ts +108 -0
- package/src/client/types/documents.ts +245 -0
- package/src/client/types/events.ts +72 -0
- package/src/client/types/index.ts +43 -0
- package/src/client/types/options.ts +103 -0
- package/src/client/types/triggers.ts +293 -0
- package/src/client/types.ts +35 -0
- package/src/client/utils/data.test.ts +59 -0
- package/src/client/utils/data.ts +22 -0
- package/src/client/utils/owner.test.ts +35 -0
- package/src/client/utils/owner.ts +27 -0
- package/src/client/utils/stripeDashboardUrl.test.ts +71 -0
- package/src/client/utils/stripeDashboardUrl.ts +71 -0
- package/src/client/utils/webhookEndpoints.test.ts +454 -0
- package/src/client/utils/webhookEndpoints.ts +271 -0
- package/src/client/webhook-handlers.test.ts +603 -0
- package/src/client/webhooks/handler.test.ts +604 -0
- package/src/client/webhooks/handler.ts +256 -0
- package/src/client/webhooks/helpers.test.ts +330 -0
- package/src/client/webhooks/helpers.ts +277 -0
- package/src/client/webhooks/hooks.test.ts +111 -0
- package/src/client/webhooks/hooks.ts +177 -0
- package/src/client/webhooks/index.ts +51 -0
- package/src/client/webhooks/processors.test.ts +2392 -0
- package/src/client/webhooks/processors.ts +1166 -0
- package/src/client/webhooks/v2.test.ts +396 -0
- package/src/client/webhooks/v2.ts +124 -0
- package/src/client/webhooks.test.ts +1689 -0
- package/src/client/webhooks.ts +3 -0
- package/src/component/_generated/api.ts +86 -0
- package/src/component/_generated/component.ts +1758 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +164 -0
- package/src/component/billing/mutations.ts +155 -0
- package/src/component/billing/queries.ts +378 -0
- package/src/component/billing/schema.ts +40 -0
- package/src/component/billing/validators.ts +137 -0
- package/src/component/config-queries.test.ts +47 -0
- package/src/component/connect/mutations.ts +624 -0
- package/src/component/connect/queries.ts +537 -0
- package/src/component/connect/schema.ts +90 -0
- package/src/component/connect/validators.ts +333 -0
- package/src/component/connect.test.ts +721 -0
- package/src/component/convex.config.ts +17 -0
- package/src/component/core/mutations.ts +182 -0
- package/src/component/core/queries.ts +100 -0
- package/src/component/core/schema.ts +13 -0
- package/src/component/core/validators.ts +55 -0
- package/src/component/earnings-totals.test.ts +196 -0
- package/src/component/fee-routing.test.ts +124 -0
- package/src/component/lib/fees.ts +64 -0
- package/src/component/lib/idempotency.test.ts +37 -0
- package/src/component/lib/idempotency.ts +20 -0
- package/src/component/lib/reversals.ts +113 -0
- package/src/component/lib/stripeFactory.ts +30 -0
- package/src/component/products/mutations.ts +73 -0
- package/src/component/products/queries.ts +149 -0
- package/src/component/products/schema.ts +22 -0
- package/src/component/products/validators.ts +63 -0
- package/src/component/public.test.ts +1858 -0
- package/src/component/reversal-races.test.ts +920 -0
- package/src/component/schema.ts +45 -0
- package/src/component/subscription-scoping.test.ts +118 -0
- package/src/component/transfers.test.ts +402 -0
- package/src/component/triggers.test.ts +359 -0
- package/src/component/webhooks/mutations.ts +151 -0
- package/src/component/webhooks/queries.ts +44 -0
- package/src/component/webhooks/schema.ts +10 -0
- package/src/component/webhooks/validators.ts +30 -0
- package/src/react/components/AccountCloseButton.tsx +91 -0
- package/src/react/components/AccountCloseCard.tsx +84 -0
- package/src/react/components/AccountCreateButton.tsx +83 -0
- package/src/react/components/AccountCreateCard.tsx +123 -0
- package/src/react/components/AccountLoginButton.tsx +69 -0
- package/src/react/components/AccountLoginCard.tsx +99 -0
- package/src/react/components/AccountOnboardingButton.tsx +83 -0
- package/src/react/components/AccountOnboardingCard.test.ts +27 -0
- package/src/react/components/AccountOnboardingCard.tsx +152 -0
- package/src/react/components/AddCardForm.tsx +80 -0
- package/src/react/components/BillingPortalLink.tsx +93 -0
- package/src/react/components/BuyerBillingView.render.test.tsx +207 -0
- package/src/react/components/BuyerBillingView.tsx +193 -0
- package/src/react/components/CheckoutSessionProvider.tsx +70 -0
- package/src/react/components/CheckoutSessionProviderWithKey.tsx +99 -0
- package/src/react/components/CheckoutStatus.tsx +71 -0
- package/src/react/components/ConnectProvider.tsx +58 -0
- package/src/react/components/ConnectRequirements.tsx +159 -0
- package/src/react/components/ConnectStatusBadge.tsx +60 -0
- package/src/react/components/DeletePaymentMethodDialog.tsx +61 -0
- package/src/react/components/DisputeDetail.render.test.tsx +143 -0
- package/src/react/components/DisputeDetail.tsx +111 -0
- package/src/react/components/DisputesList.render.test.tsx +244 -0
- package/src/react/components/DisputesList.tsx +120 -0
- package/src/react/components/EarningsSummary.render.test.tsx +153 -0
- package/src/react/components/EarningsSummary.tsx +131 -0
- package/src/react/components/EmbeddedCheckout.test.ts +25 -0
- package/src/react/components/EmbeddedCheckout.tsx +54 -0
- package/src/react/components/EmbeddedDisputes.render.test.tsx +142 -0
- package/src/react/components/EmbeddedDisputes.tsx +38 -0
- package/src/react/components/EvidenceForm.render.test.tsx +215 -0
- package/src/react/components/EvidenceForm.tsx +176 -0
- package/src/react/components/IntervalSelector.tsx +58 -0
- package/src/react/components/PaymentMethodActions.tsx +68 -0
- package/src/react/components/PaymentMethodsList.tsx +81 -0
- package/src/react/components/PayoutSchedule.render.test.tsx +178 -0
- package/src/react/components/PayoutSchedule.tsx +148 -0
- package/src/react/components/PriceBadge.render.test.tsx +134 -0
- package/src/react/components/PriceBadge.tsx +49 -0
- package/src/react/components/PriceCard.render.test.tsx +135 -0
- package/src/react/components/PriceCard.tsx +83 -0
- package/src/react/components/PricePicker.tsx +95 -0
- package/src/react/components/SplitBreakdown.render.test.tsx +168 -0
- package/src/react/components/SplitBreakdown.tsx +121 -0
- package/src/react/components/StripeProvider.test.ts +45 -0
- package/src/react/components/StripeProvider.tsx +80 -0
- package/src/react/components/StripeProviderWithKey.tsx +95 -0
- package/src/react/components/SubscriptionActions.tsx +79 -0
- package/src/react/components/SubscriptionCard.tsx +92 -0
- package/src/react/components/SubscriptionLineItems.tsx +62 -0
- package/src/react/components/TrialAlert.render.test.tsx +132 -0
- package/src/react/components/TrialAlert.tsx +44 -0
- package/src/react/hooks/skipSentinel.test.ts +85 -0
- package/src/react/hooks/useAccount.ts +28 -0
- package/src/react/hooks/useAccountOnboarding.test.ts +75 -0
- package/src/react/hooks/useAccountOnboarding.ts +35 -0
- package/src/react/hooks/useCheckout.ts +33 -0
- package/src/react/hooks/useCheckoutSession.ts +110 -0
- package/src/react/hooks/useConfirmPayment.ts +117 -0
- package/src/react/hooks/useDisputeWithCountdown.test.ts +90 -0
- package/src/react/hooks/useDisputeWithCountdown.ts +48 -0
- package/src/react/hooks/useDisputes.test.ts +75 -0
- package/src/react/hooks/useDisputes.ts +28 -0
- package/src/react/hooks/useEarnings.test.ts +159 -0
- package/src/react/hooks/useEarnings.ts +132 -0
- package/src/react/hooks/useInvoices.test.ts +79 -0
- package/src/react/hooks/useInvoices.ts +25 -0
- package/src/react/hooks/usePaymentMethodActions.ts +206 -0
- package/src/react/hooks/usePaymentMethods.ts +44 -0
- package/src/react/hooks/usePrices.ts +26 -0
- package/src/react/hooks/useProducts.test.ts +75 -0
- package/src/react/hooks/useProducts.ts +24 -0
- package/src/react/hooks/useSplitBreakdown.test.ts +151 -0
- package/src/react/hooks/useSplitBreakdown.ts +118 -0
- package/src/react/hooks/useStripeConfig.ts +31 -0
- package/src/react/hooks/useStripeMode.test.ts +49 -0
- package/src/react/hooks/useStripeMode.ts +9 -0
- package/src/react/hooks/useStripePublishableKey.test.ts +35 -0
- package/src/react/hooks/useStripePublishableKey.ts +9 -0
- package/src/react/hooks/useSubscription.ts +52 -0
- package/src/react/hooks/useSubscriptions.ts +33 -0
- package/src/react/index.payment-element.test.ts +41 -0
- package/src/react/index.test.ts +167 -0
- package/src/react/index.ts +279 -0
- package/src/react/lib/connect-requirement-keys.test.ts +73 -0
- package/src/react/lib/connect-requirement-keys.ts +66 -0
- package/src/react/lib/price-helpers.test.ts +199 -0
- package/src/react/lib/price-helpers.ts +68 -0
- package/src/react/lib/stripe-element-styles.test.ts +94 -0
- package/src/react/lib/stripe-element-styles.ts +178 -0
- package/src/react/lib/subscription-helpers.test.ts +127 -0
- package/src/react/lib/subscription-helpers.ts +64 -0
- package/src/react/types.ts +32 -0
- package/src/test.ts +5 -0
- package/src/testing/assert-test-env.test.ts +33 -0
- package/src/testing/assert-test-env.ts +20 -0
- package/src/testing/fixtures.ts +95 -0
- package/src/testing/index.ts +13 -0
- package/src/testing/mock-webhooks.test.ts +97 -0
- package/src/testing/mock-webhooks.ts +101 -0
- package/src/vite-env.d.ts +4 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export function deriveAccountStatus(account) {
|
|
2
|
+
const requirements = account.requirements;
|
|
3
|
+
const entries = requirements?.entries ?? [];
|
|
4
|
+
// V2 requirements use entries[].description as the requirement identifier
|
|
5
|
+
const missingRequirements = Array.from(new Set(entries
|
|
6
|
+
.map((entry) => entry.description)
|
|
7
|
+
.filter((value) => typeof value === "string")));
|
|
8
|
+
// Check deadline status for disabled-like conditions
|
|
9
|
+
const deadlineStatus = requirements?.summary?.minimum_deadline?.status;
|
|
10
|
+
if (deadlineStatus === "past_due") {
|
|
11
|
+
return {
|
|
12
|
+
onboardingStatus: "restricted",
|
|
13
|
+
missingRequirements,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
// Check if any entry has capability restrictions
|
|
17
|
+
const hasRestrictingImpact = entries.some((entry) => (entry.impact?.restricts_capabilities?.length ?? 0) > 0 &&
|
|
18
|
+
entry.awaiting_action_from === "user");
|
|
19
|
+
if (hasRestrictingImpact && missingRequirements.length > 0) {
|
|
20
|
+
return {
|
|
21
|
+
onboardingStatus: "restricted",
|
|
22
|
+
missingRequirements,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
if (missingRequirements.length > 0) {
|
|
26
|
+
return {
|
|
27
|
+
onboardingStatus: "in_progress",
|
|
28
|
+
missingRequirements,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const configuration = account.configuration;
|
|
32
|
+
if (!configuration) {
|
|
33
|
+
return {
|
|
34
|
+
onboardingStatus: "pending",
|
|
35
|
+
missingRequirements,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
// V2 configurations use `applied: boolean` to indicate active state
|
|
39
|
+
const configs = [
|
|
40
|
+
configuration.customer,
|
|
41
|
+
configuration.merchant,
|
|
42
|
+
configuration.recipient,
|
|
43
|
+
].filter(Boolean);
|
|
44
|
+
if (configs.length === 0) {
|
|
45
|
+
return {
|
|
46
|
+
onboardingStatus: "pending",
|
|
47
|
+
missingRequirements,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const allApplied = configs.every((cfg) => cfg?.applied === true);
|
|
51
|
+
return {
|
|
52
|
+
onboardingStatus: allApplied ? "complete" : "in_progress",
|
|
53
|
+
missingRequirements,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=accountStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountStatus.js","sourceRoot":"","sources":["../../../src/client/core/accountStatus.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,mBAAmB,CAAC,OAA0B;IAI5D,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAC1C,MAAM,OAAO,GAAG,YAAY,EAAE,OAAO,IAAI,EAAE,CAAC;IAE5C,0EAA0E;IAC1E,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CACpC,IAAI,GAAG,CACL,OAAO;SACJ,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC;SACjC,MAAM,CAAC,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CACjE,CACF,CAAC;IAEF,qDAAqD;IACrD,MAAM,cAAc,GAAG,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,CAAC;IACvE,IAAI,cAAc,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO;YACL,gBAAgB,EAAE,YAAY;YAC9B,mBAAmB;SACpB,CAAC;IACJ,CAAC;IAED,iDAAiD;IACjD,MAAM,oBAAoB,GAAG,OAAO,CAAC,IAAI,CACvC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3
|
+
import type { V2AccountUpdateParams, V2AccountRetrieveInclude } from "../stripe-types.js";
|
|
4
|
+
import type { StripeComponentAccount } from "../types.js";
|
|
5
|
+
export declare function createAccount(stripe: Stripe, component: Component, ctx: RunCtx, opts: {
|
|
6
|
+
userId: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
country?: string;
|
|
10
|
+
orgId?: string;
|
|
11
|
+
metadata?: Record<string, string>;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
accountId: any;
|
|
14
|
+
stripeAccountId: string;
|
|
15
|
+
}>;
|
|
16
|
+
/**
|
|
17
|
+
* Default V2 account configuration: merchant with card_payments.
|
|
18
|
+
*/
|
|
19
|
+
export declare const DEFAULT_ACCOUNT_CONFIGURATION: Record<string, unknown>;
|
|
20
|
+
export declare const DEFAULT_ACCOUNT_DEFAULTS: Record<string, unknown>;
|
|
21
|
+
export declare function createAccountWithOnboarding(stripe: Stripe, component: Component, ctx: RunCtx, opts: {
|
|
22
|
+
userId: string;
|
|
23
|
+
email?: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
country: string;
|
|
26
|
+
orgId?: string;
|
|
27
|
+
metadata?: Record<string, string>;
|
|
28
|
+
refreshUrl: string;
|
|
29
|
+
returnUrl: string;
|
|
30
|
+
accountConfiguration?: Record<string, unknown>;
|
|
31
|
+
accountDefaults?: Record<string, unknown>;
|
|
32
|
+
dashboard?: "express" | "full" | "none";
|
|
33
|
+
}): Promise<{
|
|
34
|
+
stripeAccountId: string;
|
|
35
|
+
onboardingUrl: string;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function getAccount(component: Component, ctx: RunCtx, opts: {
|
|
38
|
+
accountId: string;
|
|
39
|
+
}): Promise<StripeComponentAccount | null>;
|
|
40
|
+
export declare function getOrCreateAccount(stripe: Stripe, component: Component, ctx: RunCtx, opts: {
|
|
41
|
+
userId: string;
|
|
42
|
+
email?: string;
|
|
43
|
+
name?: string;
|
|
44
|
+
country?: string;
|
|
45
|
+
orgId?: string;
|
|
46
|
+
metadata?: Record<string, string>;
|
|
47
|
+
}): Promise<{
|
|
48
|
+
accountId: any;
|
|
49
|
+
stripeAccountId: any;
|
|
50
|
+
isNew: boolean;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Ensure a shopper has a V2 account with the `customer` configuration applied,
|
|
54
|
+
* creating the account if needed (BTS-18). Idempotent: an account that already
|
|
55
|
+
* has the customer configuration is returned untouched, and other
|
|
56
|
+
* configurations (e.g. `merchant`) are preserved — embodying the "one V2
|
|
57
|
+
* account, configurations accrue" model. Returns the buyer's `stripeAccountId`
|
|
58
|
+
* to pass as `customer_account` on checkout/subscriptions.
|
|
59
|
+
*/
|
|
60
|
+
export declare function ensureCustomerAccount(stripe: Stripe, component: Component, ctx: RunCtx, opts: {
|
|
61
|
+
userId: string;
|
|
62
|
+
email?: string;
|
|
63
|
+
name?: string;
|
|
64
|
+
country?: string;
|
|
65
|
+
orgId?: string;
|
|
66
|
+
metadata?: Record<string, string>;
|
|
67
|
+
}): Promise<{
|
|
68
|
+
stripeAccountId: string;
|
|
69
|
+
accountId: string | null;
|
|
70
|
+
appliedConfigurations: string[];
|
|
71
|
+
isNew: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
export declare function getAccountByUserId(component: Component, ctx: RunCtx, opts: {
|
|
74
|
+
userId: string;
|
|
75
|
+
}): Promise<StripeComponentAccount | null>;
|
|
76
|
+
export declare function getAccountByOrgId(component: Component, ctx: RunCtx, opts: {
|
|
77
|
+
orgId: string;
|
|
78
|
+
}): Promise<StripeComponentAccount | null>;
|
|
79
|
+
export declare function getAccountByStripeId(component: Component, ctx: RunCtx, opts: {
|
|
80
|
+
stripeAccountId: string;
|
|
81
|
+
}): Promise<StripeComponentAccount | null>;
|
|
82
|
+
export declare function getAccountOnboardingStatus(component: Component, ctx: RunCtx, opts: {
|
|
83
|
+
accountId: string;
|
|
84
|
+
}): Promise<any>;
|
|
85
|
+
export declare function upsertAccount(component: Component, ctx: RunCtx, opts: {
|
|
86
|
+
stripeAccountId: string;
|
|
87
|
+
userId: string;
|
|
88
|
+
orgId?: string;
|
|
89
|
+
email?: string;
|
|
90
|
+
name?: string;
|
|
91
|
+
country?: string;
|
|
92
|
+
capabilities?: Record<string, unknown>;
|
|
93
|
+
requirements?: Record<string, unknown>;
|
|
94
|
+
configuration?: Record<string, unknown>;
|
|
95
|
+
onboardingStatus?: "pending" | "in_progress" | "complete" | "restricted";
|
|
96
|
+
missingRequirements?: string[];
|
|
97
|
+
metadata?: Record<string, unknown>;
|
|
98
|
+
}): Promise<null>;
|
|
99
|
+
/**
|
|
100
|
+
* Store (or clear, with `null`) a per-store statement-descriptor suffix on the
|
|
101
|
+
* seller's component account record (BTS-32). Validated against Stripe's
|
|
102
|
+
* descriptor rules before writing; destination charges to this account then
|
|
103
|
+
* carry the suffix so buyers recognize the store on their card statement.
|
|
104
|
+
*/
|
|
105
|
+
export declare function setAccountStatementDescriptor(component: Component, ctx: RunCtx, opts: {
|
|
106
|
+
stripeAccountId: string;
|
|
107
|
+
statementDescriptor: string | null;
|
|
108
|
+
}): Promise<{
|
|
109
|
+
success: boolean;
|
|
110
|
+
}>;
|
|
111
|
+
export declare function updateAccount(stripe: Stripe, _ctx: RunCtx, opts: {
|
|
112
|
+
stripeAccountId: string;
|
|
113
|
+
email?: string;
|
|
114
|
+
name?: string;
|
|
115
|
+
metadata?: Record<string, string>;
|
|
116
|
+
}): Promise<{
|
|
117
|
+
success: boolean;
|
|
118
|
+
}>;
|
|
119
|
+
export declare function getV2Account(stripe: Stripe, _ctx: RunCtx, opts: {
|
|
120
|
+
stripeAccountId: string;
|
|
121
|
+
include?: V2AccountRetrieveInclude[];
|
|
122
|
+
}): Promise<Stripe.V2.Core.Account>;
|
|
123
|
+
export declare function updateV2Account(stripe: Stripe, _ctx: RunCtx, opts: {
|
|
124
|
+
stripeAccountId: string;
|
|
125
|
+
updateParams: V2AccountUpdateParams;
|
|
126
|
+
}): Promise<Stripe.V2.Core.Account>;
|
|
127
|
+
export declare function listStripeAccounts(stripe: Stripe, _ctx: RunCtx, opts?: {
|
|
128
|
+
limit?: number;
|
|
129
|
+
}): Promise<Stripe.V2.Core.Account[]>;
|
|
130
|
+
export declare function closeAccount(stripe: Stripe, component: Component, ctx: RunCtx, opts: {
|
|
131
|
+
stripeAccountId: string;
|
|
132
|
+
}): Promise<{
|
|
133
|
+
closed: boolean;
|
|
134
|
+
}>;
|
|
135
|
+
export declare function restartAccountOnboarding(stripe: Stripe, component: Component, ctx: RunCtx, opts: {
|
|
136
|
+
stripeAccountId: string;
|
|
137
|
+
}): Promise<{
|
|
138
|
+
closed: boolean;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Default V2 customer configuration. Applying the customer configuration is
|
|
142
|
+
* what makes a V2 Account billable — the customer-facing payment/billing flows
|
|
143
|
+
* (subscriptions, invoices, billing portal). In the V2 Accounts API a single
|
|
144
|
+
* Account with this configuration replaces the legacy V1 Customer object, so
|
|
145
|
+
* `customer_account: acct_…` is what you pass to subscriptions, setup intents,
|
|
146
|
+
* and billing-portal sessions. No capabilities are requested by default;
|
|
147
|
+
* request `customer.capabilities.automatic_indirect_tax` separately if you need
|
|
148
|
+
* automatic tax on this account's invoices/subscriptions.
|
|
149
|
+
*/
|
|
150
|
+
export declare const DEFAULT_CUSTOMER_CONFIGURATION: Record<string, unknown>;
|
|
151
|
+
/**
|
|
152
|
+
* Apply the customer configuration to an existing V2 Account, making it
|
|
153
|
+
* billable, and record the resulting applied configurations on the component
|
|
154
|
+
* account. The account must already exist in the component DB (e.g. created via
|
|
155
|
+
* `createAccount`); its owning `userId` is recovered from that record.
|
|
156
|
+
*/
|
|
157
|
+
export declare function addCustomerConfiguration(stripe: Stripe, component: Component, ctx: RunCtx, opts: {
|
|
158
|
+
stripeAccountId: string;
|
|
159
|
+
}): Promise<{
|
|
160
|
+
success: true;
|
|
161
|
+
appliedConfigurations: string[];
|
|
162
|
+
}>;
|
|
163
|
+
/**
|
|
164
|
+
* Apply the V2 recipient configuration to an existing account, and record the
|
|
165
|
+
* resulting applied configurations on the component account. The account must
|
|
166
|
+
* already exist in the component DB (e.g. from {@link createAccount}); its
|
|
167
|
+
* owning `userId` is recovered from that record, matching
|
|
168
|
+
* {@link addCustomerConfiguration}.
|
|
169
|
+
*/
|
|
170
|
+
export declare function addRecipientConfiguration(stripe: Stripe, component: Component, ctx: RunCtx, opts: {
|
|
171
|
+
stripeAccountId: string;
|
|
172
|
+
}): Promise<{
|
|
173
|
+
success: true;
|
|
174
|
+
appliedConfigurations: string[];
|
|
175
|
+
}>;
|
|
176
|
+
export declare function syncAllAccounts(stripe: Stripe, component: Component, ctx: RunCtx): Promise<{
|
|
177
|
+
synced: number;
|
|
178
|
+
errors: string[];
|
|
179
|
+
errorCount: number;
|
|
180
|
+
}>;
|
|
181
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../../src/client/core/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAEjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,KAAK,EAEV,qBAAqB,EACrB,wBAAwB,EAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAS1D,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,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AA8B,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAElE,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,GAChC,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,qBAAqB,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAgC7D;AAED;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,GAChC,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,qBAAqB,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA2C7D;AAMD,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM;;;;GAoDZ"}
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { runMutationOrThrow } from "../helpers.js";
|
|
2
|
+
import { throwStripeError } from "../errors.js";
|
|
3
|
+
import { componentRef } from "../webhooks/helpers.js";
|
|
4
|
+
import { validateStatementDescriptorSuffix } from "./descriptors.js";
|
|
5
|
+
import { deriveAccountStatus } from "./accountStatus.js";
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Account CRUD
|
|
8
|
+
// =============================================================================
|
|
9
|
+
export async function createAccount(stripe, component, ctx, opts) {
|
|
10
|
+
const metadata = {
|
|
11
|
+
...(opts.metadata ?? {}),
|
|
12
|
+
userId: opts.userId,
|
|
13
|
+
...(opts.orgId ? { orgId: opts.orgId } : {}),
|
|
14
|
+
};
|
|
15
|
+
const createParams = {
|
|
16
|
+
contact_email: opts.email,
|
|
17
|
+
metadata,
|
|
18
|
+
};
|
|
19
|
+
if (opts.country) {
|
|
20
|
+
createParams.identity = {
|
|
21
|
+
country: opts.country,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const account = await stripe.v2.core.accounts.create(createParams);
|
|
25
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/upsertAccount"), {
|
|
26
|
+
stripeAccountId: account.id,
|
|
27
|
+
userId: opts.userId,
|
|
28
|
+
orgId: opts.orgId,
|
|
29
|
+
email: opts.email,
|
|
30
|
+
name: opts.name,
|
|
31
|
+
country: opts.country,
|
|
32
|
+
appliedConfigurations: [],
|
|
33
|
+
onboardingStatus: "pending",
|
|
34
|
+
metadata,
|
|
35
|
+
});
|
|
36
|
+
const stored = await ctx.runQuery(componentRef(component, "core/queries/getAccountByStripeId"), { stripeAccountId: account.id });
|
|
37
|
+
return {
|
|
38
|
+
accountId: stored?._id ?? null,
|
|
39
|
+
stripeAccountId: account.id,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Default V2 account configuration: merchant with card_payments.
|
|
44
|
+
*/
|
|
45
|
+
export const DEFAULT_ACCOUNT_CONFIGURATION = {
|
|
46
|
+
merchant: {
|
|
47
|
+
capabilities: { card_payments: { requested: true } },
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
export const DEFAULT_ACCOUNT_DEFAULTS = {
|
|
51
|
+
responsibilities: {
|
|
52
|
+
losses_collector: "application",
|
|
53
|
+
fees_collector: "application",
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
export async function createAccountWithOnboarding(stripe, component, ctx, opts) {
|
|
57
|
+
const result = await createAccount(stripe, component, ctx, {
|
|
58
|
+
userId: opts.userId,
|
|
59
|
+
email: opts.email,
|
|
60
|
+
name: opts.name,
|
|
61
|
+
country: opts.country,
|
|
62
|
+
orgId: opts.orgId,
|
|
63
|
+
metadata: opts.metadata,
|
|
64
|
+
});
|
|
65
|
+
const configuration = opts.accountConfiguration ?? DEFAULT_ACCOUNT_CONFIGURATION;
|
|
66
|
+
const defaults = opts.accountDefaults ?? DEFAULT_ACCOUNT_DEFAULTS;
|
|
67
|
+
try {
|
|
68
|
+
// Apply configuration — this must succeed for onboarding to work correctly
|
|
69
|
+
await stripe.v2.core.accounts.update(result.stripeAccountId, {
|
|
70
|
+
configuration,
|
|
71
|
+
dashboard: opts.dashboard ?? "express",
|
|
72
|
+
defaults,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (configError) {
|
|
76
|
+
// Roll back: delete the half-created account from Convex so retries
|
|
77
|
+
// don't get stuck on an unusable pending account
|
|
78
|
+
try {
|
|
79
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/deleteAccountByStripeId"), { stripeAccountId: result.stripeAccountId });
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
// Best effort cleanup
|
|
83
|
+
}
|
|
84
|
+
throwStripeError("ACCOUNT_CREATE_FAILED", "Failed to apply account configuration after create; account was rolled back", configError);
|
|
85
|
+
}
|
|
86
|
+
// Re-fetch account to get actual applied_configurations from Stripe
|
|
87
|
+
const updatedAccount = await stripe.v2.core.accounts.retrieve(result.stripeAccountId);
|
|
88
|
+
const appliedConfigs = updatedAccount.applied_configurations ?? [];
|
|
89
|
+
// Update our DB with the applied configurations
|
|
90
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/upsertAccount"), {
|
|
91
|
+
stripeAccountId: result.stripeAccountId,
|
|
92
|
+
userId: opts.userId,
|
|
93
|
+
appliedConfigurations: appliedConfigs,
|
|
94
|
+
onboardingStatus: "in_progress",
|
|
95
|
+
});
|
|
96
|
+
const accountLink = await stripe.accountLinks.create({
|
|
97
|
+
account: result.stripeAccountId,
|
|
98
|
+
refresh_url: opts.refreshUrl,
|
|
99
|
+
return_url: opts.returnUrl,
|
|
100
|
+
type: "account_onboarding",
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
stripeAccountId: result.stripeAccountId,
|
|
104
|
+
onboardingUrl: accountLink.url,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
export async function getAccount(component, ctx, opts) {
|
|
108
|
+
return (await ctx.runQuery(componentRef(component, "core/queries/getAccount"), opts));
|
|
109
|
+
}
|
|
110
|
+
export async function getOrCreateAccount(stripe, component, ctx, opts) {
|
|
111
|
+
const existing = opts.orgId
|
|
112
|
+
? await ctx.runQuery(componentRef(component, "core/queries/getAccountByOrgId"), {
|
|
113
|
+
orgId: opts.orgId,
|
|
114
|
+
})
|
|
115
|
+
: await ctx.runQuery(componentRef(component, "core/queries/getAccountByUserId"), {
|
|
116
|
+
userId: opts.userId,
|
|
117
|
+
});
|
|
118
|
+
if (existing) {
|
|
119
|
+
return {
|
|
120
|
+
accountId: existing._id,
|
|
121
|
+
stripeAccountId: existing.stripeAccountId,
|
|
122
|
+
isNew: false,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const result = await createAccount(stripe, component, ctx, opts);
|
|
126
|
+
return { ...result, isNew: true };
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Ensure a shopper has a V2 account with the `customer` configuration applied,
|
|
130
|
+
* creating the account if needed (BTS-18). Idempotent: an account that already
|
|
131
|
+
* has the customer configuration is returned untouched, and other
|
|
132
|
+
* configurations (e.g. `merchant`) are preserved — embodying the "one V2
|
|
133
|
+
* account, configurations accrue" model. Returns the buyer's `stripeAccountId`
|
|
134
|
+
* to pass as `customer_account` on checkout/subscriptions.
|
|
135
|
+
*/
|
|
136
|
+
export async function ensureCustomerAccount(stripe, component, ctx, opts) {
|
|
137
|
+
const account = await getOrCreateAccount(stripe, component, ctx, opts);
|
|
138
|
+
// A freshly-created account has no applied configurations yet; an existing one
|
|
139
|
+
// may already have `customer` (and others). Only apply when missing.
|
|
140
|
+
let appliedConfigurations = [];
|
|
141
|
+
if (!account.isNew) {
|
|
142
|
+
const doc = (await ctx.runQuery(componentRef(component, "core/queries/getAccountByStripeId"), { stripeAccountId: account.stripeAccountId }));
|
|
143
|
+
appliedConfigurations = doc?.appliedConfigurations ?? [];
|
|
144
|
+
}
|
|
145
|
+
if (!appliedConfigurations.includes("customer")) {
|
|
146
|
+
const res = await addCustomerConfiguration(stripe, component, ctx, {
|
|
147
|
+
stripeAccountId: account.stripeAccountId,
|
|
148
|
+
});
|
|
149
|
+
appliedConfigurations = res.appliedConfigurations;
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
stripeAccountId: account.stripeAccountId,
|
|
153
|
+
accountId: account.accountId ?? null,
|
|
154
|
+
appliedConfigurations,
|
|
155
|
+
isNew: account.isNew,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
export async function getAccountByUserId(component, ctx, opts) {
|
|
159
|
+
return (await ctx.runQuery(componentRef(component, "core/queries/getAccountByUserId"), opts));
|
|
160
|
+
}
|
|
161
|
+
export async function getAccountByOrgId(component, ctx, opts) {
|
|
162
|
+
return (await ctx.runQuery(componentRef(component, "core/queries/getAccountByOrgId"), opts));
|
|
163
|
+
}
|
|
164
|
+
export async function getAccountByStripeId(component, ctx, opts) {
|
|
165
|
+
return (await ctx.runQuery(componentRef(component, "core/queries/getAccountByStripeId"), opts));
|
|
166
|
+
}
|
|
167
|
+
export async function getAccountOnboardingStatus(component, ctx, opts) {
|
|
168
|
+
return ctx.runQuery(componentRef(component, "core/queries/getAccountOnboardingStatus"), opts);
|
|
169
|
+
}
|
|
170
|
+
export async function upsertAccount(component, ctx, opts) {
|
|
171
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/upsertAccount"), opts);
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Store (or clear, with `null`) a per-store statement-descriptor suffix on the
|
|
176
|
+
* seller's component account record (BTS-32). Validated against Stripe's
|
|
177
|
+
* descriptor rules before writing; destination charges to this account then
|
|
178
|
+
* carry the suffix so buyers recognize the store on their card statement.
|
|
179
|
+
*/
|
|
180
|
+
export async function setAccountStatementDescriptor(component, ctx, opts) {
|
|
181
|
+
const statementDescriptor = opts.statementDescriptor === null
|
|
182
|
+
? null
|
|
183
|
+
: validateStatementDescriptorSuffix(opts.statementDescriptor);
|
|
184
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/setStatementDescriptor"), { stripeAccountId: opts.stripeAccountId, statementDescriptor });
|
|
185
|
+
return { success: true };
|
|
186
|
+
}
|
|
187
|
+
export async function updateAccount(stripe, _ctx, opts) {
|
|
188
|
+
const updateParams = {};
|
|
189
|
+
if (opts.email)
|
|
190
|
+
updateParams.contact_email = opts.email;
|
|
191
|
+
if (opts.metadata)
|
|
192
|
+
updateParams.metadata = opts.metadata;
|
|
193
|
+
await stripe.v2.core.accounts.update(opts.stripeAccountId, updateParams);
|
|
194
|
+
return { success: true };
|
|
195
|
+
}
|
|
196
|
+
export async function getV2Account(stripe, _ctx, opts) {
|
|
197
|
+
return await stripe.v2.core.accounts.retrieve(opts.stripeAccountId, {
|
|
198
|
+
include: opts.include,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
export async function updateV2Account(stripe, _ctx, opts) {
|
|
202
|
+
return await stripe.v2.core.accounts.update(opts.stripeAccountId, opts.updateParams);
|
|
203
|
+
}
|
|
204
|
+
export async function listStripeAccounts(stripe, _ctx, opts) {
|
|
205
|
+
const accounts = [];
|
|
206
|
+
for await (const account of stripe.v2.core.accounts.list({
|
|
207
|
+
limit: opts?.limit ?? 100,
|
|
208
|
+
})) {
|
|
209
|
+
accounts.push(account);
|
|
210
|
+
}
|
|
211
|
+
return accounts;
|
|
212
|
+
}
|
|
213
|
+
export async function closeAccount(stripe, component, ctx, opts) {
|
|
214
|
+
// First check our DB for stored applied_configurations
|
|
215
|
+
let appliedConfigs = [];
|
|
216
|
+
const dbAccount = await ctx.runQuery(componentRef(component, "core/queries/getAccountByStripeId"), { stripeAccountId: opts.stripeAccountId });
|
|
217
|
+
if (dbAccount?.appliedConfigurations) {
|
|
218
|
+
appliedConfigs = dbAccount.appliedConfigurations;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
// Fallback: fetch from Stripe
|
|
222
|
+
try {
|
|
223
|
+
const stripeAccount = await stripe.v2.core.accounts.retrieve(opts.stripeAccountId);
|
|
224
|
+
appliedConfigs = stripeAccount.applied_configurations ?? [];
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
// Account may not exist on Stripe
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// Close the account on Stripe — must pass all applied_configurations
|
|
231
|
+
// See: https://docs.stripe.com/api/v2/core/accounts/close
|
|
232
|
+
await stripe.v2.core.accounts.close(opts.stripeAccountId, {
|
|
233
|
+
applied_configurations: appliedConfigs,
|
|
234
|
+
});
|
|
235
|
+
// Only remove from component DB after Stripe close succeeds
|
|
236
|
+
// This prevents Convex/Stripe getting out of sync if close fails
|
|
237
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/deleteAccountByStripeId"), { stripeAccountId: opts.stripeAccountId });
|
|
238
|
+
return { closed: true };
|
|
239
|
+
}
|
|
240
|
+
export async function restartAccountOnboarding(stripe, component, ctx, opts) {
|
|
241
|
+
return closeAccount(stripe, component, ctx, opts);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Default V2 customer configuration. Applying the customer configuration is
|
|
245
|
+
* what makes a V2 Account billable — the customer-facing payment/billing flows
|
|
246
|
+
* (subscriptions, invoices, billing portal). In the V2 Accounts API a single
|
|
247
|
+
* Account with this configuration replaces the legacy V1 Customer object, so
|
|
248
|
+
* `customer_account: acct_…` is what you pass to subscriptions, setup intents,
|
|
249
|
+
* and billing-portal sessions. No capabilities are requested by default;
|
|
250
|
+
* request `customer.capabilities.automatic_indirect_tax` separately if you need
|
|
251
|
+
* automatic tax on this account's invoices/subscriptions.
|
|
252
|
+
*/
|
|
253
|
+
export const DEFAULT_CUSTOMER_CONFIGURATION = {
|
|
254
|
+
customer: {},
|
|
255
|
+
};
|
|
256
|
+
/**
|
|
257
|
+
* Apply the customer configuration to an existing V2 Account, making it
|
|
258
|
+
* billable, and record the resulting applied configurations on the component
|
|
259
|
+
* account. The account must already exist in the component DB (e.g. created via
|
|
260
|
+
* `createAccount`); its owning `userId` is recovered from that record.
|
|
261
|
+
*/
|
|
262
|
+
export async function addCustomerConfiguration(stripe, component, ctx, opts) {
|
|
263
|
+
const existing = (await ctx.runQuery(componentRef(component, "core/queries/getAccountByStripeId"), { stripeAccountId: opts.stripeAccountId }));
|
|
264
|
+
if (!existing) {
|
|
265
|
+
throwStripeError("ACCOUNT_NOT_FOUND", `No component account found for ${opts.stripeAccountId}; create it before applying the customer configuration`);
|
|
266
|
+
}
|
|
267
|
+
await stripe.v2.core.accounts.update(opts.stripeAccountId, {
|
|
268
|
+
configuration: DEFAULT_CUSTOMER_CONFIGURATION,
|
|
269
|
+
});
|
|
270
|
+
// Re-fetch to record the configurations Stripe actually applied
|
|
271
|
+
const updated = await stripe.v2.core.accounts.retrieve(opts.stripeAccountId);
|
|
272
|
+
const appliedConfigurations = updated.applied_configurations ?? [];
|
|
273
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/upsertAccount"), {
|
|
274
|
+
stripeAccountId: opts.stripeAccountId,
|
|
275
|
+
userId: existing.userId,
|
|
276
|
+
appliedConfigurations,
|
|
277
|
+
});
|
|
278
|
+
return { success: true, appliedConfigurations };
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Apply the V2 recipient configuration to an existing account, and record the
|
|
282
|
+
* resulting applied configurations on the component account. The account must
|
|
283
|
+
* already exist in the component DB (e.g. from {@link createAccount}); its
|
|
284
|
+
* owning `userId` is recovered from that record, matching
|
|
285
|
+
* {@link addCustomerConfiguration}.
|
|
286
|
+
*/
|
|
287
|
+
export async function addRecipientConfiguration(stripe, component, ctx, opts) {
|
|
288
|
+
const existing = (await ctx.runQuery(componentRef(component, "core/queries/getAccountByStripeId"), { stripeAccountId: opts.stripeAccountId }));
|
|
289
|
+
if (!existing) {
|
|
290
|
+
throwStripeError("ACCOUNT_NOT_FOUND", `No component account found for ${opts.stripeAccountId}; create it before applying the recipient configuration`);
|
|
291
|
+
}
|
|
292
|
+
await stripe.v2.core.accounts.update(opts.stripeAccountId, {
|
|
293
|
+
configuration: {
|
|
294
|
+
recipient: {
|
|
295
|
+
// V2 (API 2026-05-27.dahlia) requires the `capabilities` wrapper with an
|
|
296
|
+
// explicit `requested: true`. The bare `recipient.stripe_balance` shape
|
|
297
|
+
// is rejected with "Unknown field" (confirmed against the Stripe sandbox).
|
|
298
|
+
capabilities: {
|
|
299
|
+
stripe_balance: {
|
|
300
|
+
stripe_transfers: { requested: true },
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
// Re-fetch to record the configurations Stripe actually applied
|
|
307
|
+
const updated = await stripe.v2.core.accounts.retrieve(opts.stripeAccountId);
|
|
308
|
+
const appliedConfigurations = updated.applied_configurations ?? [];
|
|
309
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/upsertAccount"), {
|
|
310
|
+
stripeAccountId: opts.stripeAccountId,
|
|
311
|
+
userId: existing.userId,
|
|
312
|
+
appliedConfigurations,
|
|
313
|
+
});
|
|
314
|
+
return { success: true, appliedConfigurations };
|
|
315
|
+
}
|
|
316
|
+
// =============================================================================
|
|
317
|
+
// Sync
|
|
318
|
+
// =============================================================================
|
|
319
|
+
export async function syncAllAccounts(stripe, component, ctx) {
|
|
320
|
+
let synced = 0;
|
|
321
|
+
const errors = [];
|
|
322
|
+
for await (const account of stripe.v2.core.accounts.list({ limit: 20 })) {
|
|
323
|
+
try {
|
|
324
|
+
const identity = account.identity;
|
|
325
|
+
const metadata = (account.metadata ?? {});
|
|
326
|
+
const userId = metadata.userId ?? metadata.user_id ?? account.id;
|
|
327
|
+
const orgId = metadata.orgId ?? metadata.org_id ?? undefined;
|
|
328
|
+
const { onboardingStatus, missingRequirements } = deriveAccountStatus(account);
|
|
329
|
+
// V2 Account uses contact_email at account level, individual.email in identity
|
|
330
|
+
const email = account.contact_email ?? identity?.individual?.email ?? undefined;
|
|
331
|
+
// V2 uses registered_name for business, given_name + surname for individual
|
|
332
|
+
const name = identity?.business_details?.registered_name ??
|
|
333
|
+
(identity?.individual
|
|
334
|
+
? [identity.individual.given_name, identity.individual.surname]
|
|
335
|
+
.filter(Boolean)
|
|
336
|
+
.join(" ") || undefined
|
|
337
|
+
: undefined);
|
|
338
|
+
await runMutationOrThrow(ctx, componentRef(component, "core/mutations/upsertAccount"), {
|
|
339
|
+
stripeAccountId: account.id,
|
|
340
|
+
userId,
|
|
341
|
+
orgId,
|
|
342
|
+
email,
|
|
343
|
+
name,
|
|
344
|
+
country: identity?.country ?? undefined,
|
|
345
|
+
configuration: account.configuration ?? undefined,
|
|
346
|
+
requirements: account.requirements ?? undefined,
|
|
347
|
+
onboardingStatus,
|
|
348
|
+
missingRequirements,
|
|
349
|
+
metadata,
|
|
350
|
+
});
|
|
351
|
+
synced++;
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
errors.push(`Account ${account.id}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return { synced, errors, errorCount: errors.length };
|
|
358
|
+
}
|
|
359
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../../src/client/core/accounts.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,iCAAiC,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,gFAAgF;AAChF,eAAe;AACf,gFAAg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OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Component, RunCtx } from "../helpers.js";
|
|
2
|
+
import type { StripeMode } from "../utils/stripeDashboardUrl.js";
|
|
3
|
+
export declare function getPublishableKey(component: Component, ctx: RunCtx): Promise<string | null>;
|
|
4
|
+
export declare function getStripeMode(component: Component, ctx: RunCtx): Promise<StripeMode>;
|
|
5
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/client/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAOjE,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKxB;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,CAAC,CAKrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { componentRef } from "../webhooks/helpers.js";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// Configuration methods
|
|
4
|
+
// =============================================================================
|
|
5
|
+
export async function getPublishableKey(component, ctx) {
|
|
6
|
+
return (await ctx.runQuery(componentRef(component, "core/queries/getPublishableKey"), {}));
|
|
7
|
+
}
|
|
8
|
+
export async function getStripeMode(component, ctx) {
|
|
9
|
+
return (await ctx.runQuery(componentRef(component, "core/queries/getStripeMode"), {}));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=config.js.map
|