UNPKG

bulk-mail-cli

Version:

Do quick, hassle-free email marketing with this small but very powerful tool! 🔥

39 lines • 1.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var chalk = require("chalk"); var isConnectionPossible_1 = require("../../utils/isConnectionPossible"); function checkJsonConfiguration(jsonConfiguration, shouldLogError) { if (shouldLogError === void 0) { shouldLogError = true; } return tslib_1.__awaiter(this, void 0, void 0, function () { var errors, error_1; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: errors = []; _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4, isConnectionPossible_1.default(jsonConfiguration.credentials)]; case 2: _a.sent(); return [3, 4]; case 3: error_1 = _a.sent(); errors.push(chalk.red.bold("Attempts to connect your email account has failed.") + "\n " + chalk.yellowBright.bold("\nTroubleshooting tips \uD83D\uDCA1") + "\n " + chalk.yellow("\nTo get the correct sample configuration file, run 'bulkmail demo' command.") + "\n " + chalk.yellow("\nMake sure that your internet connection is alright.") + "\n " + chalk.yellow("\nIf using Gmail, turn on 'Less Secure Apps' option here: " + chalk.cyan("https://bit.ly/33Z4yLS"))); return [3, 4]; case 4: if (errors.length === 0) { return [2, true]; } shouldLogError && errors.forEach(function (error) { console.log(error); }); return [2, false]; } }); }); } exports.default = checkJsonConfiguration; //# sourceMappingURL=checkJsonConfiguration.js.map