@wppconnect/server 1.8.1 → 1.8.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/CHANGELOG.md +14 -102
- package/Dockerfile +2 -2
- package/README.md +2 -2
- package/dist/config.json +2 -1
- package/dist/controller/catalogController.js +59 -28
- package/dist/controller/catalogController.js.map +1 -1
- package/dist/controller/deviceController.js +47 -47
- package/dist/controller/deviceController.js.map +1 -1
- package/dist/controller/groupController.js +23 -21
- package/dist/controller/groupController.js.map +1 -1
- package/dist/controller/labelsController.js +5 -5
- package/dist/controller/labelsController.js.map +1 -1
- package/dist/controller/messageController.js +2 -2
- package/dist/controller/messageController.js.map +1 -1
- package/dist/controller/sessionController.js +19 -9
- package/dist/controller/sessionController.js.map +1 -1
- package/dist/controller/statusController.js +1 -1
- package/dist/controller/statusController.js.map +1 -1
- package/dist/routes/index.js +1 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/swagger.json +256 -2
- package/dist/util/createSessionUtil.js +11 -0
- package/dist/util/createSessionUtil.js.map +1 -1
- package/dist/util/functions.js +10 -13
- package/dist/util/functions.js.map +1 -1
- package/package.json +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,219 +1,131 @@
|
|
|
1
|
-
## 1.8.
|
|
1
|
+
## 1.8.3 (2023-02-03)
|
|
2
2
|
|
|
3
|
+
## 1.8.2 (2023-01-13)
|
|
3
4
|
|
|
5
|
+
### Bug Fixes
|
|
4
6
|
|
|
5
|
-
#
|
|
7
|
+
- Fixed send message to groups (close [#1049](https://github.com/wppconnect-team/wppconnect-server/issues/1049)) ([f8bc6e4](https://github.com/wppconnect-team/wppconnect-server/commit/f8bc6e4ee14b36e266b86bcf9998acf96629019f))
|
|
6
8
|
|
|
9
|
+
## 1.8.1 (2022-12-28)
|
|
7
10
|
|
|
11
|
+
# 1.8.0 (2022-12-15)
|
|
8
12
|
|
|
9
13
|
## 1.7.4 (2022-12-12)
|
|
10
14
|
|
|
11
|
-
|
|
12
15
|
### Bug Fixes
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
- Fixed return undefined on sendListMsg ([eb830ce](https://github.com/wppconnect-team/wppconnect-server/commit/eb830cee97384a0c9a84db8abc0d5f75ea688c86))
|
|
17
18
|
|
|
18
19
|
## 1.7.3 (2022-12-03)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
21
|
## 1.7.2 (2022-11-18)
|
|
23
22
|
|
|
24
|
-
|
|
25
23
|
### Bug Fixes
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
- **deps:** update dependency @wppconnect-team/wppconnect to ^1.19.1 ([#988](https://github.com/wppconnect-team/wppconnect-server/issues/988)) ([1c391e0](https://github.com/wppconnect-team/wppconnect-server/commit/1c391e00e65e70356de26b286e423a649f0ef7af))
|
|
30
26
|
|
|
31
27
|
## 1.7.1 (2022-11-02)
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
|
|
35
29
|
# 1.7.0 (2022-11-02)
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
|
|
39
31
|
## 1.6.4 (2022-10-20)
|
|
40
32
|
|
|
41
|
-
|
|
42
|
-
|
|
43
33
|
## 1.6.3 (2022-10-10)
|
|
44
34
|
|
|
45
|
-
|
|
46
35
|
### Bug Fixes
|
|
47
36
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
- **deps:** update dependency @wppconnect-team/wppconnect to ^1.17.1 ([#931](https://github.com/wppconnect-team/wppconnect-server/issues/931)) ([04326bf](https://github.com/wppconnect-team/wppconnect-server/commit/04326bf1a142d07d8ca63a807211b407023898d1))
|
|
51
38
|
|
|
52
39
|
## 1.6.2 (2022-08-09)
|
|
53
40
|
|
|
54
|
-
|
|
55
41
|
### Bug Fixes
|
|
56
42
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
- **deps:** update dependency @wppconnect-team/wppconnect to ^1.16.1 ([#866](https://github.com/wppconnect-team/wppconnect-server/issues/866)) ([a824339](https://github.com/wppconnect-team/wppconnect-server/commit/a8243392f8daadef5dec2205263d5a44840ae4ef))
|
|
60
44
|
|
|
61
45
|
## 1.6.1 (2022-08-05)
|
|
62
46
|
|
|
63
|
-
|
|
64
47
|
### Bug Fixes
|
|
65
48
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
49
|
+
- **deps:** update dependency @wppconnect-team/wppconnect to ^1.16.0 ([#860](https://github.com/wppconnect-team/wppconnect-server/issues/860)) ([5f72973](https://github.com/wppconnect-team/wppconnect-server/commit/5f72973788d2844d2297acd73b96e76001b70c37))
|
|
69
50
|
|
|
70
51
|
# 1.6.0 (2022-07-20)
|
|
71
52
|
|
|
72
|
-
|
|
73
|
-
|
|
74
53
|
# 1.5.0 (2022-07-12)
|
|
75
54
|
|
|
76
|
-
|
|
77
55
|
### Features
|
|
78
56
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
57
|
+
- Delete all chats close [#483](https://github.com/wppconnect-team/wppconnect-server/issues/483) ([f47a253](https://github.com/wppconnect-team/wppconnect-server/commit/f47a253b1024778f9c3ed5d14a638689be464936))
|
|
82
58
|
|
|
83
59
|
# 1.4.0 (2022-06-29)
|
|
84
60
|
|
|
85
|
-
|
|
86
|
-
|
|
87
61
|
## 1.3.4 (2022-06-20)
|
|
88
62
|
|
|
89
|
-
|
|
90
|
-
|
|
91
63
|
## 1.3.3 (2022-06-01)
|
|
92
64
|
|
|
93
|
-
|
|
94
|
-
|
|
95
65
|
## 1.3.2 (2022-05-31)
|
|
96
66
|
|
|
97
|
-
|
|
98
|
-
|
|
99
67
|
## 1.3.1 (2022-05-10)
|
|
100
68
|
|
|
101
|
-
|
|
102
|
-
|
|
103
69
|
# 1.3.0 (2022-05-10)
|
|
104
70
|
|
|
105
|
-
|
|
106
71
|
### Features
|
|
107
72
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
73
|
+
- Updated all packages ([5e7b9f2](https://github.com/wppconnect-team/wppconnect-server/commit/5e7b9f2240ccc0e44a129296e92dd6fb5393380e))
|
|
111
74
|
|
|
112
75
|
# 1.2.0 (2022-04-25)
|
|
113
76
|
|
|
114
|
-
|
|
115
|
-
|
|
116
77
|
## 1.1.23 (2022-03-13)
|
|
117
78
|
|
|
118
|
-
|
|
119
|
-
|
|
120
79
|
## 1.1.22 (2022-03-07)
|
|
121
80
|
|
|
122
|
-
|
|
123
|
-
|
|
124
81
|
## 1.1.21 (2022-02-24)
|
|
125
82
|
|
|
126
|
-
|
|
127
|
-
|
|
128
83
|
## 1.1.20 (2022-01-23)
|
|
129
84
|
|
|
130
|
-
|
|
131
|
-
|
|
132
85
|
## 1.1.19 (2022-01-21)
|
|
133
86
|
|
|
134
|
-
|
|
135
|
-
|
|
136
87
|
## 1.1.18 (2022-01-17)
|
|
137
88
|
|
|
138
|
-
|
|
139
|
-
|
|
140
89
|
## 1.1.17 (2022-01-16)
|
|
141
90
|
|
|
142
|
-
|
|
143
|
-
|
|
144
91
|
## 1.1.16 (2022-01-14)
|
|
145
92
|
|
|
146
|
-
|
|
147
|
-
|
|
148
93
|
## 1.1.15 (2022-01-09)
|
|
149
94
|
|
|
150
|
-
|
|
151
|
-
|
|
152
95
|
## 1.1.14 (2021-12-21)
|
|
153
96
|
|
|
154
|
-
|
|
155
|
-
|
|
156
97
|
## 1.1.13 (2021-12-09)
|
|
157
98
|
|
|
158
|
-
|
|
159
|
-
|
|
160
99
|
## 1.1.12 (2021-12-09)
|
|
161
100
|
|
|
162
|
-
|
|
163
|
-
|
|
164
101
|
## 1.1.11 (2021-11-16)
|
|
165
102
|
|
|
166
|
-
|
|
167
|
-
|
|
168
103
|
## 1.1.10 (2021-11-12)
|
|
169
104
|
|
|
170
|
-
|
|
171
|
-
|
|
172
105
|
## 1.1.9 (2021-11-08)
|
|
173
106
|
|
|
174
|
-
|
|
175
|
-
|
|
176
107
|
## 1.1.8 (2021-11-08)
|
|
177
108
|
|
|
178
|
-
|
|
179
|
-
|
|
180
109
|
## 1.1.7 (2021-10-21)
|
|
181
110
|
|
|
182
|
-
|
|
183
|
-
|
|
184
111
|
## 1.1.6 (2021-10-13)
|
|
185
112
|
|
|
186
|
-
|
|
187
113
|
### Bug Fixes
|
|
188
114
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
115
|
+
- block/unblock contato. ([9401b16](https://github.com/wppconnect-team/wppconnect-server/commit/9401b168ce08eb62c5ea392db82df34b69753775))
|
|
192
116
|
|
|
193
117
|
## 1.1.5 (2021-10-01)
|
|
194
118
|
|
|
195
|
-
|
|
196
|
-
|
|
197
119
|
## 1.1.4 (2021-09-22)
|
|
198
120
|
|
|
199
|
-
|
|
200
|
-
|
|
201
121
|
## 1.1.3 (2021-08-13)
|
|
202
122
|
|
|
203
|
-
|
|
204
|
-
|
|
205
123
|
## 1.1.2 (2021-08-11)
|
|
206
124
|
|
|
207
|
-
|
|
208
|
-
|
|
209
125
|
## 1.1.1 (2021-08-06)
|
|
210
126
|
|
|
211
|
-
|
|
212
|
-
|
|
213
127
|
# 1.1.0 (2021-08-04)
|
|
214
128
|
|
|
215
|
-
|
|
216
|
-
|
|
217
129
|
## 1.0.3 (2021-07-15)
|
|
218
130
|
|
|
219
131
|
## 1.0.2 (2021-07-14)
|
package/Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
FROM node:
|
|
1
|
+
FROM node:lts-alpine3.16 as base
|
|
2
2
|
WORKDIR /usr/src/wpp-server
|
|
3
3
|
ENV NODE_ENV=production PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
|
4
4
|
COPY package.json yarn.lock ./
|
|
@@ -22,4 +22,4 @@ RUN yarn cache clean
|
|
|
22
22
|
COPY . .
|
|
23
23
|
COPY --from=build /usr/src/wpp-server/ /usr/src/wpp-server/
|
|
24
24
|
EXPOSE 21465
|
|
25
|
-
ENTRYPOINT ["node", "dist/server.js"]
|
|
25
|
+
ENTRYPOINT ["node", "dist/server.js"]
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/@wppconnect/server)
|
|
8
8
|
[](https://isitmaintained.com/project/wppconnect-team/wppconnect-server 'Average time to resolve an issue')
|
|
9
9
|
[](https://isitmaintained.com/badge/open/wppconnect-team/wppconnect-server.svg 'Percentage of issues still open')
|
|
10
|
-
[](https://github.com/wppconnect-team/wppconnect-serer/actions)
|
|
11
11
|
[](https://github.com/wppconnect-team/wppconnect-server/actions/workflows/build.yml)
|
|
12
12
|
[](https://github.com/release-it/release-it)
|
|
13
13
|
|
|
@@ -23,7 +23,7 @@ Wppconnect Server is a ready-to-use API, just download, install, and start using
|
|
|
23
23
|
|
|
24
24
|
[](https://discord.gg/JU5JGGKGNG)
|
|
25
25
|
[](https://t.me/wppconnect)
|
|
26
|
-
[](https://chat.whatsapp.com/
|
|
26
|
+
[](https://chat.whatsapp.com/LJaQu6ZyNvnBPNAVRbX00K)
|
|
27
27
|
[](https://www.youtube.com/c/wppconnect)
|
|
28
28
|
|
|
29
29
|
## Documentations
|
package/dist/config.json
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.addProductImage = addProductImage;exports.changeProductImage = changeProductImage;exports.createCollection = createCollection;exports.delProducts = delProducts;exports.deleteCollection = deleteCollection;exports.editCollection = editCollection;exports.editProduct = editProduct;exports.getCollections = getCollections;exports.getProductById = getProductById;exports.getProducts = getProducts;exports.removeProductImage = removeProductImage;exports.setProductVisibility = setProductVisibility;exports.updateCartEnabled = updateCartEnabled;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", { value: true });exports.addProductImage = addProductImage;exports.changeProductImage = changeProductImage;exports.createCollection = createCollection;exports.delProducts = delProducts;exports.deleteCollection = deleteCollection;exports.editCollection = editCollection;exports.editProduct = editProduct;exports.getCollections = getCollections;exports.getProductById = getProductById;exports.getProducts = getProducts;exports.removeProductImage = removeProductImage;exports.sendLinkCatalog = sendLinkCatalog;exports.setProductVisibility = setProductVisibility;exports.updateCartEnabled = updateCartEnabled;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _functions = require("../util/functions"); /*
|
|
2
17
|
* Copyright 2021 WPPConnect Team
|
|
3
18
|
*
|
|
4
19
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -12,20 +27,7 @@
|
|
|
12
27
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
28
|
* See the License for the specific language governing permissions and
|
|
14
29
|
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
async function getProducts(req, res) {
|
|
17
|
-
const { phone, qnt } = req.query;
|
|
18
|
-
if (!phone)
|
|
19
|
-
return res.status(401).send({
|
|
20
|
-
message: 'Please send the contact number you wish to return the products.'
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const result = await req.client.getProducts(phone, qnt);
|
|
25
|
-
res.status(201).json({ status: 'success', response: result });
|
|
26
|
-
} catch (error) {
|
|
27
|
-
res.status(500).json({ status: 'Error', message: 'Error on get products' });
|
|
28
|
-
}
|
|
30
|
+
*/async function getProducts(req, res) {const { phone, qnt } = req.query;if (!phone) return res.status(401).send({ message: 'Please send the contact number you wish to return the products.' });try {const result = await req.client.getProducts(phone, qnt);res.status(201).json({ status: 'success', response: result });} catch (error) {res.status(500).json({ status: 'Error', message: 'Error on get products', error: error });}
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
async function getProductById(req, res) {
|
|
@@ -39,9 +41,10 @@ async function getProductById(req, res) {
|
|
|
39
41
|
const result = await req.client.getProductById(phone, id);
|
|
40
42
|
res.status(201).json({ status: 'success', response: result });
|
|
41
43
|
} catch (error) {
|
|
42
|
-
res.status(500).json({ status: 'Error', message: 'Error on get product' });
|
|
44
|
+
res.status(500).json({ status: 'Error', message: 'Error on get product', error: error });
|
|
43
45
|
}
|
|
44
46
|
}
|
|
47
|
+
|
|
45
48
|
async function editProduct(req, res) {
|
|
46
49
|
const { id, options } = req.body;
|
|
47
50
|
if (!id || !options)
|
|
@@ -53,7 +56,7 @@ async function editProduct(req, res) {
|
|
|
53
56
|
const result = await req.client.editProduct(id, options);
|
|
54
57
|
res.status(201).json({ status: 'success', response: result });
|
|
55
58
|
} catch (error) {
|
|
56
|
-
res.status(500).json({ status: 'Error', message: 'Error on edit product.' });
|
|
59
|
+
res.status(500).json({ status: 'Error', message: 'Error on edit product.', error: error });
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -68,7 +71,7 @@ async function delProducts(req, res) {
|
|
|
68
71
|
const result = await req.client.delProducts(id);
|
|
69
72
|
res.status(201).json({ status: 'success', response: result });
|
|
70
73
|
} catch (error) {
|
|
71
|
-
res.status(500).json({ status: 'Error', message: 'Error on delete product.' });
|
|
74
|
+
res.status(500).json({ status: 'Error', message: 'Error on delete product.', error: error });
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
|
|
@@ -83,7 +86,7 @@ async function changeProductImage(req, res) {
|
|
|
83
86
|
const result = await req.client.changeProductImage(id, base64);
|
|
84
87
|
res.status(201).json({ status: 'success', response: result });
|
|
85
88
|
} catch (error) {
|
|
86
|
-
res.status(500).json({ status: 'Error', message: 'Error on change product image.' });
|
|
89
|
+
res.status(500).json({ status: 'Error', message: 'Error on change product image.', error: error });
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
|
|
@@ -98,7 +101,7 @@ async function addProductImage(req, res) {
|
|
|
98
101
|
const result = await req.client.addProductImage(id, base64);
|
|
99
102
|
res.status(201).json({ status: 'success', response: result });
|
|
100
103
|
} catch (error) {
|
|
101
|
-
res.status(500).json({ status: 'Error', message: 'Error on add product image.' });
|
|
104
|
+
res.status(500).json({ status: 'Error', message: 'Error on add product image.', error: error });
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
|
|
@@ -113,7 +116,7 @@ async function removeProductImage(req, res) {
|
|
|
113
116
|
const result = await req.client.addProductImage(id, index);
|
|
114
117
|
res.status(201).json({ status: 'success', response: result });
|
|
115
118
|
} catch (error) {
|
|
116
|
-
res.status(500).json({ status: 'Error', message: 'Error on remove product image.' });
|
|
119
|
+
res.status(500).json({ status: 'Error', message: 'Error on remove product image.', error: error });
|
|
117
120
|
}
|
|
118
121
|
}
|
|
119
122
|
|
|
@@ -128,7 +131,7 @@ async function getCollections(req, res) {
|
|
|
128
131
|
const result = await req.client.getCollections(phone, qnt, max);
|
|
129
132
|
res.status(201).json({ status: 'success', response: result });
|
|
130
133
|
} catch (error) {
|
|
131
|
-
res.status(500).json({ status: 'Error', message: 'Error on get collections.' });
|
|
134
|
+
res.status(500).json({ status: 'Error', message: 'Error on get collections.', error: error });
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
137
|
|
|
@@ -143,7 +146,7 @@ async function createCollection(req, res) {
|
|
|
143
146
|
const result = await req.client.createCollection(name, products);
|
|
144
147
|
res.status(201).json({ status: 'success', response: result });
|
|
145
148
|
} catch (error) {
|
|
146
|
-
res.status(500).json({ status: 'Error', message: 'Error on create collection.' });
|
|
149
|
+
res.status(500).json({ status: 'Error', message: 'Error on create collection.', error: error });
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
|
|
@@ -158,7 +161,7 @@ async function editCollection(req, res) {
|
|
|
158
161
|
const result = await req.client.createCollection(id, options);
|
|
159
162
|
res.status(201).json({ status: 'success', response: result });
|
|
160
163
|
} catch (error) {
|
|
161
|
-
res.status(500).json({ status: 'Error', message: 'Error on edit collection.' });
|
|
164
|
+
res.status(500).json({ status: 'Error', message: 'Error on edit collection.', error: error });
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
|
|
@@ -173,7 +176,7 @@ async function deleteCollection(req, res) {
|
|
|
173
176
|
const result = await req.client.deleteCollection(id);
|
|
174
177
|
res.status(201).json({ status: 'success', response: result });
|
|
175
178
|
} catch (error) {
|
|
176
|
-
res.status(500).json({ status: 'Error', message: 'Error on delete collection.' });
|
|
179
|
+
res.status(500).json({ status: 'Error', message: 'Error on delete collection.', error: error });
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
|
|
@@ -188,7 +191,7 @@ async function setProductVisibility(req, res) {
|
|
|
188
191
|
const result = await req.client.setProductVisibility(id, value);
|
|
189
192
|
res.status(201).json({ status: 'success', response: result });
|
|
190
193
|
} catch (error) {
|
|
191
|
-
res.status(500).json({ status: 'Error', message: 'Error on set product visibility.' });
|
|
194
|
+
res.status(500).json({ status: 'Error', message: 'Error on set product visibility.', error: error });
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
197
|
|
|
@@ -200,10 +203,38 @@ async function updateCartEnabled(req, res) {
|
|
|
200
203
|
});
|
|
201
204
|
|
|
202
205
|
try {
|
|
203
|
-
const result = await req.client.
|
|
206
|
+
const result = await req.client.updateCartEnabled(enabled);
|
|
204
207
|
res.status(201).json({ status: 'success', response: result });
|
|
205
208
|
} catch (error) {
|
|
206
|
-
res.status(500).json({ status: 'Error', message: 'Error on set enabled cart.' });
|
|
209
|
+
res.status(500).json({ status: 'Error', message: 'Error on set enabled cart.', error: error });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async function sendLinkCatalog(req, res) {
|
|
214
|
+
const { phones, message } = req.body;
|
|
215
|
+
if (!phones)
|
|
216
|
+
return res.status(401).send({
|
|
217
|
+
message: 'phones was not informed'
|
|
218
|
+
});
|
|
219
|
+
const results = [];
|
|
220
|
+
try {
|
|
221
|
+
const session = await req.client.getWid();
|
|
222
|
+
const catalogLink = (0, _functions.createCatalogLink)(session);
|
|
223
|
+
for (const phone of phones) {
|
|
224
|
+
const result = await req.client.sendText(phone, `${message} ${catalogLink}`, {
|
|
225
|
+
useTemplateButtons: true,
|
|
226
|
+
buttons: [
|
|
227
|
+
{
|
|
228
|
+
url: catalogLink,
|
|
229
|
+
text: 'Abrir catálogo'
|
|
230
|
+
}]
|
|
231
|
+
|
|
232
|
+
});
|
|
233
|
+
results.push({ phone, status: result.id });
|
|
234
|
+
}
|
|
235
|
+
return res.status(200).json({ status: 'success', response: results });
|
|
236
|
+
} catch (error) {
|
|
237
|
+
res.status(500).json({ status: 'Error', message: 'Error on set enabled cart.', error: error });
|
|
207
238
|
}
|
|
208
239
|
}
|
|
209
240
|
//# sourceMappingURL=catalogController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogController.js","names":["getProducts","req","res","phone","qnt","query","status","send","message","result","client","json","response","error","getProductById","id","editProduct","options","body","delProducts","changeProductImage","base64","addProductImage","removeProductImage","index","getCollections","max","createCollection","name","products","editCollection","deleteCollection","setProductVisibility","value","updateCartEnabled","enabled"],"sources":["../../src/controller/catalogController.js"],"sourcesContent":["/*\n * Copyright 2021 WPPConnect Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport async function getProducts(req, res) {\n const { phone, qnt } = req.query;\n if (!phone)\n return res.status(401).send({\n message: 'Please send the contact number you wish to return the products.',\n });\n\n try {\n const result = await req.client.getProducts(phone, qnt);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on get products' });\n }\n}\n\nexport async function getProductById(req, res) {\n const { phone, id } = req.query;\n if (!phone || !id)\n return res.status(401).send({\n message: 'Please send the contact number and productId.',\n });\n\n try {\n const result = await req.client.getProductById(phone, id);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on get product' });\n }\n}\nexport async function editProduct(req, res) {\n const { id, options } = req.body;\n if (!id || !options)\n return res.status(401).send({\n message: 'productId or options was not informed',\n });\n\n try {\n const result = await req.client.editProduct(id, options);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on edit product.' });\n }\n}\n\nexport async function delProducts(req, res) {\n const { id } = req.body;\n if (!id)\n return res.status(401).send({\n message: 'products Id was not informed',\n });\n\n try {\n const result = await req.client.delProducts(id);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on delete product.' });\n }\n}\n\nexport async function changeProductImage(req, res) {\n const { id, base64 } = req.body;\n if (!id || !base64)\n return res.status(401).send({\n message: 'productId and base64 was not informed',\n });\n\n try {\n const result = await req.client.changeProductImage(id, base64);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on change product image.' });\n }\n}\n\nexport async function addProductImage(req, res) {\n const { id, base64 } = req.body;\n if (!id || !base64)\n return res.status(401).send({\n message: 'productId and base64 was not informed',\n });\n\n try {\n const result = await req.client.addProductImage(id, base64);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on add product image.' });\n }\n}\n\nexport async function removeProductImage(req, res) {\n const { id, index } = req.body;\n if (!id || !index)\n return res.status(401).send({\n message: 'productId and index image was not informed',\n });\n\n try {\n const result = await req.client.addProductImage(id, index);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on remove product image.' });\n }\n}\n\nexport async function getCollections(req, res) {\n const { phone, qnt, max } = req.query;\n if (!phone)\n return res.status(401).send({\n message: 'phone was not informed',\n });\n\n try {\n const result = await req.client.getCollections(phone, qnt, max);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on get collections.' });\n }\n}\n\nexport async function createCollection(req, res) {\n const { name, products } = req.body;\n if (!name || !products)\n return res.status(401).send({\n message: 'name or products was not informed',\n });\n\n try {\n const result = await req.client.createCollection(name, products);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on create collection.' });\n }\n}\n\nexport async function editCollection(req, res) {\n const { id, options } = req.body;\n if (!id || !options)\n return res.status(401).send({\n message: 'id or options was not informed',\n });\n\n try {\n const result = await req.client.createCollection(id, options);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on edit collection.' });\n }\n}\n\nexport async function deleteCollection(req, res) {\n const { id } = req.body;\n if (!id)\n return res.status(401).send({\n message: 'id was not informed',\n });\n\n try {\n const result = await req.client.deleteCollection(id);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on delete collection.' });\n }\n}\n\nexport async function setProductVisibility(req, res) {\n const { id, value } = req.body;\n if (!id || !value)\n return res.status(401).send({\n message: 'product id or value (false, true) was not informed',\n });\n\n try {\n const result = await req.client.setProductVisibility(id, value);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on set product visibility.' });\n }\n}\n\nexport async function updateCartEnabled(req, res) {\n const { enabled } = req.body;\n if (!enabled)\n return res.status(401).send({\n message: 'enabled (false, true) was not informed',\n });\n\n try {\n const result = await req.client.setProductVisibility(enabled);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on set enabled cart.' });\n }\n}\n"],"mappings":"8mBAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeA,WAAW,CAACC,GAAG,EAAEC,GAAG,EAAE;EAC1C,MAAM,EAAEC,KAAK,EA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,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACK,IAAI,CAAC,EAAEL,MAAM,EAAE,SAAS,EAAEM,QAAQ,EAAEH,MAAM,CAAC,CAAC,CAAC;EAC/D,CAAC,CAAC,OAAOI,KAAK,EAAE;IACdX,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACK,IAAI,CAAC,EAAEL,MAAM,EAAE,OAAO,EAAEE,OAAO,EAAE,4BAA4B,CAAC,CAAC,CAAC;EAClF;AACF"}
|
|
1
|
+
{"version":3,"file":"catalogController.js","names":["getProducts","req","res","phone","qnt","query","status","send","message","result","client","json","response","error","getProductById","id","editProduct","options","body","delProducts","changeProductImage","base64","addProductImage","removeProductImage","index","getCollections","max","createCollection","name","products","editCollection","deleteCollection","setProductVisibility","value","updateCartEnabled","enabled","sendLinkCatalog","phones","results","session","getWid","catalogLink","createCatalogLink","sendText","useTemplateButtons","buttons","url","text","push"],"sources":["../../src/controller/catalogController.js"],"sourcesContent":["/*\n * Copyright 2021 WPPConnect Team\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createCatalogLink, groupNameToArray } from '../util/functions';\n\nexport async function getProducts(req, res) {\n const { phone, qnt } = req.query;\n if (!phone)\n return res.status(401).send({\n message: 'Please send the contact number you wish to return the products.',\n });\n\n try {\n const result = await req.client.getProducts(phone, qnt);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on get products', error: error });\n }\n}\n\nexport async function getProductById(req, res) {\n const { phone, id } = req.query;\n if (!phone || !id)\n return res.status(401).send({\n message: 'Please send the contact number and productId.',\n });\n\n try {\n const result = await req.client.getProductById(phone, id);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on get product', error: error });\n }\n}\n\nexport async function editProduct(req, res) {\n const { id, options } = req.body;\n if (!id || !options)\n return res.status(401).send({\n message: 'productId or options was not informed',\n });\n\n try {\n const result = await req.client.editProduct(id, options);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on edit product.', error: error });\n }\n}\n\nexport async function delProducts(req, res) {\n const { id } = req.body;\n if (!id)\n return res.status(401).send({\n message: 'products Id was not informed',\n });\n\n try {\n const result = await req.client.delProducts(id);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on delete product.', error: error });\n }\n}\n\nexport async function changeProductImage(req, res) {\n const { id, base64 } = req.body;\n if (!id || !base64)\n return res.status(401).send({\n message: 'productId and base64 was not informed',\n });\n\n try {\n const result = await req.client.changeProductImage(id, base64);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on change product image.', error: error });\n }\n}\n\nexport async function addProductImage(req, res) {\n const { id, base64 } = req.body;\n if (!id || !base64)\n return res.status(401).send({\n message: 'productId and base64 was not informed',\n });\n\n try {\n const result = await req.client.addProductImage(id, base64);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on add product image.', error: error });\n }\n}\n\nexport async function removeProductImage(req, res) {\n const { id, index } = req.body;\n if (!id || !index)\n return res.status(401).send({\n message: 'productId and index image was not informed',\n });\n\n try {\n const result = await req.client.addProductImage(id, index);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on remove product image.', error: error });\n }\n}\n\nexport async function getCollections(req, res) {\n const { phone, qnt, max } = req.query;\n if (!phone)\n return res.status(401).send({\n message: 'phone was not informed',\n });\n\n try {\n const result = await req.client.getCollections(phone, qnt, max);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on get collections.', error: error });\n }\n}\n\nexport async function createCollection(req, res) {\n const { name, products } = req.body;\n if (!name || !products)\n return res.status(401).send({\n message: 'name or products was not informed',\n });\n\n try {\n const result = await req.client.createCollection(name, products);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on create collection.', error: error });\n }\n}\n\nexport async function editCollection(req, res) {\n const { id, options } = req.body;\n if (!id || !options)\n return res.status(401).send({\n message: 'id or options was not informed',\n });\n\n try {\n const result = await req.client.createCollection(id, options);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on edit collection.', error: error });\n }\n}\n\nexport async function deleteCollection(req, res) {\n const { id } = req.body;\n if (!id)\n return res.status(401).send({\n message: 'id was not informed',\n });\n\n try {\n const result = await req.client.deleteCollection(id);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on delete collection.', error: error });\n }\n}\n\nexport async function setProductVisibility(req, res) {\n const { id, value } = req.body;\n if (!id || !value)\n return res.status(401).send({\n message: 'product id or value (false, true) was not informed',\n });\n\n try {\n const result = await req.client.setProductVisibility(id, value);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on set product visibility.', error: error });\n }\n}\n\nexport async function updateCartEnabled(req, res) {\n const { enabled } = req.body;\n if (!enabled)\n return res.status(401).send({\n message: 'enabled (false, true) was not informed',\n });\n\n try {\n const result = await req.client.updateCartEnabled(enabled);\n res.status(201).json({ status: 'success', response: result });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on set enabled cart.', error: error });\n }\n}\n\nexport async function sendLinkCatalog(req, res) {\n const { phones, message } = req.body;\n if (!phones)\n return res.status(401).send({\n message: 'phones was not informed',\n });\n const results = [];\n try {\n const session = await req.client.getWid();\n const catalogLink = createCatalogLink(session);\n for (const phone of phones) {\n const result = await req.client.sendText(phone, `${message} ${catalogLink}`, {\n useTemplateButtons: true,\n buttons: [\n {\n url: catalogLink,\n text: 'Abrir catálogo',\n },\n ],\n });\n results.push({ phone, status: result.id });\n }\n return res.status(200).json({ status: 'success', response: results });\n } catch (error) {\n res.status(500).json({ status: 'Error', message: 'Error on set enabled cart.', error: error });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,8CAAwE,CAfxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAGO,eAAeA,WAAW,CAACC,GAAG,EAAEC,GAAG,EAAE,CAC1C,MAAM,EAAEC,KAAK,EAAEC,GAAG,CAAC,CAAC,GAAGH,GAAG,CAACI,KAAK,CAChC,IAAI,CAACF,KAAK,EACR,OAAOD,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,EAC1BC,OAAO,EAAE,iEAAiE,CAC5E,CAAC,CAAC,CAEJ,IAAI,CACF,MAAMC,MAAM,GAAG,MAAMR,GAAG,CAACS,MAAM,CAACV,WAAW,CAACG,KAAK,EAAEC,GAAG,CAAC,CACvDF,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACK,IAAI,CAAC,EAAEL,MAAM,EAAE,SAAS,EAAEM,QAAQ,EAAEH,MAAM,CAAC,CAAC,CAAC,CAC/D,CAAC,CAAC,OAAOI,KAAK,EAAE,CACdX,GAAG,CAACI,MAAM,CAAC,GAAG,CAAC,CAACK,IAAI,CAAC,EAAEL,MAAM,EAAE,OAAO,EAAEE,OAAO,EAAE,uBAAuB,EAAEK,KAAK,EAAEA,KAAK,CAAC,CAAC,CAAC,CAC3F;AACF;;AAEO,eAAeC,cAAc,CAACb,GAAG,EAAEC,GAAG,EAAE;EAC7C,MAAM,EAAEC,KAAK,EAAEY,EAAE,CAAC,CAAC,GAAGd,GAAG,CAACI,KAAK;EAC/B,IAAI,CAACF,K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