Skip to content

Commit

Permalink
Merge branch 'develop' into update/translations-loading
Browse files Browse the repository at this point in the history
  • Loading branch information
vbelolapotkov authored Feb 5, 2024
2 parents 571f0a3 + 322d3d8 commit 3771878
Show file tree
Hide file tree
Showing 84 changed files with 1,473 additions and 647 deletions.
4 changes: 4 additions & 0 deletions changelog/8075-standardise-tracking
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Refactoring the tracking logic
4 changes: 4 additions & 0 deletions changelog/add-3ds-support-for-link
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Support Stripe Link payments with 3DS cards.
4 changes: 4 additions & 0 deletions changelog/add-5141-dispute-evidence-charge-id-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: add

Show charge id on payments details page, so merchants can grab it to fill out the dispute evidence form when needed.
4 changes: 4 additions & 0 deletions changelog/dev-7887-add-currency-codes-enum
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Added ENUM class for currency codes
4 changes: 4 additions & 0 deletions changelog/dev-8113-bump-qit-cli-dep-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: dev

Comment: Bump qit-cli dependency to version 0.4.0.
5 changes: 5 additions & 0 deletions changelog/update-8099-change-plugin-title-for-wporg-seo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: update
Comment: We just changed the plugin title as displayed on WPORG.


22 changes: 8 additions & 14 deletions client/card-readers/settings/file-upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* External dependencies
*/
import React from 'react';
import wcpayTracks from 'tracks';
import { recordEvent, events } from 'tracks';
import apiFetch from '@wordpress/api-fetch';
import { __ } from '@wordpress/i18n';
import { useDispatch } from '@wordpress/data';
Expand Down Expand Up @@ -71,12 +71,9 @@ const BrandingFileUpload: React.FunctionComponent< CardReaderFileUploadProps > =

setLoading( true );

wcpayTracks.recordEvent(
'wcpay_merchant_settings_file_upload_started',
{
type: key,
}
);
recordEvent( events.SETTINGS_FILE_UPLOAD_STARTED, {
type: key,
} );

const body = new FormData();
body.append( 'file', file );
Expand All @@ -99,14 +96,11 @@ const BrandingFileUpload: React.FunctionComponent< CardReaderFileUploadProps > =
setLoading( false );
setUploadError( false );

wcpayTracks.recordEvent(
'wcpay_merchant_settings_file_upload_success',
{
type: key,
}
);
recordEvent( events.SETTINGS_FILE_UPLOAD_SUCCESS, {
type: key,
} );
} catch ( { err } ) {
wcpayTracks.recordEvent( 'wcpay_merchant_settings_upload_failed', {
recordEvent( events.SETTINGS_FILE_UPLOAD_FAILED, {
message: ( err as Error ).message,
} );

Expand Down
12 changes: 6 additions & 6 deletions client/checkout/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ export default class WCPayAPI {
// If this is a setup intent we're not processing a woopay payment so we can
// use the regular getStripe function.
if ( isSetupIntent ) {
return this.getStripe().confirmCardSetup(
decryptClientSecret( clientSecret )
);
return this.getStripe().handleNextAction( {
clientSecret: decryptClientSecret( clientSecret ),
} );
}

// For woopay we need the capability to switch up the account ID specifically for
Expand All @@ -274,9 +274,9 @@ export default class WCPayAPI {

// When not dealing with a setup intent or woopay we need to force an account
// specific request in Stripe.
return this.getStripe( true ).confirmCardPayment(
decryptClientSecret( clientSecret )
);
return this.getStripe( true ).handleNextAction( {
clientSecret: decryptClientSecret( clientSecret ),
} );
};

return (
Expand Down
4 changes: 2 additions & 2 deletions client/checkout/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
} from '../constants.js';
import { getDeferredIntentCreationUPEFields } from './payment-elements';
import { handleWooPayEmailInput } from '../woopay/email-input-iframe';
import wcpayTracks from 'tracks';
import { recordUserEvent, events } from 'tracks';
import wooPayExpressCheckoutPaymentMethod from '../woopay/express-button/woopay-express-checkout-payment-method';
import { isPreviewing } from '../preview';

Expand Down Expand Up @@ -127,7 +127,7 @@ const addCheckoutTracking = () => {
return;
}

wcpayTracks.recordUserEvent( wcpayTracks.events.PLACE_ORDER_CLICK );
recordUserEvent( events.PLACE_ORDER_CLICK );
} );
}
};
Expand Down
4 changes: 2 additions & 2 deletions client/checkout/classic/event-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import WCPayAPI from 'wcpay/checkout/api';
import apiRequest from '../utils/request';
import { handleWooPayEmailInput } from 'wcpay/checkout/woopay/email-input-iframe';
import { isPreviewing } from 'wcpay/checkout/preview';
import wcpayTracks from 'tracks';
import { recordUserEvent, events } from 'tracks';

