@auxcode/auxta 1.3.26-beta.7 → 1.3.28
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.
|
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.EmailHelper = void 0;
|
|
16
16
|
const log_service_1 = __importDefault(require("../../auxta/services/log.service"));
|
|
17
17
|
const AuxGoogleAuth_1 = require("./AuxGoogleAuth");
|
|
18
|
-
const
|
|
18
|
+
const base64 = require('js-base64');
|
|
19
19
|
const AuxTA_1 = require("../../AuxTA");
|
|
20
20
|
const MailComposer = require('nodemailer/lib/mail-composer');
|
|
21
21
|
class EmailHelper {
|
|
@@ -128,12 +128,18 @@ class EmailHelper {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
getBody(subject, gmailResponse) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
try {
|
|
132
|
+
const body = gmailResponse.data.payload.parts[0].body.data;
|
|
133
|
+
if (body) {
|
|
134
|
+
return base64.decode(body);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return '';
|
|
138
|
+
}
|
|
134
139
|
}
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
catch (e) {
|
|
141
|
+
console.log(e);
|
|
142
|
+
throw new Error(`Email with subject: ${subject} body ${gmailResponse.data.payload.parts[0].body.data} is empty`);
|
|
137
143
|
}
|
|
138
144
|
}
|
|
139
145
|
getCurrentUserEmail() {
|
|
@@ -146,7 +152,7 @@ class EmailHelper {
|
|
|
146
152
|
getUrl(body) {
|
|
147
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
154
|
const links = [];
|
|
149
|
-
const split = body.split('\r\n');
|
|
155
|
+
const split = body.split('\r\n\r\n');
|
|
150
156
|
for (const splitElement of split) {
|
|
151
157
|
if (splitElement.toString().startsWith('https')) {
|
|
152
158
|
links.push(splitElement);
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import log from "../../auxta/services/log.service";
|
|
11
11
|
import { AuxGoogleAuth } from "./AuxGoogleAuth";
|
|
12
|
-
|
|
12
|
+
const base64 = require('js-base64');
|
|
13
13
|
import { StepStatus } from "../../AuxTA";
|
|
14
14
|
const MailComposer = require('nodemailer/lib/mail-composer');
|
|
15
15
|
export class EmailHelper {
|
|
@@ -122,12 +122,18 @@ export class EmailHelper {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
getBody(subject, gmailResponse) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
try {
|
|
126
|
+
const body = gmailResponse.data.payload.parts[0].body.data;
|
|
127
|
+
if (body) {
|
|
128
|
+
return base64.decode(body);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
return '';
|
|
132
|
+
}
|
|
128
133
|
}
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
catch (e) {
|
|
135
|
+
console.log(e);
|
|
136
|
+
throw new Error(`Email with subject: ${subject} body ${gmailResponse.data.payload.parts[0].body.data} is empty`);
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
getCurrentUserEmail() {
|
|
@@ -140,7 +146,7 @@ export class EmailHelper {
|
|
|
140
146
|
getUrl(body) {
|
|
141
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
148
|
const links = [];
|
|
143
|
-
const split = body.split('\r\n');
|
|
149
|
+
const split = body.split('\r\n\r\n');
|
|
144
150
|
for (const splitElement of split) {
|
|
145
151
|
if (splitElement.toString().startsWith('https')) {
|
|
146
152
|
links.push(splitElement);
|