Skip to content

Commit

Permalink
v8.4.6
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Dec 15, 2022
1 parent 1c2948e commit f28f1c9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/index.js

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions demo/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ Gleap.log("Test log err", "ERROR");

Gleap.trackEvent("Master Event");

Gleap.identify("123456789", {
name: "John Doe",
email: "[email protected]",
customData: {
yyy: "xxx",
penis: true
}
});

// Register custom action.
Gleap.registerCustomAction((customAction) => {
console.log("Custom action called:");
Expand Down
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ export namespace Gleap {
customerData: {
name?: string;
email?: string;
phone?: string;
value?: number;
customData?: object;
},
userHash?: string
): void;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gleap",
"version": "8.4.5",
"version": "8.4.6",
"main": "build/index.js",
"scripts": {
"start": "webpack serve",
Expand Down
1 change: 1 addition & 0 deletions published/8.4.6/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion published/latest/index.js

Large diffs are not rendered by default.

20 changes: 18 additions & 2 deletions src/GleapSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ export default class GleapSession {
var userDataKeys = Object.keys(userData);
for (var i = 0; i < userDataKeys.length; i++) {
var userDataKey = userDataKeys[i];
if (this.session[userDataKey] !== userData[userDataKey]) {
if (JSON.stringify(this.session[userDataKey]) !== JSON.stringify(userData[userDataKey])) {
return true;
}
}
Expand All @@ -232,6 +232,7 @@ export default class GleapSession {

identifySession = (userId, userData, userHash) => {
const sessionNeedsUpdate = this.checkIfSessionNeedsUpdate(userId, userData);
console.log("sessionNeedsUpdate", sessionNeedsUpdate);
if (!sessionNeedsUpdate) {
return;
}
Expand Down Expand Up @@ -273,9 +274,24 @@ export default class GleapSession {
}
}
};

var dataToSend = {
...userData
};

if (userData.customData) {
delete dataToSend['customData'];
dataToSend = {
...dataToSend,
...userData.customData,
}
}

console.log("dataToSend", dataToSend);

http.send(
JSON.stringify({
...userData,
...dataToSend,
userId,
userHash,
})
Expand Down

0 comments on commit f28f1c9

Please sign in to comment.