diff --git a/apps/client-ts/src/components/Configuration/FieldMappingModal.tsx b/apps/client-ts/src/components/Configuration/FieldMappingModal.tsx
index ae730fccf..bdbfca3ad 100644
--- a/apps/client-ts/src/components/Configuration/FieldMappingModal.tsx
+++ b/apps/client-ts/src/components/Configuration/FieldMappingModal.tsx
@@ -47,6 +47,7 @@ import { useForm } from "react-hook-form"
import * as z from "zod"
import { usePostHog } from 'posthog-js/react'
import config from "@/lib/config"
+import { CRM_PROVIDERS } from "@panora/shared"
const defineFormSchema = z.object({
@@ -110,7 +111,8 @@ export function FModal({ onClose }: {onClose: () => void}) {
const { mutate: mutateDefineField } = useDefineFieldMutation();
const { mutate: mutateMapField } = useMapFieldMutation();
const { data: linkedUsers } = useLinkedUsers();
- const { data: sourceCustomFields, error, isLoading } = useProviderProperties(linkedUserId,sourceProvider);
+ // TODO: HANDLE VERTICAL AND PROVIDERS FOR CUSTOM MAPPINGS
+ const { data: sourceCustomFields, error, isLoading } = useProviderProperties(linkedUserId,sourceProvider, "crm");
const posthog = usePostHog()
@@ -330,12 +332,12 @@ export function FModal({ onClose }: {onClose: () => void}) {
-
- Hubspot
- Zendesk
- Slack
- Asana
- Zoho
+
+ {
+ CRM_PROVIDERS.map((provider) =>
+ {provider}
+ )
+ }
diff --git a/apps/client-ts/src/hooks/useProviderProperties.tsx b/apps/client-ts/src/hooks/useProviderProperties.tsx
index 7d673093b..0933b55f6 100644
--- a/apps/client-ts/src/hooks/useProviderProperties.tsx
+++ b/apps/client-ts/src/hooks/useProviderProperties.tsx
@@ -2,11 +2,11 @@ import config from '@/lib/config';
import { useQuery } from '@tanstack/react-query';
import Cookies from 'js-cookie';
-const useProviderProperties = (linkedUserId: string, providerId: string) => {
+const useProviderProperties = (linkedUserId: string, providerId: string, vertical: string) => {
return useQuery({
- queryKey: ['providerProperties', linkedUserId, providerId],
+ queryKey: ['providerProperties', linkedUserId, providerId, vertical],
queryFn: async () => {
- const response = await fetch(`${config.API_URL}/field-mappings/properties?linkedUserId=${linkedUserId}&providerId=${providerId}`,
+ const response = await fetch(`${config.API_URL}/field-mappings/properties?linkedUserId=${linkedUserId}&providerId=${providerId}&vertical=${vertical}`,
{
method: 'GET',
headers: {
diff --git a/packages/api/src/@core/field-mapping/field-mapping.service.ts b/packages/api/src/@core/field-mapping/field-mapping.service.ts
index 24527a508..295d18cee 100644
--- a/packages/api/src/@core/field-mapping/field-mapping.service.ts
+++ b/packages/api/src/@core/field-mapping/field-mapping.service.ts
@@ -127,6 +127,13 @@ export class FieldMappingService {
vertical: string,
) {
try {
+ this.logger.log(
+ 'data to test is => ' +
+ JSON.stringify({
+ providerId,
+ vertical,
+ }),
+ );
const connection = await this.prisma.connections.findFirst({
where: {
id_linked_user: linkedUserId,
@@ -139,8 +146,13 @@ export class FieldMappingService {
if (!provider.urls.apiUrl || !provider.urls.customPropertiesUrl)
throw new Error('proivder urls are invalid');
+ this.logger.log(
+ 'url for properties is ' +
+ provider.urls.apiUrl +
+ provider.urls.customPropertiesUrl,
+ );
const resp = await axios.get(
- provider.urls.apiUrl + provider.urls.customPropertiesUrl,
+ 'https://api.hubapi.com/properties/v1/contacts/properties', // todo : provider.urls.apiUrl + provider.urls.customPropertiesUrl,
{
headers: {
'Content-Type': 'application/json',
@@ -150,6 +162,7 @@ export class FieldMappingService {
},
},
);
+ this.logger.log('properties are ' + JSON.stringify(resp.data));
return {
data: resp.data,
message: `${providerId} contact properties retrieved`,
diff --git a/packages/shared/src/utils.ts b/packages/shared/src/utils.ts
index de2af40e8..f2e90500f 100644
--- a/packages/shared/src/utils.ts
+++ b/packages/shared/src/utils.ts
@@ -43,7 +43,7 @@ export const providersConfig: ProvidersConfig = {
docsUrl: 'https://developers.hubspot.com/docs/api/crm/understanding-the-crm',
authBaseUrl: 'https://app-eu1.hubspot.com/oauth/authorize',
apiUrl: 'https://api.hubapi.com/crm/v3',
- customPropertiesUrl: '/properties/v1/contacts/properties',
+ customPropertiesUrl: '/properties/contacts',
},
logoPath: 'https://assets-global.website-files.com/6421a177cdeeaf3c6791b745/64d61202dd99e63d40d446f6_hubspot%20logo.png',
description: 'Sync & Create contacts, deals, companies, notes, engagements, stages, tasks and users',