Skip to content

Commit

Permalink
Merge branch 'develop' into salesforcev2-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 authored Oct 3, 2024
2 parents 6648747 + 45b1067 commit 1565e3a
Show file tree
Hide file tree
Showing 27 changed files with 1,843 additions and 1,583 deletions.
4 changes: 2 additions & 2 deletions src/cdk/v2/destinations/bluecore/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ const verifyPayload = (payload, message) => {
}
break;
case 'purchase':
if (!payload?.properties?.order_id) {
if (!isDefinedAndNotNull(payload?.properties?.order_id)) {
throw new InstrumentationError(
'[Bluecore] property:: order_id is required for purchase event',
);
}
if (!payload?.properties?.total) {
if (!isDefinedAndNotNull(payload?.properties?.total)) {
throw new InstrumentationError(
'[Bluecore] property:: total is required for purchase event',
);
Expand Down
9 changes: 9 additions & 0 deletions src/cdk/v2/destinations/lytics/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { getMappingConfig } from '../../../../v0/util';

const CONFIG_CATEGORIES = {
CUSTOMER_PROPERTIES_CONFIG: { name: 'LYTICSIdentifyConfig' },
};

const MAPPING_CONFIG = getMappingConfig(CONFIG_CATEGORIES, __dirname);
export const CUSTOMER_PROPERTIES_CONFIG =
MAPPING_CONFIG[CONFIG_CATEGORIES.CUSTOMER_PROPERTIES_CONFIG.name];
25 changes: 25 additions & 0 deletions src/cdk/v2/destinations/lytics/data/LYTICSIdentifyConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[
{
"destKey": "user_id",
"sourceKeys": "userIdOnly",
"sourceFromGenericMap": true,
"required": false
},
{
"destKey": "anonymous_id",
"sourceKeys": "anonymousId",
"required": false
},
{
"destKey": "first_name",
"sourceKeys": "firstName",
"sourceFromGenericMap": true,
"required": false
},
{
"destKey": "last_name",
"sourceKeys": "lastName",
"sourceFromGenericMap": true,
"required": false
}
]
16 changes: 9 additions & 7 deletions src/cdk/v2/destinations/lytics/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ bindings:
path: ../../../../v0/util
- name: removeUndefinedAndNullValues
path: ../../../../v0/util
- name: constructPayload
path: ../../../../v0/util
- path: ../../bindings/jsontemplate
- name: defaultRequestConfig
path: ../../../../v0/util
- path: ./config

steps:
- name: validateInput
Expand All @@ -24,20 +27,19 @@ steps:
condition: $.context.messageType === {{$.EventType.IDENTIFY}}
template: |
const flattenTraits = $.flattenJson(.message.traits ?? .message.context.traits);
$.context.payload = .message.({
const payload = $.constructPayload(.message, $.CUSTOMER_PROPERTIES_CONFIG);
$.context.payload = {
...flattenTraits,
first_name: {{{{$.getGenericPaths("firstName")}}}},
last_name: {{{{$.getGenericPaths("lastName")}}}},
user_id: {{{{$.getGenericPaths("userId")}}}}
})
...payload,
}
else:
name: payloadForOthers
template: |
const flattenProperties = $.flattenJson(.message.properties);
const customerPropertiesInfo = $.constructPayload(.message, $.CUSTOMER_PROPERTIES_CONFIG);
$.context.payload = .message.({
...flattenProperties,
first_name: .properties.firstName ?? .properties.firstname,
last_name: .properties.lastName ?? .properties.lastname
...customerPropertiesInfo
})
- name: trackPayload
condition: $.context.messageType === {{$.EventType.TRACK}}
Expand Down
14 changes: 14 additions & 0 deletions src/v0/destinations/braze/braze.util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,20 @@ describe('dedup utility tests', () => {
{
external_ids: ['user1', 'user2'],
user_aliases: [{ alias_name: 'user3', alias_label: 'rudder_id' }],
fields_to_export: [
'created_at',
'custom_attributes',
'dob',
'email',
'first_name',
'gender',
'home_city',
'last_name',
'phone',
'time_zone',
'external_id',
'user_aliases',
],
},
{
headers: {
Expand Down
21 changes: 19 additions & 2 deletions src/v0/destinations/braze/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,36 @@ const BrazeDedupUtility = {
const identfierChunks = _.chunk(identifiers, 50);
return identfierChunks;
},

getFieldsToExport() {
return [
'created_at',
'custom_attributes',
'dob',
'email',
'first_name',
'gender',
'home_city',
'last_name',
'phone',
'time_zone',
'external_id',
'user_aliases',
// 'country' and 'language' not needed because it is not billable so we don't use it
];
},
async doApiLookup(identfierChunks, { destination, metadata }) {
return Promise.all(
identfierChunks.map(async (ids) => {
const externalIdentifiers = ids.filter((id) => id.external_id);
const aliasIdentifiers = ids.filter((id) => id.alias_name !== undefined);

const fieldsToExport = this.getFieldsToExport();
const { processedResponse: lookUpResponse } = await handleHttpRequest(
'post',
`${getEndpointFromConfig(destination)}/users/export/ids`,
{
external_ids: externalIdentifiers.map((extId) => extId.external_id),
user_aliases: aliasIdentifiers,
fields_to_export: fieldsToExport,
},
{
headers: {
Expand Down
27 changes: 0 additions & 27 deletions src/v0/destinations/lytics/config.js

This file was deleted.

19 changes: 0 additions & 19 deletions src/v0/destinations/lytics/data/LYTICSIdentifyConfig.json

This file was deleted.

12 changes: 0 additions & 12 deletions src/v0/destinations/lytics/data/LYTICSPageScreenConfig.json

This file was deleted.

12 changes: 0 additions & 12 deletions src/v0/destinations/lytics/data/LYTICSTrackConfig.json

This file was deleted.

77 changes: 0 additions & 77 deletions src/v0/destinations/lytics/transform.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/v0/destinations/posthog/data/PHAliasConfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"destKey": "properties.alias",
"destKey": "properties.distinct_id",
"sourceKeys": "userId",
"sourceFromGenericMap": true,
"required": true
},
{
"destKey": "properties.distinct_id",
"destKey": "properties.alias",
"sourceKeys": "previousId",
"required": true
},
Expand Down
16 changes: 16 additions & 0 deletions src/v0/destinations/singular/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const CONFIG_CATEGORIES = {
name: 'SINGULARIosSessionConfig',
type: 'track',
},
SESSION_UNITY: {
name: 'SINGULARUnitySessionConfig',
type: 'track',
},
EVENT_ANDROID: {
name: 'SINGULARAndroidEventConfig',
type: 'track',
Expand All @@ -21,6 +25,10 @@ const CONFIG_CATEGORIES = {
name: 'SINGULARIosEventConfig',
type: 'track',
},
EVENT_UNITY: {
name: 'SINGULARUnityEventConfig',
type: 'track',
},
PRODUCT_PROPERTY: {
name: 'SINGULAREventProductConfig',
},
Expand All @@ -29,8 +37,15 @@ const CONFIG_CATEGORIES = {
const SUPPORTED_PLATFORM = {
android: 'ANDROID',
ios: 'IOS',
pc: 'unity',
xbox: 'unity',
playstation: 'unity',
nintendo: 'unity',
metaquest: 'unity',
};

const SUPPORTED_UNTIY_SUBPLATFORMS = ['pc', 'xbox', 'playstation', 'nintendo', 'metaquest'];

const SINGULAR_SESSION_ANDROID_EXCLUSION = [
'referring_application',
'asid',
Expand Down Expand Up @@ -93,5 +108,6 @@ module.exports = {
SINGULAR_EVENT_ANDROID_EXCLUSION,
SINGULAR_EVENT_IOS_EXCLUSION,
SUPPORTED_PLATFORM,
SUPPORTED_UNTIY_SUBPLATFORMS,
BASE_URL,
};
Loading

0 comments on commit 1565e3a

Please sign in to comment.