Skip to content

Commit

Permalink
fix: fixing lytics user_id and anonymousId mapping (#3745)
Browse files Browse the repository at this point in the history
* fix: fixing lytics user_id and anonymousId mapping

* fix: adding mapping config for identify call and clean up of native code

* fix: adding user and anonymousId mapping for other calls as well

---------

Co-authored-by: Krishna Chaitanya <[email protected]>
  • Loading branch information
shrouti1507 and krishna2020 authored Sep 30, 2024
1 parent 08cfdb9 commit 45b1067
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 453 deletions.
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
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.

Loading

0 comments on commit 45b1067

Please sign in to comment.