in src/utils/batchSenders.js [112:166]
function getColumnsFromMappingsForCustomAudience(
mapping: Object,
): Array<string> {
const mappedPropKeys = Object.values(mapping)
.filter(propPath => {
return (
propPath != null &&
typeof propPath === 'string' &&
propPath.trim().length > 0
);
})
.map(propPath => {
const parts = String(propPath).split('.');
return parts[parts.length - 1];
});
const apiSchema = [];
mappedPropKeys.forEach(propKey => {
switch (propKey) {
case 'dob':
apiSchema.push('doby', 'dobm', 'dobd');
break;
case 'fn':
apiSchema.push('fn', 'fi', 'f5first');
break;
case 'ln':
apiSchema.push('ln', 'f5last');
break;
case 'age':
apiSchema.push('doby');
break;
default:
apiSchema.push(propKey);
}
});
const apiSchemaWithDuplicateDobyRemoved = [];
let dobyPushed = false;
apiSchema.forEach(propKey => {
if (propKey === 'doby') {
if (!dobyPushed) {
dobyPushed = true;
apiSchemaWithDuplicateDobyRemoved.push(propKey);
}
} else {
apiSchemaWithDuplicateDobyRemoved.push(propKey);
}
});
return apiSchemaWithDuplicateDobyRemoved;
}