@tiledesk/tiledesk-whatsapp-connector 0.1.0 → 0.1.3
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/index.js +8 -3
- package/package.json +1 -1
- package/template/configure.html +24 -3
package/index.js
CHANGED
|
@@ -237,8 +237,8 @@ router.post('/update', async (req, res) => {
|
|
|
237
237
|
}
|
|
238
238
|
})
|
|
239
239
|
|
|
240
|
-
router.post('
|
|
241
|
-
console.log("/disconnect")
|
|
240
|
+
router.post('/disconnect', async (req, res) => {
|
|
241
|
+
console.log("\n/disconnect")
|
|
242
242
|
if (log) {
|
|
243
243
|
console.log("/disconnect body: ", req.body)
|
|
244
244
|
}
|
|
@@ -586,7 +586,12 @@ function startApp(settings, callback) {
|
|
|
586
586
|
|
|
587
587
|
function readHTMLFile(templateName, callback) {
|
|
588
588
|
console.log("Reading file: ", templateName)
|
|
589
|
-
|
|
589
|
+
console.log("appRoot: ", appRoot)
|
|
590
|
+
let file = appRoot + '/template' + templateName;
|
|
591
|
+
console.log("file: ", file);
|
|
592
|
+
console.log("*** appRoot: ", appRoot.toString());
|
|
593
|
+
console.log("type: ", typeof(appRoot))
|
|
594
|
+
fs.readFile(__dirname + '/template' + templateName, { encoding: 'utf-8' },
|
|
590
595
|
function(err, html) {
|
|
591
596
|
if (err) {
|
|
592
597
|
throw err;
|
package/package.json
CHANGED
package/template/configure.html
CHANGED
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
<div>
|
|
44
44
|
|
|
45
45
|
<h1 style="margin-top: 0px; margin-bottom: 2px; min-width: 500px;">WhatsApp Business (Test)</h1>
|
|
46
|
-
<h7 style="color: rgb(140, 140, 140);">by Tiledesk (v.
|
|
46
|
+
<h7 style="color: rgb(140, 140, 140);">by Tiledesk (v. 0.1.3)</h7>
|
|
47
47
|
|
|
48
48
|
{{#if wab_token}}
|
|
49
49
|
<div style="margin-top: 20px;">
|
|
@@ -102,8 +102,13 @@
|
|
|
102
102
|
value="{{ proxy_url}}">
|
|
103
103
|
</div>
|
|
104
104
|
<div style="width: 80px;">
|
|
105
|
+
<!--
|
|
105
106
|
<input type="button" class="btn btn-primary" style="width: 100%;"
|
|
106
|
-
onclick="copyTextToClipboard(this, document.getElementById('proxy_url').value)"
|
|
107
|
+
onclick="copyTextToClipboard(this, document.getElementById('proxy_url').value)"
|
|
108
|
+
value="Copy"></input>
|
|
109
|
+
-->
|
|
110
|
+
<input type="button" id="copy-btn" class="btn btn-primary" style="width: 100%;"
|
|
111
|
+
onclick="copyTextToClipboard()"
|
|
107
112
|
value="Copy"></input>
|
|
108
113
|
</div>
|
|
109
114
|
|
|
@@ -148,7 +153,7 @@
|
|
|
148
153
|
|
|
149
154
|
<script>
|
|
150
155
|
|
|
151
|
-
function
|
|
156
|
+
function copyTextToClipboard2(btn, text) {
|
|
152
157
|
console.log("Button clicked")
|
|
153
158
|
// if (!navigator.clipboard) {
|
|
154
159
|
// fallbackCopyTextToClipboard(text);
|
|
@@ -162,6 +167,22 @@
|
|
|
162
167
|
console.error('Async: Could not copy text: ', err);
|
|
163
168
|
});
|
|
164
169
|
}
|
|
170
|
+
|
|
171
|
+
function copyTextToClipboard() {
|
|
172
|
+
const proxyUrl = document.getElementById('proxy_url').select()
|
|
173
|
+
|
|
174
|
+
//document.querySelector('textarea').select();
|
|
175
|
+
try {
|
|
176
|
+
document.execCommand('copy');
|
|
177
|
+
console.log('Async: Copied to clipboard!');
|
|
178
|
+
let btn = document.getElementById('copy-btn');
|
|
179
|
+
btn.value = "Copied!";
|
|
180
|
+
} catch (err) {
|
|
181
|
+
console.error('Async: Could not copy text: ', err);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
}
|
|
165
186
|
</script>
|
|
166
187
|
|
|
167
188
|
|