Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
fix: pass alert key to the openBanner callback (#3643)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiogoSoaress authored and katspaugh committed Mar 9, 2022
1 parent 6bdbc50 commit 7faa48d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/components/CookiesBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,17 @@ const CookiesBanner = isDesktop
const { cookieBannerOpen } = useSelector(cookieBannerState)
const isSafeAppView = useSafeAppUrl().getAppUrl() !== null

const openBanner = useCallback((): void => {
dispatch(
openCookieBanner({
cookieBannerOpen: true,
key: COOKIE_IDS.INTERCOM,
}),
)
}, [dispatch])
const openBanner = useCallback(
(key?: COOKIE_IDS): void => {
dispatch(
openCookieBanner({
cookieBannerOpen: true,
key,
}),
)
},
[dispatch],
)

const closeBanner = useCallback((): void => {
dispatch(closeCookieBanner())
Expand Down Expand Up @@ -290,7 +293,9 @@ const CookiesBanner = isDesktop
return (
<>
{/* A fake Intercom button before Intercom is loaded */}
{!localSupportAndUpdates && !isSafeAppView && <FakeIntercomButton onClick={openBanner} />}
{!localSupportAndUpdates && !isSafeAppView && (
<FakeIntercomButton onClick={() => openBanner(COOKIE_IDS.INTERCOM)} />
)}

{/* The cookie banner itself */}
{cookieBannerOpen && (
Expand Down

0 comments on commit 7faa48d

Please sign in to comment.