@product7/product7-js 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/product7-js.js
CHANGED
|
@@ -11064,8 +11064,10 @@
|
|
|
11064
11064
|
}
|
|
11065
11065
|
|
|
11066
11066
|
_updateContent() {
|
|
11067
|
-
const
|
|
11067
|
+
const isUnavailable = this.state.businessHoursState === 'offline' || this.state.businessHoursState === 'away';
|
|
11068
|
+
const avatarsHtml = (this.state.showAvatars && !isUnavailable) ? this._renderAvatarStack() : '';
|
|
11068
11069
|
const recentChangelogHtml = this._renderRecentChangelog();
|
|
11070
|
+
const availabilityHtml = this._renderAvailabilityStatus();
|
|
11069
11071
|
|
|
11070
11072
|
this.element.innerHTML = `
|
|
11071
11073
|
<div class="liveChat-home-scroll">
|
|
@@ -11074,7 +11076,7 @@
|
|
|
11074
11076
|
<div class="liveChat-home-logo">
|
|
11075
11077
|
${this.options.logoUrl ? `<img src="${this.options.logoUrl}" alt="${this.state.teamName}" />` : ''}
|
|
11076
11078
|
</div>
|
|
11077
|
-
<div class="liveChat-home-avatars">${avatarsHtml}</div>
|
|
11079
|
+
<div class="liveChat-home-avatars">${avatarsHtml || availabilityHtml}</div>
|
|
11078
11080
|
</div>
|
|
11079
11081
|
<div class="liveChat-home-welcome">
|
|
11080
11082
|
<span class="liveChat-home-greeting">${this.state.greetingMessage}</span>
|
|
@@ -11141,7 +11143,7 @@
|
|
|
11141
11143
|
return `
|
|
11142
11144
|
<div class="liveChat-home-availability">
|
|
11143
11145
|
<span class="liveChat-availability-dot liveChat-availability-away"></span>
|
|
11144
|
-
<span class="liveChat-availability-text"
|
|
11146
|
+
<span class="liveChat-availability-text">We're currently away</span>
|
|
11145
11147
|
</div>
|
|
11146
11148
|
`;
|
|
11147
11149
|
}
|
|
@@ -11915,7 +11917,38 @@
|
|
|
11915
11917
|
});
|
|
11916
11918
|
|
|
11917
11919
|
if (response.status && response.data) {
|
|
11918
|
-
|
|
11920
|
+
// Reconcile the optimistic 'Sending…' message with the server's
|
|
11921
|
+
// confirmation as soon as the POST returns. Don't depend on the WS
|
|
11922
|
+
// echo alone — when the WebSocket frame is dropped (brief
|
|
11923
|
+
// disconnect, slow network, server send-buffer full), the
|
|
11924
|
+
// optimistic message stays stuck on 'Sending…' forever because
|
|
11925
|
+
// upsertMessage's match window is finite.
|
|
11926
|
+
const serverData = response.data;
|
|
11927
|
+
let attachments = [];
|
|
11928
|
+
if (serverData.attachments) {
|
|
11929
|
+
try {
|
|
11930
|
+
attachments =
|
|
11931
|
+
typeof serverData.attachments === 'string'
|
|
11932
|
+
? JSON.parse(serverData.attachments)
|
|
11933
|
+
: serverData.attachments;
|
|
11934
|
+
} catch (e) {
|
|
11935
|
+
attachments = [];
|
|
11936
|
+
}
|
|
11937
|
+
}
|
|
11938
|
+
this.LiveChatState.upsertMessage(
|
|
11939
|
+
conversationId,
|
|
11940
|
+
{
|
|
11941
|
+
id: serverData.id,
|
|
11942
|
+
content: serverData.content,
|
|
11943
|
+
isOwn: true,
|
|
11944
|
+
timestamp: serverData.created_at,
|
|
11945
|
+
attachments:
|
|
11946
|
+
Array.isArray(attachments) && attachments.length > 0
|
|
11947
|
+
? attachments
|
|
11948
|
+
: undefined,
|
|
11949
|
+
},
|
|
11950
|
+
{ reconcileOwnOptimistic: true, optimisticMatchWindowMs: 60000 }
|
|
11951
|
+
);
|
|
11919
11952
|
}
|
|
11920
11953
|
|
|
11921
11954
|
if (this.apiService?.mock) {
|