Skip to content

Commit

Permalink
update onNotificationsChange to include payload (#98)
Browse files Browse the repository at this point in the history
* Updated response type

* Removed extra space

* Added space

* bumped to 3.3.9

* Updated import

* fixed spacing

* Adding lock

* Fixed import

* Updated styling

* updated peer dependencies
  • Loading branch information
riquelme-stripe authored Jul 8, 2024
1 parent 6be5969 commit 1e473b0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 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.7",
"@stripe/connect-js": "3.3.9",
"@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.5",
"@stripe/connect-js": ">=3.3.9",
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}
Expand Down
4 changes: 2 additions & 2 deletions src/Components.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {useCreateComponent} from './useCreateComponent';
import {useUpdateWithSetter} from './utils/useUpdateWithSetter';
import {NotificationCount} from '@stripe/connect-js';

export const ConnectPayments = (): JSX.Element => {
const {wrapper} = useCreateComponent('payments');
Expand Down Expand Up @@ -95,7 +96,7 @@ export const ConnectNotificationBanner = ({
onNotificationsChange,
}: {
collectionOptions?: CollectionOptions;
onNotificationsChange?: () => void;
onNotificationsChange?: ({total, actionRequired}: NotificationCount) => void;
}): JSX.Element | null => {
const {wrapper, component: notificationBanner} = useCreateComponent('notification-banner');

Expand All @@ -104,7 +105,6 @@ export const ConnectNotificationBanner = ({
);
useUpdateWithSetter(notificationBanner, onNotificationsChange, (comp, val) => comp.setOnNotificationsChange(val));


return wrapper;
};

Expand Down
3 changes: 2 additions & 1 deletion src/utils/useUpdateWithSetter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import {CollectionOptions} from '../Components';
import {NotificationCount} from '@stripe/connect-js';

export const useUpdateWithSetter = <
T extends HTMLElement,
V extends string | boolean | (() => void) | CollectionOptions | undefined
V extends string | boolean | (() => void) | CollectionOptions | ((notificationCount: NotificationCount) => void) |undefined
>(
component: T | null,
value: V,
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1439,10 +1439,10 @@
dependencies:
"@sinonjs/commons" "^3.0.0"

"@stripe/connect-js@3.3.7":
version "3.3.7"
resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.7.tgz#7de3a69fbc58d763f1743167063ba16bfba45809"
integrity sha512-3fCQ4pKdZcSaLKQR0x2wTY3ZIpZKzejG88of+6jqVIRElZkojQFLB5GjgpbnwICK9FQEe8aUcgigExwZYqa1PA==
"@stripe/connect-js@3.3.9":
version "3.3.9"
resolved "https://registry.yarnpkg.com/@stripe/connect-js/-/connect-js-3.3.9.tgz#1132a1b3bf8d46345e42b1532ea42663e7ab15b2"
integrity sha512-4ilZpzPV2bYDRrcsY8Jj0cBYRVABqKOqnnHDDDcn0YNjMnLJULYPKBqa14Lk3Xo8xybbd3BHCZgX6B5Dm8SuPg==

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

0 comments on commit 1e473b0

Please sign in to comment.