@auxcode/auxta 1.3.51-beta.7 → 1.3.51-beta.9

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.
@@ -6,6 +6,7 @@ export declare class AuxGoogleAuth {
6
6
  static get googleClient(): googleType.GoogleApis;
7
7
  static get gmailClient(): googleType.gmail_v1.Gmail;
8
8
  static setupBrowser(): Promise<void>;
9
+ static setEmailPassword(email: string, password: string): Promise<void>;
9
10
  static setupHeadless(): Promise<void>;
10
11
  private static authorize;
11
12
  private static authorizeHeadless;
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AuxGoogleAuth = void 0;
16
+ const config_1 = require("../../auxta/configs/config");
16
17
  const fs = require('fs');
17
18
  const readline = require('readline');
18
19
  const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
@@ -33,6 +34,8 @@ const SCOPES = [
33
34
  ];
34
35
  const TOKEN_PATH = 'token.json';
35
36
  let TOKEN = '';
37
+ let EMAIL = '';
38
+ let PASSWORD = '';
36
39
  class AuxGoogleAuth {
37
40
  static get oAuth2Client() {
38
41
  return this._oAuth2Client;
@@ -48,6 +51,12 @@ class AuxGoogleAuth {
48
51
  yield this.authorize(this.credentialsJson);
49
52
  });
50
53
  }
54
+ static setEmailPassword(email, password) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ EMAIL = email;
57
+ PASSWORD = password;
58
+ });
59
+ }
51
60
  static setupHeadless() {
52
61
  return __awaiter(this, void 0, void 0, function* () {
53
62
  yield this.authorizeHeadless(this.credentialsJson);
@@ -123,7 +132,7 @@ class AuxGoogleAuth {
123
132
  prompt: 'consent',
124
133
  scope: SCOPES,
125
134
  });
126
- const code = this.LogIn(authUrl);
135
+ const code = yield this.LogIn(authUrl);
127
136
  oAuth2Client.getToken(code, (err, token) => {
128
137
  if (err)
129
138
  return console.error('Error retrieving access token', err);
@@ -140,18 +149,18 @@ class AuxGoogleAuth {
140
149
  const page = yield context.newPage();
141
150
  yield page.goto(authUrl);
142
151
  yield page.waitForNetworkIdle();
143
- yield code_helper_1.default.waitForSelector('visible', '#identifierId');
144
- yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type('mp+auxta@auxcode.com'));
152
+ yield code_helper_1.default.waitForSelector('visible', '#identifierId', config_1.config.timeout, page);
153
+ yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(EMAIL));
145
154
  yield (yield page.$$('button'))[3].click();
146
155
  yield page.waitForNetworkIdle();
147
- yield code_helper_1.default.waitForSelector('visible', 'input[type="password"]');
148
- yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type('DeVabli99!'));
156
+ yield code_helper_1.default.waitForSelector('visible', 'input[type="password"]', config_1.config.timeout, page);
157
+ yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type(PASSWORD));
149
158
  yield (yield page.$$('button'))[1].click();
150
159
  yield page.waitForNetworkIdle();
151
- yield code_helper_1.default.waitForSelector('visible', '#headingText');
160
+ yield code_helper_1.default.waitForSelector('visible', '#headingText', config_1.config.timeout, page);
152
161
  yield (yield page.$$('button'))[2].click();
153
162
  yield page.waitForNetworkIdle();
154
- yield code_helper_1.default.waitForSelector('visible', 'input[type="checkbox"]');
163
+ yield code_helper_1.default.waitForSelector('visible', 'input[type="checkbox"]', config_1.config.timeout, page);
155
164
  yield ((_c = (yield page.$('input[type="checkbox"]'))) === null || _c === void 0 ? void 0 : _c.click());
156
165
  yield (yield page.$$('button'))[2].click();
157
166
  yield page.waitForNetworkIdle();
@@ -6,6 +6,7 @@ export declare class AuxGoogleAuth {
6
6
  static get googleClient(): googleType.GoogleApis;
7
7
  static get gmailClient(): googleType.gmail_v1.Gmail;
8
8
  static setupBrowser(): Promise<void>;
9
+ static setEmailPassword(email: string, password: string): Promise<void>;
9
10
  static setupHeadless(): Promise<void>;
10
11
  private static authorize;
11
12
  private static authorizeHeadless;
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { config } from "../../auxta/configs/config";
10
11
  const fs = require('fs');
11
12
  const readline = require('readline');
12
13
  import puppeteer from "../../puppeteer/puppeteer";
@@ -27,6 +28,8 @@ const SCOPES = [
27
28
  ];
28
29
  const TOKEN_PATH = 'token.json';
29
30
  let TOKEN = '';
31
+ let EMAIL = '';
32
+ let PASSWORD = '';
30
33
  export class AuxGoogleAuth {
31
34
  static get oAuth2Client() {
32
35
  return this._oAuth2Client;
@@ -42,6 +45,12 @@ export class AuxGoogleAuth {
42
45
  yield this.authorize(this.credentialsJson);
43
46
  });
44
47
  }
48
+ static setEmailPassword(email, password) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ EMAIL = email;
51
+ PASSWORD = password;
52
+ });
53
+ }
45
54
  static setupHeadless() {
46
55
  return __awaiter(this, void 0, void 0, function* () {
47
56
  yield this.authorizeHeadless(this.credentialsJson);
@@ -117,7 +126,7 @@ export class AuxGoogleAuth {
117
126
  prompt: 'consent',
118
127
  scope: SCOPES,
119
128
  });
120
- const code = this.LogIn(authUrl);
129
+ const code = yield this.LogIn(authUrl);
121
130
  oAuth2Client.getToken(code, (err, token) => {
122
131
  if (err)
123
132
  return console.error('Error retrieving access token', err);
@@ -134,18 +143,18 @@ export class AuxGoogleAuth {
134
143
  const page = yield context.newPage();
135
144
  yield page.goto(authUrl);
136
145
  yield page.waitForNetworkIdle();
137
- yield FunctionHelper.waitForSelector('visible', '#identifierId');
138
- yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type('mp+auxta@auxcode.com'));
146
+ yield FunctionHelper.waitForSelector('visible', '#identifierId', config.timeout, page);
147
+ yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(EMAIL));
139
148
  yield (yield page.$$('button'))[3].click();
140
149
  yield page.waitForNetworkIdle();
141
- yield FunctionHelper.waitForSelector('visible', 'input[type="password"]');
142
- yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type('DeVabli99!'));
150
+ yield FunctionHelper.waitForSelector('visible', 'input[type="password"]', config.timeout, page);
151
+ yield ((_b = (yield page.$('input[type="password"]'))) === null || _b === void 0 ? void 0 : _b.type(PASSWORD));
143
152
  yield (yield page.$$('button'))[1].click();
144
153
  yield page.waitForNetworkIdle();
145
- yield FunctionHelper.waitForSelector('visible', '#headingText');
154
+ yield FunctionHelper.waitForSelector('visible', '#headingText', config.timeout, page);
146
155
  yield (yield page.$$('button'))[2].click();
147
156
  yield page.waitForNetworkIdle();
148
- yield FunctionHelper.waitForSelector('visible', 'input[type="checkbox"]');
157
+ yield FunctionHelper.waitForSelector('visible', 'input[type="checkbox"]', config.timeout, page);
149
158
  yield ((_c = (yield page.$('input[type="checkbox"]'))) === null || _c === void 0 ? void 0 : _c.click());
150
159
  yield (yield page.$$('button'))[2].click();
151
160
  yield page.waitForNetworkIdle();