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: remove altogic

AykutSaracfb3109e648db
diff --git a/.env.development b/.env.development
index 0cb97f13..0b3b3749 100644
--- a/.env.development
+++ b/.env.development
@@ -1,5 +1,3 @@
NEXT_PUBLIC_BASE_URL=http://localhost:3000
-NEXT_PUBLIC_ALTOGIC_ENV_URL=https://jsoncrack.c5-na.altogic.com
-NEXT_PUBLIC_ALTOGIC_CLIENT_KEY=f1e92022789f4ccf91273a345ab2bdf8
NEXT_PUBLIC_PAYMENT_URL=https://herowand.lemonsqueezy.com/checkout/buy/ce30521f-c7cc-44f3-9435-995d3260ba22
NEXT_PUBLIC_GA_ID=G-JKZEHMJBMH
\ No newline at end of file
diff --git a/.env.production b/.env.production
index 3714451d..5fbad56c 100644
--- a/.env.production
+++ b/.env.production
@@ -1,5 +1,3 @@
NEXT_PUBLIC_BASE_URL=https://jsoncrack.com
-NEXT_PUBLIC_ALTOGIC_ENV_URL=https://jsoncrack.c5-na.altogic.com
-NEXT_PUBLIC_ALTOGIC_CLIENT_KEY=f1e92022789f4ccf91273a345ab2bdf8
NEXT_PUBLIC_PAYMENT_URL=https://herowand.lemonsqueezy.com/checkout/buy/ce30521f-c7cc-44f3-9435-995d3260ba22
NEXT_PUBLIC_GA_ID=G-JKZEHMJBMH
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 89ce5814..1f9f3b32 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -7,13 +7,12 @@ Read our [Code of Conduct](./CODE_OF_CONDUCT.md) to keep our community approacha
In this guide you will get an overview of the contribution workflow from opening an issue, creating a PR, reviewing, and merging the PR.
## Getting Started
-JSON Crack is built with React, Reaflow for visualization, Mantine UI for components, Zustand for state management, and Altogic for backend integration. If you are not familiar with these technologies, we recommend you to read their documentation to get started. You can find the links to the respective documentations below:
+JSON Crack is built with React, Reaflow for visualization, Mantine UI for components, Zustand for state management, and Supabase for backend integration. If you are not familiar with these technologies, we recommend you to read their documentation to get started. You can find the links to the respective documentations below:
* [React](https://reactjs.org/docs/getting-started.html)
* [Reaflow](https://github.com/reaviz/reaflow)
* [Mantine UI](https://mantine.dev/)
* [Zustand](https://github.com/pmndrs/zustand)
-* [Altogic](https://www.altogic.com/)
Once you are familiar with these technologies, you can clone the JSON Crack repository by running the following command:
diff --git a/package.json b/package.json
index 4ce2fe71..72066bcb 100644
--- a/package.json
+++ b/package.json
@@ -27,7 +27,6 @@
"@supabase/supabase-js": "^2.31.0",
"@tanstack/react-query": "^4.32.0",
"allotment": "^1.19.2",
- "altogic": "^2.3.9",
"axios": "^1.4.0",
"dayjs": "^1.11.9",
"html-to-image": "^1.11.11",
diff --git a/src/containers/Modals/CancelPremiumModal/index.tsx b/src/containers/Modals/CancelPremiumModal/index.tsx
index c8dff767..e83434f2 100644
--- a/src/containers/Modals/CancelPremiumModal/index.tsx
+++ b/src/containers/Modals/CancelPremiumModal/index.tsx
@@ -1,7 +1,7 @@
import React from "react";
import { Modal, Group, Button, Divider, ModalProps, Text, Image, Anchor } from "@mantine/core";
import { toast } from "react-hot-toast";
-import { altogic } from "src/lib/api/altogic";
+import { supabase } from "src/lib/api/supabase";
export const CancelPremiumModal: React.FC<ModalProps> = ({ opened, onClose }) => {
const [cancelling, setCancelling] = React.useState(false);
@@ -9,12 +9,20 @@ export const CancelPremiumModal: React.FC<ModalProps> = ({ opened, onClose }) =>
const cancelSub = async () => {
try {
setCancelling(true);
- const { errors } = await altogic.endpoint.delete("/subscription");
+ const { data: user } = await supabase.auth.getSession();
- if (errors?.items.length) {
- return toast.error(
- "An error occured while cancelling plan! Please contact [email protected]"
- );
+ if (user) {
+ const { error } = await supabase.functions.invoke("lemonsqueezy", {
+ method: "DELETE",
+ body: {
+ jwt: user.session?.access_token,
+ },
+ });
+
+ if (error) return toast.error(error.message);
+ toast.success("Cancelled premium plan!");
+ } else {
+ toast.error("Couldn't fetch user details, please contact: [email protected]");
}
toast.success("Cancelled premium plan!");
diff --git a/src/lib/api/altogic.ts b/src/lib/api/altogic.ts
deleted file mode 100644
index 5ce4616e..00000000
--- a/src/lib/api/altogic.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import { APIError, createClient } from "altogic";
-
-const envUrl = process.env.NEXT_PUBLIC_ALTOGIC_ENV_URL as string;
-const clientKey = process.env.NEXT_PUBLIC_ALTOGIC_CLIENT_KEY as string;
-
-const altogic = createClient(envUrl, clientKey);
-
-interface AltogicResponse<T> {
- data: T;
- errors: APIError | null;
-}
-
-export { altogic };
-export type { AltogicResponse };
diff --git a/src/types/altogic.ts b/src/types/altogic.ts
deleted file mode 100644
index 8b162729..00000000
--- a/src/types/altogic.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-export interface User {
- _id: string;
- provider: string;
- providerUserId: string;
- email: string;
- name: string;
- profilePicture: string;
- signUpAt: string;
- lastLoginAt: string;
- updatedAt: string;
- type: 0 | 1;
-}
-
-export interface Json {
- _id: string;
- createdAt: string;
- updatedAt: string;
- json: string;
- name: string;
- private: false;
-}
-
-interface Device {
- family: string;
- major: string;
- minor: string;
- patch: string;
-}
-
-interface Os {
- family: string;
- major: string;
- minor: string;
- patch: string;
-}
-
-interface UserAgent {
- family: string;
- major: string;
- minor: string;
- patch: string;
- device: Device;
- os: Os;
-}
-
-interface Session {
- userId: string;
- token: string;
- creationDtm: Date;
- userAgent: UserAgent;
- accessGroupKeys: any[];
-}
-
-export interface AltogicAuth {
- user: User;
- session: Session;
-}
diff --git a/src/types/env.d.ts b/src/types/env.d.ts
index be512601..e3d9bfc1 100644
--- a/src/types/env.d.ts
+++ b/src/types/env.d.ts
@@ -1,8 +1,6 @@
namespace NodeJS {
interface ProcessEnv {
NEXT_PUBLIC_BASE_URL: string;
- NEXT_PUBLIC_ALTOGIC_ENV_URL: string;
- NEXT_PUBLIC_ALTOGIC_CLIENT_KEY: string;
NEXT_PUBLIC_PAYMENT_URL: string;
NEXT_PUBLIC_GA_ID: string;
}
diff --git a/yarn.lock b/yarn.lock
index 9ed010e8..3fe9fa4d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1950,11 +1950,6 @@
"@sentry/cli" "^1.74.6"
webpack-sources "^2.0.0 || ^3.0.0"
-"@socket.io/component-emitter@~3.1.0":
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz#96116f2a912e0c02817345b3c10751069920d553"
- integrity sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==
-
"@supabase/auth-helpers-nextjs@^0.7.4":
version "0.7.4"
resolved "https://registry.yarnpkg.com/@supabase/auth-helpers-nextjs/-/auth-helpers-nextjs-0.7.4.tgz#0e2949b1f7ada97f8593ef1bb57901622c47b065"
@@ -2346,14 +2341,6 @@ allotment@^1.19.2:
lodash.isequal "^4.5.0"
use-resize-observer "^9.0.0"
-altogic@^2.3.9:
- version "2.3.9"
- resolved "https://registry.yarnpkg.com/altogic/-/altogic-2.3.9.tgz#202c6448abd3d75e067d0a973804a7ce293afea5"
- integrity sha512-ygB1E4ZPfk7jfwkpapXUtpF7b43e9gEENfgya5b94rQkCxN8xcwMyZK6iMrEbaUYW9ZZkg0vyad/OeWZEvrAhQ==
- dependencies:
- cross-fetch "^3.1.4"
- socket.io-client "^4.5.1"
-
ansi-regex@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
@@ -2794,13 +2781,6 @@ create-require@^1.1.0:
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
-cross-fetch@^3.1.4:
- version "3.1.5"
- resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f"
- integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==
- dependencies:
- node-fetch "2.6.7"
-
cross-fetch@^3.1.5:
version "3.1.8"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82"
@@ -2876,7 +2856,7 @@ dayjs@^1.11.9:
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.9.tgz#9ca491933fadd0a60a2c19f6c237c03517d71d1a"
integrity sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==
-debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4, debug@~4.3.1, debug@~4.3.2:
+debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
@@ -3096,22 +3076,6 @@ emoji-regex@^9.2.2:
resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72"
integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==
-engine.io-client@~6.4.0:
- version "6.4.0"
- resolved "https://registry.yarnpkg.com/engine.io-client/-/engine.io-client-6.4.0.tgz#88cd3082609ca86d7d3c12f0e746d12db4f47c91"
- integrity sha512-GyKPDyoEha+XZ7iEqam49vz6auPnNJ9ZBfy89f+rMMas8AuiMWOZ9PVzu8xb9ZC6rafUqiGHSCfu22ih66E+1g==
- dependencies:
- "@socket.io/component-emitter" "~3.1.0"
- debug "~4.3.1"
- engine.io-parser "~5.0.3"
- ws "~8.11.0"
- xmlhttprequest-ssl "~2.0.0"
-
-engine.io-parser@~5.0.3:
- version "5.0.6"
- resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-5.0.6.tgz#7811244af173e157295dec9b2718dfe42a64ef45"
- integrity sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw==
-
enhanced-resolve@^5.10.0:
version "5.12.0"
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz#300e1c90228f5b570c4d35babf263f6da7155634"
@@ -4687,13 +4651,6 @@ [email protected]:
"@next/swc-win32-ia32-msvc" "13.3.0"
"@next/swc-win32-x64-msvc" "13.3.0"
- version "2.6.7"
- resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad"
- integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==
- dependencies:
- whatwg-url "^5.0.0"
-
node-fetch@^2.6.12:
version "2.6.12"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.12.tgz#02eb8e22074018e3d5a83016649d04df0e348fba"
@@ -5476,24 +5433,6 @@ slash@^4.0.0:
resolved "https://registry.yarnpkg.com/slash/-/slash-4.0.0.tgz#2422372176c4c6c5addb5e2ada885af984b396a7"
integrity sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==
-socket.io-client@^4.5.1:
- version "4.6.1"
- resolved "https://registry.yarnpkg.com/socket.io-client/-/socket.io-client-4.6.1.tgz#80d97d5eb0feca448a0fb6d69a7b222d3d547eab"
- integrity sha512-5UswCV6hpaRsNg5kkEHVcbBIXEYoVbMQaHJBXJCyEQ+CiFPV1NIOY0XOFWG4XR4GZcB8Kn6AsRs/9cy9TbqVMQ==
- dependencies:
- "@socket.io/component-emitter" "~3.1.0"
- debug "~4.3.2"
- engine.io-client "~6.4.0"
- socket.io-parser "~4.2.1"
-
-socket.io-parser@~4.2.1:
- version "4.2.2"
- resolved "https://registry.yarnpkg.com/socket.io-parser/-/socket.io-parser-4.2.2.tgz#1dd384019e25b7a3d374877f492ab34f2ad0d206"
- integrity sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==
- dependencies:
- "@socket.io/component-emitter" "~3.1.0"
- debug "~4.3.1"
-
source-map-js@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c"
@@ -6099,21 +6038,11 @@ ws@^7.3.1:
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591"
integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==
-ws@~8.11.0:
- version "8.11.0"
- resolved "https://registry.yarnpkg.com/ws/-/ws-8.11.0.tgz#6a0d36b8edfd9f96d8b25683db2f8d7de6e8e143"
- integrity sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==
-
xmldom@^0.1.21:
version "0.1.31"
resolved "https://registry.yarnpkg.com/xmldom/-/xmldom-0.1.31.tgz#b76c9a1bd9f0a9737e5a72dc37231cf38375e2ff"
integrity sha512-yS2uJflVQs6n+CyjHoaBmVSqIDevTAWrzMmjG1Gc7h1qQ7uVozNhEPJAwZXWyGQ/Gafo3fCwrcaokezLPupVyQ==
-xmlhttprequest-ssl@~2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz#91360c86b914e67f44dce769180027c0da618c67"
- integrity sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==
-
xtend@^4.0.0:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"