From c35ce096e1edc611d9b49857bbfd7ac789c9e67b Mon Sep 17 00:00:00 2001 From: Aneesh Devasthale Date: Fri, 31 May 2024 11:20:29 +0530 Subject: [PATCH] Checkout: rename live chat strings (#91239) * Checkout: rename live chat strings * switch to hasEnTranslation * alter string --- .../components/wp-checkout-order-summary.tsx | 42 ++++++++++++++----- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/client/my-sites/checkout/src/components/wp-checkout-order-summary.tsx b/client/my-sites/checkout/src/components/wp-checkout-order-summary.tsx index a2489b622abce..73c6e562e8831 100644 --- a/client/my-sites/checkout/src/components/wp-checkout-order-summary.tsx +++ b/client/my-sites/checkout/src/components/wp-checkout-order-summary.tsx @@ -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, @@ -524,7 +525,7 @@ export function CheckoutSummaryFeaturesList( props: { ) } { ( ! hasPlanInCart || hasDomainTransferProduct ) && ( - @@ -739,11 +740,12 @@ 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 @@ -751,7 +753,7 @@ function CheckoutSummaryChatIfAvailable( props: { const currentPlanSlug = currentPlan?.productSlug; - const isChatAvailable = + const isSupportAvailable = props.hasDomainTransferInCart || ( currentPlanSlug && ( isWpComPremiumPlan( currentPlanSlug ) || @@ -759,10 +761,20 @@ function CheckoutSummaryChatIfAvailable( props: { isWpComEcommercePlan( currentPlanSlug ) ) && ! isMonthly( currentPlanSlug ) ); - if ( ! isChatAvailable ) { + if ( ! isSupportAvailable ) { return null; } + if ( hasEnTranslation( 'Fast support' ) && hasEnTranslation( 'Priority support 24/7' ) ) { + return ( + + + { isWpComPremiumPlan( currentPlanSlug ) + ? translate( 'Fast support' ) + : translate( 'Priority support 24/7' ) } + + ); + } return ( @@ -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 ) ) { @@ -808,12 +821,21 @@ function CheckoutSummaryAnnualUpsell( props: { { translate( 'Free domain for one year' ) } ) } - { ! isWpComPersonalPlan( productSlug ) && ( - - - { translate( 'Live chat support' ) } - - ) } + { hasEnTranslation( 'Fast support' ) && hasEnTranslation( 'Priority support 24/7' ) + ? ! isWpComPersonalPlan( productSlug ) && ( + + + { isWpComPremiumPlan( productSlug ) + ? translate( 'Fast support' ) + : translate( 'Priority support 24/7' ) } + + ) + : ! isWpComPersonalPlan( productSlug ) && ( + + + { translate( 'Live chat support' ) } + + ) }