Skip to content

Commit

Permalink
Merge branch 'develop' into fix/7847-update-deposits-api-docs-estimat…
Browse files Browse the repository at this point in the history
…ed-deposits-rm
  • Loading branch information
Jinksi authored Jan 25, 2024
2 parents 809796e + 3cae215 commit 9e68172
Show file tree
Hide file tree
Showing 50 changed files with 3,141 additions and 191 deletions.
1 change: 1 addition & 0 deletions .github/actions/e2e/run-log-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ runs:
with:
name: wp(${{ env.E2E_WP_VERSION }})-wc(${{ env.E2E_WC_VERSION }})-${{ env.E2E_GROUP }}-${{ env.E2E_BRANCH }}
path: |
screenshots
tests/e2e/screenshots
tests/e2e/docker/wordpress/wp-content/debug.log
${{ env.E2E_RESULT_FILEPATH }}
Expand Down
5 changes: 0 additions & 5 deletions assets/images/payment-methods/afterpay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/images/payment-methods/clearpay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions changelog/afterpay-clearpay
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Displaying Clearpay instead of Afterpay for UK based stores
5 changes: 5 additions & 0 deletions changelog/chore-mark-internal-methods-called-by-core
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: chore: adding a comment to internal methods that are called by WC core.


5 changes: 5 additions & 0 deletions changelog/chore-remove-unused-settings-generate-functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: dev
Comment: remove unused generate_* functions for settings generation


4 changes: 4 additions & 0 deletions changelog/colour-updates
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

chore: update colors on documentation pages
4 changes: 4 additions & 0 deletions changelog/e2e-7347-merchant-on-boarding
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

E2E test - Merchant facing multi-currency on-boarding screen.
4 changes: 4 additions & 0 deletions changelog/fix-2309-woopay-preflight-coupon-usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Prevent coupon usage increase in a WooPay preflight check.
4 changes: 4 additions & 0 deletions changelog/fix-8059-qit-security-test-failed-in-develop-branch
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Comment: Fix QIT security tests errors.
4 changes: 4 additions & 0 deletions changelog/fix-remove-dispute-accept-log-tracks-events
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Remove unnecessary tracks events for dispute accept success/error.
4 changes: 4 additions & 0 deletions changelog/fix-woopay-2401-validate-session
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: add

