mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-03 17:26:07 +00:00
Merge pull request #4736 from Infisical/fix/update-paywall-to-mention-correct-plans
[ENG-3974] fix: update paywall to show correct plan: team -> pro/enterprise
This commit is contained in:
@@ -8,22 +8,40 @@ type Props = {
|
|||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
onOpenChange?: (isOpen: boolean) => void;
|
onOpenChange?: (isOpen: boolean) => void;
|
||||||
text: string;
|
text: string;
|
||||||
|
isEnterpriseFeature?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const UpgradePlanModal = ({ text, isOpen, onOpenChange }: Props): JSX.Element => {
|
export const UpgradePlanModal = ({
|
||||||
|
text,
|
||||||
|
isOpen,
|
||||||
|
onOpenChange,
|
||||||
|
isEnterpriseFeature = false
|
||||||
|
}: Props): JSX.Element => {
|
||||||
const { subscription } = useSubscription();
|
const { subscription } = useSubscription();
|
||||||
const { currentOrg } = useOrganization();
|
const { currentOrg } = useOrganization();
|
||||||
const { mutateAsync, isPending } = useGetOrgTrialUrl();
|
const { mutateAsync, isPending } = useGetOrgTrialUrl();
|
||||||
const link =
|
|
||||||
subscription && subscription.slug !== null
|
const getLink = () => {
|
||||||
? ("/organization/billing" as const)
|
// self-hosting
|
||||||
: "https://infisical.com/scheduledemo";
|
if (!subscription || subscription.slug === null) {
|
||||||
|
return "https://infisical.com/scheduledemo";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Infisical cloud
|
||||||
|
if (isEnterpriseFeature) {
|
||||||
|
return "https://infisical.com/talk-to-us";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "/organization/billing" as const;
|
||||||
|
};
|
||||||
|
|
||||||
|
const link = getLink();
|
||||||
|
|
||||||
const handleUpgradeBtnClick = async () => {
|
const handleUpgradeBtnClick = async () => {
|
||||||
try {
|
try {
|
||||||
if (!subscription || !currentOrg) return;
|
if (!subscription || !currentOrg) return;
|
||||||
|
|
||||||
if (!subscription.has_used_trial) {
|
if (!subscription.has_used_trial && !isEnterpriseFeature) {
|
||||||
// direct user to start pro trial
|
// direct user to start pro trial
|
||||||
|
|
||||||
const url = await mutateAsync({
|
const url = await mutateAsync({
|
||||||
@@ -40,6 +58,17 @@ export const UpgradePlanModal = ({ text, isOpen, onOpenChange }: Props): JSX.Ele
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const getUpgradePlanLabel = () => {
|
||||||
|
if (subscription) {
|
||||||
|
if (isEnterpriseFeature) {
|
||||||
|
return "Talk to Us";
|
||||||
|
}
|
||||||
|
if (!subscription.has_used_trial) {
|
||||||
|
return "Start Pro Free Trial";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "Upgrade Plan";
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
|
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
|
||||||
@@ -55,7 +84,7 @@ export const UpgradePlanModal = ({ text, isOpen, onOpenChange }: Props): JSX.Ele
|
|||||||
onClick={handleUpgradeBtnClick}
|
onClick={handleUpgradeBtnClick}
|
||||||
className="mr-4"
|
className="mr-4"
|
||||||
>
|
>
|
||||||
{subscription && !subscription.has_used_trial ? "Start Pro Free Trial" : "Upgrade Plan"}
|
{getUpgradePlanLabel()}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
colorSchema="secondary"
|
colorSchema="secondary"
|
||||||
|
|||||||
@@ -1172,7 +1172,9 @@ export const OverviewPage = () => {
|
|||||||
handlePopUpClose("misc");
|
handlePopUpClose("misc");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handlePopUpOpen("upgradePlan");
|
handlePopUpOpen("upgradePlan", {
|
||||||
|
isEnterpriseFeature: true
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
isDisabled={userAvailableDynamicSecretEnvs.length === 0}
|
isDisabled={userAvailableDynamicSecretEnvs.length === 0}
|
||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
@@ -1679,10 +1681,11 @@ export const OverviewPage = () => {
|
|||||||
<UpgradePlanModal
|
<UpgradePlanModal
|
||||||
isOpen={popUp.upgradePlan.isOpen}
|
isOpen={popUp.upgradePlan.isOpen}
|
||||||
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
||||||
|
isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
|
||||||
text={
|
text={
|
||||||
subscription.slug === null
|
subscription.slug === null
|
||||||
? "You can perform this action under an Enterprise license"
|
? "You can perform this action under an Enterprise license"
|
||||||
: "You can perform this action if you switch to Infisical's Team plan"
|
: "You can perform this action if you switch to Infisical's Enterprise plan"
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
+7
-2
@@ -1019,7 +1019,9 @@ export const ActionBar = ({
|
|||||||
handlePopUpClose("misc");
|
handlePopUpClose("misc");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handlePopUpOpen("upgradePlan");
|
handlePopUpOpen("upgradePlan", {
|
||||||
|
isEnterpriseFeature: true
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
isDisabled={!isAllowed}
|
isDisabled={!isAllowed}
|
||||||
variant="outline_bg"
|
variant="outline_bg"
|
||||||
@@ -1274,10 +1276,13 @@ export const ActionBar = ({
|
|||||||
<UpgradePlanModal
|
<UpgradePlanModal
|
||||||
isOpen={popUp.upgradePlan.isOpen}
|
isOpen={popUp.upgradePlan.isOpen}
|
||||||
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
||||||
|
isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
|
||||||
text={
|
text={
|
||||||
subscription.slug === null
|
subscription.slug === null
|
||||||
? "You can perform this action under an Enterprise license"
|
? "You can perform this action under an Enterprise license"
|
||||||
: "You can perform this action if you switch to Infisical's Team plan"
|
: `You can perform this action if you switch to Infisical's ${
|
||||||
|
popUp.upgradePlan.data.isEnterpriseFeature ? "Enterprise" : "Pro"
|
||||||
|
} plan`
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
+1
-1
@@ -226,7 +226,7 @@ export const EnvironmentTabs = ({ secretPath }: Props) => {
|
|||||||
<UpgradePlanModal
|
<UpgradePlanModal
|
||||||
isOpen={popUp.upgradePlan.isOpen}
|
isOpen={popUp.upgradePlan.isOpen}
|
||||||
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
||||||
text="You can add custom environments if you switch to Infisical's Team plan."
|
text="You can add custom environments if you switch to Infisical's Pro plan."
|
||||||
/>
|
/>
|
||||||
<AddEnvironmentModal
|
<AddEnvironmentModal
|
||||||
isOpen={popUp.createEnvironment.isOpen}
|
isOpen={popUp.createEnvironment.isOpen}
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ const Page = () => {
|
|||||||
<UpgradePlanModal
|
<UpgradePlanModal
|
||||||
isOpen={popUp.upgradePlan.isOpen}
|
isOpen={popUp.upgradePlan.isOpen}
|
||||||
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
||||||
text="You can add secret rotation if you switch to Infisical's Team plan."
|
text="You can add secret rotation if you switch to Infisical's Pro plan."
|
||||||
/>
|
/>
|
||||||
<Modal
|
<Modal
|
||||||
isOpen={popUp.secretRotationV2.isOpen}
|
isOpen={popUp.secretRotationV2.isOpen}
|
||||||
|
|||||||
+1
-1
@@ -123,7 +123,7 @@ export const EnvironmentSection = () => {
|
|||||||
<UpgradePlanModal
|
<UpgradePlanModal
|
||||||
isOpen={popUp.upgradePlan.isOpen}
|
isOpen={popUp.upgradePlan.isOpen}
|
||||||
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
|
||||||
text="You can add custom environments if you switch to Infisical's Team plan."
|
text="You can add custom environments if you switch to Infisical's Pro plan."
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user