Skip to content

Commit

Permalink
edit in traits and object to array function
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 committed Sep 21, 2021
1 parent 995579e commit 8decc8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
19 changes: 7 additions & 12 deletions integrations/Sentry/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,16 @@ class Sentry {
const formattedAllowUrls = convertObjectToArray(
this.allowUrls,
"allowUrls"
).filter((e) => e);
const formattedDenyUrls = convertObjectToArray(
this.denyUrls,
"denyUrls"
).filter((e) => e);
);
const formattedDenyUrls = convertObjectToArray(this.denyUrls, "denyUrls");
const formattedIgnoreErrors = convertObjectToArray(
this.ignoreErrors,
"ignoreErrors"
).filter((e) => e);
);
const formattedIncludePaths = convertObjectToArray(
this.includePathsArray,
"includePathsArray"
).filter((e) => e);
"includePaths"
);

const customRelease = this.customVersionProperty
? window[this.customVersionProperty]
Expand Down Expand Up @@ -141,11 +138,9 @@ class Sentry {
}

identify(rudderElement) {
const { traits } = rudderElement.message;
const { traits } = rudderElement.message.context;
const { userId, email, name } = getDefinedTraits(rudderElement.message); // userId sent as id and username sent as name
const ipAddress =
get(rudderElement.message, "traits.ip_address") ||
get(rudderElement.message, "context.traits.ip_address");
const ipAddress = get(rudderElement.message, "context.traits.ip_address");

if (!userId && !email && !name && !ipAddress) {
// if no user identification property is present the event will be dropped
Expand Down
5 changes: 4 additions & 1 deletion integrations/Sentry/utils.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import logger from "../../utils/logUtil";
import { isDefinedAndNotNullAndNotEmpty } from "../utils/commonUtils";

const convertObjectToArray = (objectInput, propertyName) => {
return objectInput.map((objectItem) => objectItem[propertyName]);
return objectInput
.map((objectItem) => objectItem[propertyName])
.filter((e) => isDefinedAndNotNullAndNotEmpty(e));
};

const SentryScriptLoader = (id, src, integrity) => {
Expand Down

0 comments on commit 8decc8a

Please sign in to comment.