talkyzap-wapp-api 1.0.16 → 1.0.18
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 +1 -6
- package/README.md +78 -26
- package/dist/call/events/eventTypes.d.ts +2 -3
- package/dist/call/events/registerIncomingCallEvent.d.ts +1 -1
- package/dist/chat/events/eventTypes.d.ts +14 -0
- package/dist/chat/events/index.d.ts +1 -0
- package/dist/chat/events/registerUnreadCountEvent.d.ts +16 -0
- package/dist/chat/functions/forwardMessage.d.ts +4 -4
- package/dist/chat/functions/forwardMessages.d.ts +33 -0
- package/dist/chat/functions/getMessages.d.ts +7 -0
- package/dist/chat/functions/getUnreadChats.d.ts +23 -0
- package/dist/chat/functions/index.d.ts +3 -1
- package/dist/chat/functions/list.d.ts +4 -0
- package/dist/chat/functions/openChatAt.d.ts +3 -1
- package/dist/chat/functions/openChatBottom.d.ts +3 -1
- package/dist/chat/functions/openChatFromUnread.d.ts +3 -1
- package/dist/chat/functions/pinMsg.d.ts +19 -5
- package/dist/chat/functions/sendFileMessage.d.ts +13 -0
- package/dist/chat/functions/sendTextMessage.d.ts +2 -3
- package/dist/chat/index.d.ts +1 -0
- package/dist/chat/types.d.ts +11 -3
- package/dist/chat/util/index.d.ts +16 -0
- package/dist/chat/util/rehydrateMessage.d.ts +17 -0
- package/dist/conn/functions/changeEnviromentDevice.d.ts +19 -0
- package/dist/conn/functions/getBuildConstants.d.ts +37 -0
- package/dist/conn/functions/getMigrationState.d.ts +52 -0
- package/dist/conn/functions/index.d.ts +3 -0
- package/dist/contact/functions/get.d.ts +2 -0
- package/dist/contact/functions/getPnLidEntry.d.ts +59 -0
- package/dist/contact/functions/index.d.ts +1 -0
- package/dist/contact/functions/save.d.ts +3 -3
- package/dist/gtag/Tracker.d.ts +1 -1
- package/dist/order/functions/accept.d.ts +58 -0
- package/dist/order/functions/decline.d.ts +53 -0
- package/dist/order/functions/index.d.ts +3 -0
- package/dist/order/functions/update.d.ts +77 -0
- package/dist/order/index.d.ts +1 -0
- package/dist/order/types.d.ts +119 -0
- package/dist/util/fileHelpers.d.ts +29 -0
- package/dist/util/index.d.ts +1 -0
- package/dist/util/isUrl.d.ts +21 -0
- package/dist/whatsapp/collections/CallCollection.d.ts +16 -6
- package/dist/whatsapp/enums/ACK.d.ts +5 -3
- package/dist/whatsapp/enums/PinExpiryDurationOption.d.ts +25 -0
- package/dist/whatsapp/enums/index.d.ts +1 -0
- package/dist/whatsapp/functions/addAndSendMessageEdit.d.ts +2 -2
- package/dist/whatsapp/functions/addAndSendMsgToChat.d.ts +2 -2
- package/dist/whatsapp/functions/canSaveAsMyContacts.d.ts +7 -1
- package/dist/whatsapp/functions/createChat.d.ts +2 -0
- package/dist/whatsapp/functions/createGroup.d.ts +12 -2
- package/dist/whatsapp/functions/forwardMessages.d.ts +24 -0
- package/dist/whatsapp/functions/getPhoneLangPref.d.ts +25 -0
- package/dist/whatsapp/functions/getUploadLimit.d.ts +24 -0
- package/dist/whatsapp/functions/index.d.ts +4 -0
- package/dist/whatsapp/functions/msgFindQuery.d.ts +4 -2
- package/dist/whatsapp/functions/queryOrder.d.ts +8 -7
- package/dist/whatsapp/functions/saveContactAction.d.ts +3 -1
- package/dist/whatsapp/functions/sendOrderStatusMessageAsMerchant.d.ts +47 -0
- package/dist/whatsapp/functions/sendPinInChatMsg.d.ts +4 -8
- package/dist/whatsapp/functions/updateMessageTable.d.ts +18 -0
- package/dist/whatsapp/index.d.ts +1 -0
- package/dist/whatsapp/misc/Cmd.d.ts +13 -0
- package/dist/whatsapp/misc/Enviroment.d.ts +22 -0
- package/dist/whatsapp/misc/LidPnCache.d.ts +39 -0
- package/dist/whatsapp/misc/MediaGatingUtils.d.ts +29 -0
- package/dist/whatsapp/misc/MediaPrep.d.ts +3 -2
- package/dist/whatsapp/misc/UserPrefs.d.ts +27 -8
- package/dist/whatsapp/misc/Wid.d.ts +8 -0
- package/dist/whatsapp/misc/WidFactory.d.ts +2 -0
- package/dist/whatsapp/misc/index.d.ts +3 -0
- package/dist/whatsapp/models/ChatModel.d.ts +1 -1
- package/dist/whatsapp/models/MsgModel.d.ts +17 -1
- package/dist/whatsapp/types.d.ts +21 -0
- package/dist/wppconnect-wa.js +1 -1
- package/dist/wppconnect-wa.js.LICENSE.txt +1 -1
- package/eslint.config.mjs +108 -0
- package/package.json +30 -32
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2025 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 '../../whatsapp/misc';
|
|
17
|
+
/**
|
|
18
|
+
* Migration state information for the current WhatsApp account
|
|
19
|
+
*/
|
|
20
|
+
export interface MigrationState {
|
|
21
|
+
/** Whether the account has been migrated to LID (Linked Identity) system */
|
|
22
|
+
isLidMigrated: boolean;
|
|
23
|
+
/** Whether the sync session has been migrated */
|
|
24
|
+
isSyncdSessionMigrated: boolean;
|
|
25
|
+
/** Whether old messaging rules should still be applied */
|
|
26
|
+
shouldApplyNonMigratedMessagingRules: boolean;
|
|
27
|
+
/** Whether the account should have an account LID */
|
|
28
|
+
shouldHaveAccountLid: boolean;
|
|
29
|
+
/** The current user's LID, if available */
|
|
30
|
+
currentLid?: Wid;
|
|
31
|
+
/** The current user's PN, if available */
|
|
32
|
+
currentPn?: Wid;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get comprehensive migration state information for debugging and monitoring
|
|
36
|
+
*
|
|
37
|
+
* This function aggregates various LID (Linked Identity) migration-related
|
|
38
|
+
* information to help understand the current state of the account's migration
|
|
39
|
+
* from the legacy @c.us addressing system to the newer @lid system.
|
|
40
|
+
*
|
|
41
|
+
* @returns Object containing all available migration state information
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const state = WPP.conn.getMigrationState();
|
|
46
|
+
* console.log('Account migrated:', state.isLidMigrated);
|
|
47
|
+
* console.log('Current LID:', state.currentLid);
|
|
48
|
+
* console.log('Should have LID:', state.shouldHaveAccountLid);
|
|
49
|
+
* ```
|
|
50
|
+
* @category Connection
|
|
51
|
+
*/
|
|
52
|
+
export declare function getMigrationState(): MigrationState;
|
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
export { changeEnviromentDevice } from './changeEnviromentDevice';
|
|
16
17
|
export { genLinkDeviceCodeForPhoneNumber } from './genLinkDeviceCodeForPhoneNumber';
|
|
17
18
|
export { getAuthCode } from './getAuthCode';
|
|
19
|
+
export { getBuildConstants } from './getBuildConstants';
|
|
18
20
|
export { getHistorySyncProgress, HistorySyncProgress, } from './getHistorySyncProgress';
|
|
21
|
+
export { getMigrationState, MigrationState } from './getMigrationState';
|
|
19
22
|
export { getMyDeviceId } from './getMyDeviceId';
|
|
20
23
|
export { getMyUserId } from './getMyUserId';
|
|
21
24
|
export { getPlatform } from './getPlatform';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2023 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 { WPPError } from '../../util';
|
|
17
|
+
import { Wid } from '../../whatsapp';
|
|
18
|
+
export interface PnLidWid {
|
|
19
|
+
id: string;
|
|
20
|
+
server: string;
|
|
21
|
+
_serialized: string;
|
|
22
|
+
}
|
|
23
|
+
export interface PnLidContactInfo {
|
|
24
|
+
name?: string;
|
|
25
|
+
shortName?: string;
|
|
26
|
+
pushname?: string;
|
|
27
|
+
type?: 'in' | 'out';
|
|
28
|
+
verifiedName?: string;
|
|
29
|
+
isBusiness?: boolean;
|
|
30
|
+
isEnterprise?: boolean;
|
|
31
|
+
verifiedLevel?: number;
|
|
32
|
+
syncToAddressbook?: boolean;
|
|
33
|
+
isContactSyncCompleted?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface PnLidEntryResult {
|
|
36
|
+
lid?: PnLidWid;
|
|
37
|
+
phoneNumber?: PnLidWid;
|
|
38
|
+
contact?: PnLidContactInfo;
|
|
39
|
+
}
|
|
40
|
+
export declare class InvalidWidForGetPnLidEntry extends WPPError {
|
|
41
|
+
readonly id: string | {
|
|
42
|
+
_serialized: string;
|
|
43
|
+
};
|
|
44
|
+
constructor(id: string | {
|
|
45
|
+
_serialized: string;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get LID/PhoneNumber mapping and Contact information
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```javascript
|
|
53
|
+
* await WPP.contact.getPnLidEntry('[number]@c.us');
|
|
54
|
+
* await WPP.contact.getPnLidEntry('[number]@lid');
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @category Contact
|
|
58
|
+
*/
|
|
59
|
+
export declare function getPnLidEntry(contactId: string | Wid): Promise<PnLidEntryResult>;
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
export { get } from './get';
|
|
17
17
|
export { getBusinessProfile } from './getBusinessProfile';
|
|
18
18
|
export { getCommonGroups } from './getCommonGroups';
|
|
19
|
+
export { getPnLidEntry, InvalidWidForGetPnLidEntry, PnLidContactInfo, PnLidEntryResult, PnLidWid, } from './getPnLidEntry';
|
|
19
20
|
export { getProfilePictureUrl } from './getProfilePictureUrl';
|
|
20
21
|
export { getStatus } from './getStatus';
|
|
21
22
|
export { ContactListOptions, list } from './list';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2025 WPPConnect Team
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { ContactModel
|
|
16
|
+
import { ContactModel } from '../../whatsapp';
|
|
17
17
|
/**
|
|
18
18
|
* Create new or update a contact in the device
|
|
19
19
|
*
|
|
@@ -27,7 +27,7 @@ import { ContactModel, Wid } from '../../whatsapp';
|
|
|
27
27
|
*
|
|
28
28
|
* @category Contact
|
|
29
29
|
*/
|
|
30
|
-
export declare function save(contactId: string |
|
|
30
|
+
export declare function save(contactId: string | any, name: string, options?: {
|
|
31
31
|
surname?: string;
|
|
32
32
|
syncAdressBook?: boolean;
|
|
33
33
|
}): Promise<ContactModel | undefined>;
|
package/dist/gtag/Tracker.d.ts
CHANGED
|
@@ -47,6 +47,6 @@ export declare class Tracker {
|
|
|
47
47
|
* Send a user engagement each 5 minutes
|
|
48
48
|
*/
|
|
49
49
|
private processUserEngagement;
|
|
50
|
-
trackEvent(
|
|
50
|
+
trackEvent(_eventName: string, _params?: Record<string, string | number | boolean>): void;
|
|
51
51
|
setUserProperty(key: string, value: any): void;
|
|
52
52
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2025 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 { MsgKey } from '../../whatsapp';
|
|
17
|
+
/**
|
|
18
|
+
* Options for accepting an order
|
|
19
|
+
*/
|
|
20
|
+
export interface AcceptOrderOptions {
|
|
21
|
+
/** The message ID or message key of the order message */
|
|
22
|
+
msgId: string | MsgKey;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Accept an order
|
|
26
|
+
*
|
|
27
|
+
* This function performs TWO critical operations:
|
|
28
|
+
* 1. Updates the order message's status field from INQUIRY (1) to ACCEPTED (2)
|
|
29
|
+
* - This hides the "Accept Order" button in the UI
|
|
30
|
+
* 2. Sends an order status update message to the customer
|
|
31
|
+
* - Shows "Processing" or "Confirmed" status
|
|
32
|
+
*
|
|
33
|
+
* The order information is automatically retrieved from the message.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```javascript
|
|
37
|
+
* // Accept an order with default "Processing" status
|
|
38
|
+
* await WPP.order.accept({
|
|
39
|
+
* msgId: 'message_id_here',
|
|
40
|
+
* acceptNote: 'Your order has been confirmed and is being processed'
|
|
41
|
+
* });
|
|
42
|
+
*
|
|
43
|
+
* // Accept with "Confirmed" status
|
|
44
|
+
* await WPP.order.accept({
|
|
45
|
+
* msgId: 'message_id_here',
|
|
46
|
+
* orderStatus: WPP.order.OrderStatus.Confirmed,
|
|
47
|
+
* acceptNote: 'Your order has been confirmed'
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Accept without a note
|
|
51
|
+
* await WPP.order.accept({
|
|
52
|
+
* msgId: 'message_id_here'
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @category Order
|
|
57
|
+
*/
|
|
58
|
+
export declare function accept(options: AcceptOrderOptions): Promise<void>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2025 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 { MsgKey } from '../../whatsapp';
|
|
17
|
+
/**
|
|
18
|
+
* Options for declining an order
|
|
19
|
+
*/
|
|
20
|
+
export interface DeclineOrderOptions {
|
|
21
|
+
/** The message ID or message key of the order message */
|
|
22
|
+
msgId: string | MsgKey;
|
|
23
|
+
/** Optional note to include with the decline message (recommended) */
|
|
24
|
+
declineNote?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Decline an order
|
|
28
|
+
*
|
|
29
|
+
* This function performs TWO critical operations:
|
|
30
|
+
* 1. Updates the order message's status field from INQUIRY (1) to DECLINED (3)
|
|
31
|
+
* - This changes the UI to show the order as declined
|
|
32
|
+
* 2. Sends an order cancellation message to the customer
|
|
33
|
+
* - Shows "Canceled" status with optional note
|
|
34
|
+
*
|
|
35
|
+
* The order information is automatically retrieved from the message.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```javascript
|
|
39
|
+
* // Decline an order with a note
|
|
40
|
+
* await WPP.order.decline({
|
|
41
|
+
* msgId: 'message_id_here',
|
|
42
|
+
* declineNote: 'Sorry, we cannot fulfill this order at this time'
|
|
43
|
+
* });
|
|
44
|
+
*
|
|
45
|
+
* // Decline without a note
|
|
46
|
+
* await WPP.order.decline({
|
|
47
|
+
* msgId: 'message_id_here'
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @category Order
|
|
52
|
+
*/
|
|
53
|
+
export declare function decline(options: DeclineOrderOptions): Promise<void>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2025 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 { UpdateOrderOptions } from '../types';
|
|
17
|
+
/**
|
|
18
|
+
* Update an order status and/or payment information
|
|
19
|
+
*
|
|
20
|
+
* This function sends an order status update message to the customer.
|
|
21
|
+
*
|
|
22
|
+
* **Important:** For accepting or declining orders, use the dedicated `accept()` and `decline()`
|
|
23
|
+
* functions instead. Those functions properly update both the message status field (UI state)
|
|
24
|
+
* and send the status update message.
|
|
25
|
+
*
|
|
26
|
+
* This function is best used for status updates after an order has been accepted, such as:
|
|
27
|
+
* - Marking as shipped
|
|
28
|
+
* - Marking as delivered
|
|
29
|
+
* - Marking as complete
|
|
30
|
+
* - Updating payment information
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```javascript
|
|
34
|
+
* // Mark as shipped
|
|
35
|
+
* await WPP.order.update({
|
|
36
|
+
* msgId: 'message_id_here',
|
|
37
|
+
* orderInfo: {
|
|
38
|
+
* items: [
|
|
39
|
+
* {
|
|
40
|
+
* id: 'product_1',
|
|
41
|
+
* name: 'Product Name',
|
|
42
|
+
* amount: 1000,
|
|
43
|
+
* quantity: 2,
|
|
44
|
+
* isCustomItem: false,
|
|
45
|
+
* isQuantitySet: true
|
|
46
|
+
* }
|
|
47
|
+
* ],
|
|
48
|
+
* totalAmount: 2000,
|
|
49
|
+
* subtotal: 2000,
|
|
50
|
+
* currency: 'USD'
|
|
51
|
+
* },
|
|
52
|
+
* orderStatus: WPP.order.OrderStatus.Shipped,
|
|
53
|
+
* orderNote: 'Your order has been shipped',
|
|
54
|
+
* referenceId: 'ORDER_12345'
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* // Mark as delivered
|
|
58
|
+
* await WPP.order.update({
|
|
59
|
+
* msgId: 'message_id_here',
|
|
60
|
+
* orderInfo: { ... },
|
|
61
|
+
* orderStatus: WPP.order.OrderStatus.Delivered,
|
|
62
|
+
* orderNote: 'Your order has been delivered'
|
|
63
|
+
* });
|
|
64
|
+
*
|
|
65
|
+
* // Update payment status
|
|
66
|
+
* await WPP.order.update({
|
|
67
|
+
* msgId: 'message_id_here',
|
|
68
|
+
* orderInfo: { ... },
|
|
69
|
+
* orderStatus: WPP.order.OrderStatus.Complete,
|
|
70
|
+
* paymentStatus: WPP.order.PaymentStatus.Captured,
|
|
71
|
+
* orderNote: 'Order completed and payment received'
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @category Order
|
|
76
|
+
*/
|
|
77
|
+
export declare function update(options: UpdateOrderOptions): Promise<void>;
|
package/dist/order/index.d.ts
CHANGED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2025 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 { MsgKey } from '../whatsapp';
|
|
17
|
+
/**
|
|
18
|
+
* Order item information
|
|
19
|
+
*/
|
|
20
|
+
export interface OrderItem {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
amount: number;
|
|
24
|
+
quantity: number;
|
|
25
|
+
isCustomItem?: boolean;
|
|
26
|
+
isQuantitySet?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Order information structure
|
|
30
|
+
*/
|
|
31
|
+
export interface OrderInfo {
|
|
32
|
+
items: OrderItem[];
|
|
33
|
+
totalAmount: number;
|
|
34
|
+
subtotal: number;
|
|
35
|
+
tax?: number;
|
|
36
|
+
shipping?: number;
|
|
37
|
+
discount?: number;
|
|
38
|
+
currency: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Options for updating an order status
|
|
42
|
+
*/
|
|
43
|
+
export interface UpdateOrderOptions {
|
|
44
|
+
/** The message ID or message key of the order message */
|
|
45
|
+
msgId: string | MsgKey;
|
|
46
|
+
/** The new order status */
|
|
47
|
+
orderStatus: OrderStatus;
|
|
48
|
+
/** Optional note to include with the status update */
|
|
49
|
+
orderNote?: string;
|
|
50
|
+
/** The decimal offset for amount values (default: 2 for cents) */
|
|
51
|
+
offset?: number;
|
|
52
|
+
/** Reference ID for the order */
|
|
53
|
+
referenceId?: string;
|
|
54
|
+
/** Optional payment status update */
|
|
55
|
+
paymentStatus?: PaymentStatus;
|
|
56
|
+
/** Optional payment method */
|
|
57
|
+
paymentMethod?: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Order status values from WhatsApp's OrderStatus enum
|
|
61
|
+
* Based on WAWebOrderStatus module
|
|
62
|
+
*/
|
|
63
|
+
export declare enum OrderStatus {
|
|
64
|
+
/** Order is pending confirmation */
|
|
65
|
+
Pending = "pending",
|
|
66
|
+
/** Order is being processed */
|
|
67
|
+
Processing = "processing",
|
|
68
|
+
/** Order has been partially shipped */
|
|
69
|
+
PartiallyShipped = "partially_shipped",
|
|
70
|
+
/** Order has been shipped */
|
|
71
|
+
Shipped = "shipped",
|
|
72
|
+
/** Order is complete */
|
|
73
|
+
Complete = "completed",
|
|
74
|
+
/** Order has been canceled */
|
|
75
|
+
Canceled = "canceled",
|
|
76
|
+
/** Payment has been requested */
|
|
77
|
+
PaymentRequested = "payment_requested",
|
|
78
|
+
/** Order is being prepared for shipping */
|
|
79
|
+
PreparingToShip = "preparing_to_ship",
|
|
80
|
+
/** Order has been delivered */
|
|
81
|
+
Delivered = "delivered",
|
|
82
|
+
/** Order has been confirmed */
|
|
83
|
+
Confirmed = "confirmed",
|
|
84
|
+
/** Order delivery is delayed */
|
|
85
|
+
Delayed = "delayed",
|
|
86
|
+
/** Order has failed */
|
|
87
|
+
Failed = "failed",
|
|
88
|
+
/** Order is out for delivery */
|
|
89
|
+
OutForDelivery = "out_for_delivery",
|
|
90
|
+
/** Order has been refunded */
|
|
91
|
+
Refunded = "refunded"
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Payment status values from WhatsApp's OrderPaymentStatus enum
|
|
95
|
+
* Based on WAWebOrderPaymentStatus module
|
|
96
|
+
*/
|
|
97
|
+
export declare enum PaymentStatus {
|
|
98
|
+
/** Payment is pending */
|
|
99
|
+
Pending = "pending",
|
|
100
|
+
/** Payment has been captured/completed */
|
|
101
|
+
Captured = "captured",
|
|
102
|
+
/** Payment has failed */
|
|
103
|
+
Failed = "failed",
|
|
104
|
+
/** Payment has been canceled */
|
|
105
|
+
Canceled = "canceled"
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Order message status from Message$OrderMessage$OrderStatus protobuf enum
|
|
109
|
+
* This controls the UI state (whether "Accept Order" button is shown)
|
|
110
|
+
* Based on WAWebProtobufsE2E.pb.Message$OrderMessage$OrderStatus
|
|
111
|
+
*/
|
|
112
|
+
export declare enum OrderMessageStatus {
|
|
113
|
+
/** Initial order inquiry state - shows "Accept Order" button */
|
|
114
|
+
INQUIRY = 1,
|
|
115
|
+
/** Order accepted by merchant - hides "Accept Order" button */
|
|
116
|
+
ACCEPTED = 2,
|
|
117
|
+
/** Order declined by merchant */
|
|
118
|
+
DECLINED = 3
|
|
119
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 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
|
+
* Format bytes as human-readable text.
|
|
18
|
+
*
|
|
19
|
+
* @param bytes Number of bytes.
|
|
20
|
+
* @returns Formatted string.
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatFileSize(bytes: number): string;
|
|
23
|
+
/**
|
|
24
|
+
* Determine the media type for file size validation
|
|
25
|
+
* @param optionsType The media type specified in options ('image', 'video', 'audio', 'document', or 'auto-detect')
|
|
26
|
+
* @param mimeType The MIME type of the file (e.g., 'image/png', 'video/mp4')
|
|
27
|
+
* @returns The determined media type for validation ('image', 'video', 'audio', or 'document')
|
|
28
|
+
*/
|
|
29
|
+
export declare function getMediaTypeForValidation(optionsType: string, mimeType: string): string;
|
package/dist/util/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from './fetchDataFromPNG';
|
|
|
23
23
|
export * from './generateOrderUniqueId';
|
|
24
24
|
export * from './getVideoInfoFromBuffer';
|
|
25
25
|
export * from './isBase64';
|
|
26
|
+
export * from './isUrl';
|
|
26
27
|
export * from './resizeImage';
|
|
27
28
|
export * from './types';
|
|
28
29
|
export * from './wrapFunction';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 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
|
+
* Check if a string is a valid HTTP or HTTPS URL
|
|
18
|
+
* @param url The string to check
|
|
19
|
+
* @returns true if the string is a valid HTTP/HTTPS URL, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
export declare function isUrl(url: string): boolean;
|
|
@@ -21,10 +21,20 @@ import { Collection } from './Collection';
|
|
|
21
21
|
*/
|
|
22
22
|
export declare class CallCollection extends Collection<CallModel> {
|
|
23
23
|
static model: CallModel;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
$CallCollectionImpl$p_1?: () => any;
|
|
25
|
+
activeCall: CallModel | null;
|
|
26
|
+
isInConnectedCall: boolean;
|
|
27
|
+
pendingOffers: Record<string, any>;
|
|
28
|
+
pendingVoipCapChecks: Record<string, any>;
|
|
29
|
+
_cachePolicy: any;
|
|
30
|
+
_events: Record<string, any>;
|
|
31
|
+
_index: Record<string, any>;
|
|
32
|
+
_inflight: Record<string, any>;
|
|
33
|
+
_listenId: string;
|
|
34
|
+
_models: CallModel[];
|
|
35
|
+
_staleCollection: boolean;
|
|
36
|
+
cleanupPendingOffer(a?: any): any;
|
|
37
|
+
processIncomingCall(a?: any, b?: any, e?: any): any;
|
|
38
|
+
setActiveCall(a?: any): any;
|
|
39
|
+
setIsInConnectedCall(flag: boolean): any;
|
|
30
40
|
}
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @whatsapp
|
|
16
|
+
/**
|
|
17
|
+
* Versions when this enum was added/modified/revalidated:
|
|
18
|
+
* @whatsapp >= 2.2204.13
|
|
19
|
+
* @whatsapp >= 2.2222.8
|
|
20
|
+
* @whatsapp >= 2.3000.1029594945
|
|
19
21
|
*/
|
|
20
22
|
export declare enum ACK {
|
|
21
23
|
MD_DOWNGRADE = -7,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2025 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
|
+
/** @whatsapp WAWebPinMsgConstants >= 2.3000.1029839609
|
|
17
|
+
*/
|
|
18
|
+
export declare enum PinExpiryDurationOption {
|
|
19
|
+
FiveSeconds = "FiveSeconds",
|
|
20
|
+
FifteenSeconds = "FifteenSeconds",
|
|
21
|
+
OneMinute = "OneMinute",
|
|
22
|
+
OneDay = "OneDay",
|
|
23
|
+
SevenDays = "SevenDays",
|
|
24
|
+
ThirtyDays = "ThirtyDays"
|
|
25
|
+
}
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { SendMsgResult } from '../enums';
|
|
17
16
|
import { ModelPropertiesContructor, MsgModel } from '../models';
|
|
17
|
+
import { SendMsgResultObject } from '../types';
|
|
18
18
|
/** @whatsapp 375399
|
|
19
19
|
*/
|
|
20
|
-
export declare function addAndSendMessageEdit(editMsg: MsgModel, message: ModelPropertiesContructor<MsgModel>): Promise<[Promise<MsgModel>, Promise<
|
|
20
|
+
export declare function addAndSendMessageEdit(editMsg: MsgModel, message: ModelPropertiesContructor<MsgModel>): Promise<[Promise<MsgModel>, Promise<SendMsgResultObject>]>;
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { SendMsgResult } from '../enums';
|
|
17
16
|
import { ChatModel, ModelPropertiesContructor, MsgModel } from '../models';
|
|
17
|
+
import { SendMsgResultObject } from '../types';
|
|
18
18
|
/** @whatsapp 75887
|
|
19
19
|
* @whatsapp 975887 >= 2.2222.8
|
|
20
20
|
* @whatsapp 623631 >= 2.2228.4
|
|
21
21
|
*/
|
|
22
|
-
export declare function addAndSendMsgToChat(chat: ChatModel, message: ModelPropertiesContructor<MsgModel>): Promise<[Promise<MsgModel>, Promise<
|
|
22
|
+
export declare function addAndSendMsgToChat(chat: ChatModel, message: ModelPropertiesContructor<MsgModel>): Promise<[Promise<MsgModel>, Promise<SendMsgResultObject>]>;
|