From 9d55d3f13436a433a29964d8ae9a0d7ac2e2397d Mon Sep 17 00:00:00 2001 From: Jan Jakes Date: Thu, 10 Nov 2022 10:24:31 +0300 Subject: [PATCH] Use "automation" instead of "workflow" [MAILPOET-4793] --- .../_add-trigger.scss | 2 +- .../{_workflow.scss => _automation.scss} | 6 +- ...y-workflow.scss => _empty-automation.scss} | 2 +- .../css/src/mailpoet-automation-editor.scss | 4 +- .../assets/js/src/automation/api/hooks.ts | 2 +- .../assets/js/src/automation/api/index.ts | 2 +- .../assets/js/src/automation/automation.tsx | 36 +-- mailpoet/assets/js/src/automation/config.ts | 4 +- .../automation/editor/api-error-handler.tsx | 2 +- .../components/actions/trash-button.tsx | 6 +- .../add-step-button.tsx | 4 +- .../{workflow => automation}/add-trigger.tsx | 6 +- .../{workflow => automation}/context.tsx | 2 +- .../automation/empty-automation.tsx | 9 + .../{workflow => automation}/index.tsx | 32 +- .../{workflow => automation}/separator.tsx | 0 .../{workflow => automation}/statistics.tsx | 10 +- .../step-more-menu.tsx | 2 +- .../{workflow => automation}/step.tsx | 4 +- .../{workflow => automation}/types.ts | 6 +- .../components/header/document_actions.tsx | 20 +- .../editor/components/header/errors.tsx | 16 +- .../editor/components/header/index.tsx | 38 +-- .../components/inserter-popover/index.tsx | 2 +- .../components/keyboard-shortcuts/index.tsx | 4 +- .../components/modals/deactivate-modal.tsx | 26 +- .../components/panel/activate-panel.tsx | 14 +- .../{workflow => automation}/index.tsx | 22 +- .../editor/components/sidebar/header.tsx | 14 +- .../editor/components/sidebar/index.tsx | 14 +- .../components/workflow/empty-workflow.tsx | 9 - .../assets/js/src/automation/editor/index.tsx | 34 +-- .../js/src/automation/editor/store/actions.ts | 81 ++--- .../src/automation/editor/store/constants.ts | 2 +- .../automation/editor/store/initial_state.ts | 4 +- .../js/src/automation/editor/store/reducer.ts | 34 +-- .../src/automation/editor/store/selectors.ts | 12 +- .../js/src/automation/editor/store/types.ts | 8 +- .../mailpoet/step-controls/index.tsx | 4 +- .../steps/send_email/edit/edit_newsletter.tsx | 22 +- .../mailpoet/steps/send_email/index.tsx | 4 +- .../integrations/mailpoet/types/filters.tsx | 7 +- ...ces.tsx => automation-listing-notices.tsx} | 23 +- .../listing/{workflow.ts => automation.ts} | 6 +- ...{edit-workflow.tsx => edit-automation.tsx} | 8 +- .../listing/components/actions/index.tsx | 2 +- .../listing/components/actions/undo-trash.tsx | 12 +- .../listing/components/cells/actions.tsx | 16 +- .../listing/components/cells/name.tsx | 10 +- .../listing/components/cells/status.tsx | 8 +- .../listing/components/cells/subscribers.tsx | 12 +- .../listing/components/menu/delete.tsx | 12 +- .../listing/components/menu/duplicate.tsx | 12 +- .../listing/components/menu/restore.tsx | 10 +- .../listing/components/menu/trash.tsx | 12 +- .../js/src/automation/listing/get-row.tsx | 24 +- .../js/src/automation/listing/index.tsx | 51 ++-- .../src/automation/listing/store/actions.tsx | 64 ++-- .../automation/listing/store/initial_state.ts | 2 +- .../src/automation/listing/store/reducer.ts | 24 +- .../src/automation/listing/store/selectors.ts | 12 +- .../js/src/automation/listing/store/types.ts | 4 +- .../sections/build-your-own-section.tsx | 4 +- .../automation/sections/templates-section.tsx | 4 +- .../components/template-list-item.tsx | 12 +- .../js/src/automation/templates/config.ts | 6 +- .../js/src/automation/templates/index.tsx | 4 +- mailpoet/assets/js/src/automation/testing.tsx | 22 +- .../assets/js/src/automation/types/filters.ts | 10 +- .../src/newsletter_editor/components/save.js | 8 +- .../js/src/newsletter_editor/initializer.jsx | 6 +- mailpoet/assets/js/src/newsletters/send.jsx | 8 +- .../assets/js/src/newsletters/templates.jsx | 6 +- mailpoet/lib/AdminPages/Pages/Automation.php | 22 +- .../lib/AdminPages/Pages/AutomationEditor.php | 30 +- .../AdminPages/Pages/AutomationTemplates.php | 10 +- mailpoet/lib/Analytics/Reporter.php | 68 ++--- mailpoet/lib/Automation/Engine/API/API.php | 14 +- ...CreateAutomationFromTemplateController.php | 47 +++ .../CreateWorkflowFromTemplateController.php | 47 --- .../Builder/DeleteAutomationController.php | 32 ++ .../Builder/DeleteWorkflowController.php | 32 -- ....php => DuplicateAutomationController.php} | 42 +-- .../Builder/UpdateAutomationController.php | 137 +++++++++ .../Engine/Builder/UpdateStepsController.php | 12 +- .../Builder/UpdateWorkflowController.php | 137 --------- .../Automation/Engine/Control/StepHandler.php | 128 ++++---- .../Engine/Control/TriggerHandler.php | 42 +-- .../Data/{Workflow.php => Automation.php} | 26 +- .../{WorkflowRun.php => AutomationRun.php} | 28 +- ...orkflowRunLog.php => AutomationRunLog.php} | 30 +- ...tatistics.php => AutomationStatistics.php} | 14 +- ...lowTemplate.php => AutomationTemplate.php} | 18 +- .../Automation/Engine/Data/StepRunArgs.php | 34 +-- .../Engine/Data/StepValidationArgs.php | 12 +- .../AutomationTemplatesGetEndpoint.php} | 14 +- .../AutomationsCreateFromTemplateEndpoint.php | 37 +++ .../AutomationsDeleteEndpoint.php} | 14 +- .../AutomationsDuplicateEndpoint.php | 38 +++ .../Automations/AutomationsGetEndpoint.php | 38 +++ .../Automations/AutomationsPutEndpoint.php | 42 +++ .../WorkflowsCreateFromTemplateEndpoint.php | 37 --- .../Workflows/WorkflowsDuplicateEndpoint.php | 38 --- .../Workflows/WorkflowsGetEndpoint.php | 38 --- .../Workflows/WorkflowsPutEndpoint.php | 42 --- mailpoet/lib/Automation/Engine/Engine.php | 40 +-- mailpoet/lib/Automation/Engine/Exceptions.php | 112 +++---- mailpoet/lib/Automation/Engine/Hooks.php | 30 +- .../Engine/Mappers/AutomationMapper.php | 72 +++++ .../Engine/Mappers/WorkflowMapper.php | 72 ----- .../Automation/Engine/Migrations/Migrator.php | 42 +-- mailpoet/lib/Automation/Engine/Registry.php | 8 +- ...torage.php => AutomationRunLogStorage.php} | 26 +- ...unStorage.php => AutomationRunStorage.php} | 32 +- .../Storage/AutomationStatisticsStorage.php | 106 +++++++ .../Engine/Storage/AutomationStorage.php | 288 ++++++++++++++++++ ...rage.php => AutomationTemplateStorage.php} | 62 ++-- .../Storage/WorkflowStatisticsStorage.php | 106 ------- .../Engine/Storage/WorkflowStorage.php | 288 ------------------ .../AutomationNode.php} | 4 +- .../AutomationGraph/AutomationNodeVisitor.php | 13 + .../AutomationWalker.php} | 22 +- .../AutomationRules/AtLeastOneTriggerRule.php | 37 +++ .../AutomationRules/ConsistentStepMapRule.php | 30 ++ .../AutomationRules/NoCycleRule.php | 37 +++ .../AutomationRules/NoDuplicateEdgesRule.php | 28 ++ .../Validation/AutomationRules/NoJoinRule.php | 34 +++ .../AutomationRules/NoSplitRule.php | 25 ++ .../NoUnreachableStepsRule.php | 29 ++ .../TriggerNeedsToBeFollowedByActionRule.php | 41 +++ .../AutomationRules/TriggersUnderRootRule.php | 42 +++ .../AutomationRules/UnknownStepRule.php | 64 ++++ .../ValidStepArgsRule.php | 16 +- .../ValidStepOrderRule.php | 22 +- .../ValidStepRule.php | 34 +-- .../ValidStepValidationRule.php | 24 +- ...orkflowSchema.php => AutomationSchema.php} | 2 +- .../Engine/Validation/AutomationValidator.php | 71 +++++ .../WorkflowGraph/WorkflowNodeVisitor.php | 13 - .../WorkflowRules/AtLeastOneTriggerRule.php | 37 --- .../WorkflowRules/ConsistentStepMapRule.php | 30 -- .../Validation/WorkflowRules/NoCycleRule.php | 37 --- .../WorkflowRules/NoDuplicateEdgesRule.php | 28 -- .../Validation/WorkflowRules/NoJoinRule.php | 34 --- .../Validation/WorkflowRules/NoSplitRule.php | 25 -- .../WorkflowRules/NoUnreachableStepsRule.php | 29 -- .../TriggerNeedsToBeFollowedByActionRule.php | 41 --- .../WorkflowRules/TriggersUnderRootRule.php | 42 --- .../WorkflowRules/UnknownStepRule.php | 64 ---- .../Engine/Validation/WorkflowValidator.php | 71 ----- .../Integrations/Core/Actions/DelayAction.php | 4 +- .../Hooks/AutomationEditorLoadingHooks.php | 36 +-- .../MailPoet/MailPoetIntegration.php | 2 +- ...kflowBuilder.php => AutomationBuilder.php} | 16 +- mailpoet/lib/Config/Populator.php | 4 +- mailpoet/lib/DI/ContainerConfigurator.php | 46 +-- .../Entities/NewsletterOptionFieldEntity.php | 4 +- ...flow.png => customize-your-automation.png} | Bin .../tasks/phpstan/phpstan-7-baseline.neon | 4 +- .../tasks/phpstan/phpstan-8-baseline.neon | 4 +- .../tasks/phpstan/phpstan-8.1-baseline.neon | 4 +- mailpoet/tasks/phpstan/phpstan.neon | 4 +- mailpoet/tests/_support/AcceptanceTester.php | 2 +- .../_support/CheckSkippedTestsExtension.php | 4 +- .../ConfirmLeaveWhenUnsavedChangesCest.php | 4 +- ...reateEmailAutomationAndWalkThroughCest.php | 10 +- ...scribesWorkflowTriggeredByCheckoutCest.php | 56 ++-- .../UserRegistrationTriggerCest.php | 60 ++-- .../Engine/Control/StepHandlerTest.php | 160 +++++----- ...unLogTest.php => AutomationRunLogTest.php} | 148 ++++----- .../Storage/AutomationRunLogStorageTest.php | 51 ++++ .../AutomationStatisticsStorageTest.php | 203 ++++++++++++ .../Engine/Storage/AutomationStorageTest.php | 151 +++++++++ .../Storage/WorkflowRunLogStorageTest.php | 51 ---- .../Storage/WorkflowStatisticsStorageTest.php | 203 ------------ .../Engine/Storage/WorkflowStorageTest.php | 151 --------- .../Core/Actions/DelayActionTest.php | 20 +- .../MailPoet/Actions/SendEmailActionTest.php | 54 ++-- .../Triggers/SomeoneSubscribesTriggerTest.php | 14 +- .../Triggers/UserRegistrationTriggerTest.php | 14 +- .../Automations/AutomationPutEndpointTest.php | 134 ++++++++ .../AutomationTemplatesGetEndpointTest.php} | 14 +- .../AutomationsCreateFromTemplateTest.php | 81 +++++ .../AutomationsDeleteEndpointTest.php | 80 +++++ .../AutomationsDuplicateEndpointTest.php} | 62 ++-- .../AutomationsGetTest.php} | 72 ++--- .../Workflows/WorkflowPutEndpointTest.php | 134 -------- .../WorkflowsCreateFromTemplateTest.php | 81 ----- .../Workflows/WorkflowsDeleteEndpointTest.php | 80 ----- .../WorkflowWalkerTest.php | 52 ++-- .../AutomationRules/AtLeastOneTriggerTest.php | 37 +++ .../AutomationRuleTest.php} | 10 +- .../ConsistentStepMapRuleTest.php | 30 ++ .../NoCycleRuleTest.php | 24 +- .../NoDuplicateEdgesTest.php | 16 +- .../NoJoinRuleTest.php | 28 +- .../NoSplitRuleTest.php | 24 +- .../NoUnreachableStepsRuleTest.php | 22 +- .../TriggerNeedsNextStepsRuleTest.php | 28 +- .../TriggersUnderRootRuleTest.php | 18 +- .../UnknownStepRuleTest.php | 56 ++-- .../ValidStepArgsRuleTest.php | 22 +- .../ValidStepOrderRuleTest.php | 36 +-- .../ValidStepRuleTest.php | 50 +-- .../ValidStepValidationRuleTest.php | 32 +- .../WorkflowRules/AtLeastOneTriggerTest.php | 37 --- .../ConsistentStepMapRuleTest.php | 30 -- mailpoet/views/automation.html | 2 +- mailpoet/views/automation/editor.html | 2 +- .../newsletter/templates/components/save.hbs | 2 +- 210 files changed, 3677 insertions(+), 3659 deletions(-) rename mailpoet/assets/css/src/components-automation-editor/{_workflow.scss => _automation.scss} (78%) rename mailpoet/assets/css/src/components-automation-editor/{_empty-workflow.scss => _empty-automation.scss} (68%) rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/add-step-button.tsx (86%) rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/add-trigger.tsx (83%) rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/context.tsx (83%) create mode 100644 mailpoet/assets/js/src/automation/editor/components/automation/empty-automation.tsx rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/index.tsx (79%) rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/separator.tsx (100%) rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/statistics.tsx (81%) rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/step-more-menu.tsx (97%) rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/step.tsx (96%) rename mailpoet/assets/js/src/automation/editor/components/{workflow => automation}/types.ts (81%) rename mailpoet/assets/js/src/automation/editor/components/sidebar/{workflow => automation}/index.tsx (61%) delete mode 100644 mailpoet/assets/js/src/automation/editor/components/workflow/empty-workflow.tsx rename mailpoet/assets/js/src/automation/listing/{workflow-listing-notices.tsx => automation-listing-notices.tsx} (65%) rename mailpoet/assets/js/src/automation/listing/{workflow.ts => automation.ts} (73%) rename mailpoet/assets/js/src/automation/listing/components/actions/{edit-workflow.tsx => edit-automation.tsx} (59%) create mode 100644 mailpoet/lib/Automation/Engine/Builder/CreateAutomationFromTemplateController.php delete mode 100644 mailpoet/lib/Automation/Engine/Builder/CreateWorkflowFromTemplateController.php create mode 100644 mailpoet/lib/Automation/Engine/Builder/DeleteAutomationController.php delete mode 100644 mailpoet/lib/Automation/Engine/Builder/DeleteWorkflowController.php rename mailpoet/lib/Automation/Engine/Builder/{DuplicateWorkflowController.php => DuplicateAutomationController.php} (62%) create mode 100644 mailpoet/lib/Automation/Engine/Builder/UpdateAutomationController.php delete mode 100644 mailpoet/lib/Automation/Engine/Builder/UpdateWorkflowController.php rename mailpoet/lib/Automation/Engine/Data/{Workflow.php => Automation.php} (84%) rename mailpoet/lib/Automation/Engine/Data/{WorkflowRun.php => AutomationRun.php} (81%) rename mailpoet/lib/Automation/Engine/Data/{WorkflowRunLog.php => AutomationRunLog.php} (80%) rename mailpoet/lib/Automation/Engine/Data/{WorkflowStatistics.php => AutomationStatistics.php} (78%) rename mailpoet/lib/Automation/Engine/Data/{WorkflowTemplate.php => AutomationTemplate.php} (84%) rename mailpoet/lib/Automation/Engine/Endpoints/{Workflows/WorkflowTemplatesGetEndpoint.php => Automations/AutomationTemplatesGetEndpoint.php} (59%) create mode 100644 mailpoet/lib/Automation/Engine/Endpoints/Automations/AutomationsCreateFromTemplateEndpoint.php rename mailpoet/lib/Automation/Engine/Endpoints/{Workflows/WorkflowsDeleteEndpoint.php => Automations/AutomationsDeleteEndpoint.php} (57%) create mode 100644 mailpoet/lib/Automation/Engine/Endpoints/Automations/AutomationsDuplicateEndpoint.php create mode 100644 mailpoet/lib/Automation/Engine/Endpoints/Automations/AutomationsGetEndpoint.php create mode 100644 mailpoet/lib/Automation/Engine/Endpoints/Automations/AutomationsPutEndpoint.php delete mode 100644 mailpoet/lib/Automation/Engine/Endpoints/Workflows/WorkflowsCreateFromTemplateEndpoint.php delete mode 100644 mailpoet/lib/Automation/Engine/Endpoints/Workflows/WorkflowsDuplicateEndpoint.php delete mode 100644 mailpoet/lib/Automation/Engine/Endpoints/Workflows/WorkflowsGetEndpoint.php delete mode 100644 mailpoet/lib/Automation/Engine/Endpoints/Workflows/WorkflowsPutEndpoint.php create mode 100644 mailpoet/lib/Automation/Engine/Mappers/AutomationMapper.php delete mode 100644 mailpoet/lib/Automation/Engine/Mappers/WorkflowMapper.php rename mailpoet/lib/Automation/Engine/Storage/{WorkflowRunLogStorage.php => AutomationRunLogStorage.php} (67%) rename mailpoet/lib/Automation/Engine/Storage/{WorkflowRunStorage.php => AutomationRunStorage.php} (69%) create mode 100644 mailpoet/lib/Automation/Engine/Storage/AutomationStatisticsStorage.php create mode 100644 mailpoet/lib/Automation/Engine/Storage/AutomationStorage.php rename mailpoet/lib/Automation/Engine/Storage/{WorkflowTemplateStorage.php => AutomationTemplateStorage.php} (73%) delete mode 100644 mailpoet/lib/Automation/Engine/Storage/WorkflowStatisticsStorage.php delete mode 100644 mailpoet/lib/Automation/Engine/Storage/WorkflowStorage.php rename mailpoet/lib/Automation/Engine/Validation/{WorkflowGraph/WorkflowNode.php => AutomationGraph/AutomationNode.php} (84%) create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationGraph/AutomationNodeVisitor.php rename mailpoet/lib/Automation/Engine/Validation/{WorkflowGraph/WorkflowWalker.php => AutomationGraph/AutomationWalker.php} (76%) create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/AtLeastOneTriggerRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/ConsistentStepMapRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/NoCycleRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/NoDuplicateEdgesRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/NoJoinRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/NoSplitRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/NoUnreachableStepsRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/TriggerNeedsToBeFollowedByActionRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/TriggersUnderRootRule.php create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationRules/UnknownStepRule.php rename mailpoet/lib/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/ValidStepArgsRule.php (73%) rename mailpoet/lib/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/ValidStepOrderRule.php (63%) rename mailpoet/lib/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/ValidStepRule.php (80%) rename mailpoet/lib/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/ValidStepValidationRule.php (61%) rename mailpoet/lib/Automation/Engine/Validation/{WorkflowSchema.php => AutomationSchema.php} (98%) create mode 100644 mailpoet/lib/Automation/Engine/Validation/AutomationValidator.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowGraph/WorkflowNodeVisitor.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/AtLeastOneTriggerRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/ConsistentStepMapRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/NoCycleRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/NoDuplicateEdgesRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/NoJoinRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/NoSplitRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/NoUnreachableStepsRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/TriggerNeedsToBeFollowedByActionRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/TriggersUnderRootRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowRules/UnknownStepRule.php delete mode 100644 mailpoet/lib/Automation/Engine/Validation/WorkflowValidator.php rename mailpoet/lib/Automation/Integrations/MailPoet/Templates/{WorkflowBuilder.php => AutomationBuilder.php} (75%) rename mailpoet/plugin_repository/assets/automation/sections/{customize-your-workflow.png => customize-your-automation.png} (100%) rename mailpoet/tests/integration/Automation/Engine/Data/{WorkflowRunLogTest.php => AutomationRunLogTest.php} (58%) create mode 100644 mailpoet/tests/integration/Automation/Engine/Storage/AutomationRunLogStorageTest.php create mode 100644 mailpoet/tests/integration/Automation/Engine/Storage/AutomationStatisticsStorageTest.php create mode 100644 mailpoet/tests/integration/Automation/Engine/Storage/AutomationStorageTest.php delete mode 100644 mailpoet/tests/integration/Automation/Engine/Storage/WorkflowRunLogStorageTest.php delete mode 100644 mailpoet/tests/integration/Automation/Engine/Storage/WorkflowStatisticsStorageTest.php delete mode 100644 mailpoet/tests/integration/Automation/Engine/Storage/WorkflowStorageTest.php create mode 100644 mailpoet/tests/integration/REST/Automation/Automations/AutomationPutEndpointTest.php rename mailpoet/tests/integration/REST/Automation/{Workflows/WorkflowTemplatesGetEndpointTest.php => Automations/AutomationTemplatesGetEndpointTest.php} (72%) create mode 100644 mailpoet/tests/integration/REST/Automation/Automations/AutomationsCreateFromTemplateTest.php create mode 100644 mailpoet/tests/integration/REST/Automation/Automations/AutomationsDeleteEndpointTest.php rename mailpoet/tests/integration/REST/Automation/{Workflows/WorkflowsDuplicateEndpointTest.php => Automations/AutomationsDuplicateEndpointTest.php} (53%) rename mailpoet/tests/integration/REST/Automation/{Workflows/WorkflowsGetTest.php => Automations/AutomationsGetTest.php} (65%) delete mode 100644 mailpoet/tests/integration/REST/Automation/Workflows/WorkflowPutEndpointTest.php delete mode 100644 mailpoet/tests/integration/REST/Automation/Workflows/WorkflowsCreateFromTemplateTest.php delete mode 100644 mailpoet/tests/integration/REST/Automation/Workflows/WorkflowsDeleteEndpointTest.php rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowGraph => AutomationGraph}/WorkflowWalkerTest.php (62%) create mode 100644 mailpoet/tests/unit/Automation/Engine/Validation/AutomationRules/AtLeastOneTriggerTest.php rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules/WorkflowRuleTest.php => AutomationRules/AutomationRuleTest.php} (65%) create mode 100644 mailpoet/tests/unit/Automation/Engine/Validation/AutomationRules/ConsistentStepMapRuleTest.php rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/NoCycleRuleTest.php (59%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/NoDuplicateEdgesTest.php (53%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/NoJoinRuleTest.php (64%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/NoSplitRuleTest.php (59%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/NoUnreachableStepsRuleTest.php (57%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/TriggerNeedsNextStepsRuleTest.php (53%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/TriggersUnderRootRuleTest.php (58%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/UnknownStepRuleTest.php (56%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/ValidStepArgsRuleTest.php (61%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/ValidStepOrderRuleTest.php (85%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/ValidStepRuleTest.php (59%) rename mailpoet/tests/unit/Automation/Engine/Validation/{WorkflowRules => AutomationRules}/ValidStepValidationRuleTest.php (75%) delete mode 100644 mailpoet/tests/unit/Automation/Engine/Validation/WorkflowRules/AtLeastOneTriggerTest.php delete mode 100644 mailpoet/tests/unit/Automation/Engine/Validation/WorkflowRules/ConsistentStepMapRuleTest.php diff --git a/mailpoet/assets/css/src/components-automation-editor/_add-trigger.scss b/mailpoet/assets/css/src/components-automation-editor/_add-trigger.scss index c57a2d7ab2..5306f68f5a 100644 --- a/mailpoet/assets/css/src/components-automation-editor/_add-trigger.scss +++ b/mailpoet/assets/css/src/components-automation-editor/_add-trigger.scss @@ -1,4 +1,4 @@ -.mailpoet-automation-workflow-add-trigger { +.mailpoet-automation-automation-add-trigger { align-items: center; border: 1px dashed #c3c4c7; border-radius: 4px; diff --git a/mailpoet/assets/css/src/components-automation-editor/_workflow.scss b/mailpoet/assets/css/src/components-automation-editor/_automation.scss similarity index 78% rename from mailpoet/assets/css/src/components-automation-editor/_workflow.scss rename to mailpoet/assets/css/src/components-automation-editor/_automation.scss index b743bca33b..a476b67696 100644 --- a/mailpoet/assets/css/src/components-automation-editor/_workflow.scss +++ b/mailpoet/assets/css/src/components-automation-editor/_automation.scss @@ -1,14 +1,14 @@ -.mailpoet-automation-editor-workflow { +.mailpoet-automation-editor-automation { background: #fbfbfb; flex-grow: 1; } -.mailpoet-automation-editor-workflow-wrapper { +.mailpoet-automation-editor-automation-wrapper { display: grid; padding: 50px 20px; } -.mailpoet-automation-editor-workflow-end { +.mailpoet-automation-editor-automation-end { background: #8c8f94; border-radius: 999999px; fill: white; diff --git a/mailpoet/assets/css/src/components-automation-editor/_empty-workflow.scss b/mailpoet/assets/css/src/components-automation-editor/_empty-automation.scss similarity index 68% rename from mailpoet/assets/css/src/components-automation-editor/_empty-workflow.scss rename to mailpoet/assets/css/src/components-automation-editor/_empty-automation.scss index 2cd7db80a8..7b65f95d3b 100644 --- a/mailpoet/assets/css/src/components-automation-editor/_empty-workflow.scss +++ b/mailpoet/assets/css/src/components-automation-editor/_empty-automation.scss @@ -1,4 +1,4 @@ -.mailpoet-automation-editor-empty-workflow { +.mailpoet-automation-editor-empty-automation { align-items: center; display: grid; height: 100%; diff --git a/mailpoet/assets/css/src/mailpoet-automation-editor.scss b/mailpoet/assets/css/src/mailpoet-automation-editor.scss index c88404f6b1..2a28d4c7b4 100644 --- a/mailpoet/assets/css/src/mailpoet-automation-editor.scss +++ b/mailpoet/assets/css/src/mailpoet-automation-editor.scss @@ -11,17 +11,17 @@ @import './components-automation-editor/add-step-button'; @import './components-automation-editor/add-trigger'; +@import './components-automation-editor/automation'; @import './components-automation-editor/block-icon'; @import './components-automation-editor/chip'; @import './components-automation-editor/dropdown'; -@import './components-automation-editor/empty-workflow'; +@import './components-automation-editor/empty-automation'; @import './components-automation-editor/errors'; @import './components-automation-editor/panel'; @import './components-automation-editor/separator'; @import './components-automation-editor/status'; @import './components-automation-editor/step'; @import './components-automation-editor/step-card'; -@import './components-automation-editor/workflow'; @import './components-automation-editor/notices'; @import './components-automation-editor/deactivate-modal'; diff --git a/mailpoet/assets/js/src/automation/api/hooks.ts b/mailpoet/assets/js/src/automation/api/hooks.ts index b203c6e198..04b76cde3f 100644 --- a/mailpoet/assets/js/src/automation/api/hooks.ts +++ b/mailpoet/assets/js/src/automation/api/hooks.ts @@ -1,7 +1,7 @@ import { useCallback, useEffect, useState } from 'react'; import { api } from '../config'; -const API_URL = `${api.root}/mailpoet/v1/automation`; +const API_URL = `${api.root}/mailpoet/v1`; export const request = ( path: string, diff --git a/mailpoet/assets/js/src/automation/api/index.ts b/mailpoet/assets/js/src/automation/api/index.ts index e2764ff70c..abb25d5bf5 100644 --- a/mailpoet/assets/js/src/automation/api/index.ts +++ b/mailpoet/assets/js/src/automation/api/index.ts @@ -3,7 +3,7 @@ import { api } from '../config'; export * from './hooks'; -const apiUrl = `${api.root}/mailpoet/v1/automation/`; +const apiUrl = `${api.root}/mailpoet/v1/`; export type ApiError = { code?: string; diff --git a/mailpoet/assets/js/src/automation/automation.tsx b/mailpoet/assets/js/src/automation/automation.tsx index a90b371c2f..d61b3b1532 100644 --- a/mailpoet/assets/js/src/automation/automation.tsx +++ b/mailpoet/assets/js/src/automation/automation.tsx @@ -10,11 +10,11 @@ import { createStore, storeName } from './listing/store'; import { AutomationListing, AutomationListingHeader } from './listing'; import { registerApiErrorHandler } from './listing/api-error-handler'; import { Notices } from './listing/components/notices'; -import { WorkflowListingNotices } from './listing/workflow-listing-notices'; +import { AutomationListingNotices } from './listing/automation-listing-notices'; import { BuildYourOwnSection, HeroSection, TemplatesSection } from './sections'; import { - CreateEmptyWorkflowButton, - CreateWorkflowFromTemplateButton, + CreateEmptyAutomationButton, + CreateAutomationFromTemplateButton, } from './testing'; import { MailPoet } from '../mailpoet'; @@ -24,7 +24,7 @@ const trackOpenEvent = () => { function Content(): JSX.Element { const [isBooting, setIsBooting] = useState(true); - const count = useSelect((select) => select(storeName).getWorkflowCount()); + const count = useSelect((select) => select(storeName).getAutomationCount()); useEffect(() => { if (!isBooting || count === 0) { @@ -63,7 +63,7 @@ function Content(): JSX.Element { ); } -function Workflows(): JSX.Element { +function Automations(): JSX.Element { return ( <> @@ -80,7 +80,7 @@ function RecreateSchemaButton(): JSX.Element { return (
- +
setWorkflowName(newName)} + value={automationName} + onChange={(newName) => setAutomationName(newName)} help={__( `Give the automation a name that indicates its purpose. E.g. "Abandoned cart recovery"`, 'mailpoet', @@ -249,19 +249,19 @@ export function Header({ showInserterToggle }: Props): JSX.Element {
- {workflowStatus === WorkflowStatus.DRAFT && ( + {automationStatus === AutomationStatus.DRAFT && ( <> )} - {workflowStatus === WorkflowStatus.ACTIVE && ( + {automationStatus === AutomationStatus.ACTIVE && ( <> )} - {workflowStatus === WorkflowStatus.DEACTIVATING && ( + {automationStatus === AutomationStatus.DEACTIVATING && ( <> diff --git a/mailpoet/assets/js/src/automation/editor/components/inserter-popover/index.tsx b/mailpoet/assets/js/src/automation/editor/components/inserter-popover/index.tsx index 288e3f0fee..74c2dabea0 100644 --- a/mailpoet/assets/js/src/automation/editor/components/inserter-popover/index.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/inserter-popover/index.tsx @@ -22,7 +22,7 @@ export function InserterPopover(): JSX.Element | null { const onInsert = useCallback((item: Item) => { const addStepCallback: AddStepCallbackType = Hooks.applyFilters( - 'mailpoet.automation.workflow.add_step_callback', + 'mailpoet.automation.automation.add_step_callback', () => { setShowModal(true); }, diff --git a/mailpoet/assets/js/src/automation/editor/components/keyboard-shortcuts/index.tsx b/mailpoet/assets/js/src/automation/editor/components/keyboard-shortcuts/index.tsx index b13764c8c9..8fb9a11f7d 100644 --- a/mailpoet/assets/js/src/automation/editor/components/keyboard-shortcuts/index.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/keyboard-shortcuts/index.tsx @@ -5,7 +5,7 @@ import { store as keyboardShortcutsStore, } from '@wordpress/keyboard-shortcuts'; import { __ } from '@wordpress/i18n'; -import { stepSidebarKey, storeName, workflowSidebarKey } from '../../store'; +import { stepSidebarKey, storeName, automationSidebarKey } from '../../store'; // See: // https://github.com/WordPress/gutenberg/blob/9601a33e30ba41bac98579c8d822af63dd961488/packages/edit-post/src/components/keyboard-shortcuts/index.js @@ -55,7 +55,7 @@ export function KeyboardShortcuts(): null { } else { const sidebarToOpen = selectedStep() ? stepSidebarKey - : workflowSidebarKey; + : automationSidebarKey; openSidebar(sidebarToOpen); } }); diff --git a/mailpoet/assets/js/src/automation/editor/components/modals/deactivate-modal.tsx b/mailpoet/assets/js/src/automation/editor/components/modals/deactivate-modal.tsx index 67e93ad2bc..257034f22c 100644 --- a/mailpoet/assets/js/src/automation/editor/components/modals/deactivate-modal.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/modals/deactivate-modal.tsx @@ -3,7 +3,7 @@ import { Button, Modal } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import { dispatch, useSelect } from '@wordpress/data'; import { storeName } from '../../store'; -import { WorkflowStatus } from '../../../listing/workflow'; +import { AutomationStatus } from '../../../listing/automation'; type DeactivateImmediatelyModalProps = { onClose: () => void; @@ -49,20 +49,20 @@ type DeactivateModalProps = { export function DeactivateModal({ onClose, }: DeactivateModalProps): JSX.Element { - const { workflowName } = useSelect( + const { automationName } = useSelect( (select) => ({ - workflowName: select(storeName).getWorkflowData().name, + automationName: select(storeName).getAutomationData().name, }), [], ); const [selected, setSelected] = useState< - WorkflowStatus.DRAFT | WorkflowStatus.DEACTIVATING - >(WorkflowStatus.DEACTIVATING); + AutomationStatus.DRAFT | AutomationStatus.DEACTIVATING + >(AutomationStatus.DEACTIVATING); const [isBusy, setIsBusy] = useState(false); // translators: %s is the name of the automation. const title = sprintf( __('Deactivate the "%s" automation?', 'mailpoet'), - workflowName, + automationName, ); return ( @@ -79,7 +79,7 @@ export function DeactivateModal({