Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions src/Rokt-Kit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var constructor = function () {
};

var EMAIL_SHA256_KEY = 'emailsha256';
var EMAIL_KEY = 'email';

// Dynamic identity type for Rokt's emailsha256 identity value which MP doesn't natively support - will be set during initialization
var mappedEmailSha256Key;
Expand Down Expand Up @@ -185,24 +184,15 @@ var constructor = function () {

function replaceOtherIdentityWithEmailsha256(userIdentities) {
var newUserIdentities = mergeObjects({}, userIdentities || {});
if (userIdentities.hasOwnProperty(mappedEmailSha256Key)) {
if (userIdentities[mappedEmailSha256Key]) {
newUserIdentities[EMAIL_SHA256_KEY] =
userIdentities[mappedEmailSha256Key];
delete newUserIdentities[mappedEmailSha256Key];
}
delete newUserIdentities[mappedEmailSha256Key];

return newUserIdentities;
}

function sanitizeEmailIdentities(_data) {
var data = mergeObjects({}, _data || {});
if (_data.hasOwnProperty(EMAIL_SHA256_KEY)) {
delete data[EMAIL_KEY];
}

return data;
}

/**
* Selects placements for Rokt Web SDK with merged attributes, filters, and experimentation options
* @see https://docs.rokt.com/developers/integration-guides/web/library/select-placements-options/
Expand Down Expand Up @@ -262,7 +252,7 @@ var constructor = function () {
);

var selectPlacementsOptions = mergeObjects(options, {
attributes: sanitizeEmailIdentities(selectPlacementsAttributes),
attributes: selectPlacementsAttributes,
});

return self.launcher.selectPlacements(selectPlacementsOptions);
Expand Down
Loading