shared.js 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245
  1. import { nanoid } from 'nanoid';
  2. export const tasks = {
  3. trigger: {
  4. name: 'Trigger',
  5. description: 'Block where workflow will start executing',
  6. icon: 'riFlashlightLine',
  7. component: 'BlockBasic',
  8. editComponent: 'EditTrigger',
  9. category: 'general',
  10. inputs: 0,
  11. outputs: 1,
  12. allowedInputs: true,
  13. maxConnection: 1,
  14. refDataKeys: ['url'],
  15. data: {
  16. disableBlock: false,
  17. description: '',
  18. type: 'manual',
  19. interval: 60,
  20. delay: 5,
  21. date: '',
  22. time: '00:00',
  23. url: '',
  24. shortcut: '',
  25. activeInInput: false,
  26. isUrlRegex: false,
  27. days: [],
  28. contextMenuName: '',
  29. contextTypes: [],
  30. observeElement: {
  31. selector: '',
  32. baseSelector: '',
  33. matchPattern: '',
  34. targetOptions: {
  35. subtree: false,
  36. childList: true,
  37. attributes: false,
  38. attributeFilter: [],
  39. characterData: false,
  40. },
  41. baseElOptions: {
  42. subtree: false,
  43. childList: true,
  44. attributes: false,
  45. attributeFilter: [],
  46. characterData: false,
  47. },
  48. },
  49. },
  50. },
  51. 'execute-workflow': {
  52. name: 'Execute workflow',
  53. description: '',
  54. icon: 'riFlowChart',
  55. component: 'BlockBasic',
  56. category: 'general',
  57. editComponent: 'EditExecuteWorkflow',
  58. inputs: 1,
  59. outputs: 1,
  60. allowedInputs: true,
  61. maxConnection: 1,
  62. refDataKeys: ['globalData'],
  63. data: {
  64. disableBlock: false,
  65. executeId: '',
  66. workflowId: '',
  67. globalData: '',
  68. description: '',
  69. },
  70. },
  71. 'active-tab': {
  72. name: 'Active tab',
  73. description: "Set current tab that you're in as an active tab",
  74. icon: 'riWindowLine',
  75. component: 'BlockBasic',
  76. category: 'browser',
  77. disableEdit: true,
  78. inputs: 1,
  79. outputs: 1,
  80. allowedInputs: true,
  81. maxConnection: 1,
  82. data: {
  83. disableBlock: false,
  84. },
  85. },
  86. 'new-tab': {
  87. name: 'New tab',
  88. description: 'Create a new tab',
  89. icon: 'riGlobalLine',
  90. component: 'BlockBasic',
  91. editComponent: 'EditNewTab',
  92. category: 'browser',
  93. inputs: 1,
  94. outputs: 1,
  95. allowedInputs: true,
  96. maxConnection: 1,
  97. refDataKeys: ['url'],
  98. data: {
  99. disableBlock: false,
  100. description: '',
  101. url: '',
  102. userAgent: '',
  103. active: true,
  104. inGroup: false,
  105. waitTabLoaded: false,
  106. updatePrevTab: false,
  107. customUserAgent: false,
  108. },
  109. },
  110. 'switch-tab': {
  111. name: 'Switch tab',
  112. description: 'Switch active tab',
  113. icon: 'riArrowLeftRightLine',
  114. component: 'BlockBasic',
  115. editComponent: 'EditSwitchTab',
  116. category: 'browser',
  117. inputs: 1,
  118. outputs: 1,
  119. allowedInputs: true,
  120. maxConnection: 1,
  121. refDataKeys: ['url', 'matchPattern'],
  122. data: {
  123. disableBlock: false,
  124. description: '',
  125. url: '',
  126. matchPattern: '',
  127. createIfNoMatch: false,
  128. },
  129. },
  130. 'new-window': {
  131. name: 'New window',
  132. description: 'Create a new window',
  133. icon: 'riWindow2Line',
  134. component: 'BlockBasic',
  135. editComponent: 'EditNewWindow',
  136. category: 'browser',
  137. inputs: 1,
  138. outputs: 1,
  139. allowedInputs: true,
  140. maxConnection: 1,
  141. data: {
  142. disableBlock: false,
  143. description: '',
  144. top: 0,
  145. left: 0,
  146. width: 0,
  147. height: 0,
  148. incognito: false,
  149. windowState: 'normal',
  150. },
  151. },
  152. proxy: {
  153. name: 'Proxy',
  154. description: 'Set the proxy of the browser',
  155. icon: 'riShieldKeyholeLine',
  156. component: 'BlockBasic',
  157. category: 'browser',
  158. editComponent: 'EditProxy',
  159. inputs: 1,
  160. outputs: 1,
  161. maxConnection: 1,
  162. allowedInputs: true,
  163. refDataKeys: ['host', 'port', 'scheme'],
  164. data: {
  165. description: '',
  166. disableBlock: false,
  167. scheme: 'https',
  168. host: '',
  169. port: 443,
  170. bypassList: '',
  171. clearProxy: false,
  172. },
  173. },
  174. 'go-back': {
  175. name: 'Go back',
  176. description: 'Go back to the previous page',
  177. icon: 'riArrowGoBackLine',
  178. component: 'BlockBasic',
  179. category: 'browser',
  180. inputs: 1,
  181. outputs: 1,
  182. maxConnection: 1,
  183. disableEdit: true,
  184. allowedInputs: true,
  185. data: {
  186. disableBlock: false,
  187. },
  188. },
  189. 'forward-page': {
  190. name: 'Go forward',
  191. description: 'Go forward to the next page',
  192. icon: 'riArrowGoForwardLine',
  193. component: 'BlockBasic',
  194. category: 'browser',
  195. inputs: 1,
  196. outputs: 1,
  197. maxConnection: 1,
  198. disableEdit: true,
  199. allowedInputs: true,
  200. data: {
  201. disableBlock: false,
  202. },
  203. },
  204. 'close-tab': {
  205. name: 'Close tab/window',
  206. icon: 'riCloseCircleLine',
  207. component: 'BlockBasic',
  208. category: 'browser',
  209. editComponent: 'EditCloseTab',
  210. inputs: 1,
  211. outputs: 1,
  212. maxConnection: 1,
  213. allowedInputs: true,
  214. refDataKeys: ['url'],
  215. data: {
  216. disableBlock: false,
  217. url: '',
  218. description: '',
  219. activeTab: true,
  220. closeType: 'tab',
  221. allWindows: false,
  222. },
  223. },
  224. 'take-screenshot': {
  225. name: 'Take screenshot',
  226. description: 'Take a screenshot of current active tab',
  227. icon: 'riImageLine',
  228. component: 'BlockBasic',
  229. category: 'browser',
  230. editComponent: 'EditTakeScreenshot',
  231. inputs: 1,
  232. outputs: 1,
  233. maxConnection: 1,
  234. allowedInputs: true,
  235. refDataKeys: ['fileName'],
  236. autocomplete: ['variableName'],
  237. data: {
  238. description: '',
  239. disableBlock: false,
  240. fileName: '',
  241. ext: 'png',
  242. quality: 100,
  243. dataColumn: '',
  244. variableName: '',
  245. selector: '',
  246. fullPage: false,
  247. saveToColumn: false,
  248. saveToComputer: true,
  249. assignVariable: false,
  250. captureActiveTab: true,
  251. },
  252. },
  253. 'browser-event': {
  254. name: 'Browser event',
  255. description: 'Wait until the selected event is triggered',
  256. icon: 'riLightbulbLine',
  257. component: 'BlockBasic',
  258. category: 'browser',
  259. editComponent: 'EditBrowserEvent',
  260. inputs: 1,
  261. outputs: 1,
  262. maxConnection: 1,
  263. allowedInputs: true,
  264. data: {
  265. disableBlock: false,
  266. description: '',
  267. timeout: 10000,
  268. eventName: 'tab:loaded',
  269. setAsActiveTab: true,
  270. activeTabLoaded: true,
  271. tabLoadedUrl: '',
  272. tabUrl: '',
  273. fileQuery: '',
  274. },
  275. },
  276. 'event-click': {
  277. name: 'Click element',
  278. icon: 'riCursorLine',
  279. component: 'BlockBasic',
  280. editComponent: 'EditInteractionBase',
  281. category: 'interaction',
  282. inputs: 1,
  283. outputs: 1,
  284. allowedInputs: true,
  285. maxConnection: 1,
  286. refDataKeys: ['selector'],
  287. data: {
  288. disableBlock: false,
  289. description: '',
  290. findBy: 'cssSelector',
  291. waitForSelector: false,
  292. waitSelectorTimeout: 5000,
  293. selector: '',
  294. markEl: false,
  295. multiple: false,
  296. },
  297. },
  298. delay: {
  299. name: 'Delay',
  300. description: 'Add delay before executing the next block',
  301. icon: 'riTimerLine',
  302. component: 'BlockDelay',
  303. editComponent: 'EditDelay',
  304. category: 'general',
  305. inputs: 1,
  306. outputs: 1,
  307. allowedInputs: true,
  308. maxConnection: 1,
  309. refDataKeys: ['time'],
  310. data: {
  311. disableBlock: false,
  312. time: 500,
  313. },
  314. },
  315. 'get-text': {
  316. name: 'Get text',
  317. description: 'Get text from an element',
  318. icon: 'riParagraph',
  319. component: 'BlockBasic',
  320. editComponent: 'EditGetText',
  321. category: 'interaction',
  322. inputs: 1,
  323. outputs: 1,
  324. allowedInputs: true,
  325. maxConnection: 1,
  326. refDataKeys: ['selector', 'prefixText', 'suffixText', 'extraRowValue'],
  327. autocomplete: ['variableName'],
  328. data: {
  329. disableBlock: false,
  330. description: '',
  331. findBy: 'cssSelector',
  332. waitForSelector: false,
  333. waitSelectorTimeout: 5000,
  334. selector: '',
  335. markEl: false,
  336. multiple: false,
  337. regex: '',
  338. prefixText: '',
  339. suffixText: '',
  340. regexExp: ['g'],
  341. dataColumn: '',
  342. saveData: true,
  343. includeTags: false,
  344. addExtraRow: false,
  345. assignVariable: false,
  346. variableName: '',
  347. extraRowValue: '',
  348. extraRowDataColumn: '',
  349. },
  350. },
  351. 'export-data': {
  352. name: 'Export data',
  353. icon: 'riDownloadLine',
  354. component: 'BlockBasic',
  355. editComponent: 'EditExportData',
  356. category: 'general',
  357. inputs: 1,
  358. outputs: 1,
  359. allowedInputs: true,
  360. maxConnection: 1,
  361. refDataKeys: ['name'],
  362. data: {
  363. disableBlock: false,
  364. name: '',
  365. refKey: '',
  366. type: 'json',
  367. description: '',
  368. variableName: '',
  369. addBOMHeader: true,
  370. onConflict: 'uniquify',
  371. dataToExport: 'data-columns',
  372. },
  373. },
  374. 'element-scroll': {
  375. name: 'Scroll element',
  376. icon: 'riMouseLine',
  377. component: 'BlockBasic',
  378. editComponent: 'EditScrollElement',
  379. category: 'interaction',
  380. inputs: 1,
  381. outputs: 1,
  382. allowedInputs: true,
  383. maxConnection: 1,
  384. refDataKeys: ['selector'],
  385. data: {
  386. disableBlock: false,
  387. description: '',
  388. findBy: 'cssSelector',
  389. waitForSelector: false,
  390. waitSelectorTimeout: 5000,
  391. selector: 'html',
  392. markEl: false,
  393. multiple: false,
  394. scrollY: 0,
  395. scrollX: 0,
  396. incX: false,
  397. incY: false,
  398. smooth: false,
  399. scrollIntoView: false,
  400. },
  401. },
  402. link: {
  403. name: 'Link',
  404. description: 'Open link element',
  405. icon: 'riLink',
  406. component: 'BlockBasic',
  407. editComponent: 'EditInteractionBase',
  408. category: 'interaction',
  409. inputs: 1,
  410. outputs: 1,
  411. allowedInputs: true,
  412. maxConnection: 1,
  413. refDataKeys: ['selector'],
  414. data: {
  415. disableBlock: false,
  416. description: '',
  417. findBy: 'cssSelector',
  418. waitForSelector: false,
  419. waitSelectorTimeout: 5000,
  420. selector: '',
  421. markEl: false,
  422. disableMultiple: true,
  423. },
  424. },
  425. 'attribute-value': {
  426. name: 'Attribute value',
  427. description: 'Get attribute value of an element',
  428. icon: 'riBracketsLine',
  429. component: 'BlockBasic',
  430. editComponent: 'EditAttributeValue',
  431. category: 'interaction',
  432. inputs: 1,
  433. outputs: 1,
  434. allowedInputs: true,
  435. maxConnection: 1,
  436. refDataKeys: ['selector', 'attributeName', 'extraRowValue'],
  437. autocomplete: ['variableName'],
  438. data: {
  439. disableBlock: false,
  440. description: '',
  441. findBy: 'cssSelector',
  442. waitForSelector: false,
  443. waitSelectorTimeout: 5000,
  444. selector: '',
  445. markEl: false,
  446. multiple: false,
  447. attributeName: '',
  448. assignVariable: false,
  449. variableName: '',
  450. dataColumn: '',
  451. saveData: true,
  452. addExtraRow: false,
  453. extraRowValue: '',
  454. extraRowDataColumn: '',
  455. },
  456. },
  457. forms: {
  458. name: 'Forms',
  459. icon: 'riInputCursorMove',
  460. description: 'Manipulate form(input, select, checkbox, and radio) element',
  461. component: 'BlockBasic',
  462. editComponent: 'EditForms',
  463. category: 'interaction',
  464. inputs: 1,
  465. outputs: 1,
  466. allowedInputs: true,
  467. maxConnection: 1,
  468. refDataKeys: ['selector', 'value'],
  469. autocomplete: ['variableName'],
  470. data: {
  471. disableBlock: false,
  472. description: '',
  473. findBy: 'cssSelector',
  474. waitForSelector: false,
  475. waitSelectorTimeout: 5000,
  476. selector: '',
  477. markEl: false,
  478. multiple: false,
  479. selected: true,
  480. clearValue: true,
  481. getValue: false,
  482. saveData: false,
  483. dataColumn: '',
  484. assignVariable: false,
  485. variableName: '',
  486. type: 'text-field',
  487. value: '',
  488. delay: 0,
  489. events: [],
  490. },
  491. },
  492. 'repeat-task': {
  493. name: 'Repeat task',
  494. icon: 'riRepeat2Line',
  495. component: 'BlockRepeatTask',
  496. category: 'general',
  497. inputs: 1,
  498. outputs: 2,
  499. allowedInputs: true,
  500. maxConnection: 1,
  501. data: {
  502. disableBlock: false,
  503. repeatFor: 1,
  504. },
  505. },
  506. 'javascript-code': {
  507. name: 'JavaScript code',
  508. description: 'Execute your custom javascript code in a webpage',
  509. icon: 'riCodeSSlashLine',
  510. component: 'BlockBasic',
  511. editComponent: 'EditJavascriptCode',
  512. category: 'interaction',
  513. inputs: 1,
  514. outputs: 1,
  515. allowedInputs: true,
  516. maxConnection: 1,
  517. data: {
  518. disableBlock: false,
  519. description: '',
  520. timeout: 20000,
  521. code: 'console.log("Hello world!");\nautomaNextBlock()',
  522. preloadScripts: [],
  523. everyNewTab: false,
  524. },
  525. },
  526. 'trigger-event': {
  527. name: 'Trigger event',
  528. description: 'Trigger event',
  529. icon: 'riLightbulbFlashLine',
  530. component: 'BlockBasic',
  531. editComponent: 'EditTriggerEvent',
  532. category: 'interaction',
  533. inputs: 1,
  534. outputs: 1,
  535. allowedInputs: true,
  536. maxConnection: 1,
  537. refDataKeys: ['selector', 'eventParams.clientX', 'eventParams.clientY'],
  538. data: {
  539. disableBlock: false,
  540. description: '',
  541. findBy: 'cssSelector',
  542. waitForSelector: false,
  543. waitSelectorTimeout: 5000,
  544. selector: 'html',
  545. markEl: false,
  546. multiple: false,
  547. eventName: '',
  548. eventType: '',
  549. eventParams: { bubbles: true, cancelable: false },
  550. },
  551. },
  552. 'google-sheets': {
  553. name: 'Google sheets',
  554. description: 'Read Google Sheets data',
  555. icon: 'mdiGoogleSheet',
  556. component: 'BlockBasic',
  557. editComponent: 'EditGoogleSheets',
  558. category: 'onlineServices',
  559. inputs: 1,
  560. outputs: 1,
  561. allowedInputs: true,
  562. maxConnection: 1,
  563. refDataKeys: ['customData', 'range', 'spreadsheetId'],
  564. autocomplete: ['refKey'],
  565. data: {
  566. disableBlock: false,
  567. range: '',
  568. refKey: '',
  569. type: 'get',
  570. customData: '',
  571. description: '',
  572. spreadsheetId: '',
  573. dataColumn: '',
  574. saveData: true,
  575. assignVariable: false,
  576. variableName: '',
  577. firstRowAsKey: false,
  578. keysAsFirstRow: true,
  579. valueInputOption: 'RAW',
  580. InsertDataOption: 'INSERT_ROWS',
  581. dataFrom: 'data-columns',
  582. },
  583. },
  584. conditions: {
  585. name: 'Conditions',
  586. description: 'Conditional block',
  587. icon: 'riAB',
  588. component: 'BlockConditions',
  589. editComponent: 'EditConditions',
  590. category: 'conditions',
  591. inputs: 1,
  592. outputs: 0,
  593. allowedInputs: true,
  594. maxConnection: 1,
  595. data: {
  596. disableBlock: false,
  597. conditions: [],
  598. retryConditions: false,
  599. retryCount: 10,
  600. retryTimeout: 1000,
  601. },
  602. },
  603. 'element-exists': {
  604. name: 'Element exists',
  605. description: 'Check if an element is exists',
  606. icon: 'riFocus3Line',
  607. component: 'BlockElementExists',
  608. editComponent: 'EditElementExists',
  609. category: 'conditions',
  610. inputs: 1,
  611. outputs: 2,
  612. allowedInputs: true,
  613. maxConnection: 1,
  614. refDataKeys: ['selector'],
  615. data: {
  616. disableBlock: false,
  617. description: '',
  618. findBy: 'cssSelector',
  619. selector: '',
  620. tryCount: 1,
  621. timeout: 500,
  622. markEl: false,
  623. throwError: false,
  624. },
  625. },
  626. webhook: {
  627. name: 'HTTP Request',
  628. description: 'make an HTTP request',
  629. icon: 'riEarthLine',
  630. component: 'BlockBasicWithFallback',
  631. editComponent: 'EditWebhook',
  632. category: 'general',
  633. inputs: 1,
  634. outputs: 2,
  635. allowedInputs: true,
  636. maxConnection: 1,
  637. refDataKeys: ['body', 'url'],
  638. autocomplete: ['variableName'],
  639. data: {
  640. disableBlock: false,
  641. description: '',
  642. url: '',
  643. body: '{}',
  644. headers: [],
  645. method: 'POST',
  646. timeout: 10000,
  647. dataPath: '',
  648. contentType: 'json',
  649. variableName: '',
  650. assignVariable: false,
  651. saveData: false,
  652. dataColumn: '',
  653. responseType: 'json',
  654. },
  655. },
  656. 'while-loop': {
  657. name: 'While loop',
  658. description: 'Execute blocks while the condition is met',
  659. icon: 'riRefreshFill',
  660. component: 'BlockBasicWithFallback',
  661. editComponent: 'EditWhileLoop',
  662. category: 'general',
  663. inputs: 1,
  664. outputs: 2,
  665. allowedInputs: true,
  666. maxConnection: 1,
  667. data: {
  668. disableBlock: false,
  669. description: '',
  670. conditions: null,
  671. },
  672. },
  673. 'loop-data': {
  674. name: 'Loop data',
  675. icon: 'riRefreshLine',
  676. component: 'BlockBasic',
  677. editComponent: 'EditLoopData',
  678. category: 'general',
  679. inputs: 1,
  680. outputs: 1,
  681. allowedInputs: true,
  682. maxConnection: 1,
  683. refDataKeys: [
  684. 'loopData',
  685. 'variableName',
  686. 'referenceKey',
  687. 'elementSelector',
  688. ],
  689. autocomplete: ['variableName', 'loopId', 'maxLoop'],
  690. data: {
  691. disableBlock: false,
  692. loopId: '',
  693. maxLoop: 0,
  694. toNumber: 10,
  695. fromNumber: 1,
  696. startIndex: 0,
  697. loopData: '[]',
  698. description: '',
  699. variableName: '',
  700. referenceKey: '',
  701. elementSelector: '',
  702. resumeLastWorkflow: false,
  703. loopThrough: 'data-columns',
  704. },
  705. },
  706. 'loop-breakpoint': {
  707. name: 'Loop breakpoint',
  708. description: 'To tell where loop data must stop',
  709. icon: 'riStopLine',
  710. component: 'BlockLoopBreakpoint',
  711. category: 'general',
  712. disableEdit: true,
  713. inputs: 1,
  714. outputs: 1,
  715. allowedInputs: true,
  716. maxConnection: 1,
  717. data: {
  718. disableBlock: false,
  719. loopId: '',
  720. },
  721. },
  722. 'blocks-group': {
  723. name: 'Blocks group',
  724. description: 'Grouping blocks',
  725. icon: 'riFolderZipLine',
  726. component: 'BlockGroup',
  727. category: 'general',
  728. disableEdit: true,
  729. inputs: 1,
  730. outputs: 1,
  731. allowedInputs: true,
  732. maxConnection: 1,
  733. data: {
  734. disableBlock: false,
  735. name: '',
  736. blocks: [],
  737. },
  738. },
  739. clipboard: {
  740. name: 'Clipboard',
  741. description: 'Get the copied text from the clipboard',
  742. icon: 'riClipboardLine',
  743. component: 'BlockBasic',
  744. category: 'general',
  745. editComponent: 'EditClipboard',
  746. inputs: 1,
  747. outputs: 1,
  748. allowedInputs: true,
  749. maxConnection: 1,
  750. autocomplete: ['variableName'],
  751. data: {
  752. disableBlock: false,
  753. description: '',
  754. assignVariable: false,
  755. variableName: '',
  756. saveData: true,
  757. dataColumn: '',
  758. },
  759. },
  760. 'insert-data': {
  761. name: 'Insert data',
  762. description: 'Insert data into table or variable',
  763. icon: 'riDatabase2Line',
  764. component: 'BlockBasic',
  765. category: 'general',
  766. editComponent: 'EditInsertData',
  767. inputs: 1,
  768. outputs: 1,
  769. allowedInputs: true,
  770. maxConnection: 1,
  771. data: {
  772. disableBlock: false,
  773. description: '',
  774. dataList: [],
  775. },
  776. },
  777. 'switch-to': {
  778. name: 'Switch frame',
  779. description: 'Switch between main window and iframe',
  780. icon: 'riArrowUpDownLine',
  781. component: 'BlockBasic',
  782. editComponent: 'EditSwitchTo',
  783. category: 'interaction',
  784. inputs: 1,
  785. outputs: 1,
  786. allowedInputs: true,
  787. maxConnection: 1,
  788. refDataKeys: ['selector'],
  789. data: {
  790. disableBlock: false,
  791. findBy: 'cssSelector',
  792. selector: '',
  793. windowType: 'main-window',
  794. },
  795. },
  796. 'upload-file': {
  797. name: 'Upload file',
  798. description: 'Upload file into <input type="file"> element',
  799. icon: 'riFileUploadLine',
  800. component: 'BlockBasic',
  801. editComponent: 'EditUploadFile',
  802. category: 'interaction',
  803. inputs: 1,
  804. outputs: 1,
  805. allowedInputs: true,
  806. maxConnection: 1,
  807. refDataKeys: ['selector', 'filePaths'],
  808. data: {
  809. disableBlock: false,
  810. findBy: 'cssSelector',
  811. waitForSelector: false,
  812. waitSelectorTimeout: 5000,
  813. selector: '',
  814. filePaths: [],
  815. },
  816. },
  817. 'hover-element': {
  818. name: 'Hover element',
  819. description: 'Hover over an element',
  820. icon: 'mdiCursorDefaultClickOutline',
  821. component: 'BlockBasic',
  822. editComponent: 'EditInteractionBase',
  823. category: 'interaction',
  824. inputs: 1,
  825. outputs: 1,
  826. allowedInputs: true,
  827. maxConnection: 1,
  828. refDataKeys: ['selector'],
  829. data: {
  830. disableBlock: false,
  831. description: '',
  832. findBy: 'cssSelector',
  833. waitForSelector: false,
  834. waitSelectorTimeout: 5000,
  835. selector: '',
  836. markEl: false,
  837. multiple: false,
  838. },
  839. },
  840. 'save-assets': {
  841. name: 'Save assets',
  842. description:
  843. 'Save assets (image, video, audio, or file) from an element or URL',
  844. icon: 'riImageLine',
  845. component: 'BlockBasic',
  846. editComponent: 'EditSaveAssets',
  847. category: 'interaction',
  848. inputs: 1,
  849. outputs: 1,
  850. allowedInputs: true,
  851. maxConnection: 1,
  852. refDataKeys: ['selector', 'url', 'filename'],
  853. data: {
  854. disableBlock: false,
  855. description: '',
  856. findBy: 'cssSelector',
  857. waitForSelector: false,
  858. waitSelectorTimeout: 5000,
  859. selector: '',
  860. markEl: false,
  861. multiple: false,
  862. type: 'element',
  863. url: '',
  864. filename: '',
  865. onConflict: 'uniquify',
  866. },
  867. },
  868. 'press-key': {
  869. name: 'Press key',
  870. description: 'Press a key or a combination',
  871. icon: 'riKeyboardLine',
  872. component: 'BlockBasic',
  873. editComponent: 'EditPressKey',
  874. category: 'interaction',
  875. inputs: 1,
  876. outputs: 1,
  877. allowedInputs: true,
  878. maxConnection: 1,
  879. refDataKeys: ['selector', 'keys'],
  880. data: {
  881. disableBlock: false,
  882. keys: '',
  883. selector: '',
  884. description: '',
  885. },
  886. },
  887. 'handle-dialog': {
  888. name: 'Handle dialog',
  889. description:
  890. 'Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload).',
  891. icon: 'riChat3Line',
  892. component: 'BlockBasic',
  893. editComponent: 'EditHandleDialog',
  894. category: 'browser',
  895. inputs: 1,
  896. outputs: 1,
  897. allowedInputs: true,
  898. maxConnection: 1,
  899. refDataKeys: ['promptText'],
  900. data: {
  901. disableBlock: false,
  902. description: '',
  903. accept: true,
  904. promptText: '',
  905. },
  906. },
  907. 'handle-download': {
  908. name: 'Handle download',
  909. description: 'Handle downloaded file',
  910. icon: 'riFileDownloadLine',
  911. component: 'BlockBasic',
  912. editComponent: 'EditHandleDownload',
  913. category: 'browser',
  914. inputs: 1,
  915. outputs: 1,
  916. allowedInputs: true,
  917. maxConnection: 1,
  918. refDataKeys: ['filename'],
  919. autocomplete: ['variableName'],
  920. data: {
  921. disableBlock: false,
  922. description: '',
  923. filename: '',
  924. timeout: 20000,
  925. onConflict: 'uniquify',
  926. waitForDownload: true,
  927. dataColumn: '',
  928. saveData: true,
  929. assignVariable: false,
  930. variableName: '',
  931. },
  932. },
  933. 'reload-tab': {
  934. name: 'Reload tab',
  935. description: 'Reload the active tab',
  936. icon: 'riRestartLine',
  937. component: 'BlockBasic',
  938. category: 'browser',
  939. inputs: 1,
  940. outputs: 1,
  941. allowedInputs: true,
  942. maxConnection: 1,
  943. disableEdit: true,
  944. data: {
  945. disableBlock: false,
  946. },
  947. },
  948. 'delete-data': {
  949. name: 'Delete data',
  950. description: 'Delete table or variable data',
  951. icon: 'riDeleteBin7Line',
  952. editComponent: 'EditDeleteData',
  953. component: 'BlockBasic',
  954. category: 'general',
  955. inputs: 1,
  956. outputs: 1,
  957. allowedInputs: true,
  958. maxConnection: 1,
  959. data: {
  960. disableBlock: false,
  961. description: '',
  962. deleteList: [],
  963. },
  964. },
  965. 'wait-connections': {
  966. name: 'Wait connections',
  967. description: 'Wait for all connections before continuing to the next block',
  968. icon: 'riTimerFlashLine',
  969. editComponent: 'EditWaitConnections',
  970. component: 'BlockBasic',
  971. category: 'general',
  972. inputs: 1,
  973. outputs: 1,
  974. allowedInputs: true,
  975. maxConnection: 1,
  976. data: {
  977. disableBlock: false,
  978. description: '',
  979. timeout: 10000,
  980. specificFlow: false,
  981. flowBlockId: '',
  982. },
  983. },
  984. notification: {
  985. name: 'Notification',
  986. description: 'Display a notification',
  987. icon: 'riNotification3Line',
  988. editComponent: 'EditNotification',
  989. component: 'BlockBasic',
  990. category: 'general',
  991. inputs: 1,
  992. outputs: 1,
  993. allowedInputs: true,
  994. maxConnection: 1,
  995. refDataKeys: ['message', 'title', 'iconUrl', 'imageUrl'],
  996. data: {
  997. disableBlock: false,
  998. description: '',
  999. message: '',
  1000. iconUrl: '',
  1001. imageUrl: '',
  1002. title: 'Hello world!',
  1003. },
  1004. },
  1005. };
  1006. export const categories = {
  1007. interaction: {
  1008. name: 'Web interaction',
  1009. color: 'bg-green-200 dark:bg-green-300',
  1010. },
  1011. browser: {
  1012. name: 'Browser',
  1013. color: 'bg-orange-200 dark:bg-orange-300',
  1014. },
  1015. general: {
  1016. name: 'General',
  1017. color: 'bg-yellow-200 dark:bg-yellow-300',
  1018. },
  1019. onlineServices: {
  1020. name: 'Online services',
  1021. color: 'bg-red-200 dark:bg-red-300',
  1022. },
  1023. conditions: {
  1024. name: 'Conditions',
  1025. color: 'bg-blue-200 dark:bg-blue-300',
  1026. },
  1027. };
  1028. export const eventList = [
  1029. { id: 'click', name: 'Click', type: 'mouse-event' },
  1030. { id: 'dblclick', name: 'Double Click', type: 'mouse-event' },
  1031. { id: 'mouseup', name: 'Mouseup', type: 'mouse-event' },
  1032. { id: 'mousedown', name: 'Mousedown', type: 'mouse-event' },
  1033. { id: 'mouseenter', name: 'Mouseenter', type: 'mouse-event' },
  1034. { id: 'mouseleave', name: 'Mouseleave', type: 'mouse-event' },
  1035. { id: 'mouseover', name: 'Mouseover', type: 'mouse-event' },
  1036. { id: 'mouseout', name: 'Mouseout', type: 'mouse-event' },
  1037. { id: 'mousemove', name: 'Mousemove', type: 'mouse-event' },
  1038. { id: 'focus', name: 'Focus', type: 'focus-event' },
  1039. { id: 'blur', name: 'Blur', type: 'focus-event' },
  1040. { id: 'input', name: 'Input', type: 'input-event' },
  1041. { id: 'change', name: 'Change', type: 'event' },
  1042. { id: 'touchstart', name: 'Touch start', type: 'touch-event' },
  1043. { id: 'touchend', name: 'Touch end', type: 'touch-event' },
  1044. { id: 'touchmove', name: 'Touch move', type: 'touch-event' },
  1045. { id: 'touchcancel', name: 'Touch cancel', type: 'touch-event' },
  1046. { id: 'keydown', name: 'Keydown', type: 'keyboard-event' },
  1047. { id: 'keyup', name: 'Keyup', type: 'keyboard-event' },
  1048. { id: 'submit', name: 'Submit', type: 'submit-event' },
  1049. { id: 'wheel', name: 'Wheel', type: 'wheel-event' },
  1050. ];
  1051. export const dataExportTypes = [
  1052. { name: 'JSON', id: 'json' },
  1053. { name: 'CSV', id: 'csv' },
  1054. { name: 'Plain text', id: 'plain-text' },
  1055. ];
  1056. export const firstWorkflows = [
  1057. {
  1058. id: nanoid(),
  1059. name: 'Google search',
  1060. createdAt: Date.now(),
  1061. drawflow: `{"drawflow":{"Home":{"data":{"d634ff22-5dfe-44dc-83d2-842412bd9fbf":{"id":"d634ff22-5dfe-44dc-83d2-842412bd9fbf","name":"trigger","data":{"type":"manual","interval":10},"class":"trigger","html":"BlockBasic","typenode":"vue","inputs":{},"outputs":{"output_1":{"connections":[{"node":"b9e7e0d4-e86a-4635-a352-31c63723fef4","output":"input_1"}]}},"pos_x":50,"pos_y":300},"b9e7e0d4-e86a-4635-a352-31c63723fef4":{"id":"b9e7e0d4-e86a-4635-a352-31c63723fef4","name":"new-tab","data":{"url":"https://google.com","active":true},"class":"new-tab","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"d634ff22-5dfe-44dc-83d2-842412bd9fbf","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"09f3a14c-0514-4287-93b0-aa92b0064fba","output":"input_1"}]}},"pos_x":278,"pos_y":268},"09f3a14c-0514-4287-93b0-aa92b0064fba":{"id":"09f3a14c-0514-4287-93b0-aa92b0064fba","name":"forms","data":{"description":"Type query","selector":"[name='q']","markEl":false,"multiple":false,"selected":true,"type":"text-field","value":"Automa Extension","delay":"120","events":[]},"class":"forms","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"b9e7e0d4-e86a-4635-a352-31c63723fef4","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"5f76370d-aa3d-4258-8319-230fcfc49a3a","output":"input_1"}]}},"pos_x":551,"pos_y":290},"5f76370d-aa3d-4258-8319-230fcfc49a3a":{"id":"5f76370d-aa3d-4258-8319-230fcfc49a3a","name":"event-click","data":{"description":"Click search","selector":"center:nth-child(1) > .gNO89b","markEl":false,"multiple":false},"class":"event-click","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"09f3a14c-0514-4287-93b0-aa92b0064fba","input":"output_1"}]}},"outputs":{"output_1":{"connections":[]}},"pos_x":794,"pos_y":308}}}}}`,
  1062. },
  1063. {
  1064. id: nanoid(),
  1065. name: 'Generate lorem ipsum',
  1066. createdAt: Date.now(),
  1067. drawflow:
  1068. '{"drawflow":{"Home":{"data":{"c5774692-0be4-457f-82be-d5e4b3344ad7":{"id":"c5774692-0be4-457f-82be-d5e4b3344ad7","name":"trigger","data":{"disableBlock":false,"description":"","type":"manual","interval":60,"delay":5,"date":"","time":"00:00","url":"","shortcut":"","activeInInput":false,"isUrlRegex":false,"days":[]},"class":"trigger","html":"BlockBasic","typenode":"vue","inputs":{},"outputs":{"output_1":{"connections":[{"node":"10a0429e-b8c4-4c04-9ea3-df169cea78e4","output":"input_1"}]}},"pos_x":50,"pos_y":300},"10a0429e-b8c4-4c04-9ea3-df169cea78e4":{"id":"10a0429e-b8c4-4c04-9ea3-df169cea78e4","name":"new-tab","data":{"disableBlock":false,"description":"","url":"http://lipsum.com","userAgent":"","active":true,"inGroup":false,"waitTabLoaded":false,"updatePrevTab":true,"customUserAgent":false},"class":"new-tab","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"c5774692-0be4-457f-82be-d5e4b3344ad7","input":"output_1"},{"node":"2f5fec61-a318-4e2b-b7d3-bc7328bd282c","input":"output_2"}]}},"outputs":{"output_1":{"connections":[{"node":"24bdec44-1e80-4cee-9139-00545b8d33d9","output":"input_1"}]}},"pos_x":285,"pos_y":282},"df24edcc-4c29-49f5-8a29-0e572a4bc6ae":{"id":"df24edcc-4c29-49f5-8a29-0e572a4bc6ae","name":"delay","data":{"time":"1000"},"class":"delay","html":"BlockDelay","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"24bdec44-1e80-4cee-9139-00545b8d33d9","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"2d93c1de-42ca-4f39-8e61-e3e55529fbba","output":"input_1"}]}},"pos_x":833,"pos_y":297},"24bdec44-1e80-4cee-9139-00545b8d33d9":{"id":"24bdec44-1e80-4cee-9139-00545b8d33d9","name":"element-scroll","data":{"disableBlock":false,"description":"","findBy":"cssSelector","waitForSelector":false,"waitSelectorTimeout":5000,"selector":"#amount","markEl":false,"multiple":false,"scrollY":0,"scrollX":0,"incX":false,"incY":false,"smooth":true,"scrollIntoView":true},"class":"element-scroll","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"10a0429e-b8c4-4c04-9ea3-df169cea78e4","input":"output_1"},{"node":"2f5fec61-a318-4e2b-b7d3-bc7328bd282c","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"df24edcc-4c29-49f5-8a29-0e572a4bc6ae","output":"input_1"}]}},"pos_x":566,"pos_y":317},"2d93c1de-42ca-4f39-8e61-e3e55529fbba":{"id":"2d93c1de-42ca-4f39-8e61-e3e55529fbba","name":"forms","data":{"disableBlock":false,"description":"Lipsum length","findBy":"cssSelector","waitForSelector":false,"waitSelectorTimeout":5000,"selector":"#amount","markEl":false,"multiple":false,"selected":true,"clearValue":true,"getValue":false,"saveData":false,"dataColumn":"","assignVariable":false,"variableName":"","type":"text-field","value":"3","delay":0,"events":[]},"class":"forms","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"df24edcc-4c29-49f5-8a29-0e572a4bc6ae","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"0f3e2baa-8d6d-4323-8ac7-362f1be39ecb","output":"input_1"}]}},"pos_x":1058,"pos_y":327},"0f3e2baa-8d6d-4323-8ac7-362f1be39ecb":{"id":"0f3e2baa-8d6d-4323-8ac7-362f1be39ecb","name":"event-click","data":{"disableBlock":false,"description":"Generate button","findBy":"cssSelector","waitForSelector":false,"waitSelectorTimeout":5000,"selector":"#generate","markEl":false,"multiple":false},"class":"event-click","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"2d93c1de-42ca-4f39-8e61-e3e55529fbba","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"fb9be12f-8995-4876-8bfe-79323769474b","output":"input_1"}]}},"pos_x":1309,"pos_y":329},"fb9be12f-8995-4876-8bfe-79323769474b":{"id":"fb9be12f-8995-4876-8bfe-79323769474b","name":"delay","data":{"disableBlock":false,"time":2000},"class":"delay","html":"BlockDelay","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"0f3e2baa-8d6d-4323-8ac7-362f1be39ecb","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"7205fcf2-deda-445e-9690-4e36adb52585","output":"input_1"}]}},"pos_x":1566,"pos_y":310},"7205fcf2-deda-445e-9690-4e36adb52585":{"id":"7205fcf2-deda-445e-9690-4e36adb52585","name":"get-text","data":{"disableBlock":false,"description":"Get text result","findBy":"cssSelector","waitForSelector":false,"waitSelectorTimeout":5000,"selector":"#lipsum","markEl":false,"multiple":false,"regex":"","prefixText":"","suffixText":"","regexExp":["g","g"],"dataColumn":"","saveData":true,"includeTags":false,"addExtraRow":false,"assignVariable":false,"variableName":"","extraRowValue":"","extraRowDataColumn":""},"class":"get-text","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"fb9be12f-8995-4876-8bfe-79323769474b","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"3d3e8fac-97fa-4c3d-84bc-a3db18740184","output":"input_1"}]}},"pos_x":1823,"pos_y":337},"3d3e8fac-97fa-4c3d-84bc-a3db18740184":{"id":"3d3e8fac-97fa-4c3d-84bc-a3db18740184","name":"repeat-task","data":{"disableBlock":false,"repeatFor":2},"class":"repeat-task","html":"BlockRepeatTask","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"7205fcf2-deda-445e-9690-4e36adb52585","input":"output_1"}]}},"outputs":{"output_1":{"connections":[{"node":"4d39ecd5-f33f-4e57-b11d-2f26b1076334","output":"input_1"}]},"output_2":{"connections":[{"node":"2f5fec61-a318-4e2b-b7d3-bc7328bd282c","output":"input_1","points":[{"pos_x":2290.2500152587886,"pos_y":542.0000076293943},{"pos_x":1125.2500152587886,"pos_y":552.0000076293943}]}]}},"pos_x":2073,"pos_y":293.5},"2f5fec61-a318-4e2b-b7d3-bc7328bd282c":{"id":"2f5fec61-a318-4e2b-b7d3-bc7328bd282c","name":"go-back","data":{"disableBlock":false,"onError":{"retry":false,"enable":true,"retryTimes":1,"retryInterval":2,"toDo":"fallback"}},"class":"go-back","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"3d3e8fac-97fa-4c3d-84bc-a3db18740184","input":"output_2"}]}},"outputs":{"output_1":{"connections":[{"node":"24bdec44-1e80-4cee-9139-00545b8d33d9","output":"input_1","points":[{"pos_x":1305.2500152587886,"pos_y":829.5000076293943},{"pos_x":545.250015258789,"pos_y":834.499988555908}]}]},"output_2":{"connections":[{"node":"10a0429e-b8c4-4c04-9ea3-df169cea78e4","output":"input_1","points":[{"pos_x":1464.4999694824214,"pos_y":694.2499923706052},{"pos_x":1464.4999694824214,"pos_y":484.2499923706054},{"pos_x":266.99996948242176,"pos_y":464.2499923706054}]}]}},"pos_x":1135.5,"pos_y":628},"4d39ecd5-f33f-4e57-b11d-2f26b1076334":{"id":"4d39ecd5-f33f-4e57-b11d-2f26b1076334","name":"export-data","data":{"disableBlock":false,"name":"Lipsum","refKey":"","type":"plain-text","description":"","variableName":"","addBOMHeader":false,"onConflict":"uniquify","dataToExport":"data-columns"},"class":"export-data","html":"BlockBasic","typenode":"vue","inputs":{"input_1":{"connections":[{"node":"3d3e8fac-97fa-4c3d-84bc-a3db18740184","input":"output_1"}]}},"outputs":{"output_1":{"connections":[]}},"pos_x":2409.75,"pos_y":289}}}}}',
  1069. },
  1070. ];
  1071. export const workflowCategories = {
  1072. scrape: 'Scraping',
  1073. automation: 'Automation',
  1074. productivity: 'Productivity',
  1075. };
  1076. export const excludeOnError = [
  1077. 'delay',
  1078. 'webhook',
  1079. 'trigger',
  1080. 'while-loop',
  1081. 'conditions',
  1082. 'element-exists',
  1083. ];
  1084. export const contentTypes = [
  1085. { name: 'application/json', value: 'json' },
  1086. { name: 'application/x-www-form-urlencoded', value: 'form' },
  1087. ];
  1088. export const supportLocales = [
  1089. { id: 'en', name: 'English' },
  1090. { id: 'zh', name: '简体中文' },
  1091. { id: 'zh-tw', name: '繁體中文' },
  1092. { id: 'vi', name: 'Tiếng Việt' },
  1093. { id: 'fr', name: 'Français' },
  1094. ];
  1095. export const communities = [
  1096. {
  1097. name: 'GitHub',
  1098. icon: 'riGithubFill',
  1099. url: 'https://github.com/kholid060/automa',
  1100. },
  1101. {
  1102. name: 'Twitter',
  1103. icon: 'riTwitterLine',
  1104. url: 'https://twitter.com/AutomaApp',
  1105. },
  1106. {
  1107. name: 'Discord',
  1108. icon: 'riDiscordLine',
  1109. url: 'https://discord.gg/C6khwwTE84',
  1110. },
  1111. {
  1112. name: 'YouTube',
  1113. icon: 'riYoutubeLine',
  1114. url: 'https://www.youtube.com/channel/UCL3qU64hW0fsIj2vOayOQUQ',
  1115. },
  1116. ];
  1117. export const elementsHighlightData = {
  1118. selectedElements: {
  1119. stroke: '#2563EB',
  1120. activeStroke: '#f87171',
  1121. fill: 'rgba(37, 99, 235, 0.1)',
  1122. activeFill: 'rgba(248, 113, 113, 0.1)',
  1123. },
  1124. hoveredElements: {
  1125. stroke: '#fbbf24',
  1126. fill: 'rgba(251, 191, 36, 0.1)',
  1127. },
  1128. };
  1129. export const conditionBuilder = {
  1130. valueTypes: [
  1131. {
  1132. id: 'value',
  1133. category: 'value',
  1134. name: 'Value',
  1135. compareable: true,
  1136. data: { value: '' },
  1137. },
  1138. {
  1139. id: 'code',
  1140. category: 'value',
  1141. name: 'Code',
  1142. compareable: false,
  1143. data: { code: '\nreturn true;' },
  1144. },
  1145. {
  1146. id: 'element#text',
  1147. category: 'element',
  1148. name: 'Element text',
  1149. compareable: true,
  1150. data: { selector: '' },
  1151. },
  1152. {
  1153. id: 'element#exists',
  1154. category: 'element',
  1155. name: 'Element exists',
  1156. compareable: false,
  1157. data: { selector: '' },
  1158. },
  1159. {
  1160. id: 'element#notExists',
  1161. category: 'element',
  1162. name: 'Element not exists',
  1163. compareable: false,
  1164. data: { selector: '' },
  1165. },
  1166. {
  1167. id: 'element#visible',
  1168. category: 'element',
  1169. name: 'Element visible',
  1170. compareable: false,
  1171. data: { selector: '' },
  1172. },
  1173. {
  1174. id: 'element#visibleScreen',
  1175. category: 'element',
  1176. name: 'Element visible in screen',
  1177. compareable: false,
  1178. data: { selector: '' },
  1179. },
  1180. {
  1181. id: 'element#invisible',
  1182. category: 'element',
  1183. name: 'Element hidden in screen',
  1184. compareable: false,
  1185. data: { selector: '' },
  1186. },
  1187. {
  1188. id: 'element#attribute',
  1189. category: 'element',
  1190. name: 'Element attribute value',
  1191. compareable: true,
  1192. data: { selector: '', attrName: '' },
  1193. },
  1194. ],
  1195. compareTypes: [
  1196. { id: 'eq', name: 'Equals', needValue: true, category: 'basic' },
  1197. { id: 'nq', name: 'Not equals', needValue: true, category: 'basic' },
  1198. { id: 'gt', name: 'Greater than', needValue: true, category: 'number' },
  1199. {
  1200. id: 'gte',
  1201. name: 'Greater than or equal',
  1202. needValue: true,
  1203. category: 'number',
  1204. },
  1205. { id: 'lt', name: 'Less than', needValue: true, category: 'number' },
  1206. {
  1207. id: 'lte',
  1208. name: 'Less than or equal',
  1209. needValue: true,
  1210. category: 'number',
  1211. },
  1212. { id: 'cnt', name: 'Contains', needValue: true, category: 'text' },
  1213. { id: 'nct', name: 'Not contains', needValue: true, category: 'text' },
  1214. { id: 'stw', name: 'Starts with', needValue: true, category: 'text' },
  1215. { id: 'enw', name: 'Ends with', needValue: true, category: 'text' },
  1216. { id: 'itr', name: 'Is truthy', needValue: false, category: 'boolean' },
  1217. { id: 'ifl', name: 'Is falsy', needValue: false, category: 'boolean' },
  1218. ],
  1219. inputTypes: {
  1220. selector: {
  1221. placeholder: '.class',
  1222. label: 'CSS selector or XPath',
  1223. },
  1224. value: {
  1225. label: 'Value',
  1226. placeholder: 'abc123',
  1227. },
  1228. attrName: {
  1229. label: 'Attribute name',
  1230. placeholder: 'name',
  1231. },
  1232. },
  1233. };