Skip to content

Commit

Permalink
chore: allow only anonymousId set from note attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed Nov 21, 2024
1 parent 53d2bef commit a0d4efc
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { isDefinedAndNotNull } = require('@rudderstack/integrations-lib');
const { v5 } = require('uuid');
const { constructPayload } = require('../../../../v0/util');
const {
lineItemsMappingJSON,
Expand Down Expand Up @@ -47,18 +46,12 @@ const createPropertiesForEcomEventFromWebhook = (message) => {
*/
const getAnonymousIdFromAttributes = async (event) => {
let anonymousId = null;
let cartToken = null;
const noteAttributes = event.note_attributes;
if (isDefinedAndNotNull(event) && isDefinedAndNotNull(noteAttributes)) {
const rudderAnonymousIdObject = noteAttributes.find(
(attr) => attr.name === 'rudderAnonymousId',
);
anonymousId = rudderAnonymousIdObject ? rudderAnonymousIdObject.value : null;
const cartTokenObject = noteAttributes.find((attr) => attr.name === 'cartToken');
cartToken = cartTokenObject ? cartTokenObject.value : null;
if (!isDefinedAndNotNull(anonymousId) && isDefinedAndNotNull(cartToken)) {
anonymousId = v5(cartToken, v5.URL);
}
}
return anonymousId;
};
Expand Down

0 comments on commit a0d4efc

Please sign in to comment.