A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: simplify subscription cancellation
Abdullah Attafb54125ee689
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.jsindex 2c15a449e..5cb1c10a8 100644--- a/apps/web/src/views/settings.js+++ b/apps/web/src/views/settings.js@@ -1288,40 +1288,49 @@ function AccountStatus(props) {</>) : isPro ? (<>- <Button- variant="list"- onClick={async () => {- if (!user.subscription.updateURL)- return showToast(- "error",- "Failed to update. Please reach out to us at [email protected] so we can help you resolve the issue."- );- window.open(user.subscription.updateURL, "_blank");- }}- >- <Tip- text="Update payment method"- tip="Update the payment method you used to purchase this subscription."- />- </Button>- <Button- variant="list"- sx={{ ":hover": { borderColor: "error" } }}- onClick={async () => {- if (!user.subscription.cancelURL)- return showToast(- "error",- "Failed to cancel subscription. Please reach out to us at [email protected] so we can help you resolve the issue."- );- window.open(user.subscription.cancelURL, "_blank");- }}- >- <Tip- color="error"- text="Cancel subscription"- tip="You will be downgraded to the Basic plan at the end of your billing period."- />- </Button>+ {provider === "Web" ? (+ <>+ <Button+ variant="list"+ onClick={async () => {+ try {+ window.open(await db.subscriptions.updateUrl(), "_blank");+ } catch (e) {+ showToast("error", e.message);+ }+ }}+ >+ <Tip+ text="Update payment method"+ tip="Update the payment method you used to purchase this subscription."+ />+ </Button>+ <Button+ variant="list"+ sx={{ ":hover": { borderColor: "error" } }}+ onClick={async () => {+ try {+ await db.subscriptions.cancel();+ showToast(+ "success",+ "Your subscription has been cancelled."+ );+ setTimeout(() => {+ window.location.reload();+ }, 5000);+ } catch (e) {+ showToast("error", e.message);+ }+ }}+ >+ <Tip+ color="error"+ text="Cancel subscription"+ tip="You will be downgraded to the Basic plan at the end of your billing period."+ />+ </Button>+ </>+ ) : null}<Textvariant="subBody"mt={1}