From fd695fb13f42249f265e64414006931edad939cb Mon Sep 17 00:00:00 2001 From: nael Date: Wed, 17 Apr 2024 09:18:26 +0200 Subject: [PATCH 1/3] :bug: Fix namings api --- docker-compose.dev.yml | 188 +++++++++--------- docker-compose.source.yml | 113 +++++------ docker-compose.yml | 181 ++++++++--------- docs/marketing_automation/introduction.mdx | 4 +- docs/mint.json | 4 +- docs/open-source/contributors.mdx | 12 +- .../connections-strategies.service.ts | 33 ++- .../connections/connections.controller.ts | 2 +- .../@core/connections/connections.module.ts | 2 +- .../marketingautomation.connection.module.ts} | 2 +- .../getresponse/getresponse.service.ts | 12 +- .../services/mailchimp/mailchimp.service.ts | 6 +- ...marketingautomation.connection.service.ts} | 0 .../services/podium/podium.service.ts | 10 +- .../services/registry.service.ts | 0 .../types/index.ts | 0 packages/api/src/@core/utils/types/index.ts | 4 +- packages/api/src/app.module.ts | 4 +- .../@types/index.ts | 0 .../filestorage.module.ts} | 0 .../@types/index.ts | 0 .../marketingautomation.module.ts} | 0 packages/api/tsconfig.json | 4 +- packages/shared/src/enum.ts | 4 +- packages/shared/src/envConfig.ts | 15 +- packages/shared/src/providers.ts | 8 +- packages/shared/src/utils.ts | 6 +- 27 files changed, 304 insertions(+), 310 deletions(-) rename packages/api/src/@core/connections/{marketing_automation/marketing_automation.connection.module.ts => marketingautomation/marketingautomation.connection.module.ts} (96%) rename packages/api/src/@core/connections/{marketing_automation => marketingautomation}/services/getresponse/getresponse.service.ts (95%) rename packages/api/src/@core/connections/{marketing_automation => marketingautomation}/services/mailchimp/mailchimp.service.ts (97%) rename packages/api/src/@core/connections/{marketing_automation/services/marketing_automation.connection.service.ts => marketingautomation/services/marketingautomation.connection.service.ts} (100%) rename packages/api/src/@core/connections/{marketing_automation => marketingautomation}/services/podium/podium.service.ts (95%) rename packages/api/src/@core/connections/{marketing_automation => marketingautomation}/services/registry.service.ts (100%) rename packages/api/src/@core/connections/{marketing_automation => marketingautomation}/types/index.ts (100%) rename packages/api/src/{file_storage => filestorage}/@types/index.ts (100%) rename packages/api/src/{file_storage/file-storage.module.ts => filestorage/filestorage.module.ts} (100%) rename packages/api/src/{marketing_automation => marketingautomation}/@types/index.ts (100%) rename packages/api/src/{marketing_automation/marketing-automation.module.ts => marketingautomation/marketingautomation.module.ts} (100%) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index dee956b2c..c2890fd6e 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,8 +1,8 @@ # this docker compose is for development purposes. -# use it to run a development environnement locally without pulling pre-built images from cloud +# use it to run a development environnement locally without pulling pre-built images from cloud name: panora -version: '3.8' +version: "3.8" services: postgres: @@ -29,95 +29,92 @@ services: build: context: ./ dockerfile: ./packages/api/Dockerfile.dev - environment: - DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?ssl=false - DISTRIBUTION: ${DISTRIBUTION} - JWT_SECRET: ${JWT_SECRET} - REDIS_HOST: redis - ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY} - HUBSPOT_CRM_CLIENT_ID: ${HUBSPOT_CRM_CLIENT_ID} - HUBSPOT_CRM_CLIENT_SECRET: ${HUBSPOT_CRM_CLIENT_SECRET} - ATTIO_CRM_CLIENT_ID: ${ATTIO_CRM_CLIENT_ID} - ATTIO_CRM_CLIENT_SECRET: ${ATTIO_CRM_CLIENT_SECRET} - ZOHO_CRM_CLIENT_ID: ${ZOHO_CRM_CLIENT_ID} - ZOHO_CRM_CLIENT_SECRET: ${ZOHO_CRM_CLIENT_SECRET} - PIPEDRIVE_CRM_CLIENT_ID: ${PIPEDRIVE_CRM_CLIENT_ID} - PIPEDRIVE_CRM_CLIENT_SECRET: ${PIPEDRIVE_CRM_CLIENT_SECRET} - ZENDESK_CRM_CLIENT_ID: ${ZENDESK_CRM_CLIENT_ID} - ZENDESK_CRM_CLIENT_SECRET: ${ZENDESK_CRM_CLIENT_SECRET} - OAUTH_REDIRECT_BASE: ${OAUTH_REDIRECT_BASE} - ZENDESK_TICKETING_CLIENT_ID: ${ZENDESK_TICKETING_CLIENT_ID} - ZENDESK_TICKETING_CLIENT_SECRET: ${ZENDESK_TICKETING_CLIENT_SECRET} - ZENDESK_TICKETING_SUBDOMAIN: ${ZENDESK_TICKETING_SUBDOMAIN} - FRONT_TICKETING_CLIENT_ID: ${FRONT_TICKETING_CLIENT_ID} - FRONT_TICKETING_CLIENT_SECRET: ${FRONT_TICKETING_CLIENT_SECRET} - CLICKUP_TICKETING_CLIENT_ID: ${CLICKUP_TICKETING_CLIENT_ID} - CLICKUP_TICKETING_CLIENT_SECRET: ${CLICKUP_TICKETING_CLIENT_SECRET} - GITHUB_TICKETING_CLIENT_ID: ${GITHUB_TICKETING_CLIENT_ID} - GITHUB_TICKETING_CLIENT_SECRET: ${GITHUB_TICKETING_CLIENT_SECRET} - GITLAB_TICKETING_CLIENT_ID: ${GITLAB_TICKETING_CLIENT_ID} - GITLAB_TICKETING_CLIENT_SECRET: ${GITLAB_TICKETING_CLIENT_SECRET} - GORGIAS_TICKETING_CLIENT_ID: ${GORGIAS_TICKETING_CLIENT_ID} - GORGIAS_TICKETING_CLIENT_SECRET: ${GORGIAS_TICKETING_CLIENT_SECRET} - GORGIAS_TICKETING_SUBDOMAIN: ${GORGIAS_TICKETING_SUBDOMAIN} - JIRA_TICKETING_CLIENT_ID: ${JIRA_TICKETING_CLIENT_ID} - JIRA_TICKETING_CLIENT_SECRET: ${JIRA_TICKETING_CLIENT_SECRET} - JIRA_SERVICE_MGMT_TICKETING_CLIENT_ID: ${JIRA_SERVICE_MGMT_TICKETING_CLIENT_ID} - JIRA_SERVICE_MGMT_TICKETING_CLIENT_SECRET: ${JIRA_SERVICE_MGMT_TICKETING_CLIENT_SECRET} - LINEAR_TICKETING_CLIENT_ID: ${LINEAR_TICKETING_CLIENT_ID} - LINEAR_TICKETING_CLIENT_SECRET: ${LINEAR_TICKETING_CLIENT_SECRET} - ACCELO_CRM_CLIENT_ID: ${ACCELO_CRM_CLIENT_ID} - ACCELO_CRM_CLIENT_SECRET: ${ACCELO_CRM_CLIENT_SECRET} - ACCELO_CRM_SUBDOMAIN: ${ACCELO_CRM_SUBDOMAIN} - CAPSULE_CRM_CLIENT_ID: ${CAPSULE_CRM_CLIENT_ID} - CAPSULE_CRM_CLIENT_SECRET: ${CAPSULE_CRM_CLIENT_SECRET} - CLOSE_CRM_CLIENT_ID: ${CLOSE_CRM_CLIENT_ID} - CLOSE_CRM_CLIENT_SECRET: ${CLOSE_CRM_CLIENT_SECRET} - COPPER_CRM_CLIENT_ID: ${COPPER_CRM_CLIENT_ID} - COPPER_CRM_CLIENT_SECRET: ${COPPER_CRM_CLIENT_SECRET} - KEAP_CRM_CLIENT_ID: ${KEAP_CRM_CLIENT_ID} - KEAP_CRM_CLIENT_SECRET: ${KEAP_CRM_CLIENT_SECRET} - TEAMLEADER_CRM_CLIENT_ID: ${TEAMLEADER_CRM_CLIENT_ID} - TEAMLEADER_CRM_CLIENT_SECRET: ${TEAMLEADER_CRM_CLIENT_SECRET} - TEAMWORK_CRM_CLIENT_ID: ${TEAMWORK_CRM_CLIENT_ID} - TEAMWORK_CRM_CLIENT_SECRET: ${TEAMWORK_CRM_CLIENT_SECRET} - AHA_TICKETING_CLIENT_ID: ${AHA_TICKETING_CLIENT_ID} - AHA_TICKETING_CLIENT_SECRET: ${AHA_TICKETING_CLIENT_SECRET} - AHA_TICKETING_SUBDOMAIN: ${AHA_TICKETING_SUBDOMAIN} - WRIKE_TICKETING_CLOUD_CLIENT_ID: ${WRIKE_TICKETING_CLOUD_CLIENT_ID} - WRIKE_TICKETING_CLOUD_CLIENT_SECRET: ${WRIKE_TICKETING_CLOUD_CLIENT_SECRET} - ASANA_TICKETING_CLOUD_CLIENT_ID: ${ASANA_TICKETING_CLOUD_CLIENT_ID} - ASANA_TICKETING_CLOUD_CLIENT_SECRET: ${ASANA_TICKETING_CLOUD_CLIENT_SECRET} - PENNYLANE_ACCOUNTING_CLOUD_CLIENT_ID: ${PENNYLANE_ACCOUNTING_CLOUD_CLIENT_ID} - PENNYLANE_ACCOUNTING_CLOUD_CLIENT_SECRET: ${PENNYLANE_ACCOUNTING_CLOUD_CLIENT_SECRET} - FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_ID: ${FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_ID} - FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} - FREEAGENT_ACCOUNTING_CLOUD_CLIENT_ID: ${FREEAGENT_ACCOUNTING_CLOUD_CLIENT_ID} - FREEAGENT_ACCOUNTING_CLOUD_CLIENT_SECRET: ${FREEAGENT_ACCOUNTING_CLOUD_CLIENT_SECRET} - SAGE_ACCOUNTING_CLOUD_CLIENT_ID: ${SAGE_ACCOUNTING_CLOUD_CLIENT_ID} - SAGE_ACCOUNTING_CLOUD_CLIENT_SECRET: ${SAGE_ACCOUNTING_CLOUD_CLIENT_SECRET} - MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_ID: ${MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_ID} - MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_SECRET: ${MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_SECRET} - QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_ID: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_ID} - QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} - WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID} - WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET} - GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - - - - restart: - unless-stopped + environment: + DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?ssl=false + DISTRIBUTION: ${DISTRIBUTION} + JWT_SECRET: ${JWT_SECRET} + REDIS_HOST: redis + ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY} + HUBSPOT_CRM_CLOUD_CLIENT_ID: ${HUBSPOT_CRM_CLOUD_CLIENT_ID} + HUBSPOT_CRM_CLOUD_CLIENT_SECRET: ${HUBSPOT_CRM_CLOUD_CLIENT_SECRET} + ATTIO_CRM_CLOUD_CLIENT_ID: ${ATTIO_CRM_CLOUD_CLIENT_ID} + ATTIO_CRM_CLOUD_CLIENT_SECRET: ${ATTIO_CRM_CLOUD_CLIENT_SECRET} + ZOHO_CRM_CLOUD_CLIENT_ID: ${ZOHO_CRM_CLOUD_CLIENT_ID} + ZOHO_CRM_CLOUD_CLIENT_SECRET: ${ZOHO_CRM_CLOUD_CLIENT_SECRET} + PIPEDRIVE_CRM_CLOUD_CLIENT_ID: ${PIPEDRIVE_CRM_CLOUD_CLIENT_ID} + PIPEDRIVE_CRM_CLOUD_CLIENT_SECRET: ${PIPEDRIVE_CRM_CLOUD_CLIENT_SECRET} + ZENDESK_CRM_CLOUD_CLIENT_ID: ${ZENDESK_CRM_CLOUD_CLIENT_ID} + ZENDESK_CRM_CLOUD_CLIENT_SECRET: ${ZENDESK_CRM_CLOUD_CLIENT_SECRET} + OAUTH_REDIRECT_BASE: ${OAUTH_REDIRECT_BASE} + ZENDESK_TICKETING_CLOUD_CLIENT_ID: ${ZENDESK_TICKETING_CLOUD_CLIENT_ID} + ZENDESK_TICKETING_CLOUD_CLIENT_SECRET: ${ZENDESK_TICKETING_CLOUD_CLIENT_SECRET} + ZENDESK_TICKETING_CLOUD_SUBDOMAIN: ${ZENDESK_TICKETING_CLOUD_SUBDOMAIN} + FRONT_TICKETING_CLOUD_CLIENT_ID: ${FRONT_TICKETING_CLOUD_CLIENT_ID} + FRONT_TICKETING_CLOUD_CLIENT_SECRET: ${FRONT_TICKETING_CLOUD_CLIENT_SECRET} + CLICKUP_TICKETING_CLOUD_CLIENT_ID: ${CLICKUP_TICKETING_CLOUD_CLIENT_ID} + CLICKUP_TICKETING_CLOUD_CLIENT_SECRET: ${CLICKUP_TICKETING_CLOUD_CLIENT_SECRET} + GITHUB_TICKETING_CLOUD_CLIENT_ID: ${GITHUB_TICKETING_CLOUD_CLIENT_ID} + GITHUB_TICKETING_CLOUD_CLIENT_SECRET: ${GITHUB_TICKETING_CLOUD_CLIENT_SECRET} + GITLAB_TICKETING_CLOUD_CLIENT_ID: ${GITLAB_TICKETING_CLOUD_CLIENT_ID} + GITLAB_TICKETING_CLOUD_CLIENT_SECRET: ${GITLAB_TICKETING_CLOUD_CLIENT_SECRET} + GORGIAS_TICKETING_CLOUD_CLIENT_ID: ${GORGIAS_TICKETING_CLOUD_CLIENT_ID} + GORGIAS_TICKETING_CLOUD_CLIENT_SECRET: ${GORGIAS_TICKETING_CLOUD_CLIENT_SECRET} + GORGIAS_TICKETING_CLOUD_SUBDOMAIN: ${GORGIAS_TICKETING_CLOUD_SUBDOMAIN} + JIRA_TICKETING_CLOUD_CLIENT_ID: ${JIRA_TICKETING_CLOUD_CLIENT_ID} + JIRA_TICKETING_CLOUD_CLIENT_SECRET: ${JIRA_TICKETING_CLOUD_CLIENT_SECRET} + JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_ID: ${JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_ID} + JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_SECRET: ${JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_SECRET} + LINEAR_TICKETING_CLOUD_CLIENT_ID: ${LINEAR_TICKETING_CLOUD_CLIENT_ID} + LINEAR_TICKETING_CLOUD_CLIENT_SECRET: ${LINEAR_TICKETING_CLOUD_CLIENT_SECRET} + ACCELO_CRM_CLOUD_CLIENT_ID: ${ACCELO_CRM_CLOUD_CLIENT_ID} + ACCELO_CRM_CLOUD_CLIENT_SECRET: ${ACCELO_CRM_CLOUD_CLIENT_SECRET} + ACCELO_CRM_CLOUD_SUBDOMAIN: ${ACCELO_CRM_CLOUD_SUBDOMAIN} + CAPSULE_CRM_CLOUD_CLIENT_ID: ${CAPSULE_CRM_CLOUD_CLIENT_ID} + CAPSULE_CRM_CLOUD_CLIENT_SECRET: ${CAPSULE_CRM_CLOUD_CLIENT_SECRET} + CLOSE_CRM_CLOUD_CLIENT_ID: ${CLOSE_CRM_CLOUD_CLIENT_ID} + CLOSE_CRM_CLOUD_CLIENT_SECRET: ${CLOSE_CRM_CLOUD_CLIENT_SECRET} + COPPER_CRM_CLOUD_CLIENT_ID: ${COPPER_CRM_CLOUD_CLIENT_ID} + COPPER_CRM_CLOUD_CLIENT_SECRET: ${COPPER_CRM_CLOUD_CLIENT_SECRET} + KEAP_CRM_CLOUD_CLIENT_ID: ${KEAP_CRM_CLOUD_CLIENT_ID} + KEAP_CRM_CLOUD_CLIENT_SECRET: ${KEAP_CRM_CLOUD_CLIENT_SECRET} + TEAMLEADER_CRM_CLOUD_CLIENT_ID: ${TEAMLEADER_CRM_CLOUD_CLIENT_ID} + TEAMLEADER_CRM_CLOUD_CLIENT_SECRET: ${TEAMLEADER_CRM_CLOUD_CLIENT_SECRET} + TEAMWORK_CRM_CLOUD_CLIENT_ID: ${TEAMWORK_CRM_CLOUD_CLIENT_ID} + TEAMWORK_CRM_CLOUD_CLIENT_SECRET: ${TEAMWORK_CRM_CLOUD_CLIENT_SECRET} + AHA_TICKETING_CLOUD_CLIENT_ID: ${AHA_TICKETING_CLOUD_CLIENT_ID} + AHA_TICKETING_CLOUD_CLIENT_SECRET: ${AHA_TICKETING_CLOUD_CLIENT_SECRET} + AHA_TICKETING_CLOUD_SUBDOMAIN: ${AHA_TICKETING_CLOUD_SUBDOMAIN} + WRIKE_TICKETING_CLOUD_CLIENT_ID: ${WRIKE_TICKETING_CLOUD_CLIENT_ID} + WRIKE_TICKETING_CLOUD_CLIENT_SECRET: ${WRIKE_TICKETING_CLOUD_CLIENT_SECRET} + ASANA_TICKETING_CLOUD_CLIENT_ID: ${ASANA_TICKETING_CLOUD_CLIENT_ID} + ASANA_TICKETING_CLOUD_CLIENT_SECRET: ${ASANA_TICKETING_CLOUD_CLIENT_SECRET} + PENNYLANE_ACCOUNTING_CLOUD_CLIENT_ID: ${PENNYLANE_ACCOUNTING_CLOUD_CLIENT_ID} + PENNYLANE_ACCOUNTING_CLOUD_CLIENT_SECRET: ${PENNYLANE_ACCOUNTING_CLOUD_CLIENT_SECRET} + FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_ID: ${FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_ID} + FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} + FREEAGENT_ACCOUNTING_CLOUD_CLIENT_ID: ${FREEAGENT_ACCOUNTING_CLOUD_CLIENT_ID} + FREEAGENT_ACCOUNTING_CLOUD_CLIENT_SECRET: ${FREEAGENT_ACCOUNTING_CLOUD_CLIENT_SECRET} + SAGE_ACCOUNTING_CLOUD_CLIENT_ID: ${SAGE_ACCOUNTING_CLOUD_CLIENT_ID} + SAGE_ACCOUNTING_CLOUD_CLIENT_SECRET: ${SAGE_ACCOUNTING_CLOUD_CLIENT_SECRET} + MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_ID: ${MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_ID} + MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_SECRET: ${MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_SECRET} + QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_ID: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_ID} + QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} + WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID} + WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET} + GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + + restart: unless-stopped ports: - 3000:3000 depends_on: - postgres: - condition: service_healthy + postgres: + condition: service_healthy networks: - backend volumes: @@ -126,8 +123,8 @@ services: test: ["CMD", "curl", "-f", "http://localhost:3000/"] interval: 10s timeout: 5s - retries: 1000 # Try launching the API service as long as possible. Required for other services to start - + retries: 1000 # Try launching the API service as long as possible. Required for other services to start + redis: image: valkey/valkey:7.2-alpine container_name: "Redis" @@ -137,7 +134,7 @@ services: - ./redis-data:/data networks: - backend - + webapp-nextjs: build: dockerfile: ./apps/client-ts/Dockerfile.dev @@ -154,8 +151,7 @@ services: NEXT_PUBLIC_STYTCH_PROJECT_ENV: ${NEXT_PUBLIC_STYTCH_PROJECT_ENV} NEXT_PUBLIC_MAGIC_LINK_DOMAIN: ${NEXT_PUBLIC_MAGIC_LINK_DOMAIN} NEXT_PUBLIC_WEBAPP_DOMAIN: ${NEXT_PUBLIC_WEBAPP_DOMAIN} - restart: - unless-stopped + restart: unless-stopped ports: - 80:8090 depends_on: @@ -167,15 +163,14 @@ services: networks: - backend - frontend - + magic-link-frontend: build: dockerfile: ./apps/magic-link/Dockerfile.dev context: ./ args: VITE_BACKEND_DOMAIN: ${NEXT_PUBLIC_BACKEND_DOMAIN} - restart: - always + restart: always ports: - 81:5173 depends_on: @@ -187,7 +182,6 @@ services: volumes: - .:/app - networks: frontend: backend: diff --git a/docker-compose.source.yml b/docker-compose.source.yml index 0f64c2933..d5181a88b 100644 --- a/docker-compose.source.yml +++ b/docker-compose.source.yml @@ -35,55 +35,55 @@ services: JWT_SECRET: ${JWT_SECRET} REDIS_HOST: redis ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY} - HUBSPOT_CRM_CLIENT_ID: ${HUBSPOT_CRM_CLIENT_ID} - HUBSPOT_CRM_CLIENT_SECRET: ${HUBSPOT_CRM_CLIENT_SECRET} - ATTIO_CRM_CLIENT_ID: ${ATTIO_CRM_CLIENT_ID} - ATTIO_CRM_CLIENT_SECRET: ${ATTIO_CRM_CLIENT_SECRET} - ZOHO_CRM_CLIENT_ID: ${ZOHO_CRM_CLIENT_ID} - ZOHO_CRM_CLIENT_SECRET: ${ZOHO_CRM_CLIENT_SECRET} - PIPEDRIVE_CRM_CLIENT_ID: ${PIPEDRIVE_CRM_CLIENT_ID} - PIPEDRIVE_CRM_CLIENT_SECRET: ${PIPEDRIVE_CRM_CLIENT_SECRET} - ZENDESK_CRM_CLIENT_ID: ${ZENDESK_CRM_CLIENT_ID} - ZENDESK_CRM_CLIENT_SECRET: ${ZENDESK_CRM_CLIENT_SECRET} + HUBSPOT_CRM_CLOUD_CLIENT_ID: ${HUBSPOT_CRM_CLOUD_CLIENT_ID} + HUBSPOT_CRM_CLOUD_CLIENT_SECRET: ${HUBSPOT_CRM_CLOUD_CLIENT_SECRET} + ATTIO_CRM_CLOUD_CLIENT_ID: ${ATTIO_CRM_CLOUD_CLIENT_ID} + ATTIO_CRM_CLOUD_CLIENT_SECRET: ${ATTIO_CRM_CLOUD_CLIENT_SECRET} + ZOHO_CRM_CLOUD_CLIENT_ID: ${ZOHO_CRM_CLOUD_CLIENT_ID} + ZOHO_CRM_CLOUD_CLIENT_SECRET: ${ZOHO_CRM_CLOUD_CLIENT_SECRET} + PIPEDRIVE_CRM_CLOUD_CLIENT_ID: ${PIPEDRIVE_CRM_CLOUD_CLIENT_ID} + PIPEDRIVE_CRM_CLOUD_CLIENT_SECRET: ${PIPEDRIVE_CRM_CLOUD_CLIENT_SECRET} + ZENDESK_CRM_CLOUD_CLIENT_ID: ${ZENDESK_CRM_CLOUD_CLIENT_ID} + ZENDESK_CRM_CLOUD_CLIENT_SECRET: ${ZENDESK_CRM_CLOUD_CLIENT_SECRET} OAUTH_REDIRECT_BASE: ${OAUTH_REDIRECT_BASE} - ZENDESK_TICKETING_CLIENT_ID: ${ZENDESK_TICKETING_CLIENT_ID} - ZENDESK_TICKETING_CLIENT_SECRET: ${ZENDESK_TICKETING_CLIENT_SECRET} - ZENDESK_TICKETING_SUBDOMAIN: ${ZENDESK_TICKETING_SUBDOMAIN} - FRONT_TICKETING_CLIENT_ID: ${FRONT_TICKETING_CLIENT_ID} - FRONT_TICKETING_CLIENT_SECRET: ${FRONT_TICKETING_CLIENT_SECRET} - CLICKUP_TICKETING_CLIENT_ID: ${CLICKUP_TICKETING_CLIENT_ID} - CLICKUP_TICKETING_CLIENT_SECRET: ${CLICKUP_TICKETING_CLIENT_SECRET} - GITHUB_TICKETING_CLIENT_ID: ${GITHUB_TICKETING_CLIENT_ID} - GITHUB_TICKETING_CLIENT_SECRET: ${GITHUB_TICKETING_CLIENT_SECRET} - GITLAB_TICKETING_CLIENT_ID: ${GITLAB_TICKETING_CLIENT_ID} - GITLAB_TICKETING_CLIENT_SECRET: ${GITLAB_TICKETING_CLIENT_SECRET} - GORGIAS_TICKETING_CLIENT_ID: ${GORGIAS_TICKETING_CLIENT_ID} - GORGIAS_TICKETING_CLIENT_SECRET: ${GORGIAS_TICKETING_CLIENT_SECRET} - GORGIAS_TICKETING_SUBDOMAIN: ${GORGIAS_TICKETING_SUBDOMAIN} - JIRA_TICKETING_CLIENT_ID: ${JIRA_TICKETING_CLIENT_ID} - JIRA_TICKETING_CLIENT_SECRET: ${JIRA_TICKETING_CLIENT_SECRET} - JIRA_SERVICE_MGMT_TICKETING_CLIENT_ID: ${JIRA_SERVICE_MGMT_TICKETING_CLIENT_ID} - JIRA_SERVICE_MGMT_TICKETING_CLIENT_SECRET: ${JIRA_SERVICE_MGMT_TICKETING_CLIENT_SECRET} - LINEAR_TICKETING_CLIENT_ID: ${LINEAR_TICKETING_CLIENT_ID} - LINEAR_TICKETING_CLIENT_SECRET: ${LINEAR_TICKETING_CLIENT_SECRET} - ACCELO_CRM_CLIENT_ID: ${ACCELO_CRM_CLIENT_ID} - ACCELO_CRM_CLIENT_SECRET: ${ACCELO_CRM_CLIENT_SECRET} - ACCELO_CRM_SUBDOMAIN: ${ACCELO_CRM_SUBDOMAIN} - CAPSULE_CRM_CLIENT_ID: ${CAPSULE_CRM_CLIENT_ID} - CAPSULE_CRM_CLIENT_SECRET: ${CAPSULE_CRM_CLIENT_SECRET} - CLOSE_CRM_CLIENT_ID: ${CLOSE_CRM_CLIENT_ID} - CLOSE_CRM_CLIENT_SECRET: ${CLOSE_CRM_CLIENT_SECRET} - COPPER_CRM_CLIENT_ID: ${COPPER_CRM_CLIENT_ID} - COPPER_CRM_CLIENT_SECRET: ${COPPER_CRM_CLIENT_SECRET} - KEAP_CRM_CLIENT_ID: ${KEAP_CRM_CLIENT_ID} - KEAP_CRM_CLIENT_SECRET: ${KEAP_CRM_CLIENT_SECRET} - TEAMLEADER_CRM_CLIENT_ID: ${TEAMLEADER_CRM_CLIENT_ID} - TEAMLEADER_CRM_CLIENT_SECRET: ${TEAMLEADER_CRM_CLIENT_SECRET} - TEAMWORK_CRM_CLIENT_ID: ${TEAMWORK_CRM_CLIENT_ID} - TEAMWORK_CRM_CLIENT_SECRET: ${TEAMWORK_CRM_CLIENT_SECRET} - AHA_TICKETING_CLIENT_ID: ${AHA_TICKETING_CLIENT_ID} - AHA_TICKETING_CLIENT_SECRET: ${AHA_TICKETING_CLIENT_SECRET} - AHA_TICKETING_SUBDOMAIN: ${AHA_TICKETING_SUBDOMAIN} + ZENDESK_TICKETING_CLOUD_CLIENT_ID: ${ZENDESK_TICKETING_CLOUD_CLIENT_ID} + ZENDESK_TICKETING_CLOUD_CLIENT_SECRET: ${ZENDESK_TICKETING_CLOUD_CLIENT_SECRET} + ZENDESK_TICKETING_CLOUD_SUBDOMAIN: ${ZENDESK_TICKETING_CLOUD_SUBDOMAIN} + FRONT_TICKETING_CLOUD_CLIENT_ID: ${FRONT_TICKETING_CLOUD_CLIENT_ID} + FRONT_TICKETING_CLOUD_CLIENT_SECRET: ${FRONT_TICKETING_CLOUD_CLIENT_SECRET} + CLICKUP_TICKETING_CLOUD_CLIENT_ID: ${CLICKUP_TICKETING_CLOUD_CLIENT_ID} + CLICKUP_TICKETING_CLOUD_CLIENT_SECRET: ${CLICKUP_TICKETING_CLOUD_CLIENT_SECRET} + GITHUB_TICKETING_CLOUD_CLIENT_ID: ${GITHUB_TICKETING_CLOUD_CLIENT_ID} + GITHUB_TICKETING_CLOUD_CLIENT_SECRET: ${GITHUB_TICKETING_CLOUD_CLIENT_SECRET} + GITLAB_TICKETING_CLOUD_CLIENT_ID: ${GITLAB_TICKETING_CLOUD_CLIENT_ID} + GITLAB_TICKETING_CLOUD_CLIENT_SECRET: ${GITLAB_TICKETING_CLOUD_CLIENT_SECRET} + GORGIAS_TICKETING_CLOUD_CLIENT_ID: ${GORGIAS_TICKETING_CLOUD_CLIENT_ID} + GORGIAS_TICKETING_CLOUD_CLIENT_SECRET: ${GORGIAS_TICKETING_CLOUD_CLIENT_SECRET} + GORGIAS_TICKETING_CLOUD_SUBDOMAIN: ${GORGIAS_TICKETING_CLOUD_SUBDOMAIN} + JIRA_TICKETING_CLOUD_CLIENT_ID: ${JIRA_TICKETING_CLOUD_CLIENT_ID} + JIRA_TICKETING_CLOUD_CLIENT_SECRET: ${JIRA_TICKETING_CLOUD_CLIENT_SECRET} + JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_ID: ${JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_ID} + JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_SECRET: ${JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_SECRET} + LINEAR_TICKETING_CLOUD_CLIENT_ID: ${LINEAR_TICKETING_CLOUD_CLIENT_ID} + LINEAR_TICKETING_CLOUD_CLIENT_SECRET: ${LINEAR_TICKETING_CLOUD_CLIENT_SECRET} + ACCELO_CRM_CLOUD_CLIENT_ID: ${ACCELO_CRM_CLOUD_CLIENT_ID} + ACCELO_CRM_CLOUD_CLIENT_SECRET: ${ACCELO_CRM_CLOUD_CLIENT_SECRET} + ACCELO_CRM_CLOUD_SUBDOMAIN: ${ACCELO_CRM_CLOUD_SUBDOMAIN} + CAPSULE_CRM_CLOUD_CLIENT_ID: ${CAPSULE_CRM_CLOUD_CLIENT_ID} + CAPSULE_CRM_CLOUD_CLIENT_SECRET: ${CAPSULE_CRM_CLOUD_CLIENT_SECRET} + CLOSE_CRM_CLOUD_CLIENT_ID: ${CLOSE_CRM_CLOUD_CLIENT_ID} + CLOSE_CRM_CLOUD_CLIENT_SECRET: ${CLOSE_CRM_CLOUD_CLIENT_SECRET} + COPPER_CRM_CLOUD_CLIENT_ID: ${COPPER_CRM_CLOUD_CLIENT_ID} + COPPER_CRM_CLOUD_CLIENT_SECRET: ${COPPER_CRM_CLOUD_CLIENT_SECRET} + KEAP_CRM_CLOUD_CLIENT_ID: ${KEAP_CRM_CLOUD_CLIENT_ID} + KEAP_CRM_CLOUD_CLIENT_SECRET: ${KEAP_CRM_CLOUD_CLIENT_SECRET} + TEAMLEADER_CRM_CLOUD_CLIENT_ID: ${TEAMLEADER_CRM_CLOUD_CLIENT_ID} + TEAMLEADER_CRM_CLOUD_CLIENT_SECRET: ${TEAMLEADER_CRM_CLOUD_CLIENT_SECRET} + TEAMWORK_CRM_CLOUD_CLIENT_ID: ${TEAMWORK_CRM_CLOUD_CLIENT_ID} + TEAMWORK_CRM_CLOUD_CLIENT_SECRET: ${TEAMWORK_CRM_CLOUD_CLIENT_SECRET} + AHA_TICKETING_CLOUD_CLIENT_ID: ${AHA_TICKETING_CLOUD_CLIENT_ID} + AHA_TICKETING_CLOUD_CLIENT_SECRET: ${AHA_TICKETING_CLOUD_CLIENT_SECRET} + AHA_TICKETING_CLOUD_SUBDOMAIN: ${AHA_TICKETING_CLOUD_SUBDOMAIN} WRIKE_TICKETING_CLOUD_CLIENT_ID: ${WRIKE_TICKETING_CLOUD_CLIENT_ID} WRIKE_TICKETING_CLOUD_CLIENT_SECRET: ${WRIKE_TICKETING_CLOUD_CLIENT_SECRET} ASANA_TICKETING_CLOUD_CLIENT_ID: ${ASANA_TICKETING_CLOUD_CLIENT_ID} @@ -102,16 +102,13 @@ services: QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID} WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET} - GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - - - - + GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + restart: unless-stopped ports: - 3000:3000 diff --git a/docker-compose.yml b/docker-compose.yml index 4e500a7fa..13943c02f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ name: panora -version: '3.8' +version: "3.8" services: postgres: @@ -24,99 +24,95 @@ services: api: image: panoradotdev/backend-api:selfhosted - environment: - DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?ssl=false - DISTRIBUTION: ${DISTRIBUTION} - JWT_SECRET: ${JWT_SECRET} - REDIS_HOST: redis - ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY} - HUBSPOT_CRM_CLIENT_ID: ${HUBSPOT_CRM_CLIENT_ID} - HUBSPOT_CRM_CLIENT_SECRET: ${HUBSPOT_CRM_CLIENT_SECRET} - ATTIO_CRM_CLIENT_ID: ${ATTIO_CRM_CLIENT_ID} - ATTIO_CRM_CLIENT_SECRET: ${ATTIO_CRM_CLIENT_SECRET} - ZOHO_CRM_CLIENT_ID: ${ZOHO_CRM_CLIENT_ID} - ZOHO_CRM_CLIENT_SECRET: ${ZOHO_CRM_CLIENT_SECRET} - PIPEDRIVE_CRM_CLIENT_ID: ${PIPEDRIVE_CRM_CLIENT_ID} - PIPEDRIVE_CRM_CLIENT_SECRET: ${PIPEDRIVE_CRM_CLIENT_SECRET} - ZENDESK_CRM_CLIENT_ID: ${ZENDESK_CRM_CLIENT_ID} - ZENDESK_CRM_CLIENT_SECRET: ${ZENDESK_CRM_CLIENT_SECRET} - OAUTH_REDIRECT_BASE: ${OAUTH_REDIRECT_BASE} - ZENDESK_TICKETING_CLIENT_ID: ${ZENDESK_TICKETING_CLIENT_ID} - ZENDESK_TICKETING_CLIENT_SECRET: ${ZENDESK_TICKETING_CLIENT_SECRET} - ZENDESK_TICKETING_SUBDOMAIN: ${ZENDESK_TICKETING_SUBDOMAIN} - FRONT_TICKETING_CLIENT_ID: ${FRONT_TICKETING_CLIENT_ID} - FRONT_TICKETING_CLIENT_SECRET: ${FRONT_TICKETING_CLIENT_SECRET} - CLICKUP_TICKETING_CLIENT_ID: ${CLICKUP_TICKETING_CLIENT_ID} - CLICKUP_TICKETING_CLIENT_SECRET: ${CLICKUP_TICKETING_CLIENT_SECRET} - GITHUB_TICKETING_CLIENT_ID: ${GITHUB_TICKETING_CLIENT_ID} - GITHUB_TICKETING_CLIENT_SECRET: ${GITHUB_TICKETING_CLIENT_SECRET} - GITLAB_TICKETING_CLIENT_ID: ${GITLAB_TICKETING_CLIENT_ID} - GITLAB_TICKETING_CLIENT_SECRET: ${GITLAB_TICKETING_CLIENT_SECRET} - GORGIAS_TICKETING_CLIENT_ID: ${GORGIAS_TICKETING_CLIENT_ID} - GORGIAS_TICKETING_CLIENT_SECRET: ${GORGIAS_TICKETING_CLIENT_SECRET} - GORGIAS_TICKETING_SUBDOMAIN: ${GORGIAS_TICKETING_SUBDOMAIN} - JIRA_TICKETING_CLIENT_ID: ${JIRA_TICKETING_CLIENT_ID} - JIRA_TICKETING_CLIENT_SECRET: ${JIRA_TICKETING_CLIENT_SECRET} - JIRA_SERVICE_MGMT_TICKETING_CLIENT_ID: ${JIRA_SERVICE_MGMT_TICKETING_CLIENT_ID} - JIRA_SERVICE_MGMT_TICKETING_CLIENT_SECRET: ${JIRA_SERVICE_MGMT_TICKETING_CLIENT_SECRET} - LINEAR_TICKETING_CLIENT_ID: ${LINEAR_TICKETING_CLIENT_ID} - LINEAR_TICKETING_CLIENT_SECRET: ${LINEAR_TICKETING_CLIENT_SECRET} - ACCELO_CRM_CLIENT_ID: ${ACCELO_CRM_CLIENT_ID} - ACCELO_CRM_CLIENT_SECRET: ${ACCELO_CRM_CLIENT_SECRET} - ACCELO_CRM_SUBDOMAIN: ${ACCELO_CRM_SUBDOMAIN} - CAPSULE_CRM_CLIENT_ID: ${CAPSULE_CRM_CLIENT_ID} - CAPSULE_CRM_CLIENT_SECRET: ${CAPSULE_CRM_CLIENT_SECRET} - CLOSE_CRM_CLIENT_ID: ${CLOSE_CRM_CLIENT_ID} - CLOSE_CRM_CLIENT_SECRET: ${CLOSE_CRM_CLIENT_SECRET} - COPPER_CRM_CLIENT_ID: ${COPPER_CRM_CLIENT_ID} - COPPER_CRM_CLIENT_SECRET: ${COPPER_CRM_CLIENT_SECRET} - KEAP_CRM_CLIENT_ID: ${KEAP_CRM_CLIENT_ID} - KEAP_CRM_CLIENT_SECRET: ${KEAP_CRM_CLIENT_SECRET} - TEAMLEADER_CRM_CLIENT_ID: ${TEAMLEADER_CRM_CLIENT_ID} - TEAMLEADER_CRM_CLIENT_SECRET: ${TEAMLEADER_CRM_CLIENT_SECRET} - TEAMWORK_CRM_CLIENT_ID: ${TEAMWORK_CRM_CLIENT_ID} - TEAMWORK_CRM_CLIENT_SECRET: ${TEAMWORK_CRM_CLIENT_SECRET} - AHA_TICKETING_CLIENT_ID: ${AHA_TICKETING_CLIENT_ID} - AHA_TICKETING_CLIENT_SECRET: ${AHA_TICKETING_CLIENT_SECRET} - AHA_TICKETING_SUBDOMAIN: ${AHA_TICKETING_SUBDOMAIN} - WRIKE_TICKETING_CLOUD_CLIENT_ID: ${WRIKE_TICKETING_CLOUD_CLIENT_ID} - WRIKE_TICKETING_CLOUD_CLIENT_SECRET: ${WRIKE_TICKETING_CLOUD_CLIENT_SECRET} - ASANA_TICKETING_CLOUD_CLIENT_ID: ${ASANA_TICKETING_CLOUD_CLIENT_ID} - ASANA_TICKETING_CLOUD_CLIENT_SECRET: ${ASANA_TICKETING_CLOUD_CLIENT_SECRET} - PENNYLANE_ACCOUNTING_CLOUD_CLIENT_ID: ${PENNYLANE_ACCOUNTING_CLOUD_CLIENT_ID} - PENNYLANE_ACCOUNTING_CLOUD_CLIENT_SECRET: ${PENNYLANE_ACCOUNTING_CLOUD_CLIENT_SECRET} - FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_ID: ${FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_ID} - FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} - FREEAGENT_ACCOUNTING_CLOUD_CLIENT_ID: ${FREEAGENT_ACCOUNTING_CLOUD_CLIENT_ID} - FREEAGENT_ACCOUNTING_CLOUD_CLIENT_SECRET: ${FREEAGENT_ACCOUNTING_CLOUD_CLIENT_SECRET} - SAGE_ACCOUNTING_CLOUD_CLIENT_ID: ${SAGE_ACCOUNTING_CLOUD_CLIENT_ID} - SAGE_ACCOUNTING_CLOUD_CLIENT_SECRET: ${SAGE_ACCOUNTING_CLOUD_CLIENT_SECRET} - MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_ID: ${MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_ID} - MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_SECRET: ${MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_SECRET} - QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_ID: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_ID} - QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} - WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID} - WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET} - GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${GETRESPONSE_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${MAILCHIMP_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_ID: ${PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_ID} - PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET: ${PODIUM_MARKETING_AUTOMATION_CLOUD_CLIENT_SECRET} - - - - - restart: - unless-stopped + environment: + DATABASE_URL: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?ssl=false + DISTRIBUTION: ${DISTRIBUTION} + JWT_SECRET: ${JWT_SECRET} + REDIS_HOST: redis + ENCRYPT_CRYPTO_SECRET_KEY: ${ENCRYPT_CRYPTO_SECRET_KEY} + HUBSPOT_CRM_CLOUD_CLIENT_ID: ${HUBSPOT_CRM_CLOUD_CLIENT_ID} + HUBSPOT_CRM_CLOUD_CLIENT_SECRET: ${HUBSPOT_CRM_CLOUD_CLIENT_SECRET} + ATTIO_CRM_CLOUD_CLIENT_ID: ${ATTIO_CRM_CLOUD_CLIENT_ID} + ATTIO_CRM_CLOUD_CLIENT_SECRET: ${ATTIO_CRM_CLOUD_CLIENT_SECRET} + ZOHO_CRM_CLOUD_CLIENT_ID: ${ZOHO_CRM_CLOUD_CLIENT_ID} + ZOHO_CRM_CLOUD_CLIENT_SECRET: ${ZOHO_CRM_CLOUD_CLIENT_SECRET} + PIPEDRIVE_CRM_CLOUD_CLIENT_ID: ${PIPEDRIVE_CRM_CLOUD_CLIENT_ID} + PIPEDRIVE_CRM_CLOUD_CLIENT_SECRET: ${PIPEDRIVE_CRM_CLOUD_CLIENT_SECRET} + ZENDESK_CRM_CLOUD_CLIENT_ID: ${ZENDESK_CRM_CLOUD_CLIENT_ID} + ZENDESK_CRM_CLOUD_CLIENT_SECRET: ${ZENDESK_CRM_CLOUD_CLIENT_SECRET} + OAUTH_REDIRECT_BASE: ${OAUTH_REDIRECT_BASE} + ZENDESK_TICKETING_CLOUD_CLIENT_ID: ${ZENDESK_TICKETING_CLOUD_CLIENT_ID} + ZENDESK_TICKETING_CLOUD_CLIENT_SECRET: ${ZENDESK_TICKETING_CLOUD_CLIENT_SECRET} + ZENDESK_TICKETING_CLOUD_SUBDOMAIN: ${ZENDESK_TICKETING_CLOUD_SUBDOMAIN} + FRONT_TICKETING_CLOUD_CLIENT_ID: ${FRONT_TICKETING_CLOUD_CLIENT_ID} + FRONT_TICKETING_CLOUD_CLIENT_SECRET: ${FRONT_TICKETING_CLOUD_CLIENT_SECRET} + CLICKUP_TICKETING_CLOUD_CLIENT_ID: ${CLICKUP_TICKETING_CLOUD_CLIENT_ID} + CLICKUP_TICKETING_CLOUD_CLIENT_SECRET: ${CLICKUP_TICKETING_CLOUD_CLIENT_SECRET} + GITHUB_TICKETING_CLOUD_CLIENT_ID: ${GITHUB_TICKETING_CLOUD_CLIENT_ID} + GITHUB_TICKETING_CLOUD_CLIENT_SECRET: ${GITHUB_TICKETING_CLOUD_CLIENT_SECRET} + GITLAB_TICKETING_CLOUD_CLIENT_ID: ${GITLAB_TICKETING_CLOUD_CLIENT_ID} + GITLAB_TICKETING_CLOUD_CLIENT_SECRET: ${GITLAB_TICKETING_CLOUD_CLIENT_SECRET} + GORGIAS_TICKETING_CLOUD_CLIENT_ID: ${GORGIAS_TICKETING_CLOUD_CLIENT_ID} + GORGIAS_TICKETING_CLOUD_CLIENT_SECRET: ${GORGIAS_TICKETING_CLOUD_CLIENT_SECRET} + GORGIAS_TICKETING_CLOUD_SUBDOMAIN: ${GORGIAS_TICKETING_CLOUD_SUBDOMAIN} + JIRA_TICKETING_CLOUD_CLIENT_ID: ${JIRA_TICKETING_CLOUD_CLIENT_ID} + JIRA_TICKETING_CLOUD_CLIENT_SECRET: ${JIRA_TICKETING_CLOUD_CLIENT_SECRET} + JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_ID: ${JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_ID} + JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_SECRET: ${JIRA_SERVICEMGMT_TICKETING_CLOUD_CLIENT_SECRET} + LINEAR_TICKETING_CLOUD_CLIENT_ID: ${LINEAR_TICKETING_CLOUD_CLIENT_ID} + LINEAR_TICKETING_CLOUD_CLIENT_SECRET: ${LINEAR_TICKETING_CLOUD_CLIENT_SECRET} + ACCELO_CRM_CLOUD_CLIENT_ID: ${ACCELO_CRM_CLOUD_CLIENT_ID} + ACCELO_CRM_CLOUD_CLIENT_SECRET: ${ACCELO_CRM_CLOUD_CLIENT_SECRET} + ACCELO_CRM_CLOUD_SUBDOMAIN: ${ACCELO_CRM_CLOUD_SUBDOMAIN} + CAPSULE_CRM_CLOUD_CLIENT_ID: ${CAPSULE_CRM_CLOUD_CLIENT_ID} + CAPSULE_CRM_CLOUD_CLIENT_SECRET: ${CAPSULE_CRM_CLOUD_CLIENT_SECRET} + CLOSE_CRM_CLOUD_CLIENT_ID: ${CLOSE_CRM_CLOUD_CLIENT_ID} + CLOSE_CRM_CLOUD_CLIENT_SECRET: ${CLOSE_CRM_CLOUD_CLIENT_SECRET} + COPPER_CRM_CLOUD_CLIENT_ID: ${COPPER_CRM_CLOUD_CLIENT_ID} + COPPER_CRM_CLOUD_CLIENT_SECRET: ${COPPER_CRM_CLOUD_CLIENT_SECRET} + KEAP_CRM_CLOUD_CLIENT_ID: ${KEAP_CRM_CLOUD_CLIENT_ID} + KEAP_CRM_CLOUD_CLIENT_SECRET: ${KEAP_CRM_CLOUD_CLIENT_SECRET} + TEAMLEADER_CRM_CLOUD_CLIENT_ID: ${TEAMLEADER_CRM_CLOUD_CLIENT_ID} + TEAMLEADER_CRM_CLOUD_CLIENT_SECRET: ${TEAMLEADER_CRM_CLOUD_CLIENT_SECRET} + TEAMWORK_CRM_CLOUD_CLIENT_ID: ${TEAMWORK_CRM_CLOUD_CLIENT_ID} + TEAMWORK_CRM_CLOUD_CLIENT_SECRET: ${TEAMWORK_CRM_CLOUD_CLIENT_SECRET} + AHA_TICKETING_CLOUD_CLIENT_ID: ${AHA_TICKETING_CLOUD_CLIENT_ID} + AHA_TICKETING_CLOUD_CLIENT_SECRET: ${AHA_TICKETING_CLOUD_CLIENT_SECRET} + AHA_TICKETING_CLOUD_SUBDOMAIN: ${AHA_TICKETING_CLOUD_SUBDOMAIN} + WRIKE_TICKETING_CLOUD_CLIENT_ID: ${WRIKE_TICKETING_CLOUD_CLIENT_ID} + WRIKE_TICKETING_CLOUD_CLIENT_SECRET: ${WRIKE_TICKETING_CLOUD_CLIENT_SECRET} + ASANA_TICKETING_CLOUD_CLIENT_ID: ${ASANA_TICKETING_CLOUD_CLIENT_ID} + ASANA_TICKETING_CLOUD_CLIENT_SECRET: ${ASANA_TICKETING_CLOUD_CLIENT_SECRET} + PENNYLANE_ACCOUNTING_CLOUD_CLIENT_ID: ${PENNYLANE_ACCOUNTING_CLOUD_CLIENT_ID} + PENNYLANE_ACCOUNTING_CLOUD_CLIENT_SECRET: ${PENNYLANE_ACCOUNTING_CLOUD_CLIENT_SECRET} + FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_ID: ${FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_ID} + FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${FRESHBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} + FREEAGENT_ACCOUNTING_CLOUD_CLIENT_ID: ${FREEAGENT_ACCOUNTING_CLOUD_CLIENT_ID} + FREEAGENT_ACCOUNTING_CLOUD_CLIENT_SECRET: ${FREEAGENT_ACCOUNTING_CLOUD_CLIENT_SECRET} + SAGE_ACCOUNTING_CLOUD_CLIENT_ID: ${SAGE_ACCOUNTING_CLOUD_CLIENT_ID} + SAGE_ACCOUNTING_CLOUD_CLIENT_SECRET: ${SAGE_ACCOUNTING_CLOUD_CLIENT_SECRET} + MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_ID: ${MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_ID} + MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_SECRET: ${MONEYBIRD_ACCOUNTING_CLOUD_CLIENT_SECRET} + QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_ID: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_ID} + QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET: ${QUICKBOOKS_ACCOUNTING_CLOUD_CLIENT_SECRET} + WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_ID} + WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET: ${WAVE_FINANCIAL_ACCOUNTING_CLOUD_CLIENT_SECRET} + GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${GETRESPONSE_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${MAILCHIMP_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_ID: ${PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_ID} + PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET: ${PODIUM_MARKETINGAUTOMATION_CLOUD_CLIENT_SECRET} + + restart: unless-stopped ports: - 3000:3000 depends_on: - postgres: - condition: service_healthy + postgres: + condition: service_healthy networks: - backend - + redis: image: valkey/valkey:7.2-alpine container_name: "Redis" @@ -126,11 +122,10 @@ services: - ./redis-data:/data networks: - backend - + magic-link-frontend: image: panoradotdev/frontend-magic-links:selfhosted - restart: - always + restart: always ports: - 81:80 depends_on: @@ -138,7 +133,6 @@ services: networks: - backend - frontend - webapp-next: image: panoradotdev/frontend-webapp:selfhosted @@ -160,7 +154,6 @@ services: - backend - frontend - networks: frontend: backend: diff --git a/docs/marketing_automation/introduction.mdx b/docs/marketing_automation/introduction.mdx index 9656dc9f8..293c5acda 100644 --- a/docs/marketing_automation/introduction.mdx +++ b/docs/marketing_automation/introduction.mdx @@ -1,6 +1,6 @@ --- -title: 'Coming Soon' +title: "Coming Soon" description: "You're a bit early!" --- -## [Click here](https://tally.so/r/3Exrdl?integration_category=marketing_automation) to be notified once this feature is live! \ No newline at end of file +## [Click here](https://tally.so/r/3Exrdl?integration_category=marketingautomation) to be notified once this feature is live! diff --git a/docs/mint.json b/docs/mint.json index 1ab2e9762..eb4061497 100644 --- a/docs/mint.json +++ b/docs/mint.json @@ -56,7 +56,7 @@ }, { "name": "Marketing Automation", - "url": "marketing_automation" + "url": "marketingautomation" }, { "name": "Ticketing", @@ -116,7 +116,7 @@ { "group": "Marketing Automation", "pages": [ - "marketing_automation/introduction" + "marketingautomation/introduction" ] }, { diff --git a/docs/open-source/contributors.mdx b/docs/open-source/contributors.mdx index 27a73afb3..218ddb772 100644 --- a/docs/open-source/contributors.mdx +++ b/docs/open-source/contributors.mdx @@ -1,7 +1,7 @@ --- -title: 'Build a connector' -description: 'We welcome all contributions to Panora; from small UI enhancements to brand new integrations. We love seeing community members level up and give people power-ups!' -icon: 'star' +title: "Build a connector" +description: "We welcome all contributions to Panora; from small UI enhancements to brand new integrations. We love seeing community members level up and give people power-ups!" +icon: "star" --- ## Introduction @@ -14,10 +14,8 @@ We made a docker file that builds Panora from sources, specifically to help you - ```bash cp .env.example .env ``` - ```bash rm -rf node_modules .pnpm-store ./packages/api/dist ./packages/api/node_modules ./apps/webapp/node_modules @@ -53,9 +51,9 @@ First choose wisely which vertical the 3rd party belongs to among these: - ticketing - accounting - ats -- file_storage +- filestorage - hris -- marketing_automation +- marketingautomation For the sake of the guide, now on we'll consider adding a 3rd party belonging to the `crm` vertical. diff --git a/packages/api/src/@core/connections-strategies/connections-strategies.service.ts b/packages/api/src/@core/connections-strategies/connections-strategies.service.ts index 91cf06159..7ac191bae 100644 --- a/packages/api/src/@core/connections-strategies/connections-strategies.service.ts +++ b/packages/api/src/@core/connections-strategies/connections-strategies.service.ts @@ -9,6 +9,7 @@ import { extractVertical, needsSubdomain, } from '@panora/shared'; +import { SoftwareMode } from '@panora/shared/src/utils'; import { v4 as uuidv4 } from 'uuid'; export type OAuth = { @@ -190,23 +191,28 @@ export class ConnectionsStrategiesService { return data as AuthData; } - getEnvData(provider: string, vertical: string, authStrategy: AuthStrategy) { + getEnvData( + provider: string, + vertical: string, + authStrategy: AuthStrategy, + softwareMode?: SoftwareMode, + ) { let data: AuthData; switch (authStrategy) { case AuthStrategy.oauth2: data = { CLIENT_ID: this.configService.get( - `${provider.toUpperCase()}_${vertical.toUpperCase()}_CLIENT_ID`, + `${provider.toUpperCase()}_${vertical.toUpperCase()}_${softwareMode.toUpperCase()}_CLIENT_ID`, ), CLIENT_SECRET: this.configService.get( - `${provider.toUpperCase()}_${vertical.toUpperCase()}_CLIENT_SECRET`, + `${provider.toUpperCase()}_${vertical.toUpperCase()}_${softwareMode.toUpperCase()}_CLIENT_SECRET`, ), }; if (needsSubdomain(provider, vertical)) { data = { ...data, SUBDOMAIN: this.configService.get( - `${provider.toUpperCase()}_${vertical.toUpperCase()}_SUBDOMAIN`, + `${provider.toUpperCase()}_${vertical.toUpperCase()}_${softwareMode.toUpperCase()}_SUBDOMAIN`, ), }; } @@ -214,14 +220,14 @@ export class ConnectionsStrategiesService { case AuthStrategy.api_key: data = { API_KEY: this.configService.get( - `${provider.toUpperCase()}_${vertical.toUpperCase()}_API_KEY`, + `${provider.toUpperCase()}_${vertical.toUpperCase()}_${softwareMode.toUpperCase()}_API_KEY`, ), }; if (needsSubdomain(provider, vertical)) { data = { ...data, SUBDOMAIN: this.configService.get( - `${provider.toUpperCase()}_${vertical.toUpperCase()}_SUBDOMAIN`, + `${provider.toUpperCase()}_${vertical.toUpperCase()}_${softwareMode.toUpperCase()}_SUBDOMAIN`, ), }; } @@ -229,17 +235,17 @@ export class ConnectionsStrategiesService { case AuthStrategy.basic: data = { USERNAME: this.configService.get( - `${provider.toUpperCase()}_${vertical.toUpperCase()}_USERNAME`, + `${provider.toUpperCase()}_${vertical.toUpperCase()}_${softwareMode.toUpperCase()}_USERNAME`, ), SECRET: this.configService.get( - `${provider.toUpperCase()}_${vertical.toUpperCase()}_SECRET`, + `${provider.toUpperCase()}_${vertical.toUpperCase()}_${softwareMode.toUpperCase()}_SECRET`, ), }; if (needsSubdomain(provider, vertical)) { data = { ...data, SUBDOMAIN: this.configService.get( - `${provider.toUpperCase()}_${vertical.toUpperCase()}_SUBDOMAIN`, + `${provider.toUpperCase()}_${vertical.toUpperCase()}_${softwareMode.toUpperCase()}_SUBDOMAIN`, ), }; } @@ -251,7 +257,7 @@ export class ConnectionsStrategiesService { const isCustomCred = await this.isCustomCredentials(projectId, type); const provider = extractProvider(type); const vertical = extractVertical(type); - //const vertical = findProviderVertical(provider); + //TODO: extract sofwtaremode if (!vertical) throw new Error(`vertical not found for provider ${provider}`); const authStrategy = extractAuthMode(type); @@ -270,7 +276,12 @@ export class ConnectionsStrategiesService { ); } else { // type is of form = HUBSPOT_CRM_CLOUD_OAUTH so we must extract the parts - return this.getEnvData(provider, vertical, authStrategy); + return this.getEnvData( + provider, + vertical, + authStrategy, + SoftwareMode.cloud, + ); } } diff --git a/packages/api/src/@core/connections/connections.controller.ts b/packages/api/src/@core/connections/connections.controller.ts index 5fbacab2a..0a23a94b4 100644 --- a/packages/api/src/@core/connections/connections.controller.ts +++ b/packages/api/src/@core/connections/connections.controller.ts @@ -8,7 +8,7 @@ import { ApiOperation, ApiQuery, ApiResponse, ApiTags } from '@nestjs/swagger'; import { TicketingConnectionsService } from './ticketing/services/ticketing.connection.service'; import { ProviderVertical } from '@panora/shared'; import { AccountingConnectionsService } from './accounting/services/accounting.connection.service'; -import { MarketingAutomationConnectionsService } from './marketing_automation/services/marketing_automation.connection.service'; +import { MarketingAutomationConnectionsService } from './marketingautomation/services/marketingautomation.connection.service'; export type StateDataType = { projectId: string; diff --git a/packages/api/src/@core/connections/connections.module.ts b/packages/api/src/@core/connections/connections.module.ts index 3372594d3..bab08627d 100644 --- a/packages/api/src/@core/connections/connections.module.ts +++ b/packages/api/src/@core/connections/connections.module.ts @@ -5,7 +5,7 @@ import { LoggerService } from '@@core/logger/logger.service'; import { PrismaService } from '@@core/prisma/prisma.service'; import { TicketingConnectionModule } from './ticketing/ticketing.connection.module'; import { AccountingConnectionModule } from './accounting/accounting.connection.module'; -import { MarketingAutomationConnectionsModule } from './marketing_automation/marketing_automation.connection.module'; +import { MarketingAutomationConnectionsModule } from './marketingautomation/marketingautomation.connection.module'; @Module({ controllers: [ConnectionsController], diff --git a/packages/api/src/@core/connections/marketing_automation/marketing_automation.connection.module.ts b/packages/api/src/@core/connections/marketingautomation/marketingautomation.connection.module.ts similarity index 96% rename from packages/api/src/@core/connections/marketing_automation/marketing_automation.connection.module.ts rename to packages/api/src/@core/connections/marketingautomation/marketingautomation.connection.module.ts index 7195614a3..3c3ceaee3 100644 --- a/packages/api/src/@core/connections/marketing_automation/marketing_automation.connection.module.ts +++ b/packages/api/src/@core/connections/marketingautomation/marketingautomation.connection.module.ts @@ -6,7 +6,7 @@ import { WebhookModule } from '@@core/webhook/webhook.module'; import { EnvironmentService } from '@@core/environment/environment.service'; import { EncryptionService } from '@@core/encryption/encryption.service'; import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service'; -import { MarketingAutomationConnectionsService } from './services/marketing_automation.connection.service'; +import { MarketingAutomationConnectionsService } from './services/marketingautomation.connection.service'; import { ServiceRegistry } from './services/registry.service'; @Module({ diff --git a/packages/api/src/@core/connections/marketing_automation/services/getresponse/getresponse.service.ts b/packages/api/src/@core/connections/marketingautomation/services/getresponse/getresponse.service.ts similarity index 95% rename from packages/api/src/@core/connections/marketing_automation/services/getresponse/getresponse.service.ts rename to packages/api/src/@core/connections/marketingautomation/services/getresponse/getresponse.service.ts index 66ad6861f..6bd315886 100644 --- a/packages/api/src/@core/connections/marketing_automation/services/getresponse/getresponse.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/getresponse/getresponse.service.ts @@ -42,7 +42,7 @@ export class GetresponseConnectionService this.registry.registerService('getresponse', this); this.type = providerToType( 'getresponse', - 'marketing_automation', + 'marketingautomation', AuthStrategy.oauth2, ); } @@ -54,7 +54,7 @@ export class GetresponseConnectionService where: { id_linked_user: linkedUserId, provider_slug: 'getresponse', - vertical: 'marketing_automation', + vertical: 'marketingautomation', }, }); @@ -98,8 +98,7 @@ export class GetresponseConnectionService access_token: this.cryptoService.encrypt(data.access_token), refresh_token: this.cryptoService.encrypt(data.refresh_token), account_url: - providersConfig['marketing_automation']['getresponse'].urls - .apiUrl, + providersConfig['marketingautomation']['getresponse'].urls.apiUrl, expiration_timestamp: new Date( new Date().getTime() + Number(data.expires_in) * 1000, ), @@ -113,11 +112,10 @@ export class GetresponseConnectionService id_connection: uuidv4(), connection_token: connection_token, provider_slug: 'getresponse', - vertical: 'marketing_automation', + vertical: 'marketingautomation', token_type: 'oauth', account_url: - providersConfig['marketing_automation']['getresponse'].urls - .apiUrl, + providersConfig['marketingautomation']['getresponse'].urls.apiUrl, access_token: this.cryptoService.encrypt(data.access_token), refresh_token: this.cryptoService.encrypt(data.refresh_token), expiration_timestamp: new Date( diff --git a/packages/api/src/@core/connections/marketing_automation/services/mailchimp/mailchimp.service.ts b/packages/api/src/@core/connections/marketingautomation/services/mailchimp/mailchimp.service.ts similarity index 97% rename from packages/api/src/@core/connections/marketing_automation/services/mailchimp/mailchimp.service.ts rename to packages/api/src/@core/connections/marketingautomation/services/mailchimp/mailchimp.service.ts index b4d7945e0..b250aa7c5 100644 --- a/packages/api/src/@core/connections/marketing_automation/services/mailchimp/mailchimp.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/mailchimp/mailchimp.service.ts @@ -41,7 +41,7 @@ export class MailchimpConnectionService this.registry.registerService('mailchimp', this); this.type = providerToType( 'mailchimp', - 'marketing_automation', + 'marketingautomation', AuthStrategy.oauth2, ); } @@ -53,7 +53,7 @@ export class MailchimpConnectionService where: { id_linked_user: linkedUserId, provider_slug: 'mailchimp', - vertical: 'marketing_automation', + vertical: 'marketingautomation', }, }); @@ -121,7 +121,7 @@ export class MailchimpConnectionService id_connection: uuidv4(), connection_token: connection_token, provider_slug: 'mailchimp', - vertical: 'marketing_automation', + vertical: 'marketingautomation', token_type: 'oauth', account_url: server_url, access_token: this.cryptoService.encrypt(data.access_token), diff --git a/packages/api/src/@core/connections/marketing_automation/services/marketing_automation.connection.service.ts b/packages/api/src/@core/connections/marketingautomation/services/marketingautomation.connection.service.ts similarity index 100% rename from packages/api/src/@core/connections/marketing_automation/services/marketing_automation.connection.service.ts rename to packages/api/src/@core/connections/marketingautomation/services/marketingautomation.connection.service.ts diff --git a/packages/api/src/@core/connections/marketing_automation/services/podium/podium.service.ts b/packages/api/src/@core/connections/marketingautomation/services/podium/podium.service.ts similarity index 95% rename from packages/api/src/@core/connections/marketing_automation/services/podium/podium.service.ts rename to packages/api/src/@core/connections/marketingautomation/services/podium/podium.service.ts index ec948abde..91bc1105f 100644 --- a/packages/api/src/@core/connections/marketing_automation/services/podium/podium.service.ts +++ b/packages/api/src/@core/connections/marketingautomation/services/podium/podium.service.ts @@ -39,7 +39,7 @@ export class PodiumConnectionService this.registry.registerService('podium', this); this.type = providerToType( 'podium', - 'marketing_automation', + 'marketingautomation', AuthStrategy.oauth2, ); } @@ -50,7 +50,7 @@ export class PodiumConnectionService where: { id_linked_user: linkedUserId, provider_slug: 'podium', - vertical: 'marketing_automation', + vertical: 'marketingautomation', }, }); @@ -94,7 +94,7 @@ export class PodiumConnectionService access_token: this.cryptoService.encrypt(data.access_token), refresh_token: this.cryptoService.encrypt(data.refresh_token), account_url: - providersConfig['marketing_automation']['podium'].urls.apiUrl, + providersConfig['marketingautomation']['podium'].urls.apiUrl, expiration_timestamp: new Date( new Date().getTime() + 10 * 60 * 60 * 1000, ), @@ -108,10 +108,10 @@ export class PodiumConnectionService id_connection: uuidv4(), connection_token: connection_token, provider_slug: 'podium', - vertical: 'marketing_automation', + vertical: 'marketingautomation', token_type: 'oauth', account_url: - providersConfig['marketing_automation']['pdoum'].urls.apiUrl, + providersConfig['marketingautomation']['pdoum'].urls.apiUrl, access_token: this.cryptoService.encrypt(data.access_token), refresh_token: this.cryptoService.encrypt(data.refresh_token), expiration_timestamp: new Date( diff --git a/packages/api/src/@core/connections/marketing_automation/services/registry.service.ts b/packages/api/src/@core/connections/marketingautomation/services/registry.service.ts similarity index 100% rename from packages/api/src/@core/connections/marketing_automation/services/registry.service.ts rename to packages/api/src/@core/connections/marketingautomation/services/registry.service.ts diff --git a/packages/api/src/@core/connections/marketing_automation/types/index.ts b/packages/api/src/@core/connections/marketingautomation/types/index.ts similarity index 100% rename from packages/api/src/@core/connections/marketing_automation/types/index.ts rename to packages/api/src/@core/connections/marketingautomation/types/index.ts diff --git a/packages/api/src/@core/utils/types/index.ts b/packages/api/src/@core/utils/types/index.ts index 12fcac801..cea2594cd 100644 --- a/packages/api/src/@core/utils/types/index.ts +++ b/packages/api/src/@core/utils/types/index.ts @@ -2,9 +2,7 @@ import { CrmObject, UnifiedCrm } from '@crm/@utils/@types'; import { HrisObject } from '@hris/@types'; import { AtsObject, UnifiedAts } from '@ats/@types'; import { AccountingObject } from '@accounting/@types'; -import { MarketingAutomationObject } from 'src/marketing_automation/@types'; import { TicketingObject, UnifiedTicketing } from '@ticketing/@utils/@types'; -import { FileStorageObject } from 'src/file_storage/@types'; import { ApiExtraModels, ApiOkResponse, @@ -13,6 +11,8 @@ import { getSchemaPath, } from '@nestjs/swagger'; import { Type, applyDecorators } from '@nestjs/common'; +import { FileStorageObject } from '@filestorage/@types'; +import { MarketingAutomationObject } from '@marketingautomation/@types'; export type Unified = UnifiedCrm | UnifiedAts | UnifiedTicketing; export type UnifyReturnType = Unified | Unified[]; diff --git a/packages/api/src/app.module.ts b/packages/api/src/app.module.ts index e3f9b6f6b..44c814861 100644 --- a/packages/api/src/app.module.ts +++ b/packages/api/src/app.module.ts @@ -7,10 +7,10 @@ import { ScheduleModule } from '@nestjs/schedule'; import { TasksService } from './@core/tasks/tasks.service'; import { LoggerModule } from 'nestjs-pino'; import { HrisModule } from './hris/hris.module'; -import { MarketingAutomationModule } from './marketing_automation/marketing-automation.module'; +import { MarketingAutomationModule } from './marketingautomation/marketingautomation.module'; import { AtsModule } from './ats/ats.module'; import { AccountingModule } from './accounting/accounting.module'; -import { FileStorageModule } from './file_storage/file-storage.module'; +import { FileStorageModule } from './filestorage/filestorage.module'; import { SentryInterceptor, SentryModule } from '@ntegral/nestjs-sentry'; import { APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'; import { LoggerService } from '@@core/logger/logger.service'; diff --git a/packages/api/src/file_storage/@types/index.ts b/packages/api/src/filestorage/@types/index.ts similarity index 100% rename from packages/api/src/file_storage/@types/index.ts rename to packages/api/src/filestorage/@types/index.ts diff --git a/packages/api/src/file_storage/file-storage.module.ts b/packages/api/src/filestorage/filestorage.module.ts similarity index 100% rename from packages/api/src/file_storage/file-storage.module.ts rename to packages/api/src/filestorage/filestorage.module.ts diff --git a/packages/api/src/marketing_automation/@types/index.ts b/packages/api/src/marketingautomation/@types/index.ts similarity index 100% rename from packages/api/src/marketing_automation/@types/index.ts rename to packages/api/src/marketingautomation/@types/index.ts diff --git a/packages/api/src/marketing_automation/marketing-automation.module.ts b/packages/api/src/marketingautomation/marketingautomation.module.ts similarity index 100% rename from packages/api/src/marketing_automation/marketing-automation.module.ts rename to packages/api/src/marketingautomation/marketingautomation.module.ts diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 13ab06529..3bb8ac3a6 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -16,8 +16,8 @@ "@crm/*": ["src/crm/*"], "@hris/*": ["src/hris/*"], "@ticketing/*": ["src/ticketing/*"], - "@file-storage/*": ["src/file_storage/*"], - "@marketing-automation/*": ["src/marketing_automation/*"], + "@filestorage/*": ["src/filestorage/*"], + "@marketingautomation/*": ["src/marketingautomation/*"], "@ats/*": ["src/ats/*"], "@accounting/*": ["src/accounting/*"], }, diff --git a/packages/shared/src/enum.ts b/packages/shared/src/enum.ts index 9ce5de31a..2c62a7119 100644 --- a/packages/shared/src/enum.ts +++ b/packages/shared/src/enum.ts @@ -4,8 +4,8 @@ export enum ProviderVertical { ATS = 'ats', Accounting = 'accounting', Ticketing = 'ticketing', - MarketingAutomation = 'marketing_automation', - FileStorage = 'file_storage', + MarketingAutomation = 'marketingautomation', + FileStorage = 'filestorage', Unknown = 'unknown', } diff --git a/packages/shared/src/envConfig.ts b/packages/shared/src/envConfig.ts index 1f8acfd4a..aed096bd1 100644 --- a/packages/shared/src/envConfig.ts +++ b/packages/shared/src/envConfig.ts @@ -1,4 +1,4 @@ -import { AuthStrategy, providersConfig } from "./utils"; +import { AuthStrategy, providersConfig, SoftwareMode } from "./utils"; export type BasicAuthData = { USERNAME: string; @@ -38,7 +38,6 @@ export function extractVertical(type: string): string { return parts[1]; } -//TODO: handle software mode export function extractSoftwareMode(type: string): string { // Split the string at the first underscore const parts = type.split('_'); @@ -46,15 +45,15 @@ export function extractSoftwareMode(type: string): string { return parts[2]; } -//TODO: handle software mode -export function providerToType(providerName: string, vertical: string, authMode: AuthStrategy){ +export function providerToType(providerName: string, vertical: string, authMode: AuthStrategy, softwareMode?: SoftwareMode){ + const software = softwareMode ? softwareMode.toUpperCase() : SoftwareMode.cloud; switch(authMode){ case AuthStrategy.api_key: - return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_API` + return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_${software}_API_KEY` case AuthStrategy.oauth2: - return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_OAUTH` + return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_${software}_OAUTH` case AuthStrategy.basic: - return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_BASIC` + return `${providerName.toUpperCase()}_${vertical.toUpperCase()}_${software}_BASIC` } } @@ -66,7 +65,7 @@ export function extractAuthMode(type: string): AuthStrategy { switch(authMode){ case 'OAUTH': return AuthStrategy.oauth2; - case 'API': + case 'API_KEY': return AuthStrategy.api_key; case 'BASIC': return AuthStrategy.basic; diff --git a/packages/shared/src/providers.ts b/packages/shared/src/providers.ts index f2c3bc4f7..e16194d9f 100644 --- a/packages/shared/src/providers.ts +++ b/packages/shared/src/providers.ts @@ -8,8 +8,8 @@ export const HRIS_PROVIDERS = ['']; export const ATS_PROVIDERS = ['']; export const ACCOUNTING_PROVIDERS = ['']; export const TICKETING_PROVIDERS = ['zendesk', 'front', 'github', 'jira', 'gorgias']; -export const MARKETING_AUTOMATION_PROVIDERS = ['']; -export const FILE_STORAGE_PROVIDERS = ['']; +export const MARKETINGAUTOMATION_PROVIDERS = ['']; +export const FILESTORAGE_PROVIDERS = ['']; export function getProviderVertical(providerName: string): ProviderVertical { @@ -28,10 +28,10 @@ export function getProviderVertical(providerName: string): ProviderVertical { if (TICKETING_PROVIDERS.includes(providerName)) { return ProviderVertical.Ticketing; } - if (MARKETING_AUTOMATION_PROVIDERS.includes(providerName)) { + if (MARKETINGAUTOMATION_PROVIDERS.includes(providerName)) { return ProviderVertical.MarketingAutomation; } - if (FILE_STORAGE_PROVIDERS.includes(providerName)) { + if (FILESTORAGE_PROVIDERS.includes(providerName)) { return ProviderVertical.FileStorage; } return ProviderVertical.Unknown; diff --git a/packages/shared/src/utils.ts b/packages/shared/src/utils.ts index 2613f2a7f..5d6fdfe26 100644 --- a/packages/shared/src/utils.ts +++ b/packages/shared/src/utils.ts @@ -4,6 +4,10 @@ export enum AuthStrategy { basic } +export enum SoftwareMode { + cloud = "CLOUD", +} + export type ProviderConfig = { scopes: string; logoPath: string; @@ -876,7 +880,7 @@ export const providersConfig: ProvidersConfig = { authStrategy: AuthStrategy.oauth2 }, }, - 'marketing_automation': { + 'marketingautomation': { 'active_campaign': { scopes: '', urls: { From 24411273567b4f1d26648f894180a2e93912b1eb Mon Sep 17 00:00:00 2001 From: nael Date: Wed, 17 Apr 2024 09:32:36 +0200 Subject: [PATCH 2/3] :bug: Fixes --- .../connections/crm/crm.connection.module.ts | 2 - .../services/freshsales/freshsales.service.ts | 18 --- .../utils/types/original/original.crm.ts | 46 +------- .../api/src/crm/company/company.module.ts | 2 - .../crm/company/services/freshsales/index.ts | 104 ------------------ .../company/services/freshsales/mappers.ts | 33 ------ .../crm/company/services/freshsales/types.ts | 8 -- .../src/crm/company/types/mappingsTypes.ts | 6 - .../api/src/crm/contact/contact.module.ts | 2 - .../crm/contact/services/freshsales/index.ts | 104 ------------------ .../contact/services/freshsales/mappers.ts | 73 ------------ .../crm/contact/services/freshsales/types.ts | 37 ------- .../src/crm/contact/types/mappingsTypes.ts | 6 - packages/api/src/crm/deal/deal.module.ts | 2 - .../src/crm/deal/services/freshsales/index.ts | 100 ----------------- .../crm/deal/services/freshsales/mappers.ts | 31 ------ .../src/crm/deal/services/freshsales/types.ts | 37 ------- .../api/src/crm/deal/types/mappingsTypes.ts | 6 - .../src/crm/engagement/engagement.module.ts | 2 - .../engagement/services/freshsales/index.ts | 104 ------------------ .../engagement/services/freshsales/mappers.ts | 34 ------ .../engagement/services/freshsales/types.ts | 37 ------- .../src/crm/engagement/types/mappingsTypes.ts | 8 -- packages/api/src/crm/note/note.module.ts | 2 - .../src/crm/note/services/freshsales/index.ts | 101 ----------------- .../crm/note/services/freshsales/mappers.ts | 31 ------ .../src/crm/note/services/freshsales/types.ts | 37 ------- .../api/src/crm/note/types/mappingsTypes.ts | 6 - .../crm/stage/services/freshsales/index.ts | 101 ----------------- .../crm/stage/services/freshsales/mappers.ts | 31 ------ .../crm/stage/services/freshsales/types.ts | 37 ------- packages/api/src/crm/stage/stage.module.ts | 2 - .../api/src/crm/stage/types/mappingsTypes.ts | 6 - .../src/crm/task/services/freshsales/index.ts | 101 ----------------- .../crm/task/services/freshsales/mappers.ts | 31 ------ .../src/crm/task/services/freshsales/types.ts | 37 ------- packages/api/src/crm/task/task.module.ts | 2 - .../api/src/crm/task/types/mappingsTypes.ts | 6 - .../src/crm/user/services/freshsales/index.ts | 60 ---------- .../crm/user/services/freshsales/mappers.ts | 31 ------ .../src/crm/user/services/freshsales/types.ts | 37 ------- .../api/src/crm/user/types/mappingsTypes.ts | 6 - packages/api/src/crm/user/user.module.ts | 2 - packages/shared/src/enum.ts | 1 - packages/shared/src/providers.ts | 2 +- 45 files changed, 5 insertions(+), 1467 deletions(-) delete mode 100644 packages/api/src/@core/connections/crm/services/freshsales/freshsales.service.ts delete mode 100644 packages/api/src/crm/company/services/freshsales/index.ts delete mode 100644 packages/api/src/crm/company/services/freshsales/mappers.ts delete mode 100644 packages/api/src/crm/company/services/freshsales/types.ts delete mode 100644 packages/api/src/crm/contact/services/freshsales/index.ts delete mode 100644 packages/api/src/crm/contact/services/freshsales/mappers.ts delete mode 100644 packages/api/src/crm/contact/services/freshsales/types.ts delete mode 100644 packages/api/src/crm/deal/services/freshsales/index.ts delete mode 100644 packages/api/src/crm/deal/services/freshsales/mappers.ts delete mode 100644 packages/api/src/crm/deal/services/freshsales/types.ts delete mode 100644 packages/api/src/crm/engagement/services/freshsales/index.ts delete mode 100644 packages/api/src/crm/engagement/services/freshsales/mappers.ts delete mode 100644 packages/api/src/crm/engagement/services/freshsales/types.ts delete mode 100644 packages/api/src/crm/note/services/freshsales/index.ts delete mode 100644 packages/api/src/crm/note/services/freshsales/mappers.ts delete mode 100644 packages/api/src/crm/note/services/freshsales/types.ts delete mode 100644 packages/api/src/crm/stage/services/freshsales/index.ts delete mode 100644 packages/api/src/crm/stage/services/freshsales/mappers.ts delete mode 100644 packages/api/src/crm/stage/services/freshsales/types.ts delete mode 100644 packages/api/src/crm/task/services/freshsales/index.ts delete mode 100644 packages/api/src/crm/task/services/freshsales/mappers.ts delete mode 100644 packages/api/src/crm/task/services/freshsales/types.ts delete mode 100644 packages/api/src/crm/user/services/freshsales/index.ts delete mode 100644 packages/api/src/crm/user/services/freshsales/mappers.ts delete mode 100644 packages/api/src/crm/user/services/freshsales/types.ts diff --git a/packages/api/src/@core/connections/crm/crm.connection.module.ts b/packages/api/src/@core/connections/crm/crm.connection.module.ts index f8a5f2a97..9dc79933d 100644 --- a/packages/api/src/@core/connections/crm/crm.connection.module.ts +++ b/packages/api/src/@core/connections/crm/crm.connection.module.ts @@ -7,7 +7,6 @@ import { WebhookModule } from '@@core/webhook/webhook.module'; import { EnvironmentService } from '@@core/environment/environment.service'; import { EncryptionService } from '@@core/encryption/encryption.service'; import { ServiceRegistry } from './services/registry.service'; -import { FreshsalesConnectionService } from './services/freshsales/freshsales.service'; import { HubspotConnectionService } from './services/hubspot/hubspot.service'; import { ZohoConnectionService } from './services/zoho/zoho.service'; import { ZendeskConnectionService } from './services/zendesk/zendesk.service'; @@ -27,7 +26,6 @@ import { ConnectionsStrategiesService } from '@@core/connections-strategies/conn EncryptionService, ConnectionsStrategiesService, // PROVIDERS SERVICES - FreshsalesConnectionService, HubspotConnectionService, AttioConnectionService, ZohoConnectionService, diff --git a/packages/api/src/@core/connections/crm/services/freshsales/freshsales.service.ts b/packages/api/src/@core/connections/crm/services/freshsales/freshsales.service.ts deleted file mode 100644 index 5cb84aaa1..000000000 --- a/packages/api/src/@core/connections/crm/services/freshsales/freshsales.service.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Injectable } from '@nestjs/common'; -import { - CallbackParams, - ICrmConnectionService, - RefreshParams, -} from '../../types'; -import { connections as Connection } from '@prisma/client'; - -@Injectable() -export class FreshsalesConnectionService implements ICrmConnectionService { - //TODO: later - async handleCallback(opts: CallbackParams): Promise { - return; - } - async handleTokenRefresh(opts: RefreshParams) { - return; - } -} diff --git a/packages/api/src/@core/utils/types/original/original.crm.ts b/packages/api/src/@core/utils/types/original/original.crm.ts index edac1494d..c2ab3c5ed 100644 --- a/packages/api/src/@core/utils/types/original/original.crm.ts +++ b/packages/api/src/@core/utils/types/original/original.crm.ts @@ -1,12 +1,7 @@ -import { FreshsalesCompanyOutput } from '@crm/company/services/freshsales/types'; import { HubspotCompanyOutput } from '@crm/company/services/hubspot/types'; import { PipedriveCompanyOutput } from '@crm/company/services/pipedrive/types'; import { ZendeskCompanyOutput } from '@crm/company/services/zendesk/types'; import { ZohoCompanyOutput } from '@crm/company/services/zoho/types'; -import { - FreshsalesContactInput, - FreshsalesContactOutput, -} from '@crm/contact/services/freshsales/types'; import { HubspotContactInput, HubspotContactOutput, @@ -19,15 +14,11 @@ import { ZohoContactInput, ZohoContactOutput, } from '@crm/contact/services/zoho/types'; -import { FreshsalesDealOutput } from '@crm/deal/services/freshsales/types'; import { HubspotDealOutput } from '@crm/deal/services/hubspot/types'; import { PipedriveDealOutput } from '@crm/deal/services/pipedrive/types'; import { ZendeskDealOutput } from '@crm/deal/services/zendesk/types'; import { ZohoDealOutput } from '@crm/deal/services/zoho/types'; -import { - FreshsalesEngagementInput, - FreshsalesEngagementOutput, -} from '@crm/engagement/services/freshsales/types'; + import { HubspotEngagementInput, HubspotEngagementOutput, @@ -44,10 +35,7 @@ import { ZohoEngagementInput, ZohoEngagementOutput, } from '@crm/engagement/services/zoho/types'; -import { - FreshsalesNoteInput, - FreshsalesNoteOutput, -} from '@crm/note/services/freshsales/types'; + import { HubspotNoteInput, HubspotNoteOutput, @@ -61,10 +49,7 @@ import { ZendeskNoteOutput, } from '@crm/note/services/zendesk/types'; import { ZohoNoteInput, ZohoNoteOutput } from '@crm/note/services/zoho/types'; -import { - FreshsalesStageInput, - FreshsalesStageOutput, -} from '@crm/stage/services/freshsales/types'; + import { HubspotStageInput, HubspotStageOutput, @@ -81,10 +66,7 @@ import { ZohoStageInput, ZohoStageOutput, } from '@crm/stage/services/zoho/types'; -import { - FreshsalesTaskInput, - FreshsalesTaskOutput, -} from '@crm/task/services/freshsales/types'; + import { HubspotTaskInput, HubspotTaskOutput, @@ -98,10 +80,6 @@ import { ZendeskTaskOutput, } from '@crm/task/services/zendesk/types'; import { ZohoTaskInput, ZohoTaskOutput } from '@crm/task/services/zoho/types'; -import { - FreshsalesUserInput, - FreshsalesUserOutput, -} from '@crm/user/services/freshsales/types'; import { HubspotUserInput, HubspotUserOutput, @@ -124,7 +102,6 @@ import { /* contact */ export type OriginalContactInput = - | FreshsalesContactInput | HubspotContactInput | ZohoContactInput | ZendeskContactInput @@ -132,7 +109,6 @@ export type OriginalContactInput = /* deal */ export type OriginalDealInput = - | FreshsalesDealOutput | HubspotDealOutput | ZohoDealOutput | ZendeskDealOutput @@ -140,7 +116,6 @@ export type OriginalDealInput = /* company */ export type OriginalCompanyInput = - | FreshsalesCompanyOutput | HubspotCompanyOutput | ZohoCompanyOutput | ZendeskCompanyOutput @@ -148,7 +123,6 @@ export type OriginalCompanyInput = /* engagement */ export type OriginalEngagementInput = - | FreshsalesEngagementInput | HubspotEngagementInput | ZohoEngagementInput | ZendeskEngagementInput @@ -156,7 +130,6 @@ export type OriginalEngagementInput = /* note */ export type OriginalNoteInput = - | FreshsalesNoteInput | HubspotNoteInput | ZohoNoteInput | ZendeskNoteInput @@ -164,7 +137,6 @@ export type OriginalNoteInput = /* task */ export type OriginalTaskInput = - | FreshsalesTaskInput | HubspotTaskInput | ZohoTaskInput | ZendeskTaskInput @@ -172,7 +144,6 @@ export type OriginalTaskInput = /* stage */ export type OriginalStageInput = - | FreshsalesStageInput | HubspotStageInput | ZohoStageInput | ZendeskStageInput @@ -182,7 +153,6 @@ export type OriginalStageInput = /* user */ export type OriginalUserInput = - | FreshsalesUserInput | HubspotUserInput | ZohoUserInput | ZendeskUserInput @@ -201,7 +171,6 @@ export type CrmObjectInput = /* OUTPUT */ export type OriginalContactOutput = - | FreshsalesContactOutput | HubspotContactOutput | ZohoContactOutput | ZendeskContactOutput @@ -209,7 +178,6 @@ export type OriginalContactOutput = /* deal */ export type OriginalDealOutput = - | FreshsalesDealOutput | HubspotDealOutput | ZohoDealOutput | ZendeskDealOutput @@ -217,7 +185,6 @@ export type OriginalDealOutput = /* company */ export type OriginalCompanyOutput = - | FreshsalesCompanyOutput | HubspotCompanyOutput | ZohoCompanyOutput | ZendeskCompanyOutput @@ -225,7 +192,6 @@ export type OriginalCompanyOutput = /* engagement */ export type OriginalEngagementOutput = - | FreshsalesEngagementOutput | HubspotEngagementOutput | ZohoEngagementOutput | ZendeskEngagementOutput @@ -233,7 +199,6 @@ export type OriginalEngagementOutput = /* note */ export type OriginalNoteOutput = - | FreshsalesNoteOutput | HubspotNoteOutput | ZohoNoteOutput | ZendeskNoteOutput @@ -241,7 +206,6 @@ export type OriginalNoteOutput = /* task */ export type OriginalTaskOutput = - | FreshsalesTaskOutput | HubspotTaskOutput | ZohoTaskOutput | ZendeskTaskOutput @@ -249,7 +213,6 @@ export type OriginalTaskOutput = /* stage */ export type OriginalStageOutput = - | FreshsalesStageOutput | HubspotStageOutput | ZohoStageOutput | ZendeskStageOutput @@ -259,7 +222,6 @@ export type OriginalStageOutput = /* user */ export type OriginalUserOutput = - | FreshsalesUserOutput | HubspotUserOutput | ZohoUserOutput | ZendeskUserOutput diff --git a/packages/api/src/crm/company/company.module.ts b/packages/api/src/crm/company/company.module.ts index ffcb5019a..990390470 100644 --- a/packages/api/src/crm/company/company.module.ts +++ b/packages/api/src/crm/company/company.module.ts @@ -9,7 +9,6 @@ import { FieldMappingService } from '@@core/field-mapping/field-mapping.service' import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; -import { FreshsalesService } from './services/freshsales'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; @@ -33,7 +32,6 @@ import { AttioService } from './services/attio'; FieldMappingService, ServiceRegistry, /* PROVIDERS SERVICES */ - FreshsalesService, ZendeskService, ZohoService, PipedriveService, diff --git a/packages/api/src/crm/company/services/freshsales/index.ts b/packages/api/src/crm/company/services/freshsales/index.ts deleted file mode 100644 index 883ebaa55..000000000 --- a/packages/api/src/crm/company/services/freshsales/index.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { Injectable } from '@nestjs/common'; -import axios from 'axios'; -import { CrmObject } from '@crm/@utils/@types'; -import { PrismaService } from '@@core/prisma/prisma.service'; -import { LoggerService } from '@@core/logger/logger.service'; -import { ActionType, handleServiceError } from '@@core/utils/errors'; -import { EncryptionService } from '@@core/encryption/encryption.service'; -import { ApiResponse } from '@@core/utils/types'; -import { ICompanyService } from '@crm/company/types'; -import { ServiceRegistry } from '../registry.service'; -import { FreshsalesCompanyInput, FreshsalesCompanyOutput } from './types'; - -@Injectable() -export class FreshsalesService implements ICompanyService { - constructor( - private prisma: PrismaService, - private logger: LoggerService, - private cryptoService: EncryptionService, - private registry: ServiceRegistry, - ) { - this.logger.setContext( - CrmObject.company.toUpperCase() + ':' + FreshsalesService.name, - ); - this.registry.registerService('freshsales', this); - } - - async addCompany( - companyData: FreshsalesCompanyInput, - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const dataBody = { - company: companyData, - }; - const resp = await axios.post( - 'https://domain.freshsales.io/api/companys', - JSON.stringify(dataBody), - { - headers: { - Authorization: `Token token=${this.cryptoService.decrypt( - connection.access_token, - )}`, - 'Content-Type': 'application/json', - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales company created', - statusCode: 201, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.company, - ActionType.POST, - ); - } - } - - async syncCompanies( - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const resp = await axios.get( - `https://domain.freshsales.io/api/companys`, - { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales companys retrieved', - statusCode: 200, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.company, - ActionType.GET, - ); - } - } -} diff --git a/packages/api/src/crm/company/services/freshsales/mappers.ts b/packages/api/src/crm/company/services/freshsales/mappers.ts deleted file mode 100644 index 94ea2cf13..000000000 --- a/packages/api/src/crm/company/services/freshsales/mappers.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { ICompanyMapper } from '@crm/company/types'; -import { - UnifiedCompanyInput, - UnifiedCompanyOutput, -} from '@crm/company/types/model.unified'; -import { FreshsalesCompanyInput, FreshsalesCompanyOutput } from './types'; - -//TODO -export class FreshsalesCompanyMapper implements ICompanyMapper { - desunify(source: UnifiedCompanyInput): FreshsalesCompanyInput { - return; - } - - async unify( - source: FreshsalesCompanyOutput | FreshsalesCompanyOutput[], - ): Promise { - // Handling single FreshsalesCompanyOutput - if (!Array.isArray(source)) { - return this.mapSingleFreshsalesCompanyToUnified(source); - } - - // Handling array of FreshsalesCompanyOutput - return source.map((company) => - this.mapSingleFreshsalesCompanyToUnified(company), - ); - } - - private mapSingleFreshsalesCompanyToUnified( - company: FreshsalesCompanyOutput, - ): UnifiedCompanyOutput { - return; - } -} diff --git a/packages/api/src/crm/company/services/freshsales/types.ts b/packages/api/src/crm/company/services/freshsales/types.ts deleted file mode 100644 index c624a3cf8..000000000 --- a/packages/api/src/crm/company/services/freshsales/types.ts +++ /dev/null @@ -1,8 +0,0 @@ -export interface FreshsalesCompanyInput { - first_name: string; - last_name: string; - mobile_number: string | string[]; -} -export interface FreshsalesCompanyOutput { - id: string; -} diff --git a/packages/api/src/crm/company/types/mappingsTypes.ts b/packages/api/src/crm/company/types/mappingsTypes.ts index e4ff1c2c4..660920a6a 100644 --- a/packages/api/src/crm/company/types/mappingsTypes.ts +++ b/packages/api/src/crm/company/types/mappingsTypes.ts @@ -1,5 +1,4 @@ import { AttioCompanyMapper } from '../services/attio/mappers'; -import { FreshsalesCompanyMapper } from '../services/freshsales/mappers'; import { HubspotCompanyMapper } from '../services/hubspot/mappers'; import { PipedriveCompanyMapper } from '../services/pipedrive/mappers'; import { ZendeskCompanyMapper } from '../services/zendesk/mappers'; @@ -10,7 +9,6 @@ const zendeskCompanyMapper = new ZendeskCompanyMapper(); const zohoCompanyMapper = new ZohoCompanyMapper(); const pipedriveCompanyMapper = new PipedriveCompanyMapper(); const attioCompanyMapper = new AttioCompanyMapper(); -const freshsalesCompanyMapper = new FreshsalesCompanyMapper(); export const companyUnificationMapping = { hubspot: { @@ -29,10 +27,6 @@ export const companyUnificationMapping = { unify: zendeskCompanyMapper.unify.bind(zendeskCompanyMapper), desunify: zendeskCompanyMapper.desunify.bind(zendeskCompanyMapper), }, - freshsales: { - unify: freshsalesCompanyMapper.unify.bind(freshsalesCompanyMapper), - desunify: freshsalesCompanyMapper.desunify.bind(freshsalesCompanyMapper), - }, attio: { unify: attioCompanyMapper.unify.bind(attioCompanyMapper), desunify: attioCompanyMapper.desunify.bind(attioCompanyMapper), diff --git a/packages/api/src/crm/contact/contact.module.ts b/packages/api/src/crm/contact/contact.module.ts index ffe501c37..a8fae3a18 100644 --- a/packages/api/src/crm/contact/contact.module.ts +++ b/packages/api/src/crm/contact/contact.module.ts @@ -2,7 +2,6 @@ import { Module } from '@nestjs/common'; import { ContactService } from './services/contact.service'; import { ContactController } from './contact.controller'; import { PrismaService } from '@@core/prisma/prisma.service'; -import { FreshsalesService } from './services/freshsales'; import { ZendeskService } from './services/zendesk'; import { AttioService } from './services/attio'; import { ZohoService } from './services/zoho'; @@ -33,7 +32,6 @@ import { ServiceRegistry } from './services/registry.service'; EncryptionService, ServiceRegistry, /* PROVIDERS SERVICES */ - FreshsalesService, AttioService, ZendeskService, ZohoService, diff --git a/packages/api/src/crm/contact/services/freshsales/index.ts b/packages/api/src/crm/contact/services/freshsales/index.ts deleted file mode 100644 index a08a89a7f..000000000 --- a/packages/api/src/crm/contact/services/freshsales/index.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { Injectable } from '@nestjs/common'; -import axios from 'axios'; -import { CrmObject } from '@crm/@utils/@types'; -import { FreshsalesContactInput, FreshsalesContactOutput } from './types'; -import { PrismaService } from '@@core/prisma/prisma.service'; -import { LoggerService } from '@@core/logger/logger.service'; -import { ActionType, handleServiceError } from '@@core/utils/errors'; -import { EncryptionService } from '@@core/encryption/encryption.service'; -import { ApiResponse } from '@@core/utils/types'; -import { IContactService } from '@crm/contact/types'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class FreshsalesService implements IContactService { - constructor( - private prisma: PrismaService, - private logger: LoggerService, - private cryptoService: EncryptionService, - private registry: ServiceRegistry, - ) { - this.logger.setContext( - CrmObject.contact.toUpperCase() + ':' + FreshsalesService.name, - ); - this.registry.registerService('freshsales', this); - } - - async addContact( - contactData: FreshsalesContactInput, - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const dataBody = { - contact: contactData, - }; - const resp = await axios.post( - 'https://domain.freshsales.io/api/contacts', - JSON.stringify(dataBody), - { - headers: { - Authorization: `Token token=${this.cryptoService.decrypt( - connection.access_token, - )}`, - 'Content-Type': 'application/json', - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales contact created', - statusCode: 201, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.contact, - ActionType.POST, - ); - } - } - - async syncContacts( - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const resp = await axios.get( - `https://domain.freshsales.io/api/contacts`, - { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales contacts retrieved', - statusCode: 200, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.contact, - ActionType.GET, - ); - } - } -} diff --git a/packages/api/src/crm/contact/services/freshsales/mappers.ts b/packages/api/src/crm/contact/services/freshsales/mappers.ts deleted file mode 100644 index 3c0ab4fda..000000000 --- a/packages/api/src/crm/contact/services/freshsales/mappers.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { IContactMapper } from '@crm/contact/types'; -import { - UnifiedContactInput, - UnifiedContactOutput, -} from '@crm/contact/types/model.unified'; -import { Address } from '@crm/@utils/@types'; -import { FreshsalesContactInput, FreshsalesContactOutput } from './types'; - -//TODO -export class FreshsalesContactMapper implements IContactMapper { - desunify(source: UnifiedContactInput): FreshsalesContactInput { - // Assuming 'email_addresses' array contains at least one email and 'phone_numbers' array contains at least one phone number - const primaryEmail = source.email_addresses?.[0]?.email_address; - const primaryPhone = source.phone_numbers?.[0]?.phone_number; - - return { - first_name: source.first_name, - last_name: source.last_name, - mobile_number: primaryPhone, - }; - } - - async unify( - source: FreshsalesContactOutput | FreshsalesContactOutput[], - ): Promise { - // Handling single FreshsalesContactOutput - if (!Array.isArray(source)) { - return this.mapSingleFreshsalesContactToUnified(source); - } - - // Handling array of FreshsalesContactOutput - return source.map((contact) => - this.mapSingleFreshsalesContactToUnified(contact), - ); - } - - private mapSingleFreshsalesContactToUnified( - contact: FreshsalesContactOutput, - ): UnifiedContactOutput { - // Map email and phone details - const email_addresses = contact.email - ? [{ email_address: contact.email, email_address_type: 'primary' }] - : []; - const phone_numbers = []; - if (contact.work_number) { - phone_numbers.push({ - phone_number: contact.work_number, - phone_type: 'work', - }); - } - if (contact.mobile_number) { - phone_numbers.push({ - phone_number: contact.mobile_number, - phone_type: 'mobile', - }); - } - const address: Address = { - street_1: contact.address, - city: contact.city, - state: contact.state, - postal_code: contact.zipcode, - country: contact.country, - }; - - return { - first_name: contact.first_name, - last_name: contact.last_name, - email_addresses, - phone_numbers, - addresses: [address], - }; - } -} diff --git a/packages/api/src/crm/contact/services/freshsales/types.ts b/packages/api/src/crm/contact/services/freshsales/types.ts deleted file mode 100644 index 484e386ef..000000000 --- a/packages/api/src/crm/contact/services/freshsales/types.ts +++ /dev/null @@ -1,37 +0,0 @@ -export interface FreshsalesContactInput { - first_name: string; - last_name: string; - mobile_number: string | string[]; -} -export interface FreshsalesContactOutput { - id: number; - first_name: string; - last_name: string; - display_name: string; - avatar: string | null; - job_title: string | null; - city: string | null; - state: string | null; - zipcode: string | null; - country: string | null; - email: string | null; - time_zone: string | null; - work_number: string | null; - mobile_number: string; - address: string | null; - last_seen: string | null; - lead_score: number; - last_contacted: string | null; - open_deals_amount: string; - links: { - conversations: string; - activities: string; - }; - custom_field: Record; - updated_at: string; - keyword: string | null; - medium: string | null; - facebook: string | null; - twitter: string | null; - linkedin: string | null; -} diff --git a/packages/api/src/crm/contact/types/mappingsTypes.ts b/packages/api/src/crm/contact/types/mappingsTypes.ts index f1d209200..46d3b57d5 100644 --- a/packages/api/src/crm/contact/types/mappingsTypes.ts +++ b/packages/api/src/crm/contact/types/mappingsTypes.ts @@ -1,5 +1,4 @@ import { AttioContactMapper } from '../services/attio/mappers'; -import { FreshsalesContactMapper } from '../services/freshsales/mappers'; import { HubspotContactMapper } from '../services/hubspot/mappers'; import { PipedriveContactMapper } from '../services/pipedrive/mappers'; import { ZendeskContactMapper } from '../services/zendesk/mappers'; @@ -10,7 +9,6 @@ const zendeskContactMapper = new ZendeskContactMapper(); const zohoContactMapper = new ZohoContactMapper(); const pipedriveContactMapper = new PipedriveContactMapper(); const attioContactMapper = new AttioContactMapper(); -const freshsalesContactMapper = new FreshsalesContactMapper(); export const contactUnificationMapping = { hubspot: { @@ -29,10 +27,6 @@ export const contactUnificationMapping = { unify: zendeskContactMapper.unify.bind(zendeskContactMapper), desunify: zendeskContactMapper.desunify.bind(zendeskContactMapper), }, - freshsales: { - unify: freshsalesContactMapper.unify.bind(freshsalesContactMapper), - desunify: freshsalesContactMapper.desunify.bind(freshsalesContactMapper), - }, attio: { unify: attioContactMapper.unify.bind(attioContactMapper), desunify: attioContactMapper.desunify.bind(attioContactMapper), diff --git a/packages/api/src/crm/deal/deal.module.ts b/packages/api/src/crm/deal/deal.module.ts index 38b94155f..5c3dbfd97 100644 --- a/packages/api/src/crm/deal/deal.module.ts +++ b/packages/api/src/crm/deal/deal.module.ts @@ -9,7 +9,6 @@ import { FieldMappingService } from '@@core/field-mapping/field-mapping.service' import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; -import { FreshsalesService } from './services/freshsales'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; @@ -32,7 +31,6 @@ import { ZohoService } from './services/zoho'; FieldMappingService, ServiceRegistry, /* PROVIDERS SERVICES */ - FreshsalesService, ZendeskService, ZohoService, PipedriveService, diff --git a/packages/api/src/crm/deal/services/freshsales/index.ts b/packages/api/src/crm/deal/services/freshsales/index.ts deleted file mode 100644 index f9bacc110..000000000 --- a/packages/api/src/crm/deal/services/freshsales/index.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { Injectable } from '@nestjs/common'; -import axios from 'axios'; -import { CrmObject } from '@crm/@utils/@types'; -import { PrismaService } from '@@core/prisma/prisma.service'; -import { LoggerService } from '@@core/logger/logger.service'; -import { ActionType, handleServiceError } from '@@core/utils/errors'; -import { EncryptionService } from '@@core/encryption/encryption.service'; -import { ApiResponse } from '@@core/utils/types'; -import { IDealService } from '@crm/deal/types'; -import { ServiceRegistry } from '../registry.service'; -import { FreshsalesDealInput, FreshsalesDealOutput } from './types'; -@Injectable() -export class FreshsalesService implements IDealService { - constructor( - private prisma: PrismaService, - private logger: LoggerService, - private cryptoService: EncryptionService, - private registry: ServiceRegistry, - ) { - this.logger.setContext( - CrmObject.deal.toUpperCase() + ':' + FreshsalesService.name, - ); - this.registry.registerService('freshsales', this); - } - - async addDeal( - dealData: FreshsalesDealInput, - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const dataBody = { - deal: dealData, - }; - const resp = await axios.post( - 'https://domain.freshsales.io/api/deals', - JSON.stringify(dataBody), - { - headers: { - Authorization: `Token token=${this.cryptoService.decrypt( - connection.access_token, - )}`, - 'Content-Type': 'application/json', - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales deal created', - statusCode: 201, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.deal, - ActionType.POST, - ); - } - } - - async syncDeals( - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const resp = await axios.get(`https://domain.freshsales.io/api/deals`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }); - return { - data: resp.data, - message: 'Freshsales deals retrieved', - statusCode: 200, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.deal, - ActionType.GET, - ); - } - } -} diff --git a/packages/api/src/crm/deal/services/freshsales/mappers.ts b/packages/api/src/crm/deal/services/freshsales/mappers.ts deleted file mode 100644 index c8629a711..000000000 --- a/packages/api/src/crm/deal/services/freshsales/mappers.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { IDealMapper } from '@crm/deal/types'; -import { - UnifiedDealInput, - UnifiedDealOutput, -} from '@crm/deal/types/model.unified'; -import { FreshsalesDealInput, FreshsalesDealOutput } from './types'; - -//TODO -export class FreshsalesDealMapper implements IDealMapper { - desunify(source: UnifiedDealInput): FreshsalesDealInput { - return; - } - - async unify( - source: FreshsalesDealOutput | FreshsalesDealOutput[], - ): Promise { - // Handling single FreshsalesDealOutput - if (!Array.isArray(source)) { - return this.mapSingleFreshsalesDealToUnified(source); - } - - // Handling array of FreshsalesDealOutput - return source.map((deal) => this.mapSingleFreshsalesDealToUnified(deal)); - } - - private mapSingleFreshsalesDealToUnified( - deal: FreshsalesDealOutput, - ): UnifiedDealOutput { - return; - } -} diff --git a/packages/api/src/crm/deal/services/freshsales/types.ts b/packages/api/src/crm/deal/services/freshsales/types.ts deleted file mode 100644 index 928d06fd8..000000000 --- a/packages/api/src/crm/deal/services/freshsales/types.ts +++ /dev/null @@ -1,37 +0,0 @@ -export interface FreshsalesDealInput { - first_name: string; - last_name: string; - mobile_number: string | string[]; -} -export interface FreshsalesDealOutput { - id: number; - first_name: string; - last_name: string; - display_name: string; - avatar: string | null; - job_title: string | null; - city: string | null; - state: string | null; - zipcode: string | null; - country: string | null; - email: string | null; - time_zone: string | null; - work_number: string | null; - mobile_number: string; - address: string | null; - last_seen: string | null; - lead_score: number; - last_contacted: string | null; - open_deals_amount: string; - links: { - conversations: string; - activities: string; - }; - custom_field: Record; - updated_at: string; - keyword: string | null; - medium: string | null; - facebook: string | null; - twitter: string | null; - linkedin: string | null; -} diff --git a/packages/api/src/crm/deal/types/mappingsTypes.ts b/packages/api/src/crm/deal/types/mappingsTypes.ts index f7fa38bd1..c665474e4 100644 --- a/packages/api/src/crm/deal/types/mappingsTypes.ts +++ b/packages/api/src/crm/deal/types/mappingsTypes.ts @@ -1,4 +1,3 @@ -import { FreshsalesDealMapper } from '../services/freshsales/mappers'; import { HubspotDealMapper } from '../services/hubspot/mappers'; import { PipedriveDealMapper } from '../services/pipedrive/mappers'; import { ZendeskDealMapper } from '../services/zendesk/mappers'; @@ -8,7 +7,6 @@ const hubspotDealMapper = new HubspotDealMapper(); const zendeskDealMapper = new ZendeskDealMapper(); const zohoDealMapper = new ZohoDealMapper(); const pipedriveDealMapper = new PipedriveDealMapper(); -const freshSalesDealMapper = new FreshsalesDealMapper(); export const dealUnificationMapping = { hubspot: { @@ -27,8 +25,4 @@ export const dealUnificationMapping = { unify: zendeskDealMapper.unify.bind(zendeskDealMapper), desunify: zendeskDealMapper.desunify.bind(zendeskDealMapper), }, - freshsales: { - unify: freshSalesDealMapper.unify.bind(freshSalesDealMapper), - desunify: freshSalesDealMapper.desunify.bind(freshSalesDealMapper), - }, }; diff --git a/packages/api/src/crm/engagement/engagement.module.ts b/packages/api/src/crm/engagement/engagement.module.ts index 768fdb196..d6b7ad081 100644 --- a/packages/api/src/crm/engagement/engagement.module.ts +++ b/packages/api/src/crm/engagement/engagement.module.ts @@ -9,7 +9,6 @@ import { FieldMappingService } from '@@core/field-mapping/field-mapping.service' import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; -import { FreshsalesService } from './services/freshsales'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; @@ -32,7 +31,6 @@ import { ZohoService } from './services/zoho'; FieldMappingService, ServiceRegistry, /* PROVIDERS SERVICES */ - FreshsalesService, ZendeskService, ZohoService, PipedriveService, diff --git a/packages/api/src/crm/engagement/services/freshsales/index.ts b/packages/api/src/crm/engagement/services/freshsales/index.ts deleted file mode 100644 index f130b4126..000000000 --- a/packages/api/src/crm/engagement/services/freshsales/index.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { Injectable } from '@nestjs/common'; -import axios from 'axios'; -import { CrmObject } from '@crm/@utils/@types'; -import { FreshsalesEngagementInput, FreshsalesEngagementOutput } from './types'; -import { PrismaService } from '@@core/prisma/prisma.service'; -import { LoggerService } from '@@core/logger/logger.service'; -import { ActionType, handleServiceError } from '@@core/utils/errors'; -import { EncryptionService } from '@@core/encryption/encryption.service'; -import { ApiResponse } from '@@core/utils/types'; -import { IEngagementService } from '@crm/engagement/types'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class FreshsalesService implements IEngagementService { - constructor( - private prisma: PrismaService, - private logger: LoggerService, - private cryptoService: EncryptionService, - private registry: ServiceRegistry, - ) { - this.logger.setContext( - CrmObject.engagement.toUpperCase() + ':' + FreshsalesService.name, - ); - this.registry.registerService('freshsales', this); - } - - async addEngagement( - engagementData: FreshsalesEngagementInput, - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const dataBody = { - engagement: engagementData, - }; - const resp = await axios.post( - 'https://domain.freshsales.io/api/engagements', - JSON.stringify(dataBody), - { - headers: { - Authorization: `Token token=${this.cryptoService.decrypt( - connection.access_token, - )}`, - 'Content-Type': 'application/json', - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales engagement created', - statusCode: 201, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.engagement, - ActionType.POST, - ); - } - } - - async syncEngagements( - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const resp = await axios.get( - `https://domain.freshsales.io/api/engagements`, - { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales engagements retrieved', - statusCode: 200, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.engagement, - ActionType.GET, - ); - } - } -} diff --git a/packages/api/src/crm/engagement/services/freshsales/mappers.ts b/packages/api/src/crm/engagement/services/freshsales/mappers.ts deleted file mode 100644 index bce3aa3ca..000000000 --- a/packages/api/src/crm/engagement/services/freshsales/mappers.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { IEngagementMapper } from '@crm/engagement/types'; -import { - UnifiedEngagementInput, - UnifiedEngagementOutput, -} from '@crm/engagement/types/model.unified'; -import { FreshsalesEngagementInput, FreshsalesEngagementOutput } from './types'; - -//TODO -export class FreshsalesEngagementMapper implements IEngagementMapper { - desunify(source: UnifiedEngagementInput): FreshsalesEngagementInput { - return; - } - - async unify( - source: FreshsalesEngagementOutput | FreshsalesEngagementOutput[], - engagement_type: string, - ): Promise { - // Handling single FreshsalesEngagementOutput - if (!Array.isArray(source)) { - return this.mapSingleFreshsalesEngagementToUnified(source); - } - - // Handling array of FreshsalesEngagementOutput - return source.map((engagement) => - this.mapSingleFreshsalesEngagementToUnified(engagement), - ); - } - - private mapSingleFreshsalesEngagementToUnified( - engagement: FreshsalesEngagementOutput, - ): UnifiedEngagementOutput { - return; - } -} diff --git a/packages/api/src/crm/engagement/services/freshsales/types.ts b/packages/api/src/crm/engagement/services/freshsales/types.ts deleted file mode 100644 index fce34f815..000000000 --- a/packages/api/src/crm/engagement/services/freshsales/types.ts +++ /dev/null @@ -1,37 +0,0 @@ -export interface FreshsalesEngagementInput { - first_name: string; - last_name: string; - mobile_number: string | string[]; -} -export interface FreshsalesEngagementOutput { - id: number; - first_name: string; - last_name: string; - display_name: string; - avatar: string | null; - job_title: string | null; - city: string | null; - state: string | null; - zipcode: string | null; - country: string | null; - email: string | null; - time_zone: string | null; - work_number: string | null; - mobile_number: string; - address: string | null; - last_seen: string | null; - lead_score: number; - last_contacted: string | null; - open_engagements_amount: string; - links: { - conversations: string; - activities: string; - }; - custom_field: Record; - updated_at: string; - keyword: string | null; - medium: string | null; - facebook: string | null; - twitter: string | null; - linkedin: string | null; -} diff --git a/packages/api/src/crm/engagement/types/mappingsTypes.ts b/packages/api/src/crm/engagement/types/mappingsTypes.ts index c12742de9..c59c8cf6f 100644 --- a/packages/api/src/crm/engagement/types/mappingsTypes.ts +++ b/packages/api/src/crm/engagement/types/mappingsTypes.ts @@ -1,4 +1,3 @@ -import { FreshsalesEngagementMapper } from '../services/freshsales/mappers'; import { HubspotEngagementMapper } from '../services/hubspot/mappers'; import { PipedriveEngagementMapper } from '../services/pipedrive/mappers'; import { ZendeskEngagementMapper } from '../services/zendesk/mappers'; @@ -8,7 +7,6 @@ const hubspotEngagementMapper = new HubspotEngagementMapper(); const zendeskEngagementMapper = new ZendeskEngagementMapper(); const zohoEngagementMapper = new ZohoEngagementMapper(); const pipedriveEngagementMapper = new PipedriveEngagementMapper(); -const freshSalesEngagementMapper = new FreshsalesEngagementMapper(); export const engagementUnificationMapping = { hubspot: { @@ -29,10 +27,4 @@ export const engagementUnificationMapping = { unify: zendeskEngagementMapper.unify.bind(zendeskEngagementMapper), desunify: zendeskEngagementMapper.desunify.bind(zendeskEngagementMapper), }, - freshsales: { - unify: freshSalesEngagementMapper.unify.bind(freshSalesEngagementMapper), - desunify: freshSalesEngagementMapper.desunify.bind( - freshSalesEngagementMapper, - ), - }, }; diff --git a/packages/api/src/crm/note/note.module.ts b/packages/api/src/crm/note/note.module.ts index 3480990c3..24db7f527 100644 --- a/packages/api/src/crm/note/note.module.ts +++ b/packages/api/src/crm/note/note.module.ts @@ -9,7 +9,6 @@ import { FieldMappingService } from '@@core/field-mapping/field-mapping.service' import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; -import { FreshsalesService } from './services/freshsales'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; @@ -32,7 +31,6 @@ import { ZohoService } from './services/zoho'; FieldMappingService, ServiceRegistry, /* PROVIDERS SERVICES */ - FreshsalesService, ZendeskService, ZohoService, PipedriveService, diff --git a/packages/api/src/crm/note/services/freshsales/index.ts b/packages/api/src/crm/note/services/freshsales/index.ts deleted file mode 100644 index 61b18df11..000000000 --- a/packages/api/src/crm/note/services/freshsales/index.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { Injectable } from '@nestjs/common'; -import axios from 'axios'; -import { CrmObject } from '@crm/@utils/@types'; -import { FreshsalesNoteInput, FreshsalesNoteOutput } from './types'; -import { PrismaService } from '@@core/prisma/prisma.service'; -import { LoggerService } from '@@core/logger/logger.service'; -import { ActionType, handleServiceError } from '@@core/utils/errors'; -import { EncryptionService } from '@@core/encryption/encryption.service'; -import { ApiResponse } from '@@core/utils/types'; -import { INoteService } from '@crm/note/types'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class FreshsalesService implements INoteService { - constructor( - private prisma: PrismaService, - private logger: LoggerService, - private cryptoService: EncryptionService, - private registry: ServiceRegistry, - ) { - this.logger.setContext( - CrmObject.note.toUpperCase() + ':' + FreshsalesService.name, - ); - this.registry.registerService('freshsales', this); - } - - async addNote( - noteData: FreshsalesNoteInput, - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const dataBody = { - note: noteData, - }; - const resp = await axios.post( - 'https://domain.freshsales.io/api/notes', - JSON.stringify(dataBody), - { - headers: { - Authorization: `Token token=${this.cryptoService.decrypt( - connection.access_token, - )}`, - 'Content-Type': 'application/json', - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales note created', - statusCode: 201, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.note, - ActionType.POST, - ); - } - } - - async syncNotes( - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const resp = await axios.get(`https://domain.freshsales.io/api/notes`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }); - return { - data: resp.data, - message: 'Freshsales notes retrieved', - statusCode: 200, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.note, - ActionType.GET, - ); - } - } -} diff --git a/packages/api/src/crm/note/services/freshsales/mappers.ts b/packages/api/src/crm/note/services/freshsales/mappers.ts deleted file mode 100644 index 3b2fd61bc..000000000 --- a/packages/api/src/crm/note/services/freshsales/mappers.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { INoteMapper } from '@crm/note/types'; -import { - UnifiedNoteInput, - UnifiedNoteOutput, -} from '@crm/note/types/model.unified'; -import { FreshsalesNoteInput, FreshsalesNoteOutput } from './types'; - -//TODO -export class FreshsalesNoteMapper implements INoteMapper { - desunify(source: UnifiedNoteInput): FreshsalesNoteInput { - return; - } - - async unify( - source: FreshsalesNoteOutput | FreshsalesNoteOutput[], - ): Promise { - // Handling single FreshsalesNoteOutput - if (!Array.isArray(source)) { - return this.mapSingleFreshsalesNoteToUnified(source); - } - - // Handling array of FreshsalesNoteOutput - return source.map((note) => this.mapSingleFreshsalesNoteToUnified(note)); - } - - private mapSingleFreshsalesNoteToUnified( - note: FreshsalesNoteOutput, - ): UnifiedNoteOutput { - return; - } -} diff --git a/packages/api/src/crm/note/services/freshsales/types.ts b/packages/api/src/crm/note/services/freshsales/types.ts deleted file mode 100644 index 79e110926..000000000 --- a/packages/api/src/crm/note/services/freshsales/types.ts +++ /dev/null @@ -1,37 +0,0 @@ -export interface FreshsalesNoteInput { - first_name: string; - last_name: string; - mobile_number: string | string[]; -} -export interface FreshsalesNoteOutput { - id: number; - first_name: string; - last_name: string; - display_name: string; - avatar: string | null; - job_title: string | null; - city: string | null; - state: string | null; - zipcode: string | null; - country: string | null; - email: string | null; - time_zone: string | null; - work_number: string | null; - mobile_number: string; - address: string | null; - last_seen: string | null; - lead_score: number; - last_contacted: string | null; - open_engagements_amount: string; - links: { - conversations: string; - activities: string; - }; - custom_field: Record; - updated_at: string; - keyword: string | null; - medium: string | null; - facebook: string | null; - twitter: string | null; - linkedin: string | null; -} diff --git a/packages/api/src/crm/note/types/mappingsTypes.ts b/packages/api/src/crm/note/types/mappingsTypes.ts index 243d1229d..dbed4456e 100644 --- a/packages/api/src/crm/note/types/mappingsTypes.ts +++ b/packages/api/src/crm/note/types/mappingsTypes.ts @@ -1,4 +1,3 @@ -import { FreshsalesNoteMapper } from '../services/freshsales/mappers'; import { HubspotNoteMapper } from '../services/hubspot/mappers'; import { PipedriveNoteMapper } from '../services/pipedrive/mappers'; import { ZendeskNoteMapper } from '../services/zendesk/mappers'; @@ -8,7 +7,6 @@ const hubspotNoteMapper = new HubspotNoteMapper(); const zendeskNoteMapper = new ZendeskNoteMapper(); const zohoNoteMapper = new ZohoNoteMapper(); const pipedriveNoteMapper = new PipedriveNoteMapper(); -const freshSalesNoteMapper = new FreshsalesNoteMapper(); export const noteUnificationMapping = { hubspot: { @@ -27,8 +25,4 @@ export const noteUnificationMapping = { unify: zendeskNoteMapper.unify.bind(zendeskNoteMapper), desunify: zendeskNoteMapper.desunify.bind(zendeskNoteMapper), }, - freshsales: { - unify: freshSalesNoteMapper.unify.bind(freshSalesNoteMapper), - desunify: freshSalesNoteMapper.desunify.bind(freshSalesNoteMapper), - }, }; diff --git a/packages/api/src/crm/stage/services/freshsales/index.ts b/packages/api/src/crm/stage/services/freshsales/index.ts deleted file mode 100644 index 67c3d1998..000000000 --- a/packages/api/src/crm/stage/services/freshsales/index.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { Injectable } from '@nestjs/common'; -import axios from 'axios'; -import { CrmObject } from '@crm/@utils/@types'; -import { FreshsalesStageInput, FreshsalesStageOutput } from './types'; -import { PrismaService } from '@@core/prisma/prisma.service'; -import { LoggerService } from '@@core/logger/logger.service'; -import { ActionType, handleServiceError } from '@@core/utils/errors'; -import { EncryptionService } from '@@core/encryption/encryption.service'; -import { ApiResponse } from '@@core/utils/types'; -import { IStageService } from '@crm/stage/types'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class FreshsalesService implements IStageService { - constructor( - private prisma: PrismaService, - private logger: LoggerService, - private cryptoService: EncryptionService, - private registry: ServiceRegistry, - ) { - this.logger.setContext( - CrmObject.stage.toUpperCase() + ':' + FreshsalesService.name, - ); - this.registry.registerService('freshsales', this); - } - - async addStage( - stageData: FreshsalesStageInput, - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const dataBody = { - stage: stageData, - }; - const resp = await axios.post( - 'https://domain.freshsales.io/api/stages', - JSON.stringify(dataBody), - { - headers: { - Authorization: `Token token=${this.cryptoService.decrypt( - connection.access_token, - )}`, - 'Content-Type': 'application/json', - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales stage created', - statusCode: 201, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.stage, - ActionType.POST, - ); - } - } - - async syncStages( - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const resp = await axios.get(`https://domain.freshsales.io/api/stages`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }); - return { - data: resp.data, - message: 'Freshsales stages retrieved', - statusCode: 200, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.stage, - ActionType.GET, - ); - } - } -} diff --git a/packages/api/src/crm/stage/services/freshsales/mappers.ts b/packages/api/src/crm/stage/services/freshsales/mappers.ts deleted file mode 100644 index e57ab399a..000000000 --- a/packages/api/src/crm/stage/services/freshsales/mappers.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { IStageMapper } from '@crm/stage/types'; -import { - UnifiedStageInput, - UnifiedStageOutput, -} from '@crm/stage/types/model.unified'; -import { FreshsalesStageInput, FreshsalesStageOutput } from './types'; - -//TODO -export class FreshsalesStageMapper implements IStageMapper { - desunify(source: UnifiedStageInput): FreshsalesStageInput { - return; - } - - unify( - source: FreshsalesStageOutput | FreshsalesStageOutput[], - ): UnifiedStageOutput | UnifiedStageOutput[] { - // Handling single FreshsalesStageOutput - if (!Array.isArray(source)) { - return this.mapSingleFreshsalesStageToUnified(source); - } - - // Handling array of FreshsalesStageOutput - return source.map((stage) => this.mapSingleFreshsalesStageToUnified(stage)); - } - - private mapSingleFreshsalesStageToUnified( - stage: FreshsalesStageOutput, - ): UnifiedStageOutput { - return; - } -} diff --git a/packages/api/src/crm/stage/services/freshsales/types.ts b/packages/api/src/crm/stage/services/freshsales/types.ts deleted file mode 100644 index b70dafe65..000000000 --- a/packages/api/src/crm/stage/services/freshsales/types.ts +++ /dev/null @@ -1,37 +0,0 @@ -export interface FreshsalesStageInput { - first_name: string; - last_name: string; - mobile_number: string | string[]; -} -export interface FreshsalesStageOutput { - id: number; - first_name: string; - last_name: string; - display_name: string; - avatar: string | null; - job_title: string | null; - city: string | null; - state: string | null; - zipcode: string | null; - country: string | null; - email: string | null; - time_zone: string | null; - work_number: string | null; - mobile_number: string; - address: string | null; - last_seen: string | null; - lead_score: number; - last_contacted: string | null; - open_engagements_amount: string; - links: { - conversations: string; - activities: string; - }; - custom_field: Record; - updated_at: string; - keyword: string | null; - medium: string | null; - facebook: string | null; - twitter: string | null; - linkedin: string | null; -} diff --git a/packages/api/src/crm/stage/stage.module.ts b/packages/api/src/crm/stage/stage.module.ts index 6b41bc360..6376d5286 100644 --- a/packages/api/src/crm/stage/stage.module.ts +++ b/packages/api/src/crm/stage/stage.module.ts @@ -9,7 +9,6 @@ import { FieldMappingService } from '@@core/field-mapping/field-mapping.service' import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; -import { FreshsalesService } from './services/freshsales'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; @@ -32,7 +31,6 @@ import { ZohoService } from './services/zoho'; FieldMappingService, ServiceRegistry, /* PROVIDERS SERVICES */ - FreshsalesService, ZendeskService, ZohoService, PipedriveService, diff --git a/packages/api/src/crm/stage/types/mappingsTypes.ts b/packages/api/src/crm/stage/types/mappingsTypes.ts index 73ab91b0f..cf9ca7ef1 100644 --- a/packages/api/src/crm/stage/types/mappingsTypes.ts +++ b/packages/api/src/crm/stage/types/mappingsTypes.ts @@ -1,4 +1,3 @@ -import { FreshsalesStageMapper } from '../services/freshsales/mappers'; import { HubspotStageMapper } from '../services/hubspot/mappers'; import { PipedriveStageMapper } from '../services/pipedrive/mappers'; import { ZendeskStageMapper } from '../services/zendesk/mappers'; @@ -8,7 +7,6 @@ const hubspotStageMapper = new HubspotStageMapper(); const zendeskStageMapper = new ZendeskStageMapper(); const zohoStageMapper = new ZohoStageMapper(); const pipedriveStageMapper = new PipedriveStageMapper(); -const freshSalesStageMapper = new FreshsalesStageMapper(); export const stageUnificationMapping = { hubspot: { @@ -27,8 +25,4 @@ export const stageUnificationMapping = { unify: zendeskStageMapper.unify.bind(zendeskStageMapper), desunify: zendeskStageMapper.desunify.bind(zendeskStageMapper), }, - freshsales: { - unify: freshSalesStageMapper.unify.bind(freshSalesStageMapper), - desunify: freshSalesStageMapper.desunify.bind(freshSalesStageMapper), - }, }; diff --git a/packages/api/src/crm/task/services/freshsales/index.ts b/packages/api/src/crm/task/services/freshsales/index.ts deleted file mode 100644 index e8658c167..000000000 --- a/packages/api/src/crm/task/services/freshsales/index.ts +++ /dev/null @@ -1,101 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { Injectable } from '@nestjs/common'; -import axios from 'axios'; -import { CrmObject } from '@crm/@utils/@types'; -import { FreshsalesTaskInput, FreshsalesTaskOutput } from './types'; -import { PrismaService } from '@@core/prisma/prisma.service'; -import { LoggerService } from '@@core/logger/logger.service'; -import { ActionType, handleServiceError } from '@@core/utils/errors'; -import { EncryptionService } from '@@core/encryption/encryption.service'; -import { ApiResponse } from '@@core/utils/types'; -import { ITaskService } from '@crm/task/types'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class FreshsalesService implements ITaskService { - constructor( - private prisma: PrismaService, - private logger: LoggerService, - private cryptoService: EncryptionService, - private registry: ServiceRegistry, - ) { - this.logger.setContext( - CrmObject.task.toUpperCase() + ':' + FreshsalesService.name, - ); - this.registry.registerService('freshsales', this); - } - - async addTask( - taskData: FreshsalesTaskInput, - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const dataBody = { - task: taskData, - }; - const resp = await axios.post( - 'https://domain.freshsales.io/api/tasks', - JSON.stringify(dataBody), - { - headers: { - Authorization: `Token token=${this.cryptoService.decrypt( - connection.access_token, - )}`, - 'Content-Type': 'application/json', - }, - }, - ); - return { - data: resp.data, - message: 'Freshsales task created', - statusCode: 201, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.task, - ActionType.POST, - ); - } - } - - async syncTasks( - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const resp = await axios.get(`https://domain.freshsales.io/api/tasks`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }); - return { - data: resp.data, - message: 'Freshsales tasks retrieved', - statusCode: 200, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.task, - ActionType.GET, - ); - } - } -} diff --git a/packages/api/src/crm/task/services/freshsales/mappers.ts b/packages/api/src/crm/task/services/freshsales/mappers.ts deleted file mode 100644 index f8b0a5f50..000000000 --- a/packages/api/src/crm/task/services/freshsales/mappers.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ITaskMapper } from '@crm/task/types'; -import { - UnifiedTaskInput, - UnifiedTaskOutput, -} from '@crm/task/types/model.unified'; -import { FreshsalesTaskInput, FreshsalesTaskOutput } from './types'; - -//TODO -export class FreshsalesTaskMapper implements ITaskMapper { - desunify(source: UnifiedTaskInput): FreshsalesTaskInput { - return; - } - - async unify( - source: FreshsalesTaskOutput | FreshsalesTaskOutput[], - ): Promise { - // Handling single FreshsalesTaskOutput - if (!Array.isArray(source)) { - return this.mapSingleFreshsalesTaskToUnified(source); - } - - // Handling array of FreshsalesTaskOutput - return source.map((task) => this.mapSingleFreshsalesTaskToUnified(task)); - } - - private mapSingleFreshsalesTaskToUnified( - task: FreshsalesTaskOutput, - ): UnifiedTaskOutput { - return; - } -} diff --git a/packages/api/src/crm/task/services/freshsales/types.ts b/packages/api/src/crm/task/services/freshsales/types.ts deleted file mode 100644 index 5b7a36afe..000000000 --- a/packages/api/src/crm/task/services/freshsales/types.ts +++ /dev/null @@ -1,37 +0,0 @@ -export interface FreshsalesTaskInput { - first_name: string; - last_name: string; - mobile_number: string | string[]; -} -export interface FreshsalesTaskOutput { - id: number; - first_name: string; - last_name: string; - display_name: string; - avatar: string | null; - job_title: string | null; - city: string | null; - state: string | null; - zipcode: string | null; - country: string | null; - email: string | null; - time_zone: string | null; - work_number: string | null; - mobile_number: string; - address: string | null; - last_seen: string | null; - lead_score: number; - last_contacted: string | null; - open_engagements_amount: string; - links: { - conversations: string; - activities: string; - }; - custom_field: Record; - updated_at: string; - keyword: string | null; - medium: string | null; - facebook: string | null; - twitter: string | null; - linkedin: string | null; -} diff --git a/packages/api/src/crm/task/task.module.ts b/packages/api/src/crm/task/task.module.ts index 084c6fdae..e30347cad 100644 --- a/packages/api/src/crm/task/task.module.ts +++ b/packages/api/src/crm/task/task.module.ts @@ -9,7 +9,6 @@ import { FieldMappingService } from '@@core/field-mapping/field-mapping.service' import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; -import { FreshsalesService } from './services/freshsales'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; @@ -32,7 +31,6 @@ import { ZohoService } from './services/zoho'; FieldMappingService, ServiceRegistry, /* PROVIDERS SERVICES */ - FreshsalesService, ZendeskService, ZohoService, PipedriveService, diff --git a/packages/api/src/crm/task/types/mappingsTypes.ts b/packages/api/src/crm/task/types/mappingsTypes.ts index 79896d95f..12c0fd786 100644 --- a/packages/api/src/crm/task/types/mappingsTypes.ts +++ b/packages/api/src/crm/task/types/mappingsTypes.ts @@ -1,4 +1,3 @@ -import { FreshsalesTaskMapper } from '../services/freshsales/mappers'; import { HubspotTaskMapper } from '../services/hubspot/mappers'; import { PipedriveTaskMapper } from '../services/pipedrive/mappers'; import { ZendeskTaskMapper } from '../services/zendesk/mappers'; @@ -8,7 +7,6 @@ const hubspotTaskMapper = new HubspotTaskMapper(); const zendeskTaskMapper = new ZendeskTaskMapper(); const zohoTaskMapper = new ZohoTaskMapper(); const pipedriveTaskMapper = new PipedriveTaskMapper(); -const freshSalesTaskMapper = new FreshsalesTaskMapper(); export const taskUnificationMapping = { hubspot: { @@ -27,8 +25,4 @@ export const taskUnificationMapping = { unify: zendeskTaskMapper.unify.bind(zendeskTaskMapper), desunify: zendeskTaskMapper.desunify.bind(zendeskTaskMapper), }, - freshsales: { - unify: freshSalesTaskMapper.unify.bind(freshSalesTaskMapper), - desunify: freshSalesTaskMapper.desunify.bind(freshSalesTaskMapper), - }, }; diff --git a/packages/api/src/crm/user/services/freshsales/index.ts b/packages/api/src/crm/user/services/freshsales/index.ts deleted file mode 100644 index 2fd9a3b88..000000000 --- a/packages/api/src/crm/user/services/freshsales/index.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { Injectable } from '@nestjs/common'; -import axios from 'axios'; -import { CrmObject } from '@crm/@utils/@types'; -import { FreshsalesUserOutput } from './types'; -import { PrismaService } from '@@core/prisma/prisma.service'; -import { LoggerService } from '@@core/logger/logger.service'; -import { ActionType, handleServiceError } from '@@core/utils/errors'; -import { EncryptionService } from '@@core/encryption/encryption.service'; -import { ApiResponse } from '@@core/utils/types'; -import { IUserService } from '@crm/user/types'; -import { ServiceRegistry } from '../registry.service'; - -@Injectable() -export class FreshsalesService implements IUserService { - constructor( - private prisma: PrismaService, - private logger: LoggerService, - private cryptoService: EncryptionService, - private registry: ServiceRegistry, - ) { - this.logger.setContext( - CrmObject.user.toUpperCase() + ':' + FreshsalesService.name, - ); - this.registry.registerService('freshsales', this); - } - - async syncUsers( - linkedUserId: string, - ): Promise> { - try { - const connection = await this.prisma.connections.findFirst({ - where: { - id_linked_user: linkedUserId, - }, - }); - const resp = await axios.get(`https://domain.freshsales.io/api/users`, { - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${this.cryptoService.decrypt( - connection.access_token, - )}`, - }, - }); - return { - data: resp.data, - message: 'Freshsales users retrieved', - statusCode: 200, - }; - } catch (error) { - handleServiceError( - error, - this.logger, - 'Freshsales', - CrmObject.user, - ActionType.GET, - ); - } - } -} diff --git a/packages/api/src/crm/user/services/freshsales/mappers.ts b/packages/api/src/crm/user/services/freshsales/mappers.ts deleted file mode 100644 index 3f4ebf77c..000000000 --- a/packages/api/src/crm/user/services/freshsales/mappers.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { IUserMapper } from '@crm/user/types'; -import { - UnifiedUserInput, - UnifiedUserOutput, -} from '@crm/user/types/model.unified'; -import { FreshsalesUserOutput, FreshsalesUserInput } from './types'; - -//TODO -export class FreshsalesUserMapper implements IUserMapper { - desunify(source: UnifiedUserInput): FreshsalesUserInput { - return; - } - - unify( - source: FreshsalesUserOutput | FreshsalesUserOutput[], - ): UnifiedUserOutput | UnifiedUserOutput[] { - // Handling single FreshsalesUserOutput - if (!Array.isArray(source)) { - return this.mapSingleFreshsalesUserToUnified(source); - } - - // Handling array of FreshsalesUserOutput - return source.map((user) => this.mapSingleFreshsalesUserToUnified(user)); - } - - private mapSingleFreshsalesUserToUnified( - user: FreshsalesUserOutput, - ): UnifiedUserOutput { - return; - } -} diff --git a/packages/api/src/crm/user/services/freshsales/types.ts b/packages/api/src/crm/user/services/freshsales/types.ts deleted file mode 100644 index 42639d25d..000000000 --- a/packages/api/src/crm/user/services/freshsales/types.ts +++ /dev/null @@ -1,37 +0,0 @@ -export interface FreshsalesUserInput { - first_name: string; - last_name: string; - mobile_number: string | string[]; -} -export interface FreshsalesUserOutput { - id: number; - first_name: string; - last_name: string; - display_name: string; - avatar: string | null; - job_title: string | null; - city: string | null; - state: string | null; - zipcode: string | null; - country: string | null; - email: string | null; - time_zone: string | null; - work_number: string | null; - mobile_number: string; - address: string | null; - last_seen: string | null; - lead_score: number; - last_contacted: string | null; - open_engagements_amount: string; - links: { - conversations: string; - activities: string; - }; - custom_field: Record; - updated_at: string; - keyword: string | null; - medium: string | null; - facebook: string | null; - twitter: string | null; - linkedin: string | null; -} diff --git a/packages/api/src/crm/user/types/mappingsTypes.ts b/packages/api/src/crm/user/types/mappingsTypes.ts index 5ef46eb52..df8a6ecbb 100644 --- a/packages/api/src/crm/user/types/mappingsTypes.ts +++ b/packages/api/src/crm/user/types/mappingsTypes.ts @@ -1,4 +1,3 @@ -import { FreshsalesUserMapper } from '../services/freshsales/mappers'; import { HubspotUserMapper } from '../services/hubspot/mappers'; import { PipedriveUserMapper } from '../services/pipedrive/mappers'; import { ZendeskUserMapper } from '../services/zendesk/mappers'; @@ -8,7 +7,6 @@ const hubspotUserMapper = new HubspotUserMapper(); const zendeskUserMapper = new ZendeskUserMapper(); const zohoUserMapper = new ZohoUserMapper(); const pipedriveUserMapper = new PipedriveUserMapper(); -const freshSalesUserMapper = new FreshsalesUserMapper(); export const userUnificationMapping = { hubspot: { @@ -27,8 +25,4 @@ export const userUnificationMapping = { unify: zendeskUserMapper.unify.bind(zendeskUserMapper), desunify: zendeskUserMapper.desunify.bind(zendeskUserMapper), }, - freshsales: { - unify: freshSalesUserMapper.unify.bind(freshSalesUserMapper), - desunify: freshSalesUserMapper.desunify.bind(freshSalesUserMapper), - }, }; diff --git a/packages/api/src/crm/user/user.module.ts b/packages/api/src/crm/user/user.module.ts index b38dc653e..5ddfd8b7e 100644 --- a/packages/api/src/crm/user/user.module.ts +++ b/packages/api/src/crm/user/user.module.ts @@ -9,7 +9,6 @@ import { FieldMappingService } from '@@core/field-mapping/field-mapping.service' import { PrismaService } from '@@core/prisma/prisma.service'; import { WebhookService } from '@@core/webhook/webhook.service'; import { BullModule } from '@nestjs/bull'; -import { FreshsalesService } from './services/freshsales'; import { HubspotService } from './services/hubspot'; import { PipedriveService } from './services/pipedrive'; import { ZendeskService } from './services/zendesk'; @@ -32,7 +31,6 @@ import { ZohoService } from './services/zoho'; FieldMappingService, ServiceRegistry, /* PROVIDERS SERVICES */ - FreshsalesService, ZendeskService, ZohoService, PipedriveService, diff --git a/packages/shared/src/enum.ts b/packages/shared/src/enum.ts index 2c62a7119..656eb63b4 100644 --- a/packages/shared/src/enum.ts +++ b/packages/shared/src/enum.ts @@ -14,7 +14,6 @@ export enum CrmProviders { ZENDESK = 'zendesk', HUBSPOT = 'hubspot', PIPEDRIVE = 'pipedrive', - FRESHSALES = 'freshsales', ATTIO = 'attio' } diff --git a/packages/shared/src/providers.ts b/packages/shared/src/providers.ts index e16194d9f..ec9859090 100644 --- a/packages/shared/src/providers.ts +++ b/packages/shared/src/providers.ts @@ -2,7 +2,7 @@ import { ProviderVertical } from "./enum"; export const categoriesVerticals = Object.values(ProviderVertical); -export const CRM_PROVIDERS = ['zoho', 'zendesk', 'hubspot', 'pipedrive', 'attio', 'freshsales']; +export const CRM_PROVIDERS = ['zoho', 'zendesk', 'hubspot', 'pipedrive', 'attio']; export const HRIS_PROVIDERS = ['']; export const ATS_PROVIDERS = ['']; From c9b996aecb38fb6650583304d7747416a180405e Mon Sep 17 00:00:00 2001 From: nael Date: Wed, 17 Apr 2024 09:37:53 +0200 Subject: [PATCH 3/3] :bug: Fix webapp stytch --- apps/client-ts/src/app/api-keys/layout.tsx | 3 ++- apps/client-ts/src/app/configuration/layout.tsx | 3 ++- apps/client-ts/src/app/connections/layout.tsx | 3 ++- apps/client-ts/src/app/dashboard/layout.tsx | 3 ++- apps/client-ts/src/app/events/layout.tsx | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/client-ts/src/app/api-keys/layout.tsx b/apps/client-ts/src/app/api-keys/layout.tsx index 0d7de2988..c71e65eb4 100644 --- a/apps/client-ts/src/app/api-keys/layout.tsx +++ b/apps/client-ts/src/app/api-keys/layout.tsx @@ -5,6 +5,7 @@ import { RootLayout } from "@/components/RootLayout"; import { useStytchSession } from "@stytch/nextjs"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; +import config from "@/lib/config"; export default function Layout({ children, @@ -14,7 +15,7 @@ export default function Layout({ const { session } = useStytchSession(); const router = useRouter(); useEffect(() => { - if (!session) { + if(config.DISTRIBUTION !== "selfhost" && !session){ router.replace("/b2c/login"); } }, [session, router]); diff --git a/apps/client-ts/src/app/configuration/layout.tsx b/apps/client-ts/src/app/configuration/layout.tsx index 0d7de2988..c71e65eb4 100644 --- a/apps/client-ts/src/app/configuration/layout.tsx +++ b/apps/client-ts/src/app/configuration/layout.tsx @@ -5,6 +5,7 @@ import { RootLayout } from "@/components/RootLayout"; import { useStytchSession } from "@stytch/nextjs"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; +import config from "@/lib/config"; export default function Layout({ children, @@ -14,7 +15,7 @@ export default function Layout({ const { session } = useStytchSession(); const router = useRouter(); useEffect(() => { - if (!session) { + if(config.DISTRIBUTION !== "selfhost" && !session){ router.replace("/b2c/login"); } }, [session, router]); diff --git a/apps/client-ts/src/app/connections/layout.tsx b/apps/client-ts/src/app/connections/layout.tsx index 86a2b9107..7a17ef981 100644 --- a/apps/client-ts/src/app/connections/layout.tsx +++ b/apps/client-ts/src/app/connections/layout.tsx @@ -5,6 +5,7 @@ import { RootLayout } from "@/components/RootLayout"; import { useStytchSession } from "@stytch/nextjs"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; +import config from "@/lib/config"; const inter = Inter({ subsets: ["latin"] }); @@ -16,7 +17,7 @@ export default function Layout({ const { session } = useStytchSession(); const router = useRouter(); useEffect(() => { - if (!session) { + if(config.DISTRIBUTION !== "selfhost" && !session){ router.replace("/b2c/login"); } }, [session, router]); diff --git a/apps/client-ts/src/app/dashboard/layout.tsx b/apps/client-ts/src/app/dashboard/layout.tsx index 86a2b9107..7a17ef981 100644 --- a/apps/client-ts/src/app/dashboard/layout.tsx +++ b/apps/client-ts/src/app/dashboard/layout.tsx @@ -5,6 +5,7 @@ import { RootLayout } from "@/components/RootLayout"; import { useStytchSession } from "@stytch/nextjs"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; +import config from "@/lib/config"; const inter = Inter({ subsets: ["latin"] }); @@ -16,7 +17,7 @@ export default function Layout({ const { session } = useStytchSession(); const router = useRouter(); useEffect(() => { - if (!session) { + if(config.DISTRIBUTION !== "selfhost" && !session){ router.replace("/b2c/login"); } }, [session, router]); diff --git a/apps/client-ts/src/app/events/layout.tsx b/apps/client-ts/src/app/events/layout.tsx index 86a2b9107..7a17ef981 100644 --- a/apps/client-ts/src/app/events/layout.tsx +++ b/apps/client-ts/src/app/events/layout.tsx @@ -5,6 +5,7 @@ import { RootLayout } from "@/components/RootLayout"; import { useStytchSession } from "@stytch/nextjs"; import { useRouter } from "next/navigation"; import { useEffect } from "react"; +import config from "@/lib/config"; const inter = Inter({ subsets: ["latin"] }); @@ -16,7 +17,7 @@ export default function Layout({ const { session } = useStytchSession(); const router = useRouter(); useEffect(() => { - if (!session) { + if(config.DISTRIBUTION !== "selfhost" && !session){ router.replace("/b2c/login"); } }, [session, router]);