@fantastic.dev/better-stripe 0.7.0 → 0.8.1
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 +29 -18
- package/README.md +123 -91
- package/dist/client/billing/checkout.d.ts +1 -1
- package/dist/client/billing/checkout.d.ts.map +1 -1
- package/dist/client/billing/checkout.js +7 -2
- package/dist/client/billing/checkout.js.map +1 -1
- package/dist/client/connect/disputes.d.ts +1 -1
- package/dist/client/connect/disputes.d.ts.map +1 -1
- package/dist/client/connect/disputes.js +12 -6
- package/dist/client/connect/disputes.js.map +1 -1
- package/dist/client/connect/paymentMethods.d.ts.map +1 -1
- package/dist/client/connect/paymentMethods.js.map +1 -1
- package/dist/client/connect/refundActor.d.ts.map +1 -1
- package/dist/client/connect/refundActor.js.map +1 -1
- package/dist/client/connect/refunds.d.ts.map +1 -1
- package/dist/client/connect/refunds.js.map +1 -1
- package/dist/client/connect/transfers.d.ts.map +1 -1
- package/dist/client/connect/transfers.js +15 -4
- package/dist/client/connect/transfers.js.map +1 -1
- package/dist/client/core/accountDefaults.d.ts +6 -0
- package/dist/client/core/accountDefaults.d.ts.map +1 -0
- package/dist/client/core/accountDefaults.js +15 -0
- package/dist/client/core/accountDefaults.js.map +1 -0
- package/dist/client/core/accounts.d.ts +1 -5
- package/dist/client/core/accounts.d.ts.map +1 -1
- package/dist/client/core/accounts.js +2 -14
- package/dist/client/core/accounts.js.map +1 -1
- package/dist/client/core/fees.d.ts.map +1 -1
- package/dist/client/core/fees.js +7 -2
- package/dist/client/core/fees.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/products/prices.d.ts.map +1 -1
- package/dist/client/products/prices.js.map +1 -1
- package/dist/client/products/products.d.ts.map +1 -1
- package/dist/client/products/products.js +3 -1
- package/dist/client/products/products.js.map +1 -1
- package/dist/client/utils/owner.d.ts.map +1 -1
- package/dist/client/utils/owner.js +3 -1
- package/dist/client/utils/owner.js.map +1 -1
- package/dist/client/utils/stripeDashboardUrl.d.ts.map +1 -1
- package/dist/client/utils/stripeDashboardUrl.js.map +1 -1
- package/dist/client/webhooks/helpers.d.ts +10 -0
- package/dist/client/webhooks/helpers.d.ts.map +1 -1
- package/dist/client/webhooks/helpers.js +18 -0
- package/dist/client/webhooks/helpers.js.map +1 -1
- package/dist/client/webhooks/processors.d.ts.map +1 -1
- package/dist/client/webhooks/processors.js +1 -19
- package/dist/client/webhooks/processors.js.map +1 -1
- package/dist/component/connect/mutations.d.ts.map +1 -1
- package/dist/component/connect/mutations.js +4 -33
- package/dist/component/connect/mutations.js.map +1 -1
- package/dist/component/connect/schema.d.ts.map +1 -1
- package/dist/component/connect/schema.js.map +1 -1
- package/dist/component/lib/paymentSeller.d.ts +3 -0
- package/dist/component/lib/paymentSeller.d.ts.map +1 -0
- package/dist/component/lib/paymentSeller.js +10 -0
- package/dist/component/lib/paymentSeller.js.map +1 -0
- package/dist/component/lib/reversals.d.ts +10 -0
- package/dist/component/lib/reversals.d.ts.map +1 -1
- package/dist/component/lib/reversals.js +17 -0
- package/dist/component/lib/reversals.js.map +1 -1
- package/dist/react/components/ConnectProvider.d.ts +1 -1
- package/dist/react/components/ConnectProvider.d.ts.map +1 -1
- package/dist/react/components/ConnectProvider.js +18 -4
- package/dist/react/components/ConnectProvider.js.map +1 -1
- package/dist/react/components/ConnectStatusBadge.d.ts.map +1 -1
- package/dist/react/components/ConnectStatusBadge.js.map +1 -1
- package/dist/react/components/DisputeDetail.d.ts +4 -1
- package/dist/react/components/DisputeDetail.d.ts.map +1 -1
- package/dist/react/components/DisputeDetail.js +12 -6
- package/dist/react/components/DisputeDetail.js.map +1 -1
- package/dist/react/components/DisputesList.d.ts.map +1 -1
- package/dist/react/components/DisputesList.js +2 -1
- package/dist/react/components/DisputesList.js.map +1 -1
- package/dist/react/components/EmbeddedDisputes.d.ts +1 -1
- package/dist/react/components/EmbeddedDisputes.d.ts.map +1 -1
- package/dist/react/components/EmbeddedDisputes.js +1 -1
- package/dist/react/components/EmbeddedDisputes.js.map +1 -1
- package/dist/react/components/SplitBreakdown.d.ts.map +1 -1
- package/dist/react/components/SplitBreakdown.js +12 -2
- package/dist/react/components/SplitBreakdown.js.map +1 -1
- package/dist/react/hooks/useCheckoutSession.d.ts.map +1 -1
- package/dist/react/hooks/useCheckoutSession.js.map +1 -1
- package/dist/react/hooks/useConfirmPayment.d.ts.map +1 -1
- package/dist/react/hooks/useConfirmPayment.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +3 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/workflows/Account.d.ts +67 -0
- package/dist/react/workflows/Account.d.ts.map +1 -0
- package/dist/react/workflows/Account.js +74 -0
- package/dist/react/workflows/Account.js.map +1 -0
- package/dist/react/workflows/Billing.d.ts +60 -0
- package/dist/react/workflows/Billing.d.ts.map +1 -0
- package/dist/react/workflows/Billing.js +84 -0
- package/dist/react/workflows/Billing.js.map +1 -0
- package/dist/react/workflows/BillingPlans.d.ts +45 -0
- package/dist/react/workflows/BillingPlans.d.ts.map +1 -0
- package/dist/react/workflows/BillingPlans.js +51 -0
- package/dist/react/workflows/BillingPlans.js.map +1 -0
- package/dist/react/workflows/Checkout.d.ts +46 -0
- package/dist/react/workflows/Checkout.d.ts.map +1 -0
- package/dist/react/workflows/Checkout.js +61 -0
- package/dist/react/workflows/Checkout.js.map +1 -0
- package/dist/react/workflows/CheckoutChooser.d.ts +20 -0
- package/dist/react/workflows/CheckoutChooser.d.ts.map +1 -0
- package/dist/react/workflows/CheckoutChooser.js +24 -0
- package/dist/react/workflows/CheckoutChooser.js.map +1 -0
- package/dist/react/workflows/CheckoutForms.d.ts +26 -0
- package/dist/react/workflows/CheckoutForms.d.ts.map +1 -0
- package/dist/react/workflows/CheckoutForms.js +126 -0
- package/dist/react/workflows/CheckoutForms.js.map +1 -0
- package/dist/react/workflows/ClipboardButton.d.ts +17 -0
- package/dist/react/workflows/ClipboardButton.d.ts.map +1 -0
- package/dist/react/workflows/ClipboardButton.js +35 -0
- package/dist/react/workflows/ClipboardButton.js.map +1 -0
- package/dist/react/workflows/Collection.d.ts +30 -0
- package/dist/react/workflows/Collection.d.ts.map +1 -0
- package/dist/react/workflows/Collection.js +25 -0
- package/dist/react/workflows/Collection.js.map +1 -0
- package/dist/react/workflows/Collections.d.ts +56 -0
- package/dist/react/workflows/Collections.d.ts.map +1 -0
- package/dist/react/workflows/Collections.js +111 -0
- package/dist/react/workflows/Collections.js.map +1 -0
- package/dist/react/workflows/Connect.d.ts +19 -0
- package/dist/react/workflows/Connect.d.ts.map +1 -0
- package/dist/react/workflows/Connect.js +43 -0
- package/dist/react/workflows/Connect.js.map +1 -0
- package/dist/react/workflows/Costs.d.ts +48 -0
- package/dist/react/workflows/Costs.d.ts.map +1 -0
- package/dist/react/workflows/Costs.js +66 -0
- package/dist/react/workflows/Costs.js.map +1 -0
- package/dist/react/workflows/Disputes.d.ts +36 -0
- package/dist/react/workflows/Disputes.d.ts.map +1 -0
- package/dist/react/workflows/Disputes.js +74 -0
- package/dist/react/workflows/Disputes.js.map +1 -0
- package/dist/react/workflows/Earnings.d.ts +42 -0
- package/dist/react/workflows/Earnings.d.ts.map +1 -0
- package/dist/react/workflows/Earnings.js +38 -0
- package/dist/react/workflows/Earnings.js.map +1 -0
- package/dist/react/workflows/Financials.d.ts +43 -0
- package/dist/react/workflows/Financials.d.ts.map +1 -0
- package/dist/react/workflows/Financials.js +57 -0
- package/dist/react/workflows/Financials.js.map +1 -0
- package/dist/react/workflows/IntegrationSwitch.d.ts +23 -0
- package/dist/react/workflows/IntegrationSwitch.d.ts.map +1 -0
- package/dist/react/workflows/IntegrationSwitch.js +31 -0
- package/dist/react/workflows/IntegrationSwitch.js.map +1 -0
- package/dist/react/workflows/Onboarding.d.ts +56 -0
- package/dist/react/workflows/Onboarding.d.ts.map +1 -0
- package/dist/react/workflows/Onboarding.js +86 -0
- package/dist/react/workflows/Onboarding.js.map +1 -0
- package/dist/react/workflows/Overview.d.ts +51 -0
- package/dist/react/workflows/Overview.d.ts.map +1 -0
- package/dist/react/workflows/Overview.js +63 -0
- package/dist/react/workflows/Overview.js.map +1 -0
- package/dist/react/workflows/PaymentMethods.d.ts +35 -0
- package/dist/react/workflows/PaymentMethods.d.ts.map +1 -0
- package/dist/react/workflows/PaymentMethods.js +63 -0
- package/dist/react/workflows/PaymentMethods.js.map +1 -0
- package/dist/react/workflows/PaymentReceipt.d.ts +20 -0
- package/dist/react/workflows/PaymentReceipt.d.ts.map +1 -0
- package/dist/react/workflows/PaymentReceipt.js +24 -0
- package/dist/react/workflows/PaymentReceipt.js.map +1 -0
- package/dist/react/workflows/Payouts.d.ts +48 -0
- package/dist/react/workflows/Payouts.d.ts.map +1 -0
- package/dist/react/workflows/Payouts.js +88 -0
- package/dist/react/workflows/Payouts.js.map +1 -0
- package/dist/react/workflows/Products.d.ts +92 -0
- package/dist/react/workflows/Products.d.ts.map +1 -0
- package/dist/react/workflows/Products.js +179 -0
- package/dist/react/workflows/Products.js.map +1 -0
- package/dist/react/workflows/ReferralLinks.d.ts +26 -0
- package/dist/react/workflows/ReferralLinks.d.ts.map +1 -0
- package/dist/react/workflows/ReferralLinks.js +30 -0
- package/dist/react/workflows/ReferralLinks.js.map +1 -0
- package/dist/react/workflows/Refunds.d.ts +72 -0
- package/dist/react/workflows/Refunds.d.ts.map +1 -0
- package/dist/react/workflows/Refunds.js +95 -0
- package/dist/react/workflows/Refunds.js.map +1 -0
- package/dist/react/workflows/Setup.d.ts +50 -0
- package/dist/react/workflows/Setup.d.ts.map +1 -0
- package/dist/react/workflows/Setup.js +59 -0
- package/dist/react/workflows/Setup.js.map +1 -0
- package/dist/react/workflows/Storefront.d.ts +53 -0
- package/dist/react/workflows/Storefront.d.ts.map +1 -0
- package/dist/react/workflows/Storefront.js +44 -0
- package/dist/react/workflows/Storefront.js.map +1 -0
- package/dist/react/workflows/SubscriptionOverview.d.ts +13 -0
- package/dist/react/workflows/SubscriptionOverview.d.ts.map +1 -0
- package/dist/react/workflows/SubscriptionOverview.js +26 -0
- package/dist/react/workflows/SubscriptionOverview.js.map +1 -0
- package/dist/react/workflows/Subscriptions.d.ts +92 -0
- package/dist/react/workflows/Subscriptions.d.ts.map +1 -0
- package/dist/react/workflows/Subscriptions.js +149 -0
- package/dist/react/workflows/Subscriptions.js.map +1 -0
- package/dist/react/workflows/Tasks.d.ts +40 -0
- package/dist/react/workflows/Tasks.d.ts.map +1 -0
- package/dist/react/workflows/Tasks.js +113 -0
- package/dist/react/workflows/Tasks.js.map +1 -0
- package/dist/react/workflows/checkout-options.d.ts +37 -0
- package/dist/react/workflows/checkout-options.d.ts.map +1 -0
- package/dist/react/workflows/checkout-options.js +43 -0
- package/dist/react/workflows/checkout-options.js.map +1 -0
- package/dist/react/workflows/current-subscription.d.ts +11 -0
- package/dist/react/workflows/current-subscription.d.ts.map +1 -0
- package/dist/react/workflows/current-subscription.js +14 -0
- package/dist/react/workflows/current-subscription.js.map +1 -0
- package/dist/react/workflows/filters.d.ts +17 -0
- package/dist/react/workflows/filters.d.ts.map +1 -0
- package/dist/react/workflows/filters.js +23 -0
- package/dist/react/workflows/filters.js.map +1 -0
- package/dist/react/workflows/index.d.ts +70 -0
- package/dist/react/workflows/index.d.ts.map +1 -0
- package/dist/react/workflows/index.js +38 -0
- package/dist/react/workflows/index.js.map +1 -0
- package/dist/react/workflows/useWorkflowAction.d.ts +11 -0
- package/dist/react/workflows/useWorkflowAction.d.ts.map +1 -0
- package/dist/react/workflows/useWorkflowAction.js +68 -0
- package/dist/react/workflows/useWorkflowAction.js.map +1 -0
- package/dist/react/workflows/useWorkflowResource.d.ts +9 -0
- package/dist/react/workflows/useWorkflowResource.d.ts.map +1 -0
- package/dist/react/workflows/useWorkflowResource.js +67 -0
- package/dist/react/workflows/useWorkflowResource.js.map +1 -0
- package/docs/react-workflows-audit.md +88 -0
- package/docs/react-workflows.md +234 -0
- package/package.json +19 -3
- package/src/client/billing/checkout-ui-modes.test.ts +49 -0
- package/src/client/billing/checkout.ts +8 -3
- package/src/client/billing/invoices.test.ts +12 -6
- package/src/client/connect/disputes.test.ts +15 -0
- package/src/client/connect/disputes.ts +13 -7
- package/src/client/connect/paymentMethods.test.ts +3 -1
- package/src/client/connect/paymentMethods.ts +4 -1
- package/src/client/connect/refundActor.ts +1 -2
- package/src/client/connect/refunds.test.ts +35 -10
- package/src/client/connect/refunds.ts +4 -1
- package/src/client/connect/transfers.test.ts +66 -12
- package/src/client/connect/transfers.ts +32 -8
- package/src/client/core/accountDefaults.ts +15 -0
- package/src/client/core/accounts.ts +14 -17
- package/src/client/core/config.test.ts +2 -1
- package/src/client/core/descriptors.test.ts +6 -4
- package/src/client/core/fees.test.ts +20 -28
- package/src/client/core/fees.ts +9 -2
- package/src/client/index.test.ts +22 -22
- package/src/client/index.ts +1 -1
- package/src/client/products/prices.test.ts +8 -2
- package/src/client/products/prices.ts +4 -1
- package/src/client/products/products.test.ts +61 -20
- package/src/client/products/products.ts +3 -1
- package/src/client/utils/data.test.ts +3 -1
- package/src/client/utils/owner.test.ts +4 -1
- package/src/client/utils/owner.ts +5 -1
- package/src/client/utils/stripeDashboardUrl.ts +1 -4
- package/src/client/webhooks/handler.test.ts +16 -19
- package/src/client/webhooks/helpers.test.ts +26 -13
- package/src/client/webhooks/helpers.ts +23 -0
- package/src/client/webhooks/hooks.test.ts +1 -2
- package/src/client/webhooks/processors.test.ts +18 -34
- package/src/client/webhooks/processors.ts +1 -23
- package/src/client/webhooks.test.ts +1 -2
- package/src/component/_generated/api.ts +2 -0
- package/src/component/connect/mutations.ts +5 -46
- package/src/component/connect/schema.ts +4 -3
- package/src/component/connect.test.ts +1 -5
- package/src/component/lib/paymentSeller.ts +15 -0
- package/src/component/lib/reversals.ts +30 -2
- package/src/component/subscription-scoping.test.ts +5 -1
- package/src/component/triggers.test.ts +7 -4
- package/src/react/components/BuyerBillingView.render.test.tsx +7 -2
- package/src/react/components/ConnectProvider.live.test.tsx +61 -0
- package/src/react/components/ConnectProvider.tsx +18 -4
- package/src/react/components/ConnectStatusBadge.tsx +1 -4
- package/src/react/components/DisputeDetail.render.test.tsx +5 -1
- package/src/react/components/DisputeDetail.tsx +14 -5
- package/src/react/components/DisputesList.render.test.tsx +21 -0
- package/src/react/components/DisputesList.tsx +2 -1
- package/src/react/components/EarningsSummary.render.test.tsx +2 -6
- package/src/react/components/EmbeddedDisputes.render.test.tsx +7 -5
- package/src/react/components/EmbeddedDisputes.tsx +4 -1
- package/src/react/components/EvidenceForm.render.test.tsx +3 -10
- package/src/react/components/SplitBreakdown.render.test.tsx +28 -5
- package/src/react/components/SplitBreakdown.tsx +12 -2
- package/src/react/hooks/useCheckoutSession.ts +1 -2
- package/src/react/hooks/useConfirmPayment.ts +1 -2
- package/src/react/hooks/useEarnings.test.ts +43 -8
- package/src/react/hooks/useStripeMode.test.ts +5 -8
- package/src/react/index.ts +7 -1
- package/src/react/workflows/Account.test.tsx +31 -0
- package/src/react/workflows/Account.tsx +183 -0
- package/src/react/workflows/Billing.test.tsx +45 -0
- package/src/react/workflows/Billing.tsx +213 -0
- package/src/react/workflows/BillingPlans.test.tsx +31 -0
- package/src/react/workflows/BillingPlans.tsx +130 -0
- package/src/react/workflows/Checkout.test.tsx +118 -0
- package/src/react/workflows/Checkout.tsx +135 -0
- package/src/react/workflows/CheckoutChooser.test.tsx +44 -0
- package/src/react/workflows/CheckoutChooser.tsx +77 -0
- package/src/react/workflows/CheckoutForm.test.tsx +66 -0
- package/src/react/workflows/CheckoutForms.test.tsx +123 -0
- package/src/react/workflows/CheckoutForms.tsx +247 -0
- package/src/react/workflows/ClipboardButton.test.tsx +34 -0
- package/src/react/workflows/ClipboardButton.tsx +67 -0
- package/src/react/workflows/Collection.tsx +76 -0
- package/src/react/workflows/Collections.test.tsx +86 -0
- package/src/react/workflows/Collections.tsx +213 -0
- package/src/react/workflows/Connect.test.tsx +50 -0
- package/src/react/workflows/Connect.tsx +107 -0
- package/src/react/workflows/Costs.test.tsx +41 -0
- package/src/react/workflows/Costs.tsx +133 -0
- package/src/react/workflows/Disputes.test.tsx +64 -0
- package/src/react/workflows/Disputes.tsx +173 -0
- package/src/react/workflows/Earnings.test.ts +19 -0
- package/src/react/workflows/Earnings.tsx +84 -0
- package/src/react/workflows/Financials.test.tsx +35 -0
- package/src/react/workflows/Financials.tsx +117 -0
- package/src/react/workflows/IntegrationSwitch.test.tsx +36 -0
- package/src/react/workflows/IntegrationSwitch.tsx +63 -0
- package/src/react/workflows/Onboarding.test.tsx +75 -0
- package/src/react/workflows/Onboarding.tsx +171 -0
- package/src/react/workflows/Overview.test.tsx +57 -0
- package/src/react/workflows/Overview.tsx +123 -0
- package/src/react/workflows/PaymentMethods.test.tsx +60 -0
- package/src/react/workflows/PaymentMethods.tsx +117 -0
- package/src/react/workflows/PaymentReceipt.test.tsx +24 -0
- package/src/react/workflows/PaymentReceipt.tsx +46 -0
- package/src/react/workflows/Payouts.test.tsx +112 -0
- package/src/react/workflows/Payouts.tsx +215 -0
- package/src/react/workflows/Products.test.tsx +90 -0
- package/src/react/workflows/Products.tsx +377 -0
- package/src/react/workflows/ReferralLinks.test.tsx +39 -0
- package/src/react/workflows/ReferralLinks.tsx +75 -0
- package/src/react/workflows/Refunds.test.tsx +75 -0
- package/src/react/workflows/Refunds.tsx +223 -0
- package/src/react/workflows/Setup.test.tsx +25 -0
- package/src/react/workflows/Setup.tsx +166 -0
- package/src/react/workflows/Storefront.test.tsx +82 -0
- package/src/react/workflows/Storefront.tsx +138 -0
- package/src/react/workflows/SubscriptionOverview.test.tsx +27 -0
- package/src/react/workflows/SubscriptionOverview.tsx +48 -0
- package/src/react/workflows/Subscriptions.test.tsx +61 -0
- package/src/react/workflows/Subscriptions.tsx +282 -0
- package/src/react/workflows/Tasks.test.tsx +23 -0
- package/src/react/workflows/Tasks.tsx +199 -0
- package/src/react/workflows/checkout-options.ts +42 -0
- package/src/react/workflows/current-subscription.test.ts +29 -0
- package/src/react/workflows/current-subscription.ts +25 -0
- package/src/react/workflows/filters.test.ts +12 -0
- package/src/react/workflows/filters.ts +22 -0
- package/src/react/workflows/index.ts +238 -0
- package/src/react/workflows/native-interactions.test.tsx +73 -0
- package/src/react/workflows/public-workflows.test.tsx +216 -0
- package/src/react/workflows/useWorkflowAction.test.tsx +54 -0
- package/src/react/workflows/useWorkflowAction.ts +75 -0
- package/src/react/workflows/useWorkflowResource.test.tsx +41 -0
- package/src/react/workflows/useWorkflowResource.ts +78 -0
package/dist/react/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAsBH,iBAAiB;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAMnF,8CAA8C;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAK3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAMvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE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OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAOxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAK9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAMtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAKpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAKxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAKpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAK1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAKxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAKlF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAQ1E,0CAA0C;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAMhE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAMlE,YAAY;AACZ,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,SAAS,GACV,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mCAAmC,CAAC;AAE3C,8BAA8B;AAC9B,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ConnectProps } from "./Connect.js";
|
|
3
|
+
export type AccountConfiguration = "customer" | "recipient" | "merchant";
|
|
4
|
+
export type AccountManagerOptions = {
|
|
5
|
+
scopeKey: string;
|
|
6
|
+
createDashboardLink?: () => Promise<{
|
|
7
|
+
url: string;
|
|
8
|
+
}>;
|
|
9
|
+
configure?: (configuration: AccountConfiguration) => Promise<unknown>;
|
|
10
|
+
onNavigate?: (url: string) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function useAccountManager(props: AccountManagerOptions): {
|
|
13
|
+
pendingConfiguration: AccountConfiguration | null;
|
|
14
|
+
lastConfiguration: AccountConfiguration | null;
|
|
15
|
+
isPending: boolean;
|
|
16
|
+
error: string | null;
|
|
17
|
+
result: {
|
|
18
|
+
type: "login";
|
|
19
|
+
url: string;
|
|
20
|
+
configuration?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
url?: undefined;
|
|
23
|
+
type: "configure";
|
|
24
|
+
configuration: AccountConfiguration;
|
|
25
|
+
} | undefined;
|
|
26
|
+
openDashboard: () => Promise<void>;
|
|
27
|
+
configure: (configuration: AccountConfiguration) => Promise<{
|
|
28
|
+
type: "login";
|
|
29
|
+
url: string;
|
|
30
|
+
configuration?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
url?: undefined;
|
|
33
|
+
type: "configure";
|
|
34
|
+
configuration: AccountConfiguration;
|
|
35
|
+
} | undefined>;
|
|
36
|
+
};
|
|
37
|
+
export type AccountSummary = {
|
|
38
|
+
stripeAccountId: string;
|
|
39
|
+
email?: string;
|
|
40
|
+
country?: string;
|
|
41
|
+
onboardingStatus?: string;
|
|
42
|
+
configurations?: string[];
|
|
43
|
+
missingRequirements?: string[];
|
|
44
|
+
};
|
|
45
|
+
export type HeadlessAccountProps = AccountManagerOptions & {
|
|
46
|
+
presentation?: "headless";
|
|
47
|
+
account: AccountSummary | null | undefined;
|
|
48
|
+
children?: (state: ReturnType<typeof useAccountManager> & {
|
|
49
|
+
account: AccountSummary | null | undefined;
|
|
50
|
+
}) => ReactNode;
|
|
51
|
+
};
|
|
52
|
+
export type AccountProps = HeadlessAccountProps | (Omit<ConnectProps, "component"> & {
|
|
53
|
+
presentation: "embedded";
|
|
54
|
+
});
|
|
55
|
+
export declare function Account(props: AccountProps): import("react").JSX.Element;
|
|
56
|
+
export type AccountConfigurationsProps = {
|
|
57
|
+
configurations: string[];
|
|
58
|
+
children?: (state: {
|
|
59
|
+
items: {
|
|
60
|
+
key: string;
|
|
61
|
+
label: string;
|
|
62
|
+
}[];
|
|
63
|
+
isEmpty: boolean;
|
|
64
|
+
}) => ReactNode;
|
|
65
|
+
};
|
|
66
|
+
export declare function AccountConfigurations({ configurations, children, }: AccountConfigurationsProps): import("react").JSX.Element;
|
|
67
|
+
//# sourceMappingURL=Account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Account.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AACzE,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,CAAC,aAAa,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACtE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AACF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,qBAAqB;IA6B1D,oBAAoB;IACpB,iBAAiB;IACjB,SAAS;IACT,KAAK;IACL,MAAM;cAlBa,OAAO;;;;;cAOhB,WAAW;;;IAYrB,aAAa;IAOb,SAAS,kBAAkB,oBAAoB;;;;;;;;;EAGlD;AACD,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,E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
+
import { useWorkflowAction } from "./useWorkflowAction.js";
|
|
5
|
+
import { Connect } from "./Connect.js";
|
|
6
|
+
export function useAccountManager(props) {
|
|
7
|
+
const [configuration, setConfiguration] = useState(null);
|
|
8
|
+
const action = useWorkflowAction(async (command) => {
|
|
9
|
+
if (command.type === "login") {
|
|
10
|
+
if (!props.createDashboardLink)
|
|
11
|
+
throw new Error("Dashboard access is not configured.");
|
|
12
|
+
const result = await props.createDashboardLink();
|
|
13
|
+
if (!result.url)
|
|
14
|
+
throw new Error("Stripe did not return a dashboard URL.");
|
|
15
|
+
return { type: "login", url: result.url };
|
|
16
|
+
}
|
|
17
|
+
setConfiguration(command.configuration);
|
|
18
|
+
if (!props.configure)
|
|
19
|
+
throw new Error("Account configuration is not supported.");
|
|
20
|
+
await props.configure(command.configuration);
|
|
21
|
+
return {
|
|
22
|
+
type: "configure",
|
|
23
|
+
configuration: command.configuration,
|
|
24
|
+
};
|
|
25
|
+
}, props.scopeKey);
|
|
26
|
+
return {
|
|
27
|
+
pendingConfiguration: action.isPending ? configuration : null,
|
|
28
|
+
lastConfiguration: configuration,
|
|
29
|
+
isPending: action.isPending,
|
|
30
|
+
error: action.error,
|
|
31
|
+
result: action.result,
|
|
32
|
+
openDashboard: async () => {
|
|
33
|
+
const result = await action.run({ type: "login" });
|
|
34
|
+
if (result?.type === "login")
|
|
35
|
+
(props.onNavigate ?? ((url) => window.location.assign(url)))(result.url);
|
|
36
|
+
},
|
|
37
|
+
configure: (configuration) => action.run({ type: "configure", configuration }),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function Account(props) {
|
|
41
|
+
return props.presentation === "embedded" ? (_jsx(Connect, { ...props, component: "account" })) : (_jsx(AccountBody, { ...props }, props.scopeKey));
|
|
42
|
+
}
|
|
43
|
+
function AccountBody(props) {
|
|
44
|
+
const state = useAccountManager(props);
|
|
45
|
+
if (props.children)
|
|
46
|
+
return _jsx(_Fragment, { children: props.children({ ...state, account: props.account }) });
|
|
47
|
+
if (props.account === undefined)
|
|
48
|
+
return _jsx("p", { role: "status", children: "Loading account\u2026" });
|
|
49
|
+
if (!props.account)
|
|
50
|
+
return _jsx("p", { children: "No Stripe account has been set up." });
|
|
51
|
+
return (_jsxs("section", { "data-better-stripe": "account", "aria-busy": state.isPending, children: [_jsx("h2", { children: "Account" }), _jsxs("dl", { children: [_jsx("dt", { children: "Account ID" }), _jsx("dd", { children: props.account.stripeAccountId }), _jsx("dt", { children: "Email" }), _jsx("dd", { children: props.account.email ?? "Not supplied" }), _jsx("dt", { children: "Country" }), _jsx("dd", { children: props.account.country ?? "Not supplied" }), _jsx("dt", { children: "Status" }), _jsx("dd", { children: props.account.onboardingStatus ?? "pending" })] }), state.error && _jsx("p", { role: "alert", children: state.error }), props.createDashboardLink && (_jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
52
|
+
void state.openDashboard();
|
|
53
|
+
}, children: state.isPending ? "Opening…" : "Open Stripe dashboard" })), _jsx("h3", { children: "Configurations" }), props.account.configurations?.length ? (_jsx("ul", { children: props.account.configurations.map((value) => (_jsx("li", { children: value }, value))) })) : (_jsx("p", { children: "No configurations yet." })), props.configure &&
|
|
54
|
+
["customer", "recipient", "merchant"]
|
|
55
|
+
.filter((value) => !props.account.configurations?.includes(value))
|
|
56
|
+
.map((value) => (_jsxs("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
57
|
+
void state.configure(value);
|
|
58
|
+
}, children: ["Add ", value, " configuration"] }, value))), !!props.account.missingRequirements?.length && (_jsxs(_Fragment, { children: [_jsx("h3", { children: "Requirements" }), _jsx("ul", { children: props.account.missingRequirements.map((value) => (_jsx("li", { children: value }, value))) })] }))] }));
|
|
59
|
+
}
|
|
60
|
+
export function AccountConfigurations({ configurations, children, }) {
|
|
61
|
+
const labels = {
|
|
62
|
+
recipient: "Recipient (payouts)",
|
|
63
|
+
customer: "Customer (billable)",
|
|
64
|
+
merchant: "Merchant (card payments)",
|
|
65
|
+
};
|
|
66
|
+
const items = configurations.map((key) => ({
|
|
67
|
+
key,
|
|
68
|
+
label: labels[key] ?? key,
|
|
69
|
+
}));
|
|
70
|
+
if (children)
|
|
71
|
+
return _jsx(_Fragment, { children: children({ items, isEmpty: !items.length }) });
|
|
72
|
+
return items.length ? (_jsx("ul", { "data-better-stripe": "account-configurations", children: items.map((item) => (_jsx("li", { children: item.label }, item.key))) })) : (_jsx("p", { children: "No configurations yet." }));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=Account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Account.js","sourceRoot":"","sources":["../../../src/react/workflows/Account.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAQ1D,MAAM,UAAU,iBAAiB,CAAC,KAA4B;IAC5D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GACrC,QAAQ,CAA8B,IAAI,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,iBAAiB,CAC9B,KAAK,EACH,OAE8D,EAC9D,EAAE;QACF,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,KAAK,CAAC,mBAAmB;gBAC5B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;YACzD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,mBAAmB,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,CAAC,GAAG;gBACb,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAC5D,OAAO,EAAE,IAAI,EAAE,OAAgB,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;QACrD,CAAC;QACD,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACxC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GAAG;QACH,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG;KAC1B,CAAC,CAAC,CAAC;IACJ,IAAI,QAAQ;QAAE,OAAO,4BAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,GAAI,CAAC;IACxE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CACpB,mCAAuB,wBAAwB,YAC5C,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACnB,uBAAoB,IAAI,CAAC,KAAK,IAArB,IAAI,CAAC,GAAG,CAAmB,CACrC,CAAC,GACC,CACN,CAAC,CAAC,CAAC,CACF,iDAA6B,CAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export type EstimatedInvoice = {
|
|
3
|
+
currency: string;
|
|
4
|
+
total: number;
|
|
5
|
+
nextBillingAt: number;
|
|
6
|
+
lines: {
|
|
7
|
+
id: string;
|
|
8
|
+
description: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
sourceType?: string;
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
export declare function useInvoiceEstimate(load: () => Promise<EstimatedInvoice>, scopeKey: string): {
|
|
14
|
+
invoice: EstimatedInvoice | undefined;
|
|
15
|
+
isPending: boolean;
|
|
16
|
+
error: string | null;
|
|
17
|
+
refresh: () => Promise<EstimatedInvoice | undefined>;
|
|
18
|
+
};
|
|
19
|
+
export type InvoiceEstimateProps = {
|
|
20
|
+
scopeKey: string;
|
|
21
|
+
load: () => Promise<EstimatedInvoice>;
|
|
22
|
+
children?: (state: ReturnType<typeof useInvoiceEstimate>) => ReactNode;
|
|
23
|
+
};
|
|
24
|
+
export declare function InvoiceEstimate({ scopeKey, load, children, }: InvoiceEstimateProps): import("react").JSX.Element;
|
|
25
|
+
export type BalanceFundingActions = {
|
|
26
|
+
scopeKey: string;
|
|
27
|
+
change: (args: {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
consent?: true;
|
|
30
|
+
}) => Promise<unknown>;
|
|
31
|
+
};
|
|
32
|
+
export declare function useBalanceFunding({ scopeKey, change }: BalanceFundingActions): {
|
|
33
|
+
consent: boolean;
|
|
34
|
+
setConsent: (consent: boolean) => void;
|
|
35
|
+
error: string | null;
|
|
36
|
+
isPending: boolean;
|
|
37
|
+
confirm: (enabled: boolean) => Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
export type BalancePaymentSourceProps = BalanceFundingActions & {
|
|
40
|
+
enabled: boolean | undefined;
|
|
41
|
+
consentLabel?: string;
|
|
42
|
+
children?: (state: ReturnType<typeof useBalanceFunding> & {
|
|
43
|
+
enabled: boolean | undefined;
|
|
44
|
+
}) => ReactNode;
|
|
45
|
+
};
|
|
46
|
+
export declare function BalancePaymentSource(props: BalancePaymentSourceProps): import("react").JSX.Element;
|
|
47
|
+
export type BillingPortalProps = {
|
|
48
|
+
scopeKey?: string;
|
|
49
|
+
createSession: () => Promise<string | {
|
|
50
|
+
url: string;
|
|
51
|
+
}>;
|
|
52
|
+
onNavigate?: (url: string) => void;
|
|
53
|
+
children?: (state: {
|
|
54
|
+
open: () => Promise<true | undefined>;
|
|
55
|
+
isPending: boolean;
|
|
56
|
+
error: string | null;
|
|
57
|
+
}) => ReactNode;
|
|
58
|
+
};
|
|
59
|
+
export declare function BillingPortal(props: BillingPortalProps): import("react").JSX.Element;
|
|
60
|
+
//# sourceMappingURL=Billing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Billing.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Billing.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGxD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;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O,iBAAiB,CAAC,GAAG;QAC5C,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;KAC9B,KACE,SAAS,CAAC;CAChB,CAAC;AACF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,+BAwDpE;AACD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvD,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QACjB,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;QACtC,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACtB,KAAK,SAAS,CAAC;CACjB,CAAC;AACF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BA4BtD"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { useWorkflowAction } from "./useWorkflowAction.js";
|
|
5
|
+
import { formatPrice } from "../lib/price-helpers.js";
|
|
6
|
+
export function useInvoiceEstimate(load, scopeKey) {
|
|
7
|
+
const action = useWorkflowAction(load, scopeKey);
|
|
8
|
+
return {
|
|
9
|
+
invoice: action.result,
|
|
10
|
+
isPending: action.isPending,
|
|
11
|
+
error: action.error,
|
|
12
|
+
refresh: action.run,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function InvoiceEstimate({ scopeKey, load, children, }) {
|
|
16
|
+
const state = useInvoiceEstimate(load, scopeKey);
|
|
17
|
+
if (children)
|
|
18
|
+
return _jsx(_Fragment, { children: children(state) });
|
|
19
|
+
return (_jsxs("section", { "data-better-stripe": "invoice-estimate", children: [_jsx("h2", { children: "Estimated next invoice" }), _jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
20
|
+
void state.refresh();
|
|
21
|
+
}, children: state.isPending
|
|
22
|
+
? "Loading…"
|
|
23
|
+
: state.invoice
|
|
24
|
+
? "Refresh estimate"
|
|
25
|
+
: "View estimate" }), state.error && _jsx("p", { role: "alert", children: state.error }), state.invoice && (_jsxs(_Fragment, { children: [_jsxs("p", { children: ["Next billing date:", " ", new Date(state.invoice.nextBillingAt).toLocaleDateString()] }), _jsx("ul", { children: state.invoice.lines.map((line) => (_jsxs("li", { children: [line.description, " ", _jsx("span", { children: formatPrice(line.amount, state.invoice.currency) })] }, line.id))) }), _jsxs("p", { children: ["Estimated total:", " ", _jsx("span", { children: formatPrice(state.invoice.total, state.invoice.currency) })] })] }))] }));
|
|
26
|
+
}
|
|
27
|
+
export function useBalanceFunding({ scopeKey, change }) {
|
|
28
|
+
const [state, setState] = useState({ scope: scopeKey, consent: false });
|
|
29
|
+
if (state.scope !== scopeKey)
|
|
30
|
+
setState({ scope: scopeKey, consent: false });
|
|
31
|
+
const action = useWorkflowAction(async (enabled) => {
|
|
32
|
+
if (enabled && !state.consent)
|
|
33
|
+
throw new Error("Explicit consent is required to debit a Stripe balance.");
|
|
34
|
+
await change({ enabled, consent: enabled ? true : undefined });
|
|
35
|
+
return true;
|
|
36
|
+
}, scopeKey);
|
|
37
|
+
return {
|
|
38
|
+
consent: state.consent,
|
|
39
|
+
setConsent: (consent) => setState((previous) => ({ ...previous, consent })),
|
|
40
|
+
error: action.error,
|
|
41
|
+
isPending: action.isPending,
|
|
42
|
+
confirm: async (enabled) => {
|
|
43
|
+
if (await action.run(enabled))
|
|
44
|
+
setState((previous) => ({ ...previous, consent: false }));
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function BalancePaymentSource(props) {
|
|
49
|
+
const state = useBalanceFunding(props);
|
|
50
|
+
const id = useId();
|
|
51
|
+
if (props.children)
|
|
52
|
+
return _jsx(_Fragment, { children: props.children({ ...state, enabled: props.enabled }) });
|
|
53
|
+
return (_jsxs("section", { "data-better-stripe": "balance-payment-source", children: [_jsx("h2", { children: "Payment source" }), _jsx("p", { role: "status", children: props.enabled === undefined
|
|
54
|
+
? "Loading…"
|
|
55
|
+
: props.enabled
|
|
56
|
+
? "Pay from Stripe balance"
|
|
57
|
+
: "Pay with saved payment method" }), _jsx("p", { children: "If your Stripe balance is insufficient, payment can fail. Switch to a saved payment method to pay instead." }), state.error && _jsx("p", { role: "alert", children: state.error }), props.enabled === false && (_jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: id, children: [_jsx("input", { id: id, type: "checkbox", checked: state.consent, onChange: (event) => state.setConsent(event.target.checked) }), props.consentLabel ??
|
|
58
|
+
"I authorize recurring platform charges from my Stripe balance."] }), _jsx("button", { type: "button", disabled: !state.consent || state.isPending, onClick: () => {
|
|
59
|
+
void state.confirm(true);
|
|
60
|
+
}, children: state.isPending ? "Saving…" : "Confirm balance payments" })] })), props.enabled && (_jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
61
|
+
void state.confirm(false);
|
|
62
|
+
}, children: "Use saved payment method" }))] }));
|
|
63
|
+
}
|
|
64
|
+
export function BillingPortal(props) {
|
|
65
|
+
const action = useWorkflowAction(async () => {
|
|
66
|
+
const result = await props.createSession();
|
|
67
|
+
const url = typeof result === "string" ? result : result.url;
|
|
68
|
+
if (!url)
|
|
69
|
+
throw new Error("Stripe did not return a portal URL.");
|
|
70
|
+
(props.onNavigate ?? ((url) => window.location.assign(url)))(url);
|
|
71
|
+
return true;
|
|
72
|
+
}, props.scopeKey);
|
|
73
|
+
const state = {
|
|
74
|
+
open: action.run,
|
|
75
|
+
isPending: action.isPending,
|
|
76
|
+
error: action.error,
|
|
77
|
+
};
|
|
78
|
+
if (props.children)
|
|
79
|
+
return _jsx(_Fragment, { children: props.children(state) });
|
|
80
|
+
return (_jsxs("div", { "data-better-stripe": "billing-portal", children: [action.error && _jsx("p", { role: "alert", children: action.error }), _jsx("button", { type: "button", disabled: action.isPending, onClick: () => {
|
|
81
|
+
void action.run();
|
|
82
|
+
}, children: action.isPending ? "Opening portal…" : "Open Stripe Billing Portal" })] }));
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=Billing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Billing.js","sourceRoot":"","sources":["../../../src/react/workflows/Billing.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAYtD,MAAM,UAAU,kBAAkB,CAChC,IAAqC,EACrC,QAAgB;IAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM;QACtB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,MAAM,CAAC,GAAG;KACpB,CAAC;AACJ,CAAC;AAMD,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,IAAI,EACJ,QAAQ,GACa;IACrB,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACjD,IAAI,QAAQ;QAAE,OAAO,4BAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;IAC5C,OAAO,CACL,yCAA4B,kBAAkB,aAC5C,kDAA+B,EAC/B,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,OAAO,EAAE,GAAG,EAAE;oBACZ,KAAK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a,EAAE,CAAC;QAC3C,MAAM,GAAG,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QAC7D,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACjE,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAClE,OAAO,IAAa,CAAC;IACvB,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACnB,MAAM,KAAK,GAAG;QACZ,IAAI,EAAE,MAAM,CAAC,GAAG;QAChB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;IACF,IAAI,KAAK,CAAC,QAAQ;QAAE,OAAO,4BAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;IACxD,OAAO,CACL,qCAAwB,gBAAgB,aACrC,MAAM,CAAC,KAAK,IAAI,YAAG,IAAI,EAAC,OAAO,YAAE,MAAM,CAAC,KAAK,GAAK,EACnD,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,MAAM,CAAC,SAAS,EAC1B,OAAO,EAAE,GAAG,EAAE;oBACZ,KAAK,MAAM,CAAC,GAAG,EAAE,CAAC;gBACpB,CAAC,YAEA,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,4BAA4B,GAC7D,IACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { CheckoutSessionResult } from "./Checkout.js";
|
|
3
|
+
export type PlanBillingOptions<PlanId extends string = string> = {
|
|
4
|
+
scopeKey: string;
|
|
5
|
+
sessionId?: string | null;
|
|
6
|
+
confirm?: (sessionId: string) => Promise<unknown>;
|
|
7
|
+
createCheckout: (planId: PlanId) => Promise<CheckoutSessionResult>;
|
|
8
|
+
createPortal: () => Promise<string | {
|
|
9
|
+
url: string;
|
|
10
|
+
}>;
|
|
11
|
+
onNavigate?: (url: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function usePlanBilling<PlanId extends string = string>(props: PlanBillingOptions<PlanId>): {
|
|
14
|
+
clientSecret: string | undefined;
|
|
15
|
+
isPending: boolean;
|
|
16
|
+
error: string | null;
|
|
17
|
+
choose: (planId: PlanId) => Promise<{
|
|
18
|
+
type: "checkout";
|
|
19
|
+
clientSecret: string;
|
|
20
|
+
url?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
clientSecret?: undefined;
|
|
23
|
+
type: "portal";
|
|
24
|
+
url: string;
|
|
25
|
+
} | undefined>;
|
|
26
|
+
openPortal: () => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
export type BillingPlan<PlanId extends string = string> = {
|
|
29
|
+
id: PlanId;
|
|
30
|
+
name: string;
|
|
31
|
+
monthlyAmount: number;
|
|
32
|
+
currency: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
feeDescription?: string;
|
|
35
|
+
};
|
|
36
|
+
export type BillingPlansProps<PlanId extends string = string> = PlanBillingOptions<PlanId> & {
|
|
37
|
+
plans: BillingPlan<PlanId>[];
|
|
38
|
+
publishableKey: string;
|
|
39
|
+
currentPlanId?: PlanId;
|
|
40
|
+
children?: (state: ReturnType<typeof usePlanBilling<PlanId>> & {
|
|
41
|
+
plans: BillingPlan<PlanId>[];
|
|
42
|
+
}) => ReactNode;
|
|
43
|
+
};
|
|
44
|
+
export declare function BillingPlans<PlanId extends string = string>(props: BillingPlansProps<PlanId>): import("react").JSX.Element;
|
|
45
|
+
//# sourceMappingURL=BillingPlans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BillingPlans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MAAM,CAAC,GAAG;IAC3B,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG;QACjD,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;KAC9B,KACE,SAAS,CAAC;CAChB,CAAC;AACJ,wBAAgB,YAAY,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,EACzD,KAAK,EAAE,iBAAiB,CAAC,MAAM,CAAC,+BA+CjC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { EmbeddedCheckout } from "../components/EmbeddedCheckout.js";
|
|
4
|
+
import { formatPrice } from "../lib/price-helpers.js";
|
|
5
|
+
import { useWorkflowAction } from "./useWorkflowAction.js";
|
|
6
|
+
import { useWorkflowResource } from "./useWorkflowResource.js";
|
|
7
|
+
export function usePlanBilling(props) {
|
|
8
|
+
const confirmation = useWorkflowResource(() => props.sessionId && props.confirm
|
|
9
|
+
? props.confirm(props.sessionId)
|
|
10
|
+
: Promise.resolve(null), `${props.scopeKey}:${props.sessionId ?? ""}`);
|
|
11
|
+
const action = useWorkflowAction(async (operation) => {
|
|
12
|
+
if (operation.type === "checkout") {
|
|
13
|
+
const session = await props.createCheckout(operation.planId);
|
|
14
|
+
if (!session.clientSecret)
|
|
15
|
+
throw new Error("Stripe did not return a checkout form.");
|
|
16
|
+
return {
|
|
17
|
+
type: "checkout",
|
|
18
|
+
clientSecret: session.clientSecret,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const result = await props.createPortal();
|
|
22
|
+
const url = typeof result === "string" ? result : result.url;
|
|
23
|
+
if (!url)
|
|
24
|
+
throw new Error("Stripe did not return a billing portal URL.");
|
|
25
|
+
return { type: "portal", url };
|
|
26
|
+
}, props.scopeKey);
|
|
27
|
+
return {
|
|
28
|
+
clientSecret: action.result?.type === "checkout"
|
|
29
|
+
? action.result.clientSecret
|
|
30
|
+
: undefined,
|
|
31
|
+
isPending: action.isPending,
|
|
32
|
+
error: action.error ?? confirmation.error,
|
|
33
|
+
choose: (planId) => action.run({ type: "checkout", planId }),
|
|
34
|
+
openPortal: async () => {
|
|
35
|
+
const result = await action.run({ type: "portal" });
|
|
36
|
+
if (result?.type === "portal")
|
|
37
|
+
(props.onNavigate ?? ((url) => window.location.assign(url)))(result.url);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function BillingPlans(props) {
|
|
42
|
+
const state = usePlanBilling(props);
|
|
43
|
+
if (props.children)
|
|
44
|
+
return _jsx(_Fragment, { children: props.children({ ...state, plans: props.plans }) });
|
|
45
|
+
return (_jsxs("section", { "data-better-stripe": "billing-plans", "aria-busy": state.isPending, children: [_jsx("h2", { children: "Billing" }), state.error && _jsx("p", { role: "alert", children: state.error }), _jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
46
|
+
void state.openPortal();
|
|
47
|
+
}, children: state.isPending ? "Loading…" : "Manage billing" }), props.plans.length ? (props.plans.map((plan) => (_jsxs("article", { children: [_jsx("h3", { children: plan.name }), _jsxs("p", { children: [formatPrice(plan.monthlyAmount, plan.currency), "/month"] }), plan.description && _jsx("p", { children: plan.description }), plan.feeDescription && _jsx("p", { children: plan.feeDescription }), _jsx("button", { type: "button", disabled: state.isPending || plan.id === props.currentPlanId, onClick: () => {
|
|
48
|
+
void state.choose(plan.id);
|
|
49
|
+
}, children: plan.id === props.currentPlanId ? "Current plan" : "Choose plan" })] }, plan.id)))) : (_jsx("p", { children: "No billing plans configured." })), state.clientSecret && (_jsx(EmbeddedCheckout, { publishableKey: props.publishableKey, clientSecret: state.clientSecret }))] }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=BillingPlans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BillingPlans.js","sourceRoot":"","sources":["../../../src/react/workflows/BillingPlans.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAU/D,MAAM,UAAU,cAAc,CAC5B,KAAiC;IAEjC,MAAM,YAAY,GAAG,mBAAmB,CACtC,GAAG,EAAE,CACH,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO;QAC9B,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QAChC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAC3B,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,SAAS,IAAI,EAAE,EAAE,CAC7C,CAAC;IACF,MAAM,MAAM,GAAG,iBAAiB,CAC9B,KAAK,EACH,SAAoE,EACpE,EAAE;QACF,IAAI,SAAS,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAClC,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAC7D,IAAI,CAAC,OAAO,CAAC,YAAY;gBACvB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAC5D,OAAO;gBACL,IAAI,EAAE,UAAmB;gBACzB,YAAY,EAAE,OAAO,CAAC,YAAY;aACnC,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,YAAY,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,OAAO,MA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,CACrB,KAAC,gBAAgB,IACf,cAAc,EAAE,KAAK,CAAC,cAAc,EACpC,YAAY,EAAE,KAAK,CAAC,YAAY,GAChC,CACH,IACO,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type CheckoutFormOptions } from "./CheckoutForms.js";
|
|
3
|
+
export type CheckoutMode = "redirect" | "embedded" | "custom" | "form" | "payment-intent";
|
|
4
|
+
export type CheckoutSessionResult = {
|
|
5
|
+
stripeSessionId: string;
|
|
6
|
+
clientSecret?: string;
|
|
7
|
+
url?: string;
|
|
8
|
+
};
|
|
9
|
+
export type CheckoutIntentResult = {
|
|
10
|
+
paymentIntentId: string;
|
|
11
|
+
clientSecret: string;
|
|
12
|
+
};
|
|
13
|
+
export type CheckoutRequest = {
|
|
14
|
+
mode: Exclude<CheckoutMode, "payment-intent">;
|
|
15
|
+
requestId: string;
|
|
16
|
+
};
|
|
17
|
+
export type CheckoutRenderProps = {
|
|
18
|
+
content: ReactNode;
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
error: string | null;
|
|
21
|
+
retry: () => void;
|
|
22
|
+
mode: CheckoutMode;
|
|
23
|
+
hostedUrl?: string;
|
|
24
|
+
continueToCheckout?: () => void;
|
|
25
|
+
};
|
|
26
|
+
type Common = CheckoutFormOptions & {
|
|
27
|
+
publishableKey: string;
|
|
28
|
+
/** Changes when the price, signed-in customer, or referral attribution changes. */
|
|
29
|
+
orderKey: string;
|
|
30
|
+
returnUrl: string;
|
|
31
|
+
onNavigate?: (url: string) => void;
|
|
32
|
+
children?: (state: CheckoutRenderProps) => ReactNode;
|
|
33
|
+
};
|
|
34
|
+
export type CheckoutProps = Common & ({
|
|
35
|
+
mode: Exclude<CheckoutMode, "payment-intent">;
|
|
36
|
+
createSession: (request: CheckoutRequest) => Promise<CheckoutSessionResult>;
|
|
37
|
+
} | {
|
|
38
|
+
mode: "payment-intent";
|
|
39
|
+
createPaymentIntent: (request: {
|
|
40
|
+
requestId: string;
|
|
41
|
+
}) => Promise<CheckoutIntentResult>;
|
|
42
|
+
});
|
|
43
|
+
/** All checkout integrations share one unstyled lifecycle. Callbacks must authenticate and validate prices on the server. */
|
|
44
|
+
export declare function Checkout(props: CheckoutProps): import("react").JSX.Element;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=Checkout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkout.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Checkout.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAC5B,MAAM,MAAM,YAAY,GACtB,UAAU,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,gBAAgB,CAAC;AACjE,MAAM,MAAM,qBAAqB,GAAG;IAClC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,SAAS,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,YAAY,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC,CAAC;AACF,KAAK,MAAM,GAAG,mBAAmB,GAAG;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,mFAAmF;IACnF,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;CACtD,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,MAAM,GAChC,CACI;IACE,IAAI,EAAE,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAC9C,aAAa,EAAE,CACb,OAAO,EAAE,eAAe,KACrB,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACrC,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,mBAAmB,EAAE,CAAC,OAAO,EAAE;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACrC,CACJ,CAAC;AACJ,6HAA6H;AAC7H,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BAE5C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { EmbeddedCheckout } from "../components/EmbeddedCheckout.js";
|
|
4
|
+
import { useWorkflowResource } from "./useWorkflowResource.js";
|
|
5
|
+
import { CheckoutElementsForm, PaymentIntentForm, CheckoutForm, } from "./CheckoutForms.js";
|
|
6
|
+
/** All checkout integrations share one unstyled lifecycle. Callbacks must authenticate and validate prices on the server. */
|
|
7
|
+
export function Checkout(props) {
|
|
8
|
+
return _jsx(CheckoutBody, { ...props }, `${props.orderKey}:${props.mode}`);
|
|
9
|
+
}
|
|
10
|
+
function CheckoutBody(props) {
|
|
11
|
+
const state = useWorkflowResource(async () => {
|
|
12
|
+
const requestId = crypto.randomUUID();
|
|
13
|
+
const result = props.mode === "payment-intent"
|
|
14
|
+
? await props.createPaymentIntent({ requestId })
|
|
15
|
+
: await props.createSession({ mode: props.mode, requestId });
|
|
16
|
+
if (props.mode === "redirect") {
|
|
17
|
+
if (!("url" in result) || !result.url)
|
|
18
|
+
throw new Error("Stripe did not return a checkout URL.");
|
|
19
|
+
}
|
|
20
|
+
else if (!result.clientSecret)
|
|
21
|
+
throw new Error("Stripe did not return a checkout client secret.");
|
|
22
|
+
return result;
|
|
23
|
+
});
|
|
24
|
+
const navigate = props.onNavigate ?? ((url) => window.location.assign(url));
|
|
25
|
+
let content;
|
|
26
|
+
if (state.error)
|
|
27
|
+
content = (_jsxs("div", { role: "alert", children: [_jsx("p", { children: state.error }), _jsx("button", { type: "button", onClick: state.refresh, children: "Retry" })] }));
|
|
28
|
+
else if (!state.data || state.isLoading)
|
|
29
|
+
content = _jsx("p", { role: "status", children: "Creating checkout\u2026" });
|
|
30
|
+
else if (props.mode === "redirect" && "url" in state.data) {
|
|
31
|
+
const url = state.data.url;
|
|
32
|
+
content = (_jsx("button", { type: "button", onClick: () => navigate(url), children: "Continue to Stripe Checkout" }));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const form = {
|
|
36
|
+
publishableKey: props.publishableKey,
|
|
37
|
+
clientSecret: state.data.clientSecret,
|
|
38
|
+
returnUrl: props.returnUrl,
|
|
39
|
+
email: props.email,
|
|
40
|
+
appearance: props.appearance,
|
|
41
|
+
renderForm: props.renderForm,
|
|
42
|
+
onNavigate: navigate,
|
|
43
|
+
};
|
|
44
|
+
content =
|
|
45
|
+
props.mode === "embedded" ? (_jsx(EmbeddedCheckout, { publishableKey: form.publishableKey, clientSecret: form.clientSecret })) : props.mode === "custom" ? (_jsx(CheckoutElementsForm, { ...form })) : props.mode === "form" ? (_jsx(CheckoutForm, { ...form })) : (_jsx(PaymentIntentForm, { ...form }));
|
|
46
|
+
}
|
|
47
|
+
const hostedUrl = props.mode === "redirect" && state.data && "url" in state.data
|
|
48
|
+
? state.data.url
|
|
49
|
+
: undefined;
|
|
50
|
+
const result = {
|
|
51
|
+
content,
|
|
52
|
+
isLoading: state.isLoading,
|
|
53
|
+
error: state.error,
|
|
54
|
+
retry: state.refresh,
|
|
55
|
+
mode: props.mode,
|
|
56
|
+
hostedUrl,
|
|
57
|
+
continueToCheckout: hostedUrl ? () => navigate(hostedUrl) : undefined,
|
|
58
|
+
};
|
|
59
|
+
return _jsx(_Fragment, { children: props.children ? props.children(result) : content });
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=Checkout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkout.js","sourceRoot":"","sources":["../../../src/react/workflows/Checkout.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAgD5B,6HAA6H;AAC7H,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,OAAO,KAAC,YAAY,OAA6C,KAAK,IAA5C,GAAG,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAe,CAAC;AAC7E,CAAC;AACD,SAAS,YAAY,CAAC,KAAoB;IACxC,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,IAAI,EAAE;QAC3C,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACtC,MAAM,MAAM,GACV,KAAK,CAAC,IAAI,KAAK,gBAAgB;YAC7B,CAAC,CAAC,MAAM,KAAK,CAAC,mBAAmB,CAAC,EAAE,SAAS,EAAE,CAAC;YAChD,CAAC,CAAC,MAAM,KAAK,CAAC,aAAa,CAAC,EAAE,I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;IACF,OAAO,4BAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,GAAI,CAAC;AAClE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { CHECKOUT_OPTIONS } from "./checkout-options.js";
|
|
3
|
+
import type { CheckoutMode } from "./Checkout.js";
|
|
4
|
+
export type CheckoutOption = (typeof CHECKOUT_OPTIONS)[number];
|
|
5
|
+
export type CheckoutChooserState = {
|
|
6
|
+
options: typeof CHECKOUT_OPTIONS;
|
|
7
|
+
selected: CheckoutOption;
|
|
8
|
+
unsupported: boolean;
|
|
9
|
+
select: (mode: CheckoutMode) => void;
|
|
10
|
+
};
|
|
11
|
+
export type CheckoutChooserProps = {
|
|
12
|
+
value?: CheckoutMode;
|
|
13
|
+
defaultValue?: CheckoutMode;
|
|
14
|
+
onValueChange?: (mode: CheckoutMode) => void;
|
|
15
|
+
recurring?: boolean;
|
|
16
|
+
children?: (state: CheckoutChooserState) => ReactNode;
|
|
17
|
+
};
|
|
18
|
+
/** Checkout tradeoffs and mode selection, independent of routing and session creation. */
|
|
19
|
+
export declare function CheckoutChooser({ value, defaultValue, onValueChange, recurring, children, }: CheckoutChooserProps): import("react").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=CheckoutChooser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckoutChooser.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/CheckoutChooser.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/D,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,gBAAgB,CAAC;IACjC,QAAQ,EAAE,cAAc,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CACtC,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAAC;CACvD,CAAC;AACF,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,YAAyB,EACzB,aAAa,EACb,SAAiB,EACjB,QAAQ,GACT,EAAE,oBAAoB,+BAmDtB"}
|