yelda-webchat 1.1.21 → 1.1.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yelda-webchat",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "Website Chat Plugin",
5
5
  "main": "./dist/js/yeldaWebchatInjector.min.js",
6
6
  "license": "MIT",
@@ -10,13 +10,14 @@ module.exports = {
10
10
  },
11
11
  HOST: {
12
12
  PRODUCTION: 'app.yelda.ai',
13
- STAGING: 'staging.yelda.ai',
13
+ STAGING: 'staging.yelda.ai'
14
14
  },
15
15
  FRAME_EVENT_TYPES: {
16
16
  SENT: {
17
17
  OPEN_CHAT: 'openChat',
18
18
  LEAVE_VIEWPORT: 'leaveViewPort',
19
19
  SEND_USER_MESSAGE: 'sendUserMessage',
20
+ UPDATE_SLOT: 'updateSlot',
20
21
  URL_UPDATE: 'urlUpdate'
21
22
  },
22
23
  RECEIVED: {
@@ -1310,7 +1310,7 @@ class YeldaChat {
1310
1310
  const webchatFrame = document.getElementById('web_chat_frame')
1311
1311
  if (webchatFrame) {
1312
1312
  this.openChat()
1313
- webchatFrame.contentWindow.postMessage({ event: config.FRAME_EVENT_TYPES.SENT.SEND_USER_MESSAGE, data: message })
1313
+ webchatFrame.contentWindow.postMessage({ event: config.FRAME_EVENT_TYPES.SENT.SEND_USER_MESSAGE, data: message }, '*')
1314
1314
  }
1315
1315
  }
1316
1316
 
@@ -1396,6 +1396,18 @@ class YeldaChat {
1396
1396
  event: config.FRAME_EVENT_TYPES.SENT.LEAVE_VIEWPORT
1397
1397
  }, '*')
1398
1398
  }
1399
+
1400
+ /**
1401
+ * Send an updateSlot postMessage to the webchat iframe
1402
+ * @param {Object} slotObject {slotSlug: slotValue}
1403
+ */
1404
+ updateSlot(slotObject) {
1405
+ const webchatFrame = document.getElementById('web_chat_frame')
1406
+ if (webchatFrame) {
1407
+ webchatFrame.contentWindow.postMessage(slotObject, '*')
1408
+ webchatFrame.contentWindow.postMessage({ event: config.FRAME_EVENT_TYPES.SENT.UPDATE_SLOT, data: slotObject }, '*')
1409
+ }
1410
+ }
1399
1411
  }
1400
1412
 
1401
1413
  let yeldaChat = new YeldaChat()