Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: load paddle checkout in test mode during testing

Abdullah Attaceb28f08c5e0
diff --git a/apps/web/src/dialogs/buy-dialog/paddle.tsx b/apps/web/src/dialogs/buy-dialog/paddle.tsx
index 39edb3c94..2d830fe79 100644
--- a/apps/web/src/dialogs/buy-dialog/paddle.tsx
+++ b/apps/web/src/dialogs/buy-dialog/paddle.tsx
@@ -35,15 +35,18 @@ import useMobile from "../../hooks/use-mobile";
// const isDev = false; // import.meta.env.DEV;
// const VENDOR_ID = isDev ? 1506 : 128190;
-const PADDLE_ORIGIN = import.meta.env.DEV
- ? "https://sandbox-buy.paddle.com"
- : "https://buy.paddle.com";
-const CHECKOUT_CREATE_ORIGIN = import.meta.env.DEV
- ? "https://sandbox-create-checkout.paddle.com"
- : "https://create-checkout.paddle.com";
-const CHECKOUT_SERVICE_ORIGIN = import.meta.env.DEV
- ? "https://sandbox-checkout-service.paddle.com"
- : "https://checkout-service.paddle.com";
+const PADDLE_ORIGIN =
+ import.meta.env.DEV || IS_TESTING
+ ? "https://sandbox-buy.paddle.com"
+ : "https://buy.paddle.com";
+const CHECKOUT_CREATE_ORIGIN =
+ import.meta.env.DEV || IS_TESTING
+ ? "https://sandbox-create-checkout.paddle.com"
+ : "https://create-checkout.paddle.com";
+const CHECKOUT_SERVICE_ORIGIN =
+ import.meta.env.DEV || IS_TESTING
+ ? "https://sandbox-checkout-service.paddle.com"
+ : "https://checkout-service.paddle.com";
const SUBSCRIBED_EVENTS: PaddleEvents[] = [
PaddleEvents["Checkout.Loaded"],
diff --git a/apps/web/src/dialogs/buy-dialog/plans.ts b/apps/web/src/dialogs/buy-dialog/plans.ts
index e7a20c300..e56427e80 100644
--- a/apps/web/src/dialogs/buy-dialog/plans.ts
+++ b/apps/web/src/dialogs/buy-dialog/plans.ts
@@ -32,7 +32,7 @@ export const DEFAULT_PLANS: Plan[] = [
country: "PK",
currency: "USD",
discount: 0,
- id: import.meta.env.DEV ? "9822" : "648884",
+ id: import.meta.env.DEV || IS_TESTING ? "9822" : "648884",
price: { gross: 4.49, net: 0, tax: 0 }
},
{
@@ -40,7 +40,7 @@ export const DEFAULT_PLANS: Plan[] = [
country: "PK",
currency: "USD",
discount: 0,
- id: import.meta.env.DEV ? "50305" : "658759",
+ id: import.meta.env.DEV || IS_TESTING ? "50305" : "658759",
price: { gross: 49.99, net: 0, tax: 0 }
}
];
diff --git a/apps/web/src/utils/telemetry.ts b/apps/web/src/utils/telemetry.ts
index 4d82b3134..31920dbce 100644
--- a/apps/web/src/utils/telemetry.ts
+++ b/apps/web/src/utils/telemetry.ts
@@ -21,7 +21,7 @@ import Config from "./config";
export function isTelemetryEnabled() {
// telemetry is always disabled in DEBUG/TEST mode
- if (import.meta.env.DEV) return false;
+ if (import.meta.env.DEV || IS_TESTING) return false;
return Config.get("telemetry", false);
}