@product7/product7-js 0.5.6 → 0.5.7
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
package/package.json
CHANGED
|
@@ -21,7 +21,7 @@ export class LiveChatService {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
return this.api._makeRequest('/widget/
|
|
24
|
+
return this.api._makeRequest('/widget/liveChat/settings', {
|
|
25
25
|
method: 'GET',
|
|
26
26
|
headers: { Authorization: `Bearer ${this.api.sessionToken}` },
|
|
27
27
|
});
|
|
@@ -45,7 +45,7 @@ export class LiveChatService {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
return this.api._makeRequest('/widget/
|
|
48
|
+
return this.api._makeRequest('/widget/liveChat/agents/online', {
|
|
49
49
|
method: 'GET',
|
|
50
50
|
headers: { Authorization: `Bearer ${this.api.sessionToken}` },
|
|
51
51
|
});
|
|
@@ -64,7 +64,7 @@ export class LiveChatService {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const endpoint = this.api._getEndpointWithParams(
|
|
67
|
-
'/widget/
|
|
67
|
+
'/widget/liveChat/conversations',
|
|
68
68
|
options
|
|
69
69
|
);
|
|
70
70
|
return this.api._makeRequest(endpoint, {
|
|
@@ -86,7 +86,7 @@ export class LiveChatService {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
return this.api._makeRequest(
|
|
89
|
-
`/widget/
|
|
89
|
+
`/widget/liveChat/conversations/${conversationId}`,
|
|
90
90
|
{
|
|
91
91
|
method: 'GET',
|
|
92
92
|
headers: { Authorization: `Bearer ${this.api.sessionToken}` },
|
|
@@ -120,7 +120,7 @@ export class LiveChatService {
|
|
|
120
120
|
return { status: true, data: newConv };
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
return this.api._makeRequest('/widget/
|
|
123
|
+
return this.api._makeRequest('/widget/liveChat/conversations', {
|
|
124
124
|
method: 'POST',
|
|
125
125
|
headers: {
|
|
126
126
|
'Content-Type': 'application/json',
|
|
@@ -154,7 +154,7 @@ export class LiveChatService {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
return this.api._makeRequest(
|
|
157
|
-
`/widget/
|
|
157
|
+
`/widget/liveChat/conversations/${conversationId}/messages`,
|
|
158
158
|
{
|
|
159
159
|
method: 'POST',
|
|
160
160
|
headers: {
|
|
@@ -183,7 +183,7 @@ export class LiveChatService {
|
|
|
183
183
|
};
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
return this.api._makeRequest('/widget/
|
|
186
|
+
return this.api._makeRequest('/widget/liveChat/unread', {
|
|
187
187
|
method: 'GET',
|
|
188
188
|
headers: { Authorization: `Bearer ${this.api.sessionToken}` },
|
|
189
189
|
});
|
|
@@ -197,7 +197,7 @@ export class LiveChatService {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
return this.api._makeRequest(
|
|
200
|
-
`/widget/
|
|
200
|
+
`/widget/liveChat/conversations/${conversationId}/read`,
|
|
201
201
|
{
|
|
202
202
|
method: 'POST',
|
|
203
203
|
headers: { Authorization: `Bearer ${this.api.sessionToken}` },
|
|
@@ -219,7 +219,7 @@ export class LiveChatService {
|
|
|
219
219
|
|
|
220
220
|
const params = { ...options };
|
|
221
221
|
const endpoint = this.api._getEndpointWithParams(
|
|
222
|
-
`/widget/
|
|
222
|
+
`/widget/liveChat/conversations/${conversationId}/messages`,
|
|
223
223
|
params
|
|
224
224
|
);
|
|
225
225
|
return this.api._makeRequest(endpoint, {
|
|
@@ -236,7 +236,7 @@ export class LiveChatService {
|
|
|
236
236
|
return { status: true, url: `https://mock-cdn.example.com/${filename}` };
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
return this.api._makeRequest('/widget/
|
|
239
|
+
return this.api._makeRequest('/widget/liveChat/upload', {
|
|
240
240
|
method: 'POST',
|
|
241
241
|
headers: {
|
|
242
242
|
'Content-Type': 'application/json',
|
|
@@ -258,7 +258,7 @@ export class LiveChatService {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
return this.api._makeRequest(
|
|
261
|
-
`/widget/
|
|
261
|
+
`/widget/liveChat/conversations/${conversationId}/rating`,
|
|
262
262
|
{
|
|
263
263
|
method: 'POST',
|
|
264
264
|
headers: {
|
|
@@ -278,7 +278,7 @@ export class LiveChatService {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
return this.api._makeRequest(
|
|
281
|
-
`/widget/
|
|
281
|
+
`/widget/liveChat/conversations/${conversationId}/typing`,
|
|
282
282
|
{
|
|
283
283
|
method: 'POST',
|
|
284
284
|
headers: {
|
package/src/core/APIService.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ChangelogService } from '../api/services/ChangelogService.js';
|
|
2
2
|
import { FeedbackService } from '../api/services/FeedbackService.js';
|
|
3
3
|
import { HelpService } from '../api/services/HelpService.js';
|
|
4
|
-
import { SurveyService } from '../api/services/SurveyService.js';
|
|
5
4
|
import { LiveChatService } from '../api/services/LiveChatService.js';
|
|
5
|
+
import { SurveyService } from '../api/services/SurveyService.js';
|
|
6
6
|
import { BaseAPIService } from './BaseAPIService.js';
|
|
7
7
|
|
|
8
8
|
export class APIService extends BaseAPIService {
|
|
@@ -51,7 +51,7 @@ export class WebSocketService {
|
|
|
51
51
|
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
52
52
|
let wsURL = this.baseURL.replace(/^https?:/, wsProtocol);
|
|
53
53
|
wsURL = wsURL.replace('/api/v1', '');
|
|
54
|
-
wsURL = `${wsURL}/api/v1/widget/
|
|
54
|
+
wsURL = `${wsURL}/api/v1/widget/liveChat/ws?token=${encodeURIComponent(this.sessionToken)}`;
|
|
55
55
|
|
|
56
56
|
try {
|
|
57
57
|
this.ws = new WebSocket(wsURL);
|
package/src/index.js
CHANGED
|
@@ -13,9 +13,9 @@ import { BaseWidget } from './widgets/BaseWidget.js';
|
|
|
13
13
|
import { ButtonWidget } from './widgets/ButtonWidget.js';
|
|
14
14
|
import { ChangelogWidget } from './widgets/ChangelogWidget.js';
|
|
15
15
|
import { InlineWidget } from './widgets/InlineWidget.js';
|
|
16
|
+
import { LiveChatWidget } from './widgets/LiveChatWidget.js';
|
|
16
17
|
import { SurveyWidget } from './widgets/SurveyWidget.js';
|
|
17
18
|
import { TabWidget } from './widgets/TabWidget.js';
|
|
18
|
-
import { LiveChatWidget } from './widgets/LiveChatWidget.js';
|
|
19
19
|
import { WidgetFactory } from './widgets/WidgetFactory.js';
|
|
20
20
|
|
|
21
21
|
// --- Identify: transform flat user data into internal format ---
|
|
@@ -399,7 +399,7 @@ const Product7 = {
|
|
|
399
399
|
});
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
// Listen for data-product7-
|
|
402
|
+
// Listen for data-product7-liveChat clicks
|
|
403
403
|
Product7._setupLiveChatAttributeTriggers();
|
|
404
404
|
Product7._setupPostMessageListener();
|
|
405
405
|
|
|
@@ -413,7 +413,8 @@ const Product7 = {
|
|
|
413
413
|
|
|
414
414
|
openLiveChat() {
|
|
415
415
|
if (Product7._LiveChatWidget) {
|
|
416
|
-
Product7._LiveChatWidget.open?.() ||
|
|
416
|
+
Product7._LiveChatWidget.open?.() ||
|
|
417
|
+
Product7._LiveChatWidget.openPanel?.();
|
|
417
418
|
}
|
|
418
419
|
},
|
|
419
420
|
|
|
@@ -778,7 +779,7 @@ const Product7 = {
|
|
|
778
779
|
Product7._liveChatListenerAttached = true;
|
|
779
780
|
|
|
780
781
|
document.addEventListener('click', (e) => {
|
|
781
|
-
const trigger = e.target.closest('[data-product7-
|
|
782
|
+
const trigger = e.target.closest('[data-product7-liveChat]');
|
|
782
783
|
if (trigger) {
|
|
783
784
|
e.preventDefault();
|
|
784
785
|
Product7.openLiveChat();
|
|
@@ -859,12 +860,12 @@ export {
|
|
|
859
860
|
EventBus,
|
|
860
861
|
helpers,
|
|
861
862
|
InlineWidget,
|
|
863
|
+
LiveChatWidget,
|
|
862
864
|
Product7SDK as Product7,
|
|
863
865
|
SDKError,
|
|
864
866
|
SurveyWidget,
|
|
865
867
|
TabWidget,
|
|
866
868
|
ValidationError,
|
|
867
|
-
LiveChatWidget,
|
|
868
869
|
WidgetError,
|
|
869
870
|
WidgetFactory,
|
|
870
871
|
};
|
package/src/styles/base.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const baseStyles = `
|
|
2
2
|
.feedback-widget,
|
|
3
|
-
.
|
|
3
|
+
.liveChat-widget,
|
|
4
4
|
.changelog-widget,
|
|
5
5
|
.feedback-survey,
|
|
6
6
|
.feedback-panel,
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
.feedback-widget *,
|
|
16
16
|
.feedback-widget *::before,
|
|
17
17
|
.feedback-widget *::after,
|
|
18
|
-
.
|
|
19
|
-
.
|
|
20
|
-
.
|
|
18
|
+
.liveChat-widget *,
|
|
19
|
+
.liveChat-widget *::before,
|
|
20
|
+
.liveChat-widget *::after,
|
|
21
21
|
.changelog-widget *,
|
|
22
22
|
.changelog-widget *::before,
|
|
23
23
|
.changelog-widget *::after,
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
|
|
42
42
|
@media (prefers-reduced-motion: reduce) {
|
|
43
43
|
.feedback-widget *,
|
|
44
|
-
.
|
|
44
|
+
.liveChat-widget *,
|
|
45
45
|
.changelog-widget *,
|
|
46
46
|
.feedback-survey * {
|
|
47
47
|
transition: none !important;
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
.sdk-notification,
|
|
57
57
|
.changelog-widget,
|
|
58
58
|
.changelog-modal,
|
|
59
|
-
.
|
|
60
|
-
.
|
|
61
|
-
.
|
|
59
|
+
.liveChat-widget,
|
|
60
|
+
.liveChat-launcher,
|
|
61
|
+
.liveChat-panel,
|
|
62
62
|
.feedback-survey,
|
|
63
63
|
.feedback-survey-backdrop {
|
|
64
64
|
display: none !important;
|