@wppconnect/wa-js 3.6.0 → 3.7.0
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 +1926 -1
- package/dist/cart/functions/add.d.ts +20 -0
- package/dist/cart/functions/clear.d.ts +16 -0
- package/dist/cart/functions/get.d.ts +27 -0
- package/dist/cart/functions/getThumbFromCart.d.ts +16 -0
- package/dist/cart/functions/index.d.ts +22 -0
- package/dist/cart/functions/remove.d.ts +17 -0
- package/dist/cart/functions/submit.d.ts +33 -0
- package/dist/cart/functions/update.d.ts +19 -0
- package/dist/cart/index.d.ts +16 -0
- package/dist/catalog/functions/getProductById.d.ts +24 -2
- package/dist/chat/functions/index.d.ts +1 -1
- package/dist/chat/functions/{sendOrderMessage.d.ts → sendChargeMessage.d.ts} +7 -7
- package/dist/index.d.ts +1 -0
- package/dist/whatsapp/functions/addProductToCart.d.ts +23 -0
- package/dist/whatsapp/functions/createOrder.d.ts +24 -0
- package/dist/whatsapp/functions/index.d.ts +3 -0
- package/dist/whatsapp/functions/updateCart.d.ts +20 -0
- package/dist/whatsapp/misc/MsgKey.d.ts +1 -1
- package/dist/whatsapp/models/CartItemModel.d.ts +1 -0
- package/dist/wppconnect-wa.js +1 -1
- package/dist/wppconnect-wa.js.LICENSE.txt +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CartModel } from '../../whatsapp';
|
|
17
|
+
export declare function add(chatId: string, products: {
|
|
18
|
+
id: string;
|
|
19
|
+
qnt: number;
|
|
20
|
+
}[]): Promise<CartModel | undefined>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare function clear(wid: string): Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Get products in cart chat
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* const cart = WPP.cart.get('[number]@c.us');
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @category Cart
|
|
25
|
+
*/
|
|
26
|
+
import { CartModel } from '../../whatsapp';
|
|
27
|
+
export declare function get(wid: string): CartModel | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getThumbFromCart(wid: string): Promise<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { add } from './add';
|
|
17
|
+
export { clear } from './clear';
|
|
18
|
+
export { get } from './get';
|
|
19
|
+
export { getThumbFromCart } from './getThumbFromCart';
|
|
20
|
+
export { remove } from './remove';
|
|
21
|
+
export { submit } from './submit';
|
|
22
|
+
export { update } from './update';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CartModel } from '../../whatsapp';
|
|
17
|
+
export declare function remove(chatId: string, productId: string): Promise<CartModel | undefined>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Send a request order to business chat
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* const cart = WPP.cart.submit('[number]@c.us');
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```javascript
|
|
26
|
+
* // Send cart with a custom message
|
|
27
|
+
* const cart = WPP.cart.submit('[number]@c.us', 'Custom message here');
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @category Cart
|
|
31
|
+
*/
|
|
32
|
+
import { SendMessageOptions } from '../../chat';
|
|
33
|
+
export declare function submit(wid: string, msg?: string, options?: SendMessageOptions): Promise<any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CartModel } from '../../whatsapp';
|
|
17
|
+
export declare function update(chatId: string, productId: string, options: {
|
|
18
|
+
quantity: number;
|
|
19
|
+
}): Promise<CartModel | undefined>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export * from './functions';
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ProductModel } from '../../whatsapp';
|
|
17
16
|
/**
|
|
18
17
|
* Retrieves product by id
|
|
19
18
|
*
|
|
@@ -25,4 +24,27 @@ import { ProductModel } from '../../whatsapp';
|
|
|
25
24
|
*
|
|
26
25
|
* @category Catalog
|
|
27
26
|
*/
|
|
28
|
-
export declare function getProductById(chatId: string, productId: number): Promise<
|
|
27
|
+
export declare function getProductById(chatId: string, productId: number): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
retailer_id: string;
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
url: string;
|
|
33
|
+
currency: string;
|
|
34
|
+
price: string;
|
|
35
|
+
is_hidden: boolean;
|
|
36
|
+
max_available: number;
|
|
37
|
+
availability: string;
|
|
38
|
+
checkmark: boolean;
|
|
39
|
+
image_hashes_for_whatsapp: string[];
|
|
40
|
+
image_cdn_urls: {
|
|
41
|
+
key: 'requested' | 'full';
|
|
42
|
+
value: string;
|
|
43
|
+
}[];
|
|
44
|
+
additional_image_cdn_urls: any[];
|
|
45
|
+
whatsapp_product_can_appeal: boolean;
|
|
46
|
+
capability_to_review_status: {
|
|
47
|
+
key: 'WHATSAPP';
|
|
48
|
+
value: 'APPROVED';
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
@@ -55,12 +55,12 @@ export { LinkPreviewOptions, prepareLinkPreview } from './prepareLinkPreview';
|
|
|
55
55
|
export { MessageButtonsOptions, prepareMessageButtons, } from './prepareMessageButtons';
|
|
56
56
|
export { prepareRawMessage } from './prepareRawMessage';
|
|
57
57
|
export { requestPhoneNumber } from './requestPhoneNumber';
|
|
58
|
+
export { OrderItems, OrderMessageOptions, sendChargeMessage, } from './sendChargeMessage';
|
|
58
59
|
export { PoolMessageOptions, sendCreatePollMessage, } from './sendCreatePollMessage';
|
|
59
60
|
export { AudioMessageOptions, AutoDetectMessageOptions, DocumentMessageOptions, FileMessageOptions, ImageMessageOptions, sendFileMessage, StickerMessageOptions, VideoMessageOptions, } from './sendFileMessage';
|
|
60
61
|
export { GroupInviteMessage, sendGroupInviteMessage, } from './sendGroupInviteMessage';
|
|
61
62
|
export { ListMessageOptions, sendListMessage } from './sendListMessage';
|
|
62
63
|
export { LocationMessageOptions, sendLocationMessage, } from './sendLocationMessage';
|
|
63
|
-
export { OrderItems, OrderMessageOptions, sendOrderMessage, } from './sendOrderMessage';
|
|
64
64
|
export { sendPixKeyMessage } from './sendPixKeyMessage';
|
|
65
65
|
export { sendRawMessage } from './sendRawMessage';
|
|
66
66
|
export { sendReactionToMessage } from './sendReactionToMessage';
|
|
@@ -34,19 +34,19 @@ export interface OrderMessageOptions extends SendMessageOptions {
|
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
* ```javascript
|
|
37
|
-
* // Send
|
|
38
|
-
* WPP.chat.
|
|
37
|
+
* // Send charge with a product
|
|
38
|
+
* WPP.chat.sendChargeMessage('[number]@c.us', [
|
|
39
39
|
* { type: 'product', id: '67689897878', qnt: 2 },
|
|
40
40
|
* { type: 'product', id: '37878774457', qnt: 1 },
|
|
41
41
|
* ]
|
|
42
42
|
*
|
|
43
|
-
* // Send
|
|
44
|
-
* WPP.chat.
|
|
43
|
+
* // Send charge with a custom item
|
|
44
|
+
* WPP.chat.sendChargeMessage('[number]@c.us', [
|
|
45
45
|
* { type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
|
|
46
46
|
* ]
|
|
47
47
|
*
|
|
48
|
-
* // Send
|
|
49
|
-
* WPP.chat.
|
|
48
|
+
* // Send charge with custom options
|
|
49
|
+
* WPP.chat.sendChargeMessage('[number]@c.us', [
|
|
50
50
|
* { type: 'product', id: '37878774457', qnt: 1 },
|
|
51
51
|
* { type: 'custom', name: 'Item de cost test', price: 120000, qnt: 2 },
|
|
52
52
|
* ],
|
|
@@ -54,4 +54,4 @@ export interface OrderMessageOptions extends SendMessageOptions {
|
|
|
54
54
|
* ```
|
|
55
55
|
* @category Message
|
|
56
56
|
*/
|
|
57
|
-
export declare function
|
|
57
|
+
export declare function sendChargeMessage(chatId: any, items: OrderItems[], options?: OrderMessageOptions): Promise<SendMessageReturn>;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export { isInjected, isReady, isFullReady } from './webpack';
|
|
|
22
22
|
export { config, Config } from './config';
|
|
23
23
|
export * as blocklist from './blocklist';
|
|
24
24
|
export * as call from './call';
|
|
25
|
+
export * as cart from './cart';
|
|
25
26
|
export * as catalog from './catalog';
|
|
26
27
|
export * as chat from './chat';
|
|
27
28
|
export * as conn from './conn';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { ProductModel } from '../models';
|
|
17
|
+
export declare function addProductToCart(product: ProductModel): Promise<{
|
|
18
|
+
newCount: number;
|
|
19
|
+
status: 'SUCCESS' | 'QUANTITY_LIMIT_REACHED';
|
|
20
|
+
totalCartCount: number;
|
|
21
|
+
}>;
|
|
22
|
+
export declare function updateProductQuantityCart(product: ProductModel, quantity: number): Promise<any>;
|
|
23
|
+
export declare function deleteProductFromCart(chatId: string, productId: string): Promise<any>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Wid } from '../misc';
|
|
17
|
+
/**
|
|
18
|
+
* @whatsapp 990553
|
|
19
|
+
*/
|
|
20
|
+
export declare function createOrder(wid: Wid, cartItems?: any): Promise<{
|
|
21
|
+
id: number;
|
|
22
|
+
token: any;
|
|
23
|
+
price?: any;
|
|
24
|
+
}>;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export * from './addAndSendMessageEdit';
|
|
17
17
|
export * from './addAndSendMsgToChat';
|
|
18
|
+
export * from './addProductToCart';
|
|
18
19
|
export * from './addToLabelCollection';
|
|
19
20
|
export * from './blockContact';
|
|
20
21
|
export * from './calculateFilehashFromBlob';
|
|
@@ -29,6 +30,7 @@ export * from './createFanoutMsgStanza';
|
|
|
29
30
|
export * from './createGroup';
|
|
30
31
|
export * from './createMsgProtobuf';
|
|
31
32
|
export * from './createNewsletterQuery';
|
|
33
|
+
export * from './createOrder';
|
|
32
34
|
export * from './createOrUpdateReactions';
|
|
33
35
|
export * from './currencyForCountryShortcode';
|
|
34
36
|
export * from './deleteNewsletter';
|
|
@@ -134,6 +136,7 @@ export * from './syncABPropsTask';
|
|
|
134
136
|
export * from './typeAttributeFromProtobuf';
|
|
135
137
|
export * from './unixTime';
|
|
136
138
|
export * from './unmuteNewsletter';
|
|
139
|
+
export * from './updateCart';
|
|
137
140
|
export * from './updateCartEnabled';
|
|
138
141
|
export * from './updateDBForGroupAction';
|
|
139
142
|
export * from './updateNewsletterMsgRecord';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { CartModel } from '../models';
|
|
17
|
+
/**
|
|
18
|
+
* @whatsapp 990553
|
|
19
|
+
*/
|
|
20
|
+
export declare function updateCart(cart: CartModel, c?: number): Promise<void>;
|