diff --git a/changelog/chore-moving-constants-around b/changelog/chore-moving-constants-around new file mode 100644 index 00000000000..c985c0d0e4b --- /dev/null +++ b/changelog/chore-moving-constants-around @@ -0,0 +1,5 @@ +Significance: patch +Type: dev +Comment: chore: moving JS constants around for reuse + + diff --git a/client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js b/client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js index 85476312b8f..1a32b9278b9 100644 --- a/client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js +++ b/client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js @@ -41,7 +41,7 @@ import { upeCapabilityStatuses, upeMethods } from '../constants'; import paymentMethodsMap from '../../payment-methods-map'; import ConfirmPaymentMethodActivationModal from 'wcpay/payment-methods/activation-modal'; import './add-payment-methods-task.scss'; -import PAYMENT_METHOD_IDS from 'wcpay/payment-methods/constants'; +import PAYMENT_METHOD_IDS from 'wcpay/constants/payment-method'; const usePaymentMethodsCheckboxState = () => { // For UPE, the card payment method is required and always active. diff --git a/client/components/payment-method-details/index.js b/client/components/payment-method-details/index.js index a1f447d4672..dab608ea867 100755 --- a/client/components/payment-method-details/index.js +++ b/client/components/payment-method-details/index.js @@ -7,7 +7,7 @@ import { Fragment } from 'react'; import './style.scss'; import p24BankList from '../../payment-details/payment-method/p24/bank-list'; import { HoverTooltip } from '../tooltip'; -import { PAYMENT_METHOD_TITLES } from 'payment-methods/constants'; +import { PAYMENT_METHOD_TITLES } from 'wcpay/constants/payment-method'; /** * * @param {Object} payment Payment charge object diff --git a/client/components/payment-method-disabled-tooltip/index.tsx b/client/components/payment-method-disabled-tooltip/index.tsx index a2b169bf98c..6ff8a269972 100644 --- a/client/components/payment-method-disabled-tooltip/index.tsx +++ b/client/components/payment-method-disabled-tooltip/index.tsx @@ -10,7 +10,7 @@ import React from 'react'; * Internal dependencies */ import { HoverTooltip } from 'components/tooltip'; -import PAYMENT_METHOD_IDS from 'wcpay/payment-methods/constants'; +import PAYMENT_METHOD_IDS from 'wcpay/constants/payment-method'; export const DocumentationUrlForDisabledPaymentMethod = { DEFAULT: diff --git a/client/components/payment-method-disabled-tooltip/test/index.test.tsx b/client/components/payment-method-disabled-tooltip/test/index.test.tsx index 773c9f62cf0..6f3974d1ce0 100644 --- a/client/components/payment-method-disabled-tooltip/test/index.test.tsx +++ b/client/components/payment-method-disabled-tooltip/test/index.test.tsx @@ -8,7 +8,7 @@ import React from 'react'; /** * Internal dependencies */ -import PAYMENT_METHOD_IDS from 'wcpay/payment-methods/constants'; +import PAYMENT_METHOD_IDS from 'wcpay/constants/payment-method'; import PaymentMethodDisabledTooltip, { DocumentationUrlForDisabledPaymentMethod, getDocumentationUrlForDisabledPaymentMethod, diff --git a/client/payment-methods/constants.ts b/client/constants/payment-method.ts similarity index 100% rename from client/payment-methods/constants.ts rename to client/constants/payment-method.ts diff --git a/client/constants.ts b/client/constants/time.ts similarity index 100% rename from client/constants.ts rename to client/constants/time.ts diff --git a/client/overview/task-list/index.js b/client/overview/task-list/index.js index fd95f979cf6..6bb00304c0d 100644 --- a/client/overview/task-list/index.js +++ b/client/overview/task-list/index.js @@ -12,7 +12,7 @@ import { useCallback, useEffect, useState } from '@wordpress/element'; /** * Internal dependencies */ -import { TIME } from '../../constants'; +import { TIME } from 'wcpay/constants/time'; const TaskList = ( { overviewTasksVisibility, tasks } ) => { const { createNotice } = useDispatch( 'core/notices' ); diff --git a/client/payment-methods/index.js b/client/payment-methods/index.js index 68325607d78..119337f8d37 100644 --- a/client/payment-methods/index.js +++ b/client/payment-methods/index.js @@ -18,7 +18,7 @@ import { useSelectedPaymentMethod, useUnselectedPaymentMethod, } from 'wcpay/data'; -import PAYMENT_METHOD_IDS from './constants'; +import PAYMENT_METHOD_IDS from 'wcpay/constants/payment-method'; import PaymentMethodsList from 'components/payment-methods-list'; import PaymentMethod from 'components/payment-methods-list/payment-method'; diff --git a/client/transactions/list/index.tsx b/client/transactions/list/index.tsx index d1ff4d2f4f2..398da0d8f12 100644 --- a/client/transactions/list/index.tsx +++ b/client/transactions/list/index.tsx @@ -48,7 +48,8 @@ import { isExportModalDismissed, getExportLanguage, isDefaultSiteLanguage, -} from 'utils'; + applyThousandSeparator, +} from 'wcpay/utils'; import { formatCurrency, formatExplicitCurrency, @@ -66,9 +67,8 @@ import DownloadButton from 'components/download-button'; import CSVExportModal from 'components/csv-export-modal'; import { getTransactionsCSV } from '../../data/transactions/resolvers'; import p24BankList from '../../payment-details/payment-method/p24/bank-list'; -import { applyThousandSeparator } from '../../utils/index.js'; import { HoverTooltip } from 'components/tooltip'; -import { PAYMENT_METHOD_TITLES } from 'payment-methods/constants'; +import { PAYMENT_METHOD_TITLES } from 'wcpay/constants/payment-method'; import { ReportingExportLanguageHook } from 'wcpay/settings/reporting-settings/interfaces'; interface TransactionsListProps {