Skip to content

Commit

Permalink
Merge branch 'develop' into fb_content_type_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepdsvs authored Feb 29, 2024
2 parents 74d7d4b + 2761786 commit 511cfac
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 24 deletions.
25 changes: 23 additions & 2 deletions src/v0/destinations/klaviyo/data/KlaviyoIdentify.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@
"traits.address.region",
"context.traits.region",
"context.traits.address.region",
"properties.region"
"properties.region",
"traits.state",
"traits.address.state",
"context.traits.address.state",
"context.traits.state",
"properties.state"
],
"required": false
},
Expand All @@ -77,14 +82,19 @@
"sourceKeys": [
"traits.zip",
"traits.postalcode",
"traits.postalCode",
"traits.address.zip",
"traits.address.postalcode",
"traits.address.postalCode",
"context.traits.zip",
"context.traits.postalcode",
"context.traits.postalCode",
"context.traits.address.zip",
"context.traits.address.postalcode",
"context.traits.address.postalCode",
"properties.zip",
"properties.postalcode"
"properties.postalcode",
"properties.postalCode"
],
"required": false
},
Expand All @@ -97,5 +107,16 @@
"destKey": "location.timezone",
"sourceKeys": ["traits.timezone", "context.traits.timezone", "properties.timezone"],
"required": false
},
{
"destKey": "location.address1",
"sourceKeys": [
"traits.street",
"traits.address.street",
"context.traits.street",
"context.traits.address.street",
"properties.street"
],
"required": false
}
]
25 changes: 23 additions & 2 deletions src/v0/destinations/klaviyo/data/KlaviyoProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@
"traits.address.region",
"context.traits.region",
"context.traits.address.region",
"properties.region"
"properties.region",
"traits.state",
"traits.address.state",
"context.traits.address.state",
"context.traits.state",
"properties.state"
],
"required": false
},
Expand All @@ -61,14 +66,19 @@
"sourceKeys": [
"traits.zip",
"traits.postalcode",
"traits.postalCode",
"traits.address.zip",
"traits.address.postalcode",
"traits.address.postalCode",
"context.traits.zip",
"context.traits.postalcode",
"context.traits.postalCode",
"context.traits.address.zip",
"context.traits.address.postalcode",
"context.traits.address.postalCode",
"properties.zip",
"properties.postalcode"
"properties.postalcode",
"properties.postalCode"
],
"required": false
},
Expand All @@ -81,5 +91,16 @@
"destKey": "$image",
"sourceKeys": ["traits.image", "context.traits.image", "properties.image"],
"required": false
},
{
"destKey": "$address1",
"sourceKeys": [
"traits.street",
"traits.address.street",
"context.traits.street",
"context.traits.address.street",
"properties.street"
],
"required": false
}
]
4 changes: 2 additions & 2 deletions src/v0/destinations/one_signal/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const trackResponseBuilder = (message, { Config }) => {
if (!externalUserId) {
throw new InstrumentationError('userId is required for track events/updating a device');
}
endpoint = `${endpoint}/${appId}/users/${externalUserId}`;
endpoint = `${endpoint}/${appId}/users/${encodeURIComponent(externalUserId)}`;
const payload = {};
const tags = {};
/* Populating event as true in tags.
Expand Down Expand Up @@ -163,7 +163,7 @@ const groupResponseBuilder = (message, { Config }) => {
if (!externalUserId) {
throw new InstrumentationError('userId is required for group events');
}
endpoint = `${endpoint}/${appId}/users/${externalUserId}`;
endpoint = `${endpoint}/${appId}/users/${encodeURIComponent(externalUserId)}`;
const payload = {};
const tags = {
groupId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ const commonTraits = {
},
};

const commonTraits2 = { ...commonTraits, street: '63, Shibuya' };

const commonOutputUserProps = {
external_id: 'user@1',
email: '[email protected]',
Expand All @@ -67,6 +69,12 @@ const commonOutputUserProps = {
},
};

const commonOutputUserProps2 = {
...commonOutputUserProps,
location: { ...commonOutputUserProps.location, address1: '63, Shibuya' },
properties: { ...commonOutputUserProps.properties, street: '63, Shibuya' },
};

const commonOutputSubscriptionProps = {
list_id: 'XUepkK',
subscriptions: [
Expand Down Expand Up @@ -116,7 +124,7 @@ export const identifyData: ProcessorTestData[] = [
destination,
message: generateSimplifiedIdentifyPayload({
context: {
traits: commonTraits,
traits: commonTraits2,
},
anonymousId,
userId,
Expand All @@ -140,7 +148,7 @@ export const identifyData: ProcessorTestData[] = [
JSON: {
data: {
type: 'profile',
attributes: commonOutputUserProps,
attributes: commonOutputUserProps2,
id: '01GW3PHVY0MTCDGS0A1612HARX',
},
},
Expand Down Expand Up @@ -188,7 +196,7 @@ export const identifyData: ProcessorTestData[] = [
userId,
context: {
traits: {
...commonTraits,
...commonTraits2,
friend: {
names: {
first: 'Alice',
Expand Down Expand Up @@ -221,9 +229,9 @@ export const identifyData: ProcessorTestData[] = [
type: 'profile',
id: '01GW3PHVY0MTCDGS0A1612HARX',
attributes: {
...commonOutputUserProps,
...commonOutputUserProps2,
properties: {
...commonOutputUserProps.properties,
...commonOutputUserProps2.properties,
'friend.age': 25,
'friend.names.first': 'Alice',
'friend.names.last': 'Smith',
Expand Down Expand Up @@ -278,7 +286,7 @@ export const identifyData: ProcessorTestData[] = [
userId,
context: {
traits: {
...commonTraits,
...commonTraits2,
email: '[email protected]',
},
},
Expand Down Expand Up @@ -334,7 +342,7 @@ export const identifyData: ProcessorTestData[] = [
userId,
context: {
traits: {
...commonTraits,
...commonTraits2,
properties: { ...commonTraits.properties, subscribe: false },
},
},
Expand All @@ -358,7 +366,7 @@ export const identifyData: ProcessorTestData[] = [
JSON: {
data: {
type: 'profile',
attributes: commonOutputUserProps,
attributes: commonOutputUserProps2,
id: '01GW3PHVY0MTCDGS0A1612HARX',
},
},
Expand Down Expand Up @@ -390,7 +398,7 @@ export const identifyData: ProcessorTestData[] = [
sentAt,
userId,
context: {
traits: commonTraits,
traits: commonTraits2,
},
anonymousId,
originalTimestamp,
Expand All @@ -414,9 +422,9 @@ export const identifyData: ProcessorTestData[] = [
data: {
type: 'profile',
attributes: removeUndefinedAndNullValues({
...commonOutputUserProps,
...commonOutputUserProps2,
properties: {
...commonOutputUserProps.properties,
...commonOutputUserProps2.properties,
_id: userId,
},
// remove external_id from the payload
Expand Down Expand Up @@ -546,7 +554,7 @@ export const identifyData: ProcessorTestData[] = [
userId,
context: {
traits: removeUndefinedAndNullValues({
...commonTraits,
...commonTraits2,
email: undefined,
phone: undefined,
}),
Expand Down
10 changes: 5 additions & 5 deletions test/integrations/destinations/one_signal/processor/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down Expand Up @@ -789,7 +789,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down Expand Up @@ -870,7 +870,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down Expand Up @@ -945,7 +945,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down Expand Up @@ -1025,7 +1025,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
userId: '',
},
statusCode: 200,
Expand Down
2 changes: 1 addition & 1 deletion test/integrations/destinations/one_signal/router/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const data = [
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
version: '1',
endpoint:
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user@27',
'https://onesignal.com/api/v1/apps/random-818c-4a28-b98e-6cd8a994eb22/users/user%4027',
},
metadata: [{ jobId: 2, userId: 'u1' }],
batched: false,
Expand Down

0 comments on commit 511cfac

Please sign in to comment.