Skip to content

Commit

Permalink
Merge branch 'develop' into upgrade-version-google-dests
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 authored Dec 18, 2023
2 parents 3aeb0b2 + eea6511 commit 7d23d71
Show file tree
Hide file tree
Showing 12 changed files with 479 additions and 16 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

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.52.3](https://github.com/rudderlabs/rudder-transformer/compare/v1.52.2...v1.52.3) (2023-12-18)


### Bug Fixes

* email validation for braze ([#2929](https://github.com/rudderlabs/rudder-transformer/issues/2929)) ([28207d0](https://github.com/rudderlabs/rudder-transformer/commit/28207d02a1b39b25325fa30be12c4dccd05c844e))
* pinterest event value is restricted to string ([#2933](https://github.com/rudderlabs/rudder-transformer/issues/2933)) ([7f6d519](https://github.com/rudderlabs/rudder-transformer/commit/7f6d519b811a5d8f83f7a2103d9ba50efed8a923))
* remove log from dcm_floodlight ([#2934](https://github.com/rudderlabs/rudder-transformer/issues/2934)) ([c5d9a3c](https://github.com/rudderlabs/rudder-transformer/commit/c5d9a3cc7d0270238c102cec809edcccad5b270d))
* tiktok remove lowercasing for custom events ([#2930](https://github.com/rudderlabs/rudder-transformer/issues/2930)) ([1a90719](https://github.com/rudderlabs/rudder-transformer/commit/1a9071931e9768a3fd02b749b4b705e8c28d9763))

### [1.52.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.52.1...v1.52.2) (2023-12-15)


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.52.2",
"version": "1.52.3",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
1 change: 0 additions & 1 deletion src/cdk/v2/destinations/dcm_floodlight/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ steps:
$.transformCustomVariable(conversionEvent.customVariables || [], .message)
);
$.context.salesTag = conversionEvent.salesTag;
console.log("$.context.salesTag", $.context.salesTag);
- name: handleSalesTag
condition: $.context.salesTag
template: |
Expand Down
5 changes: 4 additions & 1 deletion src/cdk/v2/destinations/pinterest_tag/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ bindings:
path: ../../../../v0/util
- name: removeUndefinedAndNullAndEmptyValues
path: ../../../../v0/util
- name: validateEventName
path: ../../../../v0/util
steps:
- name: checkIfProcessed
condition: .message.statusCode
Expand Down Expand Up @@ -175,6 +177,7 @@ steps:
name: eventNamesForOthers
template: |
let event = .message.event ?? .message.name;
$.validateEventName(event);
let eventInLowerCase = event.toLowerCase();
let eventNames = .destination.Config.eventsMapping.(){.from === event}.to[] ?? [];
eventNames = $.convertToSnakeCase(eventNames);
Expand Down Expand Up @@ -243,4 +246,4 @@ steps:
},
"params": $.outputs.checkSendTestEventConfig,
"files": {}
})[]
})[]
23 changes: 13 additions & 10 deletions src/v0/destinations/braze/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,19 @@ function getUserAttributesObject(message, mappingJson, destination) {
Object.keys(mappingJson).forEach((destKey) => {
let value = get(traits, mappingJson[destKey]);
if (value || (value === null && reservedKeys.includes(destKey))) {
// if email is not string remove it from attributes
if (destKey === 'email' && typeof value !== 'string') {
throw new InstrumentationError('Invalid email, email must be a valid string');
}

// handle gender special case
if (destKey === 'gender') {
value = formatGender(value);
} else if (destKey === 'email' && isDefinedAndNotNull(value)) {
value = value.toString().toLowerCase();
switch (destKey) {
case 'gender':
value = formatGender(value);
break;
case 'email':
if (typeof value === 'string') {
value = value.toLowerCase();
} else if (isDefinedAndNotNull(value)) {
throw new InstrumentationError('Invalid email, email must be a valid string');
}
break;
default:
break;
}
data[destKey] = value;
}
Expand Down
2 changes: 2 additions & 0 deletions src/v0/destinations/pinterest_tag/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
isDefined,
getHashFromArrayWithDuplicate,
removeUndefinedAndNullValues,
validateEventName,
} = require('../../util');
const { COMMON_CONFIGS, CUSTOM_CONFIGS, API_VERSION } = require('./config');

Expand Down Expand Up @@ -170,6 +171,7 @@ const deduceTrackScreenEventName = (message, Config) => {
if (!trackEventOrScreenName) {
throw new InstrumentationError('event_name could not be mapped. Aborting');
}
validateEventName(trackEventOrScreenName);

/*
Step 1: If the event is not amongst the above list of ecommerce events, will look for
Expand Down
3 changes: 2 additions & 1 deletion src/v0/destinations/tiktok_ads/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ const trackResponseBuilder = async (message, { Config }) => {
return responseList;
}
// Doc https://ads.tiktok.com/help/article/standard-events-parameters?lang=en
event = eventNameMapping[event] || event;
// For custom event we do not want to lower case the event or trim it we just want to send those as it is
event = eventNameMapping[event] || message.event;
// if there exists no event mapping we will build payload with custom event recieved
responseList.push(getTrackResponse(message, Config, event));

Expand Down
77 changes: 77 additions & 0 deletions test/__tests__/data/braze_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -1955,5 +1955,82 @@
"type": "identify",
"userId": ""
}
},
{
"destination": {
"Config": {
"restApiKey": "dummyApiKey",
"prefixProperties": true,
"useNativeSDK": false,
"sendPurchaseEventWithExtraProperties": true
},
"DestinationDefinition": {
"DisplayName": "Braze",
"ID": "1WhbSZ6uA3H5ChVifHpfL2H6sie",
"Name": "BRAZE"
},
"Enabled": true,
"ID": "1WhcOCGgj9asZu850HvugU2C3Aq",
"Name": "Braze",
"Transformations": []
},
"message": {
"anonymousId": "e6ab2c5e-2cda-44a9-a962-e2f67df78bca",
"channel": "web",
"context": {
"traits": {
"city": "Disney",
"country": "USA",
"email": null,
"firstname": "Mickey"
},
"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"
},
"event": "Order Completed",
"integrations": {
"All": true
},
"messageId": "aa5f5e44-8756-40ad-ad1e-b0d3b9fa710a",
"originalTimestamp": "2020-01-24T06:29:02.367Z",
"properties": {
"affiliation": "Google Store",
"checkout_id": "fksdjfsdjfisjf9sdfjsd9f",
"coupon": "hasbros",
"currency": "USD",
"discount": 2.5,
"order_id": "50314b8e9bcf000000000000",
"products": [
{
"category": "Games",
"image_url": "https:///www.example.com/product/path.jpg",
"name": "Monopoly: 3rd Edition",
"price": 0,
"product_id": "507f1f77bcf86cd799439023",
"quantity": 1,
"sku": "45790-32",
"url": "https://www.example.com/product/path"
},
{
"category": "Games",
"name": "Uno Card Game",
"price": 0,
"product_id": "505bd76785ebb509fc183724",
"quantity": 2,
"sku": "46493-32"
}
],
"revenue": 25,
"shipping": 3,
"subtotal": 22.5,
"tax": 2,
"total": 27.5
},
"receivedAt": "2020-01-24T11:59:02.403+05:30",
"request_ip": "[::1]:53712",
"sentAt": "2020-01-24T06:29:02.368Z",
"timestamp": "2020-01-24T11:59:02.402+05:30",
"type": "track",
"userId": ""
}
}
]
71 changes: 71 additions & 0 deletions test/__tests__/data/braze_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -1038,5 +1038,76 @@
{
"statusCode": 400,
"message": "Invalid email, email must be a valid string"
},
{
"body": {
"FORM": {},
"JSON": {
"attributes": [
{
"_update_existing_only": false,
"city": "Disney",
"country": "USA",
"email": null,
"firstname": "Mickey",
"user_alias": {
"alias_label": "rudder_id",
"alias_name": "e6ab2c5e-2cda-44a9-a962-e2f67df78bca"
}
}
],
"partner": "RudderStack",
"purchases": [
{
"_update_existing_only": false,
"currency": "USD",
"price": 0,
"product_id": "507f1f77bcf86cd799439023",
"properties": {
"category": "Games",
"image_url": "https:///www.example.com/product/path.jpg",
"name": "Monopoly: 3rd Edition",
"url": "https://www.example.com/product/path"
},
"quantity": 1,
"time": "2020-01-24T11:59:02.402+05:30",
"user_alias": {
"alias_label": "rudder_id",
"alias_name": "e6ab2c5e-2cda-44a9-a962-e2f67df78bca"
}
},
{
"_update_existing_only": false,
"currency": "USD",
"price": 0,
"product_id": "505bd76785ebb509fc183724",
"properties": {
"category": "Games",
"name": "Uno Card Game"
},
"quantity": 2,
"time": "2020-01-24T11:59:02.402+05:30",
"user_alias": {
"alias_label": "rudder_id",
"alias_name": "e6ab2c5e-2cda-44a9-a962-e2f67df78bca"
}
}
]
},
"JSON_ARRAY": {},
"XML": {}
},
"endpoint": "https://rest.fra-01.braze.eu/users/track",
"files": {},
"headers": {
"Accept": "application/json",
"Authorization": "Bearer dummyApiKey",
"Content-Type": "application/json"
},
"method": "POST",
"params": {},
"type": "REST",
"userId": "e6ab2c5e-2cda-44a9-a962-e2f67df78bca",
"version": "1"
}
]
Loading

0 comments on commit 7d23d71

Please sign in to comment.