diff --git a/frontend/src/integrations/hubspot/components/hubspot-book-call.vue b/frontend/src/integrations/hubspot/components/hubspot-book-call.vue deleted file mode 100644 index f64ae12d3b..0000000000 --- a/frontend/src/integrations/hubspot/components/hubspot-book-call.vue +++ /dev/null @@ -1,60 +0,0 @@ - - - - - diff --git a/frontend/src/integrations/hubspot/components/hubspot-connect.vue b/frontend/src/integrations/hubspot/components/hubspot-connect.vue new file mode 100644 index 0000000000..dde5b7d134 --- /dev/null +++ b/frontend/src/integrations/hubspot/components/hubspot-connect.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/frontend/src/integrations/hubspot/components/hubspot-property-map.vue b/frontend/src/integrations/hubspot/components/hubspot-property-map.vue new file mode 100644 index 0000000000..9daa630fb4 --- /dev/null +++ b/frontend/src/integrations/hubspot/components/hubspot-property-map.vue @@ -0,0 +1,107 @@ + + + + + + + diff --git a/frontend/src/integrations/hubspot/components/hubspot-settings-drawer.vue b/frontend/src/integrations/hubspot/components/hubspot-settings-drawer.vue new file mode 100644 index 0000000000..a2d60e460e --- /dev/null +++ b/frontend/src/integrations/hubspot/components/hubspot-settings-drawer.vue @@ -0,0 +1,429 @@ + + + + + + + diff --git a/frontend/src/integrations/hubspot/config.js b/frontend/src/integrations/hubspot/config.js index 8aa117d438..3f24fa4aba 100644 --- a/frontend/src/integrations/hubspot/config.js +++ b/frontend/src/integrations/hubspot/config.js @@ -1,4 +1,4 @@ -import HubSpotBookCall from './components/hubspot-book-call.vue'; +import HubspotConnect from './components/hubspot-connect.vue'; export default { name: 'HubSpot', @@ -7,7 +7,7 @@ export default { description: 'Create a 2-way sync with HubSpot.', image: '/images/integrations/hubspot.png', - connectComponent: HubSpotBookCall, + connectComponent: HubspotConnect, enabled: true, url: (username) => null, chartColor: '#FF712E', diff --git a/frontend/src/integrations/hubspot/hubspot.api.service.ts b/frontend/src/integrations/hubspot/hubspot.api.service.ts new file mode 100644 index 0000000000..90a41ae133 --- /dev/null +++ b/frontend/src/integrations/hubspot/hubspot.api.service.ts @@ -0,0 +1,33 @@ +import AuthCurrentTenant from '@/modules/auth/auth-current-tenant'; +import authAxios from '@/shared/axios/auth-axios'; +import { MappableFields } from '@/integrations/hubspot/types/MappableFields'; +import { HubspotOnboard } from '@/integrations/hubspot/types/HubspotOnboard'; + +export class HubspotApiService { + static getMappableFields(): Promise { + const tenantId = AuthCurrentTenant.get(); + + return authAxios.get( + `/tenant/${tenantId}/hubspot-mappable-fields`, + ) + .then((response) => response.data); + } + + static updateAttributes(): Promise { + const tenantId = AuthCurrentTenant.get(); + return authAxios.post( + `/tenant/${tenantId}/hubspot-update-properties`, + ) + .then((response) => response.data); + } + + static finishOnboard(data: HubspotOnboard): Promise { + const tenantId = AuthCurrentTenant.get(); + + return authAxios.post( + `/tenant/${tenantId}/hubspot-onboard`, + data, + ) + .then((response) => response.data); + } +} diff --git a/frontend/src/integrations/hubspot/types/HubspotEntity.ts b/frontend/src/integrations/hubspot/types/HubspotEntity.ts new file mode 100644 index 0000000000..b6539c7f38 --- /dev/null +++ b/frontend/src/integrations/hubspot/types/HubspotEntity.ts @@ -0,0 +1,4 @@ +export enum HubspotEntity { + MEMBERS= 'members', + ORGANIZATIONS = 'organizations' +} diff --git a/frontend/src/integrations/hubspot/types/HubspotOnboard.ts b/frontend/src/integrations/hubspot/types/HubspotOnboard.ts new file mode 100644 index 0000000000..4d6da16dd2 --- /dev/null +++ b/frontend/src/integrations/hubspot/types/HubspotOnboard.ts @@ -0,0 +1,9 @@ +import { HubspotEntity } from '@/integrations/hubspot/types/HubspotEntity'; + +export interface HubspotOnboard{ + enabledFor: HubspotEntity[]; + attributesMapping: { + [HubspotEntity.MEMBERS]?: Record; + [HubspotEntity.ORGANIZATIONS]?: Record; + }; +} diff --git a/frontend/src/integrations/hubspot/types/HubspotProperty.ts b/frontend/src/integrations/hubspot/types/HubspotProperty.ts new file mode 100644 index 0000000000..9c7a55347b --- /dev/null +++ b/frontend/src/integrations/hubspot/types/HubspotProperty.ts @@ -0,0 +1,10 @@ +export interface HubspotProperty { + label: string; + name: string; + type: string; +} + +export interface HubspotProperties { + members: HubspotProperty[]; + organizations: HubspotProperty[]; +} diff --git a/frontend/src/integrations/hubspot/types/MappableFields.ts b/frontend/src/integrations/hubspot/types/MappableFields.ts new file mode 100644 index 0000000000..9b25aaa022 --- /dev/null +++ b/frontend/src/integrations/hubspot/types/MappableFields.ts @@ -0,0 +1,4 @@ +export interface MappableFields { + members: Record, + organizations: Record, +} diff --git a/frontend/src/modules/integration/integration-service.js b/frontend/src/modules/integration/integration-service.js index 959fab1f15..419d5bc9b2 100644 --- a/frontend/src/modules/integration/integration-service.js +++ b/frontend/src/modules/integration/integration-service.js @@ -266,7 +266,7 @@ export class IntegrationService { return response.data; } - static async hubspotOnboard() { + static async hubspotConnect() { // Getting the tenant_id const tenantId = AuthCurrentTenant.get(); // Calling the authenticate function in the backend. diff --git a/frontend/src/modules/integration/integration-store.js b/frontend/src/modules/integration/integration-store.js index cebecc7193..870b05c10a 100644 --- a/frontend/src/modules/integration/integration-store.js +++ b/frontend/src/modules/integration/integration-store.js @@ -471,12 +471,10 @@ export default { async doHubspotConnect( { commit }, ) { - // Function to connect to StackOverflow. - try { commit('CREATE_STARTED'); - const integration = await IntegrationService.hubspotOnboard(); + const integration = await IntegrationService.hubspotConnect(); commit('CREATE_SUCCESS', integration);