@product7/product7-js 0.5.2 → 0.5.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.
- package/README.md +4 -4
- package/dist/README.md +4 -4
- package/dist/product7-js.js +7120 -7132
- 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/APIService.js +1 -0
- package/src/api/services/{MessengerService.js → WebChatService.js} +15 -15
- package/src/core/APIService.js +16 -16
- package/src/core/Product7.js +4 -4
- package/src/core/WebSocketService.js +3 -3
- package/src/docs/api.md +9 -9
- package/src/docs/example.md +12 -12
- package/src/docs/framework-integrations.md +5 -5
- package/src/index.js +41 -42
- package/src/styles/base.js +9 -9
- package/src/styles/design-tokens.js +2 -2
- package/src/styles/feedback.js +2 -2
- package/src/styles/styles.js +4 -4
- package/src/styles/{messenger-components.js → web-chat-components.js} +114 -114
- package/src/styles/{messenger-core.js → web-chat-core.js} +32 -32
- package/src/styles/{messenger-features.js → web-chat-features.js} +20 -20
- package/src/styles/{messenger-views.js → web-chat-views.js} +137 -137
- package/src/styles/web-chat.js +17 -0
- package/src/styles/{messengerCustomStyles.js → webChatCustomStyles.js} +17 -19
- package/src/widgets/{MessengerWidget.js → WebChatWidget.js} +169 -172
- package/src/widgets/WidgetFactory.js +3 -3
- package/src/widgets/{messenger/MessengerState.js → web-chat/WebChatState.js} +1 -1
- package/src/widgets/{messenger → web-chat}/components/NavigationTabs.js +13 -13
- package/src/widgets/{messenger/components/MessengerLauncher.js → web-chat/components/WebChatLauncher.js} +15 -17
- package/src/widgets/{messenger/components/MessengerPanel.js → web-chat/components/WebChatPanel.js} +11 -11
- package/src/widgets/{messenger → web-chat}/views/ChangelogView.js +17 -17
- package/src/widgets/{messenger → web-chat}/views/ChatView.js +97 -99
- package/src/widgets/{messenger → web-chat}/views/ConversationsView.js +24 -24
- package/src/widgets/{messenger → web-chat}/views/HelpView.js +29 -29
- package/src/widgets/{messenger → web-chat}/views/HomeView.js +53 -55
- package/src/widgets/{messenger → web-chat}/views/PreChatFormView.js +17 -17
- package/src/styles/messenger.js +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class HelpView {
|
|
1
|
+
export class HelpView {
|
|
2
2
|
constructor(state, options = {}) {
|
|
3
3
|
this.state = state;
|
|
4
4
|
this.options = options;
|
|
@@ -8,7 +8,7 @@ export class HelpView {
|
|
|
8
8
|
|
|
9
9
|
render() {
|
|
10
10
|
this.element = document.createElement('div');
|
|
11
|
-
this.element.className = '
|
|
11
|
+
this.element.className = 'web-chat-view web-chat-help-view';
|
|
12
12
|
|
|
13
13
|
this._updateContent();
|
|
14
14
|
|
|
@@ -25,27 +25,27 @@ export class HelpView {
|
|
|
25
25
|
const searchQuery = this.state.helpSearchQuery || '';
|
|
26
26
|
|
|
27
27
|
this.element.innerHTML = `
|
|
28
|
-
<div class="
|
|
29
|
-
<div class="
|
|
28
|
+
<div class="web-chat-help-header">
|
|
29
|
+
<div class="web-chat-help-header-top">
|
|
30
30
|
<h2>Help</h2>
|
|
31
|
-
<button class="sdk-close-btn
|
|
31
|
+
<button class="sdk-close-btn web-chat-help-close-btn web-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="web-chat-help-search-wrap">
|
|
36
|
+
<span class="web-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="web-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="web-chat-help-body">
|
|
48
|
+
<div class="web-chat-help-collections"></div>
|
|
49
49
|
</div>
|
|
50
50
|
`;
|
|
51
51
|
|
|
@@ -54,7 +54,7 @@ export class HelpView {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
_updateCollectionsList() {
|
|
57
|
-
const container = this.element.querySelector('.
|
|
57
|
+
const container = this.element.querySelector('.web-chat-help-collections');
|
|
58
58
|
const collections = (this.state.helpArticles || []).filter(
|
|
59
59
|
(c) => (c.articleCount || 0) > 0
|
|
60
60
|
);
|
|
@@ -112,7 +112,7 @@ export class HelpView {
|
|
|
112
112
|
return `<img
|
|
113
113
|
src="${collection.author.picture}"
|
|
114
114
|
alt="${collection.author.name || ''}"
|
|
115
|
-
class="
|
|
115
|
+
class="web-chat-help-collection-avatar"
|
|
116
116
|
title="${collection.author.name || ''}"
|
|
117
117
|
/>`;
|
|
118
118
|
}
|
|
@@ -123,7 +123,7 @@ export class HelpView {
|
|
|
123
123
|
: 'A';
|
|
124
124
|
|
|
125
125
|
return `<span
|
|
126
|
-
class="
|
|
126
|
+
class="web-chat-help-collection-avatar web-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 @@ export class HelpView {
|
|
|
133
133
|
if (!icon) return this._defaultCollectionIcon();
|
|
134
134
|
|
|
135
135
|
if (icon.trimStart().startsWith('<')) {
|
|
136
|
-
return `<span class="
|
|
136
|
+
return `<span class="web-chat-help-collection-icon">${icon}</span>`;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
if (icon.startsWith('ph:')) {
|
|
140
|
-
return `<span class="
|
|
140
|
+
return `<span class="web-chat-help-collection-icon">
|
|
141
141
|
<iconify-icon icon="${icon}"></iconify-icon>
|
|
142
142
|
</span>`;
|
|
143
143
|
}
|
|
@@ -146,7 +146,7 @@ export class HelpView {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
_defaultCollectionIcon() {
|
|
149
|
-
return `<span class="
|
|
149
|
+
return `<span class="web-chat-help-collection-icon">
|
|
150
150
|
<iconify-icon icon="ph:book-open-duotone"></iconify-icon>
|
|
151
151
|
</span>`;
|
|
152
152
|
}
|
|
@@ -155,14 +155,14 @@ export class HelpView {
|
|
|
155
155
|
const articleCount = collection.articleCount || 0;
|
|
156
156
|
|
|
157
157
|
return `
|
|
158
|
-
<div class="
|
|
158
|
+
<div class="web-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="web-chat-help-collection-content">
|
|
161
|
+
<div class="web-chat-help-collection-title">${collection.title}</div>
|
|
162
|
+
${collection.description ? `<p class="web-chat-help-collection-desc">${collection.description}</p>` : ''}
|
|
163
|
+
<div class="web-chat-help-collection-meta">
|
|
164
164
|
${this._renderAuthorAvatar(collection)}
|
|
165
|
-
<span class="
|
|
165
|
+
<span class="web-chat-help-collection-count">
|
|
166
166
|
${articleCount} ${articleCount === 1 ? 'article' : 'articles'}
|
|
167
167
|
</span>
|
|
168
168
|
</div>
|
|
@@ -174,8 +174,8 @@ export class HelpView {
|
|
|
174
174
|
_renderEmptyState() {
|
|
175
175
|
if (this.state.helpSearchQuery) {
|
|
176
176
|
return `
|
|
177
|
-
<div class="
|
|
178
|
-
<div class="
|
|
177
|
+
<div class="web-chat-empty-state">
|
|
178
|
+
<div class="web-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 @@ export class HelpView {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
return `
|
|
188
|
-
<div class="
|
|
189
|
-
<div class="
|
|
188
|
+
<div class="web-chat-empty-state">
|
|
189
|
+
<div class="web-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 @@ export class HelpView {
|
|
|
197
197
|
|
|
198
198
|
_attachEvents() {
|
|
199
199
|
const mobileCloseBtn = this.element.querySelector(
|
|
200
|
-
'.
|
|
200
|
+
'.web-chat-help-close-btn'
|
|
201
201
|
);
|
|
202
202
|
if (mobileCloseBtn) {
|
|
203
203
|
mobileCloseBtn.addEventListener('click', () => {
|
|
@@ -206,7 +206,7 @@ export class HelpView {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
const searchInput = this.element.querySelector(
|
|
209
|
-
'.
|
|
209
|
+
'.web-chat-help-search-input'
|
|
210
210
|
);
|
|
211
211
|
let searchTimeout;
|
|
212
212
|
searchInput.addEventListener('input', (e) => {
|
|
@@ -221,7 +221,7 @@ export class HelpView {
|
|
|
221
221
|
|
|
222
222
|
_attachCollectionEvents() {
|
|
223
223
|
this.element
|
|
224
|
-
.querySelectorAll('.
|
|
224
|
+
.querySelectorAll('.web-chat-help-collection')
|
|
225
225
|
.forEach((item) => {
|
|
226
226
|
item.addEventListener('click', () => {
|
|
227
227
|
const collection = this.state.helpArticles.find(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class HomeView {
|
|
1
|
+
export class HomeView {
|
|
2
2
|
constructor(state, options = {}) {
|
|
3
3
|
this.state = state;
|
|
4
4
|
this.options = options;
|
|
@@ -8,7 +8,7 @@ export class HomeView {
|
|
|
8
8
|
|
|
9
9
|
render() {
|
|
10
10
|
this.element = document.createElement('div');
|
|
11
|
-
this.element.className = '
|
|
11
|
+
this.element.className = 'web-chat-view web-chat-home-view';
|
|
12
12
|
|
|
13
13
|
this._updateContent();
|
|
14
14
|
|
|
@@ -30,21 +30,21 @@ export class HomeView {
|
|
|
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="web-chat-home-scroll">
|
|
34
|
+
<div class="web-chat-home-header">
|
|
35
|
+
<div class="web-chat-home-header-top">
|
|
36
|
+
<div class="web-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="web-chat-home-avatars">${avatarsHtml}</div>
|
|
40
40
|
</div>
|
|
41
|
-
<div class="
|
|
42
|
-
<span class="
|
|
43
|
-
<span class="
|
|
41
|
+
<div class="web-chat-home-welcome">
|
|
42
|
+
<span class="web-chat-home-greeting">${this.state.greetingMessage}</span>
|
|
43
|
+
<span class="web-chat-home-question">${this.state.welcomeMessage}</span>
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
46
|
|
|
47
|
-
<div class="
|
|
47
|
+
<div class="web-chat-home-body">
|
|
48
48
|
${this._renderMessageButton()}
|
|
49
49
|
${this._renderFeaturedCard()}
|
|
50
50
|
${recentChangelogHtml}
|
|
@@ -73,7 +73,7 @@ export class HomeView {
|
|
|
73
73
|
})
|
|
74
74
|
.join('');
|
|
75
75
|
|
|
76
|
-
return `<div class="
|
|
76
|
+
return `<div class="web-chat-avatar-stack">${avatarItems}</div>`;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
_renderAvailabilityStatus() {
|
|
@@ -81,17 +81,17 @@ export class HomeView {
|
|
|
81
81
|
|
|
82
82
|
if (isOnline) {
|
|
83
83
|
return `
|
|
84
|
-
<div class="
|
|
85
|
-
<span class="
|
|
86
|
-
<span class="
|
|
84
|
+
<div class="web-chat-home-availability">
|
|
85
|
+
<span class="web-chat-availability-dot web-chat-availability-online"></span>
|
|
86
|
+
<span class="web-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="web-chat-home-availability">
|
|
93
|
+
<span class="web-chat-availability-dot web-chat-availability-away"></span>
|
|
94
|
+
<span class="web-chat-availability-text">${this.state.responseTime}</span>
|
|
95
95
|
</div>
|
|
96
96
|
`;
|
|
97
97
|
}
|
|
@@ -113,14 +113,14 @@ export class HomeView {
|
|
|
113
113
|
|
|
114
114
|
return `
|
|
115
115
|
${recentCardHtml}
|
|
116
|
-
<button class="
|
|
117
|
-
<div class="
|
|
118
|
-
<span class="
|
|
119
|
-
<span class="
|
|
116
|
+
<button class="web-chat-home-message-btn">
|
|
117
|
+
<div class="web-chat-home-continue-info">
|
|
118
|
+
<span class="web-chat-home-continue-label">Send us a message</span>
|
|
119
|
+
<span class="web-chat-home-message-subtext">${responseTime}</span>
|
|
120
120
|
</div>
|
|
121
121
|
${sendIcon}
|
|
122
122
|
</button>
|
|
123
|
-
<button class="
|
|
123
|
+
<button class="web-chat-home-message-btn web-chat-feedback-btn" data-action="feedback">
|
|
124
124
|
<span>Leave us feedback</span>
|
|
125
125
|
${caretIcon}
|
|
126
126
|
</button>
|
|
@@ -131,8 +131,8 @@ export class HomeView {
|
|
|
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="web-chat-home-recent-avatar web-chat-home-recent-avatar-logo"><img src="${logoUrl}" alt="${teamName}" /></div>`
|
|
135
|
+
: `<div class="web-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 @@ export class HomeView {
|
|
|
143
143
|
const hasUnread = conversation.unread > 0;
|
|
144
144
|
|
|
145
145
|
return `
|
|
146
|
-
<div class="
|
|
147
|
-
<div class="
|
|
148
|
-
<div class="
|
|
146
|
+
<div class="web-chat-home-recent-card" data-conversation-id="${conversation.id}">
|
|
147
|
+
<div class="web-chat-home-recent-card-label">Recent message</div>
|
|
148
|
+
<div class="web-chat-home-recent-card-row">
|
|
149
149
|
${logoHtml}
|
|
150
|
-
<div class="
|
|
151
|
-
<div class="
|
|
152
|
-
<span class="
|
|
153
|
-
<span class="
|
|
150
|
+
<div class="web-chat-home-recent-card-content">
|
|
151
|
+
<div class="web-chat-home-recent-card-header">
|
|
152
|
+
<span class="web-chat-home-recent-card-name">${title}</span>
|
|
153
|
+
<span class="web-chat-home-recent-card-time">${timeAgo}</span>
|
|
154
154
|
</div>
|
|
155
|
-
<div class="
|
|
156
|
-
<span class="
|
|
157
|
-
${hasUnread ? '<span class="
|
|
155
|
+
<div class="web-chat-home-recent-card-preview">
|
|
156
|
+
<span class="web-chat-home-recent-card-message">${preview}</span>
|
|
157
|
+
${hasUnread ? '<span class="web-chat-home-recent-unread-dot"></span>' : ''}
|
|
158
158
|
</div>
|
|
159
159
|
</div>
|
|
160
160
|
</div>
|
|
@@ -186,13 +186,13 @@ export class HomeView {
|
|
|
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="web-chat-home-featured">
|
|
190
|
+
${imageUrl ? `<img src="${imageUrl}" alt="${title}" class="web-chat-home-featured-image" onerror="this.style.display='none';" />` : ''}
|
|
191
|
+
<div class="web-chat-home-featured-divider"></div>
|
|
192
|
+
<div class="web-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 web-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 @@ export class HomeView {
|
|
|
207
207
|
const changelogHtml = changelogItems
|
|
208
208
|
.map(
|
|
209
209
|
(item) => `
|
|
210
|
-
<div class="
|
|
210
|
+
<div class="web-chat-home-changelog-card" data-changelog-id="${item.id}">
|
|
211
211
|
${
|
|
212
212
|
item.coverImage
|
|
213
213
|
? `
|
|
214
|
-
<div class="
|
|
214
|
+
<div class="web-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="web-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="web-chat-home-changelog-card-content">
|
|
222
|
+
<h4 class="web-chat-home-changelog-card-title">${item.title}</h4>
|
|
223
|
+
<p class="web-chat-home-changelog-card-desc">${this._stripHtml(item.description)}</p>
|
|
224
224
|
</div>
|
|
225
225
|
</div>
|
|
226
226
|
`
|
|
@@ -228,7 +228,7 @@ export class HomeView {
|
|
|
228
228
|
.join('');
|
|
229
229
|
|
|
230
230
|
return `
|
|
231
|
-
<div class="
|
|
231
|
+
<div class="web-chat-home-changelog-section">
|
|
232
232
|
${changelogHtml}
|
|
233
233
|
</div>
|
|
234
234
|
`;
|
|
@@ -254,9 +254,7 @@ export class HomeView {
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
_attachEvents() {
|
|
257
|
-
const recentCard = this.element.querySelector(
|
|
258
|
-
'.messenger-home-recent-card'
|
|
259
|
-
);
|
|
257
|
+
const recentCard = this.element.querySelector('.web-chat-home-recent-card');
|
|
260
258
|
if (recentCard) {
|
|
261
259
|
recentCard.addEventListener('click', () => {
|
|
262
260
|
const convId = recentCard.dataset.conversationId;
|
|
@@ -270,7 +268,7 @@ export class HomeView {
|
|
|
270
268
|
}
|
|
271
269
|
|
|
272
270
|
const msgBtn = this.element.querySelector(
|
|
273
|
-
'.
|
|
271
|
+
'.web-chat-home-message-btn:not(.web-chat-feedback-btn)'
|
|
274
272
|
);
|
|
275
273
|
if (msgBtn) {
|
|
276
274
|
msgBtn.addEventListener('click', () => {
|
|
@@ -279,7 +277,7 @@ export class HomeView {
|
|
|
279
277
|
});
|
|
280
278
|
}
|
|
281
279
|
|
|
282
|
-
const feedbackBtn = this.element.querySelector('.
|
|
280
|
+
const feedbackBtn = this.element.querySelector('.web-chat-feedback-btn');
|
|
283
281
|
if (feedbackBtn) {
|
|
284
282
|
feedbackBtn.addEventListener('click', () => {
|
|
285
283
|
if (this.options.onFeedbackClick) {
|
|
@@ -292,7 +290,7 @@ export class HomeView {
|
|
|
292
290
|
}
|
|
293
291
|
|
|
294
292
|
this.element
|
|
295
|
-
.querySelectorAll('.
|
|
293
|
+
.querySelectorAll('.web-chat-home-changelog-card')
|
|
296
294
|
.forEach((card) => {
|
|
297
295
|
card.addEventListener('click', () => {
|
|
298
296
|
const item = this.state.homeChangelogItems.find(
|
|
@@ -307,7 +305,7 @@ export class HomeView {
|
|
|
307
305
|
});
|
|
308
306
|
|
|
309
307
|
const seeAllBtn = this.element.querySelector(
|
|
310
|
-
'.
|
|
308
|
+
'.web-chat-home-changelog-all'
|
|
311
309
|
);
|
|
312
310
|
if (seeAllBtn) {
|
|
313
311
|
seeAllBtn.addEventListener('click', () => {
|
|
@@ -316,7 +314,7 @@ export class HomeView {
|
|
|
316
314
|
}
|
|
317
315
|
|
|
318
316
|
const featuredBtn = this.element.querySelector(
|
|
319
|
-
'.
|
|
317
|
+
'.web-chat-home-featured-btn'
|
|
320
318
|
);
|
|
321
319
|
if (featuredBtn) {
|
|
322
320
|
featuredBtn.addEventListener('click', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export class PreChatFormView {
|
|
1
|
+
export class PreChatFormView {
|
|
2
2
|
constructor(state, options = {}) {
|
|
3
3
|
this.state = state;
|
|
4
4
|
this.options = options;
|
|
@@ -8,42 +8,42 @@ export class PreChatFormView {
|
|
|
8
8
|
|
|
9
9
|
render() {
|
|
10
10
|
this.element = document.createElement('div');
|
|
11
|
-
this.element.className = '
|
|
11
|
+
this.element.className = 'web-chat-view web-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="web-chat-prechat-overlay">
|
|
19
|
+
<div class="web-chat-prechat-card">
|
|
20
|
+
<div class="web-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="web-chat-prechat-title">Before we continue</h4>
|
|
24
|
+
<p class="web-chat-prechat-subtitle">Enter your details so we can get back to you.</p>
|
|
25
|
+
<form class="web-chat-prechat-form" novalidate>
|
|
26
|
+
<div class="web-chat-prechat-field">
|
|
27
27
|
<input
|
|
28
28
|
type="text"
|
|
29
29
|
name="name"
|
|
30
|
-
class="
|
|
30
|
+
class="web-chat-prechat-input"
|
|
31
31
|
placeholder="Your name"
|
|
32
32
|
autocomplete="name"
|
|
33
33
|
/>
|
|
34
34
|
</div>
|
|
35
|
-
<div class="
|
|
35
|
+
<div class="web-chat-prechat-field">
|
|
36
36
|
<input
|
|
37
37
|
type="email"
|
|
38
38
|
name="email"
|
|
39
|
-
class="
|
|
39
|
+
class="web-chat-prechat-input"
|
|
40
40
|
placeholder="Your email address"
|
|
41
41
|
autocomplete="email"
|
|
42
42
|
required
|
|
43
43
|
/>
|
|
44
|
-
<span class="
|
|
44
|
+
<span class="web-chat-prechat-error" style="display:none;"></span>
|
|
45
45
|
</div>
|
|
46
|
-
<button type="submit" class="
|
|
46
|
+
<button type="submit" class="web-chat-prechat-submit">
|
|
47
47
|
Start chat
|
|
48
48
|
</button>
|
|
49
49
|
</form>
|
|
@@ -55,7 +55,7 @@ export class PreChatFormView {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
_attachEvents() {
|
|
58
|
-
const form = this.element.querySelector('.
|
|
58
|
+
const form = this.element.querySelector('.web-chat-prechat-form');
|
|
59
59
|
form.addEventListener('submit', async (e) => {
|
|
60
60
|
e.preventDefault();
|
|
61
61
|
await this._handleSubmit();
|
|
@@ -67,8 +67,8 @@ export class PreChatFormView {
|
|
|
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('.web-chat-prechat-error');
|
|
71
|
+
const submitBtn = this.element.querySelector('.web-chat-prechat-submit');
|
|
72
72
|
|
|
73
73
|
const email = emailInput.value.trim();
|
|
74
74
|
const name = nameInput.value.trim();
|
package/src/styles/messenger.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { messengerComponentsStyles } from './messenger-components.js';
|
|
2
|
-
import { messengerCoreStyles } from './messenger-core.js';
|
|
3
|
-
import { messengerFeaturesStyles } from './messenger-features.js';
|
|
4
|
-
import { messengerViewsStyles } from './messenger-views.js';
|
|
5
|
-
|
|
6
|
-
export const messengerStyles =
|
|
7
|
-
messengerCoreStyles +
|
|
8
|
-
messengerViewsStyles +
|
|
9
|
-
messengerComponentsStyles +
|
|
10
|
-
messengerFeaturesStyles;
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
messengerComponentsStyles,
|
|
14
|
-
messengerCoreStyles,
|
|
15
|
-
messengerFeaturesStyles,
|
|
16
|
-
messengerViewsStyles,
|
|
17
|
-
};
|