@open-wa/wa-automate 4.30.10 → 4.31.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.
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.scriptLoader = exports.ScriptLoader = void 0;
32
+ const path = __importStar(require("path"));
33
+ const fs = __importStar(require("fs"));
34
+ const logging_1 = require("../logging/logging");
35
+ const read = (_path) => new Promise((resolve, reject) => {
36
+ fs.readFile(require.resolve(path.join(__dirname, '../lib', _path)), 'utf8', (err, file) => {
37
+ if (err)
38
+ reject(err);
39
+ resolve(file);
40
+ });
41
+ });
42
+ class ScriptLoader {
43
+ constructor() {
44
+ this.scripts = [
45
+ // stage 1
46
+ 'axios.min.js',
47
+ 'jsSha.min.js',
48
+ 'qr.min.js',
49
+ 'base64.js',
50
+ 'hash.js',
51
+ //stage 2
52
+ 'wapi.js',
53
+ //stage 3,
54
+ 'launch.js'
55
+ ];
56
+ this.contentRegistry = {};
57
+ this.contentRegistry = {};
58
+ }
59
+ loadScripts() {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ yield Promise.all(this.scripts.map(this.getScript.bind(this)));
62
+ return this.contentRegistry;
63
+ });
64
+ }
65
+ getScript(scriptName) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ if (!this.contentRegistry[scriptName]) {
68
+ this.contentRegistry[scriptName] = yield read(scriptName);
69
+ logging_1.log.info("SCRIPT READY: " + scriptName);
70
+ }
71
+ return this.contentRegistry[scriptName];
72
+ });
73
+ }
74
+ flush() {
75
+ this.contentRegistry = {};
76
+ }
77
+ getScripts() {
78
+ return this.contentRegistry;
79
+ }
80
+ }
81
+ exports.ScriptLoader = ScriptLoader;
82
+ const scriptLoader = new ScriptLoader();
83
+ exports.scriptLoader = scriptLoader;
package/dist/lib/wapi.js CHANGED
@@ -82,7 +82,7 @@ if (!window.Store||!window.Store.Msg) {
82
82
  window.Store[needObj.id] = needObj.foundedModule;
83
83
  }
84
84
  });
85
- window.Store.Chat.modelClass.prototype.sendMessage = function (e) {
85
+ if(window.Store.Chat) window.Store.Chat.modelClass.prototype.sendMessage = function (e) {
86
86
  window.Store.SendTextMsgToChat(this, ...arguments);
87
87
  }
88
88
  return window.Store;
@@ -833,7 +833,7 @@ window.WAPI.markAsUnread = async function (id) {
833
833
  return false;
834
834
  };
835
835
 
836
- function isChatMessage(message) {
836
+ window.isChatMessage = function (message) {
837
837
  if (message.isSentByMe) {
838
838
  return false;
839
839
  }
@@ -1314,7 +1314,7 @@ window.WAPI.onParticipantsChanged = function (groupId, callback) {
1314
1314
  * @param callback - function - Callback function to be called when a message acknowledgement changes. The callback returns 3 variables
1315
1315
  * @returns {boolean}
1316
1316
  */
1317
- var groupParticpiantsEvents = {};
1317
+ window.groupParticpiantsEvents = {};
1318
1318
  window.WAPI._onParticipantsChanged = function (groupId, callback) {
1319
1319
  const subtypeEvents = [
1320
1320
  "invite" ,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.30.10",
4
- "licenseCheckUrl": "https://openwa.dev/license-check",
5
- "brokenMethodReportUrl": "https://openwa.dev/report-bm",
3
+ "version": "4.31.0",
4
+ "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
+ "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",
7
7
  "stickerUrl": "https://sticker-api.openwa.dev",
8
8
  "description": " 💬 🤖 The most reliable NodeJS whatsapp library for chatbots with advanced features.",
@@ -73,22 +73,22 @@
73
73
  "@types/fs-extra": "^9.0.11",
74
74
  "@types/line-reader": "0.0.34",
75
75
  "@types/localtunnel": "^2.0.1",
76
- "@types/marked": "^3.0.0",
76
+ "@types/marked": "^4.0.2",
77
77
  "@types/mime-types": "^2.1.0",
78
- "@types/node": "^16.0.0",
78
+ "@types/node": "^17.0.13",
79
79
  "@types/puppeteer": "^5.4.0",
80
80
  "@types/shelljs": "^0.8.5",
81
81
  "@types/winston-syslog": "^2.4.0",
82
82
  "@typescript-eslint/eslint-plugin": "^5.8.0",
83
- "@typescript-eslint/parser": "^4.15.2",
83
+ "@typescript-eslint/parser": "^5.10.1",
84
84
  "auto-changelog": "^2.0.0",
85
- "ava": "^3.13.0",
85
+ "ava": "^4.0.1",
86
86
  "changelog-parser": "^2.8.0",
87
87
  "command-line-args": "^5.1.1",
88
88
  "eslint": "^8.1.0",
89
89
  "husky": "^7.0.0",
90
90
  "line-reader": "^0.4.0",
91
- "marked": "^3.0.0",
91
+ "marked": "^4.0.10",
92
92
  "node-emoji": "^1.10.0",
93
93
  "onchange": "^7.0.2",
94
94
  "precise-commits": "^1.0.2",
@@ -101,18 +101,18 @@
101
101
  "typeconv": "^1.7.0",
102
102
  "typedoc": "^0.21.6",
103
103
  "typedoc-plugin-pages": "^1.0.1",
104
- "typescript": "^4.2.4"
104
+ "typescript": "^4.4.4"
105
105
  },
106
106
  "dependencies": {
107
- "@discordjs/collection": "^0.2.0",
107
+ "@discordjs/collection": "^0.5.0",
108
108
  "@open-wa/wa-decrypt": "^4.3.1",
109
109
  "atob": "^2.1.2",
110
110
  "aws4": "^1.11.0",
111
- "axios": "^0.21.0",
111
+ "axios": "^0.25.0",
112
112
  "boxen": "^5.0.0",
113
113
  "cfonts": "^2.8.5",
114
114
  "change-case": "^4.1.2",
115
- "chrome-launcher": "^0.14.0",
115
+ "chrome-launcher": "^0.15.0",
116
116
  "command-exists": "^1.2.9",
117
117
  "command-line-usage": "^6.1.1",
118
118
  "cors": "^2.8.5",
@@ -163,7 +163,7 @@
163
163
  "terminal-link": "^2.1.1",
164
164
  "terminate": "^2.5.0",
165
165
  "traverse": "^0.6.6",
166
- "ts-json-schema-generator": "^0.95.0",
166
+ "ts-json-schema-generator": "^0.97.0",
167
167
  "ts-morph": "^12.0.0",
168
168
  "type-fest": "^1.1.1",
169
169
  "update-notifier": "^5.0.0",