@tiledesk/tiledesk-whatsapp-connector 0.1.0 → 0.1.1

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 CHANGED
@@ -237,8 +237,8 @@ router.post('/update', async (req, res) => {
237
237
  }
238
238
  })
239
239
 
240
- router.post('\n/disconnect', async (req, res) => {
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
- fs.readFile(appRoot + '/template/' + templateName, { encoding: 'utf-8' },
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('./template' + templateName, { encoding: 'utf-8' },
590
595
  function(err, html) {
591
596
  if (err) {
592
597
  throw err;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-whatsapp-connector",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Tiledesk Whatsapp connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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 copyTextToClipboard(btn, text) {
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');
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