@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.
Files changed (41) hide show
  1. package/README.md +4 -4
  2. package/dist/README.md +4 -4
  3. package/dist/product7-js.js +7124 -7130
  4. package/dist/product7-js.js.map +1 -1
  5. package/dist/product7-js.min.js +1 -1
  6. package/dist/product7-js.min.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/api/APIService.js +1 -0
  9. package/src/api/services/{MessengerService.js → WebChatService.js} +15 -15
  10. package/src/core/APIService.js +16 -16
  11. package/src/core/Product7.js +4 -4
  12. package/src/core/WebSocketService.js +3 -3
  13. package/src/docs/api.md +9 -9
  14. package/src/docs/example.md +12 -12
  15. package/src/docs/framework-integrations.md +5 -5
  16. package/src/index.js +41 -42
  17. package/src/styles/base.js +9 -9
  18. package/src/styles/design-tokens.js +2 -2
  19. package/src/styles/feedback.js +2 -2
  20. package/src/styles/styles.js +4 -4
  21. package/src/styles/survey.js +3 -2
  22. package/src/styles/{messenger-components.js → web-chat-components.js} +114 -114
  23. package/src/styles/{messenger-core.js → web-chat-core.js} +32 -32
  24. package/src/styles/{messenger-features.js → web-chat-features.js} +20 -20
  25. package/src/styles/{messenger-views.js → web-chat-views.js} +137 -137
  26. package/src/styles/web-chat.js +17 -0
  27. package/src/styles/{messengerCustomStyles.js → webChatCustomStyles.js} +17 -19
  28. package/src/widgets/SurveyWidget.js +6 -1
  29. package/src/widgets/{MessengerWidget.js → WebChatWidget.js} +169 -172
  30. package/src/widgets/WidgetFactory.js +3 -3
  31. package/src/widgets/{messenger/MessengerState.js → web-chat/WebChatState.js} +1 -1
  32. package/src/widgets/{messenger → web-chat}/components/NavigationTabs.js +13 -13
  33. package/src/widgets/{messenger/components/MessengerLauncher.js → web-chat/components/WebChatLauncher.js} +15 -17
  34. package/src/widgets/{messenger/components/MessengerPanel.js → web-chat/components/WebChatPanel.js} +11 -11
  35. package/src/widgets/{messenger → web-chat}/views/ChangelogView.js +17 -17
  36. package/src/widgets/{messenger → web-chat}/views/ChatView.js +97 -99
  37. package/src/widgets/{messenger → web-chat}/views/ConversationsView.js +24 -24
  38. package/src/widgets/{messenger → web-chat}/views/HelpView.js +29 -29
  39. package/src/widgets/{messenger → web-chat}/views/HomeView.js +53 -55
  40. package/src/widgets/{messenger → web-chat}/views/PreChatFormView.js +17 -17
  41. 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 applyMessengerCustomStyles(options = {}) {
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-messenger-custom-styles';
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-messenger-widget {
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
- .messenger-launcher-btn {
45
+ .web-chat-launcher-btn {
48
46
  background: ${primaryColor} !important;
49
47
  }
50
48
 
51
- .messenger-launcher-btn:hover {
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
- .messenger-compose-send:hover:not(:disabled) {
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
- .messenger-nav-tab.active .messenger-nav-icon,
72
- .messenger-nav-tab.active .messenger-nav-label {
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
- .messenger-home-view::before {
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
- .messenger-panel-content {
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
- .messenger-panel-content,
94
- .messenger-view {
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 messenger-core.js */
99
+ /* Dark theme is now handled by CSS custom properties in web-chat-core.js */
102
100
  `;
103
101
 
104
- console.log('✅ Custom messenger styles applied:', { primaryColor, theme });
102
+ console.log('✅ Custom web chat styles applied:', { primaryColor, theme });
105
103
  }
106
104
 
107
- export function removeMessengerCustomStyles() {
105
+ export function removewebChatCustomStyles() {
108
106
  const styleElement = document.getElementById(
109
- 'product7-messenger-custom-styles'
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 buttonUrl = config.button_url || '#';
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);