From 645da38dea97543b49b8e4057dcf6764d5a3de71 Mon Sep 17 00:00:00 2001 From: Rostislav Wolny Date: Tue, 12 Dec 2023 16:33:22 +0100 Subject: [PATCH] Fix eslint issues The issues were related to a change in Gutenberg where ActionCreators are not promisified. See https://github.com/WordPress/gutenberg/pull/52530 [MAILPOET-5714] --- .../js/src/automation/editor/api-error-handler.tsx | 6 ++++-- .../editor/components/actions/trash-button.tsx | 2 +- .../editor/components/automation/add-trigger.tsx | 2 +- .../editor/components/automation/step.tsx | 4 ++-- .../automation/editor/components/header/errors.tsx | 4 ++-- .../editor/components/inserter-popover/index.tsx | 2 +- .../editor/components/keyboard-shortcuts/index.tsx | 8 ++++---- .../editor/components/modals/deactivate-modal.tsx | 4 ++-- .../editor/components/panel/activate-panel.tsx | 4 ++-- .../js/src/automation/editor/store/actions.ts | 2 +- .../automation/editor/store/register-step-type.ts | 2 +- .../integrations/core/steps/delay/edit.tsx | 2 +- .../analytics/components/tabs/orders/index.tsx | 2 +- .../analytics/components/tabs/subscribers/index.tsx | 2 +- .../integrations/mailpoet/analytics/index.tsx | 2 +- .../mailpoet/analytics/navigation/open-tab.ts | 2 +- .../mailpoet/analytics/store/actions/index.ts | 2 +- .../mailpoet/analytics/store/initial-state.ts | 2 +- .../automation-sidebar/run-automation-once.tsx | 2 +- .../steps/send-email/edit/edit-newsletter.tsx | 4 ++-- .../mailpoet/steps/send-email/edit/email-panel.tsx | 6 +++++- .../send-email/edit/google-analytics-panel.tsx | 4 ++-- .../steps/send-email/edit/reply-to-panel.tsx | 8 ++++---- .../steps/someone-subscribes/edit/list-panel.tsx | 2 +- .../steps/wp-user-registered/edit/role-panel.tsx | 2 +- .../woocommerce/steps/abandoned-cart/edit/index.tsx | 2 +- .../woocommerce/steps/buys-a-product/edit/index.tsx | 8 ++++++-- .../steps/buys-from-a-category/edit/index.tsx | 8 ++++++-- .../steps/order-status-changed/edit/index.tsx | 6 +++++- .../edit/order-status-panel.tsx | 4 ++-- .../listing/components/menu/duplicate.tsx | 2 +- .../automation/listing/components/menu/restore.tsx | 2 +- mailpoet/assets/js/src/automation/listing/index.tsx | 2 +- .../templates/components/template-preview.tsx | 2 +- .../common/premium-key/key-activation-button.tsx | 10 +++++----- .../assets/js/src/common/premium-modal/index.tsx | 2 +- .../engine/components/keybord-shortcuts/index.tsx | 8 ++++---- .../engine/components/preview/preview-dropdown.tsx | 4 ++-- .../components/preview/send-preview-email.tsx | 4 ++-- .../engine/components/sidebar/header.tsx | 8 +++++--- .../js/src/email-editor/engine/store/actions.ts | 13 ++++++++----- .../components/form-settings/form-settings.tsx | 2 +- .../js/src/form-editor/components/history-redo.tsx | 2 +- .../js/src/form-editor/components/history-undo.tsx | 2 +- mailpoet/assets/js/src/form-editor/store/actions.ts | 2 +- .../assets/js/src/form-editor/store/controls.tsx | 11 +++++++---- .../fields/subscriber/custom-fields/checkbox.tsx | 2 +- mailpoet/assets/js/src/segments/dynamic/dynamic.tsx | 2 +- .../js/src/settings/components/save-button.tsx | 2 +- .../js/src/settings/pages/advanced/captcha.tsx | 2 +- .../js/src/settings/pages/basics/default-sender.tsx | 2 +- .../pages/basics/new-subscriber-notifications.tsx | 2 +- .../settings/pages/basics/stats-notifications.tsx | 2 +- .../pages/key-activation/key-activation.tsx | 6 +++--- .../settings/pages/woo-commerce/checkout-optin.tsx | 2 +- 55 files changed, 117 insertions(+), 91 deletions(-) diff --git a/mailpoet/assets/js/src/automation/editor/api-error-handler.tsx b/mailpoet/assets/js/src/automation/editor/api-error-handler.tsx index 4ccc71cdbc4..5b4393b97e2 100644 --- a/mailpoet/assets/js/src/automation/editor/api-error-handler.tsx +++ b/mailpoet/assets/js/src/automation/editor/api-error-handler.tsx @@ -25,7 +25,9 @@ export const registerApiErrorHandler = (): void => const code = errorObject.code; if (code === 'mailpoet_automation_not_valid') { - dispatch(storeName).setErrors({ steps: errorObject.data.errors }); + void dispatch(storeName).setErrors({ + steps: errorObject.data.errors, + }); return undefined; } @@ -35,7 +37,7 @@ export const registerApiErrorHandler = (): void => message ?? __('An unknown error occurred.', 'mailpoet'), { explicitDismiss: true }, ); - dispatch(storeName).setErrors({ steps: [] }); + void dispatch(storeName).setErrors({ steps: [] }); return undefined; } diff --git a/mailpoet/assets/js/src/automation/editor/components/actions/trash-button.tsx b/mailpoet/assets/js/src/automation/editor/components/actions/trash-button.tsx index 55c6b2a256f..d44d35c7bb2 100644 --- a/mailpoet/assets/js/src/automation/editor/components/actions/trash-button.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/actions/trash-button.tsx @@ -32,7 +32,7 @@ export function TrashButton({ confirmButtonText={__('Yes, delete', 'mailpoet')} onConfirm={async () => { setIsBusy(true); - trash(() => { + void trash(() => { setShowConfirmDialog(false); setIsBusy(false); performActionAfterDelete(); diff --git a/mailpoet/assets/js/src/automation/editor/components/automation/add-trigger.tsx b/mailpoet/assets/js/src/automation/editor/components/automation/add-trigger.tsx index 621679b5181..213f0271f68 100644 --- a/mailpoet/assets/js/src/automation/editor/components/automation/add-trigger.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/automation/add-trigger.tsx @@ -29,7 +29,7 @@ export function AddTrigger({ step, index }: Props): JSX.Element { context === 'edit' ? (event) => { event.stopPropagation(); - setInserterPopover({ + void setInserterPopover({ anchor: (event.target as HTMLElement).closest('button'), type: 'triggers', }); diff --git a/mailpoet/assets/js/src/automation/editor/components/automation/step.tsx b/mailpoet/assets/js/src/automation/editor/components/automation/step.tsx index 372ca01d310..7ba48306ed0 100644 --- a/mailpoet/assets/js/src/automation/editor/components/automation/step.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/automation/step.tsx @@ -101,8 +101,8 @@ export function Step({ step, isSelected }: Props): JSX.Element { context === 'edit' ? () => batch(() => { - openSidebar(stepSidebarKey); - selectStep(step); + void openSidebar(stepSidebarKey); + void selectStep(step); }) : undefined } diff --git a/mailpoet/assets/js/src/automation/editor/components/header/errors.tsx b/mailpoet/assets/js/src/automation/editor/components/header/errors.tsx index 564a2f10fb9..6e4a6a7101b 100644 --- a/mailpoet/assets/js/src/automation/editor/components/header/errors.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/header/errors.tsx @@ -47,8 +47,8 @@ function StepError({ stepId }: StepErrorProps): JSX.Element { role="listitem" state={compositeState} onClick={() => { - openSidebar(stepSidebarKey); - selectStep(stepData); + void openSidebar(stepSidebarKey); + void selectStep(stepData); }} > { if (!showModal) { - setInserterPopover(undefined); + void setInserterPopover(undefined); } }} > 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 4d78c485fcb..e7d15aa7055 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 @@ -56,19 +56,19 @@ export function KeyboardShortcuts(): null { }, [registerShortcut]); useShortcut('mailpoet/automation-editor/toggle-fullscreen', () => { - toggleFeature('fullscreenMode'); + void toggleFeature('fullscreenMode'); }); useShortcut('mailpoet/automation-editor/toggle-sidebar', (event) => { event.preventDefault(); if (isSidebarOpened()) { - closeSidebar(); + void closeSidebar(); } else { const sidebarToOpen = selectedStep() ? stepSidebarKey : automationSidebarKey; - openSidebar(sidebarToOpen); + void openSidebar(sidebarToOpen); } }); @@ -76,7 +76,7 @@ export function KeyboardShortcuts(): null { event.preventDefault(); if (savedState === 'unsaved') { - save(); + void save(); } }); 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 aa37363506e..8a9f7135b78 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 @@ -30,7 +30,7 @@ export function DeactivateImmediatelyModal({ variant="primary" onClick={() => { setIsBusy(true); - dispatch(storeName).deactivate(true); + void dispatch(storeName).deactivate(true); }} > {__('Deactivate now', 'mailpoet')} @@ -139,7 +139,7 @@ export function DeactivateModal({ variant="primary" onClick={() => { setIsBusy(true); - dispatch(storeName).deactivate( + void dispatch(storeName).deactivate( selected !== AutomationStatus.DEACTIVATING, ); }} diff --git a/mailpoet/assets/js/src/automation/editor/components/panel/activate-panel.tsx b/mailpoet/assets/js/src/automation/editor/components/panel/activate-panel.tsx index 278b6ab8784..b2132320abd 100644 --- a/mailpoet/assets/js/src/automation/editor/components/panel/activate-panel.tsx +++ b/mailpoet/assets/js/src/automation/editor/components/panel/activate-panel.tsx @@ -22,7 +22,7 @@ function PreStep({ onClose }): JSX.Element { autoFocus={!isActivating} onClick={() => { setIsActivating(true); - activate(); + void activate(); }} > {isActivating && __('Activating…', 'mailpoet')} @@ -113,7 +113,7 @@ export function ActivatePanel(): JSX.Element { useEffect(() => { if (errors) { - closeActivationPanel(); + void closeActivationPanel(); } }, [errors, closeActivationPanel]); diff --git a/mailpoet/assets/js/src/automation/editor/store/actions.ts b/mailpoet/assets/js/src/automation/editor/store/actions.ts index 104a1f872e3..43a1a1689fc 100644 --- a/mailpoet/assets/js/src/automation/editor/store/actions.ts +++ b/mailpoet/assets/js/src/automation/editor/store/actions.ts @@ -41,7 +41,7 @@ export const closeActivationPanel = () => ({ }); export const openSidebar = (key) => { - dispatch(storeName).closeActivationPanel(); + void dispatch(storeName).closeActivationPanel(); return ({ registry }) => registry.dispatch(interfaceStore).enableComplementaryArea(storeName, key); }; diff --git a/mailpoet/assets/js/src/automation/editor/store/register-step-type.ts b/mailpoet/assets/js/src/automation/editor/store/register-step-type.ts index 751035fae0a..8fd49fafd92 100644 --- a/mailpoet/assets/js/src/automation/editor/store/register-step-type.ts +++ b/mailpoet/assets/js/src/automation/editor/store/register-step-type.ts @@ -4,7 +4,7 @@ import { storeName } from './constants'; import { StepType } from './types'; export const registerStepType = (stepType: StepType): void => { - dispatch(storeName).registerStepType( + void dispatch(storeName).registerStepType( Hooks.applyFilters('mailpoet.automation.register_step_type', stepType), ); }; diff --git a/mailpoet/assets/js/src/automation/integrations/core/steps/delay/edit.tsx b/mailpoet/assets/js/src/automation/integrations/core/steps/delay/edit.tsx index bc97523c044..59f065ecd8a 100644 --- a/mailpoet/assets/js/src/automation/integrations/core/steps/delay/edit.tsx +++ b/mailpoet/assets/js/src/automation/integrations/core/steps/delay/edit.tsx @@ -54,7 +54,7 @@ export function Edit(): JSX.Element { rawValue.length === 0 || parseInt(rawValue, 10) < 1 ? 1 : parseInt(rawValue, 10); - dispatch(storeName).updateStepArgs( + void dispatch(storeName).updateStepArgs( selectedStep.id, 'delay', value, diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/orders/index.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/orders/index.tsx index 2cd1159e29f..5feb3d7ec61 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/orders/index.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/orders/index.tsx @@ -81,7 +81,7 @@ export function Orders(): JSX.Element { : 'asc', }; } - dispatch(storeName).updateSection({ + void dispatch(storeName).updateSection({ ...ordersSection, customQuery: { ...ordersSection.customQuery, diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/subscribers/index.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/subscribers/index.tsx index e6b14a15f53..ff1b2ea28b4 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/subscribers/index.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/components/tabs/subscribers/index.tsx @@ -69,7 +69,7 @@ export function Subscribers(): JSX.Element { : 'asc', }; } - dispatch(storeName).updateSection({ + void dispatch(storeName).updateSection({ ...subscriberSection, customQuery: { ...subscriberSection.customQuery, diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/index.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/index.tsx index 6e3fa4f265a..4fd396e4c39 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/index.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/index.tsx @@ -89,7 +89,7 @@ function boot() { select(storeName) .getSections() .forEach((section: Section) => { - dispatch(storeName).updateSection(section); + void dispatch(storeName).updateSection(section); }); } diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/navigation/open-tab.ts b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/navigation/open-tab.ts index 1228ca7ec3a..7572e908462 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/navigation/open-tab.ts +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/navigation/open-tab.ts @@ -15,7 +15,7 @@ export function openTab(tab: ValidTabs, currentView?: CurrentView): void { }, currentView, }; - dispatch(storeName).updateSection(payload); + void dispatch(storeName).updateSection(payload); } const classMap: Record = { diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/actions/index.ts b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/actions/index.ts index d87a972c721..f42f3445592 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/actions/index.ts +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/actions/index.ts @@ -54,7 +54,7 @@ export function* updateSection( section: Section, queryParam: Query | undefined = undefined, ) { - dispatch(storeName).resetSectionData(section); + void dispatch(storeName).resetSectionData(section); const sampleData = Hooks.applyFilters( 'mailpoet_analytics_section_sample_data', diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/initial-state.ts b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/initial-state.ts index ca4ce3897fa..1a46580c98a 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/initial-state.ts +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/analytics/store/initial-state.ts @@ -16,7 +16,7 @@ const sections: Record = { return; } const { automation } = data; - dispatch(editorStoreName).updateAutomation(automation); + void dispatch(editorStoreName).updateAutomation(automation); }, }, overview: { diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/automation-sidebar/run-automation-once.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/automation-sidebar/run-automation-once.tsx index e687944caa3..436777c98b2 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/automation-sidebar/run-automation-once.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/automation-sidebar/run-automation-once.tsx @@ -37,7 +37,7 @@ export function RunAutomationOnce(): JSX.Element { label={__('Run this automation only once per subscriber.', 'mailpoet')} checked={checked} onChange={(value) => { - dispatch(storeName).updateAutomationMeta( + void dispatch(storeName).updateAutomationMeta( 'mailpoet:run-once-per-subscriber', value, ); diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/edit-newsletter.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/edit-newsletter.tsx index dddda25f973..ecb43bbc170 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/edit-newsletter.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/edit-newsletter.tsx @@ -65,13 +65,13 @@ export function EditNewsletter(): JSX.Element { }, }); - dispatch(storeName).updateStepArgs( + void dispatch(storeName).updateStepArgs( automationStepId, 'email_id', parseInt(response.data.id as string, 10), ); - dispatch(storeName).save(); + void dispatch(storeName).save(); }, [automationId, automationStepId]); // This component is rendered only when no email ID is set. Once we have the ID diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/email-panel.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/email-panel.tsx index a50410df6b3..9bb1da9a95f 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/email-panel.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/email-panel.tsx @@ -53,7 +53,11 @@ export function EmailPanel(): JSX.Element { currentName={(selectedStep.args.name as string) ?? ''} defaultName={__('Send email', 'mailpoet')} update={(value) => { - dispatch(storeName).updateStepArgs(selectedStep.id, 'name', value); + void dispatch(storeName).updateStepArgs( + selectedStep.id, + 'name', + value, + ); }} /> { setEnabled(false); - updateStepArgs(selectedStep.id, 'ga_campaign', undefined); + void updateStepArgs(selectedStep.id, 'ga_campaign', undefined); }} > {__( @@ -51,7 +51,7 @@ export function GoogleAnalyticsPanel(): JSX.Element { onChange={(value) => { setEnabled(value); if (!value) { - updateStepArgs(selectedStep.id, 'ga_campaign', undefined); + void updateStepArgs(selectedStep.id, 'ga_campaign', undefined); } }} /> diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/reply-to-panel.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/reply-to-panel.tsx index 769751d34a4..6aa66a72c3c 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/reply-to-panel.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/send-email/edit/reply-to-panel.tsx @@ -56,15 +56,15 @@ export function ReplyToPanel(): JSX.Element { if (value) { const name = prevValue.current?.name ?? defaultName; const address = prevValue.current?.address ?? defaultAddress; - updateStepArgs(stepId, 'reply_to_name', name); - updateStepArgs(stepId, 'reply_to_address', address); + void updateStepArgs(stepId, 'reply_to_name', name); + void updateStepArgs(stepId, 'reply_to_address', address); } else { prevValue.current = { name: args.reply_to_name, address: args.reply_to_address, }; - updateStepArgs(stepId, 'reply_to_name', undefined); - updateStepArgs(stepId, 'reply_to_address', undefined); + void updateStepArgs(stepId, 'reply_to_name', undefined); + void updateStepArgs(stepId, 'reply_to_address', undefined); } }} /> diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/someone-subscribes/edit/list-panel.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/someone-subscribes/edit/list-panel.tsx index 29c9e3018cf..95c1fd08cf4 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/someone-subscribes/edit/list-panel.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/someone-subscribes/edit/list-panel.tsx @@ -39,7 +39,7 @@ export function ListPanel(): JSX.Element { value={selected} suggestions={validSegments} onChange={(values) => { - dispatch(storeName).updateStepArgs( + void dispatch(storeName).updateStepArgs( selectedStep.id, 'segment_ids', values.map((item) => item.id), diff --git a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/wp-user-registered/edit/role-panel.tsx b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/wp-user-registered/edit/role-panel.tsx index 91c99708cdc..ac65152b519 100644 --- a/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/wp-user-registered/edit/role-panel.tsx +++ b/mailpoet/assets/js/src/automation/integrations/mailpoet/steps/wp-user-registered/edit/role-panel.tsx @@ -57,7 +57,7 @@ export function RolePanel(): JSX.Element { suggestions={userRoles} placeholder={__('Any user role', 'mailpoet')} onChange={(items) => { - dispatch(storeName).updateStepArgs( + void dispatch(storeName).updateStepArgs( selectedStep.id, 'roles', items.map((item) => item.id), diff --git a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/abandoned-cart/edit/index.tsx b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/abandoned-cart/edit/index.tsx index b9c930054fa..35539433cd0 100644 --- a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/abandoned-cart/edit/index.tsx +++ b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/abandoned-cart/edit/index.tsx @@ -14,7 +14,7 @@ export function Edit(): JSX.Element { { - dispatch(storeName).updateStepArgs( + void dispatch(storeName).updateStepArgs( selectedStep.id, 'wait', parseInt(id, 10), diff --git a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/buys-a-product/edit/index.tsx b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/buys-a-product/edit/index.tsx index 84523e5013c..477319c6d5d 100644 --- a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/buys-a-product/edit/index.tsx +++ b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/buys-a-product/edit/index.tsx @@ -58,7 +58,7 @@ export function Edit(): JSX.Element { selected={current} onChange={(items: Product[]) => { setCurrent(items); - dispatch(storeName).updateStepArgs( + void dispatch(storeName).updateStepArgs( selectedStep.id, 'product_ids', items.map((item) => item.key), @@ -75,7 +75,11 @@ export function Edit(): JSX.Element { showTo toLabel={__('Order status', 'mailpoet')} onChange={(status, property) => { - dispatch(storeName).updateStepArgs(selectedStep.id, property, status); + void dispatch(storeName).updateStepArgs( + selectedStep.id, + property, + status, + ); }} /> diff --git a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/buys-from-a-category/edit/index.tsx b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/buys-from-a-category/edit/index.tsx index 9e86a3cf047..d2250a9d26a 100644 --- a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/buys-from-a-category/edit/index.tsx +++ b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/buys-from-a-category/edit/index.tsx @@ -58,7 +58,7 @@ export function Edit(): JSX.Element { selected={current} onChange={(items: Category[]) => { setCurrent(items); - dispatch(storeName).updateStepArgs( + void dispatch(storeName).updateStepArgs( selectedStep.id, 'category_ids', items.map((item) => item.key), @@ -75,7 +75,11 @@ export function Edit(): JSX.Element { showTo toLabel={__('Order status', 'mailpoet')} onChange={(status, property) => { - dispatch(storeName).updateStepArgs(selectedStep.id, property, status); + void dispatch(storeName).updateStepArgs( + selectedStep.id, + property, + status, + ); }} /> diff --git a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/order-status-changed/edit/index.tsx b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/order-status-changed/edit/index.tsx index cc02a6bf879..c1a4f9d6385 100644 --- a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/order-status-changed/edit/index.tsx +++ b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/order-status-changed/edit/index.tsx @@ -19,7 +19,11 @@ export function Edit(): JSX.Element { toLabel={__('Status changes to:', 'mailpoet')} fromLabel={__('Status changes from:', 'mailpoet')} onChange={(status, property) => { - dispatch(storeName).updateStepArgs(selectedStep.id, property, status); + void dispatch(storeName).updateStepArgs( + selectedStep.id, + property, + status, + ); }} /> ); diff --git a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/order-status-changed/edit/order-status-panel.tsx b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/order-status-changed/edit/order-status-panel.tsx index d527706d057..f4cb1cb4aef 100644 --- a/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/order-status-changed/edit/order-status-panel.tsx +++ b/mailpoet/assets/js/src/automation/integrations/woocommerce/steps/order-status-changed/edit/order-status-panel.tsx @@ -61,7 +61,7 @@ export function OrderStatusPanel({ value={fromSelected} label={fromLabel} options={[...options.values()]} - onChange={(value) => update(value, 'from')} + onChange={(value) => update(value as string, 'from')} /> )} {showTo && ( @@ -69,7 +69,7 @@ export function OrderStatusPanel({ value={toSelected} label={toLabel} options={[...options.values()]} - onChange={(value) => update(value, 'to')} + onChange={(value) => update(value as string, 'to')} /> )} {showPremiumModal && ( diff --git a/mailpoet/assets/js/src/automation/listing/components/menu/duplicate.tsx b/mailpoet/assets/js/src/automation/listing/components/menu/duplicate.tsx index 561e9cbc366..3867609b1a2 100644 --- a/mailpoet/assets/js/src/automation/listing/components/menu/duplicate.tsx +++ b/mailpoet/assets/js/src/automation/listing/components/menu/duplicate.tsx @@ -18,7 +18,7 @@ export const useDuplicateButton = ( control: { title: __('Duplicate', 'mailpoet'), icon: null, - onClick: () => duplicateAutomation(automation), + onClick: () => void duplicateAutomation(automation), }, }; }; diff --git a/mailpoet/assets/js/src/automation/listing/components/menu/restore.tsx b/mailpoet/assets/js/src/automation/listing/components/menu/restore.tsx index ece22d3c6a2..a2fe9a4dff0 100644 --- a/mailpoet/assets/js/src/automation/listing/components/menu/restore.tsx +++ b/mailpoet/assets/js/src/automation/listing/components/menu/restore.tsx @@ -16,7 +16,7 @@ export const useRestoreButton = (automation: Automation): Item | undefined => { control: { title: __('Restore', 'mailpoet'), icon: null, - onClick: () => restoreAutomation(automation, AutomationStatus.DRAFT), + onClick: () => void restoreAutomation(automation, AutomationStatus.DRAFT), }, }; }; diff --git a/mailpoet/assets/js/src/automation/listing/index.tsx b/mailpoet/assets/js/src/automation/listing/index.tsx index 4fc054e18f7..54e0dcafa54 100644 --- a/mailpoet/assets/js/src/automation/listing/index.tsx +++ b/mailpoet/assets/js/src/automation/listing/index.tsx @@ -80,7 +80,7 @@ export function AutomationListing(): JSX.Element { const status = pageSearch.get('status'); useEffect(() => { - loadAutomations(); + void loadAutomations(); }, [loadAutomations]); // focus tab button on status change (needed due to the force re-mount below) diff --git a/mailpoet/assets/js/src/automation/templates/components/template-preview.tsx b/mailpoet/assets/js/src/automation/templates/components/template-preview.tsx index f57a0842b07..7d54971a1fc 100644 --- a/mailpoet/assets/js/src/automation/templates/components/template-preview.tsx +++ b/mailpoet/assets/js/src/automation/templates/components/template-preview.tsx @@ -55,7 +55,7 @@ export function TemplatePreview({ template }: Props): JSX.Element { method: 'GET', signal: controller.signal, }); - dispatch(storeName).updateAutomation(data.data.automation); + void dispatch(storeName).updateAutomation(data.data.automation); setState('loaded'); } catch (error) { if (!controller.signal.aborted) { diff --git a/mailpoet/assets/js/src/common/premium-key/key-activation-button.tsx b/mailpoet/assets/js/src/common/premium-key/key-activation-button.tsx index 1d7da628823..03e6a8c4182 100644 --- a/mailpoet/assets/js/src/common/premium-key/key-activation-button.tsx +++ b/mailpoet/assets/js/src/common/premium-key/key-activation-button.tsx @@ -33,8 +33,8 @@ export function KeyActivationButton({ async function activationCallback() { await verifyMssKey(state.key); - sendCongratulatoryMssEmail(); - setState({ fromAddressModalCanBeShown: true }); + void sendCongratulatoryMssEmail(); + void setState({ fromAddressModalCanBeShown: true }); } const showPendingApprovalNotice = @@ -62,7 +62,7 @@ export function KeyActivationButton({ premiumInstallationStatus: null, }); MailPoet.Modal.loading(true); - setState({ inProgress: true }); + void setState({ inProgress: true }); await verifyMssKey(state.key); const currentMssStatus = select(STORE_NAME).getKeyActivationState().mssStatus; @@ -70,9 +70,9 @@ export function KeyActivationButton({ await sendCongratulatoryMssEmail(); } await verifyPremiumKey(state.key); - setState({ inProgress: false }); + void setState({ inProgress: false }); MailPoet.Modal.loading(false); - setState({ fromAddressModalCanBeShown: true }); + void setState({ fromAddressModalCanBeShown: true }); // pending approval refresh link should only show on refresh of the page and should get hidden after the refresh button is clicked setShowRefreshMessage(false); }; diff --git a/mailpoet/assets/js/src/common/premium-modal/index.tsx b/mailpoet/assets/js/src/common/premium-modal/index.tsx index 951ced630ed..da855880ed4 100644 --- a/mailpoet/assets/js/src/common/premium-modal/index.tsx +++ b/mailpoet/assets/js/src/common/premium-modal/index.tsx @@ -150,7 +150,7 @@ function PremiumModalForStepEdit({ return; } const { selectStep } = dispatch(storeName); - selectStep(undefined); + void selectStep(undefined); setShowModal(true); }, [showModal]); if (!showModal) { diff --git a/mailpoet/assets/js/src/email-editor/engine/components/keybord-shortcuts/index.tsx b/mailpoet/assets/js/src/email-editor/engine/components/keybord-shortcuts/index.tsx index 9a41c63e58b..df0743097a5 100644 --- a/mailpoet/assets/js/src/email-editor/engine/components/keybord-shortcuts/index.tsx +++ b/mailpoet/assets/js/src/email-editor/engine/components/keybord-shortcuts/index.tsx @@ -56,16 +56,16 @@ export function KeyboardShortcuts(): null { }, [registerShortcut]); useShortcut('mailpoet/email-editor/toggle-fullscreen', () => { - toggleFeature('fullscreenMode'); + void toggleFeature('fullscreenMode'); }); useShortcut('mailpoet/email-editor/toggle-sidebar', (event) => { event.preventDefault(); if (isSidebarOpened) { - closeSidebar(); + void closeSidebar(); } else { - openSidebar(); + void openSidebar(); } }); @@ -74,7 +74,7 @@ export function KeyboardShortcuts(): null { if (!hasEdits || isSaving) { return; } - saveEditedEmail(); + void saveEditedEmail(); }); return null; diff --git a/mailpoet/assets/js/src/email-editor/engine/components/preview/preview-dropdown.tsx b/mailpoet/assets/js/src/email-editor/engine/components/preview/preview-dropdown.tsx index a4dc0e522f0..e881c859f15 100644 --- a/mailpoet/assets/js/src/email-editor/engine/components/preview/preview-dropdown.tsx +++ b/mailpoet/assets/js/src/email-editor/engine/components/preview/preview-dropdown.tsx @@ -28,7 +28,7 @@ export function PreviewDropdown() { const newsletterPreviewUrl: string = mailpoetEmailData?.preview_url || ''; const changeDeviceType = (newDeviceType: string) => { - changePreviewDeviceType(newDeviceType); + void changePreviewDeviceType(newDeviceType); }; const openInNewTab = (url: string) => { @@ -69,7 +69,7 @@ export function PreviewDropdown() { { - togglePreviewModal(true); + void togglePreviewModal(true); onClose(); }} > diff --git a/mailpoet/assets/js/src/email-editor/engine/components/preview/send-preview-email.tsx b/mailpoet/assets/js/src/email-editor/engine/components/preview/send-preview-email.tsx index c69af8eedde..11890302f0f 100644 --- a/mailpoet/assets/js/src/email-editor/engine/components/preview/send-preview-email.tsx +++ b/mailpoet/assets/js/src/email-editor/engine/components/preview/send-preview-email.tsx @@ -32,7 +32,7 @@ export function SendPreviewEmail() { ) as [MailPoetEmailData, unknown, unknown]; const handleSendPreviewEmail = () => { - requestSendingNewsletterPreview(mailpoetEmailData.id, previewToEmail); + void requestSendingNewsletterPreview(mailpoetEmailData.id, previewToEmail); }; const closeCallback = () => togglePreviewModal(false); @@ -123,7 +123,7 @@ export function SendPreviewEmail() { { - updateSendPreviewEmail(email); + void updateSendPreviewEmail(email); }} value={previewToEmail} type="email" diff --git a/mailpoet/assets/js/src/email-editor/engine/components/sidebar/header.tsx b/mailpoet/assets/js/src/email-editor/engine/components/sidebar/header.tsx index 6db9cbea1b9..511fc14e014 100644 --- a/mailpoet/assets/js/src/email-editor/engine/components/sidebar/header.tsx +++ b/mailpoet/assets/js/src/email-editor/engine/components/sidebar/header.tsx @@ -23,7 +23,9 @@ export function Header({ sidebarKey }: Props) { // Switch tab based on selected block. useEffect(() => { - openSidebar(selectedBlockId ? mainSidebarBlockKey : mainSidebarEmailKey); + void openSidebar( + selectedBlockId ? mainSidebarBlockKey : mainSidebarEmailKey, + ); }, [selectedBlockId, openSidebar]); return ( @@ -32,7 +34,7 @@ export function Header({ sidebarKey }: Props) {