Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: send empty string instead of null when the schema data is undefined #2955

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/v0/destinations/fb_custom_audience/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,21 @@ const getUpdatedDataElement = (dataElement, isHashRequired, eachProperty, update
/**
* hash the original value for the properties apart from 'MADID' && 'EXTERN_ID as hashing is not required for them
* ref: https://developers.facebook.com/docs/marketing-api/audiences/guides/custom-audiences#hash
* sending null values for the properties for which user hasn't provided any value
* sending empty string for the properties for which user hasn't provided any value
*/
if (isHashRequired && eachProperty !== 'MADID' && eachProperty !== 'EXTERN_ID') {
if (tmpUpdatedProperty) {
tmpUpdatedProperty = `${tmpUpdatedProperty}`;
dataElement.push(sha256(tmpUpdatedProperty));
} else {
dataElement.push(null);
dataElement.push('');
}
}
// if property name is MADID or EXTERN_ID if the value is undefined send null
// if property name is MADID or EXTERN_ID if the value is undefined send empty string
else if (!tmpUpdatedProperty && (eachProperty === 'MADID' || eachProperty === 'EXTERN_ID')) {
dataElement.push(null);
dataElement.push('');
} else {
dataElement.push(tmpUpdatedProperty);
dataElement.push(tmpUpdatedProperty || '');
}
return dataElement;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,7 @@ export const data = [
'a953f09a1b6b6725b81956e9ad0b1eb49e3ad40004c04307ef8af6246a054116',
'3fdba35f04dc8c462986c992bcf875546257113072a909c162f7e470e581e278',
'7931aa2a1bed855457d1ddf6bc06ab4406a9fba0579045a4d6ff78f9c07c440f',
null,
'',
'252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111',
'db0683221aebc02cc034b65ebcf7d1bddd1eb199e33fd23a31931947d13a11bc',
'abc',
Expand Down Expand Up @@ -2123,7 +2123,7 @@ export const data = [
'ST',
'COUNTRY',
],
data: [[null, null, null, null, null, null, null, null, null, null, null]],
data: [['', '', '', '', '', '', '', '', '', '', '']],
},
},
body: {
Expand Down Expand Up @@ -2256,7 +2256,7 @@ export const data = [
'a953f09a1b6b6725b81956e9ad0b1eb49e3ad40004c04307ef8af6246a054116',
'3fdba35f04dc8c462986c992bcf875546257113072a909c162f7e470e581e278',
'7931aa2a1bed855457d1ddf6bc06ab4406a9fba0579045a4d6ff78f9c07c440f',
null,
'',
'252f10c83610ebca1a059c0bae8255eba2f95be4d1d7bcfa89d7248a82d9f111',
'db0683221aebc02cc034b65ebcf7d1bddd1eb199e33fd23a31931947d13a11bc',
'abc',
Expand Down
20 changes: 10 additions & 10 deletions test/integrations/destinations/fb_custom_audience/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26757,16 +26757,16 @@ export const data = [
payload: {
schema: ['EMAIL', 'FN'],
data: [
['7625cab24612c37df6d2f724721bb38a25095d0295e29b807238ee188b8aca43', null],
['b2b4abadd72190af54305c0d3abf1977fec4935016bb13ff28040d5712318dfd', null],
['c4b007d1c3c9a5d31bd4082237a913e8e0db1767225c2a5ef33be2716df005fa', null],
['94639be1bd9f17c05820164e9d71ef78558f117a9e8bfab43cf8015e08aa0b27', null],
['39b456cfb4bb07f9e6bb18698aa173171ca49c731fccc4790e9ecea808d24ae6', null],
['769f73387add781a481ca08300008a08fb2f1816aaed196137efc2e05976d711', null],
['48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', null],
['da2d431121cd10578fd81f8f80344b06db59ea2d05a7b5d27536c8789ddae8f0', null],
['b100c2ec0718fe6b4805b623aeec6710719d042ceea55f5c8135b010ec1c7b36', null],
['0c1d1b0ba547a742013366d6fbc8f71dd77f566d94e41ed9f828a74b96928161', null],
['7625cab24612c37df6d2f724721bb38a25095d0295e29b807238ee188b8aca43', ''],
['b2b4abadd72190af54305c0d3abf1977fec4935016bb13ff28040d5712318dfd', ''],
['c4b007d1c3c9a5d31bd4082237a913e8e0db1767225c2a5ef33be2716df005fa', ''],
['94639be1bd9f17c05820164e9d71ef78558f117a9e8bfab43cf8015e08aa0b27', ''],
['39b456cfb4bb07f9e6bb18698aa173171ca49c731fccc4790e9ecea808d24ae6', ''],
['769f73387add781a481ca08300008a08fb2f1816aaed196137efc2e05976d711', ''],
['48ddb93f0b30c475423fe177832912c5bcdce3cc72872f8051627967ef278e08', ''],
['da2d431121cd10578fd81f8f80344b06db59ea2d05a7b5d27536c8789ddae8f0', ''],
['b100c2ec0718fe6b4805b623aeec6710719d042ceea55f5c8135b010ec1c7b36', ''],
['0c1d1b0ba547a742013366d6fbc8f71dd77f566d94e41ed9f828a74b96928161', ''],
],
},
},
Expand Down
Loading