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 12, 2023
2 parents 1b9900e + 50e921d commit 2b880d6
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
docker buildx imagetools create -t ${{ inputs.push_tags }} ${{ inputs.push_tags }}-amd64 ${{ inputs.push_tags }}-arm64
- name: Create latest multi-arch manifest
# To be triggered only for release/hotfix PR merges coming from `prepare-for-prod-deploy.yaml`
# To be triggered only for release/hotfix PR merges coming from `prepare-for-prod-dt-deploy.yaml`
if: ${{ inputs.build_type == 'dt' }}
run: |
docker buildx imagetools create -t rudderstack/rudder-transformer:latest ${{ inputs.push_tags }}-amd64 ${{ inputs.push_tags }}-arm64
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Prepare for Production Environment Deployment
name: Prepare for DT Production Environment Deployment

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-ut-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Prepare for Production Environment Deployment
name: Prepare for UT Production Environment Deployment

on:
push:
Expand Down
3 changes: 3 additions & 0 deletions src/v0/destinations/adobe_analytics/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,9 @@ const processTrackEvent = (message, adobeEventName, destinationConfig, extras =
const handleTrack = (message, destinationConfig) => {
const ORDER_ID_KEY = 'properties.order_id';
const { event: rawEvent, properties } = message;
if (!rawEvent) {
throw new InstrumentationError('Event name is not present. Aborting message.');
}
let payload = null;
// handle ecommerce events separately
// generic events should go to the default
Expand Down
5 changes: 4 additions & 1 deletion src/v0/destinations/braze/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ function populateCustomAttributesWithOperation(
// add,update,remove on json attributes
if (enableNestedArrayOperations) {
Object.keys(traits)
.filter((key) => typeof traits[key] === 'object' && !Array.isArray(traits[key]))
.filter(
(key) =>
traits[key] !== null && typeof traits[key] === 'object' && !Array.isArray(traits[key]),
)
.forEach((key) => {
if (traits[key][CustomAttributeOperationTypes.UPDATE]) {
CustomAttributeOperationUtil.customAttributeUpdateOperation(
Expand Down
4 changes: 4 additions & 0 deletions src/v0/destinations/klaviyo/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ const identifyRequestHandler = async (message, category, destination, reqMetadat
data.attributes.properties = flattenProperties
? flattenJson(data.attributes.properties, '.', 'normal', false)
: data.attributes.properties;

if (isEmptyObject(data.attributes.properties)) {
delete data.attributes.properties;
}
const payload = {
data: removeUndefinedAndNullValues(data),
};
Expand Down
144 changes: 144 additions & 0 deletions test/__tests__/data/klaviyo.json
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,150 @@
}
]
},
{
"description": "Identify call without user custom Properties",
"input": {
"destination": {
"Config": {
"publicApiKey": "dummyPublicApiKey",
"privateApiKey": "dummyPrivateApiKey",
"enforceEmailAsPrimary": false
}
},
"message": {
"type": "identify",
"sentAt": "2021-01-03T17:02:53.195Z",
"userId": "user@1",
"channel": "web",
"context": {
"os": {
"name": "",
"version": ""
},
"app": {
"name": "RudderLabs JavaScript SDK",
"build": "1.0.0",
"version": "1.1.11",
"namespace": "com.rudderlabs.javascript"
},
"traits": {
"firstName": "Test",
"lastName": "Rudderlabs",
"email": "[email protected]",
"phone": "+12 345 578 900",
"userId": "user@1",
"title": "Developer",
"organization": "Rudder",
"city": "Tokyo",
"region": "Kanto",
"country": "JP",
"zip": "100-0001",
"properties": {
"listId": "XUepkK",
"subscribe": true,
"consent": ["email", "sms"]
}
},
"locale": "en-US",
"screen": {
"density": 2
},
"library": {
"name": "RudderLabs JavaScript SDK",
"version": "1.1.11"
},
"campaign": {},
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0"
},
"rudderId": "8f8fa6b5-8e24-489c-8e22-61f23f2e364f",
"messageId": "2116ef8c-efc3-4ca4-851b-02ee60dad6ff",
"anonymousId": "97c46c81-3140-456d-b2a9-690d70aaca35",
"integrations": {
"All": true
},
"originalTimestamp": "2021-01-03T17:02:53.193Z"
}
},
"output": [
{
"version": "1",
"type": "REST",
"method": "PATCH",
"endpoint": "https://a.klaviyo.com/api/profiles/01GW3PHVY0MTCDGS0A1612HARX",
"headers": {
"Authorization": "Klaviyo-API-Key dummyPrivateApiKey",
"Content-Type": "application/json",
"Accept": "application/json",
"revision": "2023-02-22"
},
"params": {},
"body": {
"JSON": {
"data": {
"type": "profile",
"attributes": {
"email": "[email protected]",
"first_name": "Test",
"last_name": "Rudderlabs",
"phone_number": "+12 345 578 900",
"external_id": "user@1",
"title": "Developer",
"organization": "Rudder",
"location": {
"city": "Tokyo",
"region": "Kanto",
"country": "JP",
"zip": "100-0001"
}
},
"id": "01GW3PHVY0MTCDGS0A1612HARX"
}
},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"files": {}
},
{
"version": "1",
"type": "REST",
"method": "POST",
"endpoint": "https://a.klaviyo.com/api/profile-subscription-bulk-create-jobs",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json",
"Authorization": "Klaviyo-API-Key dummyPrivateApiKey",
"revision": "2023-02-22"
},
"params": {},
"body": {
"JSON": {
"data": {
"type": "profile-subscription-bulk-create-job",
"attributes": {
"list_id": "XUepkK",
"subscriptions": [
{
"email": "[email protected]",
"phone_number": "+12 345 578 900",
"channels": {
"email": ["MARKETING"],
"sms": ["MARKETING"]
}
}
]
}
}
},
"JSON_ARRAY": {},
"XML": {},
"FORM": {}
},
"files": {}
}
]
},
{
"description": "Identify call without email and phone & enforceEmailAsPrimary enabled from UI",
"input": {
Expand Down
45 changes: 45 additions & 0 deletions test/integrations/destinations/adobe_analytics/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3057,4 +3057,49 @@ export const data = [
},
},
},
{
name: 'adobe_analytics',
description: 'Test 17: Event is missing for track',
feature: 'processor',
module: 'destination',
version: 'v0',
input: {
request: {
body: [
{
message: {
anonymousId: '78c53c15-32a1-4b65-adac-bec2d7bb8fab',
channel: 'web',
originalTimestamp: '2020-01-09T10:01:53.558Z',
type: 'track',
sentAt: '2020-01-09T10:02:03.257Z',
},
destination: {
Config: {},
},
},
],
method: 'POST',
},
},
output: {
response: {
status: 200,
body: [
{
error: 'Event name is not present. Aborting message.',
statTags: {
destType: 'ADOBE_ANALYTICS',
errorCategory: 'dataValidation',
errorType: 'instrumentation',
feature: 'processor',
implementation: 'native',
module: 'destination',
},
statusCode: 400,
},
],
},
},
},
];

0 comments on commit 2b880d6

Please sign in to comment.