Skip to content

Commit

Permalink
Merge branch 'develop' into feat.amp-screen
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishmalik authored Nov 13, 2023
2 parents 8d0219f + e82cef8 commit 8ffd61c
Show file tree
Hide file tree
Showing 7 changed files with 254 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/v0/destinations/facebook_conversions/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { getMappingConfig } = require('../../util');

const ENDPOINT = (datasetId, accessToken) =>
`https://graph.facebook.com/v17.0/${datasetId}/events?access_token=${accessToken}`;
`https://graph.facebook.com/v18.0/${datasetId}/events?access_token=${accessToken}`;

const CONFIG_CATEGORIES = {
USERDATA: {
Expand Down
8 changes: 5 additions & 3 deletions src/v0/destinations/facebook_conversions/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const { EventType } = require('../../../constants');
const {
constructPayload,
extractCustomFields,
flattenJson,
getIntegrationsObj,
getValidDynamicFormConfig,
simpleProcessRouterDest,
Expand Down Expand Up @@ -73,8 +72,11 @@ const responseBuilderSimple = (message, category, destination) => {
commonData.action_source = getActionSource(commonData, actionSource);

let customData = {};
customData = flattenJson(
extractCustomFields(message, customData, ['properties'], FB_CONVERSIONS_DEFAULT_EXCLUSION),
customData = extractCustomFields(
message,
customData,
['properties'],
FB_CONVERSIONS_DEFAULT_EXCLUSION,
);

customData = transformedPayloadData(
Expand Down
8 changes: 7 additions & 1 deletion src/v0/destinations/facebook_conversions/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ const getCategoryFromEvent = (eventName) => {
return category;
};

const populateContentsAndContentIDs = (productPropertiesArray, fallbackQuantity) => {
const populateContentsAndContentIDs = (
productPropertiesArray,
fallbackQuantity,
fallbackDeliveryCategory,
) => {
const contentIds = [];
const contents = [];
if (Array.isArray(productPropertiesArray)) {
Expand All @@ -57,6 +61,7 @@ const populateContentsAndContentIDs = (productPropertiesArray, fallbackQuantity)
id: productId,
quantity: productProps.quantity || fallbackQuantity || 1,
item_price: productProps.price,
delivery_category: productProps.delivery_category || fallbackDeliveryCategory,
});
}
}
Expand Down Expand Up @@ -142,6 +147,7 @@ const populateCustomDataBasedOnCategory = (customData, message, category, catego
const { contentIds, contents } = populateContentsAndContentIDs(
message.properties?.products,
message.properties?.quantity,
message.properties?.delivery_category,
);

const contentCategory = eventTypeCustomData.content_category;
Expand Down
Loading

0 comments on commit 8ffd61c

Please sign in to comment.