From 1e473b0b2878b35ce8c20fc6e5a27c8f63d47d6e Mon Sep 17 00:00:00 2001 From: riquelme-stripe Date: Mon, 8 Jul 2024 13:18:12 -0700 Subject: [PATCH] update onNotificationsChange to include payload (#98) * 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 --- package.json | 4 ++-- src/Components.tsx | 4 ++-- src/utils/useUpdateWithSetter.ts | 3 ++- yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 8e8da50..10ea249 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.7", + "@stripe/connect-js": "3.3.9", "@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.5", + "@stripe/connect-js": ">=3.3.9", "react": ">=16.8.0", "react-dom": ">=16.8.0" } diff --git a/src/Components.tsx b/src/Components.tsx index 99c3aef..edfe844 100644 --- a/src/Components.tsx +++ b/src/Components.tsx @@ -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'); @@ -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'); @@ -104,7 +105,6 @@ export const ConnectNotificationBanner = ({ ); useUpdateWithSetter(notificationBanner, onNotificationsChange, (comp, val) => comp.setOnNotificationsChange(val)); - return wrapper; }; diff --git a/src/utils/useUpdateWithSetter.ts b/src/utils/useUpdateWithSetter.ts index 41ff598..92f929a 100644 --- a/src/utils/useUpdateWithSetter.ts +++ b/src/utils/useUpdateWithSetter.ts @@ -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, diff --git a/yarn.lock b/yarn.lock index 2e1dac1..ccb9c35 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"