Skip to content

Commit

Permalink
add default filters setter and update connect.js version (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
hhuang-stripe authored Oct 17, 2024
1 parent 3db5d99 commit 89d30e1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"@babel/preset-react": "7.18.6",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-replace": "^2.3.1",
"@stripe/connect-js": "3.3.22-preview-1",
"@stripe/connect-js": "3.3.22-preview-2",
"@types/jest": "^24.0.25",
"@types/react": "^16.8.0",
"@types/react-dom": "^16.8.0",
Expand Down Expand Up @@ -84,7 +84,7 @@
"zx": "^4.2.0"
},
"peerDependencies": {
"@stripe/connect-js": ">=3.3.21-preview-1",
"@stripe/connect-js": ">=3.3.21-preview-2",
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}
Expand Down
7 changes: 6 additions & 1 deletion src/Components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
IntervalType,
ReportName,
RecipientDataSource,
PaymentsListDefaultFilters
} from '@stripe/connect-js';

export type CommonComponentProps = {
Expand Down Expand Up @@ -92,9 +93,10 @@ export const ConnectBalances = ({
};

export const ConnectPayments = ({
defaultFilters,
onLoadError,
onLoaderStart,
}: CommonComponentProps): JSX.Element => {
}: {defaultFilters?: PaymentsListDefaultFilters} & CommonComponentProps): JSX.Element => {
const {wrapper, component: payments} = useCreateComponent('payments');

useUpdateWithSetter(payments, onLoaderStart, (comp, val) => {
Expand All @@ -103,6 +105,9 @@ export const ConnectPayments = ({
useUpdateWithSetter(payments, onLoadError, (comp, val) => {
comp.setOnLoadError(val);
});
useUpdateWithSetter(payments, defaultFilters, (comp, val) => {
comp.setDefaultFilters(val);
});

return wrapper;
};
Expand Down
2 changes: 2 additions & 0 deletions src/utils/useUpdateWithSetter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
InstallState,
NotificationCount,
StepChange,
PaymentsListDefaultFilters,
} from '@stripe/connect-js';

export const useUpdateWithSetter = <
Expand All @@ -22,6 +23,7 @@ export const useUpdateWithSetter = <
| (() => void)
| FetchEphemeralKeyFunction
| CollectionOptions
| PaymentsListDefaultFilters
| ((notificationCount: NotificationCount) => void)
| ((loaderStart: LoaderStart) => void)
| ((loaderError: LoadError) => void)
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1454,10 +1454,10 @@
dependencies:
"@sinonjs/commons" "^3.0.0"

"@stripe/connect-js@3.3.22-preview-1":
version "3.3.22-preview-1"
resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.22-preview-1.tgz#b94b0c8eac058f370e5bf47901e758a514afa34b"
integrity sha512-aWlczAF4buip9snjImtWIbgwhto+xRefBxDpDX6SAg1klgc8Kmvcby8MPN9Qmc37dZRFjnlvtd2EXDbcX0omzw==
"@stripe/connect-js@3.3.22-preview-2":
version "3.3.22-preview-2"
resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.22-preview-2.tgz#0a2a260ebc32586f3290e56299a602ad198fc42f"
integrity sha512-KYHRwInYRXklXwQZmu3YVhN3xlpBscZw1Fyhgz1+Zs8uORYNkt2BJr09GQabR9PpEktLttv0HaILMS1aks0gOQ==

"@tootallnate/once@2":
version "2.0.0"
Expand Down

0 comments on commit 89d30e1

Please sign in to comment.