1+ import { isEnabled } from '@automattic/calypso-config' ;
12import { Card , FoldableCard } from '@automattic/components' ;
23import { Button } from '@wordpress/components' ;
34import { Icon , arrowRight } from '@wordpress/icons' ;
45import { clsx } from 'clsx' ;
56import { useTranslate } from 'i18n-calypso' ;
67import { A4A_AGENCY_TIER_LINK } from 'calypso/a8c-for-agencies/components/sidebar-menu/lib/constants' ;
78import getAgencyTierInfo from 'calypso/a8c-for-agencies/sections/agency-tier/lib/get-agency-tier-info' ;
9+ import AgencyTierProgressCard from 'calypso/a8c-for-agencies/sections/agency-tier/progress-card' ;
810import { preventWidows } from 'calypso/lib/formatting' ;
911import { useSelector , useDispatch } from 'calypso/state' ;
1012import { getActiveAgency } from 'calypso/state/a8c-for-agencies/agency/selectors' ;
@@ -19,61 +21,73 @@ export default function OverviewSidebarAgencyTier() {
1921
2022 const agency = useSelector ( getActiveAgency ) ;
2123
22- const currentAgencyTier = agency ?. tier ?. id ;
23- const currentAgencyTierInfo = getAgencyTierInfo ( currentAgencyTier , translate ) ;
24+ const currentAgencyTierId = agency ?. tier ?. id ;
25+ const influencedRevenue = agency ?. influenced_revenue ;
26+ const isEarlyAccess = agency ?. tier ?. is_early_access ;
27+ const currentAgencyTierInfo = getAgencyTierInfo ( currentAgencyTierId , translate ) ;
2428
2529 if ( ! currentAgencyTierInfo ) {
2630 return null ;
2731 }
2832
33+ const isTiersRevampEnabled = isEnabled ( 'tiers-revamp' ) ;
34+
2935 return (
3036 < >
3137 < AgencyTierCelebrationModal
3238 agencyTierInfo = { currentAgencyTierInfo }
33- currentAgencyTier = { currentAgencyTier }
39+ currentAgencyTier = { currentAgencyTierId }
3440 />
35- < Card className = "agency-tier__card" >
36- < FoldableCard
37- className = "foldable-nav"
38- header = { translate ( 'Your progress' ) }
39- expanded
40- compact
41- iconSize = { 18 }
42- >
43- < div className = "agency-tier__bottom-content" >
44- < div
45- className = { clsx ( 'agency-tier__current-agency-tier-header' , {
46- 'is-default' : ! currentAgencyTier ,
47- } ) }
48- >
49- < span className = "agency-tier__current-agency-tier-icon" >
50- < img src = { currentAgencyTierInfo . logo } alt = { currentAgencyTierInfo . id } />
51- </ span >
52- < span className = "agency-tier__current-agency-tier-title" >
53- { preventWidows ( currentAgencyTierInfo . title ) }
54- </ span >
55- </ div >
56- { currentAgencyTierInfo && (
57- < div className = "agency-tier__current-agency-tier-description" >
58- { currentAgencyTierInfo . description }
41+ { isTiersRevampEnabled ? (
42+ < AgencyTierProgressCard
43+ currentAgencyTierId = { currentAgencyTierId }
44+ influencedRevenue = { influencedRevenue ?? 0 }
45+ isEarlyAccess = { isEarlyAccess }
46+ />
47+ ) : (
48+ < Card className = "agency-tier__card" >
49+ < FoldableCard
50+ className = "foldable-nav"
51+ header = { translate ( 'Your progress' ) }
52+ expanded
53+ compact
54+ iconSize = { 18 }
55+ >
56+ < div className = "agency-tier__bottom-content" >
57+ < div
58+ className = { clsx ( 'agency-tier__current-agency-tier-header' , {
59+ 'is-default' : ! currentAgencyTierId ,
60+ } ) }
61+ >
62+ < span className = "agency-tier__current-agency-tier-icon" >
63+ < img src = { currentAgencyTierInfo . logo } alt = { currentAgencyTierInfo . id } />
64+ </ span >
65+ < span className = "agency-tier__current-agency-tier-title" >
66+ { preventWidows ( currentAgencyTierInfo . title ) }
67+ </ span >
5968 </ div >
60- ) }
61- < Button
62- href = { A4A_AGENCY_TIER_LINK }
63- onClick = { ( ) =>
64- dispatch (
65- recordTracksEvent ( 'calypso_a4a_agency_tier_explore_tiers_and_benefits_click' , {
66- agency_tier : currentAgencyTier ,
67- } )
68- )
69- }
70- >
71- < Icon icon = { arrowRight } size = { 18 } />
72- { translate ( 'Explore Tiers and benefits' ) }
73- </ Button >
74- </ div >
75- </ FoldableCard >
76- </ Card >
69+ { currentAgencyTierInfo && (
70+ < div className = "agency-tier__current-agency-tier-description" >
71+ { currentAgencyTierInfo . description }
72+ </ div >
73+ ) }
74+ < Button
75+ href = { A4A_AGENCY_TIER_LINK }
76+ onClick = { ( ) =>
77+ dispatch (
78+ recordTracksEvent ( 'calypso_a4a_agency_tier_explore_tiers_and_benefits_click' , {
79+ agency_tier : currentAgencyTierId ,
80+ } )
81+ )
82+ }
83+ >
84+ < Icon icon = { arrowRight } size = { 18 } />
85+ { translate ( 'Explore Tiers and benefits' ) }
86+ </ Button >
87+ </ div >
88+ </ FoldableCard >
89+ </ Card >
90+ ) }
7791 </ >
7892 ) ;
7993}
0 commit comments