Skip to content

Commit

Permalink
fix(basic.gblib): WA page bug removal.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Mar 3, 2023
1 parent 4314a37 commit d902e14
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
26 changes: 13 additions & 13 deletions packages/basic.gblib/services/DialogKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export class DialogKeywords {
*
* @example x = TODAY
*/
public async getToday({}) {
public async getToday({ }) {
let d = new Date(),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
Expand Down Expand Up @@ -264,28 +264,28 @@ export class DialogKeywords {
*
* @example EXIT
*/
public async exit({}) {}
public async exit({ }) { }

/**
* Get active tasks.
*
* @example list = ACTIVE TASKS
*/
public async getActiveTasks({ pid }) {}
public async getActiveTasks({ pid }) { }

/**
* Creates a new deal.
*
* @example CREATE DEAL dealname,contato,empresa,amount
*/
public async createDeal({ pid, dealName, contact, company, amount }) {}
public async createDeal({ pid, dealName, contact, company, amount }) { }

/**
* Finds contacts in XRM.
*
* @example list = FIND CONTACT "Sandra"
*/
public async fndContact({ pid, name }) {}
public async fndContact({ pid, name }) { }

public getContentLocaleWithCulture(contentLocale) {
switch (contentLocale) {
Expand Down Expand Up @@ -488,7 +488,7 @@ export class DialogKeywords {
* @example SAVE "contacts.xlsx", name, email, NOW
*
*/
public async getNow({}) {
public async getNow({ }) {
const contentLocale = this.min.core.getParam<string>(
this.min.instance,
'Default Content Language',
Expand Down Expand Up @@ -724,7 +724,7 @@ export class DialogKeywords {
* @example MENU
*
*/
public async showMenu({}) {
public async showMenu({ }) {
// https://github.com/GeneralBots/BotServer/issues/237
// return await beginDialog('/menu');
}
Expand Down Expand Up @@ -828,7 +828,7 @@ export class DialogKeywords {
const answer = min.cbMap[userId].promise;

if (kind === 'sheet') {

// Retrieves the .xlsx file associated with the HEAR var AS file.xlsx.

let { baseUrl, client } = await GBDeployer.internalGetDriveClient(this.min);
Expand Down Expand Up @@ -864,12 +864,11 @@ export class DialogKeywords {
let list = [];
for (; index < results.text.length; index++) {
if (results.text[index][0] !== '') {
list.push( results.text[index][0]);
list.push(results.text[index][0]);
}
else
{
else {
break;
}
}
}

// Search the answer in one of valid list items loaded from sheeet.
Expand Down Expand Up @@ -1121,7 +1120,7 @@ export class DialogKeywords {
/**
* Talks to the user by using the specified text.
*/
public async getTalk({ pid, text }) {
public async getTalk({ pid, text }): Promise<{ status: number }> {
GBLog.info(`BASIC: TALK '${text}'.`);
const { min, user } = await DialogKeywords.getProcessInfo(pid);

Expand All @@ -1130,6 +1129,7 @@ export class DialogKeywords {

await min.conversationalService['sendOnConversation'](min, user, text);
}
return { status: 0 };
}

private static getChannel(): string {
Expand Down
6 changes: 3 additions & 3 deletions packages/basic.gblib/services/KeywordsExpressions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class KeywordsExpressions {
/^\s*open\s*(.*)/gim,
($0, $1, $2) => {
let sessionName;
let kind = '';
let kind = null;
let pos;

if (pos = $1.match(/\s*AS\s*\#/)) {
Expand Down Expand Up @@ -655,7 +655,7 @@ export class KeywordsExpressions {
// page is not string.
// https://github.com/GeneralBots/BotServer/issues/310
const params = this.getParams('page,' + $3, ['handle', 'frameOrSelector', 'selector']);
return `await wa.click ({pid: pid, ${params}})`;
return `await wa.getClick ({pid: pid, ${params}})`;
}
];

Expand Down Expand Up @@ -764,7 +764,7 @@ export class KeywordsExpressions {
/^\s*set\s*(.*)/gim,
($0, $1, $2) => {
const params = this.getParams($1, ['file', 'address', 'value']);
return `await sys.set ({pid: pid, ${params}})`;
return `await sys.getSet ({pid: pid, handle:page, ${params}})`;
}
];
keywords[i++] = [
Expand Down
11 changes: 6 additions & 5 deletions packages/basic.gblib/services/SystemKeywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,15 @@ export class SystemKeywords {
* @example SET page, "elementHTMLSelector", "text"
*
*/
public async set({ pid, file, address, value }): Promise<any> {
public async getSet({ pid, page, file, address, value }): Promise<any> {
const { min, user } = await DialogKeywords.getProcessInfo(pid);

// Handles calls for HTML stuff

if (file._javascriptEnabled) {
const page = file;
GBLog.info(`BASIC: Web automation setting ${page}' to '${value}' (SET). `);
if (file.indexOf("#") != -1 ||
file.indexOf("[") != -1 ) {
value = address;
GBLog.info(`BASIC: Web automation setting ${file}' to '${value}' (SET). `);
await this.wa.setElementText({ page, selector: address, text: value });

return;
Expand Down Expand Up @@ -1694,7 +1695,7 @@ export class SystemKeywords {
const address = `${cell}:${cell}`;

if (value !== found[columnName]) {
await this.set({ pid, file, address, value });
await this.getSet({ pid, file, page:null, address, value });
merges++;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/basic.gblib/services/WebAutomationServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export class WebAutomationServices {
*
* @example CLICK page,"#idElement"
*/
public async click({ pid, handle, frameOrSelector, selector }) {
public async getClick({ pid, handle, frameOrSelector, selector }) {
const page = this.getPageByHandle(handle);
GBLog.info(`BASIC: Web Automation CLICK element: ${frameOrSelector}.`);
if (selector) {
Expand Down

0 comments on commit d902e14

Please sign in to comment.