yelda-webchat 1.1.7 → 1.1.8
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 +38 -29
- package/dist/css/yeldaWebchatInjector.min.css +6 -5
- package/dist/css/yeldaWebchatInjector.min.css.map +1 -1
- package/dist/js/yeldaWebchatInjector.js +36 -2
- 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 +38 -29
- package/src/js/yeldaWebchatInjector.js +30 -2
package/package.json
CHANGED
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
font-size: 35px !important;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
.yelda_container {
|
|
52
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
|
|
53
|
+
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
54
|
+
font-weight: normal;
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
.yelda_container.inner {
|
|
52
58
|
position: absolute !important;
|
|
53
59
|
left: 45px;
|
|
@@ -140,56 +146,59 @@
|
|
|
140
146
|
}
|
|
141
147
|
/** CSS for assistant bubble text */
|
|
142
148
|
#yelda_assistant_bubble_text {
|
|
149
|
+
animation: 1s ease-out 0s 1 fadeAndSlideInFromRight;
|
|
143
150
|
position: absolute;
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
padding: 5px;
|
|
148
|
-
border: 1px solid #000000;
|
|
149
|
-
border-radius: 3px;
|
|
150
|
-
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.5);
|
|
151
|
+
padding: 7px 10px;
|
|
152
|
+
border-radius: 8px;
|
|
153
|
+
box-shadow: #00000030 0px 2px 8px 0px;
|
|
151
154
|
background-color: white;
|
|
152
155
|
cursor: pointer;
|
|
153
|
-
|
|
156
|
+
right: 0;
|
|
157
|
+
bottom: 76px;
|
|
158
|
+
max-width: 300px;
|
|
159
|
+
width: calc(66vw);
|
|
160
|
+
text-align: left;
|
|
161
|
+
font-size: 14px;
|
|
162
|
+
font-weight: normal;
|
|
154
163
|
}
|
|
155
164
|
|
|
156
165
|
#yelda_assistant_bubble_text.hidden {
|
|
157
166
|
display: none;
|
|
158
167
|
}
|
|
159
168
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
/* Close button for bubble text */
|
|
170
|
+
.bubbleCloseButton {
|
|
171
|
+
position: relative;
|
|
172
|
+
top: -17px;
|
|
173
|
+
left: 95%;
|
|
174
|
+
color: white;
|
|
175
|
+
background: grey;
|
|
176
|
+
border-radius: 50%;
|
|
177
|
+
padding: 1px 4px;
|
|
178
|
+
font-size: 16px;
|
|
179
|
+
visibility: hidden; /* Don't show the close button by default */
|
|
169
180
|
}
|
|
170
181
|
|
|
171
|
-
/*
|
|
172
|
-
#yelda_assistant_bubble_text
|
|
173
|
-
|
|
174
|
-
margin-top: -5px;
|
|
175
|
-
margin-left: 1px;
|
|
182
|
+
/* Show the close button on mouse hover */
|
|
183
|
+
#yelda_assistant_bubble_text:hover .bubbleCloseButton {
|
|
184
|
+
visibility: visible;
|
|
176
185
|
}
|
|
177
186
|
|
|
178
|
-
/*
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
187
|
+
/* Show the close button always on mobile screen */
|
|
188
|
+
@media only screen and (max-width: 768px) {
|
|
189
|
+
.bubbleCloseButton {
|
|
190
|
+
visibility: visible !important;
|
|
191
|
+
}
|
|
183
192
|
}
|
|
184
193
|
|
|
185
194
|
/** Animation for assistant bubble text */
|
|
186
195
|
@keyframes fadeAndSlideInFromRight {
|
|
187
196
|
0% {
|
|
188
|
-
transform:
|
|
197
|
+
transform: translateY(10%);
|
|
189
198
|
opacity: 0;
|
|
190
199
|
}
|
|
191
200
|
100% {
|
|
192
|
-
transform:
|
|
201
|
+
transform: translateY(0%);
|
|
193
202
|
opacity: 1;
|
|
194
203
|
}
|
|
195
204
|
}
|
|
@@ -95,7 +95,8 @@ class YeldaChat {
|
|
|
95
95
|
// create assistantBubbleText element and set the text
|
|
96
96
|
this.assistantBubbleText = document.createElement('span')
|
|
97
97
|
this.assistantBubbleText.setAttribute('id', 'yelda_assistant_bubble_text')
|
|
98
|
-
this.assistantBubbleText.innerText = text
|
|
98
|
+
this.assistantBubbleText.innerText = text
|
|
99
|
+
this.addCloseButtonForBubbleText()
|
|
99
100
|
|
|
100
101
|
// Add click event to assistant text
|
|
101
102
|
this.assistantBubbleText.addEventListener('click', this.openChat.bind(this))
|
|
@@ -104,6 +105,31 @@ class YeldaChat {
|
|
|
104
105
|
this.webChatContainer.appendChild(this.assistantBubbleText)
|
|
105
106
|
}
|
|
106
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Add close button for bubble text
|
|
110
|
+
*/
|
|
111
|
+
addCloseButtonForBubbleText() {
|
|
112
|
+
// Create close button and add it to the bubble text container
|
|
113
|
+
const closeButton = document.createElement('a')
|
|
114
|
+
closeButton.setAttribute('class', 'bubbleCloseButton')
|
|
115
|
+
closeButton.setAttribute('id', 'yelda_assistant_bubble_text_close')
|
|
116
|
+
closeButton.setAttribute('href', '#')
|
|
117
|
+
closeButton.innerHTML = '×'
|
|
118
|
+
closeButton.onclick = this.closeBubbleText.bind(this)
|
|
119
|
+
this.assistantBubbleText.prepend(closeButton)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Callback function for bubble text close button
|
|
124
|
+
* @param {Event} event
|
|
125
|
+
*/
|
|
126
|
+
closeBubbleText(event) {
|
|
127
|
+
event.preventDefault()
|
|
128
|
+
event.stopPropagation()
|
|
129
|
+
this.removeElement('yelda_assistant_bubble_text')
|
|
130
|
+
this.assistantBubbleText = null
|
|
131
|
+
}
|
|
132
|
+
|
|
107
133
|
/**
|
|
108
134
|
* Create assistantImage element and add it to webChatContainer element
|
|
109
135
|
*/
|
|
@@ -442,7 +468,9 @@ class YeldaChat {
|
|
|
442
468
|
}
|
|
443
469
|
break
|
|
444
470
|
case config.FRAME_EVENT_TYPES.RECEIVED.ADD_MINIMAL_NOTIFICATION_TEXT:
|
|
445
|
-
this.
|
|
471
|
+
if (!this.configurationData.hasOwnProperty('canBeClosed') || this.configurationData.canBeClosed) {
|
|
472
|
+
this.addAssistantBubbleText(eventData.text)
|
|
473
|
+
}
|
|
446
474
|
break;
|
|
447
475
|
}
|
|
448
476
|
}
|