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

Update/mailbox link professional email without feature flags #64986

Prev Previous commit
Next Next commit
Initial code to update thank you page
  • Loading branch information
AllTerrainDeveloper committed Jun 27, 2022
commit 9e4d8c855e50276c2711023d1f25532684396c8b
9 changes: 9 additions & 0 deletions client/lib/titan/get-titan-urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ export function getTitanContactsUrl( titanAppsUrlPrefix, email ) {
return getTitanUrl( titanAppsUrlPrefix, email, TITAN_APPS.CONTACTS );
}

/**
* Gets the Web client URL for Professional Email
*
* @param { string } titanAppsUrlPrefix URL prefix to build the final URL based on the next parameters
* @param { string | undefined } email Email account is going to be used
* @param { boolean } clearPreviousSessions Flag to clear session in the Web Client
* @param { string } redirectUrl URL to go back from the Web Client
* @returns { string } Path to be used to send the user to the Web Client
*/
export function getTitanEmailUrl(
titanAppsUrlPrefix,
email,
Expand Down
16 changes: 13 additions & 3 deletions client/my-sites/email/titan-set-up-thank-you/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isEnabled } from '@automattic/calypso-config';
import { Gridicon } from '@automattic/components';
import classNames from 'classnames';
import { useTranslate } from 'i18n-calypso';
Expand Down Expand Up @@ -41,6 +42,12 @@ const TitanSetUpThankYou = ( {
const titanAppsUrlPrefix = useTitanAppsUrlPrefix();
const translate = useTranslate();

const isEmbeddedInboxTestingEnabled = isEnabled( 'emails/embedded-inbox-testing' );

const mailboxPrefixUrl = isEmbeddedInboxTestingEnabled
? 'https://webmail-alpha.riva.co'
: titanAppsUrlPrefix;

const emailManagementPath = emailManagement( selectedSiteSlug, domainName, currentRoute );

const thankYouImage = {
Expand All @@ -67,9 +74,13 @@ const TitanSetUpThankYou = ( {
stepDescription: translate( 'Access your email from anywhere with our webmail.' ),
stepCta: (
<FullWidthButton
href={ getTitanEmailUrl( titanAppsUrlPrefix, emailAddress, true ) }
href={ getTitanEmailUrl(
mailboxPrefixUrl,
emailAddress,
true,
`${ window.location.protocol }//${ window.location.host }/${ emailManagementPath }`
) }
primary
target="_blank"
onClick={ () => {
recordEmailAppLaunchEvent( {
provider: 'titan',
Expand All @@ -79,7 +90,6 @@ const TitanSetUpThankYou = ( {
} }
>
{ translate( 'Go to Inbox' ) }
<Gridicon className="titan-set-up-thank-you__icon-external" icon="external" />
</FullWidthButton>
),
},
Expand Down