Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: create new outreach campaign targeting all safes [SW-638] #4672

Merged
merged 6 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
Binary file modified public/images/common/outreach-popup-avatar.png
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intentional that this new picture is so big? Also did you run it through tinypng.com?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, made it smaller now 👍

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCreateSubmissionMutation, useGetSubmissionQuery } from '@/store/api/gateway'
import { skipToken } from '@reduxjs/toolkit/query'
import { useEffect, type ReactElement } from 'react'
import { Avatar, Box, Button, Chip, IconButton, Link, Paper, Stack, ThemeProvider, Typography } from '@mui/material'
import { Avatar, Box, Button, IconButton, Link, Paper, Stack, ThemeProvider, Typography } from '@mui/material'
import { Close } from '@mui/icons-material'
import type { Theme } from '@mui/material/styles'
import { useAppDispatch, useAppSelector } from '@/store'
Expand Down Expand Up @@ -36,6 +36,8 @@ const OutreachPopup = (): ReactElement | null => {
},
)

const outreachUrl = `${ACTIVE_OUTREACH.url}#safe_address=${safeAddress}&signer_address=${wallet?.address}&chain_id=${currentChainId}`

const [askAgainLaterTimestamp, setAskAgainLaterTimestamp] = useSessionStorage<number>(OUTREACH_SS_KEY)

const shouldOpen = useShowOutreachPopup(isClosed, askAgainLaterTimestamp, submission)
Expand Down Expand Up @@ -81,35 +83,30 @@ const OutreachPopup = (): ReactElement | null => {
<Box className={css.popup}>
<Paper className={css.container}>
<Stack gap={2}>
<Box display="flex">
<Avatar alt="Clem, product lead" src="/images/common/outreach-popup-avatar.png" />
<Box display="flex" alignItems="center">
<Avatar
alt="Product marketing lead avatar"
src="/images/common/outreach-popup-avatar.png"
className={css.avatar}
/>
<Box ml={1}>
<Typography variant="body2">Clem</Typography>
<Typography variant="body2">Danilo Pereira</Typography>
<Typography variant="body2" color="primary.light">
Product Lead
Product Marketing Lead
</Typography>
</Box>
</Box>
<Box>
<Chip
size="small"
sx={{ backgroundColor: 'text.primary', color: 'background.paper', mt: '-2px' }}
label={
<Typography fontWeight={700} variant="overline">
EARN REWARDS
</Typography>
}
/>
</Box>
<Typography variant="h4" fontWeight={700}>
You&apos;re invited!
Your voice matters!
<br />
Help us improve {'Safe{Wallet}'}.
</Typography>
<Typography>
As one of our top users, we&apos;d love to hear your feedback on how we can enhance Safe. Share your
contact info, and we&apos;ll reach out for a short interview.
In 1 minute, tell us why you use {'Safe{Wallet}'}. Your input will help us create a better, smarter
wallet experience for you!
</Typography>
<Track {...OUTREACH_EVENTS.OPEN_SURVEY}>
<Link rel="noreferrer noopener" target="_blank" href={ACTIVE_OUTREACH.url}>
<Link rel="noreferrer noopener" target="_blank" href={outreachUrl}>
<Button fullWidth variant="contained" onClick={handleOpenSurvey}>
Get Involved
</Button>
Expand All @@ -121,14 +118,14 @@ const OutreachPopup = (): ReactElement | null => {
</Button>
</Track>
<Typography variant="body2" color="primary.light" mx="auto">
It&apos;ll only take 2 minutes.
It&apos;ll only take 1 minute.
</Typography>
<Track {...OUTREACH_EVENTS.CLOSE_POPUP}>
<IconButton className={css.close} aria-label="close" onClick={handleClose}>
<Close />
</IconButton>
</Track>
</Stack>
<Track {...OUTREACH_EVENTS.CLOSE_POPUP}>
<IconButton className={css.close} aria-label="close" onClick={handleClose}>
<Close />
</IconButton>
</Track>
</Paper>
</Box>
</ThemeProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
z-index: 1300;
bottom: var(--space-2);
right: var(--space-2);
max-width: 400px;
max-width: 340px;
}

.container {
Expand All @@ -20,6 +20,11 @@
padding: var(--space-1);
}

.avatar {
height: 32px;
width: 32px;
}

@media (max-width: 599.99px) {
.popup {
right: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/features/targetedOutreach/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const ACTIVE_OUTREACH = { id: 1, url: 'https://app.opinionx.co/safe-power-user-survey/' }
export const ACTIVE_OUTREACH = { id: 2, url: 'https://wn2n6ocviur.typeform.com/to/nlQlP7lU', targetAll: true }

export const OUTREACH_LS_KEY = 'outreachPopup'
export const OUTREACH_SS_KEY = 'outreachPopup_session'
Expand Down
5 changes: 3 additions & 2 deletions src/features/targetedOutreach/hooks/useShowOutreachPopup.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import useIsSafeOwner from '@/hooks/useIsSafeOwner'
import { MAX_ASK_AGAIN_DELAY } from '@/features/targetedOutreach/constants'
import { ACTIVE_OUTREACH, MAX_ASK_AGAIN_DELAY } from '@/features/targetedOutreach/constants'
import { useAppSelector } from '@/store'
import { selectCookieBanner } from '@/store/popupSlice'
import type { getSubmission } from '@safe-global/safe-client-gateway-sdk'
Expand All @@ -12,7 +12,8 @@ const useShowOutreachPopup = (
const cookiesPopup = useAppSelector(selectCookieBanner)
const isSigner = useIsSafeOwner()

const isTargetedSafe = !!submission?.outreachId
const submissionHasLoaded = submission !== undefined
const isTargetedSafe = submissionHasLoaded && (ACTIVE_OUTREACH.targetAll || !!submission?.outreachId)
const hasCompletedSurvey = !!submission?.completionDate

if (cookiesPopup?.open || isDismissed || !isSigner || !isTargetedSafe || hasCompletedSurvey) {
Expand Down
Loading