yelda-webchat 1.1.22 → 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/AGENTS.md +84 -0
- package/README.md +30 -2
- package/dist/js/yeldaWebchatInjector.js +1 -1
- package/dist/js/yeldaWebchatInjector.js.gz +0 -0
- package/dist/js/yeldaWebchatInjector.js.map +1 -1
- package/dist/js/yeldaWebchatInjector.min.js +1 -1
- package/dist/js/yeldaWebchatInjector.min.js.gz +0 -0
- package/dist/js/yeldaWebchatInjector.min.js.map +1 -1
- package/package.json +1 -1
- package/src/config/index.js +2 -1
- package/src/js/yeldaWebchatInjector.js +12 -0
package/package.json
CHANGED
package/src/config/index.js
CHANGED
|
@@ -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: {
|
|
@@ -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()
|