Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: removed popup setup

=46b26843d2e7
diff --git a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx
index e6c978ab9e..87857f0c9c 100644
--- a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx
@@ -95,6 +95,8 @@ export const BillingV2Page = () => {
const [flow, setFlow] = useState<BillingV2Flow | null>(null);
const [removeProdId, setRemoveProdId] = useState<string | null>(null);
+ const [trialApproval, setTrialApproval] = useState<{ orgId: string; url: string } | null>(null);
+ const trialApprovalUrl = trialApproval?.orgId === selectedOrgId ? trialApproval.url : null;
// Stripe redirects back with ?checkout=success|canceled; surface the outcome and refresh state.
useEffect(() => {
@@ -186,16 +188,16 @@ export const BillingV2Page = () => {
};
const onCompleteTrialPayment = () => {
+ const orgIdAtRequest = selectedOrgId;
confirmTrialPayment.mutate(
{
- orgId: selectedOrgId,
+ orgId: orgIdAtRequest,
returnPath: window.location.pathname
},
{
onSuccess: ({ outcome, redirectUrl }) => {
- // A Stripe hosted invoice never redirects back, so it opens beside the app.
if (outcome === "payment_action_required") {
- window.open(redirectUrl, "_blank", "noopener,noreferrer");
+ setTrialApproval({ orgId: orgIdAtRequest, url: redirectUrl });
return;
}
window.location.href = redirectUrl;
@@ -267,6 +269,7 @@ export const BillingV2Page = () => {
onContact={onContact}
onCompleteTrialPayment={onCompleteTrialPayment}
isCompletingTrialPayment={confirmTrialPayment.isPending}
+ trialApprovalUrl={trialApprovalUrl}
onRetry={onRetry}
canManageBilling={canManageBilling}
/>
diff --git a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx
index 74754c129e..d3e621bbe7 100644
--- a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx
@@ -38,6 +38,7 @@ export type OverviewProps = {
onContact: (prod: BillingV2CatalogProduct) => void;
onCompleteTrialPayment: () => void;
isCompletingTrialPayment: boolean;
+ trialApprovalUrl: string | null;
onRetry: () => void;
canManageBilling: boolean;
};
@@ -64,6 +65,7 @@ export const Overview = ({
onContact,
onCompleteTrialPayment,
isCompletingTrialPayment,
+ trialApprovalUrl,
onRetry,
canManageBilling
}: OverviewProps) => {
@@ -205,6 +207,7 @@ export const Overview = ({
onContact={onContact}
onCompleteTrialPayment={onCompleteTrialPayment}
isCompletingTrialPayment={isCompletingTrialPayment}
+ trialApprovalUrl={trialApprovalUrl}
/>
<ProductsCard
key="products"
@@ -243,6 +246,7 @@ export const Overview = ({
onContact={onContact}
onCompleteTrialPayment={onCompleteTrialPayment}
isCompletingTrialPayment={isCompletingTrialPayment}
+ trialApprovalUrl={trialApprovalUrl}
/>
<BillingHeaderCard overview={overview} catalog={catalog} />
<ProductsCard
diff --git a/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx b/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx
index 3ac86f129d..80a3666a8c 100644
--- a/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx
@@ -1,4 +1,4 @@
-import { CircleAlert, CreditCard } from "lucide-react";
+import { CircleAlert, CreditCard, ExternalLink } from "lucide-react";
import { Alert, AlertDescription, AlertTitle, Button } from "@app/components/v3";
import { BillingV2CatalogProduct, BillingV2Overview, BillingV2Trial } from "@app/hooks/api";
@@ -59,6 +59,7 @@ type Props = {
onContact: (prod: BillingV2CatalogProduct) => void;
onCompleteTrialPayment: () => void;
isCompletingTrialPayment: boolean;
+ trialApprovalUrl: string | null;
};
// A running upgrade trial is rendered on the product's own card, not here. This is only the
@@ -71,7 +72,8 @@ export const TrialBanners = ({
onUpdatePayment,
onContact,
onCompleteTrialPayment,
- isCompletingTrialPayment
+ isCompletingTrialPayment,
+ trialApprovalUrl
}: Props) => {
const canAct = overview.selfServe && !readOnly;
// The trial history is a permanent log, so an unpaid end is stale news once the org has moved on:
@@ -102,14 +104,25 @@ export const TrialBanners = ({
{overview.trialPaymentDue.dueAt}.
{canAct && (
<div className="mt-3 flex flex-wrap gap-2">
- <Button
- variant="warning"
- size="xs"
- isPending={isCompletingTrialPayment}
- onClick={onCompleteTrialPayment}
- >
- Complete Payment
- </Button>
+ {trialApprovalUrl ? (
+ <Button
+ variant="warning"
+ size="xs"
+ onClick={() => window.open(trialApprovalUrl, "_blank", "noopener,noreferrer")}
+ >
+ <ExternalLink />
+ Approve Payment
+ </Button>
+ ) : (
+ <Button
+ variant="warning"
+ size="xs"
+ isPending={isCompletingTrialPayment}
+ onClick={onCompleteTrialPayment}
+ >
+ Complete Payment
+ </Button>
+ )}
</div>
)}
</AlertDescription>