Răsfoiți Sursa

Add button to show intercom on billing modal (#4581)

Mauricio Araujo 2 ani în urmă
părinte
comite
05d1851930
1 a modificat fișierele cu 26 adăugiri și 13 ștergeri
  1. 26 13
      dashboard/src/main/home/modals/BillingModal.tsx

+ 26 - 13
dashboard/src/main/home/modals/BillingModal.tsx

@@ -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";
 
@@ -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 = {
@@ -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
@@ -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 >
   );
 };