Skip to content

Commit af3cc60

Browse files
ricardolovo-hrafaelzaleski
authored
Decoupled Multi-currency module from gateway dependencies (#9439)
Co-authored-by: Hector Lovo <[email protected]> Co-authored-by: Rafael Zaleski <[email protected]> Co-authored-by: Hector Lovo <[email protected]>
1 parent 532e9fc commit af3cc60

File tree

203 files changed

+1927
-1359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+1927
-1359
lines changed

changelog/multi-currency-v2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: minor
2+
Type: update
3+
4+
Decoupled Multi-currency module from gateway dependencies.

client/additional-methods-setup/upe-preview-methods-selector/add-payment-methods-task.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import PaymentMethodCheckbox from '../../components/payment-methods-checkboxes/p
3636
import { LoadableBlock } from '../../components/loadable';
3737
import LoadableSettingsSection from '../../settings/loadable-settings-section';
3838
import CurrencyInformationForMethods from './currency-information-for-methods';
39-
import { getMissingCurrenciesTooltipMessage } from 'wcpay/multi-currency/missing-currencies-message';
39+
import { getMissingCurrenciesTooltipMessage } from 'multi-currency/interface/functions';
4040
import { upeCapabilityStatuses, upeMethods } from '../constants';
4141
import paymentMethodsMap from '../../payment-methods-map';
4242
import ConfirmPaymentMethodActivationModal from 'wcpay/settings/payment-methods-list/activation-modal';

client/additional-methods-setup/upe-preview-methods-selector/currency-information-for-methods.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import interpolateComponents from '@automattic/interpolate-components';
99
/**
1010
* Internal dependencies
1111
*/
12+
import { useAccountDomesticCurrency } from '../../data';
1213
import {
13-
useAccountDomesticCurrency,
1414
useCurrencies,
1515
useEnabledCurrencies,
16-
} from '../../data';
16+
} from 'multi-currency/interface/data';
1717
import WCPaySettingsContext from '../../settings/wcpay-settings-context';
1818
import InlineNotice from 'components/inline-notice';
1919
import PaymentMethodsMap from '../../payment-methods-map';

client/additional-methods-setup/upe-preview-methods-selector/test/add-payment-methods-task.test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,31 @@ import {
2222
useEnabledPaymentMethodIds,
2323
useGetPaymentMethodStatuses,
2424
useSettings,
25-
useCurrencies,
26-
useEnabledCurrencies,
2725
useManualCapture,
2826
useAccountDomesticCurrency,
2927
} from '../../../data';
28+
import {
29+
useCurrencies,
30+
useEnabledCurrencies,
31+
} from 'multi-currency/interface/data';
32+
3033
import WCPaySettingsContext from '../../../settings/wcpay-settings-context';
3134
import { upeCapabilityStatuses } from 'wcpay/additional-methods-setup/constants';
3235

3336
jest.mock( '../../../data', () => ( {
3437
useGetAvailablePaymentMethodIds: jest.fn(),
3538
useEnabledPaymentMethodIds: jest.fn(),
3639
useSettings: jest.fn(),
37-
useCurrencies: jest.fn(),
38-
useEnabledCurrencies: jest.fn(),
3940
useGetPaymentMethodStatuses: jest.fn(),
4041
useManualCapture: jest.fn(),
4142
useAccountDomesticCurrency: jest.fn(),
4243
} ) );
4344

