Skip to content

Commit e226bec

Browse files
committed
v13.7.5
1 parent 888529e commit e226bec

File tree

7 files changed

+56
-33
lines changed

7 files changed

+56
-33
lines changed

build/cjs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/esm/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

demo/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const Gleap = window.Gleap;
22

33
Gleap.setLanguage("en");
4-
/*Gleap.setFrameUrl("http://0.0.0.0:3001");
4+
Gleap.setFrameUrl("http://0.0.0.0:3001");
55
Gleap.setApiUrl("http://0.0.0.0:9000");
6-
Gleap.setWSApiUrl("ws://0.0.0.0:9000");*/
6+
Gleap.setWSApiUrl("ws://0.0.0.0:9000");
77

88
Gleap.setAiTools([{
99
name: 'send-money',
@@ -29,4 +29,4 @@ Gleap.on("tool-execution", (tool) => {
2929

3030
Gleap.setTicketAttribute("notes", "This is a test value.");
3131

32-
Gleap.initialize("KEY");
32+
Gleap.initialize("9pBLU6jUACYzWDkXoCHX157R2nfW8xgw");

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": "13.7.4",
3+
"version": "13.7.5",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/13.7.4/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/GleapNotificationManager.js

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ export default class GleapNotificationManager {
2727
return this.instance;
2828
}
2929

30-
constructor() {
31-
32-
}
30+
constructor() {}
3331

3432
updateTabBarNotificationCount() {
3533
GleapEventManager.notifyEvent("unread-count-changed", this.unreadCount);
@@ -58,7 +56,14 @@ export default class GleapNotificationManager {
5856
this.unreadNotificationsKey
5957
);
6058
if (notificationsFromCache && notificationsFromCache.length > 0) {
61-
this.notifications = notificationsFromCache;
59+
if (notificationsFromCache.length > 2) {
60+
this.notifications = notificationsFromCache.splice(
61+
0,
62+
notificationsFromCache.length - 2
63+
);
64+
} else {
65+
this.notifications = notificationsFromCache;
66+
}
6267
this.renderNotifications();
6368
}
6469
}
@@ -95,7 +100,7 @@ export default class GleapNotificationManager {
95100
GleapAudioManager.ping();
96101
}
97102
}
98-
if (this.notifications.length > 3) {
103+
if (this.notifications.length > 2) {
99104
this.notifications.shift();
100105
}
101106

@@ -125,7 +130,6 @@ export default class GleapNotificationManager {
125130
// Render the notifications.
126131
for (var i = 0; i < this.notifications.length; i++) {
127132
const notification = this.notifications[i];
128-
129133
var content = notification.data.text;
130134

131135
// Try replacing the session name.
@@ -149,31 +153,45 @@ export default class GleapNotificationManager {
149153

150154
if (notification.data.news) {
151155
const renderDescription = () => {
152-
if (notification.data.previewText && notification.data.previewText.length > 0) {
156+
if (
157+
notification.data.previewText &&
158+
notification.data.previewText.length > 0
159+
) {
153160
return `<div class="gleap-notification-item-news-preview">${notification.data.previewText}</div>`;
154161
}
155162

156-
return `${notification.data.sender ? `
163+
return `${
164+
notification.data.sender
165+
? `
157166
<div class="gleap-notification-item-news-sender">
158-
${notification.data.sender.profileImageUrl &&
159-
`<img src="${notification.data.sender.profileImageUrl}" />`
167+
${
168+
notification.data.sender.profileImageUrl &&
169+
`<img src="${notification.data.sender.profileImageUrl}" />`
160170
} ${notification.data.sender.name}</div>`
161-
: ""
162-
}`;
171+
: ""
172+
}`;
163173
};
164174

165175
// News preview
166176
elem.className = "gleap-notification-item-news";
167177
elem.innerHTML = `
168178
<div class="gleap-notification-item-news-container">
169-
${notification.data.coverImageUrl && notification.data.coverImageUrl !== "" && !notification.data.coverImageUrl.includes("NewsImagePlaceholder") ? `<img class="gleap-notification-item-news-image" src="${notification.data.coverImageUrl}" />` : ''}
179+
${
180+
notification.data.coverImageUrl &&
181+
notification.data.coverImageUrl !== "" &&
182+
!notification.data.coverImageUrl.includes("NewsImagePlaceholder")
183+
? `<img class="gleap-notification-item-news-image" src="${notification.data.coverImageUrl}" />`
184+
: ""
185+
}
170186
<div class="gleap-notification-item-news-content">
171187
<div class="gleap-notification-item-news-content-title">${content}</div>
172188
${renderDescription()}
173189
</div>
174190
</div>`;
175191
} else if (notification.data.checklist) {
176-
var progress = Math.round(notification.data.currentStep / notification.data.totalSteps * 100);
192+
var progress = Math.round(
193+
(notification.data.currentStep / notification.data.totalSteps) * 100
194+
);
177195
if (progress < 100) {
178196
progress += 4;
179197
}
@@ -199,15 +217,17 @@ export default class GleapNotificationManager {
199217
// Notification item.
200218
elem.className = "gleap-notification-item";
201219
elem.innerHTML = `
202-
${notification.data.sender &&
203-
notification.data.sender.profileImageUrl &&
204-
`<img src="${notification.data.sender.profileImageUrl}" />`
205-
}
220+
${
221+
notification.data.sender &&
222+
notification.data.sender.profileImageUrl &&
223+
`<img src="${notification.data.sender.profileImageUrl}" />`
224+
}
206225
<div class="gleap-notification-item-container">
207-
${notification.data.sender
208-
? `<div class="gleap-notification-item-sender">${notification.data.sender.name}</div>`
209-
: ""
210-
}
226+
${
227+
notification.data.sender
228+
? `<div class="gleap-notification-item-sender">${notification.data.sender.name}</div>`
229+
: ""
230+
}
211231
<div class="gleap-notification-item-content">${content}</div>
212232
</div>`;
213233
}
@@ -245,9 +265,9 @@ export default class GleapNotificationManager {
245265
this.notificationContainer.classList.remove(classNoButton);
246266
if (
247267
flowConfig.feedbackButtonPosition ===
248-
GleapFeedbackButtonManager.FEEDBACK_BUTTON_CLASSIC_LEFT ||
268+
GleapFeedbackButtonManager.FEEDBACK_BUTTON_CLASSIC_LEFT ||
249269
flowConfig.feedbackButtonPosition ===
250-
GleapFeedbackButtonManager.FEEDBACK_BUTTON_BOTTOM_LEFT
270+
GleapFeedbackButtonManager.FEEDBACK_BUTTON_BOTTOM_LEFT
251271
) {
252272
this.notificationContainer.classList.add(classLeft);
253273
}
@@ -265,6 +285,9 @@ export default class GleapNotificationManager {
265285
}
266286
}
267287

268-
this.notificationContainer.setAttribute("dir", GleapTranslationManager.getInstance().isRTLLayout ? "rtl" : "ltr");
288+
this.notificationContainer.setAttribute(
289+
"dir",
290+
GleapTranslationManager.getInstance().isRTLLayout ? "rtl" : "ltr"
291+
);
269292
}
270293
}

0 commit comments

Comments
 (0)