Skip to content

Commit 830bf90

Browse files
Add IP Promo component to preview (#164)
* Add IP Promo component to preview * lint fix
1 parent 36881d7 commit 830bf90

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/Components.tsx

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -912,3 +912,44 @@ export const ConnectReportingChart = ({
912912

913913
return wrapper;
914914
};
915+
916+
export const ConnectInstantPayoutsPromotion = ({
917+
onInstantPayoutsPromotionLoaded,
918+
onInstantPayoutCreated,
919+
onLoadError,
920+
onLoaderStart,
921+
}: {
922+
onInstantPayoutsPromotionLoaded?: ({
923+
promotionShown,
924+
}: {
925+
promotionShown: boolean;
926+
}) => void;
927+
onInstantPayoutCreated?: ({payoutId}: {payoutId: string}) => void;
928+
} & CommonComponentProps): JSX.Element => {
929+
const {wrapper, component: instantPayoutsPromotion} = useCreateComponent(
930+
'instant-payouts-promotion'
931+
);
932+
933+
useUpdateWithSetter(instantPayoutsPromotion, onLoaderStart, (comp, val) => {
934+
comp.setOnLoaderStart(val);
935+
});
936+
useUpdateWithSetter(instantPayoutsPromotion, onLoadError, (comp, val) => {
937+
comp.setOnLoadError(val);
938+
});
939+
useUpdateWithSetter(
940+
instantPayoutsPromotion,
941+
onInstantPayoutsPromotionLoaded,
942+
(comp, val) => {
943+
comp.setOnInstantPayoutsPromotionLoaded(val);
944+
}
945+
);
946+
useUpdateWithSetter(
947+
instantPayoutsPromotion,
948+
onInstantPayoutCreated,
949+
(comp, val) => {
950+
comp.setOnInstantPayoutCreated(val);
951+
}
952+
);
953+
954+
return wrapper;
955+
};

src/utils/useUpdateWithSetter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export const useUpdateWithSetter = <
3333
| Date
3434
| (({id}: {id: string}) => void)
3535
| ((taxCode: string) => void)
36+
| (({promotionShown}: {promotionShown: boolean}) => void)
37+
| (({payoutId}: {payoutId: string}) => void)
3638
| undefined
3739
>(
3840
component: T | null,

0 commit comments

Comments
 (0)