Skip to content

Commit df160e3

Browse files
add payment disputes to preview (#148)
* add payment disputes to preview * optional * update connect-js version
1 parent 6839d89 commit df160e3

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@babel/preset-react": "7.18.6",
5050
"@rollup/plugin-json": "^6.0.0",
5151
"@rollup/plugin-replace": "^2.3.1",
52-
"@stripe/connect-js": "3.3.29-preview-1",
52+
"@stripe/connect-js": "3.3.30-preview-1",
5353
"@types/jest": "^24.0.25",
5454
"@types/react": "^16.8.0",
5555
"@types/react-dom": "^16.8.0",
@@ -85,7 +85,7 @@
8585
"zx": "^4.2.0"
8686
},
8787
"peerDependencies": {
88-
"@stripe/connect-js": ">=3.3.29-preview-1",
88+
"@stripe/connect-js": ">=3.3.30-preview-1",
8989
"react": ">=16.8.0",
9090
"react-dom": ">=16.8.0"
9191
}

src/Components.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,36 @@ export const ConnectPaymentDetails = ({
174174
return wrapper;
175175
};
176176

177+
export const ConnectPaymentDisputes = ({
178+
payment,
179+
onDisputesLoaded,
180+
onLoadError,
181+
onLoaderStart,
182+
}: {
183+
/**
184+
* @param payment the ID of `payment`, `charge`, or `paymentIntent` to be displayed.
185+
*/
186+
payment: string;
187+
onDisputesLoaded?: ({total}: {total: number}) => void;
188+
} & CommonComponentProps): JSX.Element | null => {
189+
const {wrapper, component} =
190+
useCreateComponent('payment-disputes');
191+
192+
useUpdateWithSetter(component, payment, (comp, val) =>
193+
comp.setPayment(val)
194+
);
195+
useUpdateWithSetter(component, onDisputesLoaded, (comp, val) =>
196+
comp.setOnDisputesLoaded(val)
197+
);
198+
useUpdateWithSetter(component, onLoaderStart, (comp, val) => {
199+
comp.setOnLoaderStart(val);
200+
});
201+
useUpdateWithSetter(component, onLoadError, (comp, val) => {
202+
comp.setOnLoadError(val);
203+
});
204+
return wrapper;
205+
};
206+
177207
export const ConnectAccountOnboarding = ({
178208
onExit,
179209
recipientTermsOfServiceUrl,

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,10 +1454,10 @@
14541454
dependencies:
14551455
"@sinonjs/commons" "^3.0.0"
14561456

1457-
"@stripe/connect-js@3.3.29-preview-1":
1458-
version "3.3.29-preview-1"
1459-
resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.29-preview-1.tgz#32c5065f18a5fd075d012a99ed3644e7a150ee4f"
1460-
integrity sha512-B3O8bVOiiGaxsRhkHL38SNX1uWs+U8XGnW652li5/FdEL94qp41tUiUsjB8z2NyccSGNDufhlnbQYdy5+h2GRg==
1457+
"@stripe/connect-js@3.3.30-preview-1":
1458+
version "3.3.30-preview-1"
1459+
resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.30-preview-1.tgz#8fd6fae9f3e1ae96d1f980b0f2f02373736f5763"
1460+
integrity sha512-mRKv6tzGf5A/3l4E7WxEZWEpJNbpAGAmVUzO2Ku1dqYBD/5cSYt5Zibh3XP1MYVm5J2AR8uy86fRmbzrVSeqNA==
14611461

14621462
"@tootallnate/once@2":
14631463
version "2.0.0"

0 commit comments

Comments
 (0)