Skip to content

✨ Innovative and open-source visualization application that transforms various data formats, such as JSON, YAML, XML and CSV into interactive graphs.

feat: append email to checkout url

AykutSarac7597a244fdda
diff --git a/src/components/Graph/PremiumView.tsx b/src/components/Graph/PremiumView.tsx
index 2fea2a07..bdbae91f 100644
--- a/src/components/Graph/PremiumView.tsx
+++ b/src/components/Graph/PremiumView.tsx
@@ -197,7 +197,7 @@ export const PremiumView = () => (
component="a"
variant="gradient"
gradient={{ from: "blue", to: "teal" }}
- href={paymentURL}
+ href={paymentURL()}
target="_blank"
>
UPGRADE TO PREMIUM $5.00
diff --git a/src/constants/data.ts b/src/constants/data.ts
index d2a2e716..7d3d6dbe 100644
--- a/src/constants/data.ts
+++ b/src/constants/data.ts
@@ -1,5 +1,14 @@
+import useUser from "src/store/useUser";
+
export const baseURL = process.env.NEXT_PUBLIC_BASE_URL as string;
-export const paymentURL = process.env.NEXT_PUBLIC_PAYMENT_URL as string;
+
+export const paymentURL = () => {
+ const email = useUser.getState().user?.email;
+ let url = process.env.NEXT_PUBLIC_PAYMENT_URL as string;
+
+ if (email) url += `?checkout[email]=${email}`;
+ return url;
+};
// Example taken from https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json
const sampleJson = Object.freeze({
diff --git a/src/containers/Modals/PremiumModal/index.tsx b/src/containers/Modals/PremiumModal/index.tsx
index 8c2515f9..360fe469 100644
--- a/src/containers/Modals/PremiumModal/index.tsx
+++ b/src/containers/Modals/PremiumModal/index.tsx
@@ -53,7 +53,7 @@ export const PremiumModal: React.FC<ModalProps> = ({ opened, onClose }) => {
</Title>
<Button
component="a"
- href={paymentURL}
+ href={paymentURL()}
variant="filled"
color="teal"
size="md"
diff --git a/src/pages/pricing.tsx b/src/pages/pricing.tsx
index 3bca9c52..33cb211a 100644
--- a/src/pages/pricing.tsx
+++ b/src/pages/pricing.tsx
@@ -64,7 +64,7 @@ const Pricing = () => {
</Title>
<Button
component="a"
- href={paymentURL}
+ href={paymentURL()}
variant="filled"
color="teal"
size="md"