From aeee8c39f612d3af3d12a80576acbcaa7e0799cb Mon Sep 17 00:00:00 2001 From: nael Date: Wed, 6 Dec 2023 21:46:15 +0100 Subject: [PATCH] :sparkles: Shared-types --- apps/frontend-snippet/package.json | 3 +- apps/frontend-snippet/src/helpers/utils.ts | 16 - .../src/lib/ProviderModal.tsx | 8 +- apps/webapp/package.json | 3 +- .../src/hooks/useProviderProperties.tsx | 5 +- packages/api/index.ts | 2 - packages/api/package.json | 3 +- .../connections/connections.controller.ts | 3 +- .../@core/passthrough/passthrough.service.ts | 2 +- .../src/@core/utils/unification/desunify.ts | 2 +- .../api/src/@core/utils/unification/unify.ts | 2 +- packages/shared-types/.eslintrc.cjs | 7 + packages/shared-types/.prettierrc | 9 + packages/shared-types/index.ts | 2 + packages/shared-types/package.json | 11 + packages/shared-types/src/enum.ts | 27 ++ .../utils => shared-types/src}/providers.ts | 28 +- packages/shared-types/tsconfig.json | 14 + pnpm-lock.yaml | 275 ++++++++++++++++-- 19 files changed, 346 insertions(+), 76 deletions(-) create mode 100644 packages/shared-types/.eslintrc.cjs create mode 100644 packages/shared-types/.prettierrc create mode 100644 packages/shared-types/index.ts create mode 100644 packages/shared-types/package.json create mode 100644 packages/shared-types/src/enum.ts rename packages/{api/src/@core/utils => shared-types/src}/providers.ts (62%) create mode 100644 packages/shared-types/tsconfig.json diff --git a/apps/frontend-snippet/package.json b/apps/frontend-snippet/package.json index 2b0b6a9b6..a920a38af 100644 --- a/apps/frontend-snippet/package.json +++ b/apps/frontend-snippet/package.json @@ -18,7 +18,8 @@ "react-dom": "^18.2.0", "react-loader-spinner": "^5.4.5", "tailwind-scrollbar-hide": "^1.1.7", - "uuid": "^9.0.1" + "uuid": "^9.0.1", + "shared-types": "workspace:*" }, "devDependencies": { "@types/react": "^18.2.15", diff --git a/apps/frontend-snippet/src/helpers/utils.ts b/apps/frontend-snippet/src/helpers/utils.ts index 5b8671510..e549ef629 100644 --- a/apps/frontend-snippet/src/helpers/utils.ts +++ b/apps/frontend-snippet/src/helpers/utils.ts @@ -1,19 +1,3 @@ -export enum CRM_PROVIDERS { - ZOHO = 'zoho', - ZENDESK = 'zendesk', - HUBSPOT = 'hubspot', - PIPEDRIVE = 'pipedrive', - FRESHSALES = 'freshsales', -} - -export enum ACCOUNTING_PROVIDERS { - PENNYLANE = 'pennylane', - FRESHBOOKS = 'freshbooks', - CLEARBOOKS = 'clearbooks', - FREEAGENT = 'freeagent', - SAGE = 'sage', -} - type ProviderConfig = { clientId: string; scopes: string; diff --git a/apps/frontend-snippet/src/lib/ProviderModal.tsx b/apps/frontend-snippet/src/lib/ProviderModal.tsx index 747e94940..092f2cf37 100644 --- a/apps/frontend-snippet/src/lib/ProviderModal.tsx +++ b/apps/frontend-snippet/src/lib/ProviderModal.tsx @@ -2,9 +2,7 @@ import { useEffect, useState } from 'react'; import { TailSpin } from 'react-loader-spinner' import useOAuth from '../hooks/useOAuth'; import { findProviderByName, providersArray } from '../helpers/utils'; - -const categories = ['CRM', 'Ticketing', 'Marketing Automation','ATS', 'Accounting', 'File Storage', 'HR & Payroll']; - +import {categoriesVerticals} from 'shared-types'; const LoadingOverlay = ({ providerName }: { providerName: string }) => { const provider = findProviderByName(providerName); @@ -35,7 +33,7 @@ const LoadingOverlay = ({ providerName }: { providerName: string }) => { }; const ProviderModal = () => { - const [selectedCategory, setSelectedCategory] = useState(categories[0]); // Default to the first category + const [selectedCategory, setSelectedCategory] = useState(categoriesVerticals[0] as string); // Default to the first category const [selectedProvider, setSelectedProvider] = useState(''); const [loading, setLoading] = useState<{ status: boolean; provider: string @@ -104,7 +102,7 @@ const ProviderModal = () => { {!loading.status ?
- {categories.map((category, index) => ( + {categoriesVerticals.map((category, index) => (