@wppconnect/wa-version 1.5.4601 → 1.5.4603

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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.5.4603 (2026-08-14)
2
+
3
+ ## [1.5.4602](https://github.com/wppconnect-team/wa-version/compare/v1.5.4601...v1.5.4602) (2026-08-14)
4
+
1
5
  ## [1.5.4601](https://github.com/wppconnect-team/wa-version/compare/v1.5.4600...v1.5.4601) (2026-08-14)
2
6
 
3
7
  ## [1.5.4600](https://github.com/wppconnect-team/wa-version/compare/v1.5.4599...v1.5.4600) (2026-08-14)
@@ -13,6 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ /**
17
+ * Return the alpha version declared inside of the page
18
+ * @param content HTML content of the page
19
+ * @returns Version number
20
+ */
21
+ export declare function getAlphaVersionFromContent(content: string): string | null;
16
22
  /**
17
23
  * Return the current active noraml version on WhatsApp WEB
18
24
  * @returns Version number
@@ -54,16 +54,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
54
54
  return (mod && mod.__esModule) ? mod : { "default": mod };
55
55
  };
56
56
  Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.getAlphaVersionFromContent = getAlphaVersionFromContent;
57
58
  exports.fetchCurrentAlphaVersion = fetchCurrentAlphaVersion;
58
59
  var node_fetch_1 = __importDefault(require("node-fetch"));
59
60
  var constants_1 = require("./constants");
61
+ /**
62
+ * Return the alpha version declared inside of the page
63
+ * @param content HTML content of the page
64
+ * @returns Version number
65
+ */
66
+ function getAlphaVersionFromContent(content) {
67
+ var matches = content.match(/"client_revision"\s*:\s*(\d+)/) || [];
68
+ if (matches[1]) {
69
+ return "2.3000.".concat(matches[1], "-alpha");
70
+ }
71
+ return null;
72
+ }
60
73
  /**
61
74
  * Return the current active noraml version on WhatsApp WEB
62
75
  * @returns Version number
63
76
  */
64
77
  function fetchCurrentAlphaVersion() {
65
78
  return __awaiter(this, void 0, void 0, function () {
66
- var response, text, matches;
79
+ var response, text;
67
80
  return __generator(this, function (_a) {
68
81
  switch (_a.label) {
69
82
  case 0: return [4 /*yield*/, (0, node_fetch_1.default)("".concat(constants_1.WA_URL), {
@@ -82,10 +95,7 @@ function fetchCurrentAlphaVersion() {
82
95
  case 2:
83
96
  text = _a.sent();
84
97
  if (text) {
85
- matches = text.match(/"client_revision"\s*:\s*(\d+)/) || [];
86
- if (matches[1]) {
87
- return [2 /*return*/, "2.3000.".concat(matches[1], "-alpha")];
88
- }
98
+ return [2 /*return*/, getAlphaVersionFromContent(text)];
89
99
  }
90
100
  return [2 /*return*/, null];
91
101
  }