jQuery( function ( $ ) {
enqueueFraudScripts( getUPEConfig( 'fraudServices' ) );
Expand Down Expand Up @@ -83,7 +83,7 @@ jQuery( function ( $ ) {
return;
}

wcpayTracks.recordUserEvent( wcpayTracks.events.PLACE_ORDER_CLICK );
recordUserEvent( events.PLACE_ORDER_CLICK );
} );

window.addEventListener( 'hashchange', () => {
Expand Down
19 changes: 5 additions & 14 deletions client/checkout/woopay/email-input-iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { __ } from '@wordpress/i18n';
import { getConfig } from 'wcpay/utils/checkout';
import wcpayTracks from 'tracks';
import { recordUserEvent, events } from 'tracks';
import request from '../utils/request';
import { buildAjaxURL } from '../../payment-request/utils';
import {
Expand Down Expand Up @@ -340,7 +340,7 @@ export const handleWooPayEmailInput = async (
parentDiv.removeChild( errorMessage );
}

wcpayTracks.recordUserEvent( wcpayTracks.events.WOOPAY_EMAIL_CHECK );
recordUserEvent( events.WOOPAY_EMAIL_CHECK );

request(
buildAjaxURL( getConfig( 'wcAjaxUrl' ), 'get_woopay_signature' ),
Expand Down Expand Up @@ -402,10 +402,7 @@ export const handleWooPayEmailInput = async (
if ( data[ 'user-exists' ] ) {
openIframe( email );
} else if ( data.code !== 'rest_invalid_param' ) {
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_OFFERED,
[]
);
recordUserEvent( events.WOOPAY_OFFERED );
}
} )
.catch( ( err ) => {
Expand Down Expand Up @@ -502,9 +499,7 @@ export const handleWooPayEmailInput = async (
'woopay-login-session-iframe-wrapper'
);
loginSessionIframe.classList.add( 'open' );
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_AUTO_REDIRECT
);
recordUserEvent( events.WOOPAY_AUTO_REDIRECT );
spinner.remove();
// Do nothing if the iframe has been closed.
if (
Expand Down Expand Up @@ -625,11 +620,7 @@ export const handleWooPayEmailInput = async (
dispatchUserExistEvent( true );
}, 2000 );

wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_SKIPPED,
[],
true
);
recordUserEvent( events.WOOPAY_SKIPPED, {}, true );

searchParams.delete( 'skip_woopay' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { expressCheckoutIframe } from '../express-checkout-iframe';
import WCPayAPI from 'wcpay/checkout/api';
import request from 'wcpay/checkout/utils/request';
import { getConfig } from 'utils/checkout';
import wcpayTracks from 'tracks';
import useExpressCheckoutProductHandler from '../use-express-checkout-product-handler';

jest.mock( 'wcpay/checkout/utils/request', () => ( {
Expand All @@ -30,7 +29,27 @@ jest.mock( '../express-checkout-iframe', () => ( {
} ) );

jest.mock( 'tracks', () => ( {
recordUserEvent: jest.fn(),
recordUserEvent: jest.fn().mockReturnValue( true ),
events: {
WOOPAY_EMAIL_CHECK: 'checkout_email_address_woopay_check',
WOOPAY_OFFERED: 'checkout_woopay_save_my_info_offered',
WOOPAY_AUTO_REDIRECT: 'checkout_woopay_auto_redirect',
WOOPAY_SKIPPED: 'woopay_skipped',
WOOPAY_BUTTON_LOAD: 'woopay_button_load',
WOOPAY_BUTTON_CLICK: 'woopay_button_click',
WOOPAY_SAVE_MY_INFO_COUNTRY_CLICK:
'checkout_woopay_save_my_info_country_click',
WOOPAY_SAVE_MY_INFO_CLICK: 'checkout_save_my_info_click',
WOOPAY_SAVE_MY_INFO_MOBILE_ENTER:
'checkout_woopay_save_my_info_mobile_enter',
WOOPAY_SAVE_MY_INFO_TOS_CLICK: 'checkout_save_my_info_tos_click',
WOOPAY_SAVE_MY_INFO_PRIVACY_CLICK:
'checkout_save_my_info_privacy_policy_click',
WOOPAY_SAVE_MY_INFO_TOOLTIP_CLICK:
'checkout_save_my_info_tooltip_click',
WOOPAY_SAVE_MY_INFO_TOOLTIP_LEARN_MORE_CLICK:
'checkout_save_my_info_tooltip_learn_more_click',
},
} ) );

jest.mock( '../use-express-checkout-product-handler', () => jest.fn() );
Expand All @@ -53,10 +72,6 @@ describe( 'WoopayExpressCheckoutButton', () => {
beforeEach( () => {
expressCheckoutIframe.mockImplementation( () => jest.fn() );
getConfig.mockReturnValue( 'foo' );
wcpayTracks.recordUserEvent.mockReturnValue( true );
wcpayTracks.events = {
WOOPAY_EXPRESS_BUTTON_OFFERED: 'woopay_express_button_offered',
};
useExpressCheckoutProductHandler.mockImplementation( () => ( {
addToCart: mockAddToCart,
} ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import WoopayIcon from './woopay-icon';
import WoopayIconLight from './woopay-icon-light';
import { expressCheckoutIframe } from './express-checkout-iframe';
import useExpressCheckoutProductHandler from './use-express-checkout-product-handler';
import wcpayTracks from 'tracks';
import { recordUserEvent, events } from 'tracks';
import { getConfig } from 'wcpay/utils/checkout';
import request from 'wcpay/checkout/utils/request';
import { showErrorMessage } from 'wcpay/checkout/woopay/express-button/utils';
Expand Down Expand Up @@ -77,12 +77,9 @@ export const WoopayExpressCheckoutButton = ( {

useEffect( () => {
if ( ! isPreview ) {
wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_BUTTON_LOAD,
{
source: context,
}
);
recordUserEvent( events.WOOPAY_BUTTON_LOAD, {
source: context,
} );
}
}, [ isPreview, context ] );

Expand Down Expand Up @@ -154,12 +151,9 @@ export const WoopayExpressCheckoutButton = ( {
return; // eslint-disable-line no-useless-return
}

wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_BUTTON_CLICK,
{
source: context,
}
);
recordUserEvent( events.WOOPAY_BUTTON_CLICK, {
source: context,
} );

if ( ! canAddProductToCart() ) {
return;
Expand Down Expand Up @@ -240,12 +234,9 @@ export const WoopayExpressCheckoutButton = ( {
return;
}

wcpayTracks.recordUserEvent(
wcpayTracks.events.WOOPAY_BUTTON_CLICK,
{
source: context,
}
);
recordUserEvent( events.WOOPAY_BUTTON_CLICK, {
source: context,
} );

if ( ! canAddProductToCart() ) {
return;
Expand Down
11 changes: 4 additions & 7 deletions client/components/account-balances/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import BalanceBlock from './balance-block';
import BalanceTooltip from './balance-tooltip';
import { documentationUrls, fundLabelStrings } from './strings';
import InstantDepositButton from 'deposits/instant-deposits';
import wcpayTracks from 'tracks';
import { recordEvent, events } from 'tracks';
import type * as AccountOverview from 'wcpay/types/account-overview';
import './style.scss';

Expand Down Expand Up @@ -57,12 +57,9 @@ const AccountBalances: React.FC = () => {

const onTabSelect = ( tabName: BalanceTabProps[ 'name' ] ) => {
setSelectedCurrency( tabName );
wcpayTracks.recordEvent(
wcpayTracks.events.OVERVIEW_BALANCES_CURRENCY_CLICK,
{
selected_currency: tabName,
}
);
recordEvent( events.OVERVIEW_BALANCES_CURRENCY_CLICK, {
selected_currency: tabName,
} );
};

if ( isLoading ) {
Expand Down
12 changes: 5 additions & 7 deletions client/components/deposits-overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies.
*/
import { getAdminUrl } from 'wcpay/utils';
import wcpayTracks from 'tracks';
import { recordEvent, events } from 'tracks';
import Loadable from 'components/loadable';
import { useSelectedCurrencyOverview } from 'wcpay/overview/hooks';
import RecentDepositsList from './recent-deposits-list';
Expand Down Expand Up @@ -160,9 +160,8 @@ const DepositsOverview: React.FC = () => {
path: '/payments/deposits',
} ) }
onClick={ () =>
wcpayTracks.recordEvent(
wcpayTracks.events
.OVERVIEW_DEPOSITS_VIEW_HISTORY_CLICK
recordEvent(
events.OVERVIEW_DEPOSITS_VIEW_HISTORY_CLICK
)
}
>
Expand All @@ -184,9 +183,8 @@ const DepositsOverview: React.FC = () => {
} ) + '#deposit-schedule'
}
onClick={ () =>
wcpayTracks.recordEvent(
wcpayTracks.events
.OVERVIEW_DEPOSITS_CHANGE_SCHEDULE_CLICK
recordEvent(
events.OVERVIEW_DEPOSITS_CHANGE_SCHEDULE_CLICK
)
}
>
Expand Down
13 changes: 5 additions & 8 deletions client/components/disputed-order-notice/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
isUnderReview,
} from 'wcpay/disputes/utils';
import { useCharge } from 'wcpay/data';
import wcpayTracks from 'tracks';
import { recordEvent, events } from 'tracks';
import './style.scss';

const DisputedOrderNoticeHandler = ( { chargeId, onDisableOrderRefund } ) => {
Expand Down Expand Up @@ -201,7 +201,7 @@ const DisputeNeedsResponseNotice = ( {
disputeDetailsUrl,
} ) => {
useEffect( () => {
wcpayTracks.recordEvent( 'wcpay_order_dispute_notice_view', {
recordEvent( events.DISPUTE_NOTICE_VIEW, {
is_inquiry: isPreDisputeInquiry,
dispute_reason: disputeReason,
due_by_days: countdownDays,
Expand Down Expand Up @@ -241,12 +241,9 @@ const DisputeNeedsResponseNotice = ( {
label: buttonLabel,
variant: 'secondary',
onClick: () => {
wcpayTracks.recordEvent(
'wcpay_order_dispute_notice_action_click',
{
due_by_days: countdownDays,
}
);
recordEvent( events.DISPUTE_NOTICE_CLICK, {
due_by_days: countdownDays,
} );
window.location = disputeDetailsUrl;
},
},
Expand Down
Loading

0 comments on commit 3771878

Please sign in to comment.