yelda-webchat 1.1.6 → 1.1.7

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.
@@ -823,19 +823,25 @@ var YeldaChat = function () {
823
823
 
824
824
  /**
825
825
  * Create an assistantBubbleText component and add it to webChatContainer element
826
+ * @param {String} text - default null
826
827
  */
827
828
 
828
829
  }, {
829
830
  key: 'addAssistantBubbleText',
830
831
  value: function addAssistantBubbleText() {
831
- if (!this.webChatContainer || !this.webchatSettings || !this.webchatSettings.bubbleText) {
832
+ var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
833
+
834
+ text = text || this.webchatSettings && this.webchatSettings.bubbleText;
835
+ if (!this.webChatContainer || !text) {
832
836
  return;
833
837
  }
834
838
 
839
+ // Remove the assistant bubble text element before adding a new one
840
+ this.removeElement('yelda_assistant_bubble_text');
835
841
  // create assistantBubbleText element and set the text
836
842
  this.assistantBubbleText = document.createElement('span');
837
843
  this.assistantBubbleText.setAttribute('id', 'yelda_assistant_bubble_text');
838
- this.assistantBubbleText.innerText = this.webchatSettings.bubbleText;
844
+ this.assistantBubbleText.innerText = text || this.webchatSettings.bubbleText;
839
845
 
840
846
  // Add click event to assistant text
841
847
  this.assistantBubbleText.addEventListener('click', this.openChat.bind(this));
@@ -1201,6 +1207,9 @@ var YeldaChat = function () {
1201
1207
  window.dispatchEvent(new CustomEvent('isSendingMessage', { detail: eventData.data }));
1202
1208
  }
1203
1209
  break;
1210
+ case _config__WEBPACK_IMPORTED_MODULE_14___default.a.FRAME_EVENT_TYPES.RECEIVED.ADD_MINIMAL_NOTIFICATION_TEXT:
1211
+ this.addAssistantBubbleText(eventData.text);
1212
+ break;
1204
1213
  }
1205
1214
  }
1206
1215
 
@@ -1296,9 +1305,12 @@ var YeldaChat = function () {
1296
1305
 
1297
1306
  // hide the assistant bubble text while opening the webchat window
1298
1307
  if (this.assistantBubbleText) {
1299
- this.assistantBubbleText.classList.add('hidden');
1308
+ this.assistantBubbleText = null;
1300
1309
  }
1301
1310
 
1311
+ // Remove assistant bubble text while opening the webchat window
1312
+ this.removeElement('yelda_assistant_bubble_text');
1313
+
1302
1314
  // Propagate the event to the webchat
1303
1315
  document.getElementById('web_chat_frame').contentWindow.postMessage(_config__WEBPACK_IMPORTED_MODULE_14___default.a.FRAME_EVENT_TYPES.SENT.OPEN_CHAT, '*');
1304
1316
  }
@@ -1397,7 +1409,7 @@ var YeldaChat = function () {
1397
1409
  }, _callee, _this2);
1398
1410
  }));
1399
1411
 
1400
- return function (_x4) {
1412
+ return function (_x5) {
1401
1413
  return _ref.apply(this, arguments);
1402
1414
  };
1403
1415
  }());
@@ -1675,7 +1687,7 @@ var YeldaChat = function () {
1675
1687
  }, _callee2, _this4, [[12, 19]]);
1676
1688
  }));
1677
1689
 
1678
- return function (_x5) {
1690
+ return function (_x6) {
1679
1691
  return _ref2.apply(this, arguments);
1680
1692
  };
1681
1693
  }());
@@ -1918,7 +1930,7 @@ var YeldaChat = function () {
1918
1930
  }, _callee4, _this5);
1919
1931
  }));
1920
1932
 
1921
- return function (_x6) {
1933
+ return function (_x7) {
1922
1934
  return _ref4.apply(this, arguments);
1923
1935
  };
1924
1936
  }());
@@ -2551,7 +2563,8 @@ module.exports = {
2551
2563
  LISTEN_LEAVE_VIEWPORT: 'listenLeaveViewport',
2552
2564
  LISTEN_URL_UPDATE: 'listenUrlUpdate',
2553
2565
  ABSTAIN_URL_UPDATE: 'abstainUrlUpdate',
2554
- ADD_BUBBLE_TEXT: 'addBubbleText'
2566
+ ADD_BUBBLE_TEXT: 'addBubbleText',
2567
+ ADD_MINIMAL_NOTIFICATION_TEXT: 'addMinimalNotificationText'
2555
2568
  }
2556
2569
  }
2557
2570
  };