-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cm360 enhanced conversions (#3414)
* feat: cm360 enhanced conversions * refactor: added null, empty checks
- Loading branch information
1 parent
d4d5a89
commit 04d0783
Showing
9 changed files
with
744 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/v0/destinations/campaign_manager/data/CampaignManagerEnhancedConversionConfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[ | ||
{ | ||
"destKey": "hashedEmail", | ||
"sourceKeys": "emailOnly", | ||
"sourceFromGenericMap": true | ||
}, | ||
{ | ||
"destKey": "hashedPhoneNumber", | ||
"sourceKeys": "phone", | ||
"sourceFromGenericMap": true | ||
}, | ||
{ | ||
"destKey": "addressInfo.hashedFirstName", | ||
"sourceKeys": "firstName", | ||
"sourceFromGenericMap": true | ||
}, | ||
{ | ||
"destKey": "addressInfo.hashedLastName", | ||
"sourceKeys": "lastName", | ||
"sourceFromGenericMap": true | ||
}, | ||
{ | ||
"destKey": "addressInfo.hashedStreetAddress", | ||
"sourceKeys": "street", | ||
"sourceFromGenericMap": true | ||
}, | ||
{ | ||
"destKey": "addressInfo.city", | ||
"sourceKeys": [ | ||
"traits.city", | ||
"traits.address.city", | ||
"context.traits.city", | ||
"context.traits.address.city" | ||
] | ||
}, | ||
{ | ||
"destKey": "addressInfo.state", | ||
"sourceKeys": [ | ||
"traits.state", | ||
"traits.address.state", | ||
"context.traits.state", | ||
"context.traits.address.state" | ||
] | ||
}, | ||
{ | ||
"destKey": "addressInfo.countryCode", | ||
"sourceKeys": [ | ||
"traits.country", | ||
"traits.address.country", | ||
"context.traits.country", | ||
"context.traits.address.country" | ||
] | ||
}, | ||
{ | ||
"destKey": "addressInfo.postalCode", | ||
"sourceKeys": "zipcode", | ||
"sourceFromGenericMap": true | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
const { convertToMicroseconds } = require('./util'); | ||
const sha256 = require('sha256'); | ||
const { | ||
convertToMicroseconds, | ||
normalizeEmail, | ||
normalizePhone, | ||
normalizeAndHash, | ||
} = require('./util'); | ||
|
||
describe('convertToMicroseconds utility test', () => { | ||
it('ISO 8601 input', () => { | ||
|
@@ -21,3 +27,31 @@ describe('convertToMicroseconds utility test', () => { | |
expect(convertToMicroseconds('1697013935000')).toEqual(1697013935000000); | ||
}); | ||
}); | ||
|
||
describe('normalizeEmail', () => { | ||
it('should remove dots from the local part for gmail.com addresses', () => { | ||
const email = '[email protected]'; | ||
const normalized = normalizeEmail(email); | ||
expect(normalized).toBe('[email protected]'); | ||
}); | ||
|
||
it('should return the same email if no google domain is present', () => { | ||
const email = '[email protected]'; | ||
const normalized = normalizeEmail(email); | ||
expect(normalized).toBe('[email protected]'); | ||
}); | ||
}); | ||
|
||
describe('normalizePhone', () => { | ||
it('should return a valid E.164 formatted phone number when provided with correct inputs', () => { | ||
const validPhone = '4155552671'; | ||
const countryCode = 'US'; | ||
expect(normalizePhone(validPhone, countryCode)).toBe('+14155552671'); | ||
}); | ||
|
||
it('should throw an InstrumentationError when the phone number is too short or too long', () => { | ||
const invalidPhone = '123'; | ||
const countryCode = 'US'; | ||
expect(() => normalizePhone(invalidPhone, countryCode)).toThrow('Invalid phone number'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.