@tiledesk/tiledesk-whatsapp-connector 0.1.2 → 0.1.5

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": "@tiledesk/tiledesk-whatsapp-connector",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "description": "Tiledesk Whatsapp connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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. 2.0.2)</h7>
46
+ <h7 style="color: rgb(140, 140, 140);">by Tiledesk (v. 0.1.5)</h7>
47
47
 
48
48
  {{#if wab_token}}
49
49
  <div style="margin-top: 20px;">
@@ -169,7 +169,7 @@
169
169
  }
170
170
 
171
171
  function copyTextToClipboard() {
172
- const proxyUrl = document.getElementById('proxy_url');
172
+ const proxyUrl = document.getElementById('proxy_url').select()
173
173
 
174
174
  //document.querySelector('textarea').select();
175
175
  try {
@@ -97,7 +97,7 @@ class TiledeskChannel {
97
97
  method: 'GET'
98
98
  }).then((response) => {
99
99
 
100
- if (log) {
100
+ if (this.log) {
101
101
  console.log("[Tiledesk Channel] get request response: ", response.data);
102
102
  }
103
103
 
@@ -108,7 +108,7 @@ class TiledeskChannel {
108
108
  request_id = new_request_id;
109
109
  }
110
110
 
111
- if (log) {
111
+ if (this.log) {
112
112
  console.log("[Tiledesk Channel] tiledeskMessage:", tiledeskMessage);
113
113
  }
114
114
 
@@ -122,7 +122,7 @@ class TiledeskChannel {
122
122
  method: 'POST'
123
123
  }).then((response) => {
124
124
 
125
- if (log) {
125
+ if (this.log) {
126
126
  console.log("[Tiledesk Channel] send message response: ", response.data);
127
127
  }
128
128
 
@@ -32,10 +32,15 @@ class TiledeskWhatsapp {
32
32
  // this.media = config.channelMedia;
33
33
  this.token = config.token;
34
34
  this.GRAPH_URL = config.GRAPH_URL
35
+
36
+ this.log = false;
37
+ if (config.log) {
38
+ this.log = config.log;
39
+ }
35
40
  }
36
41
 
37
42
  async sendMessage(phone_number_id, message) {
38
- if (log) {
43
+ if (this.log) {
39
44
  console.log("[Tiledesk Whatsapp] Sending message...", message);
40
45
  } else {
41
46
  console.log("[Tiledesk Whatsapp] Sending message...");
@@ -58,7 +63,7 @@ class TiledeskWhatsapp {
58
63
  }
59
64
 
60
65
  async downloadMedia(mediaId) {
61
- if (log) {
66
+ if (this.log) {
62
67
  console.log("[Tiledesk Whatsapp] Download media with id: ", mediaId);
63
68
  }
64
69
 
@@ -128,7 +133,7 @@ class TiledeskWhatsapp {
128
133
  }
129
134
 
130
135
  return await axios.post(url, form, request_config).then((response) => {
131
- if (log) {
136
+ if (this.log) {
132
137
  console.log("[Tiledesk Whatsapp] upload response: ", response.data);
133
138
  }
134
139
 
@@ -146,7 +151,7 @@ class TiledeskWhatsapp {
146
151
 
147
152
  // HTTP REQUEST
148
153
  static async myrequest(options, callback, log) {
149
- if (log) {
154
+ if (this.log) {
150
155
  console.log("API URL: ", options.url);
151
156
  console.log("** Options: ", options);
152
157
  }
@@ -157,7 +162,7 @@ class TiledeskWhatsapp {
157
162
  params: options.params,
158
163
  headers: options.headers
159
164
  }).then((res) => {
160
- if (log) {
165
+ if (this.log) {
161
166
  console.log("Response for url:", options.url);
162
167
  console.log("Response headers:\n", res.headers);
163
168
  }