@product7/feedback-sdk 1.3.3 → 1.3.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/feedback-sdk.js +2441 -3240
- package/dist/feedback-sdk.js.map +1 -1
- package/dist/feedback-sdk.min.js +1 -1
- package/dist/feedback-sdk.min.js.map +1 -1
- package/package.json +1 -1
- package/src/api/services/MessengerService.js +76 -0
- package/src/core/BaseAPIService.js +4 -0
- package/src/index.js +2 -3
- package/src/styles/base.js +27 -52
- package/src/styles/changelog.js +152 -269
- package/src/styles/components.js +489 -0
- package/src/styles/design-tokens.js +104 -0
- package/src/styles/feedback.js +59 -369
- package/src/styles/messenger-core.js +390 -0
- package/src/styles/messenger-features.js +347 -0
- package/src/styles/messenger-help.js +298 -0
- package/src/styles/messenger-themes.js +500 -0
- package/src/styles/messenger-views.js +618 -0
- package/src/styles/messenger.js +558 -0
- package/src/styles/styles.js +24 -2
- package/src/styles/surveys.js +354 -0
- package/src/widgets/BaseWidget.js +25 -58
- package/src/widgets/ButtonWidget.js +3 -18
- package/src/widgets/ChangelogWidget.js +7 -48
- package/src/widgets/InlineWidget.js +16 -13
- package/src/widgets/MessengerWidget.js +37 -51
- package/src/widgets/SurveyWidget.js +42 -146
- package/src/widgets/TabWidget.js +2 -22
- package/src/widgets/messenger/MessengerState.js +49 -46
- package/src/widgets/messenger/components/MessengerLauncher.js +10 -5
- package/src/widgets/messenger/components/MessengerPanel.js +5 -27
- package/src/widgets/messenger/components/NavigationTabs.js +5 -14
- package/src/widgets/messenger/views/ChangelogView.js +13 -14
- package/src/widgets/messenger/views/ChatView.js +43 -36
- package/src/widgets/messenger/views/ConversationsView.js +16 -21
- package/src/widgets/messenger/views/HelpView.js +10 -10
- package/src/widgets/messenger/views/HomeView.js +11 -16
- package/src/widgets/messenger/views/PreChatFormView.js +18 -30
- package/src/styles/messengerStyles.js +0 -2328
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MessengerPanel - Main panel container for messenger
|
|
3
|
-
*/
|
|
4
1
|
import { NavigationTabs } from './NavigationTabs.js';
|
|
5
2
|
|
|
6
3
|
export class MessengerPanel {
|
|
@@ -8,7 +5,6 @@ export class MessengerPanel {
|
|
|
8
5
|
this.state = state;
|
|
9
6
|
this.options = {
|
|
10
7
|
position: options.position || 'bottom-right',
|
|
11
|
-
theme: options.theme || 'dark',
|
|
12
8
|
...options,
|
|
13
9
|
};
|
|
14
10
|
this.element = null;
|
|
@@ -18,16 +14,13 @@ export class MessengerPanel {
|
|
|
18
14
|
this._unsubscribe = null;
|
|
19
15
|
}
|
|
20
16
|
|
|
21
|
-
/**
|
|
22
|
-
* Register view components
|
|
23
|
-
*/
|
|
24
17
|
registerView(name, ViewClass) {
|
|
25
18
|
this.viewRegistry[name] = ViewClass;
|
|
26
19
|
}
|
|
27
20
|
|
|
28
21
|
render() {
|
|
29
22
|
this.element = document.createElement('div');
|
|
30
|
-
this.element.className = `messenger-panel messenger-panel-${this.options.position}
|
|
23
|
+
this.element.className = `messenger-panel messenger-panel-${this.options.position}`;
|
|
31
24
|
|
|
32
25
|
this.element.innerHTML = `
|
|
33
26
|
<div class="messenger-panel-content">
|
|
@@ -36,15 +29,12 @@ export class MessengerPanel {
|
|
|
36
29
|
</div>
|
|
37
30
|
`;
|
|
38
31
|
|
|
39
|
-
// Render navigation tabs
|
|
40
32
|
this.navigationTabs = new NavigationTabs(this.state, this.options);
|
|
41
33
|
const navContainer = this.element.querySelector('.messenger-panel-nav');
|
|
42
34
|
navContainer.appendChild(this.navigationTabs.render());
|
|
43
35
|
|
|
44
|
-
// Render initial view
|
|
45
36
|
this._renderCurrentView();
|
|
46
37
|
|
|
47
|
-
// Subscribe to state changes
|
|
48
38
|
this._unsubscribe = this.state.subscribe((type) => {
|
|
49
39
|
if (type === 'viewChange') {
|
|
50
40
|
this._renderCurrentView();
|
|
@@ -57,44 +47,35 @@ export class MessengerPanel {
|
|
|
57
47
|
_renderCurrentView() {
|
|
58
48
|
const viewsContainer = this.element.querySelector('.messenger-panel-views');
|
|
59
49
|
|
|
60
|
-
// Destroy current view if exists
|
|
61
50
|
if (this.currentViewComponent && this.currentViewComponent.destroy) {
|
|
62
51
|
this.currentViewComponent.destroy();
|
|
63
52
|
}
|
|
64
53
|
|
|
65
|
-
// Clear container
|
|
66
54
|
viewsContainer.innerHTML = '';
|
|
67
55
|
|
|
68
|
-
// Get view class
|
|
69
56
|
const ViewClass = this.viewRegistry[this.state.currentView];
|
|
70
57
|
if (ViewClass) {
|
|
71
58
|
this.currentViewComponent = new ViewClass(this.state, this.options);
|
|
72
59
|
viewsContainer.appendChild(this.currentViewComponent.render());
|
|
73
60
|
} else {
|
|
74
|
-
viewsContainer.innerHTML = `<div class="messenger-
|
|
61
|
+
viewsContainer.innerHTML = `<div class="messenger-empty-state">
|
|
62
|
+
<p>View not found: ${this.state.currentView}</p>
|
|
63
|
+
</div>`;
|
|
75
64
|
}
|
|
76
65
|
}
|
|
77
66
|
|
|
78
|
-
/**
|
|
79
|
-
* Show the panel with animation
|
|
80
|
-
*/
|
|
81
67
|
show() {
|
|
82
68
|
if (this.element) {
|
|
83
69
|
this.element.style.display = 'block';
|
|
84
|
-
// Trigger animation
|
|
85
70
|
requestAnimationFrame(() => {
|
|
86
71
|
this.element.classList.add('open');
|
|
87
72
|
});
|
|
88
73
|
}
|
|
89
74
|
}
|
|
90
75
|
|
|
91
|
-
/**
|
|
92
|
-
* Hide the panel with animation
|
|
93
|
-
*/
|
|
94
76
|
hide() {
|
|
95
77
|
if (this.element) {
|
|
96
78
|
this.element.classList.remove('open');
|
|
97
|
-
// Wait for animation to complete
|
|
98
79
|
setTimeout(() => {
|
|
99
80
|
if (this.element) {
|
|
100
81
|
this.element.style.display = 'none';
|
|
@@ -103,9 +84,6 @@ export class MessengerPanel {
|
|
|
103
84
|
}
|
|
104
85
|
}
|
|
105
86
|
|
|
106
|
-
/**
|
|
107
|
-
* Set panel header content (used by views)
|
|
108
|
-
*/
|
|
109
87
|
setHeader(headerContent) {
|
|
110
88
|
const header = this.element.querySelector('.messenger-panel-header');
|
|
111
89
|
if (header) {
|
|
@@ -127,4 +105,4 @@ export class MessengerPanel {
|
|
|
127
105
|
this.element.parentNode.removeChild(this.element);
|
|
128
106
|
}
|
|
129
107
|
}
|
|
130
|
-
}
|
|
108
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NavigationTabs - Bottom navigation for messenger
|
|
3
|
-
*/
|
|
4
1
|
export class NavigationTabs {
|
|
5
2
|
constructor(state, options = {}) {
|
|
6
3
|
this.state = state;
|
|
@@ -16,7 +13,6 @@ export class NavigationTabs {
|
|
|
16
13
|
this._updateContent();
|
|
17
14
|
this._attachEvents();
|
|
18
15
|
|
|
19
|
-
// Subscribe to state changes
|
|
20
16
|
this._unsubscribe = this.state.subscribe((type) => {
|
|
21
17
|
if (type === 'viewChange' || type === 'unreadCountChange') {
|
|
22
18
|
this._updateActiveTab();
|
|
@@ -91,7 +87,6 @@ export class NavigationTabs {
|
|
|
91
87
|
const isActive = tab.dataset.tab === this.state.currentView;
|
|
92
88
|
tab.classList.toggle('active', isActive);
|
|
93
89
|
|
|
94
|
-
// Update badge if messages tab
|
|
95
90
|
if (tab.dataset.tab === 'messages') {
|
|
96
91
|
const existingBadge = tab.querySelector('.messenger-nav-badge');
|
|
97
92
|
if (existingBadge) existingBadge.remove();
|
|
@@ -108,29 +103,25 @@ export class NavigationTabs {
|
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
_getHomeIcon() {
|
|
111
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="
|
|
112
|
-
<path d="M216,115.54V208a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V160a8,8,0,0,0-8-8H112a8,8,0,0,0-8,8v48a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V115.54a8,8,0,0,1,2.62-5.92l80-75.54a8,8,0,0,1,10.77,0l80,75.54A8,8,0,0,1,216,115.54Z" opacity="0.2"></path>
|
|
106
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256">
|
|
113
107
|
<path d="M218.83,103.77l-80-75.48a1.14,1.14,0,0,1-.11-.11,16,16,0,0,0-21.53,0l-.11.11L37.17,103.77A16,16,0,0,0,32,115.55V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V160h32v48a16,16,0,0,0,16,16h48a16,16,0,0,0,16-16V115.55A16,16,0,0,0,218.83,103.77ZM208,208H160V160a16,16,0,0,0-16-16H112a16,16,0,0,0-16,16v48H48V115.55l.11-.1L128,40l79.9,75.43.11.1Z"></path>
|
|
114
108
|
</svg>`;
|
|
115
109
|
}
|
|
116
110
|
|
|
117
111
|
_getMessagesIcon() {
|
|
118
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="
|
|
119
|
-
<path d="M224,64V192a8,8,0,0,1-8,8H82.5a8,8,0,0,0-5.15,1.88l-32.2,28.23A8,8,0,0,1,32,224V64a8,8,0,0,1,8-8H216A8,8,0,0,1,224,64Z" opacity="0.2"></path>
|
|
112
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256">
|
|
120
113
|
<path d="M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78.69.69,0,0,0,.13-.11L82.5,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H82.5a16,16,0,0,0-10.3,3.75l-.12.11L40,224V64H216Z"></path>
|
|
121
114
|
</svg>`;
|
|
122
115
|
}
|
|
123
116
|
|
|
124
117
|
_getHelpIcon() {
|
|
125
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="
|
|
126
|
-
<path d="M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z" opacity="0.2"></path>
|
|
118
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256">
|
|
127
119
|
<path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path>
|
|
128
120
|
</svg>`;
|
|
129
121
|
}
|
|
130
122
|
|
|
131
123
|
_getChangelogIcon() {
|
|
132
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="
|
|
133
|
-
<path d="M200,144a32,32,0,0,1-63.5,4.5L85.83,121.25a32.07,32.07,0,0,1-41.54-34l-24.15-21a8,8,0,0,1,10.25-12.29L54.55,75a32,32,0,0,1,59.16,2.5l50.63,27.25a31.88,31.88,0,0,1,35.66,7l26.46-23A8,8,0,1,1,236.71,101l-26.46,23A32,32,0,0,1,200,144Z" opacity="0.2"></path>
|
|
124
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 256 256">
|
|
134
125
|
<path d="M228.54,86.66l-26.46,23.07A40,40,0,0,0,168,72.13L120.89,46.5a40,40,0,0,0-75.44-4l-22-19.2a8,8,0,0,0-10.5,12L35.44,54.77a40,40,0,0,0,50,61.07l47.1,25.64a40,40,0,0,0,75.41,4.07l26.46-23.07a8,8,0,0,0-10.5-12ZM56,96A24,24,0,1,1,77.25,82.75,24,24,0,0,1,56,96Zm144,64a24,24,0,1,1,24-24A24,24,0,0,1,200,160Z"></path>
|
|
135
126
|
</svg>`;
|
|
136
127
|
}
|
|
@@ -143,4 +134,4 @@ export class NavigationTabs {
|
|
|
143
134
|
this.element.parentNode.removeChild(this.element);
|
|
144
135
|
}
|
|
145
136
|
}
|
|
146
|
-
}
|
|
137
|
+
}
|
|
@@ -27,8 +27,8 @@ export class ChangelogView {
|
|
|
27
27
|
this.element.innerHTML = `
|
|
28
28
|
<div class="messenger-changelog-header">
|
|
29
29
|
<h2>Changelog</h2>
|
|
30
|
-
<button class="
|
|
31
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="
|
|
30
|
+
<button class="sdk-close-btn" aria-label="Close">
|
|
31
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 256 256">
|
|
32
32
|
<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
|
|
33
33
|
</svg>
|
|
34
34
|
</button>
|
|
@@ -73,7 +73,7 @@ export class ChangelogView {
|
|
|
73
73
|
const tagsHtml =
|
|
74
74
|
item.tags && item.tags.length > 0
|
|
75
75
|
? `<div class="messenger-changelog-tags">
|
|
76
|
-
${item.tags.map((tag) => `<span class="messenger-changelog-tag">${tag}</span>`).join('')}
|
|
76
|
+
${item.tags.map((tag) => `<span class="sdk-badge sdk-badge-primary messenger-changelog-tag">${tag}</span>`).join('')}
|
|
77
77
|
</div>`
|
|
78
78
|
: '';
|
|
79
79
|
|
|
@@ -96,7 +96,7 @@ export class ChangelogView {
|
|
|
96
96
|
${item.description ? `<p class="messenger-changelog-description">${this._truncateText(item.description, 100)}</p>` : ''}
|
|
97
97
|
<div class="messenger-changelog-meta">
|
|
98
98
|
<span class="messenger-changelog-date">${dateStr}</span>
|
|
99
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="
|
|
99
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 256 256" class="messenger-changelog-arrow">
|
|
100
100
|
<path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path>
|
|
101
101
|
</svg>
|
|
102
102
|
</div>
|
|
@@ -110,19 +110,18 @@ export class ChangelogView {
|
|
|
110
110
|
if (!avatars || avatars.length === 0) {
|
|
111
111
|
return `
|
|
112
112
|
<div class="messenger-avatar-stack messenger-avatar-stack-tiny">
|
|
113
|
-
<div class="
|
|
113
|
+
<div class="sdk-avatar sdk-avatar-sm">S</div>
|
|
114
114
|
</div>
|
|
115
115
|
`;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
const colors = ['#5856d6', '#007aff', '#34c759'];
|
|
119
118
|
const avatarItems = avatars
|
|
120
119
|
.slice(0, 2)
|
|
121
|
-
.map((avatar
|
|
120
|
+
.map((avatar) => {
|
|
122
121
|
if (typeof avatar === 'string' && avatar.startsWith('http')) {
|
|
123
|
-
return `<
|
|
122
|
+
return `<div class="sdk-avatar sdk-avatar-sm"><img src="${avatar}" alt="Team member" /></div>`;
|
|
124
123
|
}
|
|
125
|
-
return `<div class="
|
|
124
|
+
return `<div class="sdk-avatar sdk-avatar-sm">${avatar.charAt(0).toUpperCase()}</div>`;
|
|
126
125
|
})
|
|
127
126
|
.join('');
|
|
128
127
|
|
|
@@ -131,9 +130,9 @@ export class ChangelogView {
|
|
|
131
130
|
|
|
132
131
|
_renderEmptyState() {
|
|
133
132
|
return `
|
|
134
|
-
<div class="messenger-
|
|
135
|
-
<div class="messenger-
|
|
136
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="
|
|
133
|
+
<div class="messenger-empty-state">
|
|
134
|
+
<div class="messenger-empty-state-icon">
|
|
135
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" viewBox="0 0 256 256">
|
|
137
136
|
<path d="M228.54,86.66l-26.46,23.07A40,40,0,0,0,168,72.13L120.89,46.5a40,40,0,0,0-75.44-4l-22-19.2a8,8,0,0,0-10.5,12L35.44,54.77a40,40,0,0,0,50,61.07l47.1,25.64a40,40,0,0,0,75.41,4.07l26.46-23.07a8,8,0,0,0-10.5-12ZM56,96A24,24,0,1,1,77.25,82.75,24,24,0,0,1,56,96Zm144,64a24,24,0,1,1,24-24A24,24,0,0,1,200,160Z"></path>
|
|
138
137
|
</svg>
|
|
139
138
|
</div>
|
|
@@ -161,7 +160,7 @@ export class ChangelogView {
|
|
|
161
160
|
|
|
162
161
|
_attachEvents() {
|
|
163
162
|
this.element
|
|
164
|
-
.querySelector('.
|
|
163
|
+
.querySelector('.sdk-close-btn')
|
|
165
164
|
.addEventListener('click', () => {
|
|
166
165
|
this.state.setOpen(false);
|
|
167
166
|
});
|
|
@@ -195,4 +194,4 @@ export class ChangelogView {
|
|
|
195
194
|
this.element.parentNode.removeChild(this.element);
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
|
-
}
|
|
197
|
+
}
|
|
@@ -9,7 +9,7 @@ export class ChatView {
|
|
|
9
9
|
this._typingIndicator = null;
|
|
10
10
|
this._isConversationClosed = false;
|
|
11
11
|
this._showEmailOverlayFlag = false;
|
|
12
|
-
this._pendingAttachments = [];
|
|
12
|
+
this._pendingAttachments = [];
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
render() {
|
|
@@ -75,8 +75,8 @@ export class ChatView {
|
|
|
75
75
|
|
|
76
76
|
this.element.innerHTML = `
|
|
77
77
|
<div class="messenger-chat-header">
|
|
78
|
-
<button class="messenger-back-btn" aria-label="Back">
|
|
79
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="
|
|
78
|
+
<button class="sdk-btn-icon messenger-back-btn" aria-label="Back">
|
|
79
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 256 256">
|
|
80
80
|
<path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path>
|
|
81
81
|
</svg>
|
|
82
82
|
</button>
|
|
@@ -84,8 +84,8 @@ export class ChatView {
|
|
|
84
84
|
${avatarHtml}
|
|
85
85
|
<span class="messenger-chat-title">${title}</span>
|
|
86
86
|
</div>
|
|
87
|
-
<button class="
|
|
88
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="
|
|
87
|
+
<button class="sdk-close-btn" aria-label="Close">
|
|
88
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 256 256">
|
|
89
89
|
<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
|
|
90
90
|
</svg>
|
|
91
91
|
</button>
|
|
@@ -95,11 +95,11 @@ export class ChatView {
|
|
|
95
95
|
${messagesHtml}
|
|
96
96
|
${isClosed ? `
|
|
97
97
|
<div class="messenger-closed-banner">
|
|
98
|
-
<i class="ph ph-check-circle"
|
|
98
|
+
<i class="ph ph-check-circle"></i>
|
|
99
99
|
<span>This conversation has been resolved</span>
|
|
100
100
|
</div>
|
|
101
101
|
` : ''}
|
|
102
|
-
<div class="messenger-typing-indicator"
|
|
102
|
+
<div class="messenger-typing-indicator">
|
|
103
103
|
<div class="messenger-typing-dots">
|
|
104
104
|
<span></span><span></span><span></span>
|
|
105
105
|
</div>
|
|
@@ -111,30 +111,38 @@ export class ChatView {
|
|
|
111
111
|
<div class="messenger-compose-attachments-preview"></div>
|
|
112
112
|
|
|
113
113
|
<div class="messenger-chat-compose">
|
|
114
|
-
<button class="messenger-compose-attach" aria-label="Attach file">
|
|
115
|
-
<i class="ph ph-paperclip"
|
|
114
|
+
<button class="sdk-btn-icon messenger-compose-attach" aria-label="Attach file">
|
|
115
|
+
<i class="ph ph-paperclip"></i>
|
|
116
116
|
</button>
|
|
117
117
|
<div class="messenger-compose-input-wrapper">
|
|
118
118
|
<textarea class="messenger-compose-input" placeholder="${placeholder}" rows="1"></textarea>
|
|
119
119
|
</div>
|
|
120
120
|
<button class="messenger-compose-send" aria-label="Send" disabled>
|
|
121
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="
|
|
121
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 256 256">
|
|
122
122
|
<path d="M227.32,28.68a16,16,0,0,0-15.66-4.08l-.15,0L19.57,82.84a16,16,0,0,0-2.49,29.8L102,154l41.3,84.87A15.86,15.86,0,0,0,157.74,248q.69,0,1.38-.06a15.88,15.88,0,0,0,14-11.51l58.2-191.94c0-.05,0-.1,0-.15A16,16,0,0,0,227.32,28.68ZM157.83,231.85l-.05.14L118.42,148.9l47.24-47.25a8,8,0,0,0-11.31-11.31L107.1,137.58,24,98.22l.14,0L216,40Z"></path>
|
|
123
123
|
</svg>
|
|
124
124
|
</button>
|
|
125
|
-
<input type="file" class="messenger-compose-file-input"
|
|
125
|
+
<input type="file" class="messenger-compose-file-input" multiple accept="image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip" />
|
|
126
126
|
</div>
|
|
127
127
|
`}
|
|
128
128
|
|
|
129
|
-
<div class="messenger-email-overlay"
|
|
130
|
-
<div class="messenger-email-card">
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<div class="
|
|
136
|
-
<
|
|
137
|
-
|
|
129
|
+
<div class="messenger-email-overlay">
|
|
130
|
+
<div class="sdk-card messenger-email-card">
|
|
131
|
+
<div class="sdk-card-header">
|
|
132
|
+
<h4>What is your email address?</h4>
|
|
133
|
+
<p>Enter your email to know when we reply:</p>
|
|
134
|
+
</div>
|
|
135
|
+
<div class="sdk-card-body">
|
|
136
|
+
<div class="sdk-form-group">
|
|
137
|
+
<input type="text" class="sdk-input messenger-email-name" placeholder="Name (optional)" value="${this._escapeHtml(existingName)}" autocomplete="name" />
|
|
138
|
+
</div>
|
|
139
|
+
<div class="sdk-form-group">
|
|
140
|
+
<input type="email" class="sdk-input messenger-email-input" placeholder="Enter your email address..." autocomplete="email" />
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
<div class="sdk-card-footer messenger-email-actions">
|
|
144
|
+
<button class="sdk-btn sdk-btn-primary sdk-btn-block messenger-email-submit" disabled>Set my email</button>
|
|
145
|
+
<button class="sdk-btn sdk-btn-secondary sdk-btn-block messenger-email-skip">Skip</button>
|
|
138
146
|
</div>
|
|
139
147
|
</div>
|
|
140
148
|
</div>
|
|
@@ -179,9 +187,9 @@ export class ChatView {
|
|
|
179
187
|
return `<img class="messenger-message-image" src="${this._escapeHtml(att.url)}" alt="${this._escapeHtml(att.name || 'image')}" data-url="${this._escapeHtml(att.url)}" />`;
|
|
180
188
|
}
|
|
181
189
|
return `<a class="messenger-message-file" href="${this._escapeHtml(att.url)}" data-url="${this._escapeHtml(att.url)}" data-name="${this._escapeHtml(att.name || 'file')}">
|
|
182
|
-
<i class="ph ph-file"
|
|
190
|
+
<i class="ph ph-file"></i>
|
|
183
191
|
<span>${this._escapeHtml(att.name || 'file')}</span>
|
|
184
|
-
<i class="ph ph-download-simple messenger-file-download-icon"
|
|
192
|
+
<i class="ph ph-download-simple messenger-file-download-icon"></i>
|
|
185
193
|
</a>`;
|
|
186
194
|
}).join('');
|
|
187
195
|
}
|
|
@@ -224,21 +232,21 @@ export class ChatView {
|
|
|
224
232
|
|
|
225
233
|
_renderSenderAvatar(sender) {
|
|
226
234
|
if (sender?.avatarUrl) {
|
|
227
|
-
return `<
|
|
235
|
+
return `<div class="sdk-avatar sdk-avatar-sm"><img src="${sender.avatarUrl}" alt="${sender.name}" /></div>`;
|
|
228
236
|
}
|
|
229
237
|
const initial = (sender?.name || 'S').charAt(0).toUpperCase();
|
|
230
|
-
return `<div class="
|
|
238
|
+
return `<div class="sdk-avatar sdk-avatar-sm">${initial}</div>`;
|
|
231
239
|
}
|
|
232
240
|
|
|
233
241
|
_renderConversationAvatar(conversation) {
|
|
234
242
|
if (!conversation?.participants?.length) {
|
|
235
|
-
return `<div class="
|
|
243
|
+
return `<div class="sdk-avatar sdk-avatar-sm">S</div>`;
|
|
236
244
|
}
|
|
237
245
|
const p = conversation.participants[0];
|
|
238
246
|
if (p.avatarUrl) {
|
|
239
|
-
return `<
|
|
247
|
+
return `<div class="sdk-avatar sdk-avatar-sm"><img src="${p.avatarUrl}" alt="${p.name}" /></div>`;
|
|
240
248
|
}
|
|
241
|
-
return `<div class="
|
|
249
|
+
return `<div class="sdk-avatar sdk-avatar-sm">${(p.name || 'S').charAt(0).toUpperCase()}</div>`;
|
|
242
250
|
}
|
|
243
251
|
|
|
244
252
|
_renderTeamAvatars() {
|
|
@@ -246,20 +254,19 @@ export class ChatView {
|
|
|
246
254
|
if (!avatars || avatars.length === 0) {
|
|
247
255
|
return `
|
|
248
256
|
<div class="messenger-avatar-stack">
|
|
249
|
-
<div class="
|
|
250
|
-
<div class="
|
|
257
|
+
<div class="sdk-avatar sdk-avatar-md">S</div>
|
|
258
|
+
<div class="sdk-avatar sdk-avatar-md">T</div>
|
|
251
259
|
</div>
|
|
252
260
|
`;
|
|
253
261
|
}
|
|
254
262
|
|
|
255
|
-
const colors = ['#5856d6', '#007aff', '#34c759', '#ff9500', '#ff3b30'];
|
|
256
263
|
const avatarItems = avatars
|
|
257
264
|
.slice(0, 3)
|
|
258
|
-
.map((avatar
|
|
265
|
+
.map((avatar) => {
|
|
259
266
|
if (typeof avatar === 'string' && avatar.startsWith('http')) {
|
|
260
|
-
return `<
|
|
267
|
+
return `<div class="sdk-avatar sdk-avatar-md"><img src="${avatar}" alt="Team member" /></div>`;
|
|
261
268
|
}
|
|
262
|
-
return `<div class="
|
|
269
|
+
return `<div class="sdk-avatar sdk-avatar-md">${avatar.charAt(0).toUpperCase()}</div>`;
|
|
263
270
|
})
|
|
264
271
|
.join('');
|
|
265
272
|
|
|
@@ -334,7 +341,7 @@ export class ChatView {
|
|
|
334
341
|
const isImage = att.type.startsWith('image');
|
|
335
342
|
const thumb = isImage
|
|
336
343
|
? `<img class="messenger-attachment-thumb" src="${att.preview}" alt="${this._escapeHtml(att.file.name)}" />`
|
|
337
|
-
: `<div class="messenger-attachment-thumb messenger-attachment-file-icon"><i class="ph ph-file"
|
|
344
|
+
: `<div class="messenger-attachment-thumb messenger-attachment-file-icon"><i class="ph ph-file"></i></div>`;
|
|
338
345
|
return `
|
|
339
346
|
<div class="messenger-attachment-preview" data-index="${i}">
|
|
340
347
|
${thumb}
|
|
@@ -362,7 +369,7 @@ export class ChatView {
|
|
|
362
369
|
});
|
|
363
370
|
|
|
364
371
|
this.element
|
|
365
|
-
.querySelector('.
|
|
372
|
+
.querySelector('.sdk-close-btn')
|
|
366
373
|
.addEventListener('click', () => {
|
|
367
374
|
this.state.setOpen(false);
|
|
368
375
|
});
|
|
@@ -701,4 +708,4 @@ export class ChatView {
|
|
|
701
708
|
this.element.parentNode.removeChild(this.element);
|
|
702
709
|
}
|
|
703
710
|
}
|
|
704
|
-
}
|
|
711
|
+
}
|
|
@@ -34,9 +34,9 @@ export class ConversationsView {
|
|
|
34
34
|
let conversationsHtml;
|
|
35
35
|
if (conversations.length === 0) {
|
|
36
36
|
conversationsHtml = `
|
|
37
|
-
<div class="messenger-
|
|
38
|
-
<div class="messenger-
|
|
39
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="
|
|
37
|
+
<div class="messenger-empty-state">
|
|
38
|
+
<div class="messenger-empty-state-icon">
|
|
39
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" viewBox="0 0 256 256">
|
|
40
40
|
<path d="M216,48H40A16,16,0,0,0,24,64V224a15.85,15.85,0,0,0,9.24,14.5A16.13,16.13,0,0,0,40,240a15.89,15.89,0,0,0,10.25-3.78.69.69,0,0,0,.13-.11L82.5,208H216a16,16,0,0,0,16-16V64A16,16,0,0,0,216,48ZM40,224h0ZM216,192H82.5a16,16,0,0,0-10.3,3.75l-.12.11L40,224V64H216Z"></path>
|
|
41
41
|
</svg>
|
|
42
42
|
</div>
|
|
@@ -55,7 +55,7 @@ export class ConversationsView {
|
|
|
55
55
|
this.element.innerHTML = `
|
|
56
56
|
<div class="messenger-conversations-header">
|
|
57
57
|
<h2>Messages</h2>
|
|
58
|
-
<button class="
|
|
58
|
+
<button class="sdk-close-btn" aria-label="Close">
|
|
59
59
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#000000" viewBox="0 0 256 256">
|
|
60
60
|
<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
|
|
61
61
|
</svg>
|
|
@@ -108,43 +108,38 @@ export class ConversationsView {
|
|
|
108
108
|
|
|
109
109
|
_renderConversationAvatars(participants) {
|
|
110
110
|
if (!participants || participants.length === 0) {
|
|
111
|
-
return `<div class="
|
|
111
|
+
return `<div class="sdk-avatar sdk-avatar-md">S</div>`;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
const p = participants[0];
|
|
115
115
|
if (p.avatarUrl) {
|
|
116
|
-
return `<
|
|
116
|
+
return `<div class="sdk-avatar sdk-avatar-md"><img src="${p.avatarUrl}" alt="${p.name}" /></div>`;
|
|
117
117
|
}
|
|
118
|
-
return `<div class="
|
|
118
|
+
return `<div class="sdk-avatar sdk-avatar-md">${(p.name || 'S').charAt(0).toUpperCase()}</div>`;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
_renderAvatarStack() {
|
|
122
122
|
const avatars = this.state.teamAvatars;
|
|
123
123
|
if (!avatars || avatars.length === 0) {
|
|
124
124
|
return `
|
|
125
|
-
<div class="messenger-avatar-stack
|
|
126
|
-
<div class="
|
|
127
|
-
<div class="
|
|
125
|
+
<div class="messenger-avatar-stack">
|
|
126
|
+
<div class="sdk-avatar sdk-avatar-sm">S</div>
|
|
127
|
+
<div class="sdk-avatar sdk-avatar-sm">T</div>
|
|
128
128
|
</div>
|
|
129
129
|
`;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
const avatarItems = avatars
|
|
133
133
|
.slice(0, 2)
|
|
134
|
-
.map((avatar
|
|
134
|
+
.map((avatar) => {
|
|
135
135
|
if (typeof avatar === 'string' && avatar.startsWith('http')) {
|
|
136
|
-
return `<
|
|
136
|
+
return `<div class="sdk-avatar sdk-avatar-sm"><img src="${avatar}" alt="Team member" /></div>`;
|
|
137
137
|
}
|
|
138
|
-
return `<div class="
|
|
138
|
+
return `<div class="sdk-avatar sdk-avatar-sm">${avatar.charAt(0).toUpperCase()}</div>`;
|
|
139
139
|
})
|
|
140
140
|
.join('');
|
|
141
141
|
|
|
142
|
-
return `<div class="messenger-avatar-stack
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
_getAvatarColor(index) {
|
|
146
|
-
const colors = ['#5856d6', '#007aff', '#34c759', '#ff9500', '#ff3b30'];
|
|
147
|
-
return colors[index % colors.length];
|
|
142
|
+
return `<div class="messenger-avatar-stack">${avatarItems}</div>`;
|
|
148
143
|
}
|
|
149
144
|
|
|
150
145
|
_formatTimeAgo(timestamp) {
|
|
@@ -171,7 +166,7 @@ export class ConversationsView {
|
|
|
171
166
|
}
|
|
172
167
|
|
|
173
168
|
_attachEvents() {
|
|
174
|
-
const closeBtn = this.element.querySelector('.
|
|
169
|
+
const closeBtn = this.element.querySelector('.sdk-close-btn');
|
|
175
170
|
if (closeBtn) {
|
|
176
171
|
closeBtn.addEventListener('click', () => {
|
|
177
172
|
this.state.setOpen(false);
|
|
@@ -232,4 +227,4 @@ export class ConversationsView {
|
|
|
232
227
|
this.element.parentNode.removeChild(this.element);
|
|
233
228
|
}
|
|
234
229
|
}
|
|
235
|
-
}
|
|
230
|
+
}
|
|
@@ -29,7 +29,7 @@ export class HelpView {
|
|
|
29
29
|
this.element.innerHTML = `
|
|
30
30
|
<div class="messenger-help-header">
|
|
31
31
|
<h2>Help</h2>
|
|
32
|
-
<button class="
|
|
32
|
+
<button class="sdk-close-btn" aria-label="Close">
|
|
33
33
|
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="#000000" viewBox="0 0 256 256">
|
|
34
34
|
<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
|
|
35
35
|
</svg>
|
|
@@ -40,7 +40,7 @@ export class HelpView {
|
|
|
40
40
|
<div class="messenger-help-search-wrapper">
|
|
41
41
|
<input
|
|
42
42
|
type="text"
|
|
43
|
-
class="messenger-help-search-input"
|
|
43
|
+
class="sdk-input messenger-help-search-input"
|
|
44
44
|
placeholder="Search for help"
|
|
45
45
|
value="${searchQuery}"
|
|
46
46
|
/>
|
|
@@ -117,9 +117,9 @@ export class HelpView {
|
|
|
117
117
|
|
|
118
118
|
if (isSearching) {
|
|
119
119
|
return `
|
|
120
|
-
<div class="messenger-
|
|
121
|
-
<div class="messenger-
|
|
122
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="
|
|
120
|
+
<div class="messenger-empty-state">
|
|
121
|
+
<div class="messenger-empty-state-icon">
|
|
122
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" viewBox="0 0 256 256">
|
|
123
123
|
<path d="M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z"></path>
|
|
124
124
|
</svg>
|
|
125
125
|
</div>
|
|
@@ -130,9 +130,9 @@ export class HelpView {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
return `
|
|
133
|
-
<div class="messenger-
|
|
134
|
-
<div class="messenger-
|
|
135
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="
|
|
133
|
+
<div class="messenger-empty-state">
|
|
134
|
+
<div class="messenger-empty-state-icon">
|
|
135
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" fill="currentColor" viewBox="0 0 256 256">
|
|
136
136
|
<path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path>
|
|
137
137
|
</svg>
|
|
138
138
|
</div>
|
|
@@ -144,7 +144,7 @@ export class HelpView {
|
|
|
144
144
|
|
|
145
145
|
_attachEvents() {
|
|
146
146
|
this.element
|
|
147
|
-
.querySelector('.
|
|
147
|
+
.querySelector('.sdk-close-btn')
|
|
148
148
|
.addEventListener('click', () => {
|
|
149
149
|
this.state.setOpen(false);
|
|
150
150
|
});
|
|
@@ -189,4 +189,4 @@ export class HelpView {
|
|
|
189
189
|
this.element.parentNode.removeChild(this.element);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
}
|
|
192
|
+
}
|