Skip to content

Commit

Permalink
Merge branch 'develop' into fix.gainsight
Browse files Browse the repository at this point in the history
  • Loading branch information
mihir-4116 authored Apr 10, 2024
2 parents 6d3a13d + 007009f commit 2a6963b
Show file tree
Hide file tree
Showing 91 changed files with 1,886 additions and 388 deletions.
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"off",
{ "cases": { "camelCase": true, "pascalCase": true, "kebabCase": true } }
],
"import/no-import-module-exports": "off",
"unicorn/no-instanceof-array": "error",
"unicorn/no-static-only-class": "error",
"unicorn/consistent-destructuring": "error",
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}
payload: |
{
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U02AE5GMMHV> <@U01LVJ30QEB>",
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U024YF8CR53> <@U01LVJ30QEB>",
"blocks": [
{
"type": "header",
Expand All @@ -115,7 +115,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U02AE5GMMHV> <@U01LVJ30QEB>"
"text": "*<${{env.RELEASES_URL}}v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\nCC: <@U03KG4BK1L1> <@U024YF8CR53> <@U01LVJ30QEB>"
}
}
]
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@

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.61.1](https://github.com/rudderlabs/rudder-transformer/compare/v1.61.0...v1.61.1) (2024-04-03)

## [1.61.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.60.0...v1.61.0) (2024-04-02)


### Features

* consent field support for ga4 ([#3213](https://github.com/rudderlabs/rudder-transformer/issues/3213)) ([92515a5](https://github.com/rudderlabs/rudder-transformer/commit/92515a5fd8a2798c48010078f62b360ec6a49979))
* consent field support for gaoc and upgrade the api version from v14 to v16 ([#3121](https://github.com/rudderlabs/rudder-transformer/issues/3121)) ([2aac2a6](https://github.com/rudderlabs/rudder-transformer/commit/2aac2a62547b7a7c617735fc3d6e88e0a1bed76e)), closes [#3190](https://github.com/rudderlabs/rudder-transformer/issues/3190)
* onboard new destination bloomreach ([#3185](https://github.com/rudderlabs/rudder-transformer/issues/3185)) ([d9b7e1f](https://github.com/rudderlabs/rudder-transformer/commit/d9b7e1f70565d59979aee3e62f60e39edb9a23c7))
* onboarding linkedin conversion api ([#3194](https://github.com/rudderlabs/rudder-transformer/issues/3194)) ([eb7b197](https://github.com/rudderlabs/rudder-transformer/commit/eb7b197322c617b14c2579de8cb4d4dacf8e1df3))
* update movable ink batch size ([#3223](https://github.com/rudderlabs/rudder-transformer/issues/3223)) ([667095f](https://github.com/rudderlabs/rudder-transformer/commit/667095fa8316cd95a066f15b848ad503c6b4af80))


### Bug Fixes

* fixed userId mapping, now mapping to uid instead of id ([#3192](https://github.com/rudderlabs/rudder-transformer/issues/3192)) ([70a468b](https://github.com/rudderlabs/rudder-transformer/commit/70a468bf16ecd5ee0b6fecee4b837895d19c525f))
* ninetailed: remove page support ([#3218](https://github.com/rudderlabs/rudder-transformer/issues/3218)) ([2f30c56](https://github.com/rudderlabs/rudder-transformer/commit/2f30c56af62e983d09b5d4f2da9a0ba22f5c1612))
* shopify invalid_event metric prometheus label ([#3200](https://github.com/rudderlabs/rudder-transformer/issues/3200)) ([345c87d](https://github.com/rudderlabs/rudder-transformer/commit/345c87d7c530c621ae3fd6c504d64e5a14e31f22))
* fix: snapchat conversion: add event level_complete ([#3231](https://github.com/rudderlabs/rudder-transformer/issues/3231)) ([39368a0](https://github.com/rudderlabs/rudder-transformer/commit/39368a09e48acc324faa855186bc623e5c347881))

## [1.60.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.57.1...v1.60.0) (2024-03-20)


Expand Down
55 changes: 10 additions & 45 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rudder-transformer",
"version": "1.60.0",
"version": "1.61.1",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down Expand Up @@ -63,8 +63,8 @@
"@datadog/pprof": "^3.1.0",
"@koa/router": "^12.0.0",
"@ndhoule/extend": "^2.0.0",
"@pyroscope/nodejs": "^0.2.6",
"@rudderstack/integrations-lib": "^0.2.7",
"@pyroscope/nodejs": "^0.2.9",
"@rudderstack/integrations-lib": "^0.2.8",
"@rudderstack/workflow-engine": "^0.7.5",
"@shopify/jest-koa-mocks": "^5.1.1",
"ajv": "^8.12.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
{
"destKey": "properties.customer.email",
"sourceKeys": "email",
"sourceKeys": "emailOnly",
"required": false,
"sourceFromGenericMap": true
},
Expand Down
13 changes: 5 additions & 8 deletions src/cdk/v2/destinations/linkedin_ads/rtWorkflow.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
bindings:
- path: ./utils
- path: ./config
- name: handleRtTfSingleEventError
path: ../../../../v0/util/index

steps:
- name: validateInput
Expand All @@ -23,14 +25,9 @@ steps:
})[]
- name: failedEvents
template: |
$.outputs.transform#idx.error.({
"metadata": ^[idx].metadata[],
"destination": ^[idx].destination,
"batched": false,
"statusCode": .status,
"error": .message,
"statTags": .originalError.statTags
})[]
$.outputs.transform#idx.error.(
$.handleRtTfSingleEventError(^[idx], .originalError ?? ., {})
)[]
- name: batchSuccessfulEvents
description: Batches the successfulEvents
Expand Down
3 changes: 3 additions & 0 deletions src/cdk/v2/destinations/linkedin_ads/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ const fetchAndVerifyConversionHappenedAt = (message) => {
};

function batchResponseBuilder(successfulEvents) {
if (successfulEvents.length === 0) {
return [];
}
const constants = {
version: successfulEvents[0].message[0].version,
type: successfulEvents[0].message[0].type,
Expand Down
6 changes: 4 additions & 2 deletions src/cdk/v2/destinations/rakuten/data/propertiesMapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
},
{
"sourceKeys": ["properties.tr", "properties.ran_site_id", "properties.ranSiteID"],
"required": true,
"destKey": "tr"
"destKey": "tr",
"metadata": {
"defaultValue": " "
}
},
{
"sourceKeys": ["properties.land", "properties.land_time", "properties.landTime"],
Expand Down
7 changes: 4 additions & 3 deletions src/cdk/v2/destinations/reddit/procWorkflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ bindings:
path: ../../../../v0/util/index
- name: OAuthSecretError
path: '@rudderstack/integrations-lib'
- path: ./utils

steps:
- name: validateInput
Expand Down Expand Up @@ -56,14 +57,14 @@ steps:
const event_type = (eventNames.length === 0 || eventNames[0]==="") ? ({"tracking_type": "Custom", "custom_event_name": event}): ({tracking_type: eventNames[0]});
- name: customFields
condition: $.outputs.prepareTrackPayload.eventType.tracking_type === "Purchase"
condition: $.outputs.prepareTrackPayload.eventType.tracking_type in ['Purchase', 'AddToCart', 'ViewContent']
reference: 'https://ads-api.reddit.com/docs/v2/#tag/Conversions/paths/~1api~1v2.0~1conversions~1events~1%7Baccount_id%7D/post'
template: |
const revenue_in_cents = .message.properties.revenue ? Math.round(Number(.message.properties.revenue)*100)
const revenue_in_cents = $.populateRevenueField($.outputs.prepareTrackPayload.eventType.tracking_type,^.message.properties)
const customFields = .message.().({
"currency": .properties.currency,
"value_decimal": revenue_in_cents ? revenue_in_cents / 100,
"item_count": (Array.isArray(.properties.products) && .properties.products.length) || (.properties.itemCount && Number(.properties.itemCount)),
"item_count": $.outputs.prepareTrackPayload.eventType.tracking_type === 'Purchase' ? (Array.isArray(.properties.products) && .properties.products.length) || (.properties.itemCount && Number(.properties.itemCount)) : null,
"value": revenue_in_cents,
"conversion_id": .properties.conversionId || .messageId,
});
Expand Down
53 changes: 53 additions & 0 deletions src/cdk/v2/destinations/reddit/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,59 @@ const batchEvents = (successfulEvents) => {
const batchedEvents = batchEventChunks(eventChunks);
return batchedEvents;
};

const calculateDefaultRevenue = (properties) => {
// Check if working with products array
if (properties?.products && properties.products.length > 0) {
// Check if all product prices are undefined
if (properties.products.every((product) => product.price === undefined)) {
return null; // Return null if all product prices are undefined
}
// Proceed with calculation if not all prices are undefined
return properties.products.reduce(
(acc, product) => acc + (product.price || 0) * (product.quantity || 1),
0,
);
}
// For single product scenario, check if price is undefined
if (properties.price === undefined) {
return null; // Return null if price is undefined
}
// Proceed with calculation if price is defined
return properties.price * (properties.quantity ?? 1);
};

const populateRevenueField = (eventType, properties) => {
let revenueInCents;
switch (eventType) {
case 'Purchase':
revenueInCents =
properties.revenue && !Number.isNaN(properties.revenue)
? Math.round(Number(properties?.revenue) * 100)
: null;
break;
case 'AddToCart':
revenueInCents =
properties.price && !Number.isNaN(properties.price)
? Math.round(Number(properties?.price) * Number(properties?.quantity || 1) * 100)
: null;
break;
default:
// for viewContent
// eslint-disable-next-line no-case-declarations
const revenue = calculateDefaultRevenue(properties);
revenueInCents = revenue ? revenue * 100 : null;
break;
}

if (lodash.isNaN(revenueInCents)) {
return null;
}
// Return the value as it is if it's not NaN
return revenueInCents;
};
module.exports = {
batchEvents,
populateRevenueField,
calculateDefaultRevenue,
};
Loading

0 comments on commit 2a6963b

Please sign in to comment.