Skip to content

Commit 2bc38eb

Browse files
committed
remove email from selectPlacements when hashedemail exists
1 parent 673dc7e commit 2bc38eb

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

src/Rokt-Kit.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,14 @@ var constructor = function () {
155155
return data;
156156
}
157157

158-
// function replaceEmailIdentityWithEmailsha256(_data) {
159-
// var data = mergeObjects({}, _data || {});
160-
// if (_data.hasOwnProperty(EMAIL_SHA256_IDENTITY)) {
161-
// delete data[EMAIL_IDENTITY];
162-
// }
158+
function sanitizeIdentities(_data) {
159+
var data = mergeObjects({}, _data || {});
160+
if (_data.hasOwnProperty(EMAIL_SHA256_IDENTITY)) {
161+
delete data[EMAIL_IDENTITY];
162+
}
163163

164-
// return data;
165-
// }
164+
return data;
165+
}
166166

167167
/**
168168
* Selects placements for Rokt Web SDK with merged attributes, filters, and experimentation options
@@ -209,7 +209,6 @@ var constructor = function () {
209209
: {};
210210

211211
var filteredUserIdentities = returnUserIdentities(filteredUser);
212-
console.log(filteredUserIdentities);
213212

214213
var selectPlacementsAttributes = mergeObjects(
215214
filteredUserIdentities,
@@ -219,9 +218,9 @@ var constructor = function () {
219218
mpid: mpid,
220219
}
221220
);
222-
console.log(selectPlacementsAttributes);
221+
223222
var selectPlacementsOptions = mergeObjects(options, {
224-
attributes: selectPlacementsAttributes,
223+
attributes: sanitizeIdentities(selectPlacementsAttributes),
225224
});
226225

227226
return self.launcher.selectPlacements(selectPlacementsOptions);

test/src/tests.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ describe('Rokt Forwarder', () => {
627627
});
628628
});
629629

630-
describe.only('Identity handling', () => {
630+
describe('Identity handling', () => {
631631
beforeEach(() => {
632632
window.Rokt = new MockRoktForwarder();
633633
window.mParticle.Rokt = window.Rokt;
@@ -1120,11 +1120,11 @@ describe('Rokt Forwarder', () => {
11201120
);
11211121
});
11221122

1123-
it('should map email identity to emailsha256 when only email exists', async () => {
1123+
it('should remove email identity if emailsha256 is passed through selectPlacements', async () => {
11241124
window.mParticle.Rokt.filters = {
11251125
userAttributeFilters: [],
1126-
filterUserAttributes: function () {
1127-
return {};
1126+
filterUserAttributes: function (attributes) {
1127+
return attributes;
11281128
},
11291129
filteredUser: {
11301130
getMPID: function () {

0 commit comments

Comments
 (0)