From 39179308a94fdbe0e484df59c129aec732f5a197 Mon Sep 17 00:00:00 2001 From: Leonardo Sameshima Taba Date: Tue, 5 Nov 2024 15:08:47 -0300 Subject: [PATCH 1/6] Show notice explaining that email cannot be purchased for Gravatar domains Add notice to the email service selection page explaining that Gravatar domains cannot have email purchased for them. --- .../stacked/index.tsx | 20 ++++++++++++++++--- .../stacked/style.scss | 4 ++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/client/my-sites/email/email-providers-comparison/stacked/index.tsx b/client/my-sites/email/email-providers-comparison/stacked/index.tsx index ebeb9e38412ea..8cbde62e67466 100644 --- a/client/my-sites/email/email-providers-comparison/stacked/index.tsx +++ b/client/my-sites/email/email-providers-comparison/stacked/index.tsx @@ -13,8 +13,13 @@ import QueryProductsList from 'calypso/components/data/query-products-list'; import QuerySiteDomains from 'calypso/components/data/query-site-domains'; import { hasDiscount } from 'calypso/components/gsuite/gsuite-price'; import Main from 'calypso/components/main'; +import Notice from 'calypso/components/notice'; import TrackComponentView from 'calypso/lib/analytics/track-component-view'; -import { getSelectedDomain, canCurrentUserAddEmail } from 'calypso/lib/domains'; +import { + getSelectedDomain, + canCurrentUserAddEmail, + getCurrentUserCannotAddEmailReason, +} from 'calypso/lib/domains'; import { hasEmailForwards, getDomainsWithEmailForwards, @@ -92,7 +97,9 @@ const EmailProvidersStackedComparison = ( { ); const currentUserCanAddEmail = canCurrentUserAddEmail( domain ); - const showNonOwnerMessage = ! currentUserCanAddEmail && ! isDomainInCart; + const showNonOwnerMessage = ! currentUserCanAddEmail && ! isDomainInCart && false; + const cannotAddEmailWarningReason = getCurrentUserCannotAddEmailReason( domain ); + const isGravatarDomain = cannotAddEmailWarningReason?.code === 'domain-gravatar-domain'; const isGSuiteSupported = domain && canPurchaseGSuite && ( isDomainInCart || hasGSuiteSupportedDomain( [ domain ] ) ); @@ -292,13 +299,20 @@ const EmailProvidersStackedComparison = ( { { ! isDomainInCart && domain && } <> - { showNonOwnerMessage && ( + { showNonOwnerMessage && ! isGravatarDomain && ( ) } + { isGravatarDomain && ( + + { translate( + 'This is a Gravatar domain and cannot have email services purchased for it.' + ) } + + ) } { shouldPromoteGoogleWorkspace ? [ ...emailProviderCards ].reverse() : emailProviderCards } diff --git a/client/my-sites/email/email-providers-comparison/stacked/style.scss b/client/my-sites/email/email-providers-comparison/stacked/style.scss index 87752ec62d6cd..fa9e081899dbe 100644 --- a/client/my-sites/email/email-providers-comparison/stacked/style.scss +++ b/client/my-sites/email/email-providers-comparison/stacked/style.scss @@ -51,3 +51,7 @@ margin: 10px auto; } } + +.email-providers-stacked-comparison__notice { + margin-top: 24px; +} From a5d2e26d6f3cdeeb97d5698c8b41a0b57fb5ba86 Mon Sep 17 00:00:00 2001 From: Leonardo Sameshima Taba Date: Tue, 5 Nov 2024 15:57:59 -0300 Subject: [PATCH 2/6] Revert unadvertent change --- .../my-sites/email/email-providers-comparison/stacked/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/my-sites/email/email-providers-comparison/stacked/index.tsx b/client/my-sites/email/email-providers-comparison/stacked/index.tsx index 8cbde62e67466..924f8dedb069d 100644 --- a/client/my-sites/email/email-providers-comparison/stacked/index.tsx +++ b/client/my-sites/email/email-providers-comparison/stacked/index.tsx @@ -97,7 +97,7 @@ const EmailProvidersStackedComparison = ( { ); const currentUserCanAddEmail = canCurrentUserAddEmail( domain ); - const showNonOwnerMessage = ! currentUserCanAddEmail && ! isDomainInCart && false; + const showNonOwnerMessage = ! currentUserCanAddEmail && ! isDomainInCart; const cannotAddEmailWarningReason = getCurrentUserCannotAddEmailReason( domain ); const isGravatarDomain = cannotAddEmailWarningReason?.code === 'domain-gravatar-domain'; From 488f4e19817d0183db29fc6a9d1d89b72fb43d05 Mon Sep 17 00:00:00 2001 From: Leonardo Sameshima Taba Date: Tue, 5 Nov 2024 18:04:32 -0300 Subject: [PATCH 3/6] SHow notice on the email forwarding page for Gravatar domains --- .../email/email-forwards-add/index.tsx | 50 ++++++++++++------- .../email/email-forwards-add/style.scss | 4 ++ 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/client/my-sites/email/email-forwards-add/index.tsx b/client/my-sites/email/email-forwards-add/index.tsx index 9aa9fa084530a..8983761a70019 100644 --- a/client/my-sites/email/email-forwards-add/index.tsx +++ b/client/my-sites/email/email-forwards-add/index.tsx @@ -7,7 +7,9 @@ import QueryProductsList from 'calypso/components/data/query-products-list'; import QuerySiteDomains from 'calypso/components/data/query-site-domains'; import HeaderCake from 'calypso/components/header-cake'; import Main from 'calypso/components/main'; +import Notice from 'calypso/components/notice'; import SectionHeader from 'calypso/components/section-header'; +import { getCurrentUserCannotAddEmailReason, getSelectedDomain } from 'calypso/lib/domains'; import EmailForwardingAddNewCompactList from 'calypso/my-sites/email/email-forwarding/email-forwarding-add-new-compact-list'; import EmailHeader from 'calypso/my-sites/email/email-header'; import { @@ -17,6 +19,7 @@ import { import { useSelector } from 'calypso/state'; import getCurrentRoute from 'calypso/state/selectors/get-current-route'; import { + getDomainsBySiteId, hasLoadedSiteDomains, isRequestingSiteDomains, } from 'calypso/state/sites/domains/selectors'; @@ -46,6 +49,11 @@ const EmailForwardsAdd = ( { selectedDomainName, source }: EmailForwardsAddProps const translate = useTranslate(); + const domains = useSelector( ( state ) => getDomainsBySiteId( state, selectedSite?.ID ) ); + const selectedDomain = getSelectedDomain( { domains, selectedDomainName } ); + const cannotAddEmailWarningReason = getCurrentUserCannotAddEmailReason( selectedDomain ); + const isGravatarDomain = cannotAddEmailWarningReason?.code === 'domain-gravatar-domain'; + const goToEmail = useCallback( (): void => { if ( ! selectedSite ) { return; @@ -67,6 +75,30 @@ const EmailForwardsAdd = ( { selectedDomainName, source }: EmailForwardsAddProps page( getEmailManagementPath( selectedSite.slug, selectedDomainName, currentRoute ) ); }, [ currentRoute, selectedDomainName, selectedSite ] ); + const content = isGravatarDomain ? ( + + { translate( 'This is a Gravatar domain and cannot have email services purchased for it.' ) } + + ) : ( + + { areDomainsLoading && ( +
+

+

+

+ ) } + + { ! areDomainsLoading && ( + + ) } +
+ ); + return (
@@ -84,23 +116,7 @@ const EmailForwardsAdd = ( { selectedDomainName, source }: EmailForwardsAddProps - - { areDomainsLoading && ( -
-

-

-

- ) } - - { ! areDomainsLoading && ( - - ) } -
+ { content }
); diff --git a/client/my-sites/email/email-forwards-add/style.scss b/client/my-sites/email/email-forwards-add/style.scss index 808e9f4e269b8..24d9d3447538d 100644 --- a/client/my-sites/email/email-forwards-add/style.scss +++ b/client/my-sites/email/email-forwards-add/style.scss @@ -30,3 +30,7 @@ margin-top: 3em; } } + +.email-forwards-add__notice { + margin-top: 24px; +} From cbf96108fce3b0c6ac22565d1860bba2746de690 Mon Sep 17 00:00:00 2001 From: Leonardo Sameshima Taba Date: Fri, 8 Nov 2024 16:14:41 -0300 Subject: [PATCH 4/6] Prevent new mailboxes from being added to Gravatar domains that already have email --- client/lib/emails/email-provider-constants.js | 1 + .../home/email-plan-warning-notice.tsx | 19 ++++++++++++++---- .../email/email-management/home/utils.ts | 20 ++++++++++++++++++- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/client/lib/emails/email-provider-constants.js b/client/lib/emails/email-provider-constants.js index d2bb587968655..124248cb6f809 100644 --- a/client/lib/emails/email-provider-constants.js +++ b/client/lib/emails/email-provider-constants.js @@ -11,3 +11,4 @@ export const EMAIL_WARNING_SLUG_UNVERIFIED_FORWARDS = 'unverified_forwards'; export const EMAIL_WARNING_CODE_OTHER_USER_OWNS_DOMAIN_SUBSCRIPTION = 'other-user-owns-subscription'; export const EMAIL_WARNING_CODE_OTHER_USER_OWNS_EMAIL = 'other-user-owns-email'; +export const EMAIL_WARNING_CODE_GRAVATAR_DOMAIN = 'domain-gravatar-domain'; diff --git a/client/my-sites/email/email-management/home/email-plan-warning-notice.tsx b/client/my-sites/email/email-management/home/email-plan-warning-notice.tsx index 5c73b91baf796..f30c0fa34b097 100644 --- a/client/my-sites/email/email-management/home/email-plan-warning-notice.tsx +++ b/client/my-sites/email/email-management/home/email-plan-warning-notice.tsx @@ -5,6 +5,7 @@ import { } from 'calypso/lib/domains'; import { ResponseDomain } from 'calypso/lib/domains/types'; import { + EMAIL_WARNING_CODE_GRAVATAR_DOMAIN, EMAIL_WARNING_CODE_OTHER_USER_OWNS_DOMAIN_SUBSCRIPTION, EMAIL_WARNING_CODE_OTHER_USER_OWNS_EMAIL, } from 'calypso/lib/emails/email-provider-constants'; @@ -20,16 +21,26 @@ type EmailPlanWarningNoticeProps = { export const EmailPlanWarningNotice = ( props: EmailPlanWarningNoticeProps ) => { const { domain, selectedSite } = props; + const cannotAddEmailWarningReason = getCurrentUserCannotAddEmailReason( domain ); + const cannotAddEmailWarningMessage = cannotAddEmailWarningReason?.message ?? ''; + const cannotAddEmailWarningCode = cannotAddEmailWarningReason?.code ?? null; + + if ( cannotAddEmailWarningCode === EMAIL_WARNING_CODE_GRAVATAR_DOMAIN ) { + return ( +
+
+ { cannotAddEmailWarningMessage } +
+
+ ); + } + // If email and domain are owned by different users, none of the users will be able to make a purchase and the only way to resolve this // is to reach out to support. Therefore, we should surface a different message to address this scenario. if ( ! isDomainAndEmailSubscriptionsOwnedByDifferentUsers( domain ) ) { return ; } - const cannotAddEmailWarningReason = getCurrentUserCannotAddEmailReason( domain ); - const cannotAddEmailWarningMessage = cannotAddEmailWarningReason?.message ?? ''; - const cannotAddEmailWarningCode = cannotAddEmailWarningReason?.code ?? null; - switch ( cannotAddEmailWarningCode ) { case EMAIL_WARNING_CODE_OTHER_USER_OWNS_EMAIL: return ( diff --git a/client/my-sites/email/email-management/home/utils.ts b/client/my-sites/email/email-management/home/utils.ts index a9dd64e27c369..33894c8a3b5ba 100644 --- a/client/my-sites/email/email-management/home/utils.ts +++ b/client/my-sites/email/email-management/home/utils.ts @@ -1,6 +1,6 @@ import { translate } from 'i18n-calypso'; import { recordTracksEvent } from 'calypso/lib/analytics/tracks'; -import { canCurrentUserAddEmail } from 'calypso/lib/domains'; +import { canCurrentUserAddEmail, getCurrentUserCannotAddEmailReason } from 'calypso/lib/domains'; import { getEmailForwardsCount, hasEmailForwards } from 'calypso/lib/domains/email-forwarding'; import { isRecentlyRegistered } from 'calypso/lib/domains/utils'; import { @@ -8,6 +8,7 @@ import { hasUnusedMailboxWarning, hasUnverifiedEmailForward, } from 'calypso/lib/emails'; +import { EMAIL_WARNING_CODE_GRAVATAR_DOMAIN } from 'calypso/lib/emails/email-provider-constants'; import { getGSuiteMailboxCount, getGSuiteSubscriptionId, @@ -133,6 +134,23 @@ export function resolveEmailPlanStatus( } ), }; + const gravatarDomainStatus = { + statusClass: 'warning', + icon: 'info', + text: translate( 'Gravatar domain', { + comment: 'Current user is not allowed to manage email subscription', + } ), + }; + + // Some Gravatar domains already had email purchased for them before we disabled it. + // These domains have a specific warning message. + if ( + ! canCurrentUserAddEmail( domain ) && + getCurrentUserCannotAddEmailReason( domain )?.code === EMAIL_WARNING_CODE_GRAVATAR_DOMAIN + ) { + return gravatarDomainStatus; + } + if ( hasGSuiteWithUs( domain ) ) { if ( ! canCurrentUserAddEmail( domain ) ) { return cannotManageStatus; From a814150005d322956f950865c5ed5053729d782d Mon Sep 17 00:00:00 2001 From: Leonardo Sameshima Taba Date: Wed, 13 Nov 2024 16:07:00 -0300 Subject: [PATCH 5/6] Update messages with code review suggestion --- client/my-sites/email/email-forwards-add/index.tsx | 4 +++- client/my-sites/email/email-management/home/utils.ts | 2 +- .../email/email-providers-comparison/stacked/index.tsx | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/client/my-sites/email/email-forwards-add/index.tsx b/client/my-sites/email/email-forwards-add/index.tsx index 8983761a70019..017061a4eea22 100644 --- a/client/my-sites/email/email-forwards-add/index.tsx +++ b/client/my-sites/email/email-forwards-add/index.tsx @@ -77,7 +77,9 @@ const EmailForwardsAdd = ( { selectedDomainName, source }: EmailForwardsAddProps const content = isGravatarDomain ? ( - { translate( 'This is a Gravatar domain and cannot have email services purchased for it.' ) } + { translate( + 'This domain is associated with a Gravatar profile and cannot be used for email services at this time.' + ) } ) : ( diff --git a/client/my-sites/email/email-management/home/utils.ts b/client/my-sites/email/email-management/home/utils.ts index 33894c8a3b5ba..d90dba8f56798 100644 --- a/client/my-sites/email/email-management/home/utils.ts +++ b/client/my-sites/email/email-management/home/utils.ts @@ -138,7 +138,7 @@ export function resolveEmailPlanStatus( statusClass: 'warning', icon: 'info', text: translate( 'Gravatar domain', { - comment: 'Current user is not allowed to manage email subscription', + comment: 'Current user is not allowed to purchase new email subscriptions', } ), }; diff --git a/client/my-sites/email/email-providers-comparison/stacked/index.tsx b/client/my-sites/email/email-providers-comparison/stacked/index.tsx index 924f8dedb069d..09a68d353f7e3 100644 --- a/client/my-sites/email/email-providers-comparison/stacked/index.tsx +++ b/client/my-sites/email/email-providers-comparison/stacked/index.tsx @@ -309,7 +309,7 @@ const EmailProvidersStackedComparison = ( { { isGravatarDomain && ( { translate( - 'This is a Gravatar domain and cannot have email services purchased for it.' + 'This domain is associated with a Gravatar profile and cannot be used for email services at this time.' ) } ) } From 6884faf958ee1844ed81796c3ad8f4b309d412d3 Mon Sep 17 00:00:00 2001 From: Leonardo Sameshima Taba Date: Wed, 13 Nov 2024 16:10:49 -0300 Subject: [PATCH 6/6] Replace Gravatar error code string by constant --- client/my-sites/email/email-forwards-add/index.tsx | 3 ++- .../email/email-providers-comparison/stacked/index.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/my-sites/email/email-forwards-add/index.tsx b/client/my-sites/email/email-forwards-add/index.tsx index 017061a4eea22..518358e6531f0 100644 --- a/client/my-sites/email/email-forwards-add/index.tsx +++ b/client/my-sites/email/email-forwards-add/index.tsx @@ -10,6 +10,7 @@ import Main from 'calypso/components/main'; import Notice from 'calypso/components/notice'; import SectionHeader from 'calypso/components/section-header'; import { getCurrentUserCannotAddEmailReason, getSelectedDomain } from 'calypso/lib/domains'; +import { EMAIL_WARNING_CODE_GRAVATAR_DOMAIN } from 'calypso/lib/emails/email-provider-constants'; import EmailForwardingAddNewCompactList from 'calypso/my-sites/email/email-forwarding/email-forwarding-add-new-compact-list'; import EmailHeader from 'calypso/my-sites/email/email-header'; import { @@ -52,7 +53,7 @@ const EmailForwardsAdd = ( { selectedDomainName, source }: EmailForwardsAddProps const domains = useSelector( ( state ) => getDomainsBySiteId( state, selectedSite?.ID ) ); const selectedDomain = getSelectedDomain( { domains, selectedDomainName } ); const cannotAddEmailWarningReason = getCurrentUserCannotAddEmailReason( selectedDomain ); - const isGravatarDomain = cannotAddEmailWarningReason?.code === 'domain-gravatar-domain'; + const isGravatarDomain = cannotAddEmailWarningReason?.code === EMAIL_WARNING_CODE_GRAVATAR_DOMAIN; const goToEmail = useCallback( (): void => { if ( ! selectedSite ) { diff --git a/client/my-sites/email/email-providers-comparison/stacked/index.tsx b/client/my-sites/email/email-providers-comparison/stacked/index.tsx index 09a68d353f7e3..f1beb57ac56a4 100644 --- a/client/my-sites/email/email-providers-comparison/stacked/index.tsx +++ b/client/my-sites/email/email-providers-comparison/stacked/index.tsx @@ -24,6 +24,7 @@ import { hasEmailForwards, getDomainsWithEmailForwards, } from 'calypso/lib/domains/email-forwarding'; +import { EMAIL_WARNING_CODE_GRAVATAR_DOMAIN } from 'calypso/lib/emails/email-provider-constants'; import { hasGSuiteSupportedDomain } from 'calypso/lib/gsuite'; import { GOOGLE_WORKSPACE_PRODUCT_TYPE } from 'calypso/lib/gsuite/constants'; import { domainAddNew } from 'calypso/my-sites/domains/paths'; @@ -99,7 +100,7 @@ const EmailProvidersStackedComparison = ( { const currentUserCanAddEmail = canCurrentUserAddEmail( domain ); const showNonOwnerMessage = ! currentUserCanAddEmail && ! isDomainInCart; const cannotAddEmailWarningReason = getCurrentUserCannotAddEmailReason( domain ); - const isGravatarDomain = cannotAddEmailWarningReason?.code === 'domain-gravatar-domain'; + const isGravatarDomain = cannotAddEmailWarningReason?.code === EMAIL_WARNING_CODE_GRAVATAR_DOMAIN; const isGSuiteSupported = domain && canPurchaseGSuite && ( isDomainInCart || hasGSuiteSupportedDomain( [ domain ] ) );