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

fix: pass alert key to the openBanner callback #3643

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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