Skip to content

Commit

Permalink
Checkout: rename live chat strings (#91239)
Browse files Browse the repository at this point in the history
* Checkout: rename live chat strings

* switch to hasEnTranslation

* alter string
  • Loading branch information
aneeshd16 authored May 31, 2024
1 parent 5cc52b0 commit c35ce09
Showing 1 changed file with 32 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import { Gridicon } from '@automattic/components';
import { FormStatus, useFormStatus } from '@automattic/composite-checkout';
import { formatCurrency } from '@automattic/format-currency';
import { useHasEnTranslation } from '@automattic/i18n-utils';
import {
isNewsletterOrLinkInBioFlow,
isAnyHostingFlow,
Expand Down Expand Up @@ -524,7 +525,7 @@ export function CheckoutSummaryFeaturesList( props: {
) }

{ ( ! hasPlanInCart || hasDomainTransferProduct ) && (
<CheckoutSummaryChatIfAvailable
<CheckoutSummarySupportIfAvailable
siteId={ siteId }
hasDomainTransferInCart={ hasDomainTransferProduct }
/>
Expand Down Expand Up @@ -739,30 +740,41 @@ function CheckoutSummaryPlanFeatures( props: {
);
}

function CheckoutSummaryChatIfAvailable( props: {
function CheckoutSummarySupportIfAvailable( props: {
siteId: number | undefined;
hasDomainTransferInCart: boolean;
} ) {
const translate = useTranslate();
const hasEnTranslation = useHasEnTranslation();

const currentPlan = useSelector( ( state ) =>
props.siteId ? getCurrentPlan( state, props.siteId ) : undefined
);

const currentPlanSlug = currentPlan?.productSlug;

const isChatAvailable =
const isSupportAvailable =
props.hasDomainTransferInCart ||
( currentPlanSlug &&
( isWpComPremiumPlan( currentPlanSlug ) ||
isWpComBusinessPlan( currentPlanSlug ) ||
isWpComEcommercePlan( currentPlanSlug ) ) &&
! isMonthly( currentPlanSlug ) );

if ( ! isChatAvailable ) {
if ( ! isSupportAvailable ) {
return null;
}

if ( hasEnTranslation( 'Fast support' ) && hasEnTranslation( 'Priority support 24/7' ) ) {
return (
<CheckoutSummaryFeaturesListItem>
<WPCheckoutCheckIcon id="annual-live-chat" />
{ isWpComPremiumPlan( currentPlanSlug )
? translate( 'Fast support' )
: translate( 'Priority support 24/7' ) }
</CheckoutSummaryFeaturesListItem>
);
}
return (
<CheckoutSummaryFeaturesListItem>
<WPCheckoutCheckIcon id="annual-live-chat" />
Expand All @@ -781,6 +793,7 @@ function CheckoutSummaryAnnualUpsell( props: {
) => void;
} ) {
const translate = useTranslate();
const hasEnTranslation = useHasEnTranslation();
const productSlug = props.plan?.product_slug;
const shouldUseCheckoutV2 = hasCheckoutVersion( '2' );
if ( ! productSlug || ! isWpComPlan( productSlug ) ) {
Expand Down Expand Up @@ -808,12 +821,21 @@ function CheckoutSummaryAnnualUpsell( props: {
{ translate( 'Free domain for one year' ) }
</CheckoutSummaryFeaturesListItem>
) }
{ ! isWpComPersonalPlan( productSlug ) && (
<CheckoutSummaryFeaturesListItem isSupported={ false }>
<WPCheckoutCheckIcon id="annual-live-chat" />
{ translate( 'Live chat support' ) }
</CheckoutSummaryFeaturesListItem>
) }
{ hasEnTranslation( 'Fast support' ) && hasEnTranslation( 'Priority support 24/7' )
? ! isWpComPersonalPlan( productSlug ) && (
<CheckoutSummaryFeaturesListItem isSupported={ false }>
<WPCheckoutCheckIcon id="annual-live-chat" />
{ isWpComPremiumPlan( productSlug )
? translate( 'Fast support' )
: translate( 'Priority support 24/7' ) }
</CheckoutSummaryFeaturesListItem>
)
: ! isWpComPersonalPlan( productSlug ) && (
<CheckoutSummaryFeaturesListItem isSupported={ false }>
<WPCheckoutCheckIcon id="annual-live-chat" />
{ translate( 'Live chat support' ) }
</CheckoutSummaryFeaturesListItem>
) }
</CheckoutSummaryFeaturesListWrapper>
<SwitchToAnnualPlan plan={ props.plan } onChangeSelection={ props.onChangeSelection } />
</CheckoutSummaryFeaturesUpsell>
Expand Down

0 comments on commit c35ce09

Please sign in to comment.