@fantastic.dev/better-stripe 0.6.1 → 0.8.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 +28 -16
- package/README.md +130 -90
- 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/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 +10 -24
- package/dist/client/webhooks/processors.js.map +1 -1
- package/dist/component/_generated/component.d.ts +34 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/billing/queries.d.ts +36 -0
- package/dist/component/billing/queries.d.ts.map +1 -1
- package/dist/component/billing/queries.js +10 -0
- package/dist/component/billing/queries.js.map +1 -1
- package/dist/component/billing/schema.d.ts +1 -0
- package/dist/component/billing/schema.d.ts.map +1 -1
- package/dist/component/billing/schema.js +1 -0
- package/dist/component/billing/schema.js.map +1 -1
- package/dist/component/connect/mutations.d.ts.map +1 -1
- package/dist/component/connect/mutations.js +28 -28
- 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/component/schema.d.ts +1 -0
- 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/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 +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +2 -0
- 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 +47 -0
- package/dist/react/workflows/Payouts.d.ts.map +1 -0
- package/dist/react/workflows/Payouts.js +87 -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 +66 -0
- package/docs/react-workflows.md +231 -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/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 +34 -34
- package/src/client/webhooks/processors.ts +9 -26
- package/src/client/webhooks.test.ts +1 -2
- package/src/component/_generated/api.ts +2 -0
- package/src/component/_generated/component.ts +46 -0
- package/src/component/billing/queries.ts +12 -0
- package/src/component/billing/schema.ts +1 -0
- package/src/component/connect/mutations.ts +34 -35
- 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/seller-case-ownership.test.ts +61 -0
- package/src/component/store-subscriptions.test.ts +32 -0
- 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/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 +2 -8
- 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 +3 -0
- 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 +25 -0
- package/src/react/workflows/Disputes.tsx +164 -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 +82 -0
- package/src/react/workflows/Payouts.tsx +212 -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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Collection } from "./Collection.js";
|
|
4
|
+
import { formatPrice } from "../lib/price-helpers.js";
|
|
5
|
+
export function Sales(props) {
|
|
6
|
+
const columns = [
|
|
7
|
+
{ id: "planId", label: "Plan", cell: (row) => row.planId },
|
|
8
|
+
...[
|
|
9
|
+
["gross", "Sale"],
|
|
10
|
+
["processingFee", "Stripe processing"],
|
|
11
|
+
["platformNet", "Platform"],
|
|
12
|
+
["affiliateNet", "Affiliate"],
|
|
13
|
+
["costRecoveryAmount", "Cost recovery"],
|
|
14
|
+
["sellerNet", "Your earnings"],
|
|
15
|
+
].map(([field, label]) => ({
|
|
16
|
+
id: field,
|
|
17
|
+
label,
|
|
18
|
+
align: "end",
|
|
19
|
+
cell: (row) => formatPrice(row[field] ?? 0, row.currency),
|
|
20
|
+
})),
|
|
21
|
+
{ id: "status", label: "Status", cell: (row) => row.status },
|
|
22
|
+
{ id: "payment", label: "Payment", cell: (row) => row.paymentIntentId },
|
|
23
|
+
];
|
|
24
|
+
return (_jsx(Collection, { emptyLabel: "No sales yet.", ...props, getKey: (row) => row._id ?? row.paymentIntentId, columns: props.columns ?? columns }));
|
|
25
|
+
}
|
|
26
|
+
export function Invoices(props) {
|
|
27
|
+
const columns = [
|
|
28
|
+
{ id: "id", label: "Invoice ID", cell: (row) => row.stripeInvoiceId },
|
|
29
|
+
{
|
|
30
|
+
id: "amount",
|
|
31
|
+
label: "Amount",
|
|
32
|
+
align: "end",
|
|
33
|
+
cell: (row) => formatPrice(row.amountPaid ?? row.amountDue ?? 0, row.currency),
|
|
34
|
+
},
|
|
35
|
+
{ id: "status", label: "Status", cell: (row) => row.status },
|
|
36
|
+
{
|
|
37
|
+
id: "invoice",
|
|
38
|
+
label: "Invoice",
|
|
39
|
+
cell: (row) => row.hostedInvoiceUrl ? (_jsx("a", { href: row.hostedInvoiceUrl, target: "_blank", rel: "noopener noreferrer", children: "View invoice" })) : ("Unavailable"),
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
return (_jsx(Collection, { emptyLabel: "No invoices yet.", ...props, getKey: (row) => row.stripeInvoiceId, columns: props.columns ?? columns }));
|
|
43
|
+
}
|
|
44
|
+
export function RefundHistory(props) {
|
|
45
|
+
const columns = [
|
|
46
|
+
{ id: "id", label: "Refund ID", cell: (row) => row.stripeRefundId },
|
|
47
|
+
{
|
|
48
|
+
id: "amount",
|
|
49
|
+
label: "Amount",
|
|
50
|
+
align: "end",
|
|
51
|
+
cell: (row) => formatPrice(row.amount, row.currency),
|
|
52
|
+
},
|
|
53
|
+
{ id: "status", label: "Status", cell: (row) => row.status },
|
|
54
|
+
{
|
|
55
|
+
id: "reason",
|
|
56
|
+
label: "Reason",
|
|
57
|
+
cell: (row) => row.reason ?? "Not supplied",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "created",
|
|
61
|
+
label: "Created",
|
|
62
|
+
cell: (row) => row._creationTime === undefined
|
|
63
|
+
? "Not supplied"
|
|
64
|
+
: new Date(row._creationTime).toLocaleString(),
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
return (_jsx(Collection, { emptyLabel: "No refunds yet.", ...props, getKey: (row) => row.stripeRefundId, columns: props.columns ?? columns }));
|
|
68
|
+
}
|
|
69
|
+
export function ReferredSales(props) {
|
|
70
|
+
const columns = [
|
|
71
|
+
{
|
|
72
|
+
id: "store",
|
|
73
|
+
label: "Store",
|
|
74
|
+
cell: (row) => row.storeName ?? "Store unavailable",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "payment",
|
|
78
|
+
label: "Payment",
|
|
79
|
+
cell: (row) => row.sourceChargeId ?? row.stripeTransferId,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: "commission",
|
|
83
|
+
label: "Commission",
|
|
84
|
+
align: "end",
|
|
85
|
+
cell: (row) => formatPrice(row.amount, row.currency ?? "usd"),
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
return (_jsx(Collection, { emptyLabel: "No referred sales yet.", ...props, getKey: (row) => row.stripeTransferId, columns: props.columns ?? columns }));
|
|
89
|
+
}
|
|
90
|
+
export function WebhookEvents(props) {
|
|
91
|
+
const columns = [
|
|
92
|
+
{ id: "type", label: "Type", cell: (row) => row.eventType },
|
|
93
|
+
{ id: "status", label: "Status", cell: (row) => row.status },
|
|
94
|
+
{ id: "id", label: "Event ID", cell: (row) => row.stripeEventId },
|
|
95
|
+
{ id: "error", label: "Error", cell: (row) => row.lastError ?? "None" },
|
|
96
|
+
{
|
|
97
|
+
id: "processed",
|
|
98
|
+
label: "Processed",
|
|
99
|
+
cell: (row) => row.processedAt === undefined
|
|
100
|
+
? "Not supplied"
|
|
101
|
+
: new Date(row.processedAt).toLocaleString(),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: "mode",
|
|
105
|
+
label: "Mode",
|
|
106
|
+
cell: (row) => (row.livemode ? "Live" : "Test"),
|
|
107
|
+
},
|
|
108
|
+
];
|
|
109
|
+
return (_jsx(Collection, { emptyLabel: "No webhook events yet.", ...props, getKey: (row) => row.stripeEventId, columns: props.columns ?? columns }));
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=Collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Collections.js","sourceRoot":"","sources":["../../../src/react/workflows/Collections.tsx"],"names":[],"mappings":"AAA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CAAC,GAAG,EAAE,EAAE,CACZ,GAAG,CAAC,WAAW,KAAK,SAAS;gBAC3B,CAAC,CAAC,cAAc;gBAChB,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,cAAc,EAAE;SACjD;QACD;YACE,EAAE,EAAE,MAAM;YACV,KAAK,EAAE,MAAM;YACb,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;SAChD;KACF,CAAC;IACF,OAAO,CACL,KAAC,UAAU,IACT,UAAU,EAAC,wBAAwB,KAC/B,KAAK,EACT,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,EAClC,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,OAAO,GACjC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ConnectProviderProps } from "../components/ConnectProvider.js";
|
|
3
|
+
export type ConnectComponent = "account" | "onboarding" | "payments" | "refunds" | "disputes" | "balances" | "payouts" | "notifications";
|
|
4
|
+
export type ConnectRenderProps = {
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
error: string | null;
|
|
7
|
+
retry: () => void;
|
|
8
|
+
completed: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ConnectProps = Omit<ConnectProviderProps, "children"> & {
|
|
11
|
+
component: ConnectComponent;
|
|
12
|
+
/** Remounts the Stripe instance when the authenticated account changes. The server must authorize it independently. */
|
|
13
|
+
scopeKey: string;
|
|
14
|
+
onExit?: () => void;
|
|
15
|
+
children?: (state: ConnectRenderProps) => ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/** Unstyled, account-scoped Connect component with session refresh, error recovery, appearance, and locale. */
|
|
18
|
+
export declare function Connect(props: ConnectProps): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=Connect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connect.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Connect.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUjD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAC1C,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,YAAY,GACZ,UAAU,GACV,SAAS,GACT,UAAU,GACV,UAAU,GACV,SAAS,GACT,eAAe,CAAC;AACpB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,GAAG;IAClE,SAAS,EAAE,gBAAgB,CAAC;IAC5B,uHAAuH;IACvH,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,SAAS,CAAC;CACrD,CAAC;AAWF,+GAA+G;AAC/G,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAI1C"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { ConnectAccountManagement, ConnectAccountOnboarding, ConnectBalances, ConnectDisputesList, ConnectNotificationBanner, ConnectPayments, ConnectPayouts, } from "@stripe/react-connect-js";
|
|
5
|
+
import { ConnectProvider, } from "../components/ConnectProvider.js";
|
|
6
|
+
const widgets = {
|
|
7
|
+
account: ConnectAccountManagement,
|
|
8
|
+
onboarding: ConnectAccountOnboarding,
|
|
9
|
+
payments: ConnectPayments,
|
|
10
|
+
refunds: ConnectPayments,
|
|
11
|
+
disputes: ConnectDisputesList,
|
|
12
|
+
balances: ConnectBalances,
|
|
13
|
+
payouts: ConnectPayouts,
|
|
14
|
+
notifications: ConnectNotificationBanner,
|
|
15
|
+
};
|
|
16
|
+
/** Unstyled, account-scoped Connect component with session refresh, error recovery, appearance, and locale. */
|
|
17
|
+
export function Connect(props) {
|
|
18
|
+
return (_jsx(ConnectBody, { ...props }, `${props.scopeKey}:${props.component}`));
|
|
19
|
+
}
|
|
20
|
+
function ConnectBody({ component, publishableKey, fetchClientSecret, appearance, locale, onExit, children, }) {
|
|
21
|
+
const [attempt, setAttempt] = useState(0);
|
|
22
|
+
const [error, setError] = useState(null);
|
|
23
|
+
const [completed, setCompleted] = useState(false);
|
|
24
|
+
const Widget = widgets[component];
|
|
25
|
+
const retry = () => {
|
|
26
|
+
setError(null);
|
|
27
|
+
setAttempt((value) => value + 1);
|
|
28
|
+
};
|
|
29
|
+
const content = error ? (_jsxs("div", { role: "alert", children: [_jsx("p", { children: error }), _jsx("button", { type: "button", onClick: retry, children: "Retry" })] })) : (_jsx(ConnectProvider, { publishableKey: publishableKey, appearance: appearance, locale: locale, fetchClientSecret: async () => {
|
|
30
|
+
try {
|
|
31
|
+
return await fetchClientSecret();
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
setError(error instanceof Error ? error.message : String(error));
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}, children: _jsx(Widget, { onLoadError: ({ error }) => setError(error.message ?? "Stripe could not load this component."), onExit: () => {
|
|
38
|
+
setCompleted(true);
|
|
39
|
+
onExit?.();
|
|
40
|
+
} }) }, attempt));
|
|
41
|
+
return (_jsx(_Fragment, { children: children ? children({ content, error, retry, completed }) : content }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=Connect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react";
|
|
2
|
+
import { type WorkflowColumn } from "./Collection.js";
|
|
3
|
+
import type { ResourceCollectionProps } from "./Collections.js";
|
|
4
|
+
export type CostRecoveryRow = {
|
|
5
|
+
_id?: string;
|
|
6
|
+
id?: string;
|
|
7
|
+
paymentIntentId: string;
|
|
8
|
+
amountDue: number;
|
|
9
|
+
collectedAmount: number;
|
|
10
|
+
invoicedAmount: number;
|
|
11
|
+
outstanding: number;
|
|
12
|
+
currency: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function CostRecovery(props: ResourceCollectionProps<CostRecoveryRow>): import("react").JSX.Element;
|
|
15
|
+
export type ChargebackTransfer = {
|
|
16
|
+
stripeTransferId: string;
|
|
17
|
+
destinationAccountId: string;
|
|
18
|
+
amount: number;
|
|
19
|
+
currency: string;
|
|
20
|
+
role?: string;
|
|
21
|
+
reversedAmount?: number;
|
|
22
|
+
reversalStatus?: string;
|
|
23
|
+
};
|
|
24
|
+
export type ChargebackSummary = {
|
|
25
|
+
dispute: {
|
|
26
|
+
stripeChargeId?: string;
|
|
27
|
+
currency: string;
|
|
28
|
+
status: string;
|
|
29
|
+
};
|
|
30
|
+
transfers: ChargebackTransfer[];
|
|
31
|
+
gross: number;
|
|
32
|
+
reversed: number;
|
|
33
|
+
net: number;
|
|
34
|
+
};
|
|
35
|
+
export type ChargebackLedgerRenderProps = {
|
|
36
|
+
data: ChargebackSummary | null | undefined;
|
|
37
|
+
isLoading: boolean;
|
|
38
|
+
isEmpty: boolean;
|
|
39
|
+
grossLabel: string;
|
|
40
|
+
reversedLabel: string;
|
|
41
|
+
netLabel: string;
|
|
42
|
+
columns: WorkflowColumn<ChargebackTransfer>[];
|
|
43
|
+
};
|
|
44
|
+
export declare function ChargebackLedger({ chargeback, children, }: {
|
|
45
|
+
chargeback: ChargebackSummary | null | undefined;
|
|
46
|
+
children?: (state: ChargebackLedgerRenderProps) => ReactNode;
|
|
47
|
+
}): import("react").JSX.Element;
|
|
48
|
+
//# sourceMappingURL=Costs.d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AC;AACF,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,cAAc,CAAC,kBAAkB,CAAC,EAAE,CAAC;CAC/C,CAAC;AACF,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;IACjD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,2BAA2B,KAAK,SAAS,CAAC;CAC9D,+BA2DA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Collection } from "./Collection.js";
|
|
4
|
+
import { formatPrice } from "../lib/price-helpers.js";
|
|
5
|
+
export function CostRecovery(props) {
|
|
6
|
+
const columns = [
|
|
7
|
+
{ id: "payment", label: "Payment", cell: (row) => row.paymentIntentId },
|
|
8
|
+
...[
|
|
9
|
+
["amountDue", "Total cost"],
|
|
10
|
+
["collectedAmount", "Deducted from earnings"],
|
|
11
|
+
["invoicedAmount", "Added to invoice"],
|
|
12
|
+
["outstanding", "Outstanding"],
|
|
13
|
+
].map(([field, label]) => ({
|
|
14
|
+
id: field,
|
|
15
|
+
label,
|
|
16
|
+
align: "end",
|
|
17
|
+
cell: (row) => formatPrice(row[field], row.currency),
|
|
18
|
+
})),
|
|
19
|
+
];
|
|
20
|
+
return (_jsx(Collection, { emptyLabel: "No costs yet.", loadingLabel: "Loading costs\u2026", ...props, columns: props.columns ?? columns, getKey: (row) => row._id ?? row.id ?? row.paymentIntentId }));
|
|
21
|
+
}
|
|
22
|
+
export function ChargebackLedger({ chargeback, children, }) {
|
|
23
|
+
const currency = chargeback?.dispute.currency ?? "usd";
|
|
24
|
+
const columns = [
|
|
25
|
+
{ id: "transfer", label: "Transfer", cell: (row) => row.stripeTransferId },
|
|
26
|
+
{
|
|
27
|
+
id: "account",
|
|
28
|
+
label: "Recipient",
|
|
29
|
+
cell: (row) => row.destinationAccountId,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "amount",
|
|
33
|
+
label: "Amount",
|
|
34
|
+
align: "end",
|
|
35
|
+
cell: (row) => formatPrice(row.amount, row.currency),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "reversed",
|
|
39
|
+
label: "Reversed",
|
|
40
|
+
align: "end",
|
|
41
|
+
cell: (row) => formatPrice(row.reversedAmount ?? 0, row.currency),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "status",
|
|
45
|
+
label: "Status",
|
|
46
|
+
cell: (row) => row.reversalStatus ?? "Not reversed",
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
const state = {
|
|
50
|
+
data: chargeback,
|
|
51
|
+
isLoading: chargeback === undefined,
|
|
52
|
+
isEmpty: chargeback === null || !chargeback?.dispute.stripeChargeId,
|
|
53
|
+
grossLabel: formatPrice(chargeback?.gross ?? 0, currency),
|
|
54
|
+
reversedLabel: formatPrice(-(chargeback?.reversed ?? 0), currency),
|
|
55
|
+
netLabel: formatPrice(chargeback?.net ?? 0, currency),
|
|
56
|
+
columns,
|
|
57
|
+
};
|
|
58
|
+
if (children)
|
|
59
|
+
return _jsx(_Fragment, { children: children(state) });
|
|
60
|
+
if (state.isLoading)
|
|
61
|
+
return _jsx("p", { role: "status", children: "Loading chargeback transfers\u2026" });
|
|
62
|
+
if (state.isEmpty)
|
|
63
|
+
return _jsx("p", { children: "No linked charge is available yet." });
|
|
64
|
+
return (_jsxs("section", { "data-better-stripe": "chargeback-ledger", children: [_jsx("h3", { children: "Chargeback transfers" }), _jsxs("dl", { children: [_jsx("dt", { children: "Original transfers" }), _jsx("dd", { children: state.grossLabel }), _jsx("dt", { children: "Funds pulled back" }), _jsx("dd", { children: state.reversedLabel }), _jsx("dt", { children: "Recipient net" }), _jsx("dd", { children: state.netLabel })] }), _jsx(Collection, { rows: chargeback.transfers, columns: columns, getKey: (row) => row.stripeTransferId, emptyLabel: "No transfer rows found." })] }));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=Costs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Costs.js","sourceRoot":"","sources":["../../../src/react/workflows/Costs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAuB,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAWtD,MAAM,UAAU,YAAY,CAAC,KAA+C;IAC1E,MAAM,OAAO,GAAsC;QACjD,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,eAAe,EAAE;QACvE,GACE;YACE,CAAC,WAAW,EAAE,YAAY,CAAC;YAC3B,CAAC,iBAAiB,EAAE,wBAAwB,CAAC;YAC7C,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;YACtC,CAAC,aAAa,EAAE,aAAa,CAAC;SAEjC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;YACzB,EAAE,EAAE,KAAK;YACT,KAAK;YACL,KAAK,EAAE,KAAc;YACrB,IAAI,EAAE,CAAC,GAAoB,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,QAAQ,CAAC;SACtE,CAAC,CAAC;KACJ,CAAC;IACF,OAAO,CACL,KAAC,UAAU,IACT,UAAU,EAAC,eAA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AAE,UAAU;QAChB,SAAS,EAAE,UAAU,KAAK,SAAS;QACnC,OAAO,EAAE,UAAU,KAAK,IAAI,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,cAAc;QACnE,UAAU,EAAE,WAAW,CAAC,UAAU,EAAE,KAAK,IAAI,CAAC,EAAE,QAAQ,CAAC;QACzD,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,IAAI,CAAC,CAAC,EAAE,QAAQ,CAAC;QAClE,QAAQ,EAAE,WAAW,CAAC,UAAU,EAAE,GAAG,IAAI,CAAC,EAAE,QAAQ,CAAC;QACrD,OAAO;KACR,CAAC;IACF,IAAI,QAAQ;QAAE,OAAO,4BAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;IAC5C,IAAI,KAAK,CAAC,SAAS;QACjB,OAAO,YAAG,IAAI,EAAC,QAAQ,mDAAkC,CAAC;IAC5D,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,6DAAyC,CAAC;IACpE,OAAO,CACL,yCAA4B,mBAAmB,aAC7C,gDAA6B,EAC7B,yBACE,8CAA2B,EAC3B,uBAAK,KAAK,CAAC,UAAU,GAAM,EAC3B,6CAA0B,EAC1B,uBAAK,KAAK,CAAC,aAAa,GAAM,EAC9B,yCAAsB,EACtB,uBAAK,KAAK,CAAC,QAAQ,GAAM,IACtB,EACL,KAAC,UAAU,IACT,IAAI,EAAE,UAAW,CAAC,SAAS,EAC3B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,gBAAgB,EACrC,UAAU,EAAC,yBAAyB,GACpC,IACM,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type DisputesListRow } from "../components/DisputesList.js";
|
|
3
|
+
import { type EvidenceFormUpdateArgs } from "../components/EvidenceForm.js";
|
|
4
|
+
import type { DisputeWithCountdown } from "../hooks/useDisputeWithCountdown.js";
|
|
5
|
+
import { type ConnectProps } from "./Connect.js";
|
|
6
|
+
export type DisputeResponseOptions = {
|
|
7
|
+
scopeKey: string;
|
|
8
|
+
acceptDispute?: (stripeDisputeId: string) => Promise<unknown>;
|
|
9
|
+
onSelectionChange?: (id: string | undefined) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function useDisputeResponse(props: DisputeResponseOptions): {
|
|
12
|
+
selectedId: string | undefined;
|
|
13
|
+
setSelectedId: (selectedId: string | undefined) => void;
|
|
14
|
+
acceptStatus: "accepted" | "confirming" | "error" | "idle" | "submitting";
|
|
15
|
+
acceptError: string | null;
|
|
16
|
+
isPending: boolean;
|
|
17
|
+
requestAccept: () => void;
|
|
18
|
+
cancelAccept: () => void;
|
|
19
|
+
accept: () => Promise<boolean | undefined>;
|
|
20
|
+
};
|
|
21
|
+
export type DisputesRenderProps = ReturnType<typeof useDisputeResponse> & {
|
|
22
|
+
disputes: DisputesListRow[] | undefined;
|
|
23
|
+
detail: DisputeWithCountdown | null | undefined;
|
|
24
|
+
};
|
|
25
|
+
export type HeadlessDisputesProps = DisputeResponseOptions & {
|
|
26
|
+
presentation?: "headless";
|
|
27
|
+
disputes: DisputesListRow[] | undefined;
|
|
28
|
+
detail?: DisputeWithCountdown | null;
|
|
29
|
+
onUpdateEvidence: (args: EvidenceFormUpdateArgs) => Promise<unknown>;
|
|
30
|
+
children?: (state: DisputesRenderProps) => ReactNode;
|
|
31
|
+
};
|
|
32
|
+
export type DisputesProps = HeadlessDisputesProps | (Omit<ConnectProps, "component"> & {
|
|
33
|
+
presentation: "embedded";
|
|
34
|
+
});
|
|
35
|
+
export declare function Disputes(props: DisputesProps): import("react").JSX.Element;
|
|
36
|
+
//# sourceMappingURL=Disputes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Disputes.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Disputes.tsx"],"names":[],"mappings":"AACA,OAAO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F,MAAM,MAAM,aAAa,GACrB,qBAAqB,GACrB,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG;IAAE,YAAY,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AACrE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BAM5C"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { DisputesList, } from "../components/DisputesList.js";
|
|
5
|
+
import { DisputeDetail } from "../components/DisputeDetail.js";
|
|
6
|
+
import { EvidenceForm, } from "../components/EvidenceForm.js";
|
|
7
|
+
import { useWorkflowAction } from "./useWorkflowAction.js";
|
|
8
|
+
import { Connect } from "./Connect.js";
|
|
9
|
+
export function useDisputeResponse(props) {
|
|
10
|
+
const initial = {
|
|
11
|
+
scope: props.scopeKey,
|
|
12
|
+
selectedId: undefined,
|
|
13
|
+
confirming: false,
|
|
14
|
+
};
|
|
15
|
+
const [state, setState] = useState(initial);
|
|
16
|
+
if (state.scope !== props.scopeKey)
|
|
17
|
+
setState(initial);
|
|
18
|
+
const action = useWorkflowAction(async () => {
|
|
19
|
+
if (!state.selectedId || !state.confirming)
|
|
20
|
+
throw new Error("Confirm accepting this dispute first.");
|
|
21
|
+
if (!props.acceptDispute)
|
|
22
|
+
throw new Error("Dispute acceptance is not configured.");
|
|
23
|
+
await props.acceptDispute(state.selectedId);
|
|
24
|
+
return true;
|
|
25
|
+
}, `${props.scopeKey}:${state.selectedId ?? ""}`);
|
|
26
|
+
return {
|
|
27
|
+
selectedId: state.selectedId,
|
|
28
|
+
setSelectedId: (selectedId) => {
|
|
29
|
+
setState((previous) => ({ ...previous, selectedId, confirming: false }));
|
|
30
|
+
props.onSelectionChange?.(selectedId);
|
|
31
|
+
action.reset();
|
|
32
|
+
},
|
|
33
|
+
acceptStatus: action.isPending
|
|
34
|
+
? "submitting"
|
|
35
|
+
: action.result
|
|
36
|
+
? "accepted"
|
|
37
|
+
: action.error
|
|
38
|
+
? "error"
|
|
39
|
+
: state.confirming
|
|
40
|
+
? "confirming"
|
|
41
|
+
: "idle",
|
|
42
|
+
acceptError: action.error,
|
|
43
|
+
isPending: action.isPending,
|
|
44
|
+
requestAccept: () => {
|
|
45
|
+
action.reset();
|
|
46
|
+
setState((previous) => ({ ...previous, confirming: true }));
|
|
47
|
+
},
|
|
48
|
+
cancelAccept: () => {
|
|
49
|
+
action.reset();
|
|
50
|
+
setState((previous) => ({ ...previous, confirming: false }));
|
|
51
|
+
},
|
|
52
|
+
accept: action.run,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function Disputes(props) {
|
|
56
|
+
return props.presentation === "embedded" ? (_jsx(Connect, { ...props, component: "disputes" })) : (_jsx(DisputesBody, { ...props }, props.scopeKey));
|
|
57
|
+
}
|
|
58
|
+
function DisputesBody(props) {
|
|
59
|
+
const state = useDisputeResponse(props);
|
|
60
|
+
const detail = props.detail?.stripeDisputeId === state.selectedId
|
|
61
|
+
? props.detail
|
|
62
|
+
: undefined;
|
|
63
|
+
if (props.children)
|
|
64
|
+
return (_jsx(_Fragment, { children: props.children({ ...state, disputes: props.disputes, detail }) }));
|
|
65
|
+
return (_jsxs("section", { "data-better-stripe": "disputes", children: [_jsx("h2", { children: "Disputes" }), _jsx(DisputesList, { disputes: props.disputes, isLoading: props.disputes === undefined, renderRow: (row) => (_jsxs("button", { type: "button", "aria-pressed": state.selectedId === row.dispute.stripeDisputeId, onClick: () => state.setSelectedId(row.dispute.stripeDisputeId), children: [row.dispute.stripeDisputeId, " \u00B7 ", row.dispute.status, " ", row.badgeText] }, row.dispute.stripeDisputeId)) }), !state.selectedId ? (_jsx("p", { children: "Select a dispute to respond." })) : (_jsxs(_Fragment, { children: [_jsx(DisputeDetail, { dispute: detail, isLoading: !detail }), props.acceptDispute &&
|
|
66
|
+
(state.acceptStatus === "confirming" ? (_jsxs("div", { children: [_jsx("p", { children: "Accepting permanently closes this dispute. This cannot be undone." }), _jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
67
|
+
void state.accept();
|
|
68
|
+
}, children: "Yes, accept dispute" }), _jsx("button", { type: "button", onClick: state.cancelAccept, children: "Cancel" })] })) : (_jsx("button", { type: "button", disabled: state.isPending || state.acceptStatus === "accepted", onClick: state.requestAccept, children: state.isPending
|
|
69
|
+
? "Accepting…"
|
|
70
|
+
: state.acceptStatus === "accepted"
|
|
71
|
+
? "Dispute accepted"
|
|
72
|
+
: "Accept dispute" }))), state.acceptError && _jsx("p", { role: "alert", children: state.acceptError }), _jsx(EvidenceForm, { stripeDisputeId: state.selectedId, onUpdateDispute: props.onUpdateEvidence }, state.selectedId)] }))] }));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=Disputes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Disputes.js","sourceRoot":"","sources":["../../../src/react/workflows/Disputes.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACjD,OAAO,EACL,YAAY,GAEb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EACL,YAAY,GAEb,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAM1D,MAAM,UAAU,kBAAkB,CAAC,KAA6B;IAC9D,MAAM,OAAO,GAAG;QACd,KAAK,EAAE,KAAK,CAAC,QAAQ;QACrB,UAAU,EAAE,SAA+B;QAC3C,UAAU,EAAE,KAAK;KAClB,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5C,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BAAkB;oCACpB,CAAC,CAAC,gBAAgB,GACf,CACV,CAAC,EACH,KAAK,CAAC,WAAW,IAAI,YAAG,IAAI,EAAC,OAAO,YAAE,KAAK,CAAC,WAAW,GAAK,EAC7D,KAAC,YAAY,IAEX,eAAe,EAAE,KAAK,CAAC,UAAU,EACjC,eAAe,EAAE,KAAK,CAAC,gBAAgB,IAFlC,KAAK,CAAC,UAAU,CAGrB,IACD,CACJ,IACO,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type EarningsSummaryProps } from "../components/EarningsSummary.js";
|
|
3
|
+
import { type ConnectProps } from "./Connect.js";
|
|
4
|
+
export type BalanceSnapshot = {
|
|
5
|
+
available: number;
|
|
6
|
+
pending: number;
|
|
7
|
+
currency: string;
|
|
8
|
+
};
|
|
9
|
+
export type StoreEarnings = {
|
|
10
|
+
gross: number;
|
|
11
|
+
reversed: number;
|
|
12
|
+
net: number;
|
|
13
|
+
paidOut: number;
|
|
14
|
+
currency: string;
|
|
15
|
+
};
|
|
16
|
+
/** Recipient funds held plus already paid out, not gross charge revenue. Destination-charge balance display only. */
|
|
17
|
+
export declare function earningsFromBalance(balance: BalanceSnapshot | null, payouts: {
|
|
18
|
+
amount: number;
|
|
19
|
+
status: string;
|
|
20
|
+
currency: string;
|
|
21
|
+
}[]): StoreEarnings;
|
|
22
|
+
export type EarningsMetric = {
|
|
23
|
+
key: "gross" | "reversed" | "net" | "paidOut";
|
|
24
|
+
label: string;
|
|
25
|
+
amount: number;
|
|
26
|
+
formattedValue: string;
|
|
27
|
+
};
|
|
28
|
+
export type EarningsRenderProps = {
|
|
29
|
+
metrics: EarningsMetric[];
|
|
30
|
+
isLoading: boolean;
|
|
31
|
+
currency: string;
|
|
32
|
+
payouts: EarningsSummaryProps["payouts"];
|
|
33
|
+
};
|
|
34
|
+
export type HeadlessEarningsProps = Omit<EarningsSummaryProps, "children"> & {
|
|
35
|
+
presentation?: "headless";
|
|
36
|
+
children?: (state: EarningsRenderProps) => ReactNode;
|
|
37
|
+
};
|
|
38
|
+
export type EarningsProps = HeadlessEarningsProps | (Omit<ConnectProps, "component"> & {
|
|
39
|
+
presentation: "embedded";
|
|
40
|
+
});
|
|
41
|
+
export declare function Earnings(props: EarningsProps): import("react").JSX.Element;
|
|
42
|
+
//# sourceMappingURL=Earnings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Earnings.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Earnings.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AACF,qHAAqH;AACrH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,eAAe,GAAG,IAAI,EAC/B,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,EAAE,GAC9D,aAAa,CAOf;AACD,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,OAAO,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;CAC1C,CAAC;AACF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,GAAG;IAC3E,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;CACtD,CAAC;AACF,MAAM,MAAM,aAAa,GACrB,qBAAqB,GACrB,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG;IAAE,YAAY,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AACrE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BAgC5C"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { EarningsSummary, } from "../components/EarningsSummary.js";
|
|
4
|
+
import { formatPrice } from "../lib/price-helpers.js";
|
|
5
|
+
import { Connect } from "./Connect.js";
|
|
6
|
+
/** Recipient funds held plus already paid out, not gross charge revenue. Destination-charge balance display only. */
|
|
7
|
+
export function earningsFromBalance(balance, payouts) {
|
|
8
|
+
const currency = balance?.currency ?? payouts[0]?.currency ?? "usd";
|
|
9
|
+
const paidOut = payouts
|
|
10
|
+
.filter((row) => row.currency === currency && row.status === "paid")
|
|
11
|
+
.reduce((sum, row) => sum + row.amount, 0);
|
|
12
|
+
const gross = (balance ? balance.available + balance.pending : 0) + paidOut;
|
|
13
|
+
return { gross, reversed: 0, net: gross, paidOut, currency };
|
|
14
|
+
}
|
|
15
|
+
export function Earnings(props) {
|
|
16
|
+
if (props.presentation === "embedded")
|
|
17
|
+
return _jsx(Connect, { ...props, component: "balances" });
|
|
18
|
+
const { children, ...summary } = props;
|
|
19
|
+
const currency = props.currency ?? "usd";
|
|
20
|
+
const metrics = [
|
|
21
|
+
["gross", "Gross"],
|
|
22
|
+
["reversed", "Reversals & adjustments"],
|
|
23
|
+
["net", "Net"],
|
|
24
|
+
["paidOut", "Paid out"],
|
|
25
|
+
].map(([key, label]) => ({
|
|
26
|
+
key,
|
|
27
|
+
label: props.labels?.[key] ?? label,
|
|
28
|
+
amount: props[key],
|
|
29
|
+
formattedValue: formatPrice(props[key], currency, props.locale),
|
|
30
|
+
}));
|
|
31
|
+
return (_jsx(_Fragment, { children: children ? (children({
|
|
32
|
+
metrics,
|
|
33
|
+
isLoading: props.isLoading ?? false,
|
|
34
|
+
currency,
|
|
35
|
+
payouts: props.payouts,
|
|
36
|
+
})) : (_jsx(EarningsSummary, { ...summary })) }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=Earnings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Earnings.js","sourceRoot":"","sources":["../../../src/react/workflows/Earnings.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,eAAe,GAEhB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAa1D,qHAAqH;AACrH,MAAM,UAAU,mBAAmB,CACjC,OAA+B,EAC/B,OAA+D;IAE/D,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,IAAI,KAAK,CAAC;IACpE,MAAM,OAAO,GAAG,OAAO;SACpB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM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AAC,CACV,QAAQ,CAAC;YACP,OAAO;YACP,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK;YACnC,QAAQ;YACR,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,eAAe,OAAK,OAAO,GAAI,CACjC,GACA,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export type ChargeSummaryProps = {
|
|
3
|
+
gross: number;
|
|
4
|
+
fee: number;
|
|
5
|
+
net: number;
|
|
6
|
+
currency: string;
|
|
7
|
+
reconciles: boolean;
|
|
8
|
+
feeLabel?: string;
|
|
9
|
+
children?: (state: {
|
|
10
|
+
metrics: {
|
|
11
|
+
key: "gross" | "fee" | "net";
|
|
12
|
+
label: string;
|
|
13
|
+
amount: number;
|
|
14
|
+
formattedAmount: string;
|
|
15
|
+
}[];
|
|
16
|
+
reconciles: boolean;
|
|
17
|
+
}) => ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/** Displays a server-calculated charge allocation, without applying a platform fee policy. */
|
|
20
|
+
export declare function ChargeSummary(props: ChargeSummaryProps): import("react").JSX.Element;
|
|
21
|
+
export type PaymentDetailsPayment = {
|
|
22
|
+
amount: number;
|
|
23
|
+
currency: string;
|
|
24
|
+
status: string;
|
|
25
|
+
refundedAmount?: number;
|
|
26
|
+
refundStatus?: string;
|
|
27
|
+
};
|
|
28
|
+
export type PaymentDetailsState = {
|
|
29
|
+
payment: PaymentDetailsPayment | null | undefined;
|
|
30
|
+
isLoading: boolean;
|
|
31
|
+
isEmpty: boolean;
|
|
32
|
+
metrics: {
|
|
33
|
+
key: "charged" | "refunded" | "status" | "refundStatus";
|
|
34
|
+
label: string;
|
|
35
|
+
value: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
export type PaymentDetailsProps = {
|
|
39
|
+
payment: PaymentDetailsPayment | null | undefined;
|
|
40
|
+
children?: (state: PaymentDetailsState) => ReactNode;
|
|
41
|
+
};
|
|
42
|
+
export declare function PaymentDetails({ payment, children }: PaymentDetailsProps): import("react").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=Financials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Financials.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Financials.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE;QACjB,OAAO,EAAE;YACP,GAAG,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;YAC7B,KAAK,EAAE,MAAM,CAAC;YACd,MAAM,EAAE,MAAM,CAAC;YACf,eAAe,EAAE,MAAM,CAAC;SACzB,EAAE,CAAC;QACJ,UAAU,EAAE,OAAO,CAAC;KACrB,KAAK,SAAS,CAAC;CACjB,CAAC;AACF,8FAA8F;AAC9F,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAiCtD;AACD,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,CAAC;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO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