diff --git a/plugins/woocommerce-admin/client/subscriptions/index.tsx b/plugins/woocommerce-admin/client/subscriptions/index.tsx index da228d8b1ee..0fca3fe4634 100644 --- a/plugins/woocommerce-admin/client/subscriptions/index.tsx +++ b/plugins/woocommerce-admin/client/subscriptions/index.tsx @@ -104,7 +104,6 @@ const NoThanksButton = () => { ); updateOptions( { [ dismissOptionKey ]: 'yes', - // @ts-expect-error updateOptions returns a Promise, but it is not typed in source. } ).then( () => { window.location.href = noThanksUrl; } ); diff --git a/plugins/woocommerce-admin/client/tasks/fills/tax/index.tsx b/plugins/woocommerce-admin/client/tasks/fills/tax/index.tsx index 62c9cf7ba87..32183658050 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/tax/index.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/tax/index.tsx @@ -135,7 +135,6 @@ const Tax: React.FC< TaxProps > = ( { onComplete, query, task } ) => { updateOptions( { woocommerce_no_sales_tax: true, woocommerce_calc_taxes: 'no', - // @ts-expect-error updateOptions returns a Promise, but it is not typed in source. } ).then( () => { window.location.href = getAdminLink( 'admin.php?page=wc-admin' ); } ); diff --git a/plugins/woocommerce-admin/client/tasks/fills/tax/woocommerce-tax/plugins.tsx b/plugins/woocommerce-admin/client/tasks/fills/tax/woocommerce-tax/plugins.tsx index 88dea2f1dc7..340f1aa9e03 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/tax/woocommerce-tax/plugins.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/tax/woocommerce-tax/plugins.tsx @@ -15,7 +15,12 @@ import { useEffect } from '@wordpress/element'; */ import { createNoticesFromResponse } from '~/lib/notices'; import { SetupStepProps } from './setup'; -import { SettingsSelector } from '../utils'; + +const isWcConnectOptions = ( + wcConnectOptions: unknown +): wcConnectOptions is { + [ key: string ]: unknown; +} => typeof wcConnectOptions === 'object' && wcConnectOptions !== null; export const Plugins: React.FC< SetupStepProps > = ( { nextStep, @@ -27,7 +32,8 @@ export const Plugins: React.FC< SetupStepProps > = ( { const { isResolving, tosAccepted } = useSelect( ( select ) => { const { getOption, hasFinishedResolution } = select( OPTIONS_STORE_NAME - ) as SettingsSelector; + ); + const wcConnectOptions = getOption( 'wc_connect_options' ); return { isResolving: @@ -38,7 +44,8 @@ export const Plugins: React.FC< SetupStepProps > = ( { 'wc_connect_options', ] ), tosAccepted: - getOption( 'wc_connect_options' )?.tos_accepted || + ( isWcConnectOptions( wcConnectOptions ) && + wcConnectOptions?.tos_accepted ) || getOption( 'woocommerce_setup_jetpack_opted_in' ) === '1', }; } ); diff --git a/plugins/woocommerce-admin/client/tasks/fills/tax/woocommerce-tax/setup.tsx b/plugins/woocommerce-admin/client/tasks/fills/tax/woocommerce-tax/setup.tsx index 31ed782919e..2c395ae4977 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/tax/woocommerce-tax/setup.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/tax/woocommerce-tax/setup.tsx @@ -51,9 +51,7 @@ export const Setup: React.FC< SetupProps > = ( { const { getSettings } = select( SETTINGS_STORE_NAME ) as SettingsSelector; - const { hasFinishedResolution } = select( - OPTIONS_STORE_NAME - ) as SettingsSelector; + const { hasFinishedResolution } = select( OPTIONS_STORE_NAME ); const { getActivePlugins } = select( PLUGINS_STORE_NAME ); return { diff --git a/plugins/woocommerce-admin/client/two-column-tasks/task-list-item-two-column.tsx b/plugins/woocommerce-admin/client/two-column-tasks/task-list-item-two-column.tsx index 9f436d7bb3d..28dd5055d71 100644 --- a/plugins/woocommerce-admin/client/two-column-tasks/task-list-item-two-column.tsx +++ b/plugins/woocommerce-admin/client/two-column-tasks/task-list-item-two-column.tsx @@ -2,7 +2,7 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { OPTIONS_STORE_NAME, TaskType } from '@woocommerce/data'; +import { ONBOARDING_STORE_NAME, TaskType } from '@woocommerce/data'; import { TaskItem, useSlot } from '@woocommerce/experimental'; import { useCallback } from '@wordpress/element'; import { useDispatch } from '@wordpress/data'; @@ -26,7 +26,9 @@ export const TaskListItemTwoColumn: React.FC< TaskListItemProps > = ( { trackClick, } ) => { const { createNotice } = useDispatch( 'core/notices' ); - const { dismissTask, undoDismissTask } = useDispatch( OPTIONS_STORE_NAME ); + const { dismissTask, undoDismissTask } = useDispatch( + ONBOARDING_STORE_NAME + ); const { id: taskId, diff --git a/plugins/woocommerce-admin/client/two-column-tasks/task-list-item.tsx b/plugins/woocommerce-admin/client/two-column-tasks/task-list-item.tsx index aac93038952..acfc7fa395c 100644 --- a/plugins/woocommerce-admin/client/two-column-tasks/task-list-item.tsx +++ b/plugins/woocommerce-admin/client/two-column-tasks/task-list-item.tsx @@ -31,13 +31,14 @@ export const TaskListItem: React.FC< TaskListItemProps > = ( { eventPrefix, } ) => { const { createNotice } = useDispatch( 'core/notices' ); + const { + visitedTask, dismissTask, undoDismissTask, snoozeTask, undoSnoozeTask, - } = useDispatch( OPTIONS_STORE_NAME ); - const { visitedTask } = useDispatch( ONBOARDING_STORE_NAME ); + } = useDispatch( ONBOARDING_STORE_NAME ); const slot = useSlot( `woocommerce_onboarding_task_list_item_${ task.id }`