mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: specific actions for enterprise trial messages (#4001)
Co-authored-by: Nuno Góis <github@nunogois.com>
This commit is contained in:
		
							parent
							
								
									b97c6bdc7b
								
							
						
					
					
						commit
						02600880d1
					
				@ -5,7 +5,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
 | 
				
			|||||||
import { Dialogue } from 'component/common/Dialogue/Dialogue';
 | 
					import { Dialogue } from 'component/common/Dialogue/Dialogue';
 | 
				
			||||||
import { Typography } from '@mui/material';
 | 
					import { Typography } from '@mui/material';
 | 
				
			||||||
import { useNavigate } from 'react-router-dom';
 | 
					import { useNavigate } from 'react-router-dom';
 | 
				
			||||||
import { IInstanceStatus } from 'interfaces/instance';
 | 
					import { IInstanceStatus, InstancePlan } from 'interfaces/instance';
 | 
				
			||||||
import { ADMIN } from 'component/providers/AccessProvider/permissions';
 | 
					import { ADMIN } from 'component/providers/AccessProvider/permissions';
 | 
				
			||||||
import AccessContext from 'contexts/AccessContext';
 | 
					import AccessContext from 'contexts/AccessContext';
 | 
				
			||||||
import useInstanceStatusApi from 'hooks/api/actions/useInstanceStatusApi/useInstanceStatusApi';
 | 
					import useInstanceStatusApi from 'hooks/api/actions/useInstanceStatusApi/useInstanceStatusApi';
 | 
				
			||||||
@ -44,6 +44,24 @@ const TrialDialog: VFC<ITrialDialogProps> = ({
 | 
				
			|||||||
        return () => clearInterval(interval);
 | 
					        return () => clearInterval(interval);
 | 
				
			||||||
    }, [expired]);
 | 
					    }, [expired]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (instanceStatus.plan === InstancePlan.ENTERPRISE) {
 | 
				
			||||||
 | 
					        return (
 | 
				
			||||||
 | 
					            <Dialogue
 | 
				
			||||||
 | 
					                open={dialogOpen}
 | 
				
			||||||
 | 
					                secondaryButtonText="Remind me later"
 | 
				
			||||||
 | 
					                onClose={() => {
 | 
				
			||||||
 | 
					                    setDialogOpen(false);
 | 
				
			||||||
 | 
					                }}
 | 
				
			||||||
 | 
					                title={`Your free ${instanceStatus.plan} trial has expired!`}
 | 
				
			||||||
 | 
					            >
 | 
				
			||||||
 | 
					                <Typography>
 | 
				
			||||||
 | 
					                    Please contact your Unleash sales representative to avoid{' '}
 | 
				
			||||||
 | 
					                    <strong>deletion of your Unleash account.</strong>
 | 
				
			||||||
 | 
					                </Typography>
 | 
				
			||||||
 | 
					            </Dialogue>
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (hasAccess(ADMIN)) {
 | 
					    if (hasAccess(ADMIN)) {
 | 
				
			||||||
        return (
 | 
					        return (
 | 
				
			||||||
            <Dialogue
 | 
					            <Dialogue
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
import { styled, Button, Typography } from '@mui/material';
 | 
					import { styled, Button, Typography } from '@mui/material';
 | 
				
			||||||
import { IInstanceStatus } from 'interfaces/instance';
 | 
					import { IInstanceStatus, InstancePlan } from 'interfaces/instance';
 | 
				
			||||||
import { INSTANCE_STATUS_BAR_ID } from 'utils/testIds';
 | 
					import { INSTANCE_STATUS_BAR_ID } from 'utils/testIds';
 | 
				
			||||||
import { InfoOutlined, WarningAmber } from '@mui/icons-material';
 | 
					import { InfoOutlined, WarningAmber } from '@mui/icons-material';
 | 
				
			||||||
import { useNavigate } from 'react-router-dom';
 | 
					import { useNavigate } from 'react-router-dom';
 | 
				
			||||||
@ -86,7 +86,7 @@ const StatusBarExpired = ({ instanceStatus }: IInstanceStatusBarProps) => {
 | 
				
			|||||||
                has expired. <strong>Upgrade trial</strong> otherwise your{' '}
 | 
					                has expired. <strong>Upgrade trial</strong> otherwise your{' '}
 | 
				
			||||||
                <strong>account will be deleted.</strong>
 | 
					                <strong>account will be deleted.</strong>
 | 
				
			||||||
            </Typography>
 | 
					            </Typography>
 | 
				
			||||||
            <BillingLink />
 | 
					            <BillingLink instanceStatus={instanceStatus} />
 | 
				
			||||||
        </StyledWarningBar>
 | 
					        </StyledWarningBar>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -105,7 +105,7 @@ const StatusBarExpiresSoon = ({ instanceStatus }: IInstanceStatusBarProps) => {
 | 
				
			|||||||
                <strong>{timeRemaining}</strong> left of your free{' '}
 | 
					                <strong>{timeRemaining}</strong> left of your free{' '}
 | 
				
			||||||
                {instanceStatus.plan} trial.
 | 
					                {instanceStatus.plan} trial.
 | 
				
			||||||
            </Typography>
 | 
					            </Typography>
 | 
				
			||||||
            <BillingLink />
 | 
					            <BillingLink instanceStatus={instanceStatus} />
 | 
				
			||||||
        </StyledInfoBar>
 | 
					        </StyledInfoBar>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -118,12 +118,12 @@ const StatusBarExpiresLater = ({ instanceStatus }: IInstanceStatusBarProps) => {
 | 
				
			|||||||
                <strong>Heads up!</strong> You're currently on a free{' '}
 | 
					                <strong>Heads up!</strong> You're currently on a free{' '}
 | 
				
			||||||
                {instanceStatus.plan} trial account.
 | 
					                {instanceStatus.plan} trial account.
 | 
				
			||||||
            </Typography>
 | 
					            </Typography>
 | 
				
			||||||
            <BillingLink />
 | 
					            <BillingLink instanceStatus={instanceStatus} />
 | 
				
			||||||
        </StyledInfoBar>
 | 
					        </StyledInfoBar>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const BillingLink = () => {
 | 
					const BillingLink = ({ instanceStatus }: IInstanceStatusBarProps) => {
 | 
				
			||||||
    const { hasAccess } = useContext(AccessContext);
 | 
					    const { hasAccess } = useContext(AccessContext);
 | 
				
			||||||
    const navigate = useNavigate();
 | 
					    const navigate = useNavigate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -131,6 +131,10 @@ const BillingLink = () => {
 | 
				
			|||||||
        return null;
 | 
					        return null;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (instanceStatus.plan === InstancePlan.ENTERPRISE) {
 | 
				
			||||||
 | 
					        return null;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <StyledButton
 | 
					        <StyledButton
 | 
				
			||||||
            onClick={() => navigate('/admin/billing')}
 | 
					            onClick={() => navigate('/admin/billing')}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user