yelda-webchat 1.1.8 → 1.1.9
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/css/yeldaWebchatInjector.css +94 -36
- package/dist/css/yeldaWebchatInjector.min.css +16 -13
- package/dist/css/yeldaWebchatInjector.min.css.map +1 -1
- package/dist/js/yeldaWebchatInjector.js +69 -43
- package/dist/js/yeldaWebchatInjector.js.map +1 -1
- package/dist/js/yeldaWebchatInjector.min.js +1 -1
- package/package.json +1 -1
- package/src/css/yeldaWebchatInjector.css +94 -36
- package/src/js/yeldaWebchatInjector.js +56 -35
package/package.json
CHANGED
|
@@ -2,8 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
.yelda_assistant_img {
|
|
5
|
-
opacity: 0.93;
|
|
6
5
|
cursor: pointer;
|
|
6
|
+
opacity: 1;
|
|
7
|
+
height: auto;
|
|
8
|
+
transition-property: opacity, height;
|
|
9
|
+
transition-duration: 1s, 1ms;
|
|
10
|
+
transition-delay: 1.2s, 1.2s;
|
|
11
|
+
animation-name: appear;
|
|
12
|
+
animation-duration: 0.8s;
|
|
13
|
+
animation-delay: 1s;
|
|
14
|
+
animation-timing-function: cubic-bezier(0.230, 1.000, 0.320, 1.000);
|
|
15
|
+
animation-iteration-count: 1;
|
|
16
|
+
animation-fill-mode: forwards;
|
|
17
|
+
opacity: 0;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.yelda_container.y_active .yelda_assistant_img{
|
|
22
|
+
opacity:0 ;
|
|
23
|
+
height: 0;
|
|
24
|
+
transition-property: opacity, height;
|
|
25
|
+
transition-duration: 1ms, 1ms;
|
|
26
|
+
transition-delay: 0, 0;
|
|
27
|
+
animation: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.yelda_assistant_img.activated{
|
|
31
|
+
transition-delay: 1s;
|
|
32
|
+
/*animation-delay: 0s;*/
|
|
7
33
|
}
|
|
8
34
|
|
|
9
35
|
.yelda_assistant_img.default {
|
|
@@ -33,15 +59,6 @@
|
|
|
33
59
|
}
|
|
34
60
|
|
|
35
61
|
.yelda_assistant_img.default i{
|
|
36
|
-
font-size: 32px !important;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.yelda_assistant_img:hover{
|
|
40
|
-
animation-name: fonta;
|
|
41
|
-
animation-duration: 300ms;
|
|
42
|
-
opacity: 1;
|
|
43
|
-
}
|
|
44
|
-
.yelda_assistant_img.default:hover i{
|
|
45
62
|
height: 60px;
|
|
46
63
|
width: 60px;
|
|
47
64
|
line-height: 65px;
|
|
@@ -52,6 +69,9 @@
|
|
|
52
69
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
|
|
53
70
|
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
54
71
|
font-weight: normal;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column-reverse;
|
|
74
|
+
align-items: flex-end;
|
|
55
75
|
}
|
|
56
76
|
|
|
57
77
|
.yelda_container.inner {
|
|
@@ -60,11 +80,6 @@
|
|
|
60
80
|
top: 80px;
|
|
61
81
|
}
|
|
62
82
|
|
|
63
|
-
@keyframes fonta {
|
|
64
|
-
from {font-size:32px;}
|
|
65
|
-
to {font-size:35px;}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
83
|
#web_chat_frame{
|
|
69
84
|
height: 100% !important;
|
|
70
85
|
width: 100% !important;
|
|
@@ -79,12 +94,15 @@
|
|
|
79
94
|
|
|
80
95
|
.yelda_iframe_container {
|
|
81
96
|
width: 430px;
|
|
82
|
-
height:
|
|
97
|
+
height: 0;
|
|
83
98
|
max-height: 600px;
|
|
84
|
-
|
|
85
|
-
margin: 0px 20px 0 0px;
|
|
99
|
+
margin: 0;
|
|
86
100
|
overflow: hidden;
|
|
101
|
+
transition-property: opacity, transform, height;
|
|
102
|
+
transition-duration: 1s, 1s, 1ms;
|
|
103
|
+
transition-delay: 0s, 0s, 1s;
|
|
87
104
|
opacity: 0;
|
|
105
|
+
transform: translateY(20px);
|
|
88
106
|
}
|
|
89
107
|
|
|
90
108
|
.yelda_iframe_container:not(.voiceFirstUI) {
|
|
@@ -92,9 +110,13 @@
|
|
|
92
110
|
border-radius: 6px;
|
|
93
111
|
}
|
|
94
112
|
|
|
95
|
-
.yelda_iframe_container
|
|
113
|
+
.y_active .yelda_iframe_container{
|
|
114
|
+
height: calc(100vh - 170px);
|
|
115
|
+
transition-property: opacity, transform, height;
|
|
116
|
+
transition-duration: 1s, 1s, 1ms;
|
|
117
|
+
transition-delay: 0s, 0s, 0s;
|
|
96
118
|
opacity: 1 !important;
|
|
97
|
-
|
|
119
|
+
transform: translateY(0);
|
|
98
120
|
}
|
|
99
121
|
|
|
100
122
|
.lg-backdrop {
|
|
@@ -132,62 +154,86 @@
|
|
|
132
154
|
border-radius: 0;
|
|
133
155
|
margin: 0 !important;
|
|
134
156
|
padding: 0;
|
|
135
|
-
transition-duration: 0s;
|
|
136
157
|
}
|
|
137
158
|
|
|
138
159
|
.yelda_iframe_container.inner {
|
|
139
160
|
width: 100%;
|
|
140
161
|
box-shadow: 0 5px 32px rgba(0,0,0,.16);
|
|
141
162
|
border-radius: 6px;
|
|
142
|
-
transition-duration: 1s;
|
|
143
163
|
margin: 0px 20px 0 0px;
|
|
144
164
|
overflow: hidden;
|
|
145
165
|
}
|
|
146
166
|
}
|
|
147
167
|
/** CSS for assistant bubble text */
|
|
148
168
|
#yelda_assistant_bubble_text {
|
|
149
|
-
animation:
|
|
150
|
-
|
|
151
|
-
|
|
169
|
+
animation-name: fadeAndSlideInFromRight;
|
|
170
|
+
animation-duration: 1s;
|
|
171
|
+
animation-delay: 2s;
|
|
172
|
+
animation-timing-function: cubic-bezier(0.230, 1.000, 0.320, 1.000);
|
|
173
|
+
animation-iteration-count: 1;
|
|
174
|
+
animation-fill-mode: both;
|
|
175
|
+
padding: 7px 10px 6px;
|
|
152
176
|
border-radius: 8px;
|
|
153
|
-
box-shadow: #00000030
|
|
177
|
+
box-shadow: #00000030 0 2px 8px 0;
|
|
154
178
|
background-color: white;
|
|
155
179
|
cursor: pointer;
|
|
156
180
|
right: 0;
|
|
157
181
|
bottom: 76px;
|
|
158
182
|
max-width: 300px;
|
|
159
|
-
width: calc(66vw);
|
|
160
183
|
text-align: left;
|
|
161
184
|
font-size: 14px;
|
|
162
185
|
font-weight: normal;
|
|
186
|
+
display: inline-block;
|
|
187
|
+
margin-bottom: 10px;
|
|
188
|
+
}
|
|
189
|
+
#yelda_assistant_bubble_text.y_notification{
|
|
190
|
+
animation-delay: 0s;
|
|
163
191
|
}
|
|
164
192
|
|
|
165
193
|
#yelda_assistant_bubble_text.hidden {
|
|
166
194
|
display: none;
|
|
167
195
|
}
|
|
168
196
|
|
|
197
|
+
.y_active #yelda_assistant_bubble_text{
|
|
198
|
+
display: none;
|
|
199
|
+
}
|
|
200
|
+
|
|
169
201
|
/* Close button for bubble text */
|
|
170
202
|
.bubbleCloseButton {
|
|
171
|
-
position:
|
|
172
|
-
top: -17px;
|
|
173
|
-
left: 95%;
|
|
203
|
+
position: absolute;
|
|
174
204
|
color: white;
|
|
175
205
|
background: grey;
|
|
176
|
-
border-radius:
|
|
177
|
-
padding:
|
|
178
|
-
font-size:
|
|
179
|
-
|
|
206
|
+
border-radius: 68%;
|
|
207
|
+
padding: 0;
|
|
208
|
+
font-size: 20px;
|
|
209
|
+
width: 27px;
|
|
210
|
+
height: 27px;
|
|
211
|
+
line-height: 22px;
|
|
212
|
+
text-align: center;
|
|
213
|
+
right: -14px;
|
|
214
|
+
top: -17px;
|
|
215
|
+
text-decoration: none !important;
|
|
216
|
+
transition: all 0.15s ease-in;
|
|
217
|
+
transform: scale(0.7);
|
|
218
|
+
opacity:0; /* Don't show the close button by default */
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
a.bubbleCloseButton:hover {
|
|
222
|
+
color: white;
|
|
223
|
+
background: #5a5a5a;
|
|
180
224
|
}
|
|
181
225
|
|
|
182
226
|
/* Show the close button on mouse hover */
|
|
183
227
|
#yelda_assistant_bubble_text:hover .bubbleCloseButton {
|
|
184
|
-
|
|
228
|
+
opacity:1;
|
|
229
|
+
transform: scale(1);
|
|
185
230
|
}
|
|
186
231
|
|
|
187
232
|
/* Show the close button always on mobile screen */
|
|
188
233
|
@media only screen and (max-width: 768px) {
|
|
189
234
|
.bubbleCloseButton {
|
|
190
|
-
|
|
235
|
+
opacity: 1;
|
|
236
|
+
transform: none;
|
|
191
237
|
}
|
|
192
238
|
}
|
|
193
239
|
|
|
@@ -202,3 +248,15 @@
|
|
|
202
248
|
opacity: 1;
|
|
203
249
|
}
|
|
204
250
|
}
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
@keyframes appear {
|
|
254
|
+
from {
|
|
255
|
+
transform: scale(0.5);
|
|
256
|
+
opacity: 0;
|
|
257
|
+
}
|
|
258
|
+
to {
|
|
259
|
+
transform: scale(1);
|
|
260
|
+
opacity: 1;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
@@ -83,8 +83,9 @@ class YeldaChat {
|
|
|
83
83
|
/**
|
|
84
84
|
* Create an assistantBubbleText component and add it to webChatContainer element
|
|
85
85
|
* @param {String} text - default null
|
|
86
|
+
* @param {String} cssClass - default ''
|
|
86
87
|
*/
|
|
87
|
-
addAssistantBubbleText(text = null) {
|
|
88
|
+
addAssistantBubbleText(text = null, cssClass = '') {
|
|
88
89
|
text = text || this.webchatSettings && this.webchatSettings.bubbleText
|
|
89
90
|
if (!this.webChatContainer || !text) {
|
|
90
91
|
return
|
|
@@ -95,6 +96,7 @@ class YeldaChat {
|
|
|
95
96
|
// create assistantBubbleText element and set the text
|
|
96
97
|
this.assistantBubbleText = document.createElement('span')
|
|
97
98
|
this.assistantBubbleText.setAttribute('id', 'yelda_assistant_bubble_text')
|
|
99
|
+
this.assistantBubbleText.setAttribute('class', cssClass)
|
|
98
100
|
this.assistantBubbleText.innerText = text
|
|
99
101
|
this.addCloseButtonForBubbleText()
|
|
100
102
|
|
|
@@ -277,6 +279,43 @@ class YeldaChat {
|
|
|
277
279
|
return url
|
|
278
280
|
}
|
|
279
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Add 'y_active' class to the webChatContainer if required
|
|
284
|
+
*
|
|
285
|
+
* To control the opacity of the iframe container (.yelda_iframe_container) and the assistant image (.yelda_assistant_img),
|
|
286
|
+
* We add and remove the "y_active" CSS class to the webChatContainer (.yelda_container) which is always visible
|
|
287
|
+
* By default
|
|
288
|
+
* - yelda_iframe_container is hidden (opacity: 0;)
|
|
289
|
+
* - assistant image is visible (opacity: 1 for yelda_assistant_img)
|
|
290
|
+
*
|
|
291
|
+
* When we add the class "y_active" to (webChatContainer)
|
|
292
|
+
* - yelda_iframe_container is now visible (.y_active .yelda_iframe_container => opacity: 1)
|
|
293
|
+
* - the assistant image is hidden (.yelda_container.y_active .yelda_assistant_img => opacity: 0
|
|
294
|
+
*
|
|
295
|
+
* @param {Boolean} data.shouldBeOpened
|
|
296
|
+
* @param {Boolean} data.isStartBtn
|
|
297
|
+
* @param {Boolean} data.canBeClosed
|
|
298
|
+
*/
|
|
299
|
+
initWebChatContainerYActiveClass(data) {
|
|
300
|
+
// should be opened on load OR has a start button
|
|
301
|
+
const shoulBeOpened = data.shouldBeOpened || data.isStartBtn
|
|
302
|
+
|
|
303
|
+
// cannot be closed (canBeClosed explicitly set to false)
|
|
304
|
+
const cantBeClosed = data.hasOwnProperty('canBeClosed') && !data.canBeClosed
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* If we are sure that the webchat should be opened from the creation and displayed all the time
|
|
308
|
+
* we add the y_active class to webChatContainer at the creation
|
|
309
|
+
*
|
|
310
|
+
* Otherwise yelda_assistant_img click event management will take care of showing and hiding the webchat
|
|
311
|
+
* - closeChat() remove "y_active" from the yelda container
|
|
312
|
+
* - openChat() add y_active" to the yelda container
|
|
313
|
+
*/
|
|
314
|
+
if (shoulBeOpened && cantBeClosed) {
|
|
315
|
+
this.webChatContainer.classList.add('y_active')
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
280
319
|
/**
|
|
281
320
|
* Create iframeContainer and it's child webchat iframe, and add it to webChatContainer
|
|
282
321
|
* @param {String} url webchat url
|
|
@@ -303,24 +342,7 @@ class YeldaChat {
|
|
|
303
342
|
classList += ' inner'
|
|
304
343
|
}
|
|
305
344
|
|
|
306
|
-
|
|
307
|
-
* add CSS class which controls the opacity of the frame container if the iframe:
|
|
308
|
-
* - should be opened on load OR has a start button
|
|
309
|
-
* - cannot be closed (canBeClosed explicitly set to false)
|
|
310
|
-
*
|
|
311
|
-
* If we are sure that the webchat should be opened and displayed all the time, we can add the y_active class right away
|
|
312
|
-
* Otherwise,
|
|
313
|
-
*/
|
|
314
|
-
if ((data.shouldBeOpened || data.isStartBtn) && data.hasOwnProperty('canBeClosed') && !data.canBeClosed) {
|
|
315
|
-
classList += ' y_active'
|
|
316
|
-
} else {
|
|
317
|
-
/**
|
|
318
|
-
* If the iframe can be closed, hide it by default
|
|
319
|
-
* yelda_assistant_img click event management will take care of showing and hiding the webchat
|
|
320
|
-
* And if it should be opened, the webchat will trigger the 'openChat' event on its own
|
|
321
|
-
*/
|
|
322
|
-
this.iframeContainer.style.cssText = 'display: none;'
|
|
323
|
-
}
|
|
345
|
+
this.initWebChatContainerYActiveClass(data)
|
|
324
346
|
|
|
325
347
|
this.iframeContainer.setAttribute('class', classList)
|
|
326
348
|
this.webChatContainer.appendChild(this.iframeContainer)
|
|
@@ -469,7 +491,7 @@ class YeldaChat {
|
|
|
469
491
|
break
|
|
470
492
|
case config.FRAME_EVENT_TYPES.RECEIVED.ADD_MINIMAL_NOTIFICATION_TEXT:
|
|
471
493
|
if (!this.configurationData.hasOwnProperty('canBeClosed') || this.configurationData.canBeClosed) {
|
|
472
|
-
this.addAssistantBubbleText(eventData.text)
|
|
494
|
+
this.addAssistantBubbleText(eventData.text, 'y_notification')
|
|
473
495
|
}
|
|
474
496
|
break;
|
|
475
497
|
}
|
|
@@ -528,15 +550,11 @@ class YeldaChat {
|
|
|
528
550
|
* Close the webchat window
|
|
529
551
|
*/
|
|
530
552
|
closeChat() {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
const yeldaIframeContainerElement = document.getElementById('yelda_iframe_container')
|
|
537
|
-
if (yeldaIframeContainerElement !== null) {
|
|
538
|
-
yeldaIframeContainerElement.classList.remove('y_active')
|
|
539
|
-
yeldaIframeContainerElement.style.display = 'none'
|
|
553
|
+
// Closing the webchat = remove the y_active class on #yelda_container
|
|
554
|
+
// Hiding the iframe + showing back the bubble + animation => All is done in CSS
|
|
555
|
+
const yeldaContainerElement = document.getElementById('yelda_container')
|
|
556
|
+
if (yeldaContainerElement !== null) {
|
|
557
|
+
yeldaContainerElement.classList.remove('y_active')
|
|
540
558
|
}
|
|
541
559
|
}
|
|
542
560
|
|
|
@@ -544,18 +562,21 @@ class YeldaChat {
|
|
|
544
562
|
* Open the webchat window
|
|
545
563
|
*/
|
|
546
564
|
openChat() {
|
|
565
|
+
// Adding the class "activated" allows the CSS to change the transition/animation after the first opening
|
|
547
566
|
const assistantImgElement = document.getElementById('yelda_assistant_img')
|
|
548
567
|
if (assistantImgElement !== null) {
|
|
549
|
-
assistantImgElement.
|
|
568
|
+
assistantImgElement.classList.add('activated')
|
|
550
569
|
}
|
|
551
570
|
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
571
|
+
// Opening the webchat = adding the y_active class on #yelda_container
|
|
572
|
+
// Showing the iframe + hiding bubble + hiding minimal notification + animation => All is done in CSS
|
|
573
|
+
const yeldaContainerElement = document.getElementById('yelda_container')
|
|
574
|
+
if (yeldaContainerElement !== null) {
|
|
575
|
+
yeldaContainerElement.classList.add('y_active')
|
|
556
576
|
}
|
|
557
577
|
|
|
558
|
-
//
|
|
578
|
+
// Hide the assistant bubble text while opening the webchat window
|
|
579
|
+
// Note : bubble text container is also hidden in CSS
|
|
559
580
|
if (this.assistantBubbleText) {
|
|
560
581
|
this.assistantBubbleText = null
|
|
561
582
|
}
|