@fantastic.dev/better-stripe 0.12.0 → 0.14.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 +24 -0
- package/README.md +93 -8
- package/dist/client/connect/disputes.d.ts +20 -0
- package/dist/client/connect/disputes.d.ts.map +1 -1
- package/dist/client/connect/disputes.js +55 -0
- package/dist/client/connect/disputes.js.map +1 -1
- package/dist/client/costRecovery-invoices.d.ts +44 -0
- package/dist/client/costRecovery-invoices.d.ts.map +1 -0
- package/dist/client/costRecovery-invoices.js +109 -0
- package/dist/client/costRecovery-invoices.js.map +1 -0
- package/dist/client/costRecovery.d.ts +59 -2
- package/dist/client/costRecovery.d.ts.map +1 -1
- package/dist/client/costRecovery.js +73 -2
- package/dist/client/costRecovery.js.map +1 -1
- package/dist/client/errors.d.ts +1 -1
- package/dist/client/errors.d.ts.map +1 -1
- package/dist/client/errors.js.map +1 -1
- package/dist/client/index.d.ts +5 -14
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -8
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/component.d.ts +137 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/costRecovery/claims.d.ts +12 -0
- package/dist/component/costRecovery/claims.d.ts.map +1 -1
- package/dist/component/costRecovery/claims.js +15 -8
- package/dist/component/costRecovery/claims.js.map +1 -1
- package/dist/component/costRecovery/completion.d.ts +6 -0
- package/dist/component/costRecovery/completion.d.ts.map +1 -1
- package/dist/component/costRecovery/helpers.d.ts +6 -0
- package/dist/component/costRecovery/helpers.d.ts.map +1 -1
- package/dist/component/costRecovery/imports.d.ts +53 -0
- package/dist/component/costRecovery/imports.d.ts.map +1 -0
- package/dist/component/costRecovery/imports.js +67 -0
- package/dist/component/costRecovery/imports.js.map +1 -0
- package/dist/component/costRecovery/mutations.d.ts +119 -0
- package/dist/component/costRecovery/mutations.d.ts.map +1 -1
- package/dist/component/costRecovery/mutations.js +64 -1
- package/dist/component/costRecovery/mutations.js.map +1 -1
- package/dist/component/costRecovery/queries.d.ts +18 -0
- package/dist/component/costRecovery/queries.d.ts.map +1 -1
- package/dist/component/costRecovery/reservations.d.ts +12 -0
- package/dist/component/costRecovery/reservations.d.ts.map +1 -1
- package/dist/component/costRecovery/schema.d.ts +116 -4
- package/dist/component/costRecovery/schema.d.ts.map +1 -1
- package/dist/component/costRecovery/schema.js +19 -0
- package/dist/component/costRecovery/schema.js.map +1 -1
- package/dist/component/schema.d.ts +36 -2
- package/dist/react/workflows/Collections.d.ts.map +1 -1
- package/dist/react/workflows/Collections.js +2 -1
- package/dist/react/workflows/Collections.js.map +1 -1
- package/dist/react/workflows/EvidenceUpload.d.ts +18 -0
- package/dist/react/workflows/EvidenceUpload.d.ts.map +1 -0
- package/dist/react/workflows/EvidenceUpload.js +35 -0
- package/dist/react/workflows/EvidenceUpload.js.map +1 -0
- package/dist/react/workflows/Onboarding.d.ts +3 -3
- package/dist/react/workflows/Onboarding.d.ts.map +1 -1
- package/dist/react/workflows/Onboarding.js +8 -6
- package/dist/react/workflows/Onboarding.js.map +1 -1
- package/dist/react/workflows/Refunds.d.ts +14 -3
- package/dist/react/workflows/Refunds.d.ts.map +1 -1
- package/dist/react/workflows/Refunds.js +58 -16
- package/dist/react/workflows/Refunds.js.map +1 -1
- package/dist/react/workflows/index.d.ts +5 -1
- package/dist/react/workflows/index.d.ts.map +1 -1
- package/dist/react/workflows/index.js +3 -1
- package/dist/react/workflows/index.js.map +1 -1
- package/dist/react/workflows/refund-preview.d.ts +16 -0
- package/dist/react/workflows/refund-preview.d.ts.map +1 -0
- package/dist/react/workflows/refund-preview.js +38 -0
- package/dist/react/workflows/refund-preview.js.map +1 -0
- package/dist/react/workflows/useWorkflowAction.d.ts +1 -1
- package/dist/react/workflows/useWorkflowAction.d.ts.map +1 -1
- package/dist/react/workflows/useWorkflowAction.js +6 -2
- package/dist/react/workflows/useWorkflowAction.js.map +1 -1
- package/docs/react-workflows.md +121 -4
- package/package.json +1 -1
- package/src/client/connect/dispute-upload.test.ts +208 -0
- package/src/client/connect/disputes.ts +103 -0
- package/src/client/costRecovery-import.test.ts +174 -0
- package/src/client/costRecovery-invoices.test.ts +470 -0
- package/src/client/costRecovery-invoices.transport.test.ts +107 -0
- package/src/client/costRecovery-invoices.ts +176 -0
- package/src/client/costRecovery.ts +123 -2
- package/src/client/errors.ts +1 -0
- package/src/client/index.ts +15 -14
- package/src/component/_generated/api.ts +2 -0
- package/src/component/_generated/component.ts +164 -0
- package/src/component/costRecovery/claims.ts +18 -8
- package/src/component/costRecovery/imports.ts +74 -0
- package/src/component/costRecovery/mutations.ts +80 -0
- package/src/component/costRecovery/schema.ts +21 -0
- package/src/react/workflows/Collections.test.tsx +36 -0
- package/src/react/workflows/Collections.tsx +3 -1
- package/src/react/workflows/EvidenceUpload.test.tsx +56 -0
- package/src/react/workflows/EvidenceUpload.tsx +71 -0
- package/src/react/workflows/Onboarding.test.tsx +73 -0
- package/src/react/workflows/Onboarding.tsx +8 -5
- package/src/react/workflows/Refunds.currency.test.tsx +290 -0
- package/src/react/workflows/Refunds.tsx +115 -25
- package/src/react/workflows/index.ts +11 -1
- package/src/react/workflows/refund-preview.test.ts +65 -0
- package/src/react/workflows/refund-preview.ts +56 -0
- package/src/react/workflows/useWorkflowAction.ts +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Refunds.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Refunds.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAW,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Refunds.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/Refunds.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAAW,KAAK,YAAY,EAAE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MAAM,GAAG,IAAI,CAE7D;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB;;;;;;;;;;gCAoHpB,MAAM;+BACP,MAAM;6BACR,MAAM;+BACJ,MAAM;;;;;;yBAOZ,MAAM,GAAG,SAAS;cAhD3B,QAAQ;;;cAUV,UAAU;;;2BAwCG,MAAM,GAAG,SAAS;;;;;;;EAG5C;AACD,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAC/D,MAAM,MAAM,YAAY,GACpB,CAAC,kBAAkB,GAAG;IACpB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,SAAS,CAAC;CACrD,CAAC,GACF,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG;IAAE,YAAY,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC;AACrE,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,+BAM1C"}
|
|
@@ -3,24 +3,39 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
3
3
|
import { useState, useId } from "react";
|
|
4
4
|
import { useWorkflowAction } from "./useWorkflowAction.js";
|
|
5
5
|
import { Connect } from "./Connect.js";
|
|
6
|
-
|
|
6
|
+
import { getChargeCurrencyMetadata, parseChargeAmount, } from "../../client/charge-currency.js";
|
|
7
|
+
/** Exact positive refund amount in the original charge currency's provider units. */
|
|
8
|
+
export function parseRefundAmount(value, currency) {
|
|
9
|
+
const amount = parseChargeAmount(value.trim(), currency);
|
|
10
|
+
return amount !== null && amount > 0 ? amount : null;
|
|
11
|
+
}
|
|
12
|
+
/** Legacy USD-only parser. Use parseRefundAmount for original-currency inputs. */
|
|
7
13
|
export function parseAmountCents(value) {
|
|
8
|
-
|
|
9
|
-
return null;
|
|
10
|
-
const [whole, fraction = ""] = value.trim().split(".");
|
|
11
|
-
const amount = Number(whole) * 100 + Number(fraction.padEnd(2, "0"));
|
|
12
|
-
return Number.isSafeInteger(amount) && amount > 0 ? amount : null;
|
|
14
|
+
return parseRefundAmount(value, "usd");
|
|
13
15
|
}
|
|
14
16
|
export function useRefunds(props) {
|
|
17
|
+
const paymentCurrency = props.paymentCurrency === undefined
|
|
18
|
+
? "usd"
|
|
19
|
+
: (props.paymentCurrency?.toLowerCase() ?? null);
|
|
20
|
+
const sourceChargeCurrency = props.sourceChargeCurrency === undefined
|
|
21
|
+
? "usd"
|
|
22
|
+
: (props.sourceChargeCurrency?.toLowerCase() ?? null);
|
|
23
|
+
const scope = JSON.stringify([
|
|
24
|
+
props.scopeKey,
|
|
25
|
+
props.paymentIntentId?.trim(),
|
|
26
|
+
props.sourceChargeId?.trim(),
|
|
27
|
+
paymentCurrency,
|
|
28
|
+
sourceChargeCurrency,
|
|
29
|
+
]);
|
|
15
30
|
const initial = {
|
|
16
|
-
scope
|
|
31
|
+
scope,
|
|
17
32
|
paymentIntentId: props.paymentIntentId ?? "",
|
|
18
33
|
sourceChargeId: props.sourceChargeId ?? "",
|
|
19
34
|
refundAmount: "",
|
|
20
35
|
reversalAmount: "",
|
|
21
36
|
};
|
|
22
37
|
const [fields, setFields] = useState(initial);
|
|
23
|
-
if (fields.scope !==
|
|
38
|
+
if (fields.scope !== scope)
|
|
24
39
|
setFields(initial);
|
|
25
40
|
const [operationType, setOperationType] = useState("refund");
|
|
26
41
|
const action = useWorkflowAction(async (operation) => {
|
|
@@ -32,19 +47,30 @@ export function useRefunds(props) {
|
|
|
32
47
|
throw new Error(operation.type === "refund"
|
|
33
48
|
? "Enter a PaymentIntent id before issuing a refund."
|
|
34
49
|
: "Enter a source charge id before reversing transfers.");
|
|
50
|
+
const currency = operation.type === "refund" ? paymentCurrency : sourceChargeCurrency;
|
|
51
|
+
const boundId = operation.type === "refund"
|
|
52
|
+
? props.paymentIntentId
|
|
53
|
+
: props.sourceChargeId;
|
|
54
|
+
const hasExplicitCurrency = operation.type === "refund"
|
|
55
|
+
? props.paymentCurrency !== undefined
|
|
56
|
+
: props.sourceChargeCurrency !== undefined;
|
|
57
|
+
if (operation.kind === "partial" &&
|
|
58
|
+
hasExplicitCurrency &&
|
|
59
|
+
id !== boundId?.trim())
|
|
60
|
+
throw new Error("Original currency is not verified for this identifier.");
|
|
35
61
|
const amount = operation.kind === "partial"
|
|
36
|
-
?
|
|
62
|
+
? parseRefundAmount(operation.type === "refund"
|
|
37
63
|
? fields.refundAmount
|
|
38
|
-
: fields.reversalAmount)
|
|
64
|
+
: fields.reversalAmount, currency ?? "")
|
|
39
65
|
: undefined;
|
|
40
66
|
if (amount === null)
|
|
41
|
-
throw new Error(`Enter a positive partial ${operation.type === "refund" ? "refund" : "reversal"} amount
|
|
67
|
+
throw new Error(`Enter a positive partial ${operation.type === "refund" ? "refund" : "reversal"} amount in supported original currency units.`);
|
|
42
68
|
if (operation.type === "refund")
|
|
43
69
|
return {
|
|
44
70
|
type: "refund",
|
|
45
71
|
value: await props.issueRefund({
|
|
46
72
|
stripePaymentIntentId: id,
|
|
47
|
-
amountCents: amount,
|
|
73
|
+
...(amount === undefined ? {} : { amountCents: amount }),
|
|
48
74
|
reason: "requested_by_customer",
|
|
49
75
|
}),
|
|
50
76
|
};
|
|
@@ -54,13 +80,23 @@ export function useRefunds(props) {
|
|
|
54
80
|
type: "reversal",
|
|
55
81
|
value: await props.reverseTransfers({
|
|
56
82
|
sourceChargeId: id,
|
|
57
|
-
amountCents: amount,
|
|
83
|
+
...(amount === undefined ? {} : { amountCents: amount }),
|
|
58
84
|
}),
|
|
59
85
|
};
|
|
60
|
-
},
|
|
86
|
+
}, JSON.stringify([
|
|
87
|
+
scope,
|
|
88
|
+
fields.paymentIntentId.trim(),
|
|
89
|
+
fields.sourceChargeId.trim(),
|
|
90
|
+
]));
|
|
61
91
|
const set = (name, value) => setFields((previous) => ({ ...previous, [name]: value }));
|
|
62
92
|
return {
|
|
63
93
|
...fields,
|
|
94
|
+
scope: props.scopeKey,
|
|
95
|
+
paymentCurrency,
|
|
96
|
+
sourceChargeCurrency,
|
|
97
|
+
refundInputDecimalPlaces: getChargeCurrencyMetadata(paymentCurrency ?? "")?.displayDecimals ?? null,
|
|
98
|
+
reversalInputDecimalPlaces: getChargeCurrencyMetadata(sourceChargeCurrency ?? "")?.displayDecimals ??
|
|
99
|
+
null,
|
|
64
100
|
setPaymentIntentId: (value) => set("paymentIntentId", value),
|
|
65
101
|
setSourceChargeId: (value) => set("sourceChargeId", value),
|
|
66
102
|
setRefundAmount: (value) => set("refundAmount", value),
|
|
@@ -77,16 +113,22 @@ export function useRefunds(props) {
|
|
|
77
113
|
export function Refunds(props) {
|
|
78
114
|
return props.presentation === "embedded" ? (_jsx(Connect, { ...props, component: "refunds" })) : (_jsx(RefundsBody, { ...props }, props.scopeKey));
|
|
79
115
|
}
|
|
116
|
+
function RefundAmountInput(props) {
|
|
117
|
+
const step = props.decimalPlaces === 0 ? "1" : "0.01";
|
|
118
|
+
return (_jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: props.id, children: [props.label, props.currency !== undefined
|
|
119
|
+
? ` (${props.currency?.toUpperCase() ?? "currency unavailable"})`
|
|
120
|
+
: ""] }), _jsx("input", { id: props.id, type: "number", min: step, step: step, inputMode: props.decimalPlaces === 0 ? "numeric" : "decimal", value: props.value, onChange: (event) => props.onChange(event.target.value) })] }));
|
|
121
|
+
}
|
|
80
122
|
function RefundsBody(props) {
|
|
81
123
|
const state = useRefunds(props);
|
|
82
124
|
const id = useId();
|
|
83
125
|
if (props.children)
|
|
84
126
|
return _jsx(_Fragment, { children: props.children(state) });
|
|
85
|
-
return (_jsxs("section", { "data-better-stripe": "refunds", "aria-busy": state.isPending, children: [_jsx("h2", { children: "Refunds" }), state.error && _jsx("p", { role: "alert", children: state.error }), _jsx("label", { htmlFor: `${id}-payment`, children: "PaymentIntent ID" }), _jsx("input", { id: `${id}-payment`, value: state.paymentIntentId, onChange: (event) => state.setPaymentIntentId(event.target.value) }), _jsx(
|
|
127
|
+
return (_jsxs("section", { "data-better-stripe": "refunds", "aria-busy": state.isPending, children: [_jsx("h2", { children: "Refunds" }), state.error && _jsx("p", { role: "alert", children: state.error }), _jsx("label", { htmlFor: `${id}-payment`, children: "PaymentIntent ID" }), _jsx("input", { id: `${id}-payment`, value: state.paymentIntentId, onChange: (event) => state.setPaymentIntentId(event.target.value) }), _jsx(RefundAmountInput, { id: `${id}-amount`, label: "Partial refund amount", currency: props.paymentCurrency, decimalPlaces: state.refundInputDecimalPlaces, value: state.refundAmount, onChange: state.setRefundAmount }), _jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
86
128
|
void state.submitRefund("full");
|
|
87
129
|
}, children: state.isPending ? "Processing…" : "Full refund" }), _jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
88
130
|
void state.submitRefund("partial");
|
|
89
|
-
}, children: "Partial refund" }), state.refundResult && (_jsxs("p", { role: "status", children: ["Refund created: ", state.refundResult.stripeRefundId] })), props.reverseTransfers && (_jsxs(_Fragment, { children: [_jsx("h3", { children: "Transfer reversals" }), _jsx("label", { htmlFor: `${id}-charge`, children: "Source charge ID" }), _jsx("input", { id: `${id}-charge`, value: state.sourceChargeId, onChange: (event) => state.setSourceChargeId(event.target.value) }), _jsx(
|
|
131
|
+
}, children: "Partial refund" }), state.refundResult && (_jsxs("p", { role: "status", children: ["Refund created: ", state.refundResult.stripeRefundId] })), props.reverseTransfers && (_jsxs(_Fragment, { children: [_jsx("h3", { children: "Transfer reversals" }), _jsx("label", { htmlFor: `${id}-charge`, children: "Source charge ID" }), _jsx("input", { id: `${id}-charge`, value: state.sourceChargeId, onChange: (event) => state.setSourceChargeId(event.target.value) }), _jsx(RefundAmountInput, { id: `${id}-reversal`, label: "Partial reversal amount", currency: props.sourceChargeCurrency, decimalPlaces: state.reversalInputDecimalPlaces, value: state.reversalAmount, onChange: state.setReversalAmount }), _jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
90
132
|
void state.submitReversal("full");
|
|
91
133
|
}, children: "Reverse all transfers" }), _jsx("button", { type: "button", disabled: state.isPending, onClick: () => {
|
|
92
134
|
void state.submitReversal("partial");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Refunds.js","sourceRoot":"","sources":["../../../src/react/workflows/Refunds.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAkB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Refunds.js","sourceRoot":"","sources":["../../../src/react/workflows/Refunds.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAkB,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EACL,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,iCAAiC,CAAC;AA2BzC,qFAAqF;AACrF,MAAM,UAAU,iBAAiB,CAC/B,KAAa,EACb,QAAgB;IAEhB,MAAM,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IACzD,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACvD,CAAC;AACD,kFAAkF;AAClF,MAAM,UAAU,gBAAgB,CAAC,KAAa;IAC5C,OAAO,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,KAAyB;IAClD,MAAM,eAAe,GACnB,KAAK,CAAC,eAAe,KAAK,SAAS;QACjC,C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B,IAChB,EAAE,EAAE,GAAG,EAAE,WAAW,EACpB,KAAK,EAAC,yBAAyB,EAC/B,QAAQ,EAAE,KAAK,CAAC,oBAAoB,EACpC,aAAa,EAAE,KAAK,CAAC,0BAA0B,EAC/C,KAAK,EAAE,KAAK,CAAC,cAAc,EAC3B,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GACjC,EACF,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;wBACpC,CAAC,sCAGM,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;wBACvC,CAAC,iCAGM,EACR,KAAK,CAAC,cAAc,IAAI,CACvB,aAAG,IAAI,EAAC,QAAQ,0BACJ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,aAAa,mBAClD,CACL,IACA,CACJ,IACO,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -9,9 +9,11 @@ export { Connect } from "./Connect.js";
|
|
|
9
9
|
export type { ConnectProps, ConnectComponent, ConnectRenderProps, } from "./Connect.js";
|
|
10
10
|
export { Payouts } from "./Payouts.js";
|
|
11
11
|
export type { PayoutsProps, HeadlessPayoutsProps, PayoutsRenderProps, PayoutSnapshot, PayoutRow, } from "./Payouts.js";
|
|
12
|
-
export { Refunds, useRefunds, parseAmountCents } from "./Refunds.js";
|
|
12
|
+
export { Refunds, useRefunds, parseAmountCents, parseRefundAmount, } from "./Refunds.js";
|
|
13
13
|
export type { RefundsProps, RefundsRenderProps, RefundActionsProps, RefundRequest, ReversalRequest, RefundResult, ReversalResult, } from "./Refunds.js";
|
|
14
14
|
export { Collection } from "./Collection.js";
|
|
15
|
+
export { formatRefundAmount, groupRefundPreview } from "./refund-preview.js";
|
|
16
|
+
export type { RefundPreviewGroup } from "./refund-preview.js";
|
|
15
17
|
export type { CollectionProps, CollectionRenderProps, WorkflowColumn, } from "./Collection.js";
|
|
16
18
|
export { Sales, Invoices, RefundHistory, ReferredSales, WebhookEvents, } from "./Collections.js";
|
|
17
19
|
export type { ResourceCollectionProps, SaleRow, InvoiceRow, RefundRow, ReferredSaleRow, WebhookEventRow, } from "./Collections.js";
|
|
@@ -75,4 +77,6 @@ export { AffiliateRateEditor } from "./AffiliateRateEditor.js";
|
|
|
75
77
|
export type { AffiliateRateUpdate, AffiliateRateEditorProps, AffiliateRateEditorState, } from "./AffiliateRateEditor.js";
|
|
76
78
|
export { AffiliatePayoutEditor } from "./AffiliatePayoutEditor.js";
|
|
77
79
|
export type { AffiliateCommissionTerm, AffiliatePayoutEditorProps, AffiliatePayoutEditorState, AffiliatePayoutUpdate, } from "./AffiliatePayoutEditor.js";
|
|
80
|
+
export { EvidenceUpload } from "./EvidenceUpload.js";
|
|
81
|
+
export type { EvidenceUploadProps } from "./EvidenceUpload.js";
|
|
78
82
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,SAAS,GACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,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,4BAA4B,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -4,8 +4,9 @@ export { Checkout } from "./Checkout.js";
|
|
|
4
4
|
export { CheckoutElementsForm, PaymentIntentForm, CheckoutForm, } from "./CheckoutForms.js";
|
|
5
5
|
export { Connect } from "./Connect.js";
|
|
6
6
|
export { Payouts } from "./Payouts.js";
|
|
7
|
-
export { Refunds, useRefunds, parseAmountCents } from "./Refunds.js";
|
|
7
|
+
export { Refunds, useRefunds, parseAmountCents, parseRefundAmount, } from "./Refunds.js";
|
|
8
8
|
export { Collection } from "./Collection.js";
|
|
9
|
+
export { formatRefundAmount, groupRefundPreview } from "./refund-preview.js";
|
|
9
10
|
export { Sales, Invoices, RefundHistory, ReferredSales, WebhookEvents, } from "./Collections.js";
|
|
10
11
|
export { Products, useProductManager } from "./Products.js";
|
|
11
12
|
export { Onboarding, useOnboarding } from "./Onboarding.js";
|
|
@@ -39,4 +40,5 @@ export { Pagination, useCursorPagination } from "./Pagination.js";
|
|
|
39
40
|
export { PlanPricingEditor } from "./PlanPricingEditor.js";
|
|
40
41
|
export { AffiliateRateEditor } from "./AffiliateRateEditor.js";
|
|
41
42
|
export { AffiliatePayoutEditor } from "./AffiliatePayoutEditor.js";
|
|
43
|
+
export { EvidenceUpload } from "./EvidenceUpload.js";
|
|
42
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/workflows/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AASzC,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,YAAY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B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAOhE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAO3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAM/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAQnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type RefundPreviewGroup = {
|
|
2
|
+
currency: string;
|
|
3
|
+
status: string;
|
|
4
|
+
/** Loaded rows only. Null means unknown/invalid units or an unsafe sum. */
|
|
5
|
+
amount: number | null;
|
|
6
|
+
count: number;
|
|
7
|
+
};
|
|
8
|
+
/** Observed refund units, including fractional ISK/UGX amounts; not input eligibility. */
|
|
9
|
+
export declare function formatRefundAmount(amount: number, currency: string, locale?: string): string | null;
|
|
10
|
+
/** Group only the supplied preview, preserving provider status and currency. */
|
|
11
|
+
export declare function groupRefundPreview(rows: readonly {
|
|
12
|
+
amount: number;
|
|
13
|
+
currency: string;
|
|
14
|
+
status: string;
|
|
15
|
+
}[]): RefundPreviewGroup[];
|
|
16
|
+
//# sourceMappingURL=refund-preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refund-preview.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/refund-preview.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,2EAA2E;IAC3E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAUF,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,SAAU,GACf,MAAM,GAAG,IAAI,CAIf;AAED,gFAAgF;AAChF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,GACpE,kBAAkB,EAAE,CAsBtB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { getChargeCurrencyMetadata } from "../../client/charge-currency.js";
|
|
2
|
+
import { formatPrice } from "../lib/price-helpers.js";
|
|
3
|
+
function isRefundAmount(amount, currency) {
|
|
4
|
+
return (Number.isSafeInteger(amount) &&
|
|
5
|
+
amount >= 0 &&
|
|
6
|
+
getChargeCurrencyMetadata(currency) !== null);
|
|
7
|
+
}
|
|
8
|
+
/** Observed refund units, including fractional ISK/UGX amounts; not input eligibility. */
|
|
9
|
+
export function formatRefundAmount(amount, currency, locale = "en-US") {
|
|
10
|
+
return isRefundAmount(amount, currency)
|
|
11
|
+
? formatPrice(amount, currency, locale)
|
|
12
|
+
: null;
|
|
13
|
+
}
|
|
14
|
+
/** Group only the supplied preview, preserving provider status and currency. */
|
|
15
|
+
export function groupRefundPreview(rows) {
|
|
16
|
+
const groups = new Map();
|
|
17
|
+
for (const row of rows) {
|
|
18
|
+
const currency = row.currency.toLowerCase();
|
|
19
|
+
const key = JSON.stringify([currency, row.status]);
|
|
20
|
+
const group = groups.get(key) ?? {
|
|
21
|
+
currency,
|
|
22
|
+
status: row.status,
|
|
23
|
+
amount: 0,
|
|
24
|
+
count: 0,
|
|
25
|
+
};
|
|
26
|
+
group.count++;
|
|
27
|
+
if (group.amount === null || !isRefundAmount(row.amount, currency))
|
|
28
|
+
group.amount = null;
|
|
29
|
+
else {
|
|
30
|
+
const sum = BigInt(group.amount) + BigInt(row.amount);
|
|
31
|
+
group.amount =
|
|
32
|
+
sum <= BigInt(Number.MAX_SAFE_INTEGER) ? Number(sum) : null;
|
|
33
|
+
}
|
|
34
|
+
groups.set(key, group);
|
|
35
|
+
}
|
|
36
|
+
return [...groups.values()];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=refund-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refund-preview.js","sourceRoot":"","sources":["../../../src/react/workflows/refund-preview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAUtD,SAAS,cAAc,CAAC,MAAc,EAAE,QAAgB;IACtD,OAAO,CACL,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC;QAC5B,MAAM,IAAI,CAAC;QACX,yBAAyB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAC7C,CAAC;AACJ,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,kBAAkB,CAChC,MAAc,EACd,QAAgB,EAChB,MAAM,GAAG,OAAO;IAEhB,OAAO,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC;QACrC,CAAC,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC;QACvC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,kBAAkB,CAChC,IAAqE;IAErE,MAAM,MAAM,GAAG,IAAI,GAAG,EAA8B,CAAC;IACrD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI;YAC/B,QAAQ;YACR,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,MAAM,EAAE,CAAC;YACT,KAAK,EAAE,CAAC;SACT,CAAC;QACF,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC;YAChE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;aACjB,CAAC;YACJ,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACtD,KAAK,CAAC,MAAM;gBACV,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChE,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -7,5 +7,5 @@ export type WorkflowActionState<T, Args extends unknown[]> = {
|
|
|
7
7
|
reset: () => void;
|
|
8
8
|
};
|
|
9
9
|
/** Shared async action lifecycle. Scope identifies the authenticated account/resource, not authorization. */
|
|
10
|
-
export declare function useWorkflowAction<T, Args extends unknown[]>(action: (...args: Args) => Promise<T>, scope?: string): WorkflowActionState<T, Args>;
|
|
10
|
+
export declare function useWorkflowAction<T, Args extends unknown[]>(action: (...args: Args) => Promise<T>, scope?: string, onSuccess?: (result: T) => void): WorkflowActionState<T, Args>;
|
|
11
11
|
//# sourceMappingURL=useWorkflowAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkflowAction.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/useWorkflowAction.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,CAAC,CAAC,EAAE,IAAI,SAAS,OAAO,EAAE,IAAI;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC;IACtB,gFAAgF;IAChF,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC/C,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AACF,6GAA6G;AAC7G,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,SAAS,OAAO,EAAE,EACzD,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EACrC,KAAK,GAAE,MAAkB,
|
|
1
|
+
{"version":3,"file":"useWorkflowAction.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/useWorkflowAction.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,CAAC,CAAC,EAAE,IAAI,SAAS,OAAO,EAAE,IAAI;IAC3D,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC;IACtB,gFAAgF;IAChF,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC/C,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AACF,6GAA6G;AAC7G,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,SAAS,OAAO,EAAE,EACzD,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,EACrC,KAAK,GAAE,MAAkB,EACzB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,GAC9B,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,CAgE9B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
/** Shared async action lifecycle. Scope identifies the authenticated account/resource, not authorization. */
|
|
4
|
-
export function useWorkflowAction(action, scope = "default") {
|
|
4
|
+
export function useWorkflowAction(action, scope = "default", onSuccess) {
|
|
5
5
|
const initial = {
|
|
6
6
|
scope,
|
|
7
7
|
isPending: false,
|
|
@@ -12,11 +12,13 @@ export function useWorkflowAction(action, scope = "default") {
|
|
|
12
12
|
if (state.scope !== scope)
|
|
13
13
|
setState(initial);
|
|
14
14
|
const callback = useRef(action);
|
|
15
|
+
const success = useRef(onSuccess);
|
|
15
16
|
const lifecycle = useRef({ version: 0, mounted: false });
|
|
16
17
|
const lock = useRef(null);
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
callback.current = action;
|
|
19
|
-
|
|
20
|
+
success.current = onSuccess;
|
|
21
|
+
}, [action, onSuccess]);
|
|
20
22
|
useEffect(() => {
|
|
21
23
|
const version = ++lifecycle.current.version;
|
|
22
24
|
lifecycle.current.mounted = true;
|
|
@@ -41,10 +43,12 @@ export function useWorkflowAction(action, scope = "default") {
|
|
|
41
43
|
lock.current = version;
|
|
42
44
|
setState({ scope, isPending: true, error: null, result: undefined });
|
|
43
45
|
const current = () => lifecycle.current.mounted && lifecycle.current.version === version;
|
|
46
|
+
const complete = success.current;
|
|
44
47
|
try {
|
|
45
48
|
const result = await callback.current(...args);
|
|
46
49
|
if (!current())
|
|
47
50
|
return undefined;
|
|
51
|
+
complete?.(result);
|
|
48
52
|
setState({ scope, isPending: false, error: null, result });
|
|
49
53
|
return result;
|
|
50
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWorkflowAction.js","sourceRoot":"","sources":["../../../src/react/workflows/useWorkflowAction.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AASjE,6GAA6G;AAC7G,MAAM,UAAU,iBAAiB,CAC/B,MAAqC,EACrC,KAAK,GAAW,SAAS;
|
|
1
|
+
{"version":3,"file":"useWorkflowAction.js","sourceRoot":"","sources":["../../../src/react/workflows/useWorkflowAction.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AASjE,6GAA6G;AAC7G,MAAM,UAAU,iBAAiB,CAC/B,MAAqC,EACrC,KAAK,GAAW,SAAS,EACzB,SAA+B;IAE/B,MAAM,OAAO,GAAG;QACd,KAAK;QACL,SAAS,EAAE,KAAK;QAChB,KAAK,EAAE,IAAqB;QAC5B,MAAM,EAAE,SAA0B;KACnC,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK;QAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IACzC,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC;QAC1B,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAC9B,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,CAA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,IAAI,SAAS,CAAC,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC;QACrE,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;QACjC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;YAC/C,IAAI,CAAC,OAAO,EAAE;gBAAE,OAAO,SAAS,CAAC;YACjC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC;YACnB,QAAQ,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YAC3D,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,OAAO,EAAE;gBACX,QAAQ,CAAC;oBACP,KAAK;oBACL,SAAS,EAAE,KAAK;oBAChB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;oBAC7D,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;YACL,OAAO,SAAS,CAAC;QACnB,CAAC;gBAAS,CAAC;YACT,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO;gBAAE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpD,CAAC;IACH,CAAC,EACD,CAAC,KAAK,CAAC,CACR,CAAC;IACF,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC"}
|
package/docs/react-workflows.md
CHANGED
|
@@ -58,9 +58,8 @@ by the host's error boundary rather than presented as a fabricated amount.
|
|
|
58
58
|
Metadata describes precision only. Derive selectable presentment currencies
|
|
59
59
|
from the public `getCountrySpecs` result and validate account/payment-method
|
|
60
60
|
support on the server. Do not derive an account's supported currencies from
|
|
61
|
-
`Intl.supportedValuesOf` or this helper.
|
|
62
|
-
|
|
63
|
-
charge helpers or PlanPricingEditor integration.
|
|
61
|
+
`Intl.supportedValuesOf` or this helper. Refunds and PlanPricingEditor reuse the
|
|
62
|
+
charge helpers for original-currency inputs; neither establishes payout units.
|
|
64
63
|
|
|
65
64
|
## Bind your backend
|
|
66
65
|
|
|
@@ -207,7 +206,7 @@ widgets. Use package UI or the hosted Billing Portal for those workflows.
|
|
|
207
206
|
| Earnings | `Earnings`, `EarningsSummary` | `earningsFromBalance` |
|
|
208
207
|
| Payouts | `Payouts`, `PayoutSchedule`, `PayoutHistory`, `PayoutOverview` | `getPayoutTotals` |
|
|
209
208
|
| Sales | `Sales`, `ReferredSales` | Server-authoritative economic rows |
|
|
210
|
-
| Refunds | `Refunds`, `RefundHistory` | `useRefunds`, `parseAmountCents`
|
|
209
|
+
| Refunds | `Refunds`, `RefundHistory` | `useRefunds`, `parseRefundAmount`; legacy USD-only `parseAmountCents` |
|
|
211
210
|
| Disputes | `Disputes`, `DisputesList`, `DisputeDetail`, `EvidenceForm`, `ChargebackLedger` | `useDisputeResponse` |
|
|
212
211
|
| Onboarding | `Onboarding` | `useOnboarding` |
|
|
213
212
|
| Accounts | `Account`, `AccountConfigurations` | `useAccountManager` |
|
|
@@ -316,6 +315,82 @@ loading. The example's affiliate sales page uses this with the component query
|
|
|
316
315
|
pages scoped to the recipient account. Earnings totals still use aggregate
|
|
317
316
|
queries independently of pagination.
|
|
318
317
|
|
|
318
|
+
## Original-currency refunds and reversals
|
|
319
|
+
|
|
320
|
+
`Refunds` and `useRefunds` accept `paymentCurrency` for the selected
|
|
321
|
+
`paymentIntentId` and independent `sourceChargeCurrency` for `sourceChargeId`.
|
|
322
|
+
Derive both from authorized original records. The Vite seller refunds page
|
|
323
|
+
loads the selected payment before parsing a partial refund. Its readonly
|
|
324
|
+
`getRefundChargeContext` adapter reads the component's stored settlement allocation
|
|
325
|
+
for the selected source charge and matches the claimed persona's current account
|
|
326
|
+
to its original `store` leg. Missing allocations, unavailable accounts, foreign
|
|
327
|
+
store legs and affiliate/collaborator-only recipients return no context. Partial
|
|
328
|
+
reversals remain disabled until the selected charge has supported verified currency,
|
|
329
|
+
independently of payment currency. A charge without verified currency can still use
|
|
330
|
+
its separately authorized full operation, but cannot submit an assumed-USD partial
|
|
331
|
+
amount. This adapter adds no provider calls, writes or settlement ledger.
|
|
332
|
+
|
|
333
|
+
The example binds a client-claimed demo persona, not an authenticated identity.
|
|
334
|
+
Production hosts such as Dojo must derive an enabled user from the authenticated
|
|
335
|
+
session, authorize merchant ownership on the server and expose only the permitted
|
|
336
|
+
original-charge context. Loading context does not authorize a reversal.
|
|
337
|
+
|
|
338
|
+
```tsx
|
|
339
|
+
<Refunds
|
|
340
|
+
scopeKey={authenticatedUser.id}
|
|
341
|
+
paymentIntentId={selectedPayment.stripePaymentIntentId}
|
|
342
|
+
paymentCurrency={selectedPayment.currency}
|
|
343
|
+
sourceChargeId={verifiedOriginalCharge.id}
|
|
344
|
+
sourceChargeCurrency={verifiedOriginalCharge.currency}
|
|
345
|
+
issueRefund={authorizedRefund}
|
|
346
|
+
reverseTransfers={authorizedRecoveryReversal}
|
|
347
|
+
/>
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
The callbacks remain application-authenticated server bindings. Their optional
|
|
351
|
+
`amountCents` property keeps its legacy name but contains exact provider units
|
|
352
|
+
in the original operation's currency, not universal hundredths. JPY 500 emits
|
|
353
|
+
500; ISK 500 emits 50000; HUF/TWD charges retain fractions. Full operations omit
|
|
354
|
+
the property entirely. Currency parsing does not authorize a refund, calculate
|
|
355
|
+
the remaining refundable balance, reverse ordinary-refund legs a second time,
|
|
356
|
+
cancel a subscription or change access.
|
|
357
|
+
|
|
358
|
+
Omitting a currency retains the legacy USD contract. Pass explicit `null` while
|
|
359
|
+
original currency is unknown; partial operations then fail safely. An explicit
|
|
360
|
+
currency requires its matching original identifier prop. Editing to another
|
|
361
|
+
identifier cannot reuse the old currency; the host must select/load its verified
|
|
362
|
+
record. Unknown currencies, unsupported precision, unsafe integers, scientific
|
|
363
|
+
notation, excess decimals and nonpositive partial amounts never reach callbacks.
|
|
364
|
+
`parseRefundAmount(value, currency)` exposes this exact positive parser through
|
|
365
|
+
`/react`. `parseAmountCents(value)` remains a USD-only compatibility wrapper.
|
|
366
|
+
|
|
367
|
+
Headless state exposes both currencies and nullable `refundInputDecimalPlaces`
|
|
368
|
+
and `reversalInputDecimalPlaces`. Use these for translated labels and input
|
|
369
|
+
precision. Fields, pending/error/result state reset by authenticated scope,
|
|
370
|
+
selected identifiers and currencies. Late completion cannot update another
|
|
371
|
+
context. Changing the view does not cancel an already-submitted server operation;
|
|
372
|
+
reconcile that intent before requesting another. Revalidate authorization,
|
|
373
|
+
original merchant/currency, positive units, remaining refundable limits and
|
|
374
|
+
stable provider idempotency on the server before moving money.
|
|
375
|
+
|
|
376
|
+
The Vite refund history is a bounded preview of up to 25 loaded rows, not an
|
|
377
|
+
authoritative account total. `groupRefundPreview(rows)` groups only supplied rows
|
|
378
|
+
by original currency and exact provider status, returning currency, status, nullable
|
|
379
|
+
amount and row count. It never adds currencies or combines pending/failed/canceled
|
|
380
|
+
requests with succeeded refunds. An empty preview has no monetary group; an explicit
|
|
381
|
+
zero remains zero. Invalid or unsupported units and unsafe sums yield an unavailable
|
|
382
|
+
group amount instead of a rounded or invented total.
|
|
383
|
+
|
|
384
|
+
`formatRefundAmount(amount, currency, locale?)` returns a nullable display string
|
|
385
|
+
using package ordinary provider-unit helpers. It preserves observed fractional
|
|
386
|
+
ISK/UGX refunds; display does not establish eligibility for a new partial input.
|
|
387
|
+
The native `RefundHistory` and the Vite render-prop table use this safe formatter.
|
|
388
|
+
Both helpers are public through `/react`, allowing Dojo to supply translated
|
|
389
|
+
Shadcn labels and empty/unavailable states without rebuilding financial arithmetic.
|
|
390
|
+
Preview grouping performs no reads, writes or provider operations and cannot prove
|
|
391
|
+
bank delivery or complete-account earnings. Authorize and bound the source read in
|
|
392
|
+
the host; keep authoritative full-account aggregates separate.
|
|
393
|
+
|
|
319
394
|
## Store-plan pricing editor
|
|
320
395
|
|
|
321
396
|
`PlanPricingEditor` accepts a `plan` with `id`, `name`, `monthlyAmount` in minor
|
|
@@ -414,3 +489,45 @@ original method and types; it does not retry an unpaid invoice or automatically
|
|
|
414
489
|
fall back to a card. The example demonstrates durable preparation and pending
|
|
415
490
|
operation records in `storeBalanceFunding.ts` with a separate preview client.
|
|
416
491
|
See the [README balance-funding workflow](../README.md#optional-balance-funded-subscriptions).
|
|
492
|
+
|
|
493
|
+
## Dispute evidence uploads and onboarding navigation
|
|
494
|
+
|
|
495
|
+
`EvidenceUpload` is an unstyled control with render props. Its `scopeKey` must
|
|
496
|
+
include the authenticated scope and selected dispute. Bind `onUpload(file)` to
|
|
497
|
+
an authenticated server callback, convert the file to bytes there, and call
|
|
498
|
+
`betterStripe.uploadDisputeEvidence(ctx, { stripeDisputeId, actor, field, file })`.
|
|
499
|
+
The example seller disputes page demonstrates a communication-file attachment.
|
|
500
|
+
The example uses demo personas, so production applications must replace its
|
|
501
|
+
persona authorization with a session-derived actor and dispute ownership check.
|
|
502
|
+
Never accept an actor, connected request account, or attachment file ID from the
|
|
503
|
+
browser as authorization.
|
|
504
|
+
|
|
505
|
+
The server API accepts nonempty PDF, JPEG or PNG bytes up to 5,000,000 bytes. MIME
|
|
506
|
+
type and file signature must match. Stripe performs full document validation and
|
|
507
|
+
may reject corrupt documents or apply additional dispute/network limits. See
|
|
508
|
+
[Stripe's file upload guide](https://docs.stripe.com/file-upload) and
|
|
509
|
+
[evidence troubleshooting](https://support.stripe.com/questions/evidence-submission-troubleshooting-faq).
|
|
510
|
+
Authorization runs before uploading and again before binding. The API uploads
|
|
511
|
+
with `purpose: "dispute_evidence"`, binds only the returned ID to the chosen
|
|
512
|
+
file evidence field, and explicitly sends `submit: false`. Uploading never sends
|
|
513
|
+
evidence to the bank. Continue using `EvidenceForm.stage()` for prose drafts and
|
|
514
|
+
`EvidenceForm.submit()` for explicit final submission.
|
|
515
|
+
|
|
516
|
+
`DISPUTE_UPLOAD_FAILED` carries structured provider error details. An attachment
|
|
517
|
+
failure reports `DISPUTE_UPDATE_FAILED`; the uploaded file can remain at Stripe
|
|
518
|
+
without a draft attachment. Keep the local file and prose draft so the user can
|
|
519
|
+
retry. Do not mark an upload as attached until the entire callback succeeds.
|
|
520
|
+
Convex action payload limits can be lower than Stripe's file limit. For larger
|
|
521
|
+
files, authorize and load a private storage reference on the server, then pass
|
|
522
|
+
its bytes to the package. The example byte-action transport is for small files.
|
|
523
|
+
|
|
524
|
+
`useWorkflowAction(action, scopeKey, onSuccess)` invokes `onSuccess` only after
|
|
525
|
+
checking that the response still belongs to the mounted scope. `useOnboarding`
|
|
526
|
+
uses this lifecycle for both create and continue navigation, including its
|
|
527
|
+
`window.location.assign` fallback. An old response cannot navigate after unmount
|
|
528
|
+
or scope replacement. Current requests preserve shared pending locks and errors.
|
|
529
|
+
These APIs ship in the release containing the dispute-upload and stale-navigation
|
|
530
|
+
implementation PR. Version 0.13.0 does not contain them. Consumers must upgrade
|
|
531
|
+
to that release before removing their navigation guard or using the upload API.
|
|
532
|
+
Production storage, session authorization, styling, translations and extended
|
|
533
|
+
hosted onboarding verification remain application responsibilities.
|