Skip to content

Commit

Permalink
Add button to show intercom on billing modal (#4581)
Browse files Browse the repository at this point in the history
  • Loading branch information
MauAraujo authored Apr 25, 2024
1 parent e0790e5 commit 05d1851
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions dashboard/src/main/home/modals/BillingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Modal from "components/porter/Modal";
import Spacer from "components/porter/Spacer";
import Text from "components/porter/Text";
import { usePublishableKey } from "lib/hooks/useStripe";
import { useIntercom } from "lib/hooks/useIntercom";

import { Context } from "shared/Context";

Expand All @@ -24,10 +25,11 @@ const BillingModal = ({
const { currentProject } = useContext(Context);
const { publishableKey } = usePublishableKey();

const { showIntercomWithMessage } = useIntercom();

let stripePromise;
if (publishableKey) {
stripePromise = loadStripe(publishableKey);

}

const appearance = {
Expand Down Expand Up @@ -75,10 +77,20 @@ const BillingModal = ({
) : (
<Text color="helper">
{trialExpired
? `Your applications will continue to run but you will not be able to access your project until you link a payment method. `
? (
<div>
Your applications will continue to run but you will not be able to access your project until you link a payment method.
{" "}
<Text style={{ cursor: "pointer" }} onClick={() => showIntercomWithMessage({
message: "I have already redeemed my startup deal.",
delaySeconds: 0,
})}>
Already redeemed your startup deal?
</Text>
</div>
)
: "Link a payment method to your Porter project."}
<br />
<br />
<Spacer y={0.5} />
{`You can learn more about our pricing under "For Businesses" `}
<Link target="_blank" to="https://porter.run/pricing">
here
Expand All @@ -87,17 +99,18 @@ const BillingModal = ({
)}
<Spacer y={1} />
{
publishableKey ? <Elements
stripe={stripePromise}
options={options}
appearance={appearance}
>
<PaymentSetupForm onCreate={onCreate}></PaymentSetupForm>
</Elements> : null
publishableKey ? (
<Elements
stripe={stripePromise || null}
options={options}
appearance={appearance}
>
<PaymentSetupForm onCreate={onCreate}></PaymentSetupForm>
</Elements>
) : null
}

</div>
</Modal>
</Modal >
);
};

Expand Down

0 comments on commit 05d1851

Please sign in to comment.