@product7/product7-js 0.6.2 → 0.6.4

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.
@@ -11064,8 +11064,10 @@
11064
11064
  }
11065
11065
 
11066
11066
  _updateContent() {
11067
- const avatarsHtml = this.state.showAvatars ? this._renderAvatarStack() : '';
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">
@@ -11079,6 +11081,7 @@
11079
11081
  <div class="liveChat-home-welcome">
11080
11082
  <span class="liveChat-home-greeting">${this.state.greetingMessage}</span>
11081
11083
  <span class="liveChat-home-question">${this.state.welcomeMessage}</span>
11084
+ ${availabilityHtml}
11082
11085
  </div>
11083
11086
  </div>
11084
11087
 
@@ -11118,18 +11121,16 @@
11118
11121
  const businessState = this.state.businessHoursState;
11119
11122
 
11120
11123
  if (businessState === 'offline') {
11121
- let offlineText = 'We\'re currently closed';
11124
+ let offlineText = "We're currently closed";
11122
11125
  if (this.state.holidayName) {
11123
11126
  offlineText = `Closed for ${this.state.holidayName}`;
11124
11127
  } else if (this.state.nextOpenAt) {
11125
11128
  const opens = new Date(this.state.nextOpenAt);
11126
11129
  const now = new Date();
11127
11130
  const diffHours = Math.round((opens - now) / 3600000);
11128
- if (diffHours < 24) {
11129
- offlineText = `Opens in ${diffHours}h`;
11130
- } else {
11131
- offlineText = `Opens ${opens.toLocaleDateString('en-US', { weekday: 'short', hour: 'numeric', hour12: true })}`;
11132
- }
11131
+ offlineText = diffHours < 24
11132
+ ? `Opens in ${diffHours}h`
11133
+ : `Opens ${opens.toLocaleDateString('en-US', { weekday: 'short', hour: 'numeric', hour12: true })}`;
11133
11134
  }
11134
11135
  return `
11135
11136
  <div class="liveChat-home-availability">
@@ -11139,6 +11140,15 @@
11139
11140
  `;
11140
11141
  }
11141
11142
 
11143
+ if (businessState === 'away') {
11144
+ return `
11145
+ <div class="liveChat-home-availability">
11146
+ <span class="liveChat-availability-dot liveChat-availability-away"></span>
11147
+ <span class="liveChat-availability-text">${this.state.responseTime}</span>
11148
+ </div>
11149
+ `;
11150
+ }
11151
+
11142
11152
  if (this.state.agentsOnline) {
11143
11153
  return `
11144
11154
  <div class="liveChat-home-availability">
@@ -12568,7 +12578,7 @@
12568
12578
  this.LiveChatState.onlineCount = response.data.online_count || 0;
12569
12579
  this.LiveChatState.responseTime = response.data.response_time || '';
12570
12580
 
12571
- if (response.data.available_agents) {
12581
+ if (response.data.available_agents && this.LiveChatState.showAvatars !== false) {
12572
12582
  this.LiveChatState.setTeamAvatarsFromAgents(
12573
12583
  response.data.available_agents
12574
12584
  );