@product7/product7-js 0.5.5 → 0.5.6
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 -5
- package/dist/README.md +6 -5
- package/dist/product7-js.js +821 -816
- 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/{WebChatService.js → LiveChatService.js} +14 -14
- package/src/core/APIService.js +15 -15
- package/src/core/Product7.js +9 -4
- package/src/core/WebSocketService.js +1 -1
- package/src/docs/api.md +8 -8
- package/src/docs/example.md +9 -9
- package/src/docs/framework-integrations.md +3 -3
- package/src/index.js +37 -37
- package/src/styles/base.js +8 -8
- package/src/styles/{web-chat-components.js → live-chat-components.js} +114 -114
- package/src/styles/{web-chat-core.js → live-chat-core.js} +30 -30
- package/src/styles/{web-chat-features.js → live-chat-features.js} +20 -20
- package/src/styles/{web-chat-views.js → live-chat-views.js} +137 -137
- package/src/styles/live-chat.js +17 -0
- package/src/styles/{webChatCustomStyles.js → liveChatCustomStyles.js} +16 -16
- package/src/styles/styles.js +3 -3
- package/src/widgets/{WebChatWidget.js → LiveChatWidget.js} +166 -166
- package/src/widgets/WidgetFactory.js +2 -2
- package/src/widgets/{web-chat/WebChatState.js → live-chat/LiveChatState.js} +1 -1
- package/src/widgets/{web-chat/components/WebChatLauncher.js → live-chat/components/LiveChatLauncher.js} +15 -15
- package/src/widgets/{web-chat/components/WebChatPanel.js → live-chat/components/LiveChatPanel.js} +10 -10
- package/src/widgets/{web-chat → live-chat}/components/NavigationTabs.js +12 -12
- package/src/widgets/{web-chat → live-chat}/views/ChangelogView.js +16 -16
- package/src/widgets/{web-chat → live-chat}/views/ChatView.js +90 -90
- package/src/widgets/{web-chat → live-chat}/views/ConversationsView.js +23 -23
- package/src/widgets/{web-chat → live-chat}/views/HelpView.js +28 -28
- package/src/widgets/{web-chat → live-chat}/views/HomeView.js +52 -52
- package/src/widgets/{web-chat → live-chat}/views/PreChatFormView.js +16 -16
- package/types/index.d.ts +9 -8
- package/src/styles/web-chat.js +0 -17
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
render() {
|
|
10
10
|
this.element = document.createElement('div');
|
|
11
|
-
this.element.className = '
|
|
11
|
+
this.element.className = 'live-chat-view live-chat-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="live-chat-help-header">
|
|
29
|
+
<div class="live-chat-help-header-top">
|
|
30
30
|
<h2>Help</h2>
|
|
31
|
-
<button class="sdk-close-btn
|
|
31
|
+
<button class="sdk-close-btn live-chat-help-close-btn live-chat-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="
|
|
35
|
+
<div class="live-chat-help-search-wrap">
|
|
36
|
+
<span class="live-chat-help-search-icon">
|
|
37
37
|
<iconify-icon icon="ph:magnifying-glass-duotone" width="16" height="16"></iconify-icon>
|
|
38
38
|
</span>
|
|
39
39
|
<input
|
|
40
40
|
type="text"
|
|
41
|
-
class="
|
|
41
|
+
class="live-chat-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="live-chat-help-body">
|
|
48
|
+
<div class="live-chat-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('.live-chat-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="live-chat-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="live-chat-help-collection-avatar live-chat-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="live-chat-help-collection-icon">${icon}</span>`;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (icon.startsWith('ph:')) {
|
|
140
|
-
return `<span class="
|
|
140
|
+
return `<span class="live-chat-help-collection-icon">
|
|
141
141
|
<iconify-icon icon="${icon}"></iconify-icon>
|
|
142
142
|
</span>`;
|
|
143
143
|
}
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
_defaultCollectionIcon() {
|
|
149
|
-
return `<span class="
|
|
149
|
+
return `<span class="live-chat-help-collection-icon">
|
|
150
150
|
<iconify-icon icon="ph:book-open-duotone"></iconify-icon>
|
|
151
151
|
</span>`;
|
|
152
152
|
}
|
|
@@ -155,14 +155,14 @@
|
|
|
155
155
|
const articleCount = collection.articleCount || 0;
|
|
156
156
|
|
|
157
157
|
return `
|
|
158
|
-
<div class="
|
|
158
|
+
<div class="live-chat-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="live-chat-help-collection-content">
|
|
161
|
+
<div class="live-chat-help-collection-title">${collection.title}</div>
|
|
162
|
+
${collection.description ? `<p class="live-chat-help-collection-desc">${collection.description}</p>` : ''}
|
|
163
|
+
<div class="live-chat-help-collection-meta">
|
|
164
164
|
${this._renderAuthorAvatar(collection)}
|
|
165
|
-
<span class="
|
|
165
|
+
<span class="live-chat-help-collection-count">
|
|
166
166
|
${articleCount} ${articleCount === 1 ? 'article' : 'articles'}
|
|
167
167
|
</span>
|
|
168
168
|
</div>
|
|
@@ -174,8 +174,8 @@
|
|
|
174
174
|
_renderEmptyState() {
|
|
175
175
|
if (this.state.helpSearchQuery) {
|
|
176
176
|
return `
|
|
177
|
-
<div class="
|
|
178
|
-
<div class="
|
|
177
|
+
<div class="live-chat-empty-state">
|
|
178
|
+
<div class="live-chat-empty-state-icon">
|
|
179
179
|
<iconify-icon icon="ph:magnifying-glass-duotone" width="48" height="48"></iconify-icon>
|
|
180
180
|
</div>
|
|
181
181
|
<h3>No results found</h3>
|
|
@@ -185,8 +185,8 @@
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
return `
|
|
188
|
-
<div class="
|
|
189
|
-
<div class="
|
|
188
|
+
<div class="live-chat-empty-state">
|
|
189
|
+
<div class="live-chat-empty-state-icon">
|
|
190
190
|
<iconify-icon icon="ph:books-duotone" width="48" height="48"></iconify-icon>
|
|
191
191
|
</div>
|
|
192
192
|
<h3>Help collections</h3>
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
|
|
198
198
|
_attachEvents() {
|
|
199
199
|
const mobileCloseBtn = this.element.querySelector(
|
|
200
|
-
'.
|
|
200
|
+
'.live-chat-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
|
+
'.live-chat-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('.live-chat-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 = 'live-chat-view live-chat-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="live-chat-home-scroll">
|
|
34
|
+
<div class="live-chat-home-header">
|
|
35
|
+
<div class="live-chat-home-header-top">
|
|
36
|
+
<div class="live-chat-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="live-chat-home-avatars">${avatarsHtml}</div>
|
|
40
40
|
</div>
|
|
41
|
-
<div class="
|
|
42
|
-
<span class="
|
|
43
|
-
<span class="
|
|
41
|
+
<div class="live-chat-home-welcome">
|
|
42
|
+
<span class="live-chat-home-greeting">${this.state.greetingMessage}</span>
|
|
43
|
+
<span class="live-chat-home-question">${this.state.welcomeMessage}</span>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
|
-
<div class="
|
|
47
|
+
<div class="live-chat-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="live-chat-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="live-chat-home-availability">
|
|
85
|
+
<span class="live-chat-availability-dot live-chat-availability-online"></span>
|
|
86
|
+
<span class="live-chat-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="live-chat-home-availability">
|
|
93
|
+
<span class="live-chat-availability-dot live-chat-availability-away"></span>
|
|
94
|
+
<span class="live-chat-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="live-chat-home-message-btn">
|
|
117
|
+
<div class="live-chat-home-continue-info">
|
|
118
|
+
<span class="live-chat-home-continue-label">Send us a message</span>
|
|
119
|
+
<span class="live-chat-home-message-subtext">${responseTime}</span>
|
|
120
120
|
</div>
|
|
121
121
|
${sendIcon}
|
|
122
122
|
</button>
|
|
123
|
-
<button class="
|
|
123
|
+
<button class="live-chat-home-message-btn live-chat-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="live-chat-home-recent-avatar live-chat-home-recent-avatar-logo"><img src="${logoUrl}" alt="${teamName}" /></div>`
|
|
135
|
+
: `<div class="live-chat-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="live-chat-home-recent-card" data-conversation-id="${conversation.id}">
|
|
147
|
+
<div class="live-chat-home-recent-card-label">Recent message</div>
|
|
148
|
+
<div class="live-chat-home-recent-card-row">
|
|
149
149
|
${logoHtml}
|
|
150
|
-
<div class="
|
|
151
|
-
<div class="
|
|
152
|
-
<span class="
|
|
153
|
-
<span class="
|
|
150
|
+
<div class="live-chat-home-recent-card-content">
|
|
151
|
+
<div class="live-chat-home-recent-card-header">
|
|
152
|
+
<span class="live-chat-home-recent-card-name">${title}</span>
|
|
153
|
+
<span class="live-chat-home-recent-card-time">${timeAgo}</span>
|
|
154
154
|
</div>
|
|
155
|
-
<div class="
|
|
156
|
-
<span class="
|
|
157
|
-
${hasUnread ? '<span class="
|
|
155
|
+
<div class="live-chat-home-recent-card-preview">
|
|
156
|
+
<span class="live-chat-home-recent-card-message">${preview}</span>
|
|
157
|
+
${hasUnread ? '<span class="live-chat-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="live-chat-home-featured">
|
|
190
|
+
${imageUrl ? `<img src="${imageUrl}" alt="${title}" class="live-chat-home-featured-image" onerror="this.style.display='none';" />` : ''}
|
|
191
|
+
<div class="live-chat-home-featured-divider"></div>
|
|
192
|
+
<div class="live-chat-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 live-chat-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="live-chat-home-changelog-card" data-changelog-id="${item.id}">
|
|
211
211
|
${
|
|
212
212
|
item.coverImage
|
|
213
213
|
? `
|
|
214
|
-
<div class="
|
|
214
|
+
<div class="live-chat-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="live-chat-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="live-chat-home-changelog-card-content">
|
|
222
|
+
<h4 class="live-chat-home-changelog-card-title">${item.title}</h4>
|
|
223
|
+
<p class="live-chat-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="live-chat-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('.live-chat-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
|
+
'.live-chat-home-message-btn:not(.live-chat-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('.live-chat-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('.live-chat-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
|
+
'.live-chat-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
|
+
'.live-chat-home-featured-btn'
|
|
318
318
|
);
|
|
319
319
|
if (featuredBtn) {
|
|
320
320
|
featuredBtn.addEventListener('click', () => {
|
|
@@ -8,42 +8,42 @@
|
|
|
8
8
|
|
|
9
9
|
render() {
|
|
10
10
|
this.element = document.createElement('div');
|
|
11
|
-
this.element.className = '
|
|
11
|
+
this.element.className = 'live-chat-view live-chat-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
|
-
<div class="
|
|
18
|
+
<div class="live-chat-prechat-overlay">
|
|
19
|
+
<div class="live-chat-prechat-card">
|
|
20
|
+
<div class="live-chat-prechat-icon">
|
|
21
21
|
<iconify-icon icon="ph:chat-teardrop-dots-duotone" width="36" height="36"></iconify-icon>
|
|
22
22
|
</div>
|
|
23
|
-
<h4 class="
|
|
24
|
-
<p class="
|
|
25
|
-
<form class="
|
|
26
|
-
<div class="
|
|
23
|
+
<h4 class="live-chat-prechat-title">Before we continue</h4>
|
|
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">
|
|
27
27
|
<input
|
|
28
28
|
type="text"
|
|
29
29
|
name="name"
|
|
30
|
-
class="
|
|
30
|
+
class="live-chat-prechat-input"
|
|
31
31
|
placeholder="Your name"
|
|
32
32
|
autocomplete="name"
|
|
33
33
|
/>
|
|
34
34
|
</div>
|
|
35
|
-
<div class="
|
|
35
|
+
<div class="live-chat-prechat-field">
|
|
36
36
|
<input
|
|
37
37
|
type="email"
|
|
38
38
|
name="email"
|
|
39
|
-
class="
|
|
39
|
+
class="live-chat-prechat-input"
|
|
40
40
|
placeholder="Your email address"
|
|
41
41
|
autocomplete="email"
|
|
42
42
|
required
|
|
43
43
|
/>
|
|
44
|
-
<span class="
|
|
44
|
+
<span class="live-chat-prechat-error" style="display:none;"></span>
|
|
45
45
|
</div>
|
|
46
|
-
<button type="submit" class="
|
|
46
|
+
<button type="submit" class="live-chat-prechat-submit">
|
|
47
47
|
Start chat
|
|
48
48
|
</button>
|
|
49
49
|
</form>
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
_attachEvents() {
|
|
58
|
-
const form = this.element.querySelector('.
|
|
58
|
+
const form = this.element.querySelector('.live-chat-prechat-form');
|
|
59
59
|
form.addEventListener('submit', async (e) => {
|
|
60
60
|
e.preventDefault();
|
|
61
61
|
await this._handleSubmit();
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
|
|
68
68
|
const emailInput = this.element.querySelector('input[name="email"]');
|
|
69
69
|
const nameInput = this.element.querySelector('input[name="name"]');
|
|
70
|
-
const errorEl = this.element.querySelector('.
|
|
71
|
-
const submitBtn = this.element.querySelector('.
|
|
70
|
+
const errorEl = this.element.querySelector('.live-chat-prechat-error');
|
|
71
|
+
const submitBtn = this.element.querySelector('.live-chat-prechat-submit');
|
|
72
72
|
|
|
73
73
|
const email = emailInput.value.trim();
|
|
74
74
|
const name = nameInput.value.trim();
|
package/types/index.d.ts
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
feedback?: Partial<FeedbackWidgetOptions> | Record<string, any>;
|
|
58
58
|
button?: Partial<ButtonWidgetOptions> | Record<string, any>;
|
|
59
59
|
survey?: Partial<SurveyWidgetOptions> | Record<string, any>;
|
|
60
|
-
|
|
60
|
+
liveChat?: Partial<LiveChatWidgetOptions> | Record<string, any>;
|
|
61
61
|
changelog?: Partial<ChangelogWidgetOptions> | Record<string, any>;
|
|
62
62
|
[key: string]: Record<string, any> | undefined;
|
|
63
63
|
}
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
response: any;
|
|
104
104
|
}>;
|
|
105
105
|
createFeedbackWidget(options?: FeedbackWidgetOptions): FeedbackWidget;
|
|
106
|
-
|
|
106
|
+
createLiveChatWidget(options?: LiveChatWidgetOptions): LiveChatWidget;
|
|
107
107
|
createChangelogWidget(options?: ChangelogWidgetOptions): ChangelogWidget;
|
|
108
108
|
createSurveyWidget(options?: SurveyWidgetOptions): SurveyWidget;
|
|
109
109
|
createWidget(
|
|
@@ -113,9 +113,9 @@
|
|
|
113
113
|
createWidget(type: 'button', options?: ButtonWidgetOptions): ButtonWidget;
|
|
114
114
|
createWidget(type: 'survey', options?: SurveyWidgetOptions): SurveyWidget;
|
|
115
115
|
createWidget(
|
|
116
|
-
type: '
|
|
117
|
-
options?:
|
|
118
|
-
):
|
|
116
|
+
type: 'liveChat',
|
|
117
|
+
options?: LiveChatWidgetOptions
|
|
118
|
+
): LiveChatWidget;
|
|
119
119
|
createWidget(
|
|
120
120
|
type: 'changelog',
|
|
121
121
|
options?: ChangelogWidgetOptions
|
|
@@ -295,7 +295,7 @@
|
|
|
295
295
|
refresh(): Promise<void>;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
export interface
|
|
298
|
+
export interface LiveChatWidgetOptions {
|
|
299
299
|
enabled?: boolean;
|
|
300
300
|
position?: 'bottom-right' | 'bottom-left';
|
|
301
301
|
theme?: 'light' | 'dark';
|
|
@@ -348,9 +348,9 @@
|
|
|
348
348
|
onChangelogClick?: (changelog: any) => void;
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
export interface
|
|
351
|
+
export interface LiveChatWidget {
|
|
352
352
|
id: string;
|
|
353
|
-
type: '
|
|
353
|
+
type: 'liveChat';
|
|
354
354
|
mount(container?: string | HTMLElement): this;
|
|
355
355
|
destroy(): void;
|
|
356
356
|
open(): void;
|
|
@@ -376,3 +376,4 @@
|
|
|
376
376
|
export default Product7Default;
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
+
|
package/src/styles/web-chat.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { webChatComponentsStyles } from './web-chat-components.js';
|
|
2
|
-
import { webChatCoreStyles } from './web-chat-core.js';
|
|
3
|
-
import { webChatFeaturesStyles } from './web-chat-features.js';
|
|
4
|
-
import { webChatViewsStyles } from './web-chat-views.js';
|
|
5
|
-
|
|
6
|
-
export const webChatStyles =
|
|
7
|
-
webChatCoreStyles +
|
|
8
|
-
webChatViewsStyles +
|
|
9
|
-
webChatComponentsStyles +
|
|
10
|
-
webChatFeaturesStyles;
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
webChatComponentsStyles,
|
|
14
|
-
webChatCoreStyles,
|
|
15
|
-
webChatFeaturesStyles,
|
|
16
|
-
webChatViewsStyles,
|
|
17
|
-
};
|