Skip to content

Commit

Permalink
Move CES data store to @woocommerce/customer-effort-score (#37252)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsherman committed Mar 16, 2023
1 parent 97b6ae0 commit 9c5e9b5
Show file tree
Hide file tree
Showing 23 changed files with 40 additions and 23 deletions.
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Add CES data store to @woocommerce/customer-effort-score
1 change: 1 addition & 0 deletions packages/js/customer-effort-score/src/index.ts
Expand Up @@ -4,5 +4,6 @@ export * from './components/customer-feedback-modal';
export * from './components/product-mvp-feedback-modal';
export * from './components/feedback-modal';
export * from './hooks/use-customer-effort-score-exit-page-tracker';
export * from './store';
export * from './utils/customer-effort-score-exit-page';
export * from './constants';
Expand Up @@ -11,7 +11,9 @@ import * as actions from './actions';
import * as resolvers from './resolvers';
import * as selectors from './selectors';
import reducer from './reducer';
import { STORE_KEY } from './constants';
import { QUEUE_OPTION_NAME, STORE_KEY } from './constants';

export { QUEUE_OPTION_NAME, STORE_KEY };

export default registerStore( STORE_KEY, {
actions,
Expand Down
Expand Up @@ -12,6 +12,7 @@ import {
import { useSelect, useDispatch } from '@wordpress/data';
import { uniqueId, find } from 'lodash';
import { Icon, help as helpIcon, external } from '@wordpress/icons';
import { STORE_KEY as CES_STORE_KEY } from '@woocommerce/customer-effort-score';
import { H, Section } from '@woocommerce/components';
import {
ONBOARDING_STORE_NAME,
Expand Down Expand Up @@ -48,7 +49,6 @@ import { useActiveSetupTasklist } from '~/tasks';
import { LayoutContext } from '~/layout';
import { getSegmentsFromPath } from '~/utils/url-helpers';
import { FeedbackIcon } from '~/products/images/feedback-icon';
import { STORE_KEY as CES_STORE_KEY } from '~/customer-effort-score-tracks/data/constants';
import { ProductFeedbackTour } from '~/guided-tours/add-product-feedback-tour';

const HelpPanel = lazy( () =>
Expand Down
Expand Up @@ -6,6 +6,7 @@ import { compose } from '@wordpress/compose';
import PropTypes from 'prop-types';
import { omitBy, isUndefined, snakeCase } from 'lodash';
import { withSelect, withDispatch } from '@wordpress/data';
import { STORE_KEY as CES_STORE_KEY } from '@woocommerce/customer-effort-score';
import { ReportFilters as Filters } from '@woocommerce/components';
import { SETTINGS_STORE_NAME } from '@woocommerce/data';
import {
Expand All @@ -19,7 +20,6 @@ import { CurrencyContext } from '@woocommerce/currency';
/**
* Internal dependencies
*/
import { STORE_KEY as CES_STORE_KEY } from '../../../customer-effort-score-tracks/data/constants';
import { LOCALE } from '~/utils/admin-settings';

class ReportFilters extends Component {
Expand Down
Expand Up @@ -10,6 +10,7 @@ import { withDispatch, withSelect } from '@wordpress/data';
import { get, noop, partial, uniq } from 'lodash';
import { __, sprintf } from '@wordpress/i18n';
import PropTypes from 'prop-types';
import { STORE_KEY as CES_STORE_KEY } from '@woocommerce/customer-effort-score';
import { CompareButton, Search, TableCard } from '@woocommerce/components';
import {
getIdsFromQuery,
Expand Down Expand Up @@ -39,7 +40,6 @@ import { recordEvent } from '@woocommerce/tracks';
import DownloadIcon from './download-icon';
import ReportError from '../report-error';
import { extendTableData } from './utils';
import { STORE_KEY as CES_STORE_KEY } from '../../../customer-effort-score-tracks/data/constants';
import './style.scss';

const TABLE_FILTER = 'woocommerce_admin_report_table';
Expand Down
Expand Up @@ -4,12 +4,12 @@
import { __, _x } from '@wordpress/i18n';
import { applyFilters } from '@wordpress/hooks';
import { dispatch } from '@wordpress/data';
import { STORE_KEY as CES_STORE_KEY } from '@woocommerce/customer-effort-score';

/**
* Internal dependencies
*/
import { getCategoryLabels } from '../../../lib/async-requests';
import { STORE_KEY as CES_STORE_KEY } from '../../../customer-effort-score-tracks/data/constants';

const CATEGORY_REPORT_CHARTS_FILTER =
'woocommerce_admin_categories_report_charts';
Expand Down
Expand Up @@ -4,12 +4,12 @@
import { __, _x } from '@wordpress/i18n';
import { applyFilters } from '@wordpress/hooks';
import { dispatch } from '@wordpress/data';
import { STORE_KEY as CES_STORE_KEY } from '@woocommerce/customer-effort-score';

/**
* Internal dependencies
*/
import { getCouponLabels } from '../../../lib/async-requests';
import { STORE_KEY as CES_STORE_KEY } from '../../../customer-effort-score-tracks/data/constants';

const COUPON_REPORT_CHARTS_FILTER = 'woocommerce_admin_coupons_report_charts';
const COUPON_REPORT_FILTERS_FILTER = 'woocommerce_admin_coupons_report_filters';
Expand Down
Expand Up @@ -4,6 +4,7 @@
import { __, _x } from '@wordpress/i18n';
import { applyFilters } from '@wordpress/hooks';
import { dispatch } from '@wordpress/data';
import { STORE_KEY as CES_STORE_KEY } from '@woocommerce/customer-effort-score';

/**
* Internal dependencies
Expand All @@ -12,7 +13,6 @@ import {
getProductLabels,
getVariationLabels,
} from '../../../lib/async-requests';
import { STORE_KEY as CES_STORE_KEY } from '../../../customer-effort-score-tracks/data/constants';

const PRODUCTS_REPORT_CHARTS_FILTER =
'woocommerce_admin_products_report_charts';
Expand Down
Expand Up @@ -3,6 +3,7 @@
*/
import { __, _x } from '@wordpress/i18n';
import { applyFilters } from '@wordpress/hooks';
import { STORE_KEY as CES_STORE_KEY } from '@woocommerce/customer-effort-score';
import { NAMESPACE } from '@woocommerce/data';
import { dispatch } from '@wordpress/data';

Expand All @@ -11,7 +12,6 @@ import { dispatch } from '@wordpress/data';
*/
import { getRequestByIdString } from '../../../lib/async-requests';
import { getTaxCode } from './utils';
import { STORE_KEY as CES_STORE_KEY } from '../../../customer-effort-score-tracks/data/constants';

const TAXES_REPORT_CHARTS_FILTER = 'woocommerce_admin_taxes_report_charts';
const TAXES_REPORT_FILTERS_FILTER = 'woocommerce_admin_taxes_report_filters';
Expand Down
Expand Up @@ -4,6 +4,7 @@
import { __, _x } from '@wordpress/i18n';
import { applyFilters } from '@wordpress/hooks';
import { dispatch } from '@wordpress/data';
import { STORE_KEY as CES_STORE_KEY } from '@woocommerce/customer-effort-score';

/**
* Internal dependencies
Expand All @@ -13,7 +14,6 @@ import {
getProductLabels,
getVariationLabels,
} from '../../../lib/async-requests';
import { STORE_KEY as CES_STORE_KEY } from '../../../customer-effort-score-tracks/data/constants';

const VARIATIONS_REPORT_CHARTS_FILTER =
'woocommerce_admin_variations_report_charts';
Expand Down
Expand Up @@ -3,7 +3,10 @@
*/
import { __ } from '@wordpress/i18n';
import { useDispatch, useSelect } from '@wordpress/data';
import { CustomerFeedbackModal } from '@woocommerce/customer-effort-score';
import {
CustomerFeedbackModal,
STORE_KEY,
} from '@woocommerce/customer-effort-score';
import { recordEvent } from '@woocommerce/tracks';
import { OPTIONS_STORE_NAME } from '@woocommerce/data';

Expand All @@ -12,7 +15,6 @@ import { OPTIONS_STORE_NAME } from '@woocommerce/data';
*/
import { getStoreAgeInWeeks } from './utils';
import { ADMIN_INSTALL_TIMESTAMP_OPTION_NAME } from './constants';
import { STORE_KEY } from './data/constants';

export const PRODUCT_MVP_CES_ACTION_OPTION_NAME =
'woocommerce_ces_product_mvp_ces_action';
Expand Down
Expand Up @@ -4,15 +4,17 @@
import { useEffect } from 'react';
import { compose } from '@wordpress/compose';
import { withDispatch, withSelect } from '@wordpress/data';
import {
QUEUE_OPTION_NAME,
STORE_KEY,
} from '@woocommerce/customer-effort-score';
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
import PropTypes from 'prop-types';

/**
* Internal dependencies
*/
import CustomerEffortScoreTracks from './customer-effort-score-tracks';
import { STORE_KEY, QUEUE_OPTION_NAME } from './data/constants';
import './data';

/**
* Maps the queue of CES tracks surveys to CustomerEffortScoreTracks
Expand Down
Expand Up @@ -7,15 +7,17 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { closeSmall } from '@wordpress/icons';
import { WooFooterItem } from '@woocommerce/admin-layout';
import { Pill } from '@woocommerce/components';
import { ALLOW_TRACKING_OPTION_NAME } from '@woocommerce/customer-effort-score';
import {
ALLOW_TRACKING_OPTION_NAME,
STORE_KEY,
} from '@woocommerce/customer-effort-score';
import { OPTIONS_STORE_NAME } from '@woocommerce/data';

/**
* Internal dependencies
*/
import './product-mvp-ces-footer.scss';
import { SHOWN_FOR_ACTIONS_OPTION_NAME } from './constants';
import { STORE_KEY } from './data/constants';

export const PRODUCT_MVP_CES_ACTION_OPTION_NAME =
'woocommerce_ces_product_mvp_ces_action';
Expand Down
Expand Up @@ -2,17 +2,15 @@
* External dependencies
*/
import { useDispatch, useSelect } from '@wordpress/data';
import { ProductMVPFeedbackModal } from '@woocommerce/customer-effort-score';
import {
ProductMVPFeedbackModal,
STORE_KEY,
} from '@woocommerce/customer-effort-score';
import { recordEvent } from '@woocommerce/tracks';
import { getAdminLink } from '@woocommerce/settings';
import { useFormContext } from '@woocommerce/components';
import { Product } from '@woocommerce/data';

/**
* Internal dependencies
*/
import { STORE_KEY } from './data/constants';

export const ProductMVPFeedbackModalContainer: React.FC = () => {
const { values } = useFormContext< Product >();
const { hideProductMVPFeedbackModal } = useDispatch( STORE_KEY );
Expand Down
Expand Up @@ -9,14 +9,16 @@ import { getAdminLink } from '@woocommerce/settings';
import { moreVertical } from '@wordpress/icons';
import { OPTIONS_STORE_NAME, Product } from '@woocommerce/data';
import { useFormContext } from '@woocommerce/components';
import { ALLOW_TRACKING_OPTION_NAME } from '@woocommerce/customer-effort-score';
import {
ALLOW_TRACKING_OPTION_NAME,
STORE_KEY as CES_STORE_KEY,
} from '@woocommerce/customer-effort-score';

/**
* Internal dependencies
*/
import { ClassicEditorIcon } from './images/classic-editor-icon';
import { FeedbackIcon } from './images/feedback-icon';
import { STORE_KEY as CES_STORE_KEY } from '~/customer-effort-score-tracks/data/constants';
import { NEW_PRODUCT_MANAGEMENT } from '~/customer-effort-score-tracks/product-mvp-ces-footer';
import './product-more-menu.scss';

Expand Down
4 changes: 4 additions & 0 deletions plugins/woocommerce/changelog/update-move-ces-data-store
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Add CES data store to @woocommerce/customer-effort-score

0 comments on commit 9c5e9b5

Please sign in to comment.