Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing tracks source for clicks on Fees tile link #8921

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions client/components/payment-activity/payment-activity-data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
<PaymentDataTile
id="wcpay-payment-activity-data__total-payment-volume"
label={ __( 'Total payment volume', 'woocommerce-payments' ) }
tracksSource="total_payment_volume"
currencyCode={ currency }
tooltip={
<ClickTooltip
Expand Down Expand Up @@ -122,12 +123,12 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
searchTermsForViewReportLink.totalPaymentVolume
),
} ) }
tracksSource="total_payment_volume"
isLoading={ isLoading }
/>
<div className="wcpay-payment-data-highlights">
<PaymentDataTile
id="wcpay-payment-data-highlights__charges"
tracksSource="charges"
label={ __( 'Charges', 'woocommerce-payments' ) }
currencyCode={ currency }
tooltip={
Expand Down Expand Up @@ -164,11 +165,11 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
searchTermsForViewReportLink.charge
),
} ) }
tracksSource="charges"
isLoading={ isLoading }
/>
<PaymentDataTile
id="wcpay-payment-data-highlights__refunds"
tracksSource="refunds"
label={ __( 'Refunds', 'woocommerce-payments' ) }
currencyCode={ currency }
amount={ refunds }
Expand All @@ -186,11 +187,11 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
searchTermsForViewReportLink.refunds
),
} ) }
tracksSource="refunds"
isLoading={ isLoading }
/>
<PaymentDataTile
id="wcpay-payment-data-highlights__disputes"
tracksSource="disputes"
label={ __( 'Disputes', 'woocommerce-payments' ) }
currencyCode={ currency }
amount={ disputes }
Expand All @@ -208,11 +209,11 @@ const PaymentActivityDataComponent: React.FC< Props > = ( {
searchTermsForViewReportLink.dispute
),
} ) }
tracksSource="disputes"
isLoading={ isLoading }
/>
<PaymentDataTile
id="wcpay-payment-data-highlights__fees"
tracksSource="fees"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realise that this tile is not clickable like the others. So it doesn't really need a tracksSource. TBC

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking PR as blocked, discussing internally.

May back out of this PR since the main benefit is adding fees source, without that it's not a good idea to make the prop mandatory.

label={ __( 'Fees', 'woocommerce-payments' ) }
currencyCode={ currency }
tooltip={
Expand Down
4 changes: 2 additions & 2 deletions client/components/payment-activity/payment-data-tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ interface PaymentDataTileProps {
*/
reportLink?: string;
/**
* The source of the event tracking.
* Name for the data tile, added to tracks events as `source` prop.
*/
tracksSource?: string;
tracksSource: string;
}

const PaymentDataTile: React.FC< PaymentDataTileProps > = ( {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe( 'PaymentDataTile', () => {
const { container } = render(
<PaymentDataTile
id="total-payment"
tracksSource="total-payment-volume"
currencyCode="usd"
label="Total payment volume"
/>
Expand All @@ -55,6 +56,7 @@ describe( 'PaymentDataTile', () => {
render(
<PaymentDataTile
id="total-payment"
tracksSource="total-payment-volume"
currencyCode="usd"
label={ label }
amount={ 123 }
Expand All @@ -70,6 +72,7 @@ describe( 'PaymentDataTile', () => {
render(
<PaymentDataTile
id="charges-test-tile"
tracksSource="total-payment-volume"
label="Charges"
amount={ amount }
currencyCode={ currencyCode }
Expand All @@ -84,6 +87,7 @@ describe( 'PaymentDataTile', () => {
render(
<PaymentDataTile
id="charges-test-tile"
tracksSource="charges"
label="Charges"
amount={ 10000 }
currencyCode="usd"
Expand Down
Loading