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

back-merge hotfix release into develop #3447

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.68.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.68.0...v1.68.1) (2024-05-29)


### Bug Fixes

* tiktok_v2 assigning value to undefined properties ([#3426](https://github.com/rudderlabs/rudder-transformer/issues/3426)) ([323396b](https://github.com/rudderlabs/rudder-transformer/commit/323396b09fd6b7fda3cce53cc4f1cc443d7a78c1))

## [1.68.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.67.0...v1.68.0) (2024-05-27)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.68.0",
"version": "1.68.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/v2/destinations/emarsys/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const deduceEventId = (message, destConfig) => {
const { eventsMapping } = destConfig;
const { event } = message;
validateEventName(event);
if (eventsMapping.length > 0) {
if (Array.isArray(eventsMapping) && eventsMapping.length > 0) {
const keyMap = getHashFromArray(eventsMapping, 'from', 'to', false);
eventId = keyMap[event];
}
Expand Down
1 change: 1 addition & 0 deletions src/services/userTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class UserTransformService {
destinationId: eventsToProcess[0]?.metadata.destinationId,
destinationType: eventsToProcess[0]?.metadata.destinationType,
workspaceId: eventsToProcess[0]?.metadata.workspaceId,
transformationId: eventsToProcess[0]?.metadata.transformationId,
messageIds,
};

Expand Down
4 changes: 4 additions & 0 deletions src/v0/destinations/tiktok_ads/transformV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const getTrackResponsePayload = (message, destConfig, event, setDefaultForConten
// if contents is not present but we have properties.products present which has fields with superset of contents fields
if (!payload.properties?.contents && message.properties?.products) {
// retreiving data from products only when contents is not present
// properties object may be empty due which next line may give some error
payload.properties = payload.properties || {};
payload.properties.contents = getContents(message, false);
}

Expand All @@ -55,6 +57,8 @@ const getTrackResponsePayload = (message, destConfig, event, setDefaultForConten
}
// setting content-type default value in case of all standard event except `page-view`
if (!payload.properties?.content_type && setDefaultForContentType) {
// properties object may be empty due which next line may give some error
payload.properties = payload.properties || {};
payload.properties.content_type = 'product';
}
payload.event = event;
Expand Down
117 changes: 117 additions & 0 deletions test/integrations/destinations/emarsys/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1377,4 +1377,121 @@ export const data = [
},
},
},
{
name: 'emarsys',
description: 'Test 11 : Track call with no event mapping field should fail',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
metadata: {},
message: {
event: 'Order Completed',
anonymousId: 'anonId06',
channel: 'web',
context: {
userAgent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.117 Safari/537.36',
traits: {
email: '[email protected]',
lastName: 'Doe',
firstName: 'John',
},
},
integrations: {
All: true,
EMARSYS: {
trigger_id: 'EVENT_TRIGGER_ID',
},
},
properties: {
company: 'testComp',
data: {
section_group1: [
{
section_variable1: 'some_value',
section_variable2: 'another_value',
},
{
section_variable1: 'yet_another_value',
section_variable2: 'one_more_value',
},
],
global: {
global_variable1: 'global_value',
global_variable2: 'another_global_value',
},
},
attachment: [
{
filename: 'example.pdf',
data: 'ZXhhbXBsZQo=',
},
],
},
messageId: '2536eda4-d638-4c93-8014-8ffe3f083214',
originalTimestamp: '2020-01-24T06:29:02.362Z',
receivedAt: '2020-01-24T11:59:02.403+05:30',
request_ip: '[::1]:53709',
sentAt: '2020-01-24T06:29:02.363Z',
timestamp: '2023-07-06T11:59:02.402+05:30',
type: 'track',
userId: 'userId06',
},
destination: {
DestinationDefinition: {
Config: {
cdkV2Enabled: true,
excludeKeys: [],
includeKeys: [],
},
},
Config: {
discardEmptyProperties: true,
emersysUsername: 'dummy',
emersysUserSecret: 'dummy',
emersysCustomIdentifier: '3',
defaultContactList: 'dummy',
fieldMapping: [
{
rudderProperty: 'email',
emersysProperty: '3',
},
],
oneTrustCookieCategories: [
{
oneTrustCookieCategory: 'Marketing',
},
],
},
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
error:
'Order Completed is not mapped to any Emersys external event. Aborting: Workflow: procWorkflow, Step: preparePayloadForTrack, ChildStep: undefined, OriginalError: Order Completed is not mapped to any Emersys external event. Aborting',
metadata: {},
statTags: {
destType: 'EMARSYS',
errorCategory: 'dataValidation',
errorType: 'configuration',
feature: 'processor',
implementation: 'cdkV2',
module: 'destination',
},
statusCode: 400,
},
],
},
},
},
].map((d) => ({ ...d, mockFns }));
103 changes: 103 additions & 0 deletions test/integrations/destinations/tiktok_ads/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6971,6 +6971,109 @@ export const data = [
},
},
},
{
name: 'tiktok_ads',
description: 'Test 46 -> V2 -> Standard Event with no properties',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
anonymousId: '21e13f4bc7ceddad',
channel: 'web',
context: {
traits: {
email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f',
},
userAgent:
'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion',
ip: '13.57.97.131',
locale: 'en-US',
externalId: [
{
type: 'tiktokExternalId',
id: 'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc',
},
],
},
messageId: '84e26acc-56a5-4835-8233-591137fca468',
session_id: '3049dc4c-5a95-4ccd-a3e7-d74a7e411f22',
originalTimestamp: '2019-10-14T09:03:17.562Z',
timestamp: '2020-09-17T19:49:27Z',
type: 'track',
event: 'Search',
integrations: {
All: true,
},
sentAt: '2019-10-14T09:03:22.563Z',
},
destination: {
Config: {
version: 'v2',
accessToken: 'dummyAccessToken',
pixelCode: '{{PIXEL-CODE}}',
hashUserProperties: false,
sendCustomEvents: true,
},
},
},
],
},
},
output: {
response: {
status: 200,
body: [
{
output: {
version: '1',
type: 'REST',
method: 'POST',
endpoint: 'https://business-api.tiktok.com/open_api/v1.3/event/track/',
headers: {
'Access-Token': 'dummyAccessToken',
'Content-Type': 'application/json',
},
params: {},
body: {
JSON: {
event_source: 'web',
event_source_id: '{{PIXEL-CODE}}',
partner_name: 'RudderStack',
data: [
{
event: 'Search',
event_id: '84e26acc-56a5-4835-8233-591137fca468',
event_time: 1600372167,
properties: { content_type: 'product' },
user: {
locale: 'en-US',
email: 'dd6ff77f54e2106661089bae4d40cdb600979bf7edc9eb65c0942ba55c7c2d7f',
external_id:
'f0e388f53921a51f0bb0fc8a2944109ec188b59172935d8f23020b1614cc44bc',
ip: '13.57.97.131',
user_agent:
'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion',
},
},
],
},
JSON_ARRAY: {},
XML: {},
FORM: {},
},
files: {},
userId: '',
},
statusCode: 200,
},
],
},
},
},
{
name: 'tiktok_ads',
description: 'Testing if the event name provided as a string or not',
Expand Down
Loading