wineater-bot 2.1.2 → 2.1.3
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/wineater-chatbot.mjs +476 -461
- package/dist/wineater-chatbot.umd.js +40 -28
- package/package.json +1 -1
- package/src/index.js +22 -10
- package/src/js/styles.js +28 -16
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -13,13 +13,6 @@ const tracker = new Tracker({
|
|
|
13
13
|
'__DISABLE_SECURE_MODE': true
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
flagsmith.init({
|
|
17
|
-
environmentID: '5RfiDoiqb4dHrNdQvzbkfM',
|
|
18
|
-
// api:"http://localhost:8000/api/v1/" set this if you are self hosting, and point it to your API
|
|
19
|
-
cacheFlags: true, // stores flags in localStorage cache
|
|
20
|
-
enableAnalytics: true, // See https://docs.flagsmith.com/flag-analytics/ for more info.
|
|
21
|
-
});
|
|
22
|
-
|
|
23
16
|
// Import your JavaScript modules here
|
|
24
17
|
import { toggleChatWindow, closeChatWindow, openChatWindow } from './js/ui.js';
|
|
25
18
|
import { Chatbot } from './js/chatbot.js';
|
|
@@ -44,6 +37,10 @@ export {
|
|
|
44
37
|
openChatWindow
|
|
45
38
|
};
|
|
46
39
|
|
|
40
|
+
function getUniqueId() {
|
|
41
|
+
const uniqueId = getCookie()
|
|
42
|
+
}
|
|
43
|
+
|
|
47
44
|
function createChatbotUI() {
|
|
48
45
|
tracker.start();
|
|
49
46
|
const btnTextOption = flagsmith.getValue('chat-btn-txt');
|
|
@@ -146,13 +143,28 @@ if (typeof window !== 'undefined') {
|
|
|
146
143
|
}
|
|
147
144
|
}
|
|
148
145
|
await translator.fetchConfig(capitalizeStore || 'Climats');
|
|
149
|
-
|
|
146
|
+
setCookie('chatbotToken', window.wineaterData?.CLIENT_TOKEN || DEMO_TOKEN, 365);
|
|
147
|
+
setUniqueUserCookie();
|
|
148
|
+
flagsmith.init({
|
|
149
|
+
environmentID: '5RfiDoiqb4dHrNdQvzbkfM',
|
|
150
|
+
// api:"http://localhost:8000/api/v1/" set this if you are self hosting, and point it to your API
|
|
151
|
+
cacheFlags: false, // stores flags in localStorage cache
|
|
152
|
+
enableAnalytics: true,
|
|
153
|
+
identity: getCookie('uniqueUserID') // See https://docs.flagsmith.com/flag-analytics/ for more info.
|
|
154
|
+
}).then(() => {
|
|
155
|
+
createChatbotUI(); // Create the UI
|
|
156
|
+
setupCloseButton();
|
|
157
|
+
setupOutsideClick();
|
|
158
|
+
toggleChatIconPosition(position);
|
|
159
|
+
const myChatbot = new Chatbot();
|
|
160
|
+
myChatbot.initialize();
|
|
161
|
+
}).catch(() => {
|
|
162
|
+
createChatbotUI(); // Create the UI
|
|
150
163
|
setupCloseButton();
|
|
151
164
|
setupOutsideClick();
|
|
152
165
|
toggleChatIconPosition(position);
|
|
153
|
-
setCookie('chatbotToken', window.wineaterData?.CLIENT_TOKEN || DEMO_TOKEN, 365);
|
|
154
|
-
setUniqueUserCookie();
|
|
155
166
|
const myChatbot = new Chatbot();
|
|
156
167
|
myChatbot.initialize();
|
|
168
|
+
});
|
|
157
169
|
});
|
|
158
170
|
}
|
package/src/js/styles.js
CHANGED
|
@@ -10,7 +10,7 @@ const css = `
|
|
|
10
10
|
bottom: 20px;
|
|
11
11
|
right: 20px;
|
|
12
12
|
font-family: 'Poppins', sans-serif; /* Use Poppins as the main font */
|
|
13
|
-
z-index:
|
|
13
|
+
z-index: 10000; /* Ensure chat is above other content */
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/* Styling the chat icon */
|
|
@@ -28,6 +28,7 @@ const css = `
|
|
|
28
28
|
font-family: 'Poppins', sans-serif;
|
|
29
29
|
font-size: 16px; /* Увеличенный размер текста */
|
|
30
30
|
font-weight: bold;
|
|
31
|
+
box-sizing: border-box;
|
|
31
32
|
transition: transform 0.2s ease, box-shadow 0.2s ease; /* Анимация при наведении */
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -84,14 +85,18 @@ const css = `
|
|
|
84
85
|
/* Chat window styles */
|
|
85
86
|
#chat-window {
|
|
86
87
|
position: fixed;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
88
|
+
bottom: 20px;
|
|
89
|
+
right: 20px;
|
|
90
|
+
width: 380px;
|
|
91
|
+
background-color: white;
|
|
92
|
+
border-radius: 24px;
|
|
93
|
+
border: 2px solid transparent;
|
|
94
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
|
|
95
|
+
display: none;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
background: linear-gradient(white, white) padding-box,
|
|
98
|
+
linear-gradient(90deg, #7B2BEB, #0044FF) border-box;
|
|
99
|
+
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
#chat-header {
|
|
@@ -360,10 +365,17 @@ border-top-left-radius: 4px;
|
|
|
360
365
|
}
|
|
361
366
|
|
|
362
367
|
.wine-item a {
|
|
363
|
-
color: #0044FF;
|
|
364
|
-
text-decoration:
|
|
365
|
-
font-size: 14px;
|
|
366
|
-
font-weight: 500;
|
|
368
|
+
color: #0044FF; /* Синий цвет ссылки */
|
|
369
|
+
text-decoration: underline; /* Подчеркивание для эффекта ссылки */
|
|
370
|
+
font-size: 14px; /* Размер текста */
|
|
371
|
+
font-weight: 500; /* Полужирный текст */
|
|
372
|
+
margin-top: 10px; /* Отступ сверху */
|
|
373
|
+
display: inline-block; /* Чтобы отступы работали корректно */
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.wine-item a:hover {
|
|
377
|
+
text-decoration: none; /* Убираем подчеркивание при наведении */
|
|
378
|
+
color: #002699; /* Более темный синий для интерактивного эффекта */
|
|
367
379
|
}
|
|
368
380
|
|
|
369
381
|
.wine-description {
|
|
@@ -387,7 +399,7 @@ border-bottom-right-radius: 15px;
|
|
|
387
399
|
|
|
388
400
|
/* Loader Styles */
|
|
389
401
|
.loader {
|
|
390
|
-
|
|
402
|
+
display: none;
|
|
391
403
|
width: 40px;
|
|
392
404
|
height: 40px;
|
|
393
405
|
margin: 20px auto;
|
|
@@ -423,7 +435,7 @@ border-bottom-right-radius: 15px;
|
|
|
423
435
|
justify-content: center;
|
|
424
436
|
align-items: center;
|
|
425
437
|
height: 0;
|
|
426
|
-
|
|
438
|
+
visibility: hidden;
|
|
427
439
|
background-color: white;
|
|
428
440
|
}
|
|
429
441
|
|
|
@@ -477,7 +489,7 @@ border-bottom-right-radius: 15px;
|
|
|
477
489
|
}
|
|
478
490
|
|
|
479
491
|
#message-container {
|
|
480
|
-
height: calc(100vh -
|
|
492
|
+
height: calc(100vh - 250px); /* Учитываем высоту header и input container */
|
|
481
493
|
max-height: none;
|
|
482
494
|
}
|
|
483
495
|
|