From bc4bfa63f732b55cafe10c23ecfa52fca2a74bcc Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 17 Sep 2025 12:46:53 +0500 Subject: [PATCH] web: go back on overlay checkout closed --- apps/web/src/views/payments.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/web/src/views/payments.tsx b/apps/web/src/views/payments.tsx index 1a0f1d9b8..216c5f938 100644 --- a/apps/web/src/views/payments.tsx +++ b/apps/web/src/views/payments.tsx @@ -21,7 +21,7 @@ import "../app.css"; import { useEffect, useState } from "react"; import { Flex } from "@theme-ui/components"; import { hardNavigate, useQueryParams } from "../navigation"; -import { initializePaddle } from "@paddle/paddle-js"; +import { CheckoutEventNames, initializePaddle } from "@paddle/paddle-js"; import { CLIENT_PADDLE_TOKEN } from "../dialogs/buy-dialog/paddle"; import { Loader } from "../components/loader"; import { IS_DEV } from "../dialogs/buy-dialog/helpers"; @@ -35,7 +35,11 @@ function Payments() { (async function () { const paddle = await initializePaddle({ token: CLIENT_PADDLE_TOKEN, - environment: IS_DEV ? "sandbox" : "production" + environment: IS_DEV ? "sandbox" : "production", + eventCallback: (event) => { + if (event.name === CheckoutEventNames.CHECKOUT_CLOSED) + window.history.back(); + } }); if (!paddle) return hardNavigate("/notes");