@wppconnect/wa-js
Version:
WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web
82 lines (81 loc) • 2.87 kB
TypeScript
/*!
* Copyright 2021 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface BuildConstants {
VERSION_STR: string;
VERSION_BASE: string;
VERSION_PRIMARY: string;
VERSION_SECONDARY: string;
VERSION_TERTIARY: string;
WINDOWS_BUILD: string | null;
PARSED: {
PRIMARY: number;
SECONDARY: number;
TERTIARY: number;
};
[key: string]: any;
}
/**
* Get the WhatsApp Web build constants
* Retrieves the internal WAWebBuildConstants module from WhatsApp source
*
* @example
* ```javascript
* const buildConstants = WPP.conn.getBuildConstants();
* console.log('Version:', buildConstants.VERSION_STR);
* console.log('Base Version:', buildConstants.VERSION_BASE);
* console.log('Windows Build:', buildConstants.WINDOWS_BUILD);
* ```
*
* @returns {BuildConstants|null} Object containing version constants or null if not available
* - VERSION_STR: Full version string (e.g., "2.3000.1234567")
* - VERSION_BASE: Base version (e.g., "2.3000.1234567")
* - VERSION_PRIMARY: Primary version number
* - VERSION_SECONDARY: Secondary version number
* - VERSION_TERTIARY: Tertiary version number
* - WINDOWS_BUILD: Windows build number (if applicable)
* - And other build-related constants
*/
export declare function getBuildConstants(): BuildConstants | null;
/**
* Check if the current WhatsApp version is greater than or equal to a specified version
*
* @example
* ```javascript
* // Check if version is >= 2.3000.1030110621
* if (WPP.conn.isWhatsAppVersionGTE('2.3000.1030110621')) {
* console.log('Using new API');
* }
* ```
*
* @param version - Version string to compare against (e.g., "2.3000.1029")
* @returns {boolean} True if current version is >= specified version
*/
export declare function isWhatsAppVersionGTE(version: string): boolean;
/**
* Check if the current WhatsApp version is less than or equal to a specified version
*
* @example
* ```javascript
* // Check if version is <= 2.3000.1029960097
* if (WPP.conn.isWhatsAppVersionLTE('2.3000.1029960097')) {
* console.log('Using legacy API');
* }
* ```
*
* @param version - Version string to compare against (e.g., "2.3000.1029")
* @returns {boolean} True if current version is <= specified version
*/
export declare function isWhatsAppVersionLTE(version: string): boolean;