@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,304 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { query } from "../_generated/server";
|
|
3
|
+
import { checkoutSessionDocValidator, checkoutSessionStatusValidator, invoiceDocValidator, invoiceStatusValidator, subscriptionDocValidator, subscriptionFields, subscriptionStatusValidator, } from "./validators";
|
|
4
|
+
// =============================================================================
|
|
5
|
+
// SUBSCRIPTION QUERIES
|
|
6
|
+
// =============================================================================
|
|
7
|
+
export const getSubscription = query({
|
|
8
|
+
args: { subscriptionId: v.id("subscriptions") },
|
|
9
|
+
returns: v.union(subscriptionDocValidator, v.null()),
|
|
10
|
+
handler: async (ctx, args) => {
|
|
11
|
+
return await ctx.db.get("subscriptions", args.subscriptionId);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
export const getSubscriptionByStripeId = query({
|
|
15
|
+
args: { stripeSubscriptionId: v.string() },
|
|
16
|
+
returns: v.union(subscriptionDocValidator, v.null()),
|
|
17
|
+
handler: async (ctx, args) => {
|
|
18
|
+
return await ctx.db
|
|
19
|
+
.query("subscriptions")
|
|
20
|
+
.withIndex("by_stripe_subscription_id", (q) => q.eq("stripeSubscriptionId", args.stripeSubscriptionId))
|
|
21
|
+
.first();
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
export const listSubscriptions = query({
|
|
25
|
+
args: {
|
|
26
|
+
accountId: v.optional(v.string()),
|
|
27
|
+
status: v.optional(subscriptionStatusValidator),
|
|
28
|
+
limit: v.optional(v.number()),
|
|
29
|
+
},
|
|
30
|
+
returns: v.array(subscriptionDocValidator),
|
|
31
|
+
handler: async (ctx, args) => {
|
|
32
|
+
const limit = args.limit ?? 50;
|
|
33
|
+
if (args.accountId !== undefined && args.status !== undefined) {
|
|
34
|
+
const { accountId, status } = args;
|
|
35
|
+
return await ctx.db
|
|
36
|
+
.query("subscriptions")
|
|
37
|
+
.withIndex("by_account_status", (q) => q.eq("accountId", accountId).eq("status", status))
|
|
38
|
+
.take(limit);
|
|
39
|
+
}
|
|
40
|
+
if (args.accountId !== undefined) {
|
|
41
|
+
const accountId = args.accountId;
|
|
42
|
+
return await ctx.db
|
|
43
|
+
.query("subscriptions")
|
|
44
|
+
.withIndex("by_account_id", (q) => q.eq("accountId", accountId))
|
|
45
|
+
.take(limit);
|
|
46
|
+
}
|
|
47
|
+
if (args.status !== undefined) {
|
|
48
|
+
const status = args.status;
|
|
49
|
+
return await ctx.db
|
|
50
|
+
.query("subscriptions")
|
|
51
|
+
.withIndex("by_status", (q) => q.eq("status", status))
|
|
52
|
+
.take(limit);
|
|
53
|
+
}
|
|
54
|
+
return await ctx.db.query("subscriptions").take(limit);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
export const listSubscriptionsByUser = query({
|
|
58
|
+
args: {
|
|
59
|
+
userId: v.string(),
|
|
60
|
+
status: v.optional(v.string()),
|
|
61
|
+
},
|
|
62
|
+
returns: v.array(subscriptionDocValidator),
|
|
63
|
+
handler: async (ctx, args) => {
|
|
64
|
+
if (args.userId === "")
|
|
65
|
+
return [];
|
|
66
|
+
// A user typically has a small number of subscriptions (current + historical).
|
|
67
|
+
// eslint-disable-next-line @convex-dev/no-collect-in-query
|
|
68
|
+
const subs = await ctx.db
|
|
69
|
+
.query("subscriptions")
|
|
70
|
+
.withIndex("by_user_id", (q) => q.eq("userId", args.userId))
|
|
71
|
+
.collect();
|
|
72
|
+
if (args.status) {
|
|
73
|
+
return subs.filter((s) => s.status === args.status);
|
|
74
|
+
}
|
|
75
|
+
return subs;
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* List a buyer's subscriptions scoped to one store (the recipient
|
|
80
|
+
* `destinationAccountId`). A buyer's saved payment profile lives on their
|
|
81
|
+
* `customer_account` and is reusable across every store, but each subscription
|
|
82
|
+
* belongs to a single store — this is the per-store view (BTS-19). A user has a
|
|
83
|
+
* bounded number of subscriptions, so this collect-then-filter mirrors
|
|
84
|
+
* listSubscriptionsByUser.
|
|
85
|
+
*/
|
|
86
|
+
export const listSubscriptionsByUserAndStore = query({
|
|
87
|
+
args: {
|
|
88
|
+
userId: v.string(),
|
|
89
|
+
destinationAccountId: v.string(),
|
|
90
|
+
status: v.optional(subscriptionStatusValidator),
|
|
91
|
+
},
|
|
92
|
+
returns: v.array(subscriptionDocValidator),
|
|
93
|
+
handler: async (ctx, args) => {
|
|
94
|
+
if (args.userId === "")
|
|
95
|
+
return [];
|
|
96
|
+
// eslint-disable-next-line @convex-dev/no-collect-in-query
|
|
97
|
+
const subs = await ctx.db
|
|
98
|
+
.query("subscriptions")
|
|
99
|
+
.withIndex("by_user_id", (q) => q.eq("userId", args.userId))
|
|
100
|
+
.collect();
|
|
101
|
+
return subs.filter((s) => s.destinationAccountId === args.destinationAccountId &&
|
|
102
|
+
(args.status ? s.status === args.status : true));
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
export const listSubscriptionsByOrg = query({
|
|
106
|
+
args: {
|
|
107
|
+
orgId: v.string(),
|
|
108
|
+
status: v.optional(v.string()),
|
|
109
|
+
},
|
|
110
|
+
returns: v.array(subscriptionDocValidator),
|
|
111
|
+
handler: async (ctx, args) => {
|
|
112
|
+
if (args.orgId === "")
|
|
113
|
+
return [];
|
|
114
|
+
// An org typically has a small number of subscriptions (current + historical).
|
|
115
|
+
// eslint-disable-next-line @convex-dev/no-collect-in-query
|
|
116
|
+
const subs = await ctx.db
|
|
117
|
+
.query("subscriptions")
|
|
118
|
+
.withIndex("by_org_id", (q) => q.eq("orgId", args.orgId))
|
|
119
|
+
.collect();
|
|
120
|
+
if (args.status) {
|
|
121
|
+
return subs.filter((s) => s.status === args.status);
|
|
122
|
+
}
|
|
123
|
+
return subs;
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
export const getActiveSubscription = query({
|
|
127
|
+
args: {
|
|
128
|
+
userId: v.string(),
|
|
129
|
+
orgId: v.optional(v.string()),
|
|
130
|
+
// Optional store scope: only consider subscriptions routed to this recipient.
|
|
131
|
+
destinationAccountId: v.optional(v.string()),
|
|
132
|
+
},
|
|
133
|
+
returns: v.union(subscriptionDocValidator, v.null()),
|
|
134
|
+
handler: async (ctx, args) => {
|
|
135
|
+
// Empty orgId is treated as absent.
|
|
136
|
+
const orgId = args.orgId === "" ? undefined : args.orgId;
|
|
137
|
+
if (args.userId === "" && orgId === undefined)
|
|
138
|
+
return null;
|
|
139
|
+
// Scoped to a single user/org — bounded by number of subscriptions per entity.
|
|
140
|
+
const subs = orgId
|
|
141
|
+
? // eslint-disable-next-line @convex-dev/no-collect-in-query
|
|
142
|
+
await ctx.db
|
|
143
|
+
.query("subscriptions")
|
|
144
|
+
.withIndex("by_org_id", (q) => q.eq("orgId", orgId))
|
|
145
|
+
.collect()
|
|
146
|
+
: // eslint-disable-next-line @convex-dev/no-collect-in-query
|
|
147
|
+
await ctx.db
|
|
148
|
+
.query("subscriptions")
|
|
149
|
+
.withIndex("by_user_id", (q) => q.eq("userId", args.userId))
|
|
150
|
+
.collect();
|
|
151
|
+
return (subs.find((s) => (s.status === "active" || s.status === "trialing") &&
|
|
152
|
+
(args.destinationAccountId === undefined ||
|
|
153
|
+
s.destinationAccountId === args.destinationAccountId)) ?? null);
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
export const getTrialStatus = query({
|
|
157
|
+
args: { subscriptionId: v.id("subscriptions") },
|
|
158
|
+
returns: v.union(v.object({
|
|
159
|
+
isTrialing: v.boolean(),
|
|
160
|
+
trialStart: subscriptionFields.trialStart,
|
|
161
|
+
trialEnd: subscriptionFields.trialEnd,
|
|
162
|
+
daysRemaining: v.number(),
|
|
163
|
+
status: subscriptionStatusValidator,
|
|
164
|
+
}), v.null()),
|
|
165
|
+
handler: async (ctx, args) => {
|
|
166
|
+
const sub = await ctx.db.get("subscriptions", args.subscriptionId);
|
|
167
|
+
if (!sub)
|
|
168
|
+
return null;
|
|
169
|
+
let daysRemaining = 0;
|
|
170
|
+
if (sub.isTrialing && sub.trialEnd) {
|
|
171
|
+
const trialEndDate = new Date(sub.trialEnd);
|
|
172
|
+
const now = new Date();
|
|
173
|
+
daysRemaining = Math.max(0, Math.ceil((trialEndDate.getTime() - now.getTime()) / (1000 * 60 * 60 * 24)));
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
isTrialing: sub.isTrialing,
|
|
177
|
+
trialStart: sub.trialStart,
|
|
178
|
+
trialEnd: sub.trialEnd,
|
|
179
|
+
daysRemaining,
|
|
180
|
+
status: sub.status,
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
// =============================================================================
|
|
185
|
+
// CHECKOUT SESSION QUERIES
|
|
186
|
+
// =============================================================================
|
|
187
|
+
export const getCheckoutSession = query({
|
|
188
|
+
args: { sessionId: v.id("checkoutSessions") },
|
|
189
|
+
returns: v.union(checkoutSessionDocValidator, v.null()),
|
|
190
|
+
handler: async (ctx, args) => {
|
|
191
|
+
return await ctx.db.get("checkoutSessions", args.sessionId);
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
export const getCheckoutSessionByStripeId = query({
|
|
195
|
+
args: { stripeSessionId: v.string() },
|
|
196
|
+
returns: v.union(checkoutSessionDocValidator, v.null()),
|
|
197
|
+
handler: async (ctx, args) => {
|
|
198
|
+
return await ctx.db
|
|
199
|
+
.query("checkoutSessions")
|
|
200
|
+
.withIndex("by_stripe_session_id", (q) => q.eq("stripeSessionId", args.stripeSessionId))
|
|
201
|
+
.first();
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
export const listCheckoutSessionsByUser = query({
|
|
205
|
+
args: {
|
|
206
|
+
userId: v.string(),
|
|
207
|
+
status: v.optional(checkoutSessionStatusValidator),
|
|
208
|
+
limit: v.optional(v.number()),
|
|
209
|
+
},
|
|
210
|
+
returns: v.array(checkoutSessionDocValidator),
|
|
211
|
+
handler: async (ctx, args) => {
|
|
212
|
+
if (args.userId === "")
|
|
213
|
+
return [];
|
|
214
|
+
const limit = args.limit ?? 50;
|
|
215
|
+
if (args.status !== undefined) {
|
|
216
|
+
const { userId, status } = args;
|
|
217
|
+
return await ctx.db
|
|
218
|
+
.query("checkoutSessions")
|
|
219
|
+
.withIndex("by_user_status", (q) => q.eq("userId", userId).eq("status", status))
|
|
220
|
+
.take(limit);
|
|
221
|
+
}
|
|
222
|
+
return await ctx.db
|
|
223
|
+
.query("checkoutSessions")
|
|
224
|
+
.withIndex("by_user_id", (q) => q.eq("userId", args.userId))
|
|
225
|
+
.take(limit);
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
// =============================================================================
|
|
229
|
+
// INVOICE QUERIES
|
|
230
|
+
// =============================================================================
|
|
231
|
+
export const getInvoiceByStripeId = query({
|
|
232
|
+
args: { stripeInvoiceId: v.string() },
|
|
233
|
+
returns: v.union(invoiceDocValidator, v.null()),
|
|
234
|
+
handler: async (ctx, args) => {
|
|
235
|
+
return await ctx.db
|
|
236
|
+
.query("invoices")
|
|
237
|
+
.withIndex("by_stripe_invoice_id", (q) => q.eq("stripeInvoiceId", args.stripeInvoiceId))
|
|
238
|
+
.first();
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
export const listInvoices = query({
|
|
242
|
+
args: {
|
|
243
|
+
userId: v.optional(v.string()),
|
|
244
|
+
accountId: v.optional(v.string()),
|
|
245
|
+
subscriptionId: v.optional(v.string()),
|
|
246
|
+
status: v.optional(invoiceStatusValidator),
|
|
247
|
+
limit: v.optional(v.number()),
|
|
248
|
+
},
|
|
249
|
+
returns: v.array(invoiceDocValidator),
|
|
250
|
+
handler: async (ctx, args) => {
|
|
251
|
+
const limit = args.limit ?? 50;
|
|
252
|
+
if (args.accountId !== undefined) {
|
|
253
|
+
const accountId = args.accountId;
|
|
254
|
+
if (args.status !== undefined) {
|
|
255
|
+
const status = args.status;
|
|
256
|
+
return await ctx.db
|
|
257
|
+
.query("invoices")
|
|
258
|
+
.withIndex("by_account_status", (q) => q.eq("accountId", accountId).eq("status", status))
|
|
259
|
+
.take(limit);
|
|
260
|
+
}
|
|
261
|
+
return await ctx.db
|
|
262
|
+
.query("invoices")
|
|
263
|
+
.withIndex("by_account_id", (q) => q.eq("accountId", accountId))
|
|
264
|
+
.take(limit);
|
|
265
|
+
}
|
|
266
|
+
if (args.userId !== undefined && args.userId !== "") {
|
|
267
|
+
const userId = args.userId;
|
|
268
|
+
if (args.status !== undefined) {
|
|
269
|
+
const status = args.status;
|
|
270
|
+
return await ctx.db
|
|
271
|
+
.query("invoices")
|
|
272
|
+
.withIndex("by_user_status", (q) => q.eq("userId", userId).eq("status", status))
|
|
273
|
+
.take(limit);
|
|
274
|
+
}
|
|
275
|
+
return await ctx.db
|
|
276
|
+
.query("invoices")
|
|
277
|
+
.withIndex("by_user_id", (q) => q.eq("userId", userId))
|
|
278
|
+
.take(limit);
|
|
279
|
+
}
|
|
280
|
+
if (args.subscriptionId !== undefined) {
|
|
281
|
+
const subscriptionId = args.subscriptionId;
|
|
282
|
+
if (args.status !== undefined) {
|
|
283
|
+
const status = args.status;
|
|
284
|
+
return await ctx.db
|
|
285
|
+
.query("invoices")
|
|
286
|
+
.withIndex("by_subscription_status", (q) => q.eq("subscriptionId", subscriptionId).eq("status", status))
|
|
287
|
+
.take(limit);
|
|
288
|
+
}
|
|
289
|
+
return await ctx.db
|
|
290
|
+
.query("invoices")
|
|
291
|
+
.withIndex("by_subscription_id", (q) => q.eq("subscriptionId", subscriptionId))
|
|
292
|
+
.take(limit);
|
|
293
|
+
}
|
|
294
|
+
if (args.status !== undefined) {
|
|
295
|
+
const status = args.status;
|
|
296
|
+
return await ctx.db
|
|
297
|
+
.query("invoices")
|
|
298
|
+
.withIndex("by_status", (q) => q.eq("status", status))
|
|
299
|
+
.take(limit);
|
|
300
|
+
}
|
|
301
|
+
return await ctx.db.query("invoices").take(limit);
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/billing/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAElC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAEtB,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;IACnC,IAAI,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,EAAE;IAC/C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,OAAO,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IAChE,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAC;IAC7C,IAAI,EAAE,EAAE,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE;IAC1C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,OAAO,MAAM,GAAG,CAAC,EAAE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AAI,CAAC,MAAM,CAAC;gBAC3B,OAAO,MAAM,GAAG,CAAC,EAAE;qBAChB,KAAK,CAAC,UAAU,CAAC;qBACjB,SAAS,CAAC,wBAAwB,EAAE,CAAC,CAAC,EAAE,EAAE,CACzC,CAAC,CAAC,EAAE,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAC5D;qBACA,IAAI,CAAC,KAAK,CAAC,CAAC;YACjB,CAAC;YACD,OAAO,MAAM,GAAG,CAAC,EAAE;iBAChB,KAAK,CAAC,UAAU,CAAC;iBACjB,SAAS,CAAC,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CACrC,CAAC,CAAC,EAAE,CAAC,gBAAgB,EAAE,cAAc,CAAC,CACvC;iBACA,IAAI,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,OAAO,MAAM,GAAG,CAAC,EAAE;iBAChB,KAAK,CAAC,UAAU,CAAC;iBACjB,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;iBACrD,IAAI,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;QAED,OAAO,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subscriptions with first-class trial tracking.
|
|
3
|
+
*/
|
|
4
|
+
export declare const subscriptionsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
5
|
+
accountId?: string | undefined;
|
|
6
|
+
applicationFeeAmount?: number | undefined;
|
|
7
|
+
applicationFeePercent?: number | undefined;
|
|
8
|
+
chargeType?: "destination" | "separate" | undefined;
|
|
9
|
+
currency?: string | undefined;
|
|
10
|
+
destinationAccountId?: string | undefined;
|
|
11
|
+
feeCollectedAmount?: number | undefined;
|
|
12
|
+
feeRefundedAmount?: number | undefined;
|
|
13
|
+
metadata?: any;
|
|
14
|
+
orgId?: string | undefined;
|
|
15
|
+
priceId?: string | undefined;
|
|
16
|
+
splitRecipients?: {
|
|
17
|
+
percent?: number | undefined;
|
|
18
|
+
amount?: number | undefined;
|
|
19
|
+
destinationAccountId: string;
|
|
20
|
+
role: "store" | "affiliate" | "other";
|
|
21
|
+
}[] | undefined;
|
|
22
|
+
canceledAt?: string | undefined;
|
|
23
|
+
currentPeriodEnd?: string | undefined;
|
|
24
|
+
currentPeriodStart?: string | undefined;
|
|
25
|
+
quantity?: number | undefined;
|
|
26
|
+
trialEnd?: string | undefined;
|
|
27
|
+
trialStart?: string | undefined;
|
|
28
|
+
status: "active" | "trialing" | "past_due" | "canceled" | "incomplete" | "incomplete_expired" | "unpaid" | "paused";
|
|
29
|
+
userId: string;
|
|
30
|
+
cancelAtPeriodEnd: boolean;
|
|
31
|
+
isTrialing: boolean;
|
|
32
|
+
stripeSubscriptionId: string;
|
|
33
|
+
}, {
|
|
34
|
+
metadata: import("convex/values").VAny<any, "optional", string>;
|
|
35
|
+
destinationAccountId: import("convex/values").VString<string | undefined, "optional">;
|
|
36
|
+
applicationFeeAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
37
|
+
applicationFeePercent: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
38
|
+
feeCollectedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
39
|
+
feeRefundedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
40
|
+
chargeType: import("convex/values").VUnion<"destination" | "separate" | undefined, [import("convex/values").VLiteral<"destination", "required">, import("convex/values").VLiteral<"separate", "required">], "optional", never>;
|
|
41
|
+
splitRecipients: import("convex/values").VArray<{
|
|
42
|
+
percent?: number | undefined;
|
|
43
|
+
amount?: number | undefined;
|
|
44
|
+
destinationAccountId: string;
|
|
45
|
+
role: "store" | "affiliate" | "other";
|
|
46
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
47
|
+
percent?: number | undefined;
|
|
48
|
+
amount?: number | undefined;
|
|
49
|
+
destinationAccountId: string;
|
|
50
|
+
role: "store" | "affiliate" | "other";
|
|
51
|
+
}, {
|
|
52
|
+
destinationAccountId: import("convex/values").VString<string, "required">;
|
|
53
|
+
role: import("convex/values").VUnion<"store" | "affiliate" | "other", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
|
|
54
|
+
amount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
55
|
+
percent: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
56
|
+
}, "required", "destinationAccountId" | "percent" | "amount" | "role">, "optional">;
|
|
57
|
+
stripeSubscriptionId: import("convex/values").VString<string, "required">;
|
|
58
|
+
accountId: import("convex/values").VString<string | undefined, "optional">;
|
|
59
|
+
userId: import("convex/values").VString<string, "required">;
|
|
60
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
61
|
+
status: import("convex/values").VUnion<"active" | "trialing" | "past_due" | "canceled" | "incomplete" | "incomplete_expired" | "unpaid" | "paused", [import("convex/values").VLiteral<"active", "required">, import("convex/values").VLiteral<"trialing", "required">, import("convex/values").VLiteral<"past_due", "required">, import("convex/values").VLiteral<"canceled", "required">, import("convex/values").VLiteral<"incomplete", "required">, import("convex/values").VLiteral<"incomplete_expired", "required">, import("convex/values").VLiteral<"unpaid", "required">, import("convex/values").VLiteral<"paused", "required">], "required", never>;
|
|
62
|
+
priceId: import("convex/values").VString<string | undefined, "optional">;
|
|
63
|
+
quantity: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
64
|
+
currentPeriodStart: import("convex/values").VString<string | undefined, "optional">;
|
|
65
|
+
currentPeriodEnd: import("convex/values").VString<string | undefined, "optional">;
|
|
66
|
+
cancelAtPeriodEnd: import("convex/values").VBoolean<boolean, "required">;
|
|
67
|
+
canceledAt: import("convex/values").VString<string | undefined, "optional">;
|
|
68
|
+
isTrialing: import("convex/values").VBoolean<boolean, "required">;
|
|
69
|
+
trialStart: import("convex/values").VString<string | undefined, "optional">;
|
|
70
|
+
trialEnd: import("convex/values").VString<string | undefined, "optional">;
|
|
71
|
+
currency: import("convex/values").VString<string | undefined, "optional">;
|
|
72
|
+
}, "required", "accountId" | "applicationFeeAmount" | "applicationFeePercent" | "chargeType" | "currency" | "destinationAccountId" | "feeCollectedAmount" | "feeRefundedAmount" | "metadata" | "orgId" | "priceId" | "splitRecipients" | "status" | "userId" | "cancelAtPeriodEnd" | "canceledAt" | "currentPeriodEnd" | "currentPeriodStart" | "isTrialing" | "quantity" | "stripeSubscriptionId" | "trialEnd" | "trialStart" | `metadata.${string}`>, {
|
|
73
|
+
by_stripe_subscription_id: ["stripeSubscriptionId", "_creationTime"];
|
|
74
|
+
by_user_id: ["userId", "_creationTime"];
|
|
75
|
+
by_org_id: ["orgId", "_creationTime"];
|
|
76
|
+
by_status: ["status", "_creationTime"];
|
|
77
|
+
by_account_id: ["accountId", "_creationTime"];
|
|
78
|
+
by_account_status: ["accountId", "status", "_creationTime"];
|
|
79
|
+
}, {}, {}>;
|
|
80
|
+
/**
|
|
81
|
+
* Checkout sessions (embedded + redirect modes).
|
|
82
|
+
*/
|
|
83
|
+
export declare const checkoutSessionsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
84
|
+
accountId?: string | undefined;
|
|
85
|
+
applicationFeeAmount?: number | undefined;
|
|
86
|
+
applicationFeePercent?: number | undefined;
|
|
87
|
+
chargeType?: "destination" | "separate" | undefined;
|
|
88
|
+
clientSecret?: string | undefined;
|
|
89
|
+
currency?: string | undefined;
|
|
90
|
+
destinationAccountId?: string | undefined;
|
|
91
|
+
feeCollectedAmount?: number | undefined;
|
|
92
|
+
feeRefundedAmount?: number | undefined;
|
|
93
|
+
metadata?: any;
|
|
94
|
+
orgId?: string | undefined;
|
|
95
|
+
priceId?: string | undefined;
|
|
96
|
+
splitRecipients?: {
|
|
97
|
+
percent?: number | undefined;
|
|
98
|
+
amount?: number | undefined;
|
|
99
|
+
destinationAccountId: string;
|
|
100
|
+
role: "store" | "affiliate" | "other";
|
|
101
|
+
}[] | undefined;
|
|
102
|
+
url?: string | undefined;
|
|
103
|
+
mode: "payment" | "subscription" | "setup";
|
|
104
|
+
status: "open" | "complete" | "expired";
|
|
105
|
+
stripeSessionId: string;
|
|
106
|
+
userId: string;
|
|
107
|
+
}, {
|
|
108
|
+
metadata: import("convex/values").VAny<any, "optional", string>;
|
|
109
|
+
destinationAccountId: import("convex/values").VString<string | undefined, "optional">;
|
|
110
|
+
applicationFeeAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
111
|
+
applicationFeePercent: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
112
|
+
feeCollectedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
113
|
+
feeRefundedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
114
|
+
chargeType: import("convex/values").VUnion<"destination" | "separate" | undefined, [import("convex/values").VLiteral<"destination", "required">, import("convex/values").VLiteral<"separate", "required">], "optional", never>;
|
|
115
|
+
splitRecipients: import("convex/values").VArray<{
|
|
116
|
+
percent?: number | undefined;
|
|
117
|
+
amount?: number | undefined;
|
|
118
|
+
destinationAccountId: string;
|
|
119
|
+
role: "store" | "affiliate" | "other";
|
|
120
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
121
|
+
percent?: number | undefined;
|
|
122
|
+
amount?: number | undefined;
|
|
123
|
+
destinationAccountId: string;
|
|
124
|
+
role: "store" | "affiliate" | "other";
|
|
125
|
+
}, {
|
|
126
|
+
destinationAccountId: import("convex/values").VString<string, "required">;
|
|
127
|
+
role: import("convex/values").VUnion<"store" | "affiliate" | "other", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
|
|
128
|
+
amount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
129
|
+
percent: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
130
|
+
}, "required", "destinationAccountId" | "percent" | "amount" | "role">, "optional">;
|
|
131
|
+
stripeSessionId: import("convex/values").VString<string, "required">;
|
|
132
|
+
userId: import("convex/values").VString<string, "required">;
|
|
133
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
134
|
+
accountId: import("convex/values").VString<string | undefined, "optional">;
|
|
135
|
+
mode: import("convex/values").VUnion<"payment" | "subscription" | "setup", [import("convex/values").VLiteral<"payment", "required">, import("convex/values").VLiteral<"subscription", "required">, import("convex/values").VLiteral<"setup", "required">], "required", never>;
|
|
136
|
+
status: import("convex/values").VUnion<"open" | "complete" | "expired", [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"complete", "required">, import("convex/values").VLiteral<"expired", "required">], "required", never>;
|
|
137
|
+
clientSecret: import("convex/values").VString<string | undefined, "optional">;
|
|
138
|
+
url: import("convex/values").VString<string | undefined, "optional">;
|
|
139
|
+
priceId: import("convex/values").VString<string | undefined, "optional">;
|
|
140
|
+
currency: import("convex/values").VString<string | undefined, "optional">;
|
|
141
|
+
}, "required", "accountId" | "applicationFeeAmount" | "applicationFeePercent" | "chargeType" | "clientSecret" | "currency" | "destinationAccountId" | "feeCollectedAmount" | "feeRefundedAmount" | "metadata" | "mode" | "orgId" | "priceId" | "splitRecipients" | "status" | "stripeSessionId" | "url" | "userId" | `metadata.${string}`>, {
|
|
142
|
+
by_stripe_session_id: ["stripeSessionId", "_creationTime"];
|
|
143
|
+
by_user_id: ["userId", "_creationTime"];
|
|
144
|
+
by_account_id: ["accountId", "_creationTime"];
|
|
145
|
+
by_user_status: ["userId", "status", "_creationTime"];
|
|
146
|
+
}, {}, {}>;
|
|
147
|
+
/**
|
|
148
|
+
* Invoice summaries (line items fetched on demand from Stripe).
|
|
149
|
+
*/
|
|
150
|
+
export declare const invoicesTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
151
|
+
accountId?: string | undefined;
|
|
152
|
+
applicationFeeAmount?: number | undefined;
|
|
153
|
+
applicationFeePercent?: number | undefined;
|
|
154
|
+
chargeType?: "destination" | "separate" | undefined;
|
|
155
|
+
destinationAccountId?: string | undefined;
|
|
156
|
+
feeCollectedAmount?: number | undefined;
|
|
157
|
+
feeRefundedAmount?: number | undefined;
|
|
158
|
+
metadata?: any;
|
|
159
|
+
orgId?: string | undefined;
|
|
160
|
+
splitRecipients?: {
|
|
161
|
+
percent?: number | undefined;
|
|
162
|
+
amount?: number | undefined;
|
|
163
|
+
destinationAccountId: string;
|
|
164
|
+
role: "store" | "affiliate" | "other";
|
|
165
|
+
}[] | undefined;
|
|
166
|
+
attemptCount?: number | undefined;
|
|
167
|
+
hostedInvoiceUrl?: string | undefined;
|
|
168
|
+
invoicePdf?: string | undefined;
|
|
169
|
+
nextPaymentAttempt?: string | undefined;
|
|
170
|
+
periodEnd?: string | undefined;
|
|
171
|
+
periodStart?: string | undefined;
|
|
172
|
+
subscriptionId?: string | undefined;
|
|
173
|
+
currency: string;
|
|
174
|
+
status: "open" | "draft" | "paid" | "uncollectible" | "void";
|
|
175
|
+
userId: string;
|
|
176
|
+
amountDue: number;
|
|
177
|
+
amountPaid: number;
|
|
178
|
+
stripeInvoiceId: string;
|
|
179
|
+
}, {
|
|
180
|
+
metadata: import("convex/values").VAny<any, "optional", string>;
|
|
181
|
+
destinationAccountId: import("convex/values").VString<string | undefined, "optional">;
|
|
182
|
+
applicationFeeAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
183
|
+
applicationFeePercent: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
184
|
+
feeCollectedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
185
|
+
feeRefundedAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
186
|
+
chargeType: import("convex/values").VUnion<"destination" | "separate" | undefined, [import("convex/values").VLiteral<"destination", "required">, import("convex/values").VLiteral<"separate", "required">], "optional", never>;
|
|
187
|
+
splitRecipients: import("convex/values").VArray<{
|
|
188
|
+
percent?: number | undefined;
|
|
189
|
+
amount?: number | undefined;
|
|
190
|
+
destinationAccountId: string;
|
|
191
|
+
role: "store" | "affiliate" | "other";
|
|
192
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
193
|
+
percent?: number | undefined;
|
|
194
|
+
amount?: number | undefined;
|
|
195
|
+
destinationAccountId: string;
|
|
196
|
+
role: "store" | "affiliate" | "other";
|
|
197
|
+
}, {
|
|
198
|
+
destinationAccountId: import("convex/values").VString<string, "required">;
|
|
199
|
+
role: import("convex/values").VUnion<"store" | "affiliate" | "other", [import("convex/values").VLiteral<"store", "required">, import("convex/values").VLiteral<"affiliate", "required">, import("convex/values").VLiteral<"other", "required">], "required", never>;
|
|
200
|
+
amount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
201
|
+
percent: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
202
|
+
}, "required", "destinationAccountId" | "percent" | "amount" | "role">, "optional">;
|
|
203
|
+
stripeInvoiceId: import("convex/values").VString<string, "required">;
|
|
204
|
+
userId: import("convex/values").VString<string, "required">;
|
|
205
|
+
orgId: import("convex/values").VString<string | undefined, "optional">;
|
|
206
|
+
accountId: import("convex/values").VString<string | undefined, "optional">;
|
|
207
|
+
subscriptionId: import("convex/values").VString<string | undefined, "optional">;
|
|
208
|
+
status: import("convex/values").VUnion<"open" | "draft" | "paid" | "uncollectible" | "void", [import("convex/values").VLiteral<"draft", "required">, import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"paid", "required">, import("convex/values").VLiteral<"uncollectible", "required">, import("convex/values").VLiteral<"void", "required">], "required", never>;
|
|
209
|
+
currency: import("convex/values").VString<string, "required">;
|
|
210
|
+
amountDue: import("convex/values").VFloat64<number, "required">;
|
|
211
|
+
amountPaid: import("convex/values").VFloat64<number, "required">;
|
|
212
|
+
hostedInvoiceUrl: import("convex/values").VString<string | undefined, "optional">;
|
|
213
|
+
invoicePdf: import("convex/values").VString<string | undefined, "optional">;
|
|
214
|
+
periodStart: import("convex/values").VString<string | undefined, "optional">;
|
|
215
|
+
periodEnd: import("convex/values").VString<string | undefined, "optional">;
|
|
216
|
+
nextPaymentAttempt: import("convex/values").VString<string | undefined, "optional">;
|
|
217
|
+
attemptCount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
218
|
+
}, "required", "accountId" | "applicationFeeAmount" | "applicationFeePercent" | "chargeType" | "currency" | "destinationAccountId" | "feeCollectedAmount" | "feeRefundedAmount" | "metadata" | "orgId" | "splitRecipients" | "status" | "userId" | "amountDue" | "amountPaid" | "attemptCount" | "hostedInvoiceUrl" | "invoicePdf" | "nextPaymentAttempt" | "periodEnd" | "periodStart" | "stripeInvoiceId" | "subscriptionId" | `metadata.${string}`>, {
|
|
219
|
+
by_stripe_invoice_id: ["stripeInvoiceId", "_creationTime"];
|
|
220
|
+
by_user_id: ["userId", "_creationTime"];
|
|
221
|
+
by_subscription_id: ["subscriptionId", "_creationTime"];
|
|
222
|
+
by_account_id: ["accountId", "_creationTime"];
|
|
223
|
+
by_account_status: ["accountId", "status", "_creationTime"];
|
|
224
|
+
by_user_status: ["userId", "status", "_creationTime"];
|
|
225
|
+
by_subscription_status: ["subscriptionId", "status", "_creationTime"];
|
|
226
|
+
by_status: ["status", "_creationTime"];
|
|
227
|
+
}, {}, {}>;
|
|
228
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/billing/schema.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAMuB,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAIc,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQO,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineTable } from "convex/server";
|
|
2
|
+
import { checkoutSessionFields, invoiceFields, subscriptionFields, } from "./validators";
|
|
3
|
+
/**
|
|
4
|
+
* Subscriptions with first-class trial tracking.
|
|
5
|
+
*/
|
|
6
|
+
export const subscriptionsTable = defineTable(subscriptionFields)
|
|
7
|
+
.index("by_stripe_subscription_id", ["stripeSubscriptionId"])
|
|
8
|
+
.index("by_user_id", ["userId"])
|
|
9
|
+
.index("by_org_id", ["orgId"])
|
|
10
|
+
.index("by_status", ["status"])
|
|
11
|
+
.index("by_account_id", ["accountId"])
|
|
12
|
+
.index("by_account_status", ["accountId", "status"]);
|
|
13
|
+
/**
|
|
14
|
+
* Checkout sessions (embedded + redirect modes).
|
|
15
|
+
*/
|
|
16
|
+
export const checkoutSessionsTable = defineTable(checkoutSessionFields)
|
|
17
|
+
.index("by_stripe_session_id", ["stripeSessionId"])
|
|
18
|
+
.index("by_user_id", ["userId"])
|
|
19
|
+
.index("by_account_id", ["accountId"])
|
|
20
|
+
.index("by_user_status", ["userId", "status"]);
|
|
21
|
+
/**
|
|
22
|
+
* Invoice summaries (line items fetched on demand from Stripe).
|
|
23
|
+
*/
|
|
24
|
+
export const invoicesTable = defineTable(invoiceFields)
|
|
25
|
+
.index("by_stripe_invoice_id", ["stripeInvoiceId"])
|
|
26
|
+
.index("by_user_id", ["userId"])
|
|
27
|
+
.index("by_subscription_id", ["subscriptionId"])
|
|
28
|
+
.index("by_account_id", ["accountId"])
|
|
29
|
+
.index("by_account_status", ["accountId", "status"])
|
|
30
|
+
.index("by_user_status", ["userId", "status"])
|
|
31
|
+
.index("by_subscription_status", ["subscriptionId", "status"])
|
|
32
|
+
.index("by_status", ["status"]);
|
|
33
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/billing/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAC,kBAAkB,CAAC;KAC9D,KAAK,CAAC,2BAA2B,EAAE,CAAC,sBAAsB,CAAC,CAAC;KAC5D,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC;KAC/B,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC;KAC7B,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,CAAC;KAC9B,KAAK,CAAC,eAAe,EAAE,CAAC,WAAW,CAAC,CAAC;KACrC,KAAK,CAAC,mBAAmB,EAAE,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC,qBAAqB,CAAC;KACpE,KAAK,CAAC,sBAAsB,EAAE,CAAC,iBAAiB,CAAC,CAAC;KAClD,KAAK,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC;KAC/B,KAAK,CAAC,eAAe,EAAE,CAAC,WAAW,CAAC,CAAC;KACrC,KAAK,CAAC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAC,aAAa,CAAC;KAC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