Skip to content

Commit

Permalink
chore(release): pull main into develop post release v1.83.0 (#3834)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai authored Oct 30, 2024
2 parents 3a09181 + 64583d0 commit a15a9fe
Show file tree
Hide file tree
Showing 11 changed files with 665 additions and 253 deletions.
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.83.0](https://github.com/rudderlabs/rudder-transformer/compare/v1.82.2...v1.83.0) (2024-10-25)


### Features

* add support for identity stitching for shopify pixel flow ([#3818](https://github.com/rudderlabs/rudder-transformer/issues/3818)) ([3a09181](https://github.com/rudderlabs/rudder-transformer/commit/3a091810bff12ae893c16b514c07d17e6374062a))
* onboard tune destination ([#3795](https://github.com/rudderlabs/rudder-transformer/issues/3795)) ([741f0c6](https://github.com/rudderlabs/rudder-transformer/commit/741f0c6d6714cf760ce98cc9354b61f7b5ce4684))
* snowpipe streaming ([#3740](https://github.com/rudderlabs/rudder-transformer/issues/3740)) ([21b1039](https://github.com/rudderlabs/rudder-transformer/commit/21b1039c26067b4896a15adf8b10a044e69cb495))
* support for multiple zap urls ([#3825](https://github.com/rudderlabs/rudder-transformer/issues/3825)) ([f79dfe7](https://github.com/rudderlabs/rudder-transformer/commit/f79dfe74b447b8ccd80287e143ff771688c510be))


### Bug Fixes

* add missing field for pinterest_tag single product events ([f781a84](https://github.com/rudderlabs/rudder-transformer/commit/f781a84ade98649d68cebf4da13c2ceff8df2df2))
* add missing field for pinterest_tag single product events ([#3826](https://github.com/rudderlabs/rudder-transformer/issues/3826)) ([4a63277](https://github.com/rudderlabs/rudder-transformer/commit/4a63277efd0b4357d8321618640d1a0ba2a47d71))
* heap userId extraction ([#3801](https://github.com/rudderlabs/rudder-transformer/issues/3801)) ([e578413](https://github.com/rudderlabs/rudder-transformer/commit/e57841396ad666d716e195fbd4e9b74a63bf5191))
* not allowing empty string or null values for mandatory fields in zoho ([#3800](https://github.com/rudderlabs/rudder-transformer/issues/3800)) ([fcd8d99](https://github.com/rudderlabs/rudder-transformer/commit/fcd8d997fe815d61d21ffff235b0799e69b7ded9))
* populate source destination info env set properly ([#3806](https://github.com/rudderlabs/rudder-transformer/issues/3806)) ([d730daf](https://github.com/rudderlabs/rudder-transformer/commit/d730dafbbd2de30b67c35db8ca05396a98a8d2e0))
* str replace is not a function error ([#3799](https://github.com/rudderlabs/rudder-transformer/issues/3799)) ([8f18e1a](https://github.com/rudderlabs/rudder-transformer/commit/8f18e1aca70ab68e3f157a4632d63ae7cec0e87b))
* update order_id in checkout events, messageId in pixel events ([#3794](https://github.com/rudderlabs/rudder-transformer/issues/3794)) ([427be71](https://github.com/rudderlabs/rudder-transformer/commit/427be71a91df8495f81b42d2b58aa490db439b23))

### [1.82.2](https://github.com/rudderlabs/rudder-transformer/compare/v1.82.1...v1.82.2) (2024-10-18)


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.82.2",
"version": "1.83.0",
"description": "",
"homepage": "https://github.com/rudderlabs/rudder-transformer#readme",
"bugs": {
Expand Down
8 changes: 6 additions & 2 deletions src/v0/destinations/tune/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const {
isNotEmpty,
} = require('../../util');

const getTuneEndpoint = (subdomain) => `https://${subdomain}.go2cloud.org/aff_l`;

const mapPropertiesWithNestedSupport = (msg, properties, mappings) => {
const mappedObj = {}; // Create a new object for parameters
Object.entries(mappings).forEach(([key, value]) => {
Expand All @@ -26,7 +28,7 @@ const mapPropertiesWithNestedSupport = (msg, properties, mappings) => {
};

const responseBuilder = (message, { Config }) => {
const { tuneEvents } = Config; // Extract tuneEvents from config
const { tuneEvents, subdomain } = Config; // Extract tuneEvents from config
const { properties, event: messageEvent } = message; // Destructure properties and event from message

// Find the relevant tune event based on the message's event name
Expand All @@ -43,10 +45,12 @@ const responseBuilder = (message, { Config }) => {
...mapPropertiesWithNestedSupport(message, properties, advUniqueIdHashMap),
};

const endpoint = getTuneEndpoint(subdomain);

// Prepare the response
const response = defaultRequestConfig();
response.params = params; // Set only the mapped params
response.endpoint = tuneEvent.url; // Use the user-defined URL
response.endpoint = endpoint;

return response;
}
Expand Down
2 changes: 1 addition & 1 deletion src/v1/sources/shopify/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const PIXEL_EVENT_MAPPING = {
product_viewed: 'Product Viewed',
collection_viewed: 'Collection Viewed',
checkout_started: 'Checkout Started',
checkout_completed: 'Checkout Completed',
checkout_completed: 'Order Completed',
checkout_address_info_submitted: 'Checkout Address Info Submitted',
checkout_contact_info_submitted: 'Checkout Contact Info Submitted',
checkout_shipping_info_submitted: 'Checkout Shipping Info Submitted',
Expand Down
58 changes: 39 additions & 19 deletions src/v1/sources/shopify/pixelUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ function setNestedValue(object, path, value) {
}, object);
}

function mapObjectKeys(sourceObject, keyMappings) {
if (!Array.isArray(keyMappings)) {
throw new TypeError('keyMappings should be an array');
}
/*
* Creates a copy of the source object with the keys mapped to the destination keys
* Keys that are not present in the mapping will be copied as is
* @param {Object} sourceObject
* @param {Array} keyMappings
* @returns {Object} resultObject
*/
function mapContextObjectKeys(sourceObject, keyMappings) {
const resultObject = { ...sourceObject };

// eslint-disable-next-line @typescript-eslint/no-shadow
Expand All @@ -46,24 +50,40 @@ function mapObjectKeys(sourceObject, keyMappings) {
}, resultObject);
}

/*
* Maps the keys of the source object to the destination object
* Only the keys that are present in the mapping will be copied
* @param {Object} sourceObject
* @param {Array} keyMappings
* @returns {Object} trackProperties
*/
function mapObjectKeys(sourceObject, keyMappings) {
const trackProperties = {};

keyMappings.forEach(({ sourceKeys, destKeys }) => {
const value = getNestedValue(sourceObject, sourceKeys);
if (value !== undefined) {
setNestedValue(trackProperties, destKeys, value);
}
});

return trackProperties;
}

const createMessage = (eventType, eventName, properties, context) => {
const message = new Message(INTEGERATION);
message.setEventType(eventType);
message.setEventName(eventName);
if (eventType === EventType.TRACK) message.setEventName(eventName);
else message.name = eventName;
message.properties = properties;
message.context = context;
return message;
};

const pageViewedEventBuilder = (inputEvent) => {
const { data, context } = inputEvent;
const pageEventContextValues = mapObjectKeys(context, contextualFieldMappingJSON);
const message = new Message(INTEGERATION);
message.name = 'Page View';
message.setEventType(EventType.PAGE);
message.properties = { ...data };
message.context = { ...pageEventContextValues };
return message;
const pageEventContextValues = mapContextObjectKeys(context, contextualFieldMappingJSON);
return createMessage(EventType.PAGE, 'Page View', { ...data }, pageEventContextValues);
};

const cartViewedEventBuilder = (inputEvent) => {
Expand All @@ -83,7 +103,7 @@ const cartViewedEventBuilder = (inputEvent) => {
cart_id: inputEvent.data.cart.id,
total,
};
const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON);
const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON);
return createMessage(EventType.TRACK, 'Cart Viewed', properties, contextualPayload);
};

Expand All @@ -102,23 +122,23 @@ const productListViewedEventBuilder = (inputEvent) => {
products,
};

const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON);
const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON);
return createMessage(EventType.TRACK, 'Product List Viewed', properties, contextualPayload);
};

const productViewedEventBuilder = (inputEvent) => {
const properties = {
...mapObjectKeys(inputEvent.data, productViewedEventMappingJSON),
};
const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON);
const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON);
return createMessage(EventType.TRACK, 'Product Viewed', properties, contextualPayload);
};

const productToCartEventBuilder = (inputEvent) => {
const properties = {
...mapObjectKeys(inputEvent.data, productToCartEventMappingJSON),
};
const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON);
const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON);
return createMessage(
EventType.TRACK,
PIXEL_EVENT_MAPPING[inputEvent.name],
Expand Down Expand Up @@ -148,7 +168,7 @@ const checkoutEventBuilder = (inputEvent) => {
value: inputEvent?.data?.checkout?.totalPrice?.amount,
tax: inputEvent?.data?.checkout?.totalTax?.amount,
};
const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON);
const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON);
return createMessage(
EventType.TRACK,
PIXEL_EVENT_MAPPING[inputEvent.name],
Expand All @@ -158,7 +178,7 @@ const checkoutEventBuilder = (inputEvent) => {
};

const checkoutStepEventBuilder = (inputEvent) => {
const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON);
const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON);
const properties = {
...inputEvent.data.checkout,
};
Expand All @@ -174,7 +194,7 @@ const searchEventBuilder = (inputEvent) => {
const properties = {
query: inputEvent.data.searchResult.query,
};
const contextualPayload = mapObjectKeys(inputEvent.context, contextualFieldMappingJSON);
const contextualPayload = mapContextObjectKeys(inputEvent.context, contextualFieldMappingJSON);
return createMessage(
EventType.TRACK,
PIXEL_EVENT_MAPPING[inputEvent.name],
Expand Down
Loading

0 comments on commit a15a9fe

Please sign in to comment.