Skip to content

Commit

Permalink
v13.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Jul 5, 2024
1 parent 888529e commit e226bec
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 33 deletions.
2 changes: 1 addition & 1 deletion build/cjs/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/esm/index.mjs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions demo/main.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const Gleap = window.Gleap;

Gleap.setLanguage("en");
/*Gleap.setFrameUrl("http://0.0.0.0:3001");
Gleap.setFrameUrl("http://0.0.0.0:3001");
Gleap.setApiUrl("http://0.0.0.0:9000");
Gleap.setWSApiUrl("ws://0.0.0.0:9000");*/
Gleap.setWSApiUrl("ws://0.0.0.0:9000");

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

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

Gleap.initialize("KEY");
Gleap.initialize("9pBLU6jUACYzWDkXoCHX157R2nfW8xgw");
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": "13.7.4",
"version": "13.7.5",
"main": "build/cjs/index.js",
"module": "build/esm/index.mjs",
"exports": {
Expand Down
2 changes: 1 addition & 1 deletion published/13.7.4/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.

73 changes: 48 additions & 25 deletions src/GleapNotificationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export default class GleapNotificationManager {
return this.instance;
}

constructor() {

}
constructor() {}

updateTabBarNotificationCount() {
GleapEventManager.notifyEvent("unread-count-changed", this.unreadCount);
Expand Down Expand Up @@ -58,7 +56,14 @@ export default class GleapNotificationManager {
this.unreadNotificationsKey
);
if (notificationsFromCache && notificationsFromCache.length > 0) {
this.notifications = notificationsFromCache;
if (notificationsFromCache.length > 2) {
this.notifications = notificationsFromCache.splice(
0,
notificationsFromCache.length - 2
);
} else {
this.notifications = notificationsFromCache;
}
this.renderNotifications();
}
}
Expand Down Expand Up @@ -95,7 +100,7 @@ export default class GleapNotificationManager {
GleapAudioManager.ping();
}
}
if (this.notifications.length > 3) {
if (this.notifications.length > 2) {
this.notifications.shift();
}

Expand Down Expand Up @@ -125,7 +130,6 @@ export default class GleapNotificationManager {
// Render the notifications.
for (var i = 0; i < this.notifications.length; i++) {
const notification = this.notifications[i];

var content = notification.data.text;

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

if (notification.data.news) {
const renderDescription = () => {
if (notification.data.previewText && notification.data.previewText.length > 0) {
if (
notification.data.previewText &&
notification.data.previewText.length > 0
) {
return `<div class="gleap-notification-item-news-preview">${notification.data.previewText}</div>`;
}

return `${notification.data.sender ? `
return `${
notification.data.sender
? `
<div class="gleap-notification-item-news-sender">
${notification.data.sender.profileImageUrl &&
`<img src="${notification.data.sender.profileImageUrl}" />`
${
notification.data.sender.profileImageUrl &&
`<img src="${notification.data.sender.profileImageUrl}" />`
} ${notification.data.sender.name}</div>`
: ""
}`;
: ""
}`;
};

// News preview
elem.className = "gleap-notification-item-news";
elem.innerHTML = `
<div class="gleap-notification-item-news-container">
${notification.data.coverImageUrl && notification.data.coverImageUrl !== "" && !notification.data.coverImageUrl.includes("NewsImagePlaceholder") ? `<img class="gleap-notification-item-news-image" src="${notification.data.coverImageUrl}" />` : ''}
${
notification.data.coverImageUrl &&
notification.data.coverImageUrl !== "" &&
!notification.data.coverImageUrl.includes("NewsImagePlaceholder")
? `<img class="gleap-notification-item-news-image" src="${notification.data.coverImageUrl}" />`
: ""
}
<div class="gleap-notification-item-news-content">
<div class="gleap-notification-item-news-content-title">${content}</div>
${renderDescription()}
</div>
</div>`;
} else if (notification.data.checklist) {
var progress = Math.round(notification.data.currentStep / notification.data.totalSteps * 100);
var progress = Math.round(
(notification.data.currentStep / notification.data.totalSteps) * 100
);
if (progress < 100) {
progress += 4;
}
Expand All @@ -199,15 +217,17 @@ export default class GleapNotificationManager {
// Notification item.
elem.className = "gleap-notification-item";
elem.innerHTML = `
${notification.data.sender &&
notification.data.sender.profileImageUrl &&
`<img src="${notification.data.sender.profileImageUrl}" />`
}
${
notification.data.sender &&
notification.data.sender.profileImageUrl &&
`<img src="${notification.data.sender.profileImageUrl}" />`
}
<div class="gleap-notification-item-container">
${notification.data.sender
? `<div class="gleap-notification-item-sender">${notification.data.sender.name}</div>`
: ""
}
${
notification.data.sender
? `<div class="gleap-notification-item-sender">${notification.data.sender.name}</div>`
: ""
}
<div class="gleap-notification-item-content">${content}</div>
</div>`;
}
Expand Down Expand Up @@ -245,9 +265,9 @@ export default class GleapNotificationManager {
this.notificationContainer.classList.remove(classNoButton);
if (
flowConfig.feedbackButtonPosition ===
GleapFeedbackButtonManager.FEEDBACK_BUTTON_CLASSIC_LEFT ||
GleapFeedbackButtonManager.FEEDBACK_BUTTON_CLASSIC_LEFT ||
flowConfig.feedbackButtonPosition ===
GleapFeedbackButtonManager.FEEDBACK_BUTTON_BOTTOM_LEFT
GleapFeedbackButtonManager.FEEDBACK_BUTTON_BOTTOM_LEFT
) {
this.notificationContainer.classList.add(classLeft);
}
Expand All @@ -265,6 +285,9 @@ export default class GleapNotificationManager {
}
}

this.notificationContainer.setAttribute("dir", GleapTranslationManager.getInstance().isRTLLayout ? "rtl" : "ltr");
this.notificationContainer.setAttribute(
"dir",
GleapTranslationManager.getInstance().isRTLLayout ? "rtl" : "ltr"
);
}
}

0 comments on commit e226bec

Please sign in to comment.