mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-18 07:24:09 +00:00
Merge pull request #20435 from overleaf/jdt-hide-wf-promo-from-wf-commons
Hide Writefull Promo From Writefull Commons Users GitOrigin-RevId: 7adcb8f6e71c9c5b27da248e025b14a51fab703b
This commit is contained in:
parent
a807a810e6
commit
5b73f08703
5 changed files with 14 additions and 1 deletions
|
@ -4,6 +4,7 @@ import { sendMB } from '@/infrastructure/event-tracking'
|
||||||
import customLocalStorage from '@/infrastructure/local-storage'
|
import customLocalStorage from '@/infrastructure/local-storage'
|
||||||
import WritefullLogo from '@/shared/svgs/writefull-logo'
|
import WritefullLogo from '@/shared/svgs/writefull-logo'
|
||||||
import OLButton from '@/features/ui/components/ol/ol-button'
|
import OLButton from '@/features/ui/components/ol/ol-button'
|
||||||
|
import getMeta from '@/utils/meta'
|
||||||
|
|
||||||
const eventSegmentation = {
|
const eventSegmentation = {
|
||||||
location: 'dashboard-banner',
|
location: 'dashboard-banner',
|
||||||
|
@ -20,6 +21,11 @@ function WritefullPremiumPromoBanner({
|
||||||
setShow: (value: boolean) => void
|
setShow: (value: boolean) => void
|
||||||
onDismiss: () => void
|
onDismiss: () => void
|
||||||
}) {
|
}) {
|
||||||
|
// dont show the add to WF commons users since their license already includes it
|
||||||
|
const userAffiliations = getMeta('ol-userAffiliations') || []
|
||||||
|
const hasWritefullCommons = userAffiliations.some(
|
||||||
|
affil => affil.institution?.writefullCommonsAccount
|
||||||
|
)
|
||||||
const handleClose = useCallback(() => {
|
const handleClose = useCallback(() => {
|
||||||
customLocalStorage.setItem('has_dismissed_writefull_promo_banner', true)
|
customLocalStorage.setItem('has_dismissed_writefull_promo_banner', true)
|
||||||
setShow(false)
|
setShow(false)
|
||||||
|
@ -27,7 +33,7 @@ function WritefullPremiumPromoBanner({
|
||||||
onDismiss()
|
onDismiss()
|
||||||
}, [setShow, onDismiss])
|
}, [setShow, onDismiss])
|
||||||
|
|
||||||
if (!show) {
|
if (!show || hasWritefullCommons) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ const userEmailData: UserEmailData & { affiliation: Affiliation } = {
|
||||||
department: 'Art History',
|
department: 'Art History',
|
||||||
institution: {
|
institution: {
|
||||||
commonsAccount: false,
|
commonsAccount: false,
|
||||||
|
writefullCommonsAccount: false,
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
id: 1,
|
id: 1,
|
||||||
isUniversity: true,
|
isUniversity: true,
|
||||||
|
|
|
@ -23,6 +23,7 @@ const userData1: UserEmailData & { affiliation: Affiliation } = {
|
||||||
department: null,
|
department: null,
|
||||||
institution: {
|
institution: {
|
||||||
commonsAccount: false,
|
commonsAccount: false,
|
||||||
|
writefullCommonsAccount: false,
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
id: 1,
|
id: 1,
|
||||||
isUniversity: false,
|
isUniversity: false,
|
||||||
|
@ -53,6 +54,7 @@ const userData2: UserEmailData & { affiliation: Affiliation } = {
|
||||||
department: 'Art History',
|
department: 'Art History',
|
||||||
institution: {
|
institution: {
|
||||||
commonsAccount: false,
|
commonsAccount: false,
|
||||||
|
writefullCommonsAccount: false,
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
id: 1,
|
id: 1,
|
||||||
isUniversity: false,
|
isUniversity: false,
|
||||||
|
|
|
@ -24,6 +24,7 @@ export const professionalUserData: UserEmailData & {
|
||||||
department: 'Art History',
|
department: 'Art History',
|
||||||
institution: {
|
institution: {
|
||||||
commonsAccount: false,
|
commonsAccount: false,
|
||||||
|
writefullCommonsAccount: false,
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
id: 1,
|
id: 1,
|
||||||
isUniversity: false,
|
isUniversity: false,
|
||||||
|
@ -56,6 +57,7 @@ export const unconfirmedCommonsUserData: UserEmailData & {
|
||||||
department: 'Art History',
|
department: 'Art History',
|
||||||
institution: {
|
institution: {
|
||||||
commonsAccount: true,
|
commonsAccount: true,
|
||||||
|
writefullCommonsAccount: false,
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
id: 1,
|
id: 1,
|
||||||
isUniversity: false,
|
isUniversity: false,
|
||||||
|
@ -85,6 +87,7 @@ export const ssoUserData: UserEmailData = {
|
||||||
department: 'Art History',
|
department: 'Art History',
|
||||||
institution: {
|
institution: {
|
||||||
commonsAccount: true,
|
commonsAccount: true,
|
||||||
|
writefullCommonsAccount: false,
|
||||||
confirmed: true,
|
confirmed: true,
|
||||||
id: 2,
|
id: 2,
|
||||||
isUniversity: true,
|
isUniversity: true,
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { Nullable } from './utils'
|
||||||
|
|
||||||
export type Institution = {
|
export type Institution = {
|
||||||
commonsAccount: boolean
|
commonsAccount: boolean
|
||||||
|
writefullCommonsAccount: boolean
|
||||||
confirmed: boolean
|
confirmed: boolean
|
||||||
id: number
|
id: number
|
||||||
isUniversity: boolean
|
isUniversity: boolean
|
||||||
|
|
Loading…
Reference in a new issue