Skip to content

Commit 2a6dfb4

Browse files
committed
v8.5.10
1 parent 30ef5d1 commit 2a6dfb4

File tree

5 files changed

+110
-13
lines changed

5 files changed

+110
-13
lines changed

demo/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ Gleap.attachCustomData({
1414
},
1515
});
1616

17-
Gleap.identify("123456789", {
17+
/*Gleap.identify("123456789", {
1818
name: "John Doe",
1919
email: "lukas@gleap.io",
2020
value: 1234,
2121
phone: "+49123456789",
2222
"penis": "true",
2323
testing: { "fun": 1123 },
2424
luki: 19283
25-
});
25+
});*/
2626

2727
Gleap.log("Test log");
2828
Gleap.log("Test log info", "INFO");

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "8.5.9",
3+
"version": "8.5.10",
44
"main": "build/index.js",
55
"scripts": {
66
"start": "webpack serve",

src/GleapNotificationManager.js

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,41 @@ export default class GleapNotificationManager {
137137
Gleap.open();
138138
}
139139
};
140-
elem.className = "gleap-notification-item";
141-
elem.innerHTML = `
140+
141+
if (notification.data.news) {
142+
// News preview
143+
elem.className = "gleap-notification-item-news";
144+
elem.innerHTML = `
145+
<div class="gleap-notification-item-news-container">
146+
${notification.data.coverImageUrl ? `<img class="gleap-notification-item-news-image" src="${notification.data.coverImageUrl}" />` : ''}
147+
<div class="gleap-notification-item-news-content">
148+
<div class="gleap-notification-item-news-content-title">${content}</div>
149+
${notification.data.sender ? `
150+
<div class="gleap-notification-item-news-sender">
151+
${notification.data.sender.profileImageUrl &&
152+
`<img src="${notification.data.sender.profileImageUrl}" />`
153+
} ${notification.data.sender.name}</div>`
154+
: ""
155+
}
156+
</div>
157+
</div>`;
158+
} else {
159+
// Notification item.
160+
elem.className = "gleap-notification-item";
161+
elem.innerHTML = `
142162
${notification.data.sender &&
143-
notification.data.sender.profileImageUrl &&
144-
`<img src="${notification.data.sender.profileImageUrl}" />`
145-
}
163+
notification.data.sender.profileImageUrl &&
164+
`<img src="${notification.data.sender.profileImageUrl}" />`
165+
}
146166
<div class="gleap-notification-item-container">
147167
${notification.data.sender
148-
? `<div class="gleap-notification-item-sender">${notification.data.sender.name}</div>`
149-
: ""
150-
}
168+
? `<div class="gleap-notification-item-sender">${notification.data.sender.name}</div>`
169+
: ""
170+
}
151171
<div class="gleap-notification-item-content">${content}</div>
152172
</div>`;
173+
}
174+
153175
this.notificationContainer.appendChild(elem);
154176
}
155177
}

src/GleapStreamedEvent.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class GleapStreamedEvent {
66
streamedEventArray = [];
77
eventMaxLength = 500;
88
errorCount = 0;
9+
skippedCount = 1;
910
streamingEvents = false;
1011
lastUrl = undefined;
1112
stopped = false;
@@ -106,6 +107,11 @@ export default class GleapStreamedEvent {
106107
return;
107108
}
108109

110+
if ((!this.streamedEventArray || this.streamedEventArray.length === 0) && this.skippedCount < 1) {
111+
this.skippedCount++;
112+
return;
113+
}
114+
109115
const self = this;
110116
this.streamingEvents = true;
111117

@@ -123,6 +129,7 @@ export default class GleapStreamedEvent {
123129
if (http.readyState === 4) {
124130
if (http.status === 200 || http.status === 201) {
125131
self.errorCount = 0;
132+
self.skippedCount = 0;
126133

127134
// Only perform actions if gleapId was not changed.
128135
if (GleapSession.getInstance().getGleapId() === preGleapId) {

src/UI.js

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ export const injectStyledCSS = (
257257
display: flex;
258258
flex-direction: column;
259259
align-items: flex-end;
260-
max-width: min(300px, 80vw);
260+
width: 100%;
261+
max-width: min(340px, 80vw);
261262
}
262263
263264
.gleap-notification-container--left {
@@ -314,9 +315,76 @@ export const injectStyledCSS = (
314315
fill: ${backgroundColor};
315316
}
316317
318+
.gleap-notification-item-news {
319+
width: 100%;
320+
cursor: pointer;
321+
}
322+
323+
.gleap-notification-item-news-content {
324+
align-items: flex-start;
325+
display: flex;
326+
flex-direction: column;
327+
padding: 15px;
328+
}
329+
330+
.gleap-notification-item-news-sender {
331+
display: flex;
332+
align-items: center;
333+
color: ${subTextColor};
334+
font-size: 14px;
335+
font-weight: 400;
336+
}
337+
338+
.gleap-notification-item-news-content-title {
339+
font-size: 14px;
340+
font-weight: 500;
341+
line-height: 18px;
342+
margin-bottom: 6px;
343+
max-width: 100%;
344+
overflow: hidden;
345+
text-overflow: ellipsis;
346+
white-space: nowrap;
347+
color: ${contrastBackgroundColor};
348+
}
349+
350+
.gleap-notification-item-news-sender img {
351+
border-radius: 100%;
352+
height: 20px;
353+
margin-right: 8px;
354+
object-fit: cover;
355+
width: 20px;
356+
}
357+
358+
.gleap-notification-item-news-container {
359+
display: flex;
360+
animation: fadeIn;
361+
animation-duration: .45s;
362+
background-color: ${backgroundColor};
363+
border-radius: ${subTextColor};
364+
box-sizing: border-box;
365+
cursor: pointer;
366+
flex-direction: column;
367+
overflow: hidden;
368+
box-shadow: 0px 5px 30px rgba(0, 0, 0, 0.2);
369+
border-radius: ${chatRadius}px;
370+
margin-bottom: 12px;
371+
}
372+
373+
.gleap-notification-item-news-image {
374+
background-color: ${subTextColor};
375+
height: 170px;
376+
object-fit: cover;
377+
width: 100%;
378+
}
379+
380+
.gleap-notification-item-news:hover .gleap-notification-item-news-content-title {
381+
color: ${primaryColor};
382+
}
383+
317384
.gleap-notification-item {
318385
display: flex;
319386
align-items: flex-end;
387+
cursor: pointer;
320388
}
321389
322390
.gleap-notification-item img {
@@ -353,7 +421,7 @@ export const injectStyledCSS = (
353421
left: -6px;
354422
border-style: solid;
355423
border-width: 0px 0px 10px 6px;
356-
border-color: transparent transparent white;
424+
border-color: transparent transparent ${backgroundColor};
357425
}
358426
359427
.gleap-notification-item-sender {

0 commit comments

Comments
 (0)