From 15e259b425bcf3deb312622051c53594318d976d Mon Sep 17 00:00:00 2001 From: Khaja Nizamuddin Date: Mon, 22 Jan 2018 22:44:36 +0530 Subject: [PATCH] Auto Open after timeout done. Version 0.3.2 --- package.json | 2 +- src/assets/embed/ana-web-chat-plugin.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3dc94fb..fc86154 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ana-web-chat", - "version": "0.3.1", + "version": "0.3.2", "license": "GNU-GPLv3", "scripts": { "ng": "ng", diff --git a/src/assets/embed/ana-web-chat-plugin.js b/src/assets/embed/ana-web-chat-plugin.js index 7a86944..d5e2513 100644 --- a/src/assets/embed/ana-web-chat-plugin.js +++ b/src/assets/embed/ana-web-chat-plugin.js @@ -41,6 +41,7 @@ let stompEndpoint = base.getAttr(script, "endpoint"); let businessId = base.getAttr(script, "businessid"); let apiEndpoint = base.getAttr(script, "api-endpoint"); + let autoOpen = base.getAttr(script, "auto-open"); let htmlMessages = (base.getAttr(script, "html-messages") === 'true' ? true : false) let flowId = base.getAttr(script, "flowid"); let fileUploadUrl = ""; @@ -505,8 +506,16 @@ document.body.appendChild(divEle); let scriptEle = document.createElement('script') - scriptEle.innerHTML = bodyScript + scriptEle.innerHTML = bodyScript; document.body.appendChild(scriptEle); + + var maxBtn = document.getElementById('ana-max-btn'); + autoOpen = parseInt(autoOpen); + if (maxBtn && autoOpen > 0 && !fullpage) { + setTimeout(() => { + maxBtn.click(); + }, autoOpen * 1000); + } } } let script = base.scriptEle();