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: allow requesting refunds from settings
Abdullah Atta7f873f240e74
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.jsindex 2a67db0b9..801883102 100644--- a/apps/web/src/views/settings.js+++ b/apps/web/src/views/settings.js@@ -1357,6 +1357,40 @@ function AccountStatus(props) {tip="Update the payment method you used to purchase this subscription."/></Button>+ <Button+ variant="list"+ onClick={async () => {+ const refundSubscription = await confirm({+ title: "Request refund?",+ message:+ "You will only be issued a refund if you are eligible as per our refund policy. Your account will be immediately downgraded to Basic and your funds will be transferred to your account within 24 hours.",+ negativeButtonText: "No",+ positiveButtonText: "Yes"+ });+ if (refundSubscription) {+ const error = await TaskManager.startTask({+ id: "refund-subscription",+ type: "modal",+ title: "Requesting refund for your subscription",+ subtitle: "Please wait...",+ action: () => db.subscriptions.refund()+ });+ if (error instanceof Error) {+ showToast("error", error.message);+ } else {+ showToast(+ "success",+ "Your refund has been issued. Please wait 24 hours before reaching out to us in case you do not receive your funds."+ );+ }+ }+ }}+ >+ <Tip+ text="Request refund"+ tip="If you are eligible for a refund, your account will be immediately downgraded to Basic and your funds will be transferred to your account within 24 hours."+ />+ </Button><Buttonvariant="list"sx={{ ":hover": { borderColor: "error" } }}diff --git a/packages/core/api/subscriptions.js b/packages/core/api/subscriptions.jsindex 8aa15cf39..f036cf636 100644--- a/packages/core/api/subscriptions.js+++ b/packages/core/api/subscriptions.js@@ -34,6 +34,16 @@ export default class Subscriptions {await http.delete(`${hosts.SUBSCRIPTIONS_HOST}/subscriptions`, token);}+ async refund() {+ const token = await this._tokenManager.getAccessToken();+ if (!token) return;+ await http.post(+ `${hosts.SUBSCRIPTIONS_HOST}/subscriptions/refund`,+ null,+ token+ );+ }+async updateUrl() {const token = await this._tokenManager.getAccessToken();if (!token) return;