mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 04:11:59 +08:00
fix: allow workspace blocked users to extend trial (#4393)
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
This commit is contained in:
parent
46559014f7
commit
c1b9049176
@ -125,8 +125,9 @@ export default function DataSource(): JSX.Element {
|
|||||||
)}
|
)}
|
||||||
key={dataSource.name}
|
key={dataSource.name}
|
||||||
onClick={(): void => {
|
onClick={(): void => {
|
||||||
updateSelectedFramework('');
|
updateSelectedFramework(null);
|
||||||
updateSelectedDataSource(dataSource);
|
updateSelectedDataSource(dataSource);
|
||||||
|
form.setFieldsValue({ selectFramework: null });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
@ -152,6 +153,7 @@ export default function DataSource(): JSX.Element {
|
|||||||
<Form
|
<Form
|
||||||
initialValues={{
|
initialValues={{
|
||||||
serviceName,
|
serviceName,
|
||||||
|
selectFramework: selectedFramework,
|
||||||
}}
|
}}
|
||||||
form={form}
|
form={form}
|
||||||
onValuesChange={(): void => {
|
onValuesChange={(): void => {
|
||||||
@ -165,7 +167,6 @@ export default function DataSource(): JSX.Element {
|
|||||||
validateTrigger="onBlur"
|
validateTrigger="onBlur"
|
||||||
>
|
>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
hasFeedback
|
|
||||||
name="serviceName"
|
name="serviceName"
|
||||||
label="Service Name"
|
label="Service Name"
|
||||||
rules={[{ required: true, message: 'Please enter service name' }]}
|
rules={[{ required: true, message: 'Please enter service name' }]}
|
||||||
@ -178,13 +179,11 @@ export default function DataSource(): JSX.Element {
|
|||||||
<div className="framework-selector">
|
<div className="framework-selector">
|
||||||
<Form.Item
|
<Form.Item
|
||||||
label="Select Framework"
|
label="Select Framework"
|
||||||
name="select-framework"
|
name="selectFramework"
|
||||||
hasFeedback
|
|
||||||
rules={[{ required: true, message: 'Please select framework' }]}
|
rules={[{ required: true, message: 'Please select framework' }]}
|
||||||
validateTrigger=""
|
|
||||||
>
|
>
|
||||||
<Select
|
<Select
|
||||||
defaultValue={selectedFramework}
|
value={selectedFramework}
|
||||||
getPopupContainer={popupContainer}
|
getPopupContainer={popupContainer}
|
||||||
style={{ minWidth: 120 }}
|
style={{ minWidth: 120 }}
|
||||||
placeholder="Select Framework"
|
placeholder="Select Framework"
|
||||||
|
@ -78,6 +78,7 @@ export default function ModuleStepsContainer({
|
|||||||
const [metaData, setMetaData] = useState<MetaDataProps[]>(defaultMetaData);
|
const [metaData, setMetaData] = useState<MetaDataProps[]>(defaultMetaData);
|
||||||
const lastStepIndex = selectedModuleSteps.length - 1;
|
const lastStepIndex = selectedModuleSteps.length - 1;
|
||||||
|
|
||||||
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
const isValidForm = (): boolean => {
|
const isValidForm = (): boolean => {
|
||||||
const { id: selectedModuleID } = selectedModule;
|
const { id: selectedModuleID } = selectedModule;
|
||||||
const dataSourceStep = stepsMap.dataSource;
|
const dataSourceStep = stepsMap.dataSource;
|
||||||
@ -106,7 +107,10 @@ export default function ModuleStepsContainer({
|
|||||||
dataSource: selectedDataSource,
|
dataSource: selectedDataSource,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (doesHaveFrameworks && selectedFramework === '') {
|
if (
|
||||||
|
doesHaveFrameworks &&
|
||||||
|
(selectedFramework === null || selectedFramework === '')
|
||||||
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +181,7 @@ export default function ModuleStepsContainer({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Framework',
|
name: 'Framework',
|
||||||
value: selectedFramework,
|
value: selectedFramework || '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Environment',
|
name: 'Environment',
|
||||||
|
@ -14,7 +14,7 @@ interface OnboardingContextData {
|
|||||||
ingestionData: any;
|
ingestionData: any;
|
||||||
serviceName: string;
|
serviceName: string;
|
||||||
selectedEnvironment: string;
|
selectedEnvironment: string;
|
||||||
selectedFramework: string;
|
selectedFramework: string | null;
|
||||||
selectedModule: ModuleProps | null;
|
selectedModule: ModuleProps | null;
|
||||||
selectedMethod: any;
|
selectedMethod: any;
|
||||||
selectedDataSource: DataSourceType | null;
|
selectedDataSource: DataSourceType | null;
|
||||||
@ -51,7 +51,9 @@ function OnboardingContextProvider({
|
|||||||
|
|
||||||
const [errorDetails, setErrorDetails] = useState(null);
|
const [errorDetails, setErrorDetails] = useState(null);
|
||||||
const [selectedEnvironment, setSelectedEnvironment] = useState<string>('');
|
const [selectedEnvironment, setSelectedEnvironment] = useState<string>('');
|
||||||
const [selectedFramework, setSelectedFramework] = useState<string>('');
|
const [selectedFramework, setSelectedFramework] = useState<string | null>(
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
|
||||||
const [selectedMethod, setSelectedMethod] = useState(
|
const [selectedMethod, setSelectedMethod] = useState(
|
||||||
OnboardingMethods.QUICK_START,
|
OnboardingMethods.QUICK_START,
|
||||||
|
@ -9,11 +9,19 @@
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.update-credit-card-btn {
|
|
||||||
margin: 24px 0;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.contact-us {
|
.contact-us {
|
||||||
margin-top: 48px;
|
margin-top: 48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cta {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.update-credit-card-btn,
|
||||||
|
.extend-trial-btn {
|
||||||
|
margin: 24px 0;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
/* eslint-disable react/no-unescaped-entities */
|
/* eslint-disable react/no-unescaped-entities */
|
||||||
import './WorkspaceLocked.styles.scss';
|
import './WorkspaceLocked.styles.scss';
|
||||||
|
|
||||||
import { CreditCardOutlined, LockOutlined } from '@ant-design/icons';
|
import {
|
||||||
|
CreditCardOutlined,
|
||||||
|
LockOutlined,
|
||||||
|
SendOutlined,
|
||||||
|
} from '@ant-design/icons';
|
||||||
import { Button, Card, Skeleton, Typography } from 'antd';
|
import { Button, Card, Skeleton, Typography } from 'antd';
|
||||||
import updateCreditCardApi from 'api/billing/checkout';
|
import updateCreditCardApi from 'api/billing/checkout';
|
||||||
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
import { SOMETHING_WENT_WRONG } from 'constants/api';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import FullViewHeader from 'container/FullViewHeader/FullViewHeader';
|
import FullViewHeader from 'container/FullViewHeader/FullViewHeader';
|
||||||
|
import useAnalytics from 'hooks/analytics/useAnalytics';
|
||||||
import useLicense from 'hooks/useLicense';
|
import useLicense from 'hooks/useLicense';
|
||||||
import { useNotifications } from 'hooks/useNotifications';
|
import { useNotifications } from 'hooks/useNotifications';
|
||||||
import history from 'lib/history';
|
import history from 'lib/history';
|
||||||
@ -22,6 +27,7 @@ export default function WorkspaceBlocked(): JSX.Element {
|
|||||||
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
|
const { role } = useSelector<AppState, AppReducer>((state) => state.app);
|
||||||
const isAdmin = role === 'ADMIN';
|
const isAdmin = role === 'ADMIN';
|
||||||
const [activeLicense, setActiveLicense] = useState<License | null>(null);
|
const [activeLicense, setActiveLicense] = useState<License | null>(null);
|
||||||
|
const { trackEvent } = useAnalytics();
|
||||||
|
|
||||||
const { notifications } = useNotifications();
|
const { notifications } = useNotifications();
|
||||||
|
|
||||||
@ -68,13 +74,36 @@ export default function WorkspaceBlocked(): JSX.Element {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleUpdateCreditCard = useCallback(async () => {
|
const handleUpdateCreditCard = useCallback(async () => {
|
||||||
|
trackEvent('Workspace Blocked: User Clicked Update Credit Card');
|
||||||
|
|
||||||
updateCreditCard({
|
updateCreditCard({
|
||||||
licenseKey: activeLicense?.key || '',
|
licenseKey: activeLicense?.key || '',
|
||||||
successURL: window.location.origin,
|
successURL: window.location.origin,
|
||||||
cancelURL: window.location.origin,
|
cancelURL: window.location.origin,
|
||||||
});
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [activeLicense?.key, updateCreditCard]);
|
}, [activeLicense?.key, updateCreditCard]);
|
||||||
|
|
||||||
|
const handleExtendTrial = (): void => {
|
||||||
|
trackEvent('Workspace Blocked: User Clicked Extend Trial');
|
||||||
|
|
||||||
|
const recipient = 'cloud-support@signoz.io';
|
||||||
|
const subject = 'Extend SigNoz Cloud Trial';
|
||||||
|
const body = `I'd like to request an extension for SigNoz Cloud for my account. Please find my account details below
|
||||||
|
|
||||||
|
SigNoz URL:
|
||||||
|
Admin Email:
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Create the mailto link
|
||||||
|
const mailtoLink = `mailto:${recipient}?subject=${encodeURIComponent(
|
||||||
|
subject,
|
||||||
|
)}&body=${encodeURIComponent(body)}`;
|
||||||
|
|
||||||
|
// Open the default email client
|
||||||
|
window.location.href = mailtoLink;
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FullViewHeader overrideRoute={ROUTES.WORKSPACE_LOCKED} />
|
<FullViewHeader overrideRoute={ROUTES.WORKSPACE_LOCKED} />
|
||||||
@ -95,18 +124,31 @@ export default function WorkspaceBlocked(): JSX.Element {
|
|||||||
account.
|
account.
|
||||||
{!isAdmin && 'Please contact your administrator for further help'}
|
{!isAdmin && 'Please contact your administrator for further help'}
|
||||||
</Typography.Paragraph>
|
</Typography.Paragraph>
|
||||||
{isAdmin && (
|
|
||||||
|
<div className="cta">
|
||||||
|
{isAdmin && (
|
||||||
|
<Button
|
||||||
|
className="update-credit-card-btn"
|
||||||
|
type="primary"
|
||||||
|
icon={<CreditCardOutlined />}
|
||||||
|
size="middle"
|
||||||
|
loading={isLoading}
|
||||||
|
onClick={handleUpdateCreditCard}
|
||||||
|
>
|
||||||
|
Update Credit Card
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
className="update-credit-card-btn"
|
className="extend-trial-btn"
|
||||||
type="primary"
|
type="default"
|
||||||
icon={<CreditCardOutlined />}
|
icon={<SendOutlined />}
|
||||||
size="middle"
|
size="middle"
|
||||||
loading={isLoading}
|
onClick={handleExtendTrial}
|
||||||
onClick={handleUpdateCreditCard}
|
|
||||||
>
|
>
|
||||||
Update Credit Card
|
Extend Trial
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
</div>
|
||||||
<div className="contact-us">
|
<div className="contact-us">
|
||||||
Got Questions?
|
Got Questions?
|
||||||
<span>
|
<span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user