Skip to content

Commit

Permalink
Merge branch 'develop' into feat.intercom-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 authored Dec 7, 2023
2 parents 39e93ce + 7131791 commit a4bdb14
Show file tree
Hide file tree
Showing 21 changed files with 499 additions and 46 deletions.
57 changes: 57 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## What are the changes introduced in this PR?

Write a brief explainer on your code changes.

## Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, **mandatorily** mention them here

### Type of change

If the pull request is a **bug-fix**, **enhancement** or a **refactor**, please fill in the details on the changes made.

- Existing capabilities/behavior

- New capabilities/behavior

If the pull request is a **new feature**,

### Any technical or performance related pointers to consider with the change?

N/A

### Any new dependencies introduced with this change?

N/A

### Any new generic utility introduced or modified. Please explain the changes.

N/A

### If the PR has changes in more than 10 files, please mention why the changes were not split into multiple PRs.

N/A

### If multiple linear tasks are associated with the PR changes, please elaborate on the reason:

N/A

<hr>

### Developer checklist

- [ ] **No breaking changes are being introduced.**

- [ ] Are all related docs linked with the PR?

- [ ] Are all changes manually tested?

- [ ] Does this change require any documentation changes?

- [ ] Are relevant unit and component test-cases added?

### Reviewer checklist

- [ ] Is the type of change in the PR title appropriate as per the changes?

- [ ] Verified that there are no credentials or confidential data exposed with the changes.
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,48 @@

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


### Bug Fixes

