Skip to content

Commit

Permalink
fix: allow support for full url from UI in freshsales and freshmarket…
Browse files Browse the repository at this point in the history
…er (#2780)

* fix: allow support for full url from UI in freshsales

* fix: allow support for full url from UI in freshmarketer

* fix: tests

* fix: testsx2
  • Loading branch information
yashasvibajpai authored Nov 3, 2023
1 parent ec206c6 commit 570532c
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 77 deletions.
14 changes: 7 additions & 7 deletions src/v0/destinations/freshmarketer/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ const CONFIG_CATEGORIES = {
IDENTIFY: {
name: 'FRESHMARKETERIdentifyConfig',
type: 'identify',
baseUrl: '.myfreshworks.com/crm/sales/api/contacts/upsert',
baseUrl: '/crm/sales/api/contacts/upsert',
},
GROUP: {
name: 'FRESHMARKETERGroupConfig',
type: 'group',
baseUrlAccount: '.myfreshworks.com/crm/sales/api/sales_accounts/upsert',
baseUrlList: '.myfreshworks.com/crm/sales/api/lists',
baseUrlAccount: '/crm/sales/api/sales_accounts/upsert',
baseUrlList: '/crm/sales/api/lists',
},
SALES_ACTIVITY: {
name: 'SalesActivityConfig',
baseUrlCreate: '.myfreshworks.com/crm/sales/api/sales_activities',
baseUrlListAll: '.myfreshworks.com/crm/sales/api/selector/sales_activity_types',
baseUrlCreate: '/crm/sales/api/sales_activities',
baseUrlListAll: '/crm/sales/api/selector/sales_activity_types',
},
};

const DELETE_ENDPOINT = '.myfreshworks.com/crm/sales/api/contacts/';
const LIFECYCLE_STAGE_ENDPOINT = '.myfreshworks.com/crm/sales/api/selector/lifecycle_stages';
const DELETE_ENDPOINT = '/crm/sales/api/contacts/';
const LIFECYCLE_STAGE_ENDPOINT = '/crm/sales/api/selector/lifecycle_stages';

const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname);
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion src/v0/destinations/freshmarketer/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const updateAccountWOContact = (payload, Config) => {
*/
const updateContactWithList = (userId, listId, Config) => {
const response = defaultRequestConfig();
response.endpoint = `https://${Config.domain}.myfreshworks.com/crm/sales/api/lists/${listId}/add_contacts`;
response.endpoint = `https://${Config.domain}/crm/sales/api/lists/${listId}/add_contacts`;
response.headers = getHeaders(Config.apiKey);
response.body.JSON = {
ids: [userId],
Expand Down
10 changes: 5 additions & 5 deletions src/v0/destinations/freshsales/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ const CONFIG_CATEGORIES = {
IDENTIFY: {
name: 'identifyConfig',
type: 'identify',
baseUrl: '.myfreshworks.com/crm/sales/api/contacts/upsert',
baseUrl: '/crm/sales/api/contacts/upsert',
method: 'POST',
},
GROUP: {
name: 'groupConfig',
type: 'group',
baseUrlAccount: '.myfreshworks.com/crm/sales/api/sales_accounts/upsert',
baseUrlAccount: '/crm/sales/api/sales_accounts/upsert',
method: 'POST',
},
SALES_ACTIVITY: {
name: 'SalesActivityConfig',
baseUrlCreate: '.myfreshworks.com/crm/sales/api/sales_activities',
baseUrlListAll: '.myfreshworks.com/crm/sales/api/selector/sales_activity_types',
baseUrlCreate: '/crm/sales/api/sales_activities',
baseUrlListAll: '/crm/sales/api/selector/sales_activity_types',
},
};

const LIFECYCLE_STAGE_ENDPOINT = '.myfreshworks.com/crm/sales/api/selector/lifecycle_stages';
const LIFECYCLE_STAGE_ENDPOINT = '/crm/sales/api/selector/lifecycle_stages';

const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname);
module.exports = {
Expand Down
62 changes: 31 additions & 31 deletions test/__tests__/data/freshmarketer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "rudderstack-476952domain3105"
"domain": "rudderstack-476952domain3105.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -94,7 +94,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "rudderstack-476952domain3105"
"domain": "rudderstack-476952domain3105.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -183,7 +183,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "rudderstack-476952domain3105"
"domain": "rudderstack-476952domain3105.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -248,7 +248,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "rudderstack-476952domain3105"
"domain": "rudderstack-476952domain3105.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -312,7 +312,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -422,7 +422,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -491,7 +491,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -558,7 +558,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -627,7 +627,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
},
"message": {
Expand Down Expand Up @@ -760,7 +760,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -843,7 +843,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -927,7 +927,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1019,7 +1019,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1127,7 +1127,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1228,7 +1228,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1315,7 +1315,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1406,7 +1406,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1496,7 +1496,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1586,7 +1586,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1696,7 +1696,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1757,7 +1757,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1788,7 +1788,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1825,7 +1825,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1892,7 +1892,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1937,7 +1937,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -1976,7 +1976,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -2043,7 +2043,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -2145,7 +2145,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -2232,7 +2232,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -2334,7 +2334,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
}
},
Expand Down Expand Up @@ -2427,7 +2427,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder",
"domain": "domain-rudder.myfreshworks.com",
"rudderEventsToFreshmarketerEvents": [
{
"from": "test_activity",
Expand Down
6 changes: 3 additions & 3 deletions test/__tests__/data/freshmarketer_router_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "rudderstack-476952domain3105"
"domain": "rudderstack-476952domain3105.myfreshworks.com"
}
},
"metadata": {
Expand Down Expand Up @@ -59,7 +59,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "rudderstack-476952domain3105"
"domain": "rudderstack-476952domain3105.myfreshworks.com"
}
},
"metadata": {
Expand Down Expand Up @@ -115,7 +115,7 @@
"destination": {
"Config": {
"apiKey": "dummyApiKey",
"domain": "domain-rudder"
"domain": "domain-rudder.myfreshworks.com"
}
},
"metadata": {
Expand Down
Loading

0 comments on commit 570532c

Please sign in to comment.