@auxcode/auxta 1.3.51-beta.13 → 1.3.51-beta.15

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.
@@ -14,10 +14,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AuxGoogleAuth = void 0;
16
16
  const config_1 = require("../../auxta/configs/config");
17
- const fs = require('fs');
18
- const readline = require('readline');
19
17
  const puppeteer_1 = __importDefault(require("../../puppeteer/puppeteer"));
20
18
  const code_helper_1 = __importDefault(require("../helpers/code.helper"));
19
+ const status_of_step_1 = __importDefault(require("../../auxta/enums/status-of.step"));
20
+ const fs = require('fs');
21
+ const readline = require('readline');
21
22
  const { google } = require("googleapis");
22
23
  const SCOPES = [
23
24
  'https://www.googleapis.com/auth/gmail.addons.current.action.compose',
@@ -85,7 +86,8 @@ class AuxGoogleAuth {
85
86
  const { client_secret, client_id, redirect_uris } = credentials.installed;
86
87
  const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
87
88
  try {
88
- if (TOKEN.length > 0) {
89
+ code_helper_1.default.log('tes', TOKEN, status_of_step_1.default.PASSED);
90
+ if (TOKEN) {
89
91
  oAuth2Client.setCredentials(JSON.parse(TOKEN));
90
92
  this._oAuth2Client = oAuth2Client;
91
93
  return;
@@ -133,11 +135,13 @@ class AuxGoogleAuth {
133
135
  scope: SCOPES,
134
136
  });
135
137
  const code = yield this.LogIn(authUrl);
138
+ code_helper_1.default.log('tes', code, status_of_step_1.default.PASSED);
136
139
  oAuth2Client.getToken(code, (err, token) => {
137
140
  if (err)
138
141
  return console.error('Error retrieving access token', err);
139
142
  oAuth2Client.setCredentials(token);
140
- TOKEN = token;
143
+ code_helper_1.default.log('tes', token.toString(), status_of_step_1.default.PASSED);
144
+ TOKEN = token.toString();
141
145
  this._oAuth2Client = oAuth2Client;
142
146
  });
143
147
  });
@@ -148,7 +152,6 @@ class AuxGoogleAuth {
148
152
  const context = yield puppeteer_1.default.defaultPage.browser().createIncognitoBrowserContext();
149
153
  const page = yield context.newPage();
150
154
  yield page.goto(authUrl);
151
- yield page.waitForNetworkIdle();
152
155
  yield code_helper_1.default.waitForSelector('visible', '#identifierId', config_1.config.timeout, page);
153
156
  yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(EMAIL));
154
157
  yield (yield page.$$('button'))[3].click();
@@ -160,14 +163,14 @@ class AuxGoogleAuth {
160
163
  yield code_helper_1.default.waitForSelector('visible', '#headingText', config_1.config.timeout, page);
161
164
  yield (yield page.$$('button'))[2].click();
162
165
  yield code_helper_1.default.timeout(3000);
163
- const checkbox = yield page.$('input[type="checkbox"]');
164
- if (checkbox) {
166
+ const checkbox = yield page.$$('input[type="checkbox"]');
167
+ if (checkbox.length > 0) {
165
168
  yield code_helper_1.default.waitForSelector('visible', 'input[type="checkbox"]', config_1.config.timeout, page);
166
- yield checkbox.click();
169
+ yield checkbox[0].click();
167
170
  yield (yield page.$$('button'))[2].click();
168
171
  }
169
172
  else {
170
- yield (yield page.$$('button'))[3].click();
173
+ yield (yield page.$$('button'))[2].click();
171
174
  }
172
175
  yield code_helper_1.default.timeout(3000);
173
176
  const currentUrl = page.url();
@@ -8,10 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { config } from "../../auxta/configs/config";
11
- const fs = require('fs');
12
- const readline = require('readline');
13
11
  import puppeteer from "../../puppeteer/puppeteer";
14
12
  import FunctionHelper from "../helpers/code.helper";
13
+ import StatusOfStep from "../../auxta/enums/status-of.step";
14
+ const fs = require('fs');
15
+ const readline = require('readline');
15
16
  const { google } = require("googleapis");
16
17
  const SCOPES = [
17
18
  'https://www.googleapis.com/auth/gmail.addons.current.action.compose',
@@ -79,7 +80,8 @@ export class AuxGoogleAuth {
79
80
  const { client_secret, client_id, redirect_uris } = credentials.installed;
80
81
  const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
81
82
  try {
82
- if (TOKEN.length > 0) {
83
+ FunctionHelper.log('tes', TOKEN, StatusOfStep.PASSED);
84
+ if (TOKEN) {
83
85
  oAuth2Client.setCredentials(JSON.parse(TOKEN));
84
86
  this._oAuth2Client = oAuth2Client;
85
87
  return;
@@ -127,11 +129,13 @@ export class AuxGoogleAuth {
127
129
  scope: SCOPES,
128
130
  });
129
131
  const code = yield this.LogIn(authUrl);
132
+ FunctionHelper.log('tes', code, StatusOfStep.PASSED);
130
133
  oAuth2Client.getToken(code, (err, token) => {
131
134
  if (err)
132
135
  return console.error('Error retrieving access token', err);
133
136
  oAuth2Client.setCredentials(token);
134
- TOKEN = token;
137
+ FunctionHelper.log('tes', token.toString(), StatusOfStep.PASSED);
138
+ TOKEN = token.toString();
135
139
  this._oAuth2Client = oAuth2Client;
136
140
  });
137
141
  });
@@ -142,7 +146,6 @@ export class AuxGoogleAuth {
142
146
  const context = yield puppeteer.defaultPage.browser().createIncognitoBrowserContext();
143
147
  const page = yield context.newPage();
144
148
  yield page.goto(authUrl);
145
- yield page.waitForNetworkIdle();
146
149
  yield FunctionHelper.waitForSelector('visible', '#identifierId', config.timeout, page);
147
150
  yield ((_a = (yield page.$('#identifierId'))) === null || _a === void 0 ? void 0 : _a.type(EMAIL));
148
151
  yield (yield page.$$('button'))[3].click();
@@ -154,14 +157,14 @@ export class AuxGoogleAuth {
154
157
  yield FunctionHelper.waitForSelector('visible', '#headingText', config.timeout, page);
155
158
  yield (yield page.$$('button'))[2].click();
156
159
  yield FunctionHelper.timeout(3000);
157
- const checkbox = yield page.$('input[type="checkbox"]');
158
- if (checkbox) {
160
+ const checkbox = yield page.$$('input[type="checkbox"]');
161
+ if (checkbox.length > 0) {
159
162
  yield FunctionHelper.waitForSelector('visible', 'input[type="checkbox"]', config.timeout, page);
160
- yield checkbox.click();
163
+ yield checkbox[0].click();
161
164
  yield (yield page.$$('button'))[2].click();
162
165
  }
163
166
  else {
164
- yield (yield page.$$('button'))[3].click();
167
+ yield (yield page.$$('button'))[2].click();
165
168
  }
166
169
  yield FunctionHelper.timeout(3000);
167
170
  const currentUrl = page.url();