fix(all): TODO items removed or moved to ALM.

This commit is contained in:
rodrigorodriguez 2023-01-01 14:24:53 -03:00
parent 7344a8e7dd
commit 7348c54894
5 changed files with 145 additions and 156 deletions

View file

@ -937,9 +937,7 @@ export class GBMinService {
// Required for F0 handling of persisted conversations.
GBLog.info(
`Input> ${context.activity.text} (type: ${context.activity.type}, name: ${
context.activity.name
}, channelId: ${context.activity.channelId})`
`Input> ${context.activity.text} (type: ${context.activity.type}, name: ${context.activity.name}, channelId: ${context.activity.channelId})`
);
// Answer to specific BOT Framework event conversationUpdate to auto start dialogs.
@ -1065,6 +1063,16 @@ export class GBMinService {
}
}
/**
*
* Checks for global exit kewywords cancelling any active dialogs.
*
* */
public static isGlobalQuitUtterance(locale, utterance) {
return utterance.match(Messages.global_quit);
}
/**
* Called to handle all text messages sent and received by the bot.
*/
@ -1109,12 +1117,6 @@ export class GBMinService {
}
}
// Checks for global exit kewywords cancelling any active dialogs.
const globalQuit = (locale, utterance) => {
return utterance.match(Messages.global_quit);
};
// Files in .gbdialog can be called directly by typing its name normalized into JS .
const isVMCall = Object.keys(min.scriptMap).find(key => min.scriptMap[key] === context.activity.text) !== undefined;
@ -1142,7 +1144,7 @@ export class GBMinService {
} else {
await step.beginDialog(cmdOrDialogName, { args: args });
}
} else if (globalQuit(step.context.activity.locale, context.activity.text)) {
} else if (GBMinService.isGlobalQuitUtterance(step.context.activity.locale, context.activity.text)) {
await step.cancelAllDialogs();
await min.conversationalService.sendText(min, step, Messages[step.context.activity.locale].canceled);
} else if (context.activity.text === 'admin') {

View file

@ -54,9 +54,6 @@ else
talk "The maximum number of payments is 60"
end if
' TODO: This must be reviewed in terms of financing logic.
nInstallments = parseInt(installments)
vamount = parseFloat(amount)
initialPayment = vamount * 0.3 ' 30% of the value

View file

@ -185,7 +185,6 @@ export class SecService extends GBService {
item !== userSystemId &&
!(await this.isAgentSystemId(item))
) {
// TODO: Optimize loop.
agentSystemId = item;
}
});

View file

@ -34,7 +34,7 @@ import urlJoin from 'url-join';
import Swagger from 'swagger-client';
import Path from 'path';
import Fs from 'fs';
import { GBLog, GBMinInstance, GBService, IGBPackage } from 'botlib';
import { GBError, GBLog, GBMinInstance, GBService, IGBPackage } from 'botlib';
import { CollectionUtil } from 'pragmatismo-io-framework';
import { GBServer } from '../../../src/app.js';
import { GBConversationalService } from '../../core.gbapp/services/GBConversationalService.js';
@ -310,10 +310,8 @@ export class WhatsappDirectLine extends GBService {
public async check() {
switch (this.provider) {
case 'GeneralBots':
return this.customClient.getState() === 'CONNECTED';
// TODO: Verify if browser is OK.
return true;
default:
GBLog.verbose(`GBWhatsapp: Checking server...`);
let url = urlJoin(this.whatsappServiceUrl, 'status') + `?token=${this.min.instance.whatsappServiceKey}`;
@ -323,7 +321,7 @@ export class WhatsappDirectLine extends GBService {
};
const res = await fetch(url, options);
const json = (await res.json());
const json = await res.json();
return json['accountStatus'] === 'authenticated';
}
}
@ -538,7 +536,6 @@ export class WhatsappDirectLine extends GBService {
await this.min.conversationalService.sendMarkdownToMobile(this.min, null, user.userSystemId, message);
}
} else if (text === '/qt') {
// https://github.com/GeneralBots/BotServer/issues/307
await this.sendToDeviceEx(
@ -579,8 +576,7 @@ export class WhatsappDirectLine extends GBService {
locale,
null
);
} else if (text === '/qt' || text === 'Sair' || text === 'Fechar') {
// TODO: Transfers only in pt-br for now.
} else if (text === '/qt' || GBMinService.isGlobalQuitUtterance(locale, text)) {
await this.endTransfer(from, locale, user, agent, sec);
} else {
GBLog.info(`USER (${from}) TO AGENT ${agent.userSystemId}: ${text}`);
@ -836,9 +832,7 @@ export class WhatsappDirectLine extends GBService {
break;
case 'maytapi':
options = {}; // TODO: Code Maytapi.
break;
throw GBError.create('Sending audio in Maytapi not supported.');
}
if (options) {
@ -920,8 +914,6 @@ export class WhatsappDirectLine extends GBService {
await fetch(url, options);
} catch (error) {
GBLog.error(`Error sending message to Whatsapp provider ${error.message}`);
// TODO: Handle Error: socket hang up and retry.
}
}
}

View file

@ -127,7 +127,6 @@ export class GBServer {
if (proxy !== undefined) {
GBServer.globals.publicAddress = proxy;
} else {
// Ensure that local development proxy is setup.
GBLog.info(`Establishing a development local proxy (ngrok)...`);
@ -224,15 +223,15 @@ export class GBServer {
const loggers = GBLog.getLogger();
winston.default(server, loggers[1]);
}
GBLog.info(`The Bot Server is in RUNNING mode...`);
// Opens Navigator.
// TODO: Config: core.openBrowserInDevelopment();
if (process.env.DEV_OPEN_BROWSER) {
core.openBrowserInDevelopment();
}
} catch (err) {
GBLog.error(`STOP: ${err.message ? err.message : err} ${err.stack ? err.stack : ''}`);
process.exit(1);
@ -240,7 +239,7 @@ export class GBServer {
})();
};
// TODO: Move to .gbot folder myown.com pointing to generalbots.ai/myown.
//
if (process.env.CERTIFICATE_PFX) {
const options1 = {