mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 11:29:42 +00:00
Add card declined alert
This commit is contained in:
@@ -53,4 +53,5 @@ export type SubscriptionPlan = {
|
|||||||
secretScanning: boolean;
|
secretScanning: boolean;
|
||||||
enterpriseSecretSyncs: boolean;
|
enterpriseSecretSyncs: boolean;
|
||||||
enterpriseAppConnections: boolean;
|
enterpriseAppConnections: boolean;
|
||||||
|
cardDeclined?: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {
|
|||||||
faCaretDown,
|
faCaretDown,
|
||||||
faCheck,
|
faCheck,
|
||||||
faEnvelope,
|
faEnvelope,
|
||||||
|
faExclamationTriangle,
|
||||||
faInfo,
|
faInfo,
|
||||||
faInfoCircle,
|
faInfoCircle,
|
||||||
faSignOut,
|
faSignOut,
|
||||||
@@ -109,6 +110,9 @@ export const Navbar = () => {
|
|||||||
const { subscription } = useSubscription();
|
const { subscription } = useSubscription();
|
||||||
const { currentOrg } = useOrganization();
|
const { currentOrg } = useOrganization();
|
||||||
const [showAdminsModal, setShowAdminsModal] = useState(false);
|
const [showAdminsModal, setShowAdminsModal] = useState(false);
|
||||||
|
const [showCardDeclinedModal, setShowCardDeclinedModal] = useState(
|
||||||
|
subscription?.cardDeclined || false
|
||||||
|
);
|
||||||
|
|
||||||
const { data: orgs } = useGetOrganizations();
|
const { data: orgs } = useGetOrganizations();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -195,8 +199,23 @@ export const Navbar = () => {
|
|||||||
<FontAwesomeIcon icon={faBuilding} className="text-xs text-bunker-300" />
|
<FontAwesomeIcon icon={faBuilding} className="text-xs text-bunker-300" />
|
||||||
</div>
|
</div>
|
||||||
<div className="whitespace-nowrap">{currentOrg?.name}</div>
|
<div className="whitespace-nowrap">{currentOrg?.name}</div>
|
||||||
<div className="mr-1 rounded border border-mineshaft-500 px-1 text-xs text-bunker-300 !no-underline">
|
<div className="flex items-center gap-1">
|
||||||
{getPlan(subscription)}
|
<div className="mr-1 rounded border border-mineshaft-500 px-1 text-xs text-bunker-300 !no-underline">
|
||||||
|
{getPlan(subscription)}
|
||||||
|
</div>
|
||||||
|
{subscription.cardDeclined && (
|
||||||
|
<Tooltip
|
||||||
|
content="Payment failed. Please update your payment method to continue using premium features."
|
||||||
|
className="max-w-xs"
|
||||||
|
>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={faExclamationTriangle}
|
||||||
|
className="animate-pulse cursor-help text-xs text-primary-400"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -394,6 +413,48 @@ export const Navbar = () => {
|
|||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
<Modal isOpen={showCardDeclinedModal} onOpenChange={setShowCardDeclinedModal}>
|
||||||
|
<ModalContent
|
||||||
|
title={
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<FontAwesomeIcon icon={faExclamationTriangle} className="text-lg text-primary-400" />
|
||||||
|
Your payment method has been declined
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<div className="mb-1">
|
||||||
|
<p>
|
||||||
|
Your payment method was declined and your subscription may be at risk. Please
|
||||||
|
update your payment information to continue using premium features.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className="mt-4">
|
||||||
|
<div className="flex space-x-3">
|
||||||
|
<Link to="/organization/billing" className="inline-flex">
|
||||||
|
<Button
|
||||||
|
colorSchema="primary"
|
||||||
|
variant="solid"
|
||||||
|
onClick={() => setShowCardDeclinedModal(false)}
|
||||||
|
>
|
||||||
|
Update Payment Method
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
colorSchema="secondary"
|
||||||
|
variant="outline"
|
||||||
|
className="ml-2"
|
||||||
|
onClick={() => setShowCardDeclinedModal(false)}
|
||||||
|
>
|
||||||
|
Dismiss
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ModalContent>
|
||||||
|
</Modal>
|
||||||
<Modal isOpen={showAdminsModal} onOpenChange={setShowAdminsModal}>
|
<Modal isOpen={showAdminsModal} onOpenChange={setShowAdminsModal}>
|
||||||
<ModalContent title="Server Administrators" subTitle="View all server administrators">
|
<ModalContent title="Server Administrators" subTitle="View all server administrators">
|
||||||
<div className="mb-2">
|
<div className="mb-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user