@product7/product7-js 0.5.1 → 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 +7124 -7130
- 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/survey.js +3 -2
- 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/SurveyWidget.js +6 -1
- 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
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function applywebChatCustomStyles(options = {}) {
|
|
2
2
|
const {
|
|
3
3
|
primaryColor = '#155EEF',
|
|
4
4
|
textColor = '#1d1d1f',
|
|
@@ -6,13 +6,11 @@ export function applyMessengerCustomStyles(options = {}) {
|
|
|
6
6
|
theme = 'light',
|
|
7
7
|
} = options;
|
|
8
8
|
|
|
9
|
-
let styleElement = document.getElementById(
|
|
10
|
-
'product7-messenger-custom-styles'
|
|
11
|
-
);
|
|
9
|
+
let styleElement = document.getElementById('product7-web-chat-custom-styles');
|
|
12
10
|
|
|
13
11
|
if (!styleElement) {
|
|
14
12
|
styleElement = document.createElement('style');
|
|
15
|
-
styleElement.id = 'product7-
|
|
13
|
+
styleElement.id = 'product7-web-chat-custom-styles';
|
|
16
14
|
document.head.appendChild(styleElement);
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -39,16 +37,16 @@ export function applyMessengerCustomStyles(options = {}) {
|
|
|
39
37
|
const darkBorder = adjustColor(backgroundColor, 34);
|
|
40
38
|
|
|
41
39
|
styleElement.textContent = `
|
|
42
|
-
#product7-
|
|
40
|
+
#product7-web-chat-widget {
|
|
43
41
|
--color-primary: ${primaryColor} !important;
|
|
44
42
|
--color-primary-hover: ${adjustColor(primaryColor, -10)} !important;
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
.
|
|
45
|
+
.web-chat-launcher-btn {
|
|
48
46
|
background: ${primaryColor} !important;
|
|
49
47
|
}
|
|
50
48
|
|
|
51
|
-
.
|
|
49
|
+
.web-chat-launcher-btn:hover {
|
|
52
50
|
box-shadow: 0 8px 24px ${adjustColor(primaryColor, 0, 0.3)} !important;
|
|
53
51
|
}
|
|
54
52
|
|
|
@@ -62,25 +60,25 @@ export function applyMessengerCustomStyles(options = {}) {
|
|
|
62
60
|
border-color: ${adjustColor(primaryColor, -10)} !important;
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
.
|
|
63
|
+
.web-chat-compose-send:hover:not(:disabled) {
|
|
66
64
|
background: ${primaryColor} !important;
|
|
67
65
|
border-color: ${primaryColor} !important;
|
|
68
66
|
color: #FFFFFF !important;
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
.
|
|
72
|
-
.
|
|
69
|
+
.web-chat-nav-tab.active .web-chat-nav-icon,
|
|
70
|
+
.web-chat-nav-tab.active .web-chat-nav-label {
|
|
73
71
|
color: ${primaryColor} !important;
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
.
|
|
74
|
+
.web-chat-home-view::before {
|
|
77
75
|
background: radial-gradient(circle, ${adjustColor(primaryColor, 0, 0.08)} 0%, transparent 70%) !important;
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
${
|
|
81
79
|
backgroundColor !== '#ffffff'
|
|
82
80
|
? `
|
|
83
|
-
.
|
|
81
|
+
.web-chat-panel-content {
|
|
84
82
|
background: ${backgroundColor} !important;
|
|
85
83
|
}
|
|
86
84
|
`
|
|
@@ -90,23 +88,23 @@ export function applyMessengerCustomStyles(options = {}) {
|
|
|
90
88
|
${
|
|
91
89
|
textColor !== '#1d1d1f'
|
|
92
90
|
? `
|
|
93
|
-
.
|
|
94
|
-
.
|
|
91
|
+
.web-chat-panel-content,
|
|
92
|
+
.web-chat-view {
|
|
95
93
|
color: ${textColor} !important;
|
|
96
94
|
}
|
|
97
95
|
`
|
|
98
96
|
: ''
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
/* Dark theme is now handled by CSS custom properties in
|
|
99
|
+
/* Dark theme is now handled by CSS custom properties in web-chat-core.js */
|
|
102
100
|
`;
|
|
103
101
|
|
|
104
|
-
console.log('✅ Custom
|
|
102
|
+
console.log('✅ Custom web chat styles applied:', { primaryColor, theme });
|
|
105
103
|
}
|
|
106
104
|
|
|
107
|
-
export function
|
|
105
|
+
export function removewebChatCustomStyles() {
|
|
108
106
|
const styleElement = document.getElementById(
|
|
109
|
-
'product7-
|
|
107
|
+
'product7-web-chat-custom-styles'
|
|
110
108
|
);
|
|
111
109
|
if (styleElement && styleElement.parentNode) {
|
|
112
110
|
styleElement.parentNode.removeChild(styleElement);
|
|
@@ -1234,7 +1234,12 @@ export class SurveyWidget extends BaseWidget {
|
|
|
1234
1234
|
{};
|
|
1235
1235
|
const title = config.title || 'Thanks for your feedback!';
|
|
1236
1236
|
const buttonText = config.button_text || null;
|
|
1237
|
-
const
|
|
1237
|
+
const rawUrl = config.button_url || '';
|
|
1238
|
+
const buttonUrl = rawUrl
|
|
1239
|
+
? /^https?:\/\//i.test(rawUrl)
|
|
1240
|
+
? rawUrl
|
|
1241
|
+
: `https://${rawUrl}`
|
|
1242
|
+
: '#';
|
|
1238
1243
|
|
|
1239
1244
|
if (this._escapeHandler) {
|
|
1240
1245
|
document.removeEventListener('keydown', this._escapeHandler);
|