feat: generate pair for custom action event

This commit is contained in:
karishmas6
2024-06-08 00:12:41 +05:30
parent 03e5a1ed97
commit 13c9aeb89d

View File

@@ -276,5 +276,27 @@ export class WorkflowGenerator {
await this.addPairToWorkflowAndNotifyClient(pair, page);
};
public customAction = async (action: CustomActions, settings: any, page: Page) => {
const pair: WhereWhatPair = {
where: { url: this.getBestUrl(page.url())},
what: [{
action,
args: settings ? Array.isArray(settings) ? settings : [settings] : [],
}],
}
if (this.generatedData.lastUsedSelector) {
this.socket.emit('decision', {
pair, actionType: 'customAction',
lastData: {
selector: this.generatedData.lastUsedSelector,
action: this.generatedData.lastAction,
} });
} else {
await this.addPairToWorkflowAndNotifyClient(pair, page);
}
};
}