From f46bebf12aad6181cb6b3358586e8eca1d51257d Mon Sep 17 00:00:00 2001 From: Hannah Huang Date: Thu, 17 Oct 2024 12:03:53 -0400 Subject: [PATCH 1/5] add default filters setter --- src/Components.tsx | 9 ++++++--- src/utils/useUpdateWithSetter.ts | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Components.tsx b/src/Components.tsx index 889ec5d..fea2bf7 100644 --- a/src/Components.tsx +++ b/src/Components.tsx @@ -5,6 +5,7 @@ import { LoaderStart, NotificationCount, StepChange, + PaymentsListDefaultFilters } from '@stripe/connect-js'; export type CommonComponentProps = { @@ -13,9 +14,10 @@ export type CommonComponentProps = { }; 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) => { @@ -24,8 +26,9 @@ export const ConnectPayments = ({ useUpdateWithSetter(payments, onLoadError, (comp, val) => { comp.setOnLoadError(val); }); - - return wrapper; + useUpdateWithSetter(payments, defaultFilters, (comp, val) => { + comp.setDefaultFilters(val); + }); }; export const ConnectPayouts = ({ diff --git a/src/utils/useUpdateWithSetter.ts b/src/utils/useUpdateWithSetter.ts index fbcaf88..e436918 100644 --- a/src/utils/useUpdateWithSetter.ts +++ b/src/utils/useUpdateWithSetter.ts @@ -5,6 +5,7 @@ import { LoaderStart, NotificationCount, StepChange, + PaymentsListDefaultFilters } from '@stripe/connect-js'; export const useUpdateWithSetter = < @@ -20,6 +21,7 @@ export const useUpdateWithSetter = < | ((loaderError: LoadError) => void) | ((stepChange: StepChange) => void) | (({id}: {id: string}) => void) + | ((defaultFilters: PaymentsListDefaultFilters) => void) | undefined >( component: T | null, From 3a068aae2f94bf16e79017f27ffab727b7dac7c9 Mon Sep 17 00:00:00 2001 From: Hannah Huang Date: Thu, 17 Oct 2024 12:05:43 -0400 Subject: [PATCH 2/5] return wrapper --- src/Components.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Components.tsx b/src/Components.tsx index fea2bf7..fb397d0 100644 --- a/src/Components.tsx +++ b/src/Components.tsx @@ -29,6 +29,8 @@ export const ConnectPayments = ({ useUpdateWithSetter(payments, defaultFilters, (comp, val) => { comp.setDefaultFilters(val); }); + + return wrapper; }; export const ConnectPayouts = ({ From 9275848884f89676600799f180a3216e1635d329 Mon Sep 17 00:00:00 2001 From: Hannah Huang Date: Thu, 17 Oct 2024 13:29:09 -0400 Subject: [PATCH 3/5] update connect.js version --- package.json | 4 ++-- yarn.lock | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index bf91242..aff6302 100644 --- a/package.json +++ b/package.json @@ -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.14", + "@stripe/connect-js": "3.3.16", "@types/jest": "^24.0.25", "@types/react": "^16.8.0", "@types/react-dom": "^16.8.0", @@ -84,7 +84,7 @@ "zx": "^4.2.0" }, "peerDependencies": { - "@stripe/connect-js": ">=3.3.14", + "@stripe/connect-js": ">=3.3.16", "react": ">=16.8.0", "react-dom": ">=16.8.0" } diff --git a/yarn.lock b/yarn.lock index 9c8deec..220db0d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1439,10 +1439,10 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@stripe/connect-js@3.3.14": - version "3.3.14" - resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.14.tgz#4510042e5b9bab98ef4706a79010cacd11c74b48" - integrity sha512-jQ6ee5JVY4XMDL6PhAFv47om1/H0JjE6G4GpuEItRQkmVScAi3tTzx7g7/1/2LhvYW+4HejZJAIq51ymFIneLw== +"@stripe/connect-js@3.3.16": + version "3.3.16" + resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.16.tgz#36af5211c863c18520a080403c4f736c0160f8a1" + integrity sha512-lMUKJJaDl6qzjp+czNn+N6wMwFXwLawmB2jNNgds8SeR+bXCVCXevzJ8dfF92KfmexKg++hBYagF9e99sEMBJQ== "@tootallnate/once@2": version "2.0.0" From bb27b56782aa4969d7eb9ea077c8545791a8f9ec Mon Sep 17 00:00:00 2001 From: Hannah Huang Date: Thu, 17 Oct 2024 13:45:36 -0400 Subject: [PATCH 4/5] add type in useUpdateWithSetter --- src/utils/useUpdateWithSetter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/useUpdateWithSetter.ts b/src/utils/useUpdateWithSetter.ts index e436918..6cb8005 100644 --- a/src/utils/useUpdateWithSetter.ts +++ b/src/utils/useUpdateWithSetter.ts @@ -14,6 +14,7 @@ export const useUpdateWithSetter = < | string | boolean | string[] + | PaymentsListDefaultFilters | (() => void) | CollectionOptions | ((notificationCount: NotificationCount) => void) @@ -21,7 +22,7 @@ export const useUpdateWithSetter = < | ((loaderError: LoadError) => void) | ((stepChange: StepChange) => void) | (({id}: {id: string}) => void) - | ((defaultFilters: PaymentsListDefaultFilters) => void) + // | ((defaultFilters: PaymentsListDefaultFilters) => void) | undefined >( component: T | null, From a9b318647e6cc44ff2f5e78cac57df650f705207 Mon Sep 17 00:00:00 2001 From: Hannah Huang Date: Thu, 17 Oct 2024 14:00:04 -0400 Subject: [PATCH 5/5] remove comment --- src/utils/useUpdateWithSetter.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/useUpdateWithSetter.ts b/src/utils/useUpdateWithSetter.ts index 6cb8005..c5946d1 100644 --- a/src/utils/useUpdateWithSetter.ts +++ b/src/utils/useUpdateWithSetter.ts @@ -22,7 +22,6 @@ export const useUpdateWithSetter = < | ((loaderError: LoadError) => void) | ((stepChange: StepChange) => void) | (({id}: {id: string}) => void) - // | ((defaultFilters: PaymentsListDefaultFilters) => void) | undefined >( component: T | null,