From fa5c12e5846f32e6784c7d85e3519a10ab89c45b Mon Sep 17 00:00:00 2001 From: David Remer Date: Wed, 12 Apr 2023 08:16:50 +0300 Subject: [PATCH] Add Custom Trigger and Custom Action stubs [MAILPOET-5514] --- .../integrations/mailpoet/index.tsx | 4 ++ .../mailpoet/steps/custom_action/index.tsx | 35 +++++++++++++++ .../mailpoet/steps/custom_trigger/index.tsx | 44 +++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 mailpoet/assets/js/src/automation/integrations/mailpoet/steps/custom_action/index.tsx create mode 100644 mailpoet/assets/js/src/automation/integrations/mailpoet/steps/custom_trigger/index.tsx diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/index.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/index.tsx index 8df2c3058e..7db7282d89 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/index.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/index.tsx @@ -9,6 +9,8 @@ import { step as RemoveFromListStep } from './steps/remove-from-list'; import { step as UpdateSubscriberStep } from './steps/update-subscriber'; import { step as UnsubscribeStep } from './steps/unsubscribe'; import { step as NotificationEmail } from './steps/notification-email'; +import { step as CustomTriggerStep } from './steps/custom_trigger'; +import { step as CustomActionStep } from './steps/custom_action'; import { registerStepControls } from './step-controls'; import { registerAutomationSidebar } from './automation-sidebar'; @@ -16,6 +18,8 @@ export const initialize = (): void => { registerStepType(SendEmailStep); registerStepType(WpUserRegisteredTrigger); registerStepType(SomeoneSubscribesTrigger); + registerStepType(CustomTriggerStep); + registerStepType(CustomActionStep); registerStepType(AddTagsAction); registerStepType(RemoveTagsAction); registerStepType(AddToListStep); diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/custom_action/index.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/custom_action/index.tsx new file mode 100644 index 0000000000..be112aed4e --- /dev/null +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/custom_action/index.tsx @@ -0,0 +1,35 @@ +import { __ } from '@wordpress/i18n'; +import { code } from '@wordpress/icons'; +import { StepType } from '../../../../editor/store/types'; +import { PremiumModalForStepEdit } from '../../../../../common/premium_modal'; +import { LockedBadge } from '../../../../../common/premium_modal/locked_badge'; + +const keywords = [ + __('custom', 'mailpoet'), + __('hook', 'mailpoet'), + __('code', 'mailpoet'), +]; + +export const step: StepType = { + key: 'mailpoet:custom-action', + group: 'actions', + title: () => __('Custom action', 'mailpoet'), + description: () => __('Fires a customizable hook.', 'mailpoet'), + subtitle: () => , + keywords, + foreground: '#00A32A', + background: '#EDFAEF', + icon: () => ( +
{code}
+ ), + edit: () => ( + + {__('Firing a custom hook is a premium feature.', 'mailpoet')} + + ), +} as const; diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/custom_trigger/index.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/custom_trigger/index.tsx new file mode 100644 index 0000000000..eda75b24d3 --- /dev/null +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/custom_trigger/index.tsx @@ -0,0 +1,44 @@ +import { __ } from '@wordpress/i18n'; +import { plugins } from '@wordpress/icons'; +import { StepType } from '../../../../editor/store'; +import { LockedBadge } from '../../../../../common/premium_modal/locked_badge'; +import { PremiumModalForStepEdit } from '../../../../../common/premium_modal'; + +const keywords = [ + __('custom', 'mailpoet'), + __('hook', 'mailpoet'), + __('code', 'mailpoet'), +]; + +export const step: StepType = { + key: 'mailpoet:custom-trigger', + group: 'triggers', + title: () => __('Custom trigger', 'mailpoet'), + description: () => + __( + 'Starts an automation when a certain action is fired. This action needs to hand over the email address of the subscriber.', + 'mailpoet', + ), + subtitle: () => , + keywords, + foreground: '#2271b1', + background: '#f0f6fc', + icon: () => ( +
+ {plugins} +
+ ), + edit: () => ( + + {__( + 'Triggering an automation with a custom hook is a premium feature.', + 'mailpoet', + )} + + ), +} as const;