45+
jest.mock( 'multi-currency/interface/data', () => ( {
46+
useCurrencies: jest.fn(),
47+
useEnabledCurrencies: jest.fn(),
48+
} ) );
49+
4450
jest.mock( '@wordpress/a11y', () => ( {
4551
...jest.requireActual( '@wordpress/a11y' ),
4652
speak: jest.fn(),

client/additional-methods-setup/upe-preview-methods-selector/test/currency-information-for-methods.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@ import { render, screen } from '@testing-library/react';
77
/**
88
* Internal dependencies
99
*/
10+
import { useAccountDomesticCurrency } from '../../../data';
1011
import {
1112
useCurrencies,
1213
useEnabledCurrencies,
13-
useAccountDomesticCurrency,
14-
} from 'wcpay/data';
14+
} from 'multi-currency/interface/data';
1515
import CurrencyInformationForMethods from '../currency-information-for-methods';
1616
import WCPaySettingsContext from '../../../settings/wcpay-settings-context';
1717

18-
jest.mock( 'wcpay/data', () => ( {
18+
jest.mock( '../../../data', () => ( {
19+
useAccountDomesticCurrency: jest.fn(),
20+
} ) );
21+
22+
jest.mock( 'multi-currency/interface/data', () => ( {
1923
useCurrencies: jest.fn(),
2024
useEnabledCurrencies: jest.fn(),
21-
useAccountDomesticCurrency: jest.fn(),
2225
} ) );
2326

2427
jest.mock( '@wordpress/a11y', () => ( {

client/additional-methods-setup/wizard/task-item.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ import { Icon, check } from '@wordpress/icons';
1111
import WizardTaskContext from './task/context';
1212
import './task-item.scss';
1313

14-
const WizardTaskItem = ( { children, title, index, className } ) => {
14+
const WizardTaskItem = ( {
15+
children,
16+
title,
17+
index,
18+
className,
19+
visibleDescription,
20+
} ) => {
1521
const { isCompleted, isActive } = useContext( WizardTaskContext );
1622

1723
return (
@@ -39,6 +45,16 @@ const WizardTaskItem = ( { children, title, index, className } ) => {
3945
</div>
4046
<span className="wcpay-wizard-task__title">{ title }</span>
4147
</div>
48+
{ visibleDescription && ! isActive && (
49+
<span
50+
className={ classNames(
51+
'wcpay-wizard-task__visible-description-element',
52+
'is-muted-color'
53+
) }
54+
>
55+
{ visibleDescription }
56+
</span>
57+
) }
4258
<div className="wcpay-wizard-task__body">{ children }</div>
4359
</li>
4460
);

client/additional-methods-setup/wizard/task-item.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,22 @@
117117
}
118118
}
119119

120+
&__visible-description-element {
121+
position: absolute;
122+
margin-left: 40px;
123+
margin-top: 0;
124+
margin-bottom: 1em;
125+
126+
&.is-muted-color {
127+
color: $gray-700;
128+
}
129+
130+
.components-external-link svg {
131+
width: 1em;
132+
height: 1em;
133+
}
134+
}
135+
120136
.add-payment-methods-task {
121137
&__payment-selector {
122138
&-wrapper {

client/capital/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import Page from 'components/page';
1515
import { TestModeNotice } from 'components/test-mode-notice';
1616
import ErrorBoundary from 'components/error-boundary';
1717
import ActiveLoanSummary from 'components/active-loan-summary';
18-
import { formatExplicitCurrency, isZeroDecimalCurrency } from 'utils/currency';
18+
import {
19+
formatExplicitCurrency,
20+
isZeroDecimalCurrency,
21+
} from 'multi-currency/interface/functions';
1922
import { CapitalLoan } from 'data/capital/types';
2023
import ClickableCell from 'components/clickable-cell';
2124
import Chip from 'components/chip';

client/checkout/woopay/email-input-iframe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import { buildAjaxURL } from 'utils/express-checkout';
99
import { getAppearance } from 'checkout/upe-styles';
1010
import {
1111
getTargetElement,
12-
getAppearanceType,
1312
validateEmail,
1413
appendRedirectionParams,
1514
shouldSkipWooPay,
1615
deleteSkipWooPayCookie,
1716
} from './utils';
17+
import { getAppearanceType } from '../utils';
1818

1919
export const handleWooPayEmailInput = async (
2020
field,

client/components/account-balances/balance-block.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as React from 'react';
66
/**
77
* Internal dependencies
88
*/
9-
import { formatCurrency } from 'wcpay/utils/currency';
9+
import { formatCurrency } from 'multi-currency/interface/functions';
1010
import Loadable from 'components/loadable';
1111

1212
/**

0 commit comments

Comments
 (0)