import { DataFetcher } from "../../../../lib/http/data-fetcher/DataFetcher";
const SERVICE_ACTION_EXECUTE_SCRIPT = 'ActionButtonsSP.executeScript';
export default class JavascriptExecutor {
  execute(action) {
    var _a;
    const execSource = {
      actionID: action.actionID,
      refreshType: (_a = action.actionConfig.runScript) === null || _a === void 0 ? void 0 : _a.refreshType
    };
    return new Promise((resolve) => {
      resolve({ execSource, callback: this.callExecScript });
    });
  }
  async callExecScript(execSource) {
    const request = {
      runScript: execSource
    };
    await DataFetcher.get().callServiceBroker(SERVICE_ACTION_EXECUTE_SCRIPT, request);
  }
}