Enhance WooPay session validation
5 changes: 5 additions & 0 deletions changelog/update-confetti-animation
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: update
Comment: Confetti animation update.


Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,22 @@ export const WoopayExpressCheckoutButton = ( {
}
)
.then( ( response ) => {
iframe.contentWindow.postMessage(
{
action: 'setPreemptiveSessionData',
value: response,
},
getConfig( 'woopayHost' )
);
if (
response?.blog_id &&
response?.data?.session
) {
iframe.contentWindow.postMessage(
{
action: 'setPreemptiveSessionData',
value: response,
},
getConfig( 'woopayHost' )
);
} else {
// Set button's default onClick handle to use modal checkout flow.
initWoopayRef.current = onClickFallback;
throw new Error( response?.data );
}
} )
.catch( () => {
const errorMessage = __(
Expand All @@ -317,13 +326,22 @@ export const WoopayExpressCheckoutButton = ( {
}
)
.then( ( response ) => {
iframe.contentWindow.postMessage(
{
action: 'setPreemptiveSessionData',
value: response,
},
getConfig( 'woopayHost' )
);
if (
response?.blog_id &&
response?.data?.session
) {
iframe.contentWindow.postMessage(
{
action: 'setPreemptiveSessionData',
value: response,
},
getConfig( 'woopayHost' )
);
} else {
// Set button's default onClick handle to use modal checkout flow.
initWoopayRef.current = onClickFallback;
throw new Error( response?.data );
}
} )
?.catch( () => {
const errorMessage = __(
Expand Down
65 changes: 39 additions & 26 deletions client/components/confetti-animation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,51 @@ import confetti from 'canvas-confetti';

const defaultColors = [ '#889BF2', '#C3CDF9', '#6079ED' ];

const randomInRange = ( min: number, max: number ): number =>
Math.floor( Math.random() * ( max - min ) + min );

// Use a rectangle instead of an square on supported browsers.
const rectangle =
typeof Path2D === 'function' && typeof DOMMatrix === 'function'
? confetti.shapeFromPath( {
path: 'M0,0 L2,0 L2,1 L0,1 Z',
} )
: 'square';

// Adjust particle amount based on screen size.
const particleLength = ( window.innerWidth + window.innerHeight ) / 50;

const fireConfetti = ( colors: string[] ) => {
const defaults = {
origin: { y: 0.3 },
spread: 360,
particleCount: 1,
startVelocity: 0,
zIndex: 1000000,
colors,
};

const rectangle = confetti.shapeFromPath( {
path: 'M0,0 L2,0 L2,1 L0,1 Z',
} );

confetti( {
...defaults,
particleCount: 20,
shapes: [ rectangle ],
scalar: 4,
startVelocity: 60,
} );
confetti( {
...defaults,
particleCount: 20,
shapes: [ rectangle ],
scalar: 2,
startVelocity: 40,
} );
confetti( {
...defaults,
particleCount: 40,
shapes: [ 'circle' ],
startVelocity: 20,
} );
for ( let i = 0; i < particleLength; i++ ) {
confetti( {
...defaults,
colors: [ colors[ randomInRange( 0, colors.length ) ] ],
origin: {
x: Math.random(),
y: Math.random() * 0.999 - 0.2,
},
drift: randomInRange( -2, 2 ),
shapes: [ 'circle' ],
} );
confetti( {
...defaults,
colors: [ colors[ randomInRange( 0, colors.length ) ] ],
origin: {
x: Math.random(),
y: Math.random() * 0.999 - 0.2,
},
shapes: [ rectangle ],
drift: randomInRange( -2, 2 ),
scalar: randomInRange( 2, 4 ),
} );
}
};

interface Props {
Expand Down
7 changes: 6 additions & 1 deletion client/connect-account-page/payment-methods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import './style.scss';
import {
AffirmIcon,
AfterpayIcon,
ClearpayIcon,
AmericanExpressIcon,
ApplePayIcon,
DinersClubIcon,
Expand All @@ -38,7 +39,11 @@ const PaymentMethods: React.FC = () => {
<UnionPayIcon />
<JCBIcon />
<AffirmIcon />
<AfterpayIcon />
{ 'GB' === wcpaySettings?.connect?.country ? (
<ClearpayIcon />
) : (
<AfterpayIcon />
) }
<span>& more.</span>
</div>
</>
Expand Down
3 changes: 0 additions & 3 deletions client/data/disputes/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { __, sprintf } from '@wordpress/i18n';
*/
import { NAMESPACE, STORE_NAME } from '../constants';
import TYPES from './action-types';
import wcpayTracks from 'tracks';
import { getPaymentIntent } from '../payment-intents/resolvers';

export function updateDispute( data ) {
Expand Down Expand Up @@ -70,7 +69,6 @@ export function* acceptDispute( dispute ) {
id,
] );

wcpayTracks.recordEvent( 'wcpay_dispute_accept_success' );
const message = updatedDispute.order
? sprintf(
/* translators: #%s is an order number, e.g. 15 */
Expand All @@ -91,7 +89,6 @@ export function* acceptDispute( dispute ) {
'There has been an error accepting the dispute. Please try again later.',
'woocommerce-payments'
);
wcpayTracks.recordEvent( 'wcpay_dispute_accept_failed' );
yield controls.dispatch( 'core/notices', 'createErrorNotice', message );
yield controls.dispatch( STORE_NAME, 'finishResolution', 'getDispute', [
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,14 @@ const AddCurrenciesTask = () => {
);
} );

const displayCurrencyCheckbox = ( code ) =>
const displayCurrencyCheckbox = ( code, testId = '' ) =>
availableCurrencyCodes.length && (
<EnabledCurrenciesModalCheckbox
key={ 'currency-checkbox-' + availableCurrencies[ code ].id }
checked={ selectedCurrencyCodes.includes( code ) }
onChange={ handleChange }
currency={ availableCurrencies[ code ] }
testId={ _.isString( testId ) ? testId : null }
/>
);

Expand Down Expand Up @@ -284,7 +285,11 @@ const AddCurrenciesTask = () => {
</h4>
</li>
{ visibleRecommendedCurrencyCodes.map(
displayCurrencyCheckbox
( code ) =>
displayCurrencyCheckbox(
code,
'recommended-currency'
)
) }
<li
className={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -171,6 +172,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -232,6 +234,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -293,6 +296,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -354,6 +358,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down Expand Up @@ -415,6 +420,7 @@ exports[`Multi-Currency enabled currencies list add currencies task renders corr
</li>
<li
class="enabled-currency-checkbox"
data-testid="recommended-currency"
>
<div
class="components-base-control components-checkbox-control css-wdf2ti-Wrapper ej5x27r4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const EnabledCurrenciesModalCheckbox = ( {
onChange,
checked = false,
currency: { flag, symbol, code, name },
testId = null,
} ) => {
const handleChange = useCallback(
( enabled ) => {
Expand All @@ -20,7 +21,7 @@ const EnabledCurrenciesModalCheckbox = ( {
);

return (
<li className="enabled-currency-checkbox">
<li className="enabled-currency-checkbox" data-testid={ testId }>
<CheckboxControl
code={ code }
checked={ checked }
Expand Down
5 changes: 5 additions & 0 deletions client/payment-methods-icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import IdealAsset from 'assets/images/payment-methods/ideal.svg?asset';
import BankDebitAsset from 'assets/images/payment-methods/bank-debit.svg?asset';
import AffirmAsset from 'assets/images/payment-methods/affirm.svg?asset';
import AfterpayAsset from 'assets/images/payment-methods/afterpay.svg?asset';
import ClearpayAsset from 'assets/images/payment-methods/clearpay.svg?asset';
import JCBAsset from 'assets/images/payment-methods/jcb.svg?asset';
import KlarnaAsset from 'assets/images/payment-methods/klarna.svg?asset';
import VisaAsset from 'assets/images/cards/visa.svg?asset';
Expand Down Expand Up @@ -57,6 +58,10 @@ export const AfterpayIcon = iconComponent(
AfterpayAsset,
__( 'Afterpay', 'woocommerce-payments' )
);
export const ClearpayIcon = iconComponent(
ClearpayAsset,
__( 'Clearpay', 'woocommerce-payments' )
);
export const AmericanExpressIcon = iconComponent(
AmexAsset,
__( 'American Express', 'woocommerce-payments' )
Expand Down
Loading

0 comments on commit 9e68172

Please sign in to comment.