@fluidgrids/fe-sdk 0.0.0-stage → 2026.1203.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +564 -2
- package/dist/ActivityOptionsFields-C2u-hY2U.js +142 -0
- package/dist/AiStudioPage-B_hNTj-_.js +1137 -0
- package/dist/ApprovalInboxPage-ClITra3n.js +1312 -0
- package/dist/ChoiceSelect-LkK-uS9J.js +65 -0
- package/dist/ConfirmActionDialog-DHWTDRbp.js +31 -0
- package/dist/ConnectionFormDialog-C0kDgcrZ.js +153 -0
- package/dist/CreateFluidgridsTagDocument-Dtp9KPLJ.js +1055 -0
- package/dist/DataSinkDashboardPage-b4ezeqa6.js +278 -0
- package/dist/DataTablesPage-C1d9YGHz.js +5575 -0
- package/dist/DateTimeField-B1qR4ruo.js +51 -0
- package/dist/Disclosure-BNKij7-v.js +45 -0
- package/dist/ElementLibraryPage-8jNO6YmE.js +2256 -0
- package/dist/ElementLibrarySequenceDocument-B-W8SPzn.js +3979 -0
- package/dist/EnsureThemeProvider-BvlNjAd0.js +24 -0
- package/dist/EntityTagBadge-1OlP6p0c.js +25 -0
- package/dist/EntityTagPicker-BBrU5cE0.js +137 -0
- package/dist/ExecuteStepDocument-B4j1mdRT.js +189 -0
- package/dist/ExecutionDetailDocument-D6QuM-kp.js +875 -0
- package/dist/ExecutionDetailPage-D4CBtFdo.js +12217 -0
- package/dist/ExecutionDetailPage-DvQ667OE.d.ts +10 -0
- package/dist/ExecutionStatusBadge-BsDVor9t.js +221 -0
- package/dist/ExecutionsListDocument-Dan7ZiqB.js +459 -0
- package/dist/ExecutionsListPage-B3XT8ITL.js +4307 -0
- package/dist/FailureTriagePanel-DOJMaJ0n.js +1285 -0
- package/dist/FileDownloadUrlDocument-CVOYKcL5.js +92 -0
- package/dist/FluidGridsDocsLink-bX0Hnhxr.js +66 -0
- package/dist/FluidGridsMark-CE2blT7K.js +74 -0
- package/dist/HeldLoadRegion-BtTxbvOW.js +34 -0
- package/dist/HistoryPage-BLoRpJ1R.d.ts +6 -0
- package/dist/HistoryPage-BSBISXoj.js +2835 -0
- package/dist/Icon-BtQ0HXLh.js +160 -0
- package/dist/InsightsPage-D7ybj8N9.js +11245 -0
- package/dist/IsolationSetting-vy911E8b.js +1153 -0
- package/dist/LibraryParts-DOeNgR8A.js +413 -0
- package/dist/ManagedAiPolicyAuthority-BxwJ3ptd.js +40 -0
- package/dist/ManagedAiPolicyAuthority-DM3t3wNr.d.ts +18 -0
- package/dist/ManagedAiPolicyAuthorityContext-CNkxIOZ1.js +10 -0
- package/dist/McpTriggerServers-BCPCAOWB.js +459 -0
- package/dist/MissingNodesInstallModal-rO_SEDrC.js +224 -0
- package/dist/NavigationV2Provider-DCDt35eG.js +17 -0
- package/dist/NodeSchemaIntrospectionDocument-C1vAIcHd.js +95 -0
- package/dist/NodesPage-DEbnz9iU.d.ts +6 -0
- package/dist/NodesPage-O7KeeKtd.js +653 -0
- package/dist/OfflineIcon-TwMKYWjA.js +207 -0
- package/dist/OpenTemplateAsCodeButton-BhWJWIF3.js +94 -0
- package/dist/PaidTemplateConfirm-_G3ag6S4.js +28 -0
- package/dist/PublishCustomNodeAction-CIySbK4c.js +134 -0
- package/dist/RecordTaskDialog-BkpCDvhR.js +2078 -0
- package/dist/RunActionsMenu-DodOgIQm.js +59 -0
- package/dist/RunnerStatusPill-C1v967iq.js +24 -0
- package/dist/RunnersPage-dB0RSdY_.js +1929 -0
- package/dist/SandboxRuntimeExhaustedNotice-BFOIF93C.js +120 -0
- package/dist/SchedulesPage-DPWr1yvf.js +1607 -0
- package/dist/SearchBox-BGtYjvfs.js +49 -0
- package/dist/SequenceEditor-CFiHeHkR.js +497 -0
- package/dist/SettingsPage-0CQBNPZV.js +8695 -0
- package/dist/StewardPages-DAJhepen.js +47 -0
- package/dist/StewardRunImportPanel-Kva2DO0u.js +2844 -0
- package/dist/StoreTemplateCardCompact-CHn5kP7A.js +2166 -0
- package/dist/TagFilterSelect-CyA8QrS7.js +42 -0
- package/dist/TaskQueuesPage-DdnDCyat.js +3571 -0
- package/dist/TechnicalDetails-B0Oi4aZw.js +19 -0
- package/dist/TemplateConfigurationModal-CdvCYJLM.js +332 -0
- package/dist/TemplateDetailPanel-CbiKciuB.js +222 -0
- package/dist/TemplatePreview-cx7-NOeG.js +868 -0
- package/dist/TemplatesPage-BG3H-6v6.d.ts +10 -0
- package/dist/TemplatesPage-BVQpGYIV.js +3251 -0
- package/dist/TerminateExecutionDocument-B_HKNVrN.js +581 -0
- package/dist/TranslationBridge-Bd4aJKMs.d.ts +11 -0
- package/dist/TranslationBridge-Da-TPgQm.js +68 -0
- package/dist/TriggerWorkflowDocument-D9Km2Vv2.js +460 -0
- package/dist/UiSequencePickerSequenceDocument-BSYnSDV7.js +607 -0
- package/dist/UiStepScreenshot-Qh4QMyUp.js +146 -0
- package/dist/UsageTimeSeriesDocument-DcInx9-z.js +177 -0
- package/dist/VariablesPage-ChfGuW22.js +2243 -0
- package/dist/VersionDiffDialog-Bd2AeUwf.js +1702 -0
- package/dist/VersionLifecycleBar-BBeWVtz-.js +143 -0
- package/dist/WebhookDeliveriesPage-D66bua0j.js +1563 -0
- package/dist/WorkflowBuilder-B6wQD1TK.js +539 -0
- package/dist/WorkflowBuilder-DR4ku8Tr.js +1611 -0
- package/dist/WorkflowDefinitionDocument-DZLbTPUZ.js +321 -0
- package/dist/WorkflowEmbed-BXfFGy0i.js +708 -0
- package/dist/WorkflowEmbed-Cbqe1s1z.d.ts +6 -0
- package/dist/WorkflowPinnedDataDocument-BODT5omd.js +782 -0
- package/dist/WorkflowProposalCard-BruukdeF.js +96 -0
- package/dist/WorkflowProposalDocument-BdUbsrd0.js +620 -0
- package/dist/WorkflowSearchRedirect-C7zJ2MKH.js +40 -0
- package/dist/WorkflowSettingsDrawer-MVU1BKfY.d.ts +18 -0
- package/dist/WorkflowSettingsDrawer-gazs97WR.js +196 -0
- package/dist/WorkflowShareDialog-e8jJtLjU.js +469 -0
- package/dist/WorkflowVersionsDocument-DRVOp8Uj.js +3213 -0
- package/dist/WorkflowsList--hR2_8gf.js +4593 -0
- package/dist/WorkflowsList-CcNDQge5.d.ts +6 -0
- package/dist/WorkflowsListPageDocument-CnzcQm_o.js +934 -0
- package/dist/addonCatalog-CbZS4deh.js +58 -0
- package/dist/addonCatalog-sjlonAmR.d.ts +15 -0
- package/dist/addons.d.ts +3 -0
- package/dist/addons.js +4 -0
- package/dist/agent-form-Bfvm32j1.js +83 -0
- package/dist/agent-tools.d.ts +3 -0
- package/dist/agent-tools.js +5 -0
- package/dist/agentTools-CyL7DLOF.js +320 -0
- package/dist/ai-usage-BrxDgvdR.js +240 -0
- package/dist/aiCreditsBridge-BuE92tKo.js +49 -0
- package/dist/api-BKq-nIOZ.js +2286 -0
- package/dist/api-Ol7I8NxE.js +8289 -0
- package/dist/apollo-type-policies.d.ts +11 -0
- package/dist/apollo-type-policies.js +64 -0
- package/dist/askAboutBridge-ByYsQams.js +106 -0
- package/dist/askQuestions-Cmx7VnMm.js +742 -0
- package/dist/assert-rules-lfYEMc99.js +318 -0
- package/dist/assistant.d.ts +94 -0
- package/dist/assistant.js +99 -0
- package/dist/attach-node-helpers-HDKQOtrD.js +32 -0
- package/dist/badge-CXfPhoMH.js +26 -0
- package/dist/basil.generated-BK-EHbwN.js +10 -0
- package/dist/browser-steps-DMpS5TyB.js +533 -0
- package/dist/builderTimings-pvGnK1m-.js +510 -0
- package/dist/button-DG7y_FVJ.js +48 -0
- package/dist/canvasNoteTools-BxuP_AYO.js +137 -0
- package/dist/card-Bomy_1UG.js +44 -0
- package/dist/catalogGrid-BOrfMgi-.js +41 -0
- package/dist/channel-CPyQ1NR1.js +212 -0
- package/dist/chips-CvNrYJZa.js +27 -0
- package/dist/client-holder-C0M5Cfwl.js +68 -0
- package/dist/cn-QqidFIgr.js +10 -0
- package/dist/code-editor-diagnostics-Zr0cIcx1.js +46 -0
- package/dist/code-editor-field-x_JrY8KR.js +113 -0
- package/dist/codec-client-DPuD6mw7.js +515 -0
- package/dist/conditionBuilder-DwfEF0Q-.js +1144 -0
- package/dist/config-DO68jw5k.js +322 -0
- package/dist/constants-DgbVc24O.d.ts +296 -0
- package/dist/constants-DlRnHBfQ.js +217 -0
- package/dist/convert-browser-action-pfecelF7.js +347 -0
- package/dist/convert-dialog-B_o22NiJ.js +382 -0
- package/dist/create-workflow-first-Azg3JUdX.js +120 -0
- package/dist/definition-canvas-Bsda-rDT.js +31 -0
- package/dist/dialog-BVd152GS.js +94 -0
- package/dist/durable-nodes-BXyYCLxT.js +91 -0
- package/dist/duration-CDb7-mT_.js +33 -0
- package/dist/edge-mapper-wEAdGVU2.js +4477 -0
- package/dist/element-library-DkSlg_VE.js +727 -0
- package/dist/entities-I_0kio3q.js +38 -0
- package/dist/error-advice-QLr5NCm7.js +65 -0
- package/dist/errors-ClKb5sEt.js +188 -0
- package/dist/executions.d.ts +3 -0
- package/dist/executions.js +5 -0
- package/dist/feature-flags-B2qetXKd.js +385 -0
- package/dist/field-label-DPZRmE_B.js +153 -0
- package/dist/firstWorkflow-C_h0KMB2.js +133 -0
- package/dist/flags.d.ts +3 -0
- package/dist/flags.js +4 -0
- package/dist/flow-builder-DIvLOhz0.js +28038 -0
- package/dist/flow-store-holder-CUN7Terz.js +52 -0
- package/dist/fluent.generated-CA_e6-4l.js +14 -0
- package/dist/fluidgridsEvents-bbEQbwU6.js +175 -0
- package/dist/fluidgridsTheme-DUhvOgoy.js +297 -0
- package/dist/global-client-BQPuFrFa.js +433 -0
- package/dist/global-operations-BG6YgxrM.js +136 -0
- package/dist/graphql-types-UTYtujY9.js +21358 -0
- package/dist/history.d.ts +3 -0
- package/dist/history.js +4 -0
- package/dist/index-AoJAa5vU.d.ts +164958 -0
- package/dist/index-DEMT3iAM.d.ts +120 -0
- package/dist/index-ROZzNGyY.d.ts +76 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +8123 -0
- package/dist/ion.generated-mbajjcAg.js +10 -0
- package/dist/label-Lzb8ZXf_.js +29 -0
- package/dist/labels-rXd9gYQz.js +1236 -0
- package/dist/liveCanvas-D5ytXDp8.js +103 -0
- package/dist/logos.generated-X6_0kjVR.js +21 -0
- package/dist/logs-panel-Cw0DkG0l.js +468 -0
- package/dist/lucide.generated-B6NVd3GT.js +29 -0
- package/dist/marksStore-a9oIMMot.js +175 -0
- package/dist/mcp-trigger-D0nRdvq5.js +307 -0
- package/dist/mdi.generated-D1BV74d6.js +292 -0
- package/dist/menus-CU3hDGYl.js +160 -0
- package/dist/mynaui.generated-DMWr5cXz.js +66 -0
- package/dist/navigation-v2.d.ts +3 -0
- package/dist/navigation-v2.js +5 -0
- package/dist/node-detail-view-Cgm5H1P-.js +1372 -0
- package/dist/node-editor-tab-body-CZ0fVuVP.js +187 -0
- package/dist/node-operation-selection-CdV3KI_V.js +3534 -0
- package/dist/node-registry-refresh-s3okf83X.js +27 -0
- package/dist/node-role-TMbnkmeP.js +132 -0
- package/dist/node-type-icon-BZa8n4iG.js +33 -0
- package/dist/nodes.d.ts +3 -0
- package/dist/nodes.js +4 -0
- package/dist/notesKey-5EaREBGA.js +12 -0
- package/dist/observability.d.ts +3 -0
- package/dist/observability.js +5 -0
- package/dist/offset-pages-zghoClB3.js +55 -0
- package/dist/operations-BBmT9ToP.js +663 -0
- package/dist/operations-WxRJWeqO.js +3133 -0
- package/dist/output-files-Ba8bu5lv.js +196 -0
- package/dist/page-operation-DrWuhd6Y.js +129 -0
- package/dist/page-twins.d.ts +13 -0
- package/dist/page-twins.js +186 -0
- package/dist/pageControlSpecs-DZJ9K37m.js +134 -0
- package/dist/pageControlsBridge-0pX9s-3k.js +54 -0
- package/dist/pageControlsBridge-DAuT3w7L.d.ts +36 -0
- package/dist/panels-PfBBAToE.js +346 -0
- package/dist/parts-B7fBcw-B.js +346 -0
- package/dist/popover-Dms9Vz3j.js +3389 -0
- package/dist/preloadable-lazy-Pp47mqQ9.js +65 -0
- package/dist/proactive.d.ts +66 -0
- package/dist/proactive.js +237 -0
- package/dist/quick-config-panel-DFd77xho.js +451 -0
- package/dist/quota-DeA_CJ2e.js +175 -0
- package/dist/quota.d.ts +3 -0
- package/dist/quota.js +4 -0
- package/dist/read-only-context-Dt9N9SIG.js +18 -0
- package/dist/relative-time-Dxt8ZIIu.js +55 -0
- package/dist/results-CwK_yDxK.js +325 -0
- package/dist/rolldown-runtime-hDbaFkMy.js +18 -0
- package/dist/route-data.d.ts +12 -0
- package/dist/route-data.js +69 -0
- package/dist/route-match-C-0_EnAt.d.ts +5 -0
- package/dist/route-match-DMkUICYV.js +41 -0
- package/dist/route-preload-C4DlGoCd.js +120 -0
- package/dist/run-display-UjLAoYqQ.js +81 -0
- package/dist/run-history-arGiHzGU.js +285 -0
- package/dist/run-list-links-DJn4Mf1T.js +98 -0
- package/dist/run-mode-USmM0-Uo.js +82 -0
- package/dist/run-parity-CWXqEJqM.js +144 -0
- package/dist/runsQuota-B6SyTbne.js +100 -0
- package/dist/runsQuota-DsniKiSg.d.ts +20 -0
- package/dist/safe-expression-Cw7-SCsm.js +1251 -0
- package/dist/save-status-store-C7nEYpfb.js +631 -0
- package/dist/schedule-panel-B4GYXzXQ.js +13774 -0
- package/dist/schedule-rules-ggVKRkBH.js +358 -0
- package/dist/secrets-Re_wSiE3.js +153 -0
- package/dist/settings.d.ts +4 -0
- package/dist/settings.js +6 -0
- package/dist/shared-DAWGGMSM.js +177 -0
- package/dist/sidebar-node-editor-6eSSgCzc.js +178 -0
- package/dist/solar.generated-CGYuUQAC.js +10 -0
- package/dist/stableTabbedDialog-BBhrfXGe.js +20 -0
- package/dist/start-url-CT6Yz96K.js +24 -0
- package/dist/status-CessxGpm.js +55 -0
- package/dist/store-icon-OctYp5zP.js +155 -0
- package/dist/styles-WGmTnZ2n.js +26 -0
- package/dist/styles.css +139 -0
- package/dist/svg-spinners.generated-CIPT7IhM.js +10 -0
- package/dist/template-code-CzN6JWNV.js +191 -0
- package/dist/template-graph-DLF9dygU.js +20 -0
- package/dist/template-preview-DcIIKOOL.js +32 -0
- package/dist/template-price-CdUHZRMF.js +40 -0
- package/dist/templates.d.ts +3 -0
- package/dist/templates.js +5 -0
- package/dist/theme-provider-CntfC4_i.js +23 -0
- package/dist/transient-DgZfhDfN.js +57 -0
- package/dist/typed-calls-C5tO03wq.js +26 -0
- package/dist/ui-script-By74Guk3.js +1094 -0
- package/dist/ui-script-editor-CqPu2bCN.js +2447 -0
- package/dist/ui-step-fix-8uM2_Hft.js +67 -0
- package/dist/ui-step-fix-store-CcO1FdRx.js +19 -0
- package/dist/ui-step-run-context-o7bLE6KP.js +46 -0
- package/dist/ui-target-editor-D2JhB_lD.js +673 -0
- package/dist/uiMarkTools-CSznnO1i.js +1054 -0
- package/dist/upgradePrompt-BAFBKKW5.js +72 -0
- package/dist/use-bare-node-registry-O6mKJO_n.js +11498 -0
- package/dist/use-browser-available-hj8wc3Kb.js +241 -0
- package/dist/use-edge-mapper-schemas-Bonofxow.js +496 -0
- package/dist/use-extension-bridge-B9ZreOkQ.js +608 -0
- package/dist/use-mobile-BTqCUjzS.js +27 -0
- package/dist/use-sdk-query-C697xZVv.js +116 -0
- package/dist/use-workflow-code-editor-CFoRFrZ5.js +753 -0
- package/dist/useActionParam-B2tU2BlY.js +85 -0
- package/dist/useAgentTokenStream-Bko_J0d0.js +4217 -0
- package/dist/useBrowserClients-3v95-gSh.js +103 -0
- package/dist/useCodeWorkflowInsights-w0tz9Ap_.js +600 -0
- package/dist/useConnections-DsgEJs05.js +439 -0
- package/dist/useDebouncedValue-BFekcv6n.js +18 -0
- package/dist/useDurableParity-8fnMZmBc.js +1787 -0
- package/dist/useEntityTags-D0spL6Ut.js +460 -0
- package/dist/useExecutions-2u5nGJJk.js +681 -0
- package/dist/useFluidGridsAnalytics-VM8lAi2x.js +238 -0
- package/dist/useGlobalStoreClient-BTdhkA2I.js +24 -0
- package/dist/useHumanRequests-zlYDp3l1.js +221 -0
- package/dist/useNavigationV2-C2WeqN7d.js +29 -0
- package/dist/useNavigationV2-DANUmg12.d.ts +9 -0
- package/dist/useObservability-BRlQ0tOA.js +285 -0
- package/dist/useRequestedProposal-B7uPXfZB.js +51 -0
- package/dist/useRunHistory-CXCMUPyf.js +2759 -0
- package/dist/useRunLive-D0JvVZT2.js +1060 -0
- package/dist/useRunnerList-Dbi59i1K.js +446 -0
- package/dist/useRunners-URUc5quU.js +173 -0
- package/dist/useRunsPage-DG656UCK.js +2709 -0
- package/dist/useVariables-BIelxcWr.js +463 -0
- package/dist/useVersionHistoryData-CTjqVw7l.js +292 -0
- package/dist/useWorkflowCodeExport-pqxyLHD1.js +522 -0
- package/dist/useWorkflowListExport-hcZNvTaB.js +232 -0
- package/dist/useWorkflowOrganization-CpBbOrs7.js +1772 -0
- package/dist/useWorkflowProposal-BH0VdNMA.js +3280 -0
- package/dist/useWorkflows-Cvg-Z_IE.js +1606 -0
- package/dist/utils-fvBb5qOD.js +89 -0
- package/dist/webhook-deliveries-AvQujaZy.js +99 -0
- package/dist/workflow-builder-CJygVkVv.d.ts +2 -0
- package/dist/workflow-builder.d.ts +3 -0
- package/dist/workflow-builder.js +8 -0
- package/dist/workflow-code-transfer-Bsy0JKAZ.js +323 -0
- package/dist/workflow-embed.d.ts +3 -0
- package/dist/workflow-embed.js +4 -0
- package/dist/workflow-git-sync--K9ZsPDC.js +263 -0
- package/dist/workflow-host.d.ts +6 -0
- package/dist/workflow-host.js +11 -0
- package/dist/workflow-pages-D-7ByLTB.d.ts +68 -0
- package/dist/workflow-pages.d.ts +3 -0
- package/dist/workflow-pages.js +115 -0
- package/dist/workflow-preview-canvas-CO8yzdE3.js +848 -0
- package/dist/workflow-preview.d.ts +65 -0
- package/dist/workflow-preview.js +4 -0
- package/dist/workflow-route.d.ts +33 -0
- package/dist/workflow-route.js +4 -0
- package/dist/workflow-save-state-D0l-DkLf.js +767 -0
- package/dist/workflow-transfer-CQnQC-ke.js +104 -0
- package/dist/workflowRouteData-BkfVOc-O.js +169 -0
- package/dist/workflows-list.d.ts +10 -0
- package/dist/workflows-list.js +5 -0
- package/package.json +320 -4
|
@@ -0,0 +1,2078 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-hDbaFkMy.js";
|
|
3
|
+
import { r as useTr } from "./TranslationBridge-Da-TPgQm.js";
|
|
4
|
+
import { t as useFluidGridsAnalytics } from "./useFluidGridsAnalytics-VM8lAi2x.js";
|
|
5
|
+
import { O as createConfiguredNode, Sn as followRecordedNode, bn as emitRecordingSaved, c as ensureNodeTypeReady, f as getNodeConfig, xn as emitRecordingStarted } from "./use-bare-node-registry-O6mKJO_n.js";
|
|
6
|
+
import { T as NDV_OVERLAY_Z_INDEX } from "./browser-steps-DMpS5TyB.js";
|
|
7
|
+
import { a as MIN_BRIDGE_EXTENSION_VERSION, n as useBridgeAvailability, r as useBridgeOperation } from "./use-extension-bridge-B9ZreOkQ.js";
|
|
8
|
+
import { t as startUrlOf } from "./start-url-CT6Yz96K.js";
|
|
9
|
+
import { i as newUseBrowserNode, n as convertBrowserActionSteps } from "./convert-browser-action-pfecelF7.js";
|
|
10
|
+
import { E as stepSentence, h as newStepId, u as isDraftStep, w as stepIds } from "./ui-script-By74Guk3.js";
|
|
11
|
+
import { t as FluidGridsDocsLink } from "./FluidGridsDocsLink-bX0Hnhxr.js";
|
|
12
|
+
import { t as blankWorkflowCreateInput } from "./create-workflow-first-Azg3JUdX.js";
|
|
13
|
+
import { d as USE_BROWSER_INPUTS_PARAMETER, p as USE_BROWSER_SCRIPT_PARAMETER } from "./askQuestions-Cmx7VnMm.js";
|
|
14
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
15
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { cn } from "@burdenoff/fe-libs/utils";
|
|
17
|
+
import { Button, Checkbox, Input, ResponsiveDialog, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogHeader, ResponsiveDialogTitle, Textarea } from "@burdenoff/fe-libs/ui";
|
|
18
|
+
import { describeTarget, parseUiScript, safeParseUiScript } from "@burdenoff/ui-engine/script";
|
|
19
|
+
|
|
20
|
+
// src/rpa/connector-suggest.ts
|
|
21
|
+
/** The curated map: sites with a FluidGrids store node. */
|
|
22
|
+
const CURATED_CONNECTORS = [
|
|
23
|
+
{
|
|
24
|
+
nodeType: "store/salesforce",
|
|
25
|
+
name: "Salesforce",
|
|
26
|
+
domains: ["salesforce.com", "force.com"]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
nodeType: "store/hubspot",
|
|
30
|
+
name: "HubSpot",
|
|
31
|
+
domains: ["hubspot.com"]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
nodeType: "store/zendesk",
|
|
35
|
+
name: "Zendesk",
|
|
36
|
+
domains: ["zendesk.com"]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
nodeType: "store/jira",
|
|
40
|
+
name: "Jira",
|
|
41
|
+
domains: ["atlassian.net"]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
nodeType: "store/github",
|
|
45
|
+
name: "GitHub",
|
|
46
|
+
domains: ["github.com"]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
nodeType: "store/gitlab",
|
|
50
|
+
name: "GitLab",
|
|
51
|
+
domains: ["gitlab.com"]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
nodeType: "store/slack",
|
|
55
|
+
name: "Slack",
|
|
56
|
+
domains: ["slack.com"]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
nodeType: "store/shopify",
|
|
60
|
+
name: "Shopify",
|
|
61
|
+
domains: ["myshopify.com", "admin.shopify.com"]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
nodeType: "store/stripe",
|
|
65
|
+
name: "Stripe",
|
|
66
|
+
domains: ["dashboard.stripe.com"]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
nodeType: "store/notion",
|
|
70
|
+
name: "Notion",
|
|
71
|
+
domains: ["notion.so", "notion.com"]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
nodeType: "store/airtable",
|
|
75
|
+
name: "Airtable",
|
|
76
|
+
domains: ["airtable.com"]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
nodeType: "store/google_sheets",
|
|
80
|
+
name: "Google Sheets",
|
|
81
|
+
domains: ["docs.google.com"]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
nodeType: "store/gmail_reader",
|
|
85
|
+
name: "Gmail",
|
|
86
|
+
domains: ["mail.google.com"]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
nodeType: "store/asana",
|
|
90
|
+
name: "Asana",
|
|
91
|
+
domains: ["asana.com"]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
nodeType: "store/trello",
|
|
95
|
+
name: "Trello",
|
|
96
|
+
domains: ["trello.com"]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
nodeType: "store/quickbooks",
|
|
100
|
+
name: "QuickBooks",
|
|
101
|
+
domains: ["qbo.intuit.com", "quickbooks.intuit.com"]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
nodeType: "store/xero",
|
|
105
|
+
name: "Xero",
|
|
106
|
+
domains: ["xero.com"]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
nodeType: "store/freshbooks",
|
|
110
|
+
name: "FreshBooks",
|
|
111
|
+
domains: ["freshbooks.com"]
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
nodeType: "store/pipedrive",
|
|
115
|
+
name: "Pipedrive",
|
|
116
|
+
domains: ["pipedrive.com"]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
nodeType: "store/intercom",
|
|
120
|
+
name: "Intercom",
|
|
121
|
+
domains: ["intercom.com"]
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
nodeType: "store/linear",
|
|
125
|
+
name: "Linear",
|
|
126
|
+
domains: ["linear.app"]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
nodeType: "store/monday",
|
|
130
|
+
name: "monday.com",
|
|
131
|
+
domains: ["monday.com"]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
nodeType: "store/clickup",
|
|
135
|
+
name: "ClickUp",
|
|
136
|
+
domains: ["clickup.com"]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
nodeType: "store/servicenow",
|
|
140
|
+
name: "ServiceNow",
|
|
141
|
+
domains: ["service-now.com"]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
nodeType: "store/docusign",
|
|
145
|
+
name: "DocuSign",
|
|
146
|
+
domains: ["docusign.com", "docusign.net"]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
nodeType: "store/mailchimp",
|
|
150
|
+
name: "Mailchimp",
|
|
151
|
+
domains: ["mailchimp.com"]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
nodeType: "store/twilio",
|
|
155
|
+
name: "Twilio",
|
|
156
|
+
domains: ["console.twilio.com"]
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
nodeType: "store/dropbox",
|
|
160
|
+
name: "Dropbox",
|
|
161
|
+
domains: ["dropbox.com"]
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
nodeType: "store/box",
|
|
165
|
+
name: "Box",
|
|
166
|
+
domains: ["app.box.com"]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
nodeType: "store/netsuite",
|
|
170
|
+
name: "NetSuite",
|
|
171
|
+
domains: ["netsuite.com"]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
nodeType: "store/workday",
|
|
175
|
+
name: "Workday",
|
|
176
|
+
domains: ["myworkday.com", "workday.com"]
|
|
177
|
+
}
|
|
178
|
+
];
|
|
179
|
+
/** A domain as it is compared: lower case, without a leading `*.` or `.` and without a port. */
|
|
180
|
+
function normaliseDomain(domain) {
|
|
181
|
+
return domain.trim().toLowerCase().replace(/^\*?\./, "").replace(/:\d+$/, "");
|
|
182
|
+
}
|
|
183
|
+
/** Whether `host` is `domain` or one of its subdomains. */
|
|
184
|
+
function hostMatchesDomain(host, domain) {
|
|
185
|
+
const h = normaliseDomain(host);
|
|
186
|
+
const d = normaliseDomain(domain);
|
|
187
|
+
return d.length > 0 && (h === d || h.endsWith(`.${d}`));
|
|
188
|
+
}
|
|
189
|
+
/** The host of an http(s) address, or null. */
|
|
190
|
+
function hostOf(url) {
|
|
191
|
+
if (typeof url !== "string") return null;
|
|
192
|
+
try {
|
|
193
|
+
const parsed = new URL(url);
|
|
194
|
+
return parsed.protocol === "http:" || parsed.protocol === "https:" ? parsed.hostname.toLowerCase() : null;
|
|
195
|
+
} catch {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/** The connector for one host: a manifest's `domains` first, then the curated map. */
|
|
200
|
+
function connectorForHost(host, manifestConnectors = []) {
|
|
201
|
+
for (const candidate of [...manifestConnectors, ...CURATED_CONNECTORS]) if (candidate.domains.some((domain) => hostMatchesDomain(host, domain))) return candidate;
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The first recorded site with a connector, and the steps done on it: from a
|
|
206
|
+
* page load of that site up to the next page load of another site. Null when
|
|
207
|
+
* no recorded site has one.
|
|
208
|
+
*/
|
|
209
|
+
function suggestConnector(steps, manifestConnectors = []) {
|
|
210
|
+
let host = null;
|
|
211
|
+
let suggestion = null;
|
|
212
|
+
for (let index = 0; index < steps.length; index++) {
|
|
213
|
+
const step = steps[index];
|
|
214
|
+
if (step?.action === "navigate") {
|
|
215
|
+
const next = hostOf(step.url);
|
|
216
|
+
if (next) host = next;
|
|
217
|
+
}
|
|
218
|
+
if (!host) continue;
|
|
219
|
+
if (!suggestion) {
|
|
220
|
+
const connector = connectorForHost(host, manifestConnectors);
|
|
221
|
+
if (!connector) continue;
|
|
222
|
+
suggestion = {
|
|
223
|
+
connector,
|
|
224
|
+
host,
|
|
225
|
+
stepIndexes: []
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
if (suggestion.host === host) suggestion.stepIndexes.push(index);
|
|
229
|
+
}
|
|
230
|
+
return suggestion;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/rpa/recording-to-script.ts
|
|
234
|
+
/**
|
|
235
|
+
* A browser recording turned into the draft the recording review shows, and
|
|
236
|
+
* the reviewed draft turned into a UI script (RPA plan P1-12; spec 06 section
|
|
237
|
+
* 5.3; spec 19 M3).
|
|
238
|
+
*
|
|
239
|
+
* The extension (0.4.0, P1-10) hands over a UI script v1 whose steps are
|
|
240
|
+
* already masked: a password, one-time code or credential-like field becomes
|
|
241
|
+
* a `type` step with `masked: true`, no text and no screenshot. The clipboard
|
|
242
|
+
* path ("Paste from the recorder") hands over a Run in Browser step list,
|
|
243
|
+
* which goes through the same adapter as Convert to Use Browser.
|
|
244
|
+
*
|
|
245
|
+
* Clean-up, as the review shows it:
|
|
246
|
+
*
|
|
247
|
+
* 1. **Merged**, with a note on the step that is kept: typing into the field
|
|
248
|
+
* the previous step typed into (the recorder merges keystrokes already; this
|
|
249
|
+
* also merges what a paste or an older recorder left), a click on a field
|
|
250
|
+
* right before typing into it, and a page load of the address just loaded.
|
|
251
|
+
* 2. **Flagged, never removed silently**: a click on something that is not a
|
|
252
|
+
* control (a page area, a paragraph) that no page load follows ("looks
|
|
253
|
+
* accidental"), a second identical click in a row, and typing into a field
|
|
254
|
+
* that a later step types into again (a correction). The person chooses
|
|
255
|
+
* Remove or Keep; until then the step stays.
|
|
256
|
+
* 3. **Inputs found**: every typed value and chosen option, named after its
|
|
257
|
+
* field. A masked step is never offered (threat review R1, spec 19
|
|
258
|
+
* decision 7).
|
|
259
|
+
* 4. **Outputs found**: text a step reads (copy the text, read a value).
|
|
260
|
+
* 5. **Names**: steps read as sentences from `describeStep` (the review
|
|
261
|
+
* translates them); a step the person renames keeps the name as its
|
|
262
|
+
* `intent`. The script is named after the recorded site.
|
|
263
|
+
*
|
|
264
|
+
* This module loads `@burdenoff/ui-engine` at run time, so only the lazily
|
|
265
|
+
* loaded recording review may import it (`src/tooling/check-builder-chunks.ts`).
|
|
266
|
+
*/
|
|
267
|
+
const EMPTY_CHOICES = {
|
|
268
|
+
removed: /* @__PURE__ */ new Set(),
|
|
269
|
+
names: /* @__PURE__ */ new Map(),
|
|
270
|
+
inputs: /* @__PURE__ */ new Map(),
|
|
271
|
+
outputs: /* @__PURE__ */ new Map(),
|
|
272
|
+
useConnector: false
|
|
273
|
+
};
|
|
274
|
+
/** Longest step name kept (the engine's intent limit is 500). */
|
|
275
|
+
const MAX_STEP_NAME_LENGTH = 200;
|
|
276
|
+
/** Roles of things a click does something on. */
|
|
277
|
+
const CONTROL_ROLES = /* @__PURE__ */ new Set([
|
|
278
|
+
"button",
|
|
279
|
+
"link",
|
|
280
|
+
"checkbox",
|
|
281
|
+
"radio",
|
|
282
|
+
"switch",
|
|
283
|
+
"menuitem",
|
|
284
|
+
"menuitemcheckbox",
|
|
285
|
+
"menuitemradio",
|
|
286
|
+
"tab",
|
|
287
|
+
"option",
|
|
288
|
+
"treeitem",
|
|
289
|
+
"textbox",
|
|
290
|
+
"searchbox",
|
|
291
|
+
"combobox",
|
|
292
|
+
"listbox",
|
|
293
|
+
"slider",
|
|
294
|
+
"spinbutton",
|
|
295
|
+
"row",
|
|
296
|
+
"cell",
|
|
297
|
+
"gridcell",
|
|
298
|
+
"columnheader",
|
|
299
|
+
"rowheader",
|
|
300
|
+
"img",
|
|
301
|
+
"image",
|
|
302
|
+
"figure"
|
|
303
|
+
]);
|
|
304
|
+
/** Roles of page areas and text: a click on one alone usually does nothing. */
|
|
305
|
+
const AREA_ROLES = /* @__PURE__ */ new Set([
|
|
306
|
+
"generic",
|
|
307
|
+
"none",
|
|
308
|
+
"presentation",
|
|
309
|
+
"main",
|
|
310
|
+
"region",
|
|
311
|
+
"document",
|
|
312
|
+
"group",
|
|
313
|
+
"article",
|
|
314
|
+
"section",
|
|
315
|
+
"paragraph",
|
|
316
|
+
"banner",
|
|
317
|
+
"contentinfo",
|
|
318
|
+
"complementary",
|
|
319
|
+
"navigation",
|
|
320
|
+
"form",
|
|
321
|
+
"heading",
|
|
322
|
+
"text",
|
|
323
|
+
"statictext"
|
|
324
|
+
]);
|
|
325
|
+
/** Tags of page areas, as the last part of a CSS selector reads them. */
|
|
326
|
+
const AREA_TAGS = /* @__PURE__ */ new Set([
|
|
327
|
+
"body",
|
|
328
|
+
"html",
|
|
329
|
+
"main",
|
|
330
|
+
"div",
|
|
331
|
+
"section",
|
|
332
|
+
"article",
|
|
333
|
+
"header",
|
|
334
|
+
"footer",
|
|
335
|
+
"aside",
|
|
336
|
+
"p",
|
|
337
|
+
"span",
|
|
338
|
+
"form",
|
|
339
|
+
"h1",
|
|
340
|
+
"h2",
|
|
341
|
+
"h3",
|
|
342
|
+
"h4",
|
|
343
|
+
"h5",
|
|
344
|
+
"h6"
|
|
345
|
+
]);
|
|
346
|
+
function isRecord$2(value) {
|
|
347
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
348
|
+
}
|
|
349
|
+
/** A target compared as text (recordings write the same target the same way). */
|
|
350
|
+
function targetKey(ref) {
|
|
351
|
+
return ref === void 0 ? "" : JSON.stringify(ref);
|
|
352
|
+
}
|
|
353
|
+
function stepTarget(step) {
|
|
354
|
+
return "target" in step && isRecord$2(step.target) ? step.target : void 0;
|
|
355
|
+
}
|
|
356
|
+
/** The element's name as a sentence shows it, without the quotes. */
|
|
357
|
+
function targetLabel(ref) {
|
|
358
|
+
const unquoted = describeTarget(ref).replace(/^"(.*)"$/, "$1").trim();
|
|
359
|
+
return unquoted === "?" ? "" : unquoted;
|
|
360
|
+
}
|
|
361
|
+
/** Whether a click target is a page area rather than a control. */
|
|
362
|
+
function isAreaTarget(ref) {
|
|
363
|
+
if (!ref || !("methods" in ref)) return false;
|
|
364
|
+
const methods = ref.methods.filter((method) => method.enabled !== false);
|
|
365
|
+
if (methods.some((method) => method.kind === "testId")) return false;
|
|
366
|
+
const roles = methods.flatMap((method) => method.kind === "role" ? [method.role.toLowerCase()] : []);
|
|
367
|
+
if (roles.some((role) => CONTROL_ROLES.has(role))) return false;
|
|
368
|
+
if (roles.length > 0) return roles.every((role) => AREA_ROLES.has(role));
|
|
369
|
+
const css = methods.find((method) => method.kind === "css");
|
|
370
|
+
if (!css || css.kind !== "css") return false;
|
|
371
|
+
const last = css.selector.trim().split(/[\s>+~]+/).pop() ?? "";
|
|
372
|
+
const tag = /^([a-z][a-z0-9]*)/i.exec(last)?.[1]?.toLowerCase();
|
|
373
|
+
return tag !== void 0 && AREA_TAGS.has(tag);
|
|
374
|
+
}
|
|
375
|
+
/** A name for a value: an identifier made from its field's label. */
|
|
376
|
+
function suggestName(label, fallback, taken) {
|
|
377
|
+
let base = label.normalize("NFKD").replace(/[\u0300-\u036f]/g, "").replace(/[^A-Za-z0-9]+/g, " ").trim().toLowerCase().split(/\s+/).filter(Boolean).slice(0, 6).join("_").slice(0, 48);
|
|
378
|
+
if (!base || !/^[a-z_]/.test(base)) base = fallback;
|
|
379
|
+
if (!taken.has(base)) return base;
|
|
380
|
+
for (let n = 2;; n++) {
|
|
381
|
+
const name = `${base}_${n}`;
|
|
382
|
+
if (!taken.has(name)) return name;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function literalText(expression) {
|
|
386
|
+
return typeof expression === "string" ? expression : null;
|
|
387
|
+
}
|
|
388
|
+
/** A type step without its value: what the recorder writes for a masked field. */
|
|
389
|
+
function maskedStep(step) {
|
|
390
|
+
if (step.action !== "type") return step;
|
|
391
|
+
const rest = { ...step };
|
|
392
|
+
delete rest.text;
|
|
393
|
+
delete rest.screenshotRef;
|
|
394
|
+
return {
|
|
395
|
+
...rest,
|
|
396
|
+
masked: true
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function isMasked(step, maskedIds) {
|
|
400
|
+
return step.action === "type" && (step.masked === true || maskedIds.has(step.id));
|
|
401
|
+
}
|
|
402
|
+
/** Merges what a replay does the same way anyway; see the module comment. */
|
|
403
|
+
function mergeSteps(steps, maskedIds) {
|
|
404
|
+
const merged = [];
|
|
405
|
+
for (const original of steps) {
|
|
406
|
+
const step = isMasked(original, maskedIds) ? maskedStep(original) : original;
|
|
407
|
+
const notes = step.action === "type" && step.masked === true ? [{ kind: "masked" }] : [];
|
|
408
|
+
const last = merged[merged.length - 1];
|
|
409
|
+
const lastTarget = last ? targetKey(stepTarget(last.step)) : "";
|
|
410
|
+
const target = targetKey(stepTarget(step));
|
|
411
|
+
if (last && step.action === "type" && last.step.action === "type" && target !== "" && target === lastTarget) {
|
|
412
|
+
const count = last.notes.find((note) => note.kind === "mergedTyping");
|
|
413
|
+
const masked = step.masked === true || last.step.masked === true;
|
|
414
|
+
last.step = masked ? maskedStep(step) : step;
|
|
415
|
+
last.notes = [
|
|
416
|
+
...last.notes.filter((note) => note.kind !== "mergedTyping" && note.kind !== "masked"),
|
|
417
|
+
{
|
|
418
|
+
kind: "mergedTyping",
|
|
419
|
+
count: (count?.kind === "mergedTyping" ? count.count : 1) + 1
|
|
420
|
+
},
|
|
421
|
+
...masked ? [{ kind: "masked" }] : []
|
|
422
|
+
];
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
if (last && step.action === "type" && last.step.action === "click" && target !== "" && target === lastTarget) {
|
|
426
|
+
merged[merged.length - 1] = {
|
|
427
|
+
step,
|
|
428
|
+
notes: [{ kind: "mergedClick" }, ...notes],
|
|
429
|
+
flag: null
|
|
430
|
+
};
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
if (last && step.action === "navigate" && last.step.action === "navigate" && step.url === last.step.url) {
|
|
434
|
+
const count = last.notes.find((note) => note.kind === "mergedPageLoads");
|
|
435
|
+
last.notes = [...last.notes.filter((note) => note.kind !== "mergedPageLoads"), {
|
|
436
|
+
kind: "mergedPageLoads",
|
|
437
|
+
count: (count?.kind === "mergedPageLoads" ? count.count : 1) + 1
|
|
438
|
+
}];
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
441
|
+
merged.push({
|
|
442
|
+
step,
|
|
443
|
+
notes,
|
|
444
|
+
flag: null
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
return merged;
|
|
448
|
+
}
|
|
449
|
+
/** Flags the steps a person may want to remove; see the module comment. */
|
|
450
|
+
function flagSteps(steps) {
|
|
451
|
+
steps.forEach((entry, index) => {
|
|
452
|
+
const { step } = entry;
|
|
453
|
+
const next = steps[index + 1]?.step;
|
|
454
|
+
const previous = steps[index - 1]?.step;
|
|
455
|
+
if (step.action === "click") {
|
|
456
|
+
const target = targetKey(step.target);
|
|
457
|
+
if (previous?.action === "click" && targetKey(previous.target) === target) entry.flag = "repeated";
|
|
458
|
+
else if (isAreaTarget(step.target) && next?.action !== "navigate") entry.flag = "accidental";
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
if (step.action === "type" && step.masked !== true) {
|
|
462
|
+
const target = targetKey(step.target);
|
|
463
|
+
if (steps.slice(index + 1).some((other) => other.step.action === "type" && target !== "" && targetKey(other.step.target) === target)) entry.flag = "corrected";
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
const OUTPUT_ACTIONS = /* @__PURE__ */ new Set([
|
|
468
|
+
"getText",
|
|
469
|
+
"getValue",
|
|
470
|
+
"getAttribute"
|
|
471
|
+
]);
|
|
472
|
+
function findInputs(steps, declared) {
|
|
473
|
+
const taken = new Set(declared);
|
|
474
|
+
const inputs = [];
|
|
475
|
+
steps.forEach(({ step }, index) => {
|
|
476
|
+
if (step.action === "type" && step.masked !== true) {
|
|
477
|
+
const example = literalText(step.text);
|
|
478
|
+
if (example === null || example === "") return;
|
|
479
|
+
const label = targetLabel(step.target);
|
|
480
|
+
const name = suggestName(label, `step${index + 1}_text`, taken);
|
|
481
|
+
taken.add(name);
|
|
482
|
+
inputs.push({
|
|
483
|
+
stepId: step.id,
|
|
484
|
+
name,
|
|
485
|
+
label,
|
|
486
|
+
example
|
|
487
|
+
});
|
|
488
|
+
} else if (step.action === "select" && step.values.length === 1) {
|
|
489
|
+
const example = literalText(step.values[0]);
|
|
490
|
+
if (example === null || example === "") return;
|
|
491
|
+
const label = targetLabel(step.target);
|
|
492
|
+
const name = suggestName(label, `step${index + 1}_option`, taken);
|
|
493
|
+
taken.add(name);
|
|
494
|
+
inputs.push({
|
|
495
|
+
stepId: step.id,
|
|
496
|
+
name,
|
|
497
|
+
label,
|
|
498
|
+
example
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
return inputs;
|
|
503
|
+
}
|
|
504
|
+
function findOutputs(steps, inputNames) {
|
|
505
|
+
const taken = new Set(inputNames);
|
|
506
|
+
const outputs = [];
|
|
507
|
+
steps.forEach(({ step }, index) => {
|
|
508
|
+
if (!OUTPUT_ACTIONS.has(step.action)) return;
|
|
509
|
+
const label = targetLabel(stepTarget(step));
|
|
510
|
+
const name = step.saveAs ?? suggestName(label, `step${index + 1}_text`, taken);
|
|
511
|
+
taken.add(name);
|
|
512
|
+
outputs.push({
|
|
513
|
+
stepId: step.id,
|
|
514
|
+
name,
|
|
515
|
+
label
|
|
516
|
+
});
|
|
517
|
+
});
|
|
518
|
+
return outputs;
|
|
519
|
+
}
|
|
520
|
+
/** The first page load's address. */
|
|
521
|
+
function firstUrl(steps) {
|
|
522
|
+
for (const step of steps) if (step.action === "navigate" && typeof step.url === "string") return step.url;
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* The review of a recorded script. `maskedStepIds` are the steps the
|
|
527
|
+
* extension masked (also marked `masked: true` on the steps themselves).
|
|
528
|
+
* Throws the engine's `UiScriptError` when `script` is not a UI script.
|
|
529
|
+
*/
|
|
530
|
+
function reviewRecording(script, maskedStepIds = [], manifestConnectors = [], carriedInputValues = {}) {
|
|
531
|
+
const parsed = parseUiScript(script);
|
|
532
|
+
const carried = { ...parsed };
|
|
533
|
+
for (const key of [
|
|
534
|
+
"scriptVersion",
|
|
535
|
+
"steps",
|
|
536
|
+
"name"
|
|
537
|
+
]) Reflect.deleteProperty(carried, key);
|
|
538
|
+
const masked = new Set(maskedStepIds);
|
|
539
|
+
const steps = mergeSteps(parsed.steps, masked);
|
|
540
|
+
flagSteps(steps);
|
|
541
|
+
const inputs = findInputs(steps, (carried.inputs ?? []).map((input) => input.name));
|
|
542
|
+
const outputs = findOutputs(steps, /* @__PURE__ */ new Set([...inputs.map((input) => input.name), ...(carried.outputs ?? []).map((output) => output.name)]));
|
|
543
|
+
const url = firstUrl(parsed.steps);
|
|
544
|
+
const host = hostOf(url);
|
|
545
|
+
let origin = null;
|
|
546
|
+
if (url && host) origin = new URL(url).origin;
|
|
547
|
+
return {
|
|
548
|
+
host,
|
|
549
|
+
origin,
|
|
550
|
+
recordedCount: parsed.steps.length,
|
|
551
|
+
steps,
|
|
552
|
+
inputs,
|
|
553
|
+
outputs,
|
|
554
|
+
connector: suggestConnector(steps.map(({ step }) => ({
|
|
555
|
+
action: step.action,
|
|
556
|
+
url: step.action === "navigate" ? step.url : void 0
|
|
557
|
+
})), manifestConnectors),
|
|
558
|
+
carried,
|
|
559
|
+
carriedInputValues
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* "Paste from the recorder": the step list the extension's popup copies (a
|
|
564
|
+
* Run in Browser step list), as a review. A typed step the recorder hid (an
|
|
565
|
+
* empty value with its "fill this in" note) is a masked step.
|
|
566
|
+
*/
|
|
567
|
+
function reviewPastedSteps(text, manifestConnectors = []) {
|
|
568
|
+
if (!text.trim()) return { problem: "empty" };
|
|
569
|
+
let parsed;
|
|
570
|
+
try {
|
|
571
|
+
parsed = JSON.parse(text);
|
|
572
|
+
} catch {
|
|
573
|
+
return { problem: "notJson" };
|
|
574
|
+
}
|
|
575
|
+
if (!Array.isArray(parsed) || parsed.length === 0) return { problem: "notSteps" };
|
|
576
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
577
|
+
parsed.forEach((step, index) => {
|
|
578
|
+
if (isRecord$2(step) && step.action === "type" && step.value === "" && typeof step.note === "string") hidden.add(index);
|
|
579
|
+
});
|
|
580
|
+
const conversion = convertBrowserActionSteps(parsed);
|
|
581
|
+
if (!conversion.script) return { problem: "blocked" };
|
|
582
|
+
const steps = conversion.script.steps.map((step, index) => hidden.has(index) && step.action === "type" ? maskedStep(step) : step);
|
|
583
|
+
const masked = steps.filter((step) => step.action === "type" && step.masked === true).map((step) => step.id);
|
|
584
|
+
const checked = safeParseUiScript({
|
|
585
|
+
...conversion.script,
|
|
586
|
+
steps
|
|
587
|
+
});
|
|
588
|
+
if (!checked.success) return { problem: "blocked" };
|
|
589
|
+
const lifted = {};
|
|
590
|
+
for (const [name, value] of Object.entries(conversion.inputs)) if (typeof value === "string") lifted[name] = value;
|
|
591
|
+
return { review: reviewRecording(checked.script, masked, manifestConnectors, lifted) };
|
|
592
|
+
}
|
|
593
|
+
/** The steps the reviewed script keeps, with their review entry. */
|
|
594
|
+
function keptSteps(review, choices) {
|
|
595
|
+
const connectorSteps = new Set(choices.useConnector ? review.connector?.stepIndexes ?? [] : []);
|
|
596
|
+
return review.steps.filter((entry, index) => !choices.removed.has(entry.step.id) && !connectorSteps.has(index));
|
|
597
|
+
}
|
|
598
|
+
function withName(step, name) {
|
|
599
|
+
const intent = name?.trim().slice(0, 200);
|
|
600
|
+
return intent ? {
|
|
601
|
+
...step,
|
|
602
|
+
intent
|
|
603
|
+
} : step;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* The UI script the review saves, its input values and the connector the
|
|
607
|
+
* person chose. `name` is the script's name. Throws the engine's
|
|
608
|
+
* `UiScriptError` when the result is not a valid script (a review that kept
|
|
609
|
+
* no step, for one).
|
|
610
|
+
*/
|
|
611
|
+
function buildReviewedScript(review, choices, name) {
|
|
612
|
+
const inputs = [...review.carried.inputs ?? []];
|
|
613
|
+
const outputs = [...review.carried.outputs ?? []];
|
|
614
|
+
const inputValues = { ...review.carriedInputValues };
|
|
615
|
+
const candidates = new Map(review.inputs.map((input) => [input.stepId, input]));
|
|
616
|
+
const steps = keptSteps(review, choices).map(({ step }) => {
|
|
617
|
+
let next = withName(step, choices.names.get(step.id));
|
|
618
|
+
const inputName = choices.inputs.get(step.id);
|
|
619
|
+
const candidate = candidates.get(step.id);
|
|
620
|
+
if (inputName && candidate) {
|
|
621
|
+
inputs.push({
|
|
622
|
+
name: inputName,
|
|
623
|
+
type: "text",
|
|
624
|
+
required: true,
|
|
625
|
+
...candidate.label ? { description: candidate.label.slice(0, 200) } : {}
|
|
626
|
+
});
|
|
627
|
+
inputValues[inputName] = candidate.example;
|
|
628
|
+
if (next.action === "type") next = {
|
|
629
|
+
...next,
|
|
630
|
+
text: { input: inputName }
|
|
631
|
+
};
|
|
632
|
+
else if (next.action === "select") next = {
|
|
633
|
+
...next,
|
|
634
|
+
values: [{ input: inputName }]
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
const outputName = choices.outputs.get(step.id);
|
|
638
|
+
if (outputName && OUTPUT_ACTIONS.has(next.action)) {
|
|
639
|
+
next = {
|
|
640
|
+
...next,
|
|
641
|
+
saveAs: outputName
|
|
642
|
+
};
|
|
643
|
+
outputs.push({
|
|
644
|
+
name: outputName,
|
|
645
|
+
value: { var: outputName }
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
return next;
|
|
649
|
+
});
|
|
650
|
+
const script = {
|
|
651
|
+
...review.carried,
|
|
652
|
+
scriptVersion: 1,
|
|
653
|
+
...name.trim() ? { name: name.trim().slice(0, 200) } : {},
|
|
654
|
+
...!review.carried.application && review.host && review.origin ? { application: {
|
|
655
|
+
name: review.host,
|
|
656
|
+
urlPattern: `${review.origin}/*`
|
|
657
|
+
} } : {},
|
|
658
|
+
...inputs.length > 0 ? { inputs } : {},
|
|
659
|
+
...outputs.length > 0 ? { outputs } : {},
|
|
660
|
+
steps
|
|
661
|
+
};
|
|
662
|
+
return {
|
|
663
|
+
script: parseUiScript(script),
|
|
664
|
+
inputValues,
|
|
665
|
+
connector: choices.useConnector ? review.connector?.connector ?? null : null
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
/** How many steps the review keeps with these choices. */
|
|
669
|
+
function keptStepCount(review, choices) {
|
|
670
|
+
return keptSteps(review, choices).length;
|
|
671
|
+
}
|
|
672
|
+
/** Steps that keep a masked value: each needs a value before the script can run. */
|
|
673
|
+
function maskedStepCount(review, choices) {
|
|
674
|
+
return keptSteps(review, choices).filter(({ step }) => step.action === "type" && step.masked === true).length;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// src/builder/components/rpa/recording-review/review-state.ts
|
|
678
|
+
/** The English text of each clean-up note. */
|
|
679
|
+
const NOTE_TEXTS = [
|
|
680
|
+
{
|
|
681
|
+
kind: "mergedTyping",
|
|
682
|
+
key: "fluidgrids.builder.recording.note.mergedTyping",
|
|
683
|
+
fallback: "{{count}} typing steps into this field were merged into one Type step"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
kind: "mergedClick",
|
|
687
|
+
key: "fluidgrids.builder.recording.note.mergedClick",
|
|
688
|
+
fallback: "The click that selected this field was merged into this step"
|
|
689
|
+
},
|
|
690
|
+
{
|
|
691
|
+
kind: "mergedPageLoads",
|
|
692
|
+
key: "fluidgrids.builder.recording.note.mergedPageLoads",
|
|
693
|
+
fallback: "{{count}} loads of this page were merged into one"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
kind: "masked",
|
|
697
|
+
key: "fluidgrids.builder.recording.note.masked",
|
|
698
|
+
fallback: "Not recorded: this field is masked, so the value stays empty. Set it from a connection before the step runs."
|
|
699
|
+
}
|
|
700
|
+
];
|
|
701
|
+
/** The English text of each flag. */
|
|
702
|
+
const FLAG_TEXTS = [
|
|
703
|
+
{
|
|
704
|
+
flag: "accidental",
|
|
705
|
+
key: "fluidgrids.builder.recording.flag.accidental",
|
|
706
|
+
fallback: "Looks accidental: the click was on the page, not on a button, link or field"
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
flag: "repeated",
|
|
710
|
+
key: "fluidgrids.builder.recording.flag.repeated",
|
|
711
|
+
fallback: "The same click again, right after the first"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
flag: "corrected",
|
|
715
|
+
key: "fluidgrids.builder.recording.flag.corrected",
|
|
716
|
+
fallback: "You typed into this field again later, so this value is replaced"
|
|
717
|
+
}
|
|
718
|
+
];
|
|
719
|
+
function noteText(tr, note) {
|
|
720
|
+
const text = NOTE_TEXTS.find((item) => item.kind === note.kind);
|
|
721
|
+
if (!text) return note.kind;
|
|
722
|
+
return tr(text.key, text.fallback, "count" in note ? { count: note.count } : void 0);
|
|
723
|
+
}
|
|
724
|
+
function flagText(tr, flag) {
|
|
725
|
+
const text = FLAG_TEXTS.find((item) => item.flag === flag);
|
|
726
|
+
return text ? tr(text.key, text.fallback) : flag;
|
|
727
|
+
}
|
|
728
|
+
/** Whether the review leaves a step out: removed, or done on the connector's site. */
|
|
729
|
+
function isLeftOut(review, choices, index, id) {
|
|
730
|
+
if (choices.removed.has(id)) return true;
|
|
731
|
+
return choices.useConnector && (review.connector?.stepIndexes.includes(index) ?? false);
|
|
732
|
+
}
|
|
733
|
+
/** Each step's number as the saved script will have it; null for a step left out. */
|
|
734
|
+
function stepNumbers(review, choices) {
|
|
735
|
+
let next = 0;
|
|
736
|
+
return review.steps.map((entry, index) => isLeftOut(review, choices, index, entry.step.id) ? null : ++next);
|
|
737
|
+
}
|
|
738
|
+
function setWith(set, value, on) {
|
|
739
|
+
const next = new Set(set);
|
|
740
|
+
if (on) next.add(value);
|
|
741
|
+
else next.delete(value);
|
|
742
|
+
return next;
|
|
743
|
+
}
|
|
744
|
+
function mapWith(map, key, value) {
|
|
745
|
+
const next = new Map(map);
|
|
746
|
+
if (value === null) next.delete(key);
|
|
747
|
+
else next.set(key, value);
|
|
748
|
+
return next;
|
|
749
|
+
}
|
|
750
|
+
/** An identifier the script accepts as an input or output name. */
|
|
751
|
+
const NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]{0,63}$/;
|
|
752
|
+
/**
|
|
753
|
+
* Only the ticks on steps the script keeps count: a step removed or left out
|
|
754
|
+
* for the connector takes its input and output with it. A name the recorded
|
|
755
|
+
* script already declares counts as taken.
|
|
756
|
+
*/
|
|
757
|
+
function checkNames(review, choices) {
|
|
758
|
+
const keptIds = new Set(keptSteps(review, choices).map((entry) => entry.step.id));
|
|
759
|
+
const ticked = (map) => [...map].filter(([stepId]) => keptIds.has(stepId)).map(([, name]) => name);
|
|
760
|
+
const inputs = ticked(choices.inputs);
|
|
761
|
+
const outputs = ticked(choices.outputs);
|
|
762
|
+
const allInputs = [...inputs, ...(review.carried.inputs ?? []).map((input) => input.name)];
|
|
763
|
+
const allOutputs = [...outputs, ...(review.carried.outputs ?? []).map((output) => output.name)];
|
|
764
|
+
return {
|
|
765
|
+
inputs,
|
|
766
|
+
outputs,
|
|
767
|
+
bad: [...inputs, ...outputs].filter((name) => !NAME_PATTERN.test(name)),
|
|
768
|
+
duplicate: allInputs.length !== new Set(allInputs).size || allOutputs.length !== new Set(allOutputs).size
|
|
769
|
+
};
|
|
770
|
+
}
|
|
771
|
+
/** Why Save is not possible (or the last save failed), or null. */
|
|
772
|
+
function reviewProblem(tr, state) {
|
|
773
|
+
if (state.stepCount === 0) return tr("fluidgrids.builder.recording.noStepsLeft", "Keep at least one step to save the recording.");
|
|
774
|
+
if (state.names.bad.length > 0) return tr("fluidgrids.builder.recording.badName", "Names start with a letter or _ and use only letters, digits and _: {{name}}", { name: state.names.bad[0] ?? "" });
|
|
775
|
+
if (state.names.duplicate) return tr("fluidgrids.builder.recording.duplicateName", "Two inputs or outputs have the same name.");
|
|
776
|
+
if (state.buildError) return tr("fluidgrids.builder.recording.cannotSave", "These steps cannot be saved: {{detail}}", { detail: state.buildError });
|
|
777
|
+
return state.error;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
// src/builder/components/rpa/recording-review/ReviewStepRow.tsx
|
|
781
|
+
/**
|
|
782
|
+
* One step of the recording review (RPA plan P1-12, spec 19 M3): its number
|
|
783
|
+
* and sentence (click to rename), what clean-up did to it, and Remove and
|
|
784
|
+
* Keep on a flagged step.
|
|
785
|
+
*
|
|
786
|
+
* Loaded with the lazy recorder: sentences come from `@burdenoff/ui-engine`.
|
|
787
|
+
*/
|
|
788
|
+
/** The step's sentence, or its name; a click edits the name. */
|
|
789
|
+
function StepName({ name, sentence, leftOut, onName, testId }) {
|
|
790
|
+
const tr = useTr();
|
|
791
|
+
const [editing, setEditing] = useState(null);
|
|
792
|
+
const commit = () => {
|
|
793
|
+
if (editing === null) return;
|
|
794
|
+
const trimmed = editing.trim();
|
|
795
|
+
onName(trimmed && trimmed !== sentence ? trimmed : null);
|
|
796
|
+
setEditing(null);
|
|
797
|
+
};
|
|
798
|
+
const onKeyDown = (event) => {
|
|
799
|
+
if (event.key === "Enter") {
|
|
800
|
+
event.preventDefault();
|
|
801
|
+
commit();
|
|
802
|
+
} else if (event.key === "Escape") {
|
|
803
|
+
event.preventDefault();
|
|
804
|
+
event.stopPropagation();
|
|
805
|
+
setEditing(null);
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
if (editing !== null) return /* @__PURE__ */ jsx(Input, {
|
|
809
|
+
value: editing,
|
|
810
|
+
autoFocus: true,
|
|
811
|
+
maxLength: 200,
|
|
812
|
+
"aria-label": tr("fluidgrids.builder.recording.renameLabel", "Step name"),
|
|
813
|
+
onChange: (event) => setEditing(event.target.value),
|
|
814
|
+
onBlur: commit,
|
|
815
|
+
onKeyDown,
|
|
816
|
+
className: "h-8 text-sm",
|
|
817
|
+
"data-testid": `${testId}-name-input`,
|
|
818
|
+
"data-recording-rename": "true"
|
|
819
|
+
});
|
|
820
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("button", {
|
|
821
|
+
type: "button",
|
|
822
|
+
className: cn("text-left text-sm text-foreground hover:underline", leftOut && "line-through"),
|
|
823
|
+
onClick: () => setEditing(name ?? sentence),
|
|
824
|
+
title: tr("fluidgrids.builder.recording.renameHint", "Click to rename this step"),
|
|
825
|
+
"data-testid": `${testId}-text`,
|
|
826
|
+
children: name ?? sentence
|
|
827
|
+
}), name !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
828
|
+
className: "text-xs text-muted-foreground",
|
|
829
|
+
"data-testid": `${testId}-sentence`,
|
|
830
|
+
children: sentence
|
|
831
|
+
})] });
|
|
832
|
+
}
|
|
833
|
+
/** Remove and Keep on a flagged step, or Put back on a removed one. */
|
|
834
|
+
function StepDecision({ flagged, removed, onRemove, onKeep, testId }) {
|
|
835
|
+
const tr = useTr();
|
|
836
|
+
if (removed) return /* @__PURE__ */ jsx(Button, {
|
|
837
|
+
type: "button",
|
|
838
|
+
size: "sm",
|
|
839
|
+
variant: "ghost",
|
|
840
|
+
onClick: onKeep,
|
|
841
|
+
"data-testid": `${testId}-undo-remove`,
|
|
842
|
+
children: tr("fluidgrids.builder.recording.undoRemove", "Put back")
|
|
843
|
+
});
|
|
844
|
+
if (!flagged) return null;
|
|
845
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
846
|
+
className: "flex shrink-0 gap-1",
|
|
847
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
848
|
+
type: "button",
|
|
849
|
+
size: "sm",
|
|
850
|
+
variant: "outline",
|
|
851
|
+
onClick: onRemove,
|
|
852
|
+
"data-testid": `${testId}-remove`,
|
|
853
|
+
children: tr("fluidgrids.builder.recording.remove", "Remove")
|
|
854
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
855
|
+
type: "button",
|
|
856
|
+
size: "sm",
|
|
857
|
+
variant: "ghost",
|
|
858
|
+
onClick: onKeep,
|
|
859
|
+
"data-testid": `${testId}-keep`,
|
|
860
|
+
children: tr("fluidgrids.builder.recording.keep", "Keep")
|
|
861
|
+
})]
|
|
862
|
+
});
|
|
863
|
+
}
|
|
864
|
+
function ReviewStepRow({ entry, index, number, leftOut, removed, decided, name, onName, onRemove, onKeep, testIdPrefix }) {
|
|
865
|
+
const tr = useTr();
|
|
866
|
+
const sentence = stepSentence(entry.step);
|
|
867
|
+
const testId = `${testIdPrefix}-step-${index}`;
|
|
868
|
+
const flagShown = entry.flag !== null && !decided && !removed;
|
|
869
|
+
return /* @__PURE__ */ jsx("li", {
|
|
870
|
+
className: cn("flex flex-col gap-1 rounded-md border border-border p-2", leftOut && "opacity-60"),
|
|
871
|
+
"data-testid": testId,
|
|
872
|
+
"data-flag": entry.flag ?? void 0,
|
|
873
|
+
"data-left-out": leftOut ? "true" : void 0,
|
|
874
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
875
|
+
className: "flex items-start gap-2",
|
|
876
|
+
children: [
|
|
877
|
+
/* @__PURE__ */ jsx("span", {
|
|
878
|
+
className: "mt-0.5 w-6 shrink-0 text-right text-xs font-semibold text-muted-foreground",
|
|
879
|
+
children: number ?? "–"
|
|
880
|
+
}),
|
|
881
|
+
/* @__PURE__ */ jsxs("div", {
|
|
882
|
+
className: "flex min-w-0 flex-1 flex-col gap-0.5",
|
|
883
|
+
children: [
|
|
884
|
+
/* @__PURE__ */ jsx(StepName, {
|
|
885
|
+
name,
|
|
886
|
+
sentence: tr(sentence.key, sentence.fallback, sentence.vars),
|
|
887
|
+
leftOut,
|
|
888
|
+
onName,
|
|
889
|
+
testId
|
|
890
|
+
}),
|
|
891
|
+
entry.notes.map((note) => /* @__PURE__ */ jsx("span", {
|
|
892
|
+
className: cn("text-xs", note.kind === "masked" ? "text-[var(--color-status-warning-text)]" : "text-muted-foreground"),
|
|
893
|
+
"data-testid": `${testId}-note-${note.kind}`,
|
|
894
|
+
children: noteText(tr, note)
|
|
895
|
+
}, note.kind)),
|
|
896
|
+
flagShown && entry.flag && /* @__PURE__ */ jsx("span", {
|
|
897
|
+
className: "text-xs text-[var(--color-status-warning-text)]",
|
|
898
|
+
"data-testid": `${testId}-flag`,
|
|
899
|
+
children: flagText(tr, entry.flag)
|
|
900
|
+
})
|
|
901
|
+
]
|
|
902
|
+
}),
|
|
903
|
+
/* @__PURE__ */ jsx(StepDecision, {
|
|
904
|
+
flagged: flagShown,
|
|
905
|
+
removed,
|
|
906
|
+
onRemove,
|
|
907
|
+
onKeep,
|
|
908
|
+
testId
|
|
909
|
+
})
|
|
910
|
+
]
|
|
911
|
+
})
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// src/builder/components/rpa/recording-review/ReviewPanels.tsx
|
|
916
|
+
/**
|
|
917
|
+
* The side of the recording review (RPA plan P1-12, spec 19 M3 markers 4 to
|
|
918
|
+
* 7): inputs found, outputs found, the connector suggestion, where it is
|
|
919
|
+
* saved, and the buttons.
|
|
920
|
+
*/
|
|
921
|
+
/** A value offered as an input or an output: a tick, and the name when ticked. */
|
|
922
|
+
function Candidate({ id, text, name, editable, onTick, onName }) {
|
|
923
|
+
const tr = useTr();
|
|
924
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
925
|
+
className: "flex flex-col gap-1",
|
|
926
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
927
|
+
htmlFor: id,
|
|
928
|
+
className: "flex items-start gap-2 text-sm text-foreground",
|
|
929
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
930
|
+
id,
|
|
931
|
+
checked: name !== void 0,
|
|
932
|
+
onCheckedChange: (checked) => onTick(checked === true),
|
|
933
|
+
"data-testid": id
|
|
934
|
+
}), /* @__PURE__ */ jsx("span", { children: text })]
|
|
935
|
+
}), editable && name !== void 0 && /* @__PURE__ */ jsx(Input, {
|
|
936
|
+
value: name,
|
|
937
|
+
maxLength: 64,
|
|
938
|
+
"aria-label": tr("fluidgrids.builder.recording.inputName", "Input name"),
|
|
939
|
+
onChange: (event) => onName(event.target.value),
|
|
940
|
+
className: "ml-6 h-8 w-auto font-mono text-xs",
|
|
941
|
+
"data-testid": `${id}-name`
|
|
942
|
+
})]
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
function InputsSection({ inputs, ticked, numberOf, hasMasked, onTick, testIdPrefix }) {
|
|
946
|
+
const tr = useTr();
|
|
947
|
+
const shown = inputs.flatMap((input) => {
|
|
948
|
+
const number = numberOf(input.stepId);
|
|
949
|
+
return number === null ? [] : [{
|
|
950
|
+
input,
|
|
951
|
+
number
|
|
952
|
+
}];
|
|
953
|
+
});
|
|
954
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
955
|
+
className: "flex flex-col gap-2",
|
|
956
|
+
"data-testid": `${testIdPrefix}-inputs`,
|
|
957
|
+
children: [
|
|
958
|
+
/* @__PURE__ */ jsx("h3", {
|
|
959
|
+
className: "text-sm font-semibold text-foreground",
|
|
960
|
+
children: tr("fluidgrids.builder.recording.inputsTitle", "Inputs found")
|
|
961
|
+
}),
|
|
962
|
+
/* @__PURE__ */ jsx("span", {
|
|
963
|
+
className: "text-xs text-muted-foreground",
|
|
964
|
+
children: inputs.length === 0 ? tr("fluidgrids.builder.recording.noInputs", "No typed values were recorded.") : tr("fluidgrids.builder.recording.inputsHint", "Tick the values that change on every run.")
|
|
965
|
+
}),
|
|
966
|
+
/* @__PURE__ */ jsx("ul", {
|
|
967
|
+
className: "flex flex-col gap-2",
|
|
968
|
+
children: shown.map(({ input, number }) => /* @__PURE__ */ jsx(Candidate, {
|
|
969
|
+
id: `${testIdPrefix}-input-${input.stepId}`,
|
|
970
|
+
text: tr("fluidgrids.builder.recording.inputCandidate", "{{label}} from step {{number}}, example {{example}}", {
|
|
971
|
+
label: input.label || tr("fluidgrids.builder.recording.valueLabel", "Value"),
|
|
972
|
+
number,
|
|
973
|
+
example: input.example
|
|
974
|
+
}),
|
|
975
|
+
name: ticked.get(input.stepId),
|
|
976
|
+
editable: true,
|
|
977
|
+
onTick: (on) => onTick(input.stepId, on ? input.name : null),
|
|
978
|
+
onName: (name) => onTick(input.stepId, name)
|
|
979
|
+
}, input.stepId))
|
|
980
|
+
}),
|
|
981
|
+
hasMasked && /* @__PURE__ */ jsx("span", {
|
|
982
|
+
className: "text-xs text-muted-foreground",
|
|
983
|
+
"data-testid": `${testIdPrefix}-masked-note`,
|
|
984
|
+
children: tr("fluidgrids.builder.recording.maskedNeverInput", "Masked steps are never offered as inputs.")
|
|
985
|
+
})
|
|
986
|
+
]
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
function OutputsSection({ outputs, ticked, numberOf, onTick, testIdPrefix }) {
|
|
990
|
+
const tr = useTr();
|
|
991
|
+
if (outputs.length === 0) return null;
|
|
992
|
+
const shown = outputs.flatMap((output) => {
|
|
993
|
+
const number = numberOf(output.stepId);
|
|
994
|
+
return number === null ? [] : [{
|
|
995
|
+
output,
|
|
996
|
+
number
|
|
997
|
+
}];
|
|
998
|
+
});
|
|
999
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
1000
|
+
className: "flex flex-col gap-2",
|
|
1001
|
+
"data-testid": `${testIdPrefix}-outputs`,
|
|
1002
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
1003
|
+
className: "text-sm font-semibold text-foreground",
|
|
1004
|
+
children: tr("fluidgrids.builder.recording.outputsTitle", "Outputs found")
|
|
1005
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
1006
|
+
className: "flex flex-col gap-2",
|
|
1007
|
+
children: shown.map(({ output, number }) => /* @__PURE__ */ jsx(Candidate, {
|
|
1008
|
+
id: `${testIdPrefix}-output-${output.stepId}`,
|
|
1009
|
+
text: tr("fluidgrids.builder.recording.outputCandidate", "{{label}} read in step {{number}}, becomes output {{name}}", {
|
|
1010
|
+
label: output.label || tr("fluidgrids.builder.recording.valueLabel", "Value"),
|
|
1011
|
+
number,
|
|
1012
|
+
name: output.name
|
|
1013
|
+
}),
|
|
1014
|
+
name: ticked.get(output.stepId),
|
|
1015
|
+
editable: false,
|
|
1016
|
+
onTick: (on) => onTick(output.stepId, on ? output.name : null),
|
|
1017
|
+
onName: (name) => onTick(output.stepId, name)
|
|
1018
|
+
}, output.stepId))
|
|
1019
|
+
})]
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
function ConnectorCard({ connector, chosen, steps, onChoose, testIdPrefix }) {
|
|
1023
|
+
const tr = useTr();
|
|
1024
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
1025
|
+
className: "flex flex-col gap-2 rounded-md border border-dashed border-border p-3",
|
|
1026
|
+
"data-testid": `${testIdPrefix}-connector`,
|
|
1027
|
+
children: [
|
|
1028
|
+
/* @__PURE__ */ jsx("h3", {
|
|
1029
|
+
className: "text-sm font-semibold text-foreground",
|
|
1030
|
+
children: tr("fluidgrids.builder.recording.suggestions", "Suggestions")
|
|
1031
|
+
}),
|
|
1032
|
+
/* @__PURE__ */ jsx("span", {
|
|
1033
|
+
className: "text-sm text-foreground",
|
|
1034
|
+
children: chosen ? tr("fluidgrids.builder.recording.connectorChosen", "The {{name}} connector is added to the new workflow; set it up there. The screen steps on {{site}} are left out.", {
|
|
1035
|
+
name: connector.connector.name,
|
|
1036
|
+
site: connector.host
|
|
1037
|
+
}) : tr("fluidgrids.builder.recording.connectorSuggestion", "{{name}} has a connector. Use it instead of the screen for steps {{from}} to {{to}}?", {
|
|
1038
|
+
name: connector.connector.name,
|
|
1039
|
+
...steps
|
|
1040
|
+
})
|
|
1041
|
+
}),
|
|
1042
|
+
/* @__PURE__ */ jsx("div", {
|
|
1043
|
+
className: "flex flex-wrap gap-2",
|
|
1044
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1045
|
+
type: "button",
|
|
1046
|
+
size: "sm",
|
|
1047
|
+
variant: "outline",
|
|
1048
|
+
onClick: () => onChoose(!chosen),
|
|
1049
|
+
"data-testid": `${testIdPrefix}-connector-${chosen ? "undo" : "use"}`,
|
|
1050
|
+
children: chosen ? tr("fluidgrids.builder.recording.keepScreenSteps", "Keep screen steps") : tr("fluidgrids.builder.recording.useConnector", "Use the connector")
|
|
1051
|
+
})
|
|
1052
|
+
})
|
|
1053
|
+
]
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
function DestinationSection({ mode, workflowName, onWorkflowName, testIdPrefix }) {
|
|
1057
|
+
const tr = useTr();
|
|
1058
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
1059
|
+
className: "flex flex-col gap-2",
|
|
1060
|
+
"data-testid": `${testIdPrefix}-destination`,
|
|
1061
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
1062
|
+
className: "text-sm font-semibold text-foreground",
|
|
1063
|
+
children: tr("fluidgrids.builder.recording.whereSaved", "Where it is saved")
|
|
1064
|
+
}), mode === "new" ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("label", {
|
|
1065
|
+
className: "flex flex-col gap-1 text-xs text-muted-foreground",
|
|
1066
|
+
htmlFor: `${testIdPrefix}-workflow-name`,
|
|
1067
|
+
children: [tr("fluidgrids.builder.recording.newWorkflow", "New workflow"), /* @__PURE__ */ jsx(Input, {
|
|
1068
|
+
id: `${testIdPrefix}-workflow-name`,
|
|
1069
|
+
value: workflowName,
|
|
1070
|
+
maxLength: 200,
|
|
1071
|
+
onChange: (event) => onWorkflowName(event.target.value),
|
|
1072
|
+
className: "h-9 text-sm",
|
|
1073
|
+
"data-testid": `${testIdPrefix}-workflow-name`
|
|
1074
|
+
})]
|
|
1075
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1076
|
+
className: "text-xs text-muted-foreground",
|
|
1077
|
+
children: tr("fluidgrids.builder.recording.saveAddsNode", "Saving adds one Use Browser node with these steps.")
|
|
1078
|
+
})] }) : /* @__PURE__ */ jsx("span", {
|
|
1079
|
+
className: "text-xs text-muted-foreground",
|
|
1080
|
+
children: tr("fluidgrids.builder.recording.appendHint", "Saving adds these steps to the end of this Use Browser node.")
|
|
1081
|
+
})]
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
function ReviewFooter({ mode, busy, canSave, onDiscard, onSave, onRunNow, testIdPrefix }) {
|
|
1085
|
+
const tr = useTr();
|
|
1086
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1087
|
+
className: "flex flex-col-reverse gap-2 sm:flex-row sm:justify-between",
|
|
1088
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1089
|
+
type: "button",
|
|
1090
|
+
variant: "ghost",
|
|
1091
|
+
onClick: onDiscard,
|
|
1092
|
+
disabled: busy,
|
|
1093
|
+
"data-testid": `${testIdPrefix}-discard`,
|
|
1094
|
+
children: tr("fluidgrids.builder.recording.discard", "Discard recording")
|
|
1095
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1096
|
+
className: "flex flex-col-reverse gap-2 sm:flex-row",
|
|
1097
|
+
children: [onRunNow && /* @__PURE__ */ jsx(Button, {
|
|
1098
|
+
type: "button",
|
|
1099
|
+
variant: "outline",
|
|
1100
|
+
disabled: !canSave,
|
|
1101
|
+
onClick: onRunNow,
|
|
1102
|
+
"data-testid": `${testIdPrefix}-run-now`,
|
|
1103
|
+
children: tr("fluidgrids.builder.recording.runNow", "Run it now in this browser")
|
|
1104
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1105
|
+
type: "button",
|
|
1106
|
+
disabled: !canSave,
|
|
1107
|
+
"aria-busy": busy,
|
|
1108
|
+
onClick: onSave,
|
|
1109
|
+
"data-testid": `${testIdPrefix}-save`,
|
|
1110
|
+
children: mode === "new" ? tr("fluidgrids.builder.recording.saveToWorkflow", "Save to workflow") : tr("fluidgrids.builder.recording.addSteps", "Add the steps")
|
|
1111
|
+
})]
|
|
1112
|
+
})]
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
// src/builder/components/rpa/recording-review/RecordingReview.tsx
|
|
1117
|
+
/**
|
|
1118
|
+
* The recording review (RPA plan P1-12, spec 19 M3): the cleaned steps as
|
|
1119
|
+
* sentences, the inputs and outputs it found, the connector suggestion, and
|
|
1120
|
+
* Save. Nothing is saved before Save.
|
|
1121
|
+
*
|
|
1122
|
+
* - Steps read as sentences from the engine's `describeStep`; clicking a
|
|
1123
|
+
* step's text renames it (the name is kept as the step's `intent`).
|
|
1124
|
+
* - Merged steps say what was merged; a masked step says its value stays
|
|
1125
|
+
* empty and is never offered as an input.
|
|
1126
|
+
* - Flagged steps (looks accidental, repeated, corrected) offer Remove and
|
|
1127
|
+
* Keep. Nothing is removed until the person chooses Remove.
|
|
1128
|
+
* - Ticked inputs become script inputs, filled with the recorded value so the
|
|
1129
|
+
* first run works unedited; ticked outputs keep the value they read.
|
|
1130
|
+
*
|
|
1131
|
+
* The rules are in `./review-state.ts`, a step's row in `./ReviewStepRow.tsx`
|
|
1132
|
+
* and the side panels in `./ReviewPanels.tsx`. Loaded lazily with the
|
|
1133
|
+
* recorder (it reads step sentences from `@burdenoff/ui-engine`).
|
|
1134
|
+
*/
|
|
1135
|
+
/** The steps, with what the person decided about each. */
|
|
1136
|
+
function StepsSection({ review, choices, kept, numbers, onName, onRemove, onKeep, testIdPrefix }) {
|
|
1137
|
+
const tr = useTr();
|
|
1138
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
1139
|
+
className: "flex min-w-0 flex-col gap-2",
|
|
1140
|
+
"aria-labelledby": `${testIdPrefix}-steps-title`,
|
|
1141
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1142
|
+
className: "flex flex-col",
|
|
1143
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
1144
|
+
id: `${testIdPrefix}-steps-title`,
|
|
1145
|
+
className: "text-sm font-semibold text-foreground",
|
|
1146
|
+
children: tr("fluidgrids.builder.recording.steps", "Steps")
|
|
1147
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1148
|
+
className: "text-xs text-muted-foreground",
|
|
1149
|
+
children: tr("fluidgrids.builder.recording.stepsHint", "Names come from the element labels. Rename any step by clicking its text.")
|
|
1150
|
+
})]
|
|
1151
|
+
}), /* @__PURE__ */ jsx("ol", {
|
|
1152
|
+
className: "flex flex-col gap-1.5",
|
|
1153
|
+
"data-testid": `${testIdPrefix}-steps`,
|
|
1154
|
+
children: review.steps.map((entry, index) => {
|
|
1155
|
+
const id = entry.step.id;
|
|
1156
|
+
return /* @__PURE__ */ jsx(ReviewStepRow, {
|
|
1157
|
+
entry,
|
|
1158
|
+
index,
|
|
1159
|
+
number: numbers[index] ?? null,
|
|
1160
|
+
leftOut: isLeftOut(review, choices, index, id),
|
|
1161
|
+
removed: choices.removed.has(id),
|
|
1162
|
+
decided: kept.has(id),
|
|
1163
|
+
name: choices.names.get(id),
|
|
1164
|
+
onName: (name) => onName(id, name),
|
|
1165
|
+
onRemove: () => onRemove(id),
|
|
1166
|
+
onKeep: () => onKeep(id),
|
|
1167
|
+
testIdPrefix
|
|
1168
|
+
}, id);
|
|
1169
|
+
})
|
|
1170
|
+
})]
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
function RecordingReview({ review, mode, defaultWorkflowName, busy = false, error = null, onDiscard, onSave, onRunNow, testIdPrefix = "recording-review" }) {
|
|
1174
|
+
const tr = useTr();
|
|
1175
|
+
const [choices, setChoices] = useState(EMPTY_CHOICES);
|
|
1176
|
+
const [kept, setKept] = useState(/* @__PURE__ */ new Set());
|
|
1177
|
+
const [workflowName, setWorkflowName] = useState(defaultWorkflowName);
|
|
1178
|
+
const [buildError, setBuildError] = useState(null);
|
|
1179
|
+
const edits = useRef(0);
|
|
1180
|
+
const stepCount = keptStepCount(review, choices);
|
|
1181
|
+
const numbers = useMemo(() => stepNumbers(review, choices), [review, choices]);
|
|
1182
|
+
const numberOf = (stepId) => {
|
|
1183
|
+
const index = review.steps.findIndex((entry) => entry.step.id === stepId);
|
|
1184
|
+
return index < 0 ? null : numbers[index] ?? null;
|
|
1185
|
+
};
|
|
1186
|
+
const names = checkNames(review, choices);
|
|
1187
|
+
const problem = reviewProblem(tr, {
|
|
1188
|
+
stepCount,
|
|
1189
|
+
names,
|
|
1190
|
+
buildError,
|
|
1191
|
+
error
|
|
1192
|
+
});
|
|
1193
|
+
const canSave = !busy && stepCount > 0 && names.bad.length === 0 && !names.duplicate && (mode === "append" || workflowName.trim().length > 0);
|
|
1194
|
+
const result = () => {
|
|
1195
|
+
const name = workflowName.trim() || defaultWorkflowName;
|
|
1196
|
+
try {
|
|
1197
|
+
const reviewed = buildReviewedScript(review, choices, name);
|
|
1198
|
+
setBuildError(null);
|
|
1199
|
+
return {
|
|
1200
|
+
reviewed,
|
|
1201
|
+
workflowName: name,
|
|
1202
|
+
stepCount,
|
|
1203
|
+
inputCount: names.inputs.length,
|
|
1204
|
+
outputCount: names.outputs.length,
|
|
1205
|
+
maskedSteps: maskedStepCount(review, choices),
|
|
1206
|
+
flaggedSteps: review.steps.filter((entry) => entry.flag !== null).length,
|
|
1207
|
+
edits: edits.current
|
|
1208
|
+
};
|
|
1209
|
+
} catch (err) {
|
|
1210
|
+
setBuildError(err instanceof Error ? err.message : String(err));
|
|
1211
|
+
return null;
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1214
|
+
const handOver = (handler) => {
|
|
1215
|
+
const built = result();
|
|
1216
|
+
if (built) handler(built);
|
|
1217
|
+
};
|
|
1218
|
+
const connectorNumbers = (review.connector?.stepIndexes ?? []).map((index) => numbers[index]).filter((value) => typeof value === "number");
|
|
1219
|
+
const setTick = (field) => (stepId, name) => setChoices((current) => ({
|
|
1220
|
+
...current,
|
|
1221
|
+
[field]: mapWith(current[field], stepId, name)
|
|
1222
|
+
}));
|
|
1223
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1224
|
+
className: "flex flex-col gap-4",
|
|
1225
|
+
"data-testid": testIdPrefix,
|
|
1226
|
+
children: [
|
|
1227
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1228
|
+
className: "flex flex-col gap-1",
|
|
1229
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
1230
|
+
className: "text-lg font-semibold text-foreground",
|
|
1231
|
+
children: tr("fluidgrids.builder.recording.reviewTitle", "Review your recording")
|
|
1232
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1233
|
+
className: "text-sm text-muted-foreground",
|
|
1234
|
+
"data-testid": `${testIdPrefix}-summary`,
|
|
1235
|
+
children: tr("fluidgrids.builder.recording.reviewSummary", "{{site}} · recorded in this browser · {{recorded}} actions became {{steps}} steps after clean-up · nothing is saved yet", {
|
|
1236
|
+
site: review.host ?? tr("fluidgrids.builder.recording.unknownSite", "Recorded site"),
|
|
1237
|
+
recorded: review.recordedCount,
|
|
1238
|
+
steps: stepCount
|
|
1239
|
+
})
|
|
1240
|
+
})]
|
|
1241
|
+
}),
|
|
1242
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1243
|
+
className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]",
|
|
1244
|
+
children: [/* @__PURE__ */ jsx(StepsSection, {
|
|
1245
|
+
review,
|
|
1246
|
+
choices,
|
|
1247
|
+
kept,
|
|
1248
|
+
numbers,
|
|
1249
|
+
onName: (id, name) => {
|
|
1250
|
+
setChoices((current) => ({
|
|
1251
|
+
...current,
|
|
1252
|
+
names: mapWith(current.names, id, name)
|
|
1253
|
+
}));
|
|
1254
|
+
edits.current += 1;
|
|
1255
|
+
},
|
|
1256
|
+
onRemove: (id) => {
|
|
1257
|
+
setChoices((current) => ({
|
|
1258
|
+
...current,
|
|
1259
|
+
removed: setWith(current.removed, id, true),
|
|
1260
|
+
inputs: mapWith(current.inputs, id, null),
|
|
1261
|
+
outputs: mapWith(current.outputs, id, null)
|
|
1262
|
+
}));
|
|
1263
|
+
edits.current += 1;
|
|
1264
|
+
},
|
|
1265
|
+
onKeep: (id) => {
|
|
1266
|
+
if (choices.removed.has(id)) edits.current = Math.max(0, edits.current - 1);
|
|
1267
|
+
setChoices((current) => ({
|
|
1268
|
+
...current,
|
|
1269
|
+
removed: setWith(current.removed, id, false)
|
|
1270
|
+
}));
|
|
1271
|
+
setKept((current) => setWith(current, id, true));
|
|
1272
|
+
},
|
|
1273
|
+
testIdPrefix
|
|
1274
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1275
|
+
className: "flex min-w-0 flex-col gap-4",
|
|
1276
|
+
children: [
|
|
1277
|
+
/* @__PURE__ */ jsx(InputsSection, {
|
|
1278
|
+
inputs: review.inputs,
|
|
1279
|
+
ticked: choices.inputs,
|
|
1280
|
+
numberOf,
|
|
1281
|
+
hasMasked: review.steps.some((entry) => entry.notes.some((note) => note.kind === "masked")),
|
|
1282
|
+
onTick: setTick("inputs"),
|
|
1283
|
+
testIdPrefix
|
|
1284
|
+
}),
|
|
1285
|
+
/* @__PURE__ */ jsx(OutputsSection, {
|
|
1286
|
+
outputs: review.outputs,
|
|
1287
|
+
ticked: choices.outputs,
|
|
1288
|
+
numberOf,
|
|
1289
|
+
onTick: setTick("outputs"),
|
|
1290
|
+
testIdPrefix
|
|
1291
|
+
}),
|
|
1292
|
+
review.connector && mode === "new" && /* @__PURE__ */ jsx(ConnectorCard, {
|
|
1293
|
+
connector: review.connector,
|
|
1294
|
+
chosen: choices.useConnector,
|
|
1295
|
+
steps: {
|
|
1296
|
+
from: connectorNumbers[0] ?? 1,
|
|
1297
|
+
to: connectorNumbers[connectorNumbers.length - 1] ?? 1
|
|
1298
|
+
},
|
|
1299
|
+
onChoose: (useConnector) => setChoices((current) => ({
|
|
1300
|
+
...current,
|
|
1301
|
+
useConnector
|
|
1302
|
+
})),
|
|
1303
|
+
testIdPrefix
|
|
1304
|
+
}),
|
|
1305
|
+
/* @__PURE__ */ jsx(DestinationSection, {
|
|
1306
|
+
mode,
|
|
1307
|
+
workflowName,
|
|
1308
|
+
onWorkflowName: setWorkflowName,
|
|
1309
|
+
testIdPrefix
|
|
1310
|
+
})
|
|
1311
|
+
]
|
|
1312
|
+
})]
|
|
1313
|
+
}),
|
|
1314
|
+
problem !== null && /* @__PURE__ */ jsx("p", {
|
|
1315
|
+
role: "alert",
|
|
1316
|
+
className: "text-sm text-[var(--color-status-error-text)]",
|
|
1317
|
+
"data-testid": `${testIdPrefix}-error`,
|
|
1318
|
+
children: problem
|
|
1319
|
+
}),
|
|
1320
|
+
/* @__PURE__ */ jsx(ReviewFooter, {
|
|
1321
|
+
mode,
|
|
1322
|
+
busy,
|
|
1323
|
+
canSave,
|
|
1324
|
+
onDiscard,
|
|
1325
|
+
onSave: () => handOver(onSave),
|
|
1326
|
+
onRunNow: onRunNow ? () => handOver(onRunNow) : void 0,
|
|
1327
|
+
testIdPrefix
|
|
1328
|
+
})
|
|
1329
|
+
]
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
// src/builder/components/rpa/recording-review/flow-support.ts
|
|
1334
|
+
/** The English text of each bridge error the person can act on. */
|
|
1335
|
+
const ERROR_TEXTS = [
|
|
1336
|
+
{
|
|
1337
|
+
code: "NOT_SIGNED_IN",
|
|
1338
|
+
key: "fluidgrids.builder.recording.error.NOT_SIGNED_IN",
|
|
1339
|
+
fallback: "Sign in to the FluidGrids extension, then try again."
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
code: "WORKSPACE_MISMATCH",
|
|
1343
|
+
key: "fluidgrids.builder.recording.error.WORKSPACE_MISMATCH",
|
|
1344
|
+
fallback: "The extension is set to another workspace. Choose this workspace in the extension, then try again."
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
code: "BUSY",
|
|
1348
|
+
key: "fluidgrids.builder.recording.error.BUSY",
|
|
1349
|
+
fallback: "The extension is already recording or picking. Finish or cancel that first."
|
|
1350
|
+
},
|
|
1351
|
+
{
|
|
1352
|
+
code: "INVALID_URL",
|
|
1353
|
+
key: "fluidgrids.builder.recording.error.INVALID_URL",
|
|
1354
|
+
fallback: "Enter a web address that starts with https:// or http://."
|
|
1355
|
+
},
|
|
1356
|
+
{
|
|
1357
|
+
code: "EMPTY_RECORDING",
|
|
1358
|
+
key: "fluidgrids.builder.recording.error.EMPTY_RECORDING",
|
|
1359
|
+
fallback: "Nothing was recorded. Start again and do the task in the opened tab."
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
code: "TOO_LARGE",
|
|
1363
|
+
key: "fluidgrids.builder.recording.error.TOO_LARGE",
|
|
1364
|
+
fallback: "The recording is too large to hand over. Record a shorter task."
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
code: "TIMEOUT",
|
|
1368
|
+
key: "fluidgrids.builder.recording.error.TIMEOUT",
|
|
1369
|
+
fallback: "The extension did not answer. Check that it is turned on, then try again."
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
code: "UNAVAILABLE",
|
|
1373
|
+
key: "fluidgrids.builder.recording.error.UNAVAILABLE",
|
|
1374
|
+
fallback: "The extension cannot be reached from this page."
|
|
1375
|
+
}
|
|
1376
|
+
];
|
|
1377
|
+
/** The English text of each paste problem. */
|
|
1378
|
+
const PASTE_TEXTS = [
|
|
1379
|
+
{
|
|
1380
|
+
problem: "empty",
|
|
1381
|
+
key: "fluidgrids.builder.recording.paste.empty",
|
|
1382
|
+
fallback: "Paste the steps you copied from the recorder."
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
problem: "notJson",
|
|
1386
|
+
key: "fluidgrids.builder.recording.paste.notJson",
|
|
1387
|
+
fallback: "This is not the recorder's copy. In the extension, open the recorder and choose Copy."
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
problem: "notSteps",
|
|
1391
|
+
key: "fluidgrids.builder.recording.paste.notSteps",
|
|
1392
|
+
fallback: "The pasted text holds no steps."
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
problem: "blocked",
|
|
1396
|
+
key: "fluidgrids.builder.recording.paste.blocked",
|
|
1397
|
+
fallback: "These steps cannot be used here. Check them in a Run in Browser node first."
|
|
1398
|
+
}
|
|
1399
|
+
];
|
|
1400
|
+
/** What a refused or failed operation says. */
|
|
1401
|
+
function errorText(tr, code, message) {
|
|
1402
|
+
const text = ERROR_TEXTS.find((item) => item.code === code);
|
|
1403
|
+
return text ? tr(text.key, text.fallback) : tr("fluidgrids.builder.recording.error.other", "The extension stopped: {{message}}", { message });
|
|
1404
|
+
}
|
|
1405
|
+
/** What a paste problem says. */
|
|
1406
|
+
function pasteText(tr, problem) {
|
|
1407
|
+
const text = PASTE_TEXTS.find((item) => item.problem === problem);
|
|
1408
|
+
return text ? tr(text.key, text.fallback) : problem;
|
|
1409
|
+
}
|
|
1410
|
+
/** What the builder says while it waits on the extension. */
|
|
1411
|
+
function waitingText(tr, phase, site) {
|
|
1412
|
+
switch (phase) {
|
|
1413
|
+
case "starting": return tr("fluidgrids.builder.recording.wait.starting", "Asking the extension to start…");
|
|
1414
|
+
case "consent": return tr("fluidgrids.builder.recording.wait.consent", "The extension opened a page that asks you to allow recording on {{site}}. Nothing is recorded before you allow it.", { site });
|
|
1415
|
+
case "active": return tr("fluidgrids.builder.recording.wait.recording", "Recording in the other tab. Do the task there, then press Stop in the recording bar.");
|
|
1416
|
+
case "confirming": return tr("fluidgrids.builder.recording.wait.confirm", "Waiting for you to confirm in the extension");
|
|
1417
|
+
case "declined": return tr("fluidgrids.builder.recording.wait.declined", "You chose not to send the recording. The extension keeps it until you send it or cancel.");
|
|
1418
|
+
default: return "";
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
/** What an operation that ended without a review says, or null while it has not. */
|
|
1422
|
+
function endedText(tr, state, handOffError) {
|
|
1423
|
+
if (state.phase === "failed") return errorText(tr, state.code, state.message);
|
|
1424
|
+
if (state.phase === "ended") return state.reason === "notAllowed" ? tr("fluidgrids.builder.recording.notAllowed", "Recording was not allowed on that site. Start again to choose differently.") : tr("fluidgrids.builder.recording.cancelled", "The recording was cancelled.");
|
|
1425
|
+
if (handOffError !== null) return tr("fluidgrids.builder.recording.badHandOff", "The recording could not be read: {{detail}}", { detail: handOffError });
|
|
1426
|
+
return null;
|
|
1427
|
+
}
|
|
1428
|
+
/** Whether the operation waits on the extension. */
|
|
1429
|
+
function isWaiting(state) {
|
|
1430
|
+
return state.phase === "starting" || state.phase === "consent" || state.phase === "active" || state.phase === "confirming" || state.phase === "declined";
|
|
1431
|
+
}
|
|
1432
|
+
function isRecord$1(value) {
|
|
1433
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1434
|
+
}
|
|
1435
|
+
/** The review of what the extension handed over, or why it cannot be shown. */
|
|
1436
|
+
function reviewOfHandOff(data) {
|
|
1437
|
+
const masked = Array.isArray(data.maskedStepIds) ? data.maskedStepIds.filter((id) => typeof id === "string") : [];
|
|
1438
|
+
if (!isRecord$1(data.script)) return { error: "The extension sent no steps." };
|
|
1439
|
+
try {
|
|
1440
|
+
return { review: reviewRecording(data.script, masked) };
|
|
1441
|
+
} catch (err) {
|
|
1442
|
+
return { error: err instanceof Error ? err.message : String(err) };
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
/** The default workflow name of a review. */
|
|
1446
|
+
function defaultRecordingName(tr, review) {
|
|
1447
|
+
return review.host ? tr("fluidgrids.builder.recording.workflowName", "{{site}} recording", { site: review.host }) : tr("fluidgrids.builder.recording.workflowNameNoSite", "Recorded task");
|
|
1448
|
+
}
|
|
1449
|
+
/** The usage counts of a saved review. */
|
|
1450
|
+
function savedCounts(result, review, source, via) {
|
|
1451
|
+
return {
|
|
1452
|
+
source,
|
|
1453
|
+
via,
|
|
1454
|
+
recordedSteps: review.recordedCount,
|
|
1455
|
+
steps: result.stepCount,
|
|
1456
|
+
inputs: result.inputCount,
|
|
1457
|
+
outputs: result.outputCount,
|
|
1458
|
+
maskedSteps: result.maskedSteps,
|
|
1459
|
+
flaggedSteps: result.flaggedSteps,
|
|
1460
|
+
reviewEdits: result.edits,
|
|
1461
|
+
connectorChosen: result.reviewed.connector !== null
|
|
1462
|
+
};
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
// src/builder/components/rpa/recording-review/HandOffPanels.tsx
|
|
1466
|
+
/**
|
|
1467
|
+
* The panels of Record a task before the review (RPA plan P1-12, spec 19
|
|
1468
|
+
* M3b): the start form (A), waiting on the extension (D), no extension (E),
|
|
1469
|
+
* extension too old (F) and Paste from the recorder.
|
|
1470
|
+
*
|
|
1471
|
+
* Loaded with the lazy recorder: Paste reads `@burdenoff/ui-engine`.
|
|
1472
|
+
*/
|
|
1473
|
+
/** A — the page to start recording on. */
|
|
1474
|
+
function StartForm({ urlText, urlError, onUrlText, onStart, onClose, testIdPrefix }) {
|
|
1475
|
+
const tr = useTr();
|
|
1476
|
+
const submit = (event) => {
|
|
1477
|
+
event.preventDefault();
|
|
1478
|
+
onStart();
|
|
1479
|
+
};
|
|
1480
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
1481
|
+
className: "flex flex-col gap-2",
|
|
1482
|
+
onSubmit: submit,
|
|
1483
|
+
"data-testid": `${testIdPrefix}-start`,
|
|
1484
|
+
children: [
|
|
1485
|
+
/* @__PURE__ */ jsx("label", {
|
|
1486
|
+
className: "text-sm font-medium text-foreground",
|
|
1487
|
+
htmlFor: `${testIdPrefix}-url`,
|
|
1488
|
+
children: tr("fluidgrids.builder.recording.startPage", "Start page")
|
|
1489
|
+
}),
|
|
1490
|
+
/* @__PURE__ */ jsx(Input, {
|
|
1491
|
+
id: `${testIdPrefix}-url`,
|
|
1492
|
+
value: urlText,
|
|
1493
|
+
inputMode: "url",
|
|
1494
|
+
placeholder: "https://",
|
|
1495
|
+
onChange: (event) => onUrlText(event.target.value),
|
|
1496
|
+
"aria-invalid": urlError,
|
|
1497
|
+
"data-testid": `${testIdPrefix}-url`
|
|
1498
|
+
}),
|
|
1499
|
+
/* @__PURE__ */ jsx("span", {
|
|
1500
|
+
className: "text-xs text-muted-foreground",
|
|
1501
|
+
children: tr("fluidgrids.builder.recording.startPageHint", "The extension opens this page in a new tab and asks you to allow recording on that site.")
|
|
1502
|
+
}),
|
|
1503
|
+
urlError && /* @__PURE__ */ jsx("p", {
|
|
1504
|
+
role: "alert",
|
|
1505
|
+
className: "text-xs text-[var(--color-status-error-text)]",
|
|
1506
|
+
"data-testid": `${testIdPrefix}-url-error`,
|
|
1507
|
+
children: tr("fluidgrids.builder.recording.error.INVALID_URL", "Enter a web address that starts with https:// or http://.")
|
|
1508
|
+
}),
|
|
1509
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1510
|
+
className: "flex flex-wrap gap-2",
|
|
1511
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
1512
|
+
type: "submit",
|
|
1513
|
+
"data-testid": `${testIdPrefix}-start-recording`,
|
|
1514
|
+
children: tr("fluidgrids.builder.recording.startRecording", "Start recording")
|
|
1515
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1516
|
+
type: "button",
|
|
1517
|
+
variant: "outline",
|
|
1518
|
+
onClick: onClose,
|
|
1519
|
+
"data-testid": `${testIdPrefix}-close`,
|
|
1520
|
+
children: tr("fluidgrids.builder.recording.cancel", "Cancel")
|
|
1521
|
+
})]
|
|
1522
|
+
})
|
|
1523
|
+
]
|
|
1524
|
+
});
|
|
1525
|
+
}
|
|
1526
|
+
/** D — waiting on the extension, with Cancel (and Send it now after "Don't send"). */
|
|
1527
|
+
function Waiting({ state, site, onCancel, onAskAgain, testIdPrefix }) {
|
|
1528
|
+
const tr = useTr();
|
|
1529
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1530
|
+
className: "flex flex-col gap-3",
|
|
1531
|
+
role: "status",
|
|
1532
|
+
"data-testid": `${testIdPrefix}-waiting`,
|
|
1533
|
+
"data-phase": state.phase,
|
|
1534
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
1535
|
+
className: "text-sm text-foreground",
|
|
1536
|
+
children: waitingText(tr, state.phase, site)
|
|
1537
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
1538
|
+
className: "flex flex-wrap gap-2",
|
|
1539
|
+
children: [state.phase === "declined" && /* @__PURE__ */ jsx(Button, {
|
|
1540
|
+
type: "button",
|
|
1541
|
+
onClick: onAskAgain,
|
|
1542
|
+
"data-testid": `${testIdPrefix}-ask-again`,
|
|
1543
|
+
children: tr("fluidgrids.builder.recording.askAgain", "Send it now")
|
|
1544
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1545
|
+
type: "button",
|
|
1546
|
+
variant: "outline",
|
|
1547
|
+
onClick: onCancel,
|
|
1548
|
+
"data-testid": `${testIdPrefix}-cancel-operation`,
|
|
1549
|
+
children: tr("fluidgrids.builder.recording.cancel", "Cancel")
|
|
1550
|
+
})]
|
|
1551
|
+
})]
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
/** E and F — no extension in this browser, or one too old to record into the builder. */
|
|
1555
|
+
function ExtensionNeeded({ tooOld, version, onRecheck, testIdPrefix }) {
|
|
1556
|
+
const tr = useTr();
|
|
1557
|
+
let text;
|
|
1558
|
+
if (!tooOld) text = tr("fluidgrids.builder.recording.installText", "The extension records what you do in a tab and sends the steps here. It works in Chrome, Edge and Firefox.");
|
|
1559
|
+
else if (version) text = tr("fluidgrids.builder.recording.updateText", "Your extension ({{version}}) still runs Run in Browser steps and older tasks, but it cannot record into the builder.", { version });
|
|
1560
|
+
else text = tr("fluidgrids.builder.recording.updateTextNoVersion", "Your extension still runs Run in Browser steps and older tasks, but it cannot record into the builder.");
|
|
1561
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
1562
|
+
className: "flex flex-col gap-2",
|
|
1563
|
+
"data-testid": `${testIdPrefix}-${tooOld ? "too-old" : "no-extension"}`,
|
|
1564
|
+
children: [
|
|
1565
|
+
/* @__PURE__ */ jsx("h3", {
|
|
1566
|
+
className: "text-sm font-semibold text-foreground",
|
|
1567
|
+
children: tooOld ? tr("fluidgrids.builder.recording.updateTitle", "Update the FluidGrids extension to {{version}}", { version: MIN_BRIDGE_EXTENSION_VERSION }) : tr("fluidgrids.builder.recording.installTitle", "Install the FluidGrids extension to record")
|
|
1568
|
+
}),
|
|
1569
|
+
/* @__PURE__ */ jsx("p", {
|
|
1570
|
+
className: "text-sm text-muted-foreground",
|
|
1571
|
+
children: text
|
|
1572
|
+
}),
|
|
1573
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1574
|
+
className: "flex flex-wrap items-center gap-3",
|
|
1575
|
+
children: [/* @__PURE__ */ jsx(FluidGridsDocsLink, {
|
|
1576
|
+
topic: "browserExtension",
|
|
1577
|
+
hideIcon: true,
|
|
1578
|
+
children: tooOld ? tr("fluidgrids.builder.recording.updateLink", "How to update") : tr("fluidgrids.builder.recording.installLink", "How to install the extension")
|
|
1579
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
1580
|
+
type: "button",
|
|
1581
|
+
variant: "ghost",
|
|
1582
|
+
size: "sm",
|
|
1583
|
+
onClick: onRecheck,
|
|
1584
|
+
"data-testid": `${testIdPrefix}-recheck`,
|
|
1585
|
+
children: tr("fluidgrids.builder.recording.recheck", "Check again")
|
|
1586
|
+
})]
|
|
1587
|
+
})
|
|
1588
|
+
]
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
/** Paste from the recorder: the clipboard path that works without the bridge. */
|
|
1592
|
+
function PastePanel({ onReview, testIdPrefix }) {
|
|
1593
|
+
const tr = useTr();
|
|
1594
|
+
const [text, setText] = useState("");
|
|
1595
|
+
const [problem, setProblem] = useState(null);
|
|
1596
|
+
const review = () => {
|
|
1597
|
+
const result = reviewPastedSteps(text);
|
|
1598
|
+
if ("problem" in result) {
|
|
1599
|
+
setProblem(result.problem);
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1602
|
+
setProblem(null);
|
|
1603
|
+
onReview(result.review);
|
|
1604
|
+
};
|
|
1605
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1606
|
+
className: "flex flex-col gap-2",
|
|
1607
|
+
"data-testid": `${testIdPrefix}-paste`,
|
|
1608
|
+
children: [
|
|
1609
|
+
/* @__PURE__ */ jsx("label", {
|
|
1610
|
+
className: "text-sm font-medium text-foreground",
|
|
1611
|
+
htmlFor: `${testIdPrefix}-paste-text`,
|
|
1612
|
+
children: tr("fluidgrids.builder.recording.pasteLabel", "Already copied steps from the recorder?")
|
|
1613
|
+
}),
|
|
1614
|
+
/* @__PURE__ */ jsx(Textarea, {
|
|
1615
|
+
id: `${testIdPrefix}-paste-text`,
|
|
1616
|
+
value: text,
|
|
1617
|
+
rows: 5,
|
|
1618
|
+
spellCheck: false,
|
|
1619
|
+
onChange: (event) => setText(event.target.value),
|
|
1620
|
+
placeholder: tr("fluidgrids.builder.recording.pastePlaceholder", "Paste the copied steps here"),
|
|
1621
|
+
className: "font-mono text-xs",
|
|
1622
|
+
"data-testid": `${testIdPrefix}-paste-text`
|
|
1623
|
+
}),
|
|
1624
|
+
problem && /* @__PURE__ */ jsx("p", {
|
|
1625
|
+
role: "alert",
|
|
1626
|
+
className: "text-xs text-[var(--color-status-error-text)]",
|
|
1627
|
+
"data-testid": `${testIdPrefix}-paste-problem`,
|
|
1628
|
+
children: pasteText(tr, problem)
|
|
1629
|
+
}),
|
|
1630
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
|
|
1631
|
+
type: "button",
|
|
1632
|
+
variant: "outline",
|
|
1633
|
+
onClick: review,
|
|
1634
|
+
"data-testid": `${testIdPrefix}-paste-review`,
|
|
1635
|
+
children: tr("fluidgrids.builder.recording.pasteButton", "Paste from the recorder")
|
|
1636
|
+
}) })
|
|
1637
|
+
]
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
// src/builder/components/rpa/recording-review/RecordTaskFlow.tsx
|
|
1642
|
+
/**
|
|
1643
|
+
* Record a task, from the start page to the review (RPA plan P1-12, spec 19
|
|
1644
|
+
* M3b panels A, D, E and F, then M3):
|
|
1645
|
+
*
|
|
1646
|
+
* - **A, start:** the page to start on. The extension opens it in a new tab
|
|
1647
|
+
* and asks the person to allow recording on that site (panel B, in the
|
|
1648
|
+
* extension). Phase 1 records in this browser only.
|
|
1649
|
+
* - **Waiting:** for the grant, for the recording, then for the person to
|
|
1650
|
+
* confirm "Send this recording to FluidGrids?" in the extension (panel D).
|
|
1651
|
+
* Cancel ends the operation in the extension too.
|
|
1652
|
+
* - **E, no extension:** the install guide and Paste from the recorder (the
|
|
1653
|
+
* clipboard path that works without the bridge).
|
|
1654
|
+
* - **F, extension too old:** "Update the FluidGrids extension to 0.4.0",
|
|
1655
|
+
* with Paste from the recorder.
|
|
1656
|
+
* - **Review:** the cleaned steps (`./RecordingReview.tsx`).
|
|
1657
|
+
*
|
|
1658
|
+
* The panels are in `./HandOffPanels.tsx`, their words in
|
|
1659
|
+
* `./flow-support.ts`. Loaded lazily (`./index.tsx`): the review loads
|
|
1660
|
+
* `@burdenoff/ui-engine`.
|
|
1661
|
+
*/
|
|
1662
|
+
/** The review of a recording, with Save and Run it now waiting on the caller. */
|
|
1663
|
+
function ReviewStage({ reviewed, mode, onClose, onSave, onRunNow, testIdPrefix }) {
|
|
1664
|
+
const tr = useTr();
|
|
1665
|
+
const [saving, setSaving] = useState(false);
|
|
1666
|
+
const [saveError, setSaveError] = useState(null);
|
|
1667
|
+
const save = async (result, handler) => {
|
|
1668
|
+
setSaving(true);
|
|
1669
|
+
setSaveError(null);
|
|
1670
|
+
try {
|
|
1671
|
+
const failed = await handler(result, reviewed.via, reviewed.review);
|
|
1672
|
+
if (failed) setSaveError(failed);
|
|
1673
|
+
else onClose();
|
|
1674
|
+
} catch (err) {
|
|
1675
|
+
setSaveError(err instanceof Error ? err.message : String(err));
|
|
1676
|
+
} finally {
|
|
1677
|
+
setSaving(false);
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
return /* @__PURE__ */ jsx(RecordingReview, {
|
|
1681
|
+
review: reviewed.review,
|
|
1682
|
+
mode,
|
|
1683
|
+
defaultWorkflowName: defaultRecordingName(tr, reviewed.review),
|
|
1684
|
+
busy: saving,
|
|
1685
|
+
error: saveError,
|
|
1686
|
+
onDiscard: onClose,
|
|
1687
|
+
onSave: (result) => void save(result, onSave),
|
|
1688
|
+
onRunNow: onRunNow ? (result) => void save(result, onRunNow) : void 0,
|
|
1689
|
+
testIdPrefix: `${testIdPrefix}-review`
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
function RecordTaskFlow({ mode, source, workspaceId, defaultUrl = "", onClose, onSave, onRunNow, testIdPrefix = "record-task" }) {
|
|
1693
|
+
const tr = useTr();
|
|
1694
|
+
const { bus } = useFluidGridsAnalytics();
|
|
1695
|
+
const [reviewed, setReviewed] = useState(null);
|
|
1696
|
+
const [urlText, setUrlText] = useState(defaultUrl);
|
|
1697
|
+
const [urlError, setUrlError] = useState(false);
|
|
1698
|
+
const [handOffError, setHandOffError] = useState(null);
|
|
1699
|
+
const { availability, recheck } = useBridgeAvailability(reviewed === null);
|
|
1700
|
+
const onReceived = useCallback((data) => {
|
|
1701
|
+
const result = reviewOfHandOff(data);
|
|
1702
|
+
if ("review" in result) setReviewed({
|
|
1703
|
+
review: result.review,
|
|
1704
|
+
via: "extension"
|
|
1705
|
+
});
|
|
1706
|
+
else setHandOffError(result.error);
|
|
1707
|
+
}, []);
|
|
1708
|
+
const operation = useBridgeOperation("record", workspaceId, onReceived);
|
|
1709
|
+
const { state } = operation;
|
|
1710
|
+
if (reviewed) return /* @__PURE__ */ jsx(ReviewStage, {
|
|
1711
|
+
reviewed,
|
|
1712
|
+
mode,
|
|
1713
|
+
onClose,
|
|
1714
|
+
onSave,
|
|
1715
|
+
onRunNow,
|
|
1716
|
+
testIdPrefix
|
|
1717
|
+
});
|
|
1718
|
+
const startUrl = startUrlOf(urlText);
|
|
1719
|
+
const start = () => {
|
|
1720
|
+
setUrlError(startUrl === null);
|
|
1721
|
+
if (!startUrl) return;
|
|
1722
|
+
setHandOffError(null);
|
|
1723
|
+
emitRecordingStarted(bus, {
|
|
1724
|
+
workspaceId: workspaceId ?? void 0,
|
|
1725
|
+
source,
|
|
1726
|
+
via: "extension"
|
|
1727
|
+
});
|
|
1728
|
+
operation.start(startUrl);
|
|
1729
|
+
};
|
|
1730
|
+
const onPasted = (pasted) => {
|
|
1731
|
+
emitRecordingStarted(bus, {
|
|
1732
|
+
workspaceId: workspaceId ?? void 0,
|
|
1733
|
+
source,
|
|
1734
|
+
via: "paste"
|
|
1735
|
+
});
|
|
1736
|
+
setReviewed({
|
|
1737
|
+
review: pasted,
|
|
1738
|
+
via: "paste"
|
|
1739
|
+
});
|
|
1740
|
+
};
|
|
1741
|
+
const ended = endedText(tr, state, handOffError);
|
|
1742
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1743
|
+
className: "flex flex-col gap-4",
|
|
1744
|
+
"data-testid": testIdPrefix,
|
|
1745
|
+
children: [
|
|
1746
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1747
|
+
className: "flex flex-col gap-1",
|
|
1748
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
1749
|
+
className: "text-lg font-semibold text-foreground",
|
|
1750
|
+
children: mode === "new" ? tr("fluidgrids.builder.recording.title", "Record a task") : tr("fluidgrids.builder.recording.recordMoreTitle", "Record more steps")
|
|
1751
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
1752
|
+
className: "text-sm text-muted-foreground",
|
|
1753
|
+
children: tr("fluidgrids.builder.recording.intro", "Do the task once in this browser. FluidGrids turns it into steps you can review before anything is saved.")
|
|
1754
|
+
})]
|
|
1755
|
+
}),
|
|
1756
|
+
availability === null && /* @__PURE__ */ jsx("p", {
|
|
1757
|
+
className: "text-sm text-muted-foreground",
|
|
1758
|
+
role: "status",
|
|
1759
|
+
"data-testid": `${testIdPrefix}-checking`,
|
|
1760
|
+
children: tr("fluidgrids.builder.recording.checking", "Looking for the FluidGrids extension…")
|
|
1761
|
+
}),
|
|
1762
|
+
availability?.kind === "ready" && !isWaiting(state) && /* @__PURE__ */ jsx(StartForm, {
|
|
1763
|
+
urlText,
|
|
1764
|
+
urlError,
|
|
1765
|
+
onUrlText: setUrlText,
|
|
1766
|
+
onStart: start,
|
|
1767
|
+
onClose,
|
|
1768
|
+
testIdPrefix
|
|
1769
|
+
}),
|
|
1770
|
+
isWaiting(state) && /* @__PURE__ */ jsx(Waiting, {
|
|
1771
|
+
state,
|
|
1772
|
+
site: startUrl ? new URL(startUrl).host : urlText,
|
|
1773
|
+
onCancel: operation.cancel,
|
|
1774
|
+
onAskAgain: operation.askAgain,
|
|
1775
|
+
testIdPrefix
|
|
1776
|
+
}),
|
|
1777
|
+
ended !== null && /* @__PURE__ */ jsx("p", {
|
|
1778
|
+
role: "alert",
|
|
1779
|
+
className: "text-sm text-[var(--color-status-error-text)]",
|
|
1780
|
+
"data-testid": `${testIdPrefix}-ended`,
|
|
1781
|
+
children: ended
|
|
1782
|
+
}),
|
|
1783
|
+
(availability?.kind === "absent" || availability?.kind === "tooOld") && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1784
|
+
/* @__PURE__ */ jsx(ExtensionNeeded, {
|
|
1785
|
+
tooOld: availability.kind === "tooOld",
|
|
1786
|
+
version: availability.kind === "tooOld" ? availability.version : null,
|
|
1787
|
+
onRecheck: recheck,
|
|
1788
|
+
testIdPrefix
|
|
1789
|
+
}),
|
|
1790
|
+
/* @__PURE__ */ jsx(PastePanel, {
|
|
1791
|
+
onReview: onPasted,
|
|
1792
|
+
testIdPrefix
|
|
1793
|
+
}),
|
|
1794
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
|
|
1795
|
+
type: "button",
|
|
1796
|
+
variant: "outline",
|
|
1797
|
+
onClick: onClose,
|
|
1798
|
+
"data-testid": `${testIdPrefix}-close`,
|
|
1799
|
+
children: tr("fluidgrids.builder.recording.cancel", "Cancel")
|
|
1800
|
+
}) })
|
|
1801
|
+
] })
|
|
1802
|
+
]
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
// src/builder/components/rpa/recording-review/save-recording.ts
|
|
1807
|
+
/** Where the nodes of a recorded workflow sit on the canvas. */
|
|
1808
|
+
const RECORDED_NODE_POSITION = {
|
|
1809
|
+
x: 360,
|
|
1810
|
+
y: 200
|
|
1811
|
+
};
|
|
1812
|
+
const CONNECTOR_NODE_POSITION = {
|
|
1813
|
+
x: 40,
|
|
1814
|
+
y: 200
|
|
1815
|
+
};
|
|
1816
|
+
function isRecord(value) {
|
|
1817
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1818
|
+
}
|
|
1819
|
+
/** `fresh` (a new Use Browser node) holding the reviewed script, its input values and a name. */
|
|
1820
|
+
function withRecordedScript(fresh, reviewed, label) {
|
|
1821
|
+
const data = isRecord(fresh.data) ? { ...fresh.data } : {};
|
|
1822
|
+
const args = isRecord(data.args) ? data.args : {};
|
|
1823
|
+
const state = isRecord(args.state) ? { ...args.state } : {};
|
|
1824
|
+
state[USE_BROWSER_SCRIPT_PARAMETER] = reviewed.script;
|
|
1825
|
+
if (Object.keys(reviewed.inputValues).length > 0) state[USE_BROWSER_INPUTS_PARAMETER] = { ...reviewed.inputValues };
|
|
1826
|
+
else delete state[USE_BROWSER_INPUTS_PARAMETER];
|
|
1827
|
+
data.args = {
|
|
1828
|
+
...args,
|
|
1829
|
+
state
|
|
1830
|
+
};
|
|
1831
|
+
if (label.trim()) data.label = label.trim();
|
|
1832
|
+
return {
|
|
1833
|
+
...fresh,
|
|
1834
|
+
position: { ...RECORDED_NODE_POSITION },
|
|
1835
|
+
selected: true,
|
|
1836
|
+
data
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
/** A store connector node from the registry, or null when its manifest cannot be loaded. */
|
|
1840
|
+
async function registryConnectorNode(nodeType, position) {
|
|
1841
|
+
if (!await ensureNodeTypeReady(nodeType)) return null;
|
|
1842
|
+
if (!getNodeConfig(nodeType)) return null;
|
|
1843
|
+
return {
|
|
1844
|
+
...createConfiguredNode(nodeType, position),
|
|
1845
|
+
selected: false
|
|
1846
|
+
};
|
|
1847
|
+
}
|
|
1848
|
+
const REGISTRY_NODES = {
|
|
1849
|
+
useBrowserNode: newUseBrowserNode,
|
|
1850
|
+
connectorNode: registryConnectorNode
|
|
1851
|
+
};
|
|
1852
|
+
/**
|
|
1853
|
+
* The nodes a recorded workflow starts with: the Use Browser node, and the
|
|
1854
|
+
* chosen connector before it. Null when the Use Browser node cannot be loaded
|
|
1855
|
+
* (its manifest is listed only while `fluidgrids.rpa.web` is on).
|
|
1856
|
+
*/
|
|
1857
|
+
async function recordedWorkflowNodes(reviewed, label, deps = REGISTRY_NODES) {
|
|
1858
|
+
const fresh = await deps.useBrowserNode({ ...RECORDED_NODE_POSITION }).catch(() => null);
|
|
1859
|
+
if (!fresh) return null;
|
|
1860
|
+
const nodes = [withRecordedScript(fresh, reviewed, label)];
|
|
1861
|
+
let connectorMissing = false;
|
|
1862
|
+
if (reviewed.connector) {
|
|
1863
|
+
const connector = await deps.connectorNode(reviewed.connector.nodeType, { ...CONNECTOR_NODE_POSITION }).catch(() => null);
|
|
1864
|
+
if (connector) nodes.unshift(connector);
|
|
1865
|
+
else connectorMissing = true;
|
|
1866
|
+
}
|
|
1867
|
+
return {
|
|
1868
|
+
nodes,
|
|
1869
|
+
connectorMissing
|
|
1870
|
+
};
|
|
1871
|
+
}
|
|
1872
|
+
/** The create input of a workflow that starts with `nodes`, otherwise exactly like a blank one. */
|
|
1873
|
+
function recordedWorkflowCreateInput(key, version, name, nodes) {
|
|
1874
|
+
const input = blankWorkflowCreateInput(key, version, name);
|
|
1875
|
+
const definition = isRecord(input.definitionJson) ? input.definitionJson : {};
|
|
1876
|
+
const data = isRecord(definition.data) ? definition.data : {};
|
|
1877
|
+
const useBrowser = nodes.find((node) => node.selected === true);
|
|
1878
|
+
return {
|
|
1879
|
+
...input,
|
|
1880
|
+
definitionJson: {
|
|
1881
|
+
...definition,
|
|
1882
|
+
data: {
|
|
1883
|
+
...data,
|
|
1884
|
+
nodes: [...nodes],
|
|
1885
|
+
sidebar: {
|
|
1886
|
+
active: "node-properties",
|
|
1887
|
+
panels: { nodeProperties: { selectedNode: useBrowser?.id ?? null } }
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
};
|
|
1892
|
+
}
|
|
1893
|
+
/** The first page a draft loads, for Record more's start page. */
|
|
1894
|
+
function firstPageOf(draft) {
|
|
1895
|
+
const step = draft?.steps.find((item) => item.action === "navigate");
|
|
1896
|
+
return typeof step?.url === "string" ? step.url : void 0;
|
|
1897
|
+
}
|
|
1898
|
+
/** Step ids inside a step, its blocks included. */
|
|
1899
|
+
function renumber(step, used) {
|
|
1900
|
+
const copy = { ...step };
|
|
1901
|
+
const id = newStepId(used);
|
|
1902
|
+
used.add(id);
|
|
1903
|
+
copy.id = id;
|
|
1904
|
+
for (const [key, value] of Object.entries(copy)) if (Array.isArray(value) && value.length > 0 && value.every(isDraftStep)) copy[key] = value.map((inner) => renumber(inner, used));
|
|
1905
|
+
return copy;
|
|
1906
|
+
}
|
|
1907
|
+
/** The longest input, output or variable name a script takes. */
|
|
1908
|
+
const MAX_NAME_LENGTH = 64;
|
|
1909
|
+
/** A name not in `taken`: the name itself, else `name_2`, `name_3`, … within 64 characters. */
|
|
1910
|
+
function freeName(name, taken) {
|
|
1911
|
+
if (!taken.has(name)) return name;
|
|
1912
|
+
for (let n = 2;; n++) {
|
|
1913
|
+
const suffix = `_${n}`;
|
|
1914
|
+
const candidate = `${name.slice(0, MAX_NAME_LENGTH - suffix.length)}${suffix}`;
|
|
1915
|
+
if (!taken.has(candidate)) return candidate;
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
function namesOf(list) {
|
|
1919
|
+
return Array.isArray(list) ? list.filter(isRecord).flatMap((item) => typeof item.name === "string" ? [item.name] : []) : [];
|
|
1920
|
+
}
|
|
1921
|
+
/** Every `saveAs` in a list of steps, their blocks included. */
|
|
1922
|
+
function savedNames(steps) {
|
|
1923
|
+
if (!Array.isArray(steps)) return [];
|
|
1924
|
+
return steps.filter(isRecord).flatMap((step) => [...typeof step.saveAs === "string" ? [step.saveAs] : [], ...Object.values(step).flatMap((value) => Array.isArray(value) ? savedNames(value) : [])]);
|
|
1925
|
+
}
|
|
1926
|
+
/** A copy of `value` with input and variable references (and `saveAs`) renamed. */
|
|
1927
|
+
function renameReferences(value, inputs, variables) {
|
|
1928
|
+
if (Array.isArray(value)) return value.map((item) => renameReferences(item, inputs, variables));
|
|
1929
|
+
if (!isRecord(value)) return value;
|
|
1930
|
+
const copy = Object.fromEntries(Object.entries(value).map(([key, inner]) => [key, renameReferences(inner, inputs, variables)]));
|
|
1931
|
+
if (typeof value.input === "string" && inputs.has(value.input)) copy.input = inputs.get(value.input);
|
|
1932
|
+
if (typeof value.var === "string" && variables.has(value.var)) copy.var = variables.get(value.var);
|
|
1933
|
+
if (typeof value.saveAs === "string" && variables.has(value.saveAs)) copy.saveAs = variables.get(value.saveAs);
|
|
1934
|
+
return copy;
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* Appends `reviewed` to the end of `draft` with new step ids. An appended
|
|
1938
|
+
* input, output or saved value whose name the draft already uses (as an
|
|
1939
|
+
* input, an output, a variable or a step's `saveAs`) gets a free name, and
|
|
1940
|
+
* the appended steps follow the rename, so nothing the node already returns
|
|
1941
|
+
* changes.
|
|
1942
|
+
*/
|
|
1943
|
+
function appendRecording(draft, reviewed) {
|
|
1944
|
+
const script = reviewed.script;
|
|
1945
|
+
const inputNames = new Set(namesOf(draft.inputs));
|
|
1946
|
+
const variableNames = /* @__PURE__ */ new Set([
|
|
1947
|
+
...namesOf(draft.variables),
|
|
1948
|
+
...savedNames(draft.steps),
|
|
1949
|
+
...savedNames(draft.cleanup)
|
|
1950
|
+
]);
|
|
1951
|
+
const outputNames = new Set(namesOf(draft.outputs));
|
|
1952
|
+
const inputRenames = /* @__PURE__ */ new Map();
|
|
1953
|
+
const inputs = (script.inputs ?? []).map((input) => {
|
|
1954
|
+
const name = freeName(input.name, inputNames);
|
|
1955
|
+
inputNames.add(name);
|
|
1956
|
+
if (name !== input.name) inputRenames.set(input.name, name);
|
|
1957
|
+
return {
|
|
1958
|
+
...input,
|
|
1959
|
+
name
|
|
1960
|
+
};
|
|
1961
|
+
});
|
|
1962
|
+
const variableRenames = /* @__PURE__ */ new Map();
|
|
1963
|
+
for (const saved of new Set(savedNames(script.steps))) {
|
|
1964
|
+
const name = freeName(saved, variableNames);
|
|
1965
|
+
variableNames.add(name);
|
|
1966
|
+
if (name !== saved) variableRenames.set(saved, name);
|
|
1967
|
+
}
|
|
1968
|
+
const outputs = (script.outputs ?? []).map((output) => {
|
|
1969
|
+
const name = freeName(variableRenames.get(output.name) ?? output.name, outputNames);
|
|
1970
|
+
outputNames.add(name);
|
|
1971
|
+
return {
|
|
1972
|
+
...output,
|
|
1973
|
+
name,
|
|
1974
|
+
value: renameReferences(output.value, inputRenames, variableRenames)
|
|
1975
|
+
};
|
|
1976
|
+
});
|
|
1977
|
+
const used = stepIds(draft);
|
|
1978
|
+
const steps = script.steps.map((step) => renumber(renameReferences(step, inputRenames, variableRenames), used));
|
|
1979
|
+
const inputValues = {};
|
|
1980
|
+
for (const [name, value] of Object.entries(reviewed.inputValues)) inputValues[inputRenames.get(name) ?? name] = value;
|
|
1981
|
+
return {
|
|
1982
|
+
draft: {
|
|
1983
|
+
...draft,
|
|
1984
|
+
steps: [...draft.steps, ...steps],
|
|
1985
|
+
...inputs.length > 0 ? { inputs: [...Array.isArray(draft.inputs) ? draft.inputs : [], ...inputs] } : {},
|
|
1986
|
+
...outputs.length > 0 ? { outputs: [...Array.isArray(draft.outputs) ? draft.outputs : [], ...outputs] } : {}
|
|
1987
|
+
},
|
|
1988
|
+
inputValues,
|
|
1989
|
+
firstPath: String(draft.steps.length)
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
// src/builder/components/rpa/recording-review/RecordTaskDialog.tsx
|
|
1994
|
+
var RecordTaskDialog_exports = /* @__PURE__ */ __exportAll({
|
|
1995
|
+
RecordMoreDialog: () => RecordMoreDialog,
|
|
1996
|
+
RecordTaskDialog: () => RecordTaskDialog,
|
|
1997
|
+
default: () => RecordTaskDialog
|
|
1998
|
+
});
|
|
1999
|
+
function Shell({ open, onOpenChange, title, zIndex, children }) {
|
|
2000
|
+
const tr = useTr();
|
|
2001
|
+
return /* @__PURE__ */ jsx(ResponsiveDialog, {
|
|
2002
|
+
open,
|
|
2003
|
+
onOpenChange,
|
|
2004
|
+
children: /* @__PURE__ */ jsxs(ResponsiveDialogContent, {
|
|
2005
|
+
style: zIndex === void 0 ? void 0 : { zIndex },
|
|
2006
|
+
onEscapeKeyDown: (event) => {
|
|
2007
|
+
if (event.target instanceof Element && event.target.closest("[data-recording-rename]")) event.preventDefault();
|
|
2008
|
+
},
|
|
2009
|
+
className: "max-h-[90vh] overflow-y-auto sm:max-w-5xl",
|
|
2010
|
+
children: [/* @__PURE__ */ jsxs(ResponsiveDialogHeader, {
|
|
2011
|
+
className: "sr-only",
|
|
2012
|
+
children: [/* @__PURE__ */ jsx(ResponsiveDialogTitle, { children: title }), /* @__PURE__ */ jsx(ResponsiveDialogDescription, { children: tr("fluidgrids.builder.recording.intro", "Do the task once in this browser. FluidGrids turns it into steps you can review before anything is saved.") })]
|
|
2013
|
+
}), open && children]
|
|
2014
|
+
})
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
/** New › Record a task: Save creates a workflow with the recorded node. */
|
|
2018
|
+
function RecordTaskDialog({ open, onOpenChange, workspaceId, createWorkflow, nodes = REGISTRY_NODES }) {
|
|
2019
|
+
const tr = useTr();
|
|
2020
|
+
const { bus } = useFluidGridsAnalytics();
|
|
2021
|
+
const onSave = async (result, via, review) => {
|
|
2022
|
+
const built = await recordedWorkflowNodes(result.reviewed, review.host ?? result.workflowName, nodes);
|
|
2023
|
+
if (!built) return tr("fluidgrids.builder.recording.noUseBrowser", "Could not load the Use Browser node, so nothing was saved. Check your connection and try again.");
|
|
2024
|
+
if ((await createWorkflow(result.workflowName, (key, version, name) => recordedWorkflowCreateInput(key, version, name, built.nodes)))?.status !== "opened") return tr("fluidgrids.builder.recording.notCreated", "The workflow was not created, so nothing was saved.");
|
|
2025
|
+
const recorded = built.nodes.find((node) => node.selected === true);
|
|
2026
|
+
if (recorded) followRecordedNode(recorded.id, result.edits);
|
|
2027
|
+
emitRecordingSaved(bus, {
|
|
2028
|
+
workspaceId: workspaceId ?? void 0,
|
|
2029
|
+
...savedCounts(result, review, "list", via)
|
|
2030
|
+
});
|
|
2031
|
+
return null;
|
|
2032
|
+
};
|
|
2033
|
+
return /* @__PURE__ */ jsx(Shell, {
|
|
2034
|
+
open,
|
|
2035
|
+
onOpenChange,
|
|
2036
|
+
title: tr("fluidgrids.builder.recording.title", "Record a task"),
|
|
2037
|
+
children: /* @__PURE__ */ jsx(RecordTaskFlow, {
|
|
2038
|
+
mode: "new",
|
|
2039
|
+
source: "list",
|
|
2040
|
+
workspaceId,
|
|
2041
|
+
onClose: () => onOpenChange(false),
|
|
2042
|
+
onSave,
|
|
2043
|
+
testIdPrefix: "record-task"
|
|
2044
|
+
})
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
/** Record more: Save adds the steps to the open Use Browser node. */
|
|
2048
|
+
function RecordMoreDialog({ open, onOpenChange, workspaceId, defaultUrl, onAppend, canRun, testIdPrefix = "ndv" }) {
|
|
2049
|
+
const tr = useTr();
|
|
2050
|
+
const { bus } = useFluidGridsAnalytics();
|
|
2051
|
+
const handler = (run) => async (result, via, review) => {
|
|
2052
|
+
const failed = await onAppend(result, run);
|
|
2053
|
+
if (failed) return failed;
|
|
2054
|
+
emitRecordingSaved(bus, {
|
|
2055
|
+
workspaceId: workspaceId ?? void 0,
|
|
2056
|
+
...savedCounts(result, review, "editor", via)
|
|
2057
|
+
});
|
|
2058
|
+
return null;
|
|
2059
|
+
};
|
|
2060
|
+
return /* @__PURE__ */ jsx(Shell, {
|
|
2061
|
+
open,
|
|
2062
|
+
onOpenChange,
|
|
2063
|
+
title: tr("fluidgrids.builder.recording.recordMoreTitle", "Record more steps"),
|
|
2064
|
+
zIndex: NDV_OVERLAY_Z_INDEX,
|
|
2065
|
+
children: /* @__PURE__ */ jsx(RecordTaskFlow, {
|
|
2066
|
+
mode: "append",
|
|
2067
|
+
source: "editor",
|
|
2068
|
+
workspaceId,
|
|
2069
|
+
defaultUrl,
|
|
2070
|
+
onClose: () => onOpenChange(false),
|
|
2071
|
+
onSave: handler(false),
|
|
2072
|
+
onRunNow: canRun ? handler(true) : void 0,
|
|
2073
|
+
testIdPrefix: `${testIdPrefix}-record-more`
|
|
2074
|
+
})
|
|
2075
|
+
});
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
export { firstPageOf as i, RecordTaskDialog_exports as n, appendRecording as r, RecordMoreDialog as t };
|