@product7/product7-js 0.5.6 → 0.5.8
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/README.md +6 -7
- package/dist/README.md +6 -7
- package/dist/product7-js.js +7155 -6999
- package/dist/product7-js.js.map +1 -1
- package/dist/product7-js.min.js +1 -1
- package/dist/product7-js.min.js.map +1 -1
- package/package.json +1 -1
- package/src/api/services/LiveChatService.js +12 -12
- package/src/core/APIService.js +1 -1
- package/src/core/WebSocketService.js +1 -1
- package/src/index.js +6 -5
- package/src/styles/base.js +8 -8
- package/src/styles/{live-chat-components.js → liveChat-components.js} +113 -113
- package/src/styles/{live-chat-core.js → liveChat-core.js} +95 -30
- package/src/styles/{live-chat-features.js → liveChat-features.js} +19 -19
- package/src/styles/{live-chat-views.js → liveChat-views.js} +136 -136
- package/src/styles/liveChat.js +17 -0
- package/src/styles/liveChatCustomStyles.js +14 -14
- package/src/styles/styles.js +2 -2
- package/src/widgets/BaseWidget.js +2 -2
- package/src/widgets/ChangelogWidget.js +3 -3
- package/src/widgets/LiveChatWidget.js +17 -13
- package/src/widgets/SurveyWidget.js +7 -7
- package/src/widgets/WidgetFactory.js +1 -1
- package/src/widgets/{live-chat → liveChat}/components/LiveChatLauncher.js +15 -15
- package/src/widgets/{live-chat → liveChat}/components/LiveChatPanel.js +40 -9
- package/src/widgets/{live-chat → liveChat}/components/NavigationTabs.js +16 -16
- package/src/widgets/{live-chat → liveChat}/views/ChangelogView.js +17 -17
- package/src/widgets/{live-chat → liveChat}/views/ChatView.js +153 -95
- package/src/widgets/{live-chat → liveChat}/views/ConversationsView.js +24 -24
- package/src/widgets/{live-chat → liveChat}/views/HelpView.js +32 -32
- package/src/widgets/{live-chat → liveChat}/views/HomeView.js +52 -52
- package/src/widgets/{live-chat → liveChat}/views/PreChatFormView.js +15 -18
- package/types/index.d.ts +0 -2
- package/src/styles/live-chat.js +0 -17
- /package/src/widgets/{live-chat → liveChat}/LiveChatState.js +0 -0
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
render() {
|
|
19
19
|
this.element = document.createElement('div');
|
|
20
|
-
this.element.className = '
|
|
20
|
+
this.element.className = 'liveChat-view liveChat-conversations-view';
|
|
21
21
|
|
|
22
22
|
this._updateContent();
|
|
23
23
|
this._attachEvents();
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
let conversationsHtml;
|
|
49
49
|
if (conversations.length === 0) {
|
|
50
50
|
conversationsHtml = `
|
|
51
|
-
<div class="
|
|
52
|
-
<div class="
|
|
53
|
-
<iconify-icon icon="ph:chat-circle
|
|
51
|
+
<div class="liveChat-empty-state">
|
|
52
|
+
<div class="liveChat-empty-state-icon">
|
|
53
|
+
<iconify-icon icon="ph:chat-circle" width="48" height="48"></iconify-icon>
|
|
54
54
|
</div>
|
|
55
55
|
<h3>No conversations yet</h3>
|
|
56
56
|
<p>Start a new conversation with our team</p>
|
|
@@ -58,26 +58,26 @@
|
|
|
58
58
|
`;
|
|
59
59
|
} else {
|
|
60
60
|
conversationsHtml = `
|
|
61
|
-
<div class="
|
|
61
|
+
<div class="liveChat-conversations-list">
|
|
62
62
|
${conversations.map((conv) => this._renderConversationItem(conv)).join('')}
|
|
63
63
|
</div>
|
|
64
64
|
`;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
this.element.innerHTML = `
|
|
68
|
-
<div class="
|
|
68
|
+
<div class="liveChat-conversations-header">
|
|
69
69
|
<h2>Messages</h2>
|
|
70
|
-
<button class="sdk-close-btn
|
|
70
|
+
<button class="sdk-close-btn liveChat-mobile-close-btn" aria-label="Close">
|
|
71
71
|
<iconify-icon icon="ph:x" width="18" height="18"></iconify-icon>
|
|
72
72
|
</button>
|
|
73
73
|
</div>
|
|
74
74
|
|
|
75
|
-
<div class="
|
|
75
|
+
<div class="liveChat-conversations-body">
|
|
76
76
|
${conversationsHtml}
|
|
77
77
|
</div>
|
|
78
78
|
|
|
79
|
-
<div class="
|
|
80
|
-
<button class="
|
|
79
|
+
<div class="liveChat-conversations-footer">
|
|
80
|
+
<button class="liveChat-new-message-btn">
|
|
81
81
|
<iconify-icon icon="ph:pencil-simple" width="16" height="16" style="flex-shrink: 0; color: var(--msg-text-secondary);"></iconify-icon>
|
|
82
82
|
<span style="flex: 1;">New conversation</span>
|
|
83
83
|
<iconify-icon icon="ph:caret-right" width="16" height="16" style="flex-shrink: 0; color: var(--msg-text-tertiary);"></iconify-icon>
|
|
@@ -98,19 +98,19 @@
|
|
|
98
98
|
);
|
|
99
99
|
|
|
100
100
|
return `
|
|
101
|
-
<div class="
|
|
102
|
-
<div class="
|
|
101
|
+
<div class="liveChat-conversation-item ${unreadClass} ${closedClass}" data-conversation-id="${conversation.id}">
|
|
102
|
+
<div class="liveChat-conversation-avatars">
|
|
103
103
|
${avatarsHtml}
|
|
104
104
|
</div>
|
|
105
|
-
<div class="
|
|
106
|
-
<div class="
|
|
107
|
-
<span class="
|
|
108
|
-
<span class="
|
|
105
|
+
<div class="liveChat-conversation-content">
|
|
106
|
+
<div class="liveChat-conversation-header">
|
|
107
|
+
<span class="liveChat-conversation-title">${conversation.title || 'Chat with team'}</span>
|
|
108
|
+
<span class="liveChat-conversation-time">${timeAgo}</span>
|
|
109
109
|
</div>
|
|
110
|
-
<div class="
|
|
111
|
-
${conversation.unread > 0 ? '<span class="
|
|
112
|
-
${isClosed ? '<span class="
|
|
113
|
-
<span class="
|
|
110
|
+
<div class="liveChat-conversation-preview">
|
|
111
|
+
${conversation.unread > 0 ? '<span class="liveChat-unread-dot"></span>' : ''}
|
|
112
|
+
${isClosed ? '<span class="liveChat-conversation-resolved-badge">Resolved</span>' : ''}
|
|
113
|
+
<span class="liveChat-conversation-message">${this._truncateMessage(conversation.lastMessage)}</span>
|
|
114
114
|
</div>
|
|
115
115
|
</div>
|
|
116
116
|
</div>
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
const color1 = this._getAvatarColor('S');
|
|
139
139
|
const color2 = this._getAvatarColor('T');
|
|
140
140
|
return `
|
|
141
|
-
<div class="
|
|
141
|
+
<div class="liveChat-avatar-stack">
|
|
142
142
|
<div class="sdk-avatar sdk-avatar-sm" style="background-color: ${color1};">S</div>
|
|
143
143
|
<div class="sdk-avatar sdk-avatar-sm" style="background-color: ${color2};">T</div>
|
|
144
144
|
</div>
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
})
|
|
158
158
|
.join('');
|
|
159
159
|
|
|
160
|
-
return `<div class="
|
|
160
|
+
return `<div class="liveChat-avatar-stack">${avatarItems}</div>`;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
_formatTimeAgo(timestamp) {
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
this.element
|
|
195
|
-
.querySelectorAll('.
|
|
195
|
+
.querySelectorAll('.liveChat-conversation-item')
|
|
196
196
|
.forEach((item) => {
|
|
197
197
|
item.addEventListener('click', () => {
|
|
198
198
|
const convId = item.dataset.conversationId;
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
});
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
const newMsgBtn = this.element.querySelector('.
|
|
209
|
+
const newMsgBtn = this.element.querySelector('.liveChat-new-message-btn');
|
|
210
210
|
if (newMsgBtn) {
|
|
211
211
|
newMsgBtn.addEventListener('click', () => {
|
|
212
212
|
this._startNewConversation();
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
render() {
|
|
10
10
|
this.element = document.createElement('div');
|
|
11
|
-
this.element.className = '
|
|
11
|
+
this.element.className = 'liveChat-view liveChat-help-view';
|
|
12
12
|
|
|
13
13
|
this._updateContent();
|
|
14
14
|
|
|
@@ -25,27 +25,27 @@
|
|
|
25
25
|
const searchQuery = this.state.helpSearchQuery || '';
|
|
26
26
|
|
|
27
27
|
this.element.innerHTML = `
|
|
28
|
-
<div class="
|
|
29
|
-
<div class="
|
|
28
|
+
<div class="liveChat-help-header">
|
|
29
|
+
<div class="liveChat-help-header-top">
|
|
30
30
|
<h2>Help</h2>
|
|
31
|
-
<button class="sdk-close-btn
|
|
31
|
+
<button class="sdk-close-btn liveChat-help-close-btn liveChat-mobile-close-btn" aria-label="Close">
|
|
32
32
|
<iconify-icon icon="ph:x" width="18" height="18"></iconify-icon>
|
|
33
33
|
</button>
|
|
34
34
|
</div>
|
|
35
|
-
<div class="
|
|
36
|
-
<span class="
|
|
37
|
-
<iconify-icon icon="ph:magnifying-glass
|
|
35
|
+
<div class="liveChat-help-search-wrap">
|
|
36
|
+
<span class="liveChat-help-search-icon">
|
|
37
|
+
<iconify-icon icon="ph:magnifying-glass" width="16" height="16"></iconify-icon>
|
|
38
38
|
</span>
|
|
39
39
|
<input
|
|
40
40
|
type="text"
|
|
41
|
-
class="
|
|
41
|
+
class="liveChat-help-search-input"
|
|
42
42
|
placeholder="Search for help..."
|
|
43
43
|
value="${searchQuery}"
|
|
44
44
|
/>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
|
-
<div class="
|
|
48
|
-
<div class="
|
|
47
|
+
<div class="liveChat-help-body">
|
|
48
|
+
<div class="liveChat-help-collections"></div>
|
|
49
49
|
</div>
|
|
50
50
|
`;
|
|
51
51
|
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
_updateCollectionsList() {
|
|
57
|
-
const container = this.element.querySelector('.
|
|
57
|
+
const container = this.element.querySelector('.liveChat-help-collections');
|
|
58
58
|
const collections = (this.state.helpArticles || []).filter(
|
|
59
59
|
(c) => (c.articleCount || 0) > 0
|
|
60
60
|
);
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
return `<img
|
|
113
113
|
src="${collection.author.picture}"
|
|
114
114
|
alt="${collection.author.name || ''}"
|
|
115
|
-
class="
|
|
115
|
+
class="liveChat-help-collection-avatar"
|
|
116
116
|
title="${collection.author.name || ''}"
|
|
117
117
|
/>`;
|
|
118
118
|
}
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
: 'A';
|
|
124
124
|
|
|
125
125
|
return `<span
|
|
126
|
-
class="
|
|
126
|
+
class="liveChat-help-collection-avatar liveChat-help-collection-avatar--initials"
|
|
127
127
|
style="background-color: ${bg}; color: ${text};"
|
|
128
128
|
title="${collection.author?.name || 'Author'}"
|
|
129
129
|
>${initials}</span>`;
|
|
@@ -133,11 +133,11 @@
|
|
|
133
133
|
if (!icon) return this._defaultCollectionIcon();
|
|
134
134
|
|
|
135
135
|
if (icon.trimStart().startsWith('<')) {
|
|
136
|
-
return `<span class="
|
|
136
|
+
return `<span class="liveChat-help-collection-icon">${icon}</span>`;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (icon.startsWith('ph:')) {
|
|
140
|
-
return `<span class="
|
|
140
|
+
return `<span class="liveChat-help-collection-icon">
|
|
141
141
|
<iconify-icon icon="${icon}"></iconify-icon>
|
|
142
142
|
</span>`;
|
|
143
143
|
}
|
|
@@ -146,8 +146,8 @@
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
_defaultCollectionIcon() {
|
|
149
|
-
return `<span class="
|
|
150
|
-
<iconify-icon icon="ph:book-open
|
|
149
|
+
return `<span class="liveChat-help-collection-icon">
|
|
150
|
+
<iconify-icon icon="ph:book-open"></iconify-icon>
|
|
151
151
|
</span>`;
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -155,14 +155,14 @@
|
|
|
155
155
|
const articleCount = collection.articleCount || 0;
|
|
156
156
|
|
|
157
157
|
return `
|
|
158
|
-
<div class="
|
|
158
|
+
<div class="liveChat-help-collection" data-collection-id="${collection.id}">
|
|
159
159
|
${this._resolveCollectionIcon(collection.icon)}
|
|
160
|
-
<div class="
|
|
161
|
-
<div class="
|
|
162
|
-
${collection.description ? `<p class="
|
|
163
|
-
<div class="
|
|
160
|
+
<div class="liveChat-help-collection-content">
|
|
161
|
+
<div class="liveChat-help-collection-title">${collection.title}</div>
|
|
162
|
+
${collection.description ? `<p class="liveChat-help-collection-desc">${collection.description}</p>` : ''}
|
|
163
|
+
<div class="liveChat-help-collection-meta">
|
|
164
164
|
${this._renderAuthorAvatar(collection)}
|
|
165
|
-
<span class="
|
|
165
|
+
<span class="liveChat-help-collection-count">
|
|
166
166
|
${articleCount} ${articleCount === 1 ? 'article' : 'articles'}
|
|
167
167
|
</span>
|
|
168
168
|
</div>
|
|
@@ -174,9 +174,9 @@
|
|
|
174
174
|
_renderEmptyState() {
|
|
175
175
|
if (this.state.helpSearchQuery) {
|
|
176
176
|
return `
|
|
177
|
-
<div class="
|
|
178
|
-
<div class="
|
|
179
|
-
<iconify-icon icon="ph:magnifying-glass
|
|
177
|
+
<div class="liveChat-empty-state">
|
|
178
|
+
<div class="liveChat-empty-state-icon">
|
|
179
|
+
<iconify-icon icon="ph:magnifying-glass" width="48" height="48"></iconify-icon>
|
|
180
180
|
</div>
|
|
181
181
|
<h3>No results found</h3>
|
|
182
182
|
<p>Try a different search term</p>
|
|
@@ -185,9 +185,9 @@
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
return `
|
|
188
|
-
<div class="
|
|
189
|
-
<div class="
|
|
190
|
-
<iconify-icon icon="ph:books
|
|
188
|
+
<div class="liveChat-empty-state">
|
|
189
|
+
<div class="liveChat-empty-state-icon">
|
|
190
|
+
<iconify-icon icon="ph:books" width="48" height="48"></iconify-icon>
|
|
191
191
|
</div>
|
|
192
192
|
<h3>Help collections</h3>
|
|
193
193
|
<p>No collections available yet</p>
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
|
|
198
198
|
_attachEvents() {
|
|
199
199
|
const mobileCloseBtn = this.element.querySelector(
|
|
200
|
-
'.
|
|
200
|
+
'.liveChat-help-close-btn'
|
|
201
201
|
);
|
|
202
202
|
if (mobileCloseBtn) {
|
|
203
203
|
mobileCloseBtn.addEventListener('click', () => {
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
const searchInput = this.element.querySelector(
|
|
209
|
-
'.
|
|
209
|
+
'.liveChat-help-search-input'
|
|
210
210
|
);
|
|
211
211
|
let searchTimeout;
|
|
212
212
|
searchInput.addEventListener('input', (e) => {
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
|
|
222
222
|
_attachCollectionEvents() {
|
|
223
223
|
this.element
|
|
224
|
-
.querySelectorAll('.
|
|
224
|
+
.querySelectorAll('.liveChat-help-collection')
|
|
225
225
|
.forEach((item) => {
|
|
226
226
|
item.addEventListener('click', () => {
|
|
227
227
|
const collection = this.state.helpArticles.find(
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
render() {
|
|
10
10
|
this.element = document.createElement('div');
|
|
11
|
-
this.element.className = '
|
|
11
|
+
this.element.className = 'liveChat-view liveChat-home-view';
|
|
12
12
|
|
|
13
13
|
this._updateContent();
|
|
14
14
|
|
|
@@ -30,21 +30,21 @@
|
|
|
30
30
|
const recentChangelogHtml = this._renderRecentChangelog();
|
|
31
31
|
|
|
32
32
|
this.element.innerHTML = `
|
|
33
|
-
<div class="
|
|
34
|
-
<div class="
|
|
35
|
-
<div class="
|
|
36
|
-
<div class="
|
|
33
|
+
<div class="liveChat-home-scroll">
|
|
34
|
+
<div class="liveChat-home-header">
|
|
35
|
+
<div class="liveChat-home-header-top">
|
|
36
|
+
<div class="liveChat-home-logo">
|
|
37
37
|
${this.options.logoUrl ? `<img src="${this.options.logoUrl}" alt="${this.state.teamName}" />` : ''}
|
|
38
38
|
</div>
|
|
39
|
-
<div class="
|
|
39
|
+
<div class="liveChat-home-avatars">${avatarsHtml}</div>
|
|
40
40
|
</div>
|
|
41
|
-
<div class="
|
|
42
|
-
<span class="
|
|
43
|
-
<span class="
|
|
41
|
+
<div class="liveChat-home-welcome">
|
|
42
|
+
<span class="liveChat-home-greeting">${this.state.greetingMessage}</span>
|
|
43
|
+
<span class="liveChat-home-question">${this.state.welcomeMessage}</span>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
|
-
<div class="
|
|
47
|
+
<div class="liveChat-home-body">
|
|
48
48
|
${this._renderMessageButton()}
|
|
49
49
|
${this._renderFeaturedCard()}
|
|
50
50
|
${recentChangelogHtml}
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
})
|
|
74
74
|
.join('');
|
|
75
75
|
|
|
76
|
-
return `<div class="
|
|
76
|
+
return `<div class="liveChat-avatar-stack">${avatarItems}</div>`;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
_renderAvailabilityStatus() {
|
|
@@ -81,17 +81,17 @@
|
|
|
81
81
|
|
|
82
82
|
if (isOnline) {
|
|
83
83
|
return `
|
|
84
|
-
<div class="
|
|
85
|
-
<span class="
|
|
86
|
-
<span class="
|
|
84
|
+
<div class="liveChat-home-availability">
|
|
85
|
+
<span class="liveChat-availability-dot liveChat-availability-online"></span>
|
|
86
|
+
<span class="liveChat-availability-text">${this.state.onlineMessage}</span>
|
|
87
87
|
</div>
|
|
88
88
|
`;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
return `
|
|
92
|
-
<div class="
|
|
93
|
-
<span class="
|
|
94
|
-
<span class="
|
|
92
|
+
<div class="liveChat-home-availability">
|
|
93
|
+
<span class="liveChat-availability-dot liveChat-availability-away"></span>
|
|
94
|
+
<span class="liveChat-availability-text">${this.state.responseTime}</span>
|
|
95
95
|
</div>
|
|
96
96
|
`;
|
|
97
97
|
}
|
|
@@ -113,14 +113,14 @@
|
|
|
113
113
|
|
|
114
114
|
return `
|
|
115
115
|
${recentCardHtml}
|
|
116
|
-
<button class="
|
|
117
|
-
<div class="
|
|
118
|
-
<span class="
|
|
119
|
-
<span class="
|
|
116
|
+
<button class="liveChat-home-message-btn">
|
|
117
|
+
<div class="liveChat-home-continue-info">
|
|
118
|
+
<span class="liveChat-home-continue-label">Send us a message</span>
|
|
119
|
+
<span class="liveChat-home-message-subtext">${responseTime}</span>
|
|
120
120
|
</div>
|
|
121
121
|
${sendIcon}
|
|
122
122
|
</button>
|
|
123
|
-
<button class="
|
|
123
|
+
<button class="liveChat-home-message-btn liveChat-feedback-btn" data-action="feedback">
|
|
124
124
|
<span>Leave us feedback</span>
|
|
125
125
|
${caretIcon}
|
|
126
126
|
</button>
|
|
@@ -131,8 +131,8 @@
|
|
|
131
131
|
const logoUrl = this.options.logoUrl;
|
|
132
132
|
const teamName = this.state.teamName || 'Support';
|
|
133
133
|
const logoHtml = logoUrl
|
|
134
|
-
? `<div class="
|
|
135
|
-
: `<div class="
|
|
134
|
+
? `<div class="liveChat-home-recent-avatar liveChat-home-recent-avatar-logo"><img src="${logoUrl}" alt="${teamName}" /></div>`
|
|
135
|
+
: `<div class="liveChat-home-recent-avatar" style="background: var(--color-primary);">${teamName.charAt(0).toUpperCase()}</div>`;
|
|
136
136
|
|
|
137
137
|
const title = conversation.title || teamName;
|
|
138
138
|
const timeAgo = this._formatTimeAgo(conversation.lastMessageTime);
|
|
@@ -143,18 +143,18 @@
|
|
|
143
143
|
const hasUnread = conversation.unread > 0;
|
|
144
144
|
|
|
145
145
|
return `
|
|
146
|
-
<div class="
|
|
147
|
-
<div class="
|
|
148
|
-
<div class="
|
|
146
|
+
<div class="liveChat-home-recent-card" data-conversation-id="${conversation.id}">
|
|
147
|
+
<div class="liveChat-home-recent-card-label">Recent message</div>
|
|
148
|
+
<div class="liveChat-home-recent-card-row">
|
|
149
149
|
${logoHtml}
|
|
150
|
-
<div class="
|
|
151
|
-
<div class="
|
|
152
|
-
<span class="
|
|
153
|
-
<span class="
|
|
150
|
+
<div class="liveChat-home-recent-card-content">
|
|
151
|
+
<div class="liveChat-home-recent-card-header">
|
|
152
|
+
<span class="liveChat-home-recent-card-name">${title}</span>
|
|
153
|
+
<span class="liveChat-home-recent-card-time">${timeAgo}</span>
|
|
154
154
|
</div>
|
|
155
|
-
<div class="
|
|
156
|
-
<span class="
|
|
157
|
-
${hasUnread ? '<span class="
|
|
155
|
+
<div class="liveChat-home-recent-card-preview">
|
|
156
|
+
<span class="liveChat-home-recent-card-message">${preview}</span>
|
|
157
|
+
${hasUnread ? '<span class="liveChat-home-recent-unread-dot"></span>' : ''}
|
|
158
158
|
</div>
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
@@ -186,13 +186,13 @@
|
|
|
186
186
|
this.options.featuredContent;
|
|
187
187
|
|
|
188
188
|
return `
|
|
189
|
-
<div class="
|
|
190
|
-
${imageUrl ? `<img src="${imageUrl}" alt="${title}" class="
|
|
191
|
-
<div class="
|
|
192
|
-
<div class="
|
|
189
|
+
<div class="liveChat-home-featured">
|
|
190
|
+
${imageUrl ? `<img src="${imageUrl}" alt="${title}" class="liveChat-home-featured-image" onerror="this.style.display='none';" />` : ''}
|
|
191
|
+
<div class="liveChat-home-featured-divider"></div>
|
|
192
|
+
<div class="liveChat-home-featured-content">
|
|
193
193
|
<h3>${title}</h3>
|
|
194
194
|
${description ? `<p>${description}</p>` : ''}
|
|
195
|
-
${action ? `<button class="sdk-btn sdk-btn-primary
|
|
195
|
+
${action ? `<button class="sdk-btn sdk-btn-primary liveChat-home-featured-btn" data-action="${action.type}" data-value="${action.value}">${action.label}</button>` : ''}
|
|
196
196
|
</div>
|
|
197
197
|
</div>
|
|
198
198
|
`;
|
|
@@ -207,20 +207,20 @@
|
|
|
207
207
|
const changelogHtml = changelogItems
|
|
208
208
|
.map(
|
|
209
209
|
(item) => `
|
|
210
|
-
<div class="
|
|
210
|
+
<div class="liveChat-home-changelog-card" data-changelog-id="${item.id}">
|
|
211
211
|
${
|
|
212
212
|
item.coverImage
|
|
213
213
|
? `
|
|
214
|
-
<div class="
|
|
214
|
+
<div class="liveChat-home-changelog-cover">
|
|
215
215
|
<img src="${item.coverImage}" alt="${item.title}" onerror="this.style.display='none';" />
|
|
216
|
-
${item.coverText ? `<span class="
|
|
216
|
+
${item.coverText ? `<span class="liveChat-home-changelog-cover-text">${item.coverText}</span>` : ''}
|
|
217
217
|
</div>
|
|
218
218
|
`
|
|
219
219
|
: ''
|
|
220
220
|
}
|
|
221
|
-
<div class="
|
|
222
|
-
<h4 class="
|
|
223
|
-
<p class="
|
|
221
|
+
<div class="liveChat-home-changelog-card-content">
|
|
222
|
+
<h4 class="liveChat-home-changelog-card-title">${item.title}</h4>
|
|
223
|
+
<p class="liveChat-home-changelog-card-desc">${this._stripHtml(item.description)}</p>
|
|
224
224
|
</div>
|
|
225
225
|
</div>
|
|
226
226
|
`
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
.join('');
|
|
229
229
|
|
|
230
230
|
return `
|
|
231
|
-
<div class="
|
|
231
|
+
<div class="liveChat-home-changelog-section">
|
|
232
232
|
${changelogHtml}
|
|
233
233
|
</div>
|
|
234
234
|
`;
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
_attachEvents() {
|
|
257
|
-
const recentCard = this.element.querySelector('.
|
|
257
|
+
const recentCard = this.element.querySelector('.liveChat-home-recent-card');
|
|
258
258
|
if (recentCard) {
|
|
259
259
|
recentCard.addEventListener('click', () => {
|
|
260
260
|
const convId = recentCard.dataset.conversationId;
|
|
@@ -268,7 +268,7 @@
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
const msgBtn = this.element.querySelector(
|
|
271
|
-
'.
|
|
271
|
+
'.liveChat-home-message-btn:not(.liveChat-feedback-btn)'
|
|
272
272
|
);
|
|
273
273
|
if (msgBtn) {
|
|
274
274
|
msgBtn.addEventListener('click', () => {
|
|
@@ -277,7 +277,7 @@
|
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
const feedbackBtn = this.element.querySelector('.
|
|
280
|
+
const feedbackBtn = this.element.querySelector('.liveChat-feedback-btn');
|
|
281
281
|
if (feedbackBtn) {
|
|
282
282
|
feedbackBtn.addEventListener('click', () => {
|
|
283
283
|
if (this.options.onFeedbackClick) {
|
|
@@ -290,7 +290,7 @@
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
this.element
|
|
293
|
-
.querySelectorAll('.
|
|
293
|
+
.querySelectorAll('.liveChat-home-changelog-card')
|
|
294
294
|
.forEach((card) => {
|
|
295
295
|
card.addEventListener('click', () => {
|
|
296
296
|
const item = this.state.homeChangelogItems.find(
|
|
@@ -305,7 +305,7 @@
|
|
|
305
305
|
});
|
|
306
306
|
|
|
307
307
|
const seeAllBtn = this.element.querySelector(
|
|
308
|
-
'.
|
|
308
|
+
'.liveChat-home-changelog-all'
|
|
309
309
|
);
|
|
310
310
|
if (seeAllBtn) {
|
|
311
311
|
seeAllBtn.addEventListener('click', () => {
|
|
@@ -314,7 +314,7 @@
|
|
|
314
314
|
}
|
|
315
315
|
|
|
316
316
|
const featuredBtn = this.element.querySelector(
|
|
317
|
-
'.
|
|
317
|
+
'.liveChat-home-featured-btn'
|
|
318
318
|
);
|
|
319
319
|
if (featuredBtn) {
|
|
320
320
|
featuredBtn.addEventListener('click', () => {
|
|
@@ -8,42 +8,39 @@
|
|
|
8
8
|
|
|
9
9
|
render() {
|
|
10
10
|
this.element = document.createElement('div');
|
|
11
|
-
this.element.className = '
|
|
11
|
+
this.element.className = 'liveChat-view liveChat-prechat-view';
|
|
12
12
|
this._updateContent();
|
|
13
13
|
return this.element;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
_updateContent() {
|
|
17
17
|
this.element.innerHTML = `
|
|
18
|
-
<div class="
|
|
19
|
-
<div class="
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<p class="live-chat-prechat-subtitle">Enter your details so we can get back to you.</p>
|
|
25
|
-
<form class="live-chat-prechat-form" novalidate>
|
|
26
|
-
<div class="live-chat-prechat-field">
|
|
18
|
+
<div class="liveChat-prechat-overlay">
|
|
19
|
+
<div class="liveChat-prechat-card">
|
|
20
|
+
<h4 class="liveChat-prechat-title">Before we continue</h4>
|
|
21
|
+
<p class="liveChat-prechat-subtitle">Enter your details so we can get back to you.</p>
|
|
22
|
+
<form class="liveChat-prechat-form" novalidate>
|
|
23
|
+
<div class="liveChat-prechat-field">
|
|
27
24
|
<input
|
|
28
25
|
type="text"
|
|
29
26
|
name="name"
|
|
30
|
-
class="
|
|
27
|
+
class="liveChat-prechat-input"
|
|
31
28
|
placeholder="Your name"
|
|
32
29
|
autocomplete="name"
|
|
33
30
|
/>
|
|
34
31
|
</div>
|
|
35
|
-
<div class="
|
|
32
|
+
<div class="liveChat-prechat-field">
|
|
36
33
|
<input
|
|
37
34
|
type="email"
|
|
38
35
|
name="email"
|
|
39
|
-
class="
|
|
36
|
+
class="liveChat-prechat-input"
|
|
40
37
|
placeholder="Your email address"
|
|
41
38
|
autocomplete="email"
|
|
42
39
|
required
|
|
43
40
|
/>
|
|
44
|
-
<span class="
|
|
41
|
+
<span class="liveChat-prechat-error" style="display:none;"></span>
|
|
45
42
|
</div>
|
|
46
|
-
<button type="submit" class="
|
|
43
|
+
<button type="submit" class="liveChat-prechat-submit">
|
|
47
44
|
Start chat
|
|
48
45
|
</button>
|
|
49
46
|
</form>
|
|
@@ -55,7 +52,7 @@
|
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
_attachEvents() {
|
|
58
|
-
const form = this.element.querySelector('.
|
|
55
|
+
const form = this.element.querySelector('.liveChat-prechat-form');
|
|
59
56
|
form.addEventListener('submit', async (e) => {
|
|
60
57
|
e.preventDefault();
|
|
61
58
|
await this._handleSubmit();
|
|
@@ -67,8 +64,8 @@
|
|
|
67
64
|
|
|
68
65
|
const emailInput = this.element.querySelector('input[name="email"]');
|
|
69
66
|
const nameInput = this.element.querySelector('input[name="name"]');
|
|
70
|
-
const errorEl = this.element.querySelector('.
|
|
71
|
-
const submitBtn = this.element.querySelector('.
|
|
67
|
+
const errorEl = this.element.querySelector('.liveChat-prechat-error');
|
|
68
|
+
const submitBtn = this.element.querySelector('.liveChat-prechat-submit');
|
|
72
69
|
|
|
73
70
|
const email = emailInput.value.trim();
|
|
74
71
|
const name = nameInput.value.trim();
|
package/types/index.d.ts
CHANGED
package/src/styles/live-chat.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { liveChatComponentsStyles } from './live-chat-components.js';
|
|
2
|
-
import { liveChatCoreStyles } from './live-chat-core.js';
|
|
3
|
-
import { liveChatFeaturesStyles } from './live-chat-features.js';
|
|
4
|
-
import { liveChatViewsStyles } from './live-chat-views.js';
|
|
5
|
-
|
|
6
|
-
export const liveChatStyles =
|
|
7
|
-
liveChatCoreStyles +
|
|
8
|
-
liveChatViewsStyles +
|
|
9
|
-
liveChatComponentsStyles +
|
|
10
|
-
liveChatFeaturesStyles;
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
liveChatComponentsStyles,
|
|
14
|
-
liveChatCoreStyles,
|
|
15
|
-
liveChatFeaturesStyles,
|
|
16
|
-
liveChatViewsStyles,
|
|
17
|
-
};
|
|
File without changes
|