* marketo backward compatibility ([#2880](https://github.com/rudderlabs/rudder-transformer/issues/2880)) ([af6aebb](https://github.com/rudderlabs/rudder-transformer/commit/af6aebba9a9891fadc91fe2dc4ae4db4b1e269c9))
* marketo new field introduction backward compatibility ([cd6c3b0](https://github.com/rudderlabs/rudder-transformer/commit/cd6c3b0672a0b17078627f28f6613a2ef1898ee7))
* remove ErrorResponse type from postTransfomration delivery ([b13f0a6](https://github.com/rudderlabs/rudder-transformer/commit/b13f0a6340177a56417692ad7dcf3829d4990826))

## [1.51.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.50.1...v1.51.0) (2023-12-06)


### Features

* cm360 router batching ([#2836](https://github.com/rudderlabs/rudder-transformer/issues/2836)) ([4b260e4](https://github.com/rudderlabs/rudder-transformer/commit/4b260e4ec6d25875903830004b3e4975b3402b2d))
* cm360 transformerproxy V1 flag ([#2848](https://github.com/rudderlabs/rudder-transformer/issues/2848)) ([27f0797](https://github.com/rudderlabs/rudder-transformer/commit/27f0797c6dcd626a713c11a48c6e85a69e0a4963))
* **INT-305:** onboard gladly destination ([#2786](https://github.com/rudderlabs/rudder-transformer/issues/2786)) ([ff80b88](https://github.com/rudderlabs/rudder-transformer/commit/ff80b885fe0507c137b3c9eacffcef331010da0c))
* marketo: migrate config fields and fix test cases ([#2789](https://github.com/rudderlabs/rudder-transformer/issues/2789)) ([7910dba](https://github.com/rudderlabs/rudder-transformer/commit/7910dba2318f92cec3be1b7c7aa6b00428ecae94))
* mixpanel set once feature onboard ([#2820](https://github.com/rudderlabs/rudder-transformer/issues/2820)) ([9eda50e](https://github.com/rudderlabs/rudder-transformer/commit/9eda50e850c5a1ccb46f1b54c3d176edb915eb27))
* onboard webhook to component tests ([#2837](https://github.com/rudderlabs/rudder-transformer/issues/2837)) ([284d141](https://github.com/rudderlabs/rudder-transformer/commit/284d1411514c26dda2403a4a18967e5f40e255ea))
* update facebook destinations API version to v18.0 ([#2828](https://github.com/rudderlabs/rudder-transformer/issues/2828)) ([3127a1c](https://github.com/rudderlabs/rudder-transformer/commit/3127a1ca8dc1b887f9158a1d839c5504f40c4678))


### Bug Fixes

* add support for custom properties for braze purchase events ([#2856](https://github.com/rudderlabs/rudder-transformer/issues/2856)) ([be6ef26](https://github.com/rudderlabs/rudder-transformer/commit/be6ef2605f04e9182534b9633eeec1091cf7a431))
* bugsnag issue in moengage identify event ([#2845](https://github.com/rudderlabs/rudder-transformer/issues/2845)) ([0e7adc6](https://github.com/rudderlabs/rudder-transformer/commit/0e7adc66ff88d9510e48a5651460b4e02cc57c78))
* encode &, < and > to html counterparts in adobe analytics ([#2854](https://github.com/rudderlabs/rudder-transformer/issues/2854)) ([571dbf5](https://github.com/rudderlabs/rudder-transformer/commit/571dbf5bd65e7d0e261562ff3da3b393f27f27b6))
* error handling in active_campaign ([#2843](https://github.com/rudderlabs/rudder-transformer/issues/2843)) ([a015460](https://github.com/rudderlabs/rudder-transformer/commit/a015460f0a6d2d5320f633abc151febf22561b6b))
* make supportTransformerProxyV1 false ([#2861](https://github.com/rudderlabs/rudder-transformer/issues/2861)) ([80cf69d](https://github.com/rudderlabs/rudder-transformer/commit/80cf69dc40bb4dc7c0a6d516814f36d962018745))
* remove errorCategory for braze dedup error ([#2850](https://github.com/rudderlabs/rudder-transformer/issues/2850)) ([91d4cd1](https://github.com/rudderlabs/rudder-transformer/commit/91d4cd16f9839b0be5a663ca5010bdd72cff9bdc))
* sfmc bug fix for track event validations ([#2852](https://github.com/rudderlabs/rudder-transformer/issues/2852)) ([cd9a046](https://github.com/rudderlabs/rudder-transformer/commit/cd9a046f66eab8363373cb9a0fa1afeef3137d78))
* unhandled error code in facebook_custom_audience ([#2853](https://github.com/rudderlabs/rudder-transformer/issues/2853)) ([8c02b8c](https://github.com/rudderlabs/rudder-transformer/commit/8c02b8ccb2101147ac84b4555e7fd07235ebf9fc))
* updated transformerProxyV1 name ([#2859](https://github.com/rudderlabs/rudder-transformer/issues/2859)) ([1a8d825](https://github.com/rudderlabs/rudder-transformer/commit/1a8d825ccbb87d34d8ae5ff2cb02f4be9700eee6))

### [1.50.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.50.0...v1.50.1) (2023-12-05)


### Bug Fixes

* salesforce transformer proxy response handling issue for authorization flow ([#2873](https://github.com/rudderlabs/rudder-transformer/issues/2873)) ([4cec65e](https://github.com/rudderlabs/rudder-transformer/commit/4cec65e4103e99021f5108fcc7c557b952f1c5eb))

## [1.50.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.49.1...v1.50.0) (2023-11-13)


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.50.0",
"version": "1.51.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
1 change: 0 additions & 1 deletion src/cdk/v2/destinations/tiktok_audience/rtWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ steps:
loopOverInput: true

- name: successfulEvents
debug: true
template: |
$.outputs.transform#idx{"output" in .}.({
"batchedRequest": .output,
Expand Down
17 changes: 1 addition & 16 deletions src/services/destination/postTransformation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@ import { ErrorReportingService } from '../errorReporting';
import tags from '../../v0/util/tags';
import stats from '../../util/stats';

type ErrorResponse = {
status?: number;
message?: string;
destinationResponse?: object;
statTags?: object;
authErrorCategory?: string | undefined;
response?: object | undefined;
};

export class DestinationPostTransformationService {
public static handleProcessorTransformSucessEvents(
event: ProcessorTransformationRequest,
Expand Down Expand Up @@ -148,7 +139,7 @@ export class DestinationPostTransformationService {
}

public static handleDeliveryFailureEvents(
error: ErrorResponse,
error: NonNullable<unknown>,
metaTo: MetaTransferObject,
): DeliveryResponse {
const errObj = generateErrorObject(error, metaTo.errorDetails, false);
Expand All @@ -161,12 +152,6 @@ export class DestinationPostTransformationService {
authErrorCategory: errObj.authErrorCategory,
}),
} as DeliveryResponse;

// for transformer-proxy to maintain contract
const { response } = error;
if (response) {
resp.response = response;
}
ErrorReportingService.reportError(error, metaTo.errorContext, resp);
return resp;
}
Expand Down
6 changes: 6 additions & 0 deletions src/util/prometheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,12 @@ class Prometheus {
type: 'counter',
labelNames: ['type', 'writeKey', 'source'],
},
{
name: 'shopify_anon_id_resolve',
help: 'shopify_anon_id_resolve',
type: 'counter',
labelNames: ['method', 'writeKey', 'shopifyTopic'],
},
{
name: 'shopify_redis_calls',
help: 'shopify_redis_calls',
Expand Down
141 changes: 141 additions & 0 deletions src/v0/destinations/braze/braze.util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1219,4 +1219,145 @@ describe('getPurchaseObjs', () => {
);
}
});

test('products having extra properties', () => {
const output = getPurchaseObjs(
{
properties: {
products: [
{ product_id: '123', price: 10.99, quantity: 2, random_extra_property_a: 'abc' },
{ product_id: '456', price: 5.49, quantity: 1, random_extra_property_b: 'efg' },
{
product_id: '789',
price: 15.49,
quantity: 1,
random_extra_property_a: 'abc',
random_extra_property_b: 'efg',
random_extra_property_c: 'hij',
},
],
currency: 'USD',
},
timestamp: '2023-08-04T12:34:56Z',
anonymousId: 'abc',
},
{
sendPurchaseEventWithExtraProperties: true,
},
);
expect(output).toEqual([
{
product_id: '123',
price: 10.99,
currency: 'USD',
quantity: 2,
time: '2023-08-04T12:34:56Z',
properties: {
random_extra_property_a: 'abc',
},
_update_existing_only: false,
user_alias: {
alias_name: 'abc',
alias_label: 'rudder_id',
},
},
{
product_id: '456',
price: 5.49,
currency: 'USD',
quantity: 1,
time: '2023-08-04T12:34:56Z',
properties: {
random_extra_property_b: 'efg',
},
_update_existing_only: false,
user_alias: {
alias_name: 'abc',
alias_label: 'rudder_id',
},
},
{
product_id: '789',
price: 15.49,
currency: 'USD',
quantity: 1,
time: '2023-08-04T12:34:56Z',
properties: {
random_extra_property_a: 'abc',
random_extra_property_b: 'efg',
random_extra_property_c: 'hij',
},
_update_existing_only: false,
user_alias: {
alias_name: 'abc',
alias_label: 'rudder_id',
},
},
]);
});

test('products having extra properties with sendPurchaseEventWithExtraProperties as false', () => {
const output = getPurchaseObjs(
{
properties: {
products: [
{ product_id: '123', price: 10.99, quantity: 2, random_extra_property_a: 'abc' },
{ product_id: '456', price: 5.49, quantity: 1, random_extra_property_b: 'efg' },
{
product_id: '789',
price: 15.49,
quantity: 1,
random_extra_property_a: 'abc',
random_extra_property_b: 'efg',
random_extra_property_c: 'hij',
},
],
currency: 'USD',
},
timestamp: '2023-08-04T12:34:56Z',
anonymousId: 'abc',
},
{
sendPurchaseEventWithExtraProperties: false,
},
);
expect(output).toEqual([
{
product_id: '123',
price: 10.99,
currency: 'USD',
quantity: 2,
time: '2023-08-04T12:34:56Z',
_update_existing_only: false,
user_alias: {
alias_name: 'abc',
alias_label: 'rudder_id',
},
},
{
product_id: '456',
price: 5.49,
currency: 'USD',
quantity: 1,
time: '2023-08-04T12:34:56Z',
_update_existing_only: false,
user_alias: {
alias_name: 'abc',
alias_label: 'rudder_id',
},
},
{
product_id: '789',
price: 15.49,
currency: 'USD',
quantity: 1,
time: '2023-08-04T12:34:56Z',
_update_existing_only: false,
user_alias: {
alias_name: 'abc',
alias_label: 'rudder_id',
},
},
]);
});
});
4 changes: 3 additions & 1 deletion src/v0/destinations/braze/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const BRAZE_NON_BILLABLE_ATTRIBUTES = [
'subscription_groups',
];

const BRAZE_PURCHASE_STANDARD_PROPERTIES = ['product_id', 'sku', 'price', 'quantity', 'currency'];
module.exports = {
ConfigCategory,
mappingConfig,
Expand All @@ -64,12 +65,13 @@ module.exports = {
getSubscriptionGroupEndPoint,
getAliasMergeEndPoint,
BRAZE_PARTNER_NAME,
BRAZE_PURCHASE_STANDARD_PROPERTIES,
TRACK_BRAZE_MAX_REQ_COUNT,
IDENTIFY_BRAZE_MAX_REQ_COUNT,
DESTINATION,
CustomAttributeOperationTypes,
DEL_MAX_BATCH_SIZE,
BRAZE_NON_BILLABLE_ATTRIBUTES,
ALIAS_BRAZE_MAX_REQ_COUNT,
SUBSCRIPTION_BRAZE_MAX_REQ_COUNT
SUBSCRIPTION_BRAZE_MAX_REQ_COUNT,
};
2 changes: 1 addition & 1 deletion src/v0/destinations/braze/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ function processTrackEvent(messageType, message, destination, mappingJson, proce
typeof eventName === 'string' &&
eventName.toLowerCase() === 'order completed'
) {
const purchaseObjs = getPurchaseObjs(message);
const purchaseObjs = getPurchaseObjs(message, destination.Config);

// del used properties
delete properties.products;
Expand Down
7 changes: 6 additions & 1 deletion src/v0/destinations/braze/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const {
SUBSCRIPTION_BRAZE_MAX_REQ_COUNT,
ALIAS_BRAZE_MAX_REQ_COUNT,
TRACK_BRAZE_MAX_REQ_COUNT,
BRAZE_PURCHASE_STANDARD_PROPERTIES,
} = require('./config');
const { JSON_MIME_TYPE, HTTP_STATUS_CODES } = require('../../util/constant');
const { isObject } = require('../../util');
Expand Down Expand Up @@ -539,7 +540,7 @@ function addMandatoryPurchaseProperties(productId, price, currencyCode, quantity
};
}

function getPurchaseObjs(message) {
function getPurchaseObjs(message, config) {
// ref:https://www.braze.com/docs/api/objects_filters/purchase_object/
const validateForPurchaseEvent = (message) => {
const { properties } = message;
Expand Down Expand Up @@ -634,6 +635,10 @@ function getPurchaseObjs(message) {
parseInt(quantity, 10),
timestamp,
);
const extraProperties = _.omit(product, BRAZE_PURCHASE_STANDARD_PROPERTIES);
if (Object.keys(extraProperties).length > 0 && config.sendPurchaseEventWithExtraProperties) {
purchaseObj = { ...purchaseObj, properties: extraProperties };
}
purchaseObj = setExternalIdOrAliasObject(purchaseObj, message);
purchaseObjs.push(purchaseObj);
});
Expand Down
Loading

0 comments on commit a4bdb14

Please sign in to comment.