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

Reporting: Fix the View report link URL on Total payment volume tile, within Payment activity widget #8726

Merged
merged 17 commits into from
May 2, 2024

Conversation

nagpai
Copy link
Contributor

@nagpai nagpai commented Apr 29, 2024

Fixes #8706

Changes proposed in this Pull Request

The PR fixes the View report link on Total Payment volume tile to match the requirement as follows:

  • Total payment volume should show all types created over the last 7 days (or selected time filter) except for Loan disbursement and Loan repayment

Notes

  • The existing advanced filter on the Transaction page, do have Type is and Type is not filters, but they do not allow selecting more than one types in it, in the current design.
  • Thanks to @shendy-a8c , who drew my attention to the default Disputes link that uses search term params to give a result comprising types - needs_response and warning_needs_response
image
  • For segregating transactions matching the above criteria, similar principle has been used :
    • On the server, the exact search of type has been added in the search fields.
    • On the client, the View report URL was edited to include the search terms.
    • Some minor CSS changes were done so that the tags that appear in the search box do not warp outside the box.

A more permanent solution to this would be to have typeIs and typeIsNot params accept arrays. But this may require higher effort to execute and to ensure backward compatibility. I found using the way similar to Disputes a better option for now.

Testing instructions

  • On your local server instance, please check out branch add/type-to-search-by-fields
  • On the local test client setup, make sure your account has sufficient transactions within the last 7 days, and at least one Loan disbursement and Loan repayment . See if you can switch to acct_1OuYn1QpUShfetUA which has these ( and should remain for the next few days. Else create the loan transactions using the steps in the PdjTHR-31T-p2.
  • Browse to Payments > Overview and click the View report against Total payment volume
  • On the transactions report page that lands, you should see all transactions except Loan disbursement and Loan repayment

Screenshots

On a wider screen
image

On a narrow screen
image

Without the CSS change, it would appear like this:
image


  • Run npm run changelog to add a changelog file, choose patch to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.
  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Post merge

@botwoo
Copy link
Collaborator

botwoo commented Apr 29, 2024

Test the build

Option 1. Jetpack Beta

  • Install and activate Jetpack Beta.
  • Use this build by searching for PR number 8726 or branch name fix/8706-tpv-view-report-link in your-test.site/wp-admin/admin.php?page=jetpack-beta&plugin=woocommerce-payments

Option 2. Jurassic Ninja - available for logged-in A12s

🚀 Launch a JN site with this branch 🚀

ℹ️ Install this Tampermonkey script to get more options.


Build info:

  • Latest commit: 8cd9331
  • Build time: 2024-05-02 08:54:27 UTC

Note: the build is updated when a new commit is pushed to this PR.

Copy link
Contributor

github-actions bot commented Apr 29, 2024

Size Change: +116 B (0%)

Total Size: 1.25 MB

Filename Size Change
release/woocommerce-payments/dist/index-rtl.css 40.7 kB +10 B (0%)
release/woocommerce-payments/dist/index.css 40.6 kB +9 B (0%)
release/woocommerce-payments/dist/index.js 292 kB +97 B (0%)
ℹ️ View Unchanged
Filename Size
release/woocommerce-payments/assets/css/admin.css 1.08 kB
release/woocommerce-payments/assets/css/admin.rtl.css 1.08 kB
release/woocommerce-payments/assets/css/success.css 172 B
release/woocommerce-payments/assets/css/success.rtl.css 172 B
release/woocommerce-payments/dist/blocks-checkout-rtl.css 2.06 kB
release/woocommerce-payments/dist/blocks-checkout.css 2.07 kB
release/woocommerce-payments/dist/blocks-checkout.js 56.3 kB
release/woocommerce-payments/dist/bnpl-announcement-rtl.css 530 B
release/woocommerce-payments/dist/bnpl-announcement.css 531 B
release/woocommerce-payments/dist/bnpl-announcement.js 20 kB
release/woocommerce-payments/dist/cart-block.js 21.4 kB
release/woocommerce-payments/dist/cart.js 4.39 kB
release/woocommerce-payments/dist/checkout-rtl.css 599 B
release/woocommerce-payments/dist/checkout.css 599 B
release/woocommerce-payments/dist/checkout.js 37.5 kB
release/woocommerce-payments/dist/multi-currency-analytics.js 1.05 kB
release/woocommerce-payments/dist/multi-currency-rtl.css 3.28 kB
release/woocommerce-payments/dist/multi-currency-switcher-block.js 59.5 kB
release/woocommerce-payments/dist/multi-currency.css 3.29 kB
release/woocommerce-payments/dist/multi-currency.js 54.6 kB
release/woocommerce-payments/dist/order-rtl.css 733 B
release/woocommerce-payments/dist/order.css 735 B
release/woocommerce-payments/dist/order.js 41.8 kB
release/woocommerce-payments/dist/payment-gateways-rtl.css 1.21 kB
release/woocommerce-payments/dist/payment-gateways.css 1.21 kB
release/woocommerce-payments/dist/payment-gateways.js 38.6 kB
release/woocommerce-payments/dist/payment-request-rtl.css 155 B
release/woocommerce-payments/dist/payment-request.css 155 B
release/woocommerce-payments/dist/payment-request.js 12 kB
release/woocommerce-payments/dist/product-details-rtl.css 398 B
release/woocommerce-payments/dist/product-details.css 402 B
release/woocommerce-payments/dist/product-details.js 17.2 kB
release/woocommerce-payments/dist/settings-rtl.css 11.1 kB
release/woocommerce-payments/dist/settings.css 10.9 kB
release/woocommerce-payments/dist/settings.js 201 kB
release/woocommerce-payments/dist/subscription-edit-page.js 669 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal-rtl.css 527 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.css 527 B
release/woocommerce-payments/dist/subscription-product-onboarding-modal.js 19.4 kB
release/woocommerce-payments/dist/subscription-product-onboarding-toast.js 693 B
release/woocommerce-payments/dist/subscriptions-empty-state-rtl.css 120 B
release/woocommerce-payments/dist/subscriptions-empty-state.css 120 B
release/woocommerce-payments/dist/subscriptions-empty-state.js 18.5 kB
release/woocommerce-payments/dist/tos-rtl.css 235 B
release/woocommerce-payments/dist/tos.css 236 B
release/woocommerce-payments/dist/tos.js 21 kB
release/woocommerce-payments/dist/woopay-direct-checkout.js 4.54 kB
release/woocommerce-payments/dist/woopay-express-button-rtl.css 155 B
release/woocommerce-payments/dist/woopay-express-button.css 155 B
release/woocommerce-payments/dist/woopay-express-button.js 21 kB
release/woocommerce-payments/dist/woopay-rtl.css 4.25 kB
release/woocommerce-payments/dist/woopay.css 4.22 kB
release/woocommerce-payments/dist/woopay.js 69.4 kB
release/woocommerce-payments/includes/subscriptions/assets/css/plugin-page.css 622 B
release/woocommerce-payments/includes/subscriptions/assets/js/plugin-page.js 815 B
release/woocommerce-payments/vendor/automattic/jetpack-assets/build/i18n-loader.js 2.44 kB
release/woocommerce-payments/vendor/automattic/jetpack-assets/src/js/i18n-loader.js 1.01 kB
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-ajax.js 522 B
release/woocommerce-payments/vendor/automattic/jetpack-connection/dist/tracks-callables.js 581 B
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/babel.config.js 160 B
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.css 2.37 kB
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.js 13.5 kB
release/woocommerce-payments/vendor/automattic/jetpack-identity-crisis/build/index.rtl.css 2.37 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/about.css 1.03 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-empty-state.css 291 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin-order-statuses.css 403 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/admin.css 3.6 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/checkout.css 299 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/modal.css 742 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/view-subscription.css 572 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/css/wcs-upgrade.css 411 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin-pointers.js 544 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/admin.js 9.4 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.js 6.8 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/jstz.min.js 3.83 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-coupon.js 544 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/meta-boxes-subscription.js 2.52 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.js 22.1 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/moment.min.js 11.6 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/payment-method-restrictions.js 1.29 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/admin/wcs-meta-boxes-order.js 502 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/payment-methods.js 355 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/single-product.js 429 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/view-subscription.js 1.38 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/frontend/wcs-cart.js 781 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/modal.js 1.1 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/assets/js/wcs-upgrade.js 1.27 kB
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.css 392 B
release/woocommerce-payments/vendor/woocommerce/subscriptions-core/build/index.js 3.05 kB

compressed-size-action

@nagpai nagpai marked this pull request as ready for review April 29, 2024 05:32
@nagpai nagpai requested a review from a team April 29, 2024 05:32
@nagpai nagpai requested review from a team and jessy-p April 29, 2024 09:53
Copy link
Contributor

@jessy-p jessy-p left a comment

Choose a reason for hiding this comment

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

Filtered values are NOT displayed on the page. Hope that is OK/ as expected @nagpai
Further filtering by applying Advanced filter is working as expected.

@jessy-p
Copy link
Contributor

jessy-p commented Apr 29, 2024

Some minor CSS changes were done so that the tags that appear in the search box do not warp outside the box.

If I do not have Loan disbursement and Loan repayment types in my timeline, should I still be seeing all the other transaction types as tags? Can you share a screenshot? @nagpai

@nagpai
Copy link
Contributor Author

nagpai commented Apr 29, 2024

Filtered values are NOT displayed on the page. Hope that is OK/ as expected @nagpai
Further filtering by applying Advanced filter is working as expected.

Hi @jessy-p , I hope you are seeing all transaction types except for Loan disbursement and Loan repayment

If I do not have Loan disbursement and Loan repayment types in my timeline, should I still be seeing all the other transaction types as tags? Can you share a screenshot?

Yes, it is expected for you to see all other transaction type tags in the search bar, since we do not have a negative search option .. The types include charge, payment, payment_failure_refund, payment_refund, refund, refund_failure, dispute, dispute_reversal, card_reader_fee .

Since this list is long, to prevent warping I added a subtle scroll overflow. Adding the screenshot in a moment. Added!

If you like to see the loan related transactions filtered out, feel free to switch to my test account via the CLI command on server - ./local/bin/link-account.sh <your client blog id> acct_1OuYn1QpUShfetUA . It has a loan disbursal and repayment transaction, that you can see getting filtered out.

@nagpai nagpai requested review from jessy-p and a team April 29, 2024 12:40
@jessy-p
Copy link
Contributor

jessy-p commented Apr 30, 2024

After using the server branch add/type-to-search-by-fields, I am able to see the Transactions search box with the tags as expected.

🟡 Only if the customer clicks on Advanced filter, he will see the dates which have been applied. Add filter=advanced to the URL to have the Date displayed when the page is loaded.

✅ Filters are working correctly and when changed, the data refreshes accordingly. Everything clear, nothing confusing or odd observed.

🟡 The scroll section still looks bit off to me. Bottom part of the tags seem to be cut off and when you click in the box, the Search by prompt overlaps with x. Can check with Design about solutions for this.
image

@nagpai
Copy link
Contributor Author

nagpai commented Apr 30, 2024

🟡 Only if the customer clicks on Advanced filter, he will see the dates which have been applied. Add filter=advanced to the URL to have the Date displayed when the page is loaded.

I have addressed this here 75a17d2

It looks like this now with the advanced date filters visible.

image

@nagpai
Copy link
Contributor Author

nagpai commented Apr 30, 2024

@jessy-p

On this point

🟡 The scroll section still looks bit off to me. Bottom part of the tags seem to be cut off and when you click in the box, the Search by prompt overlaps with x. Can check with Design about solutions for this.

I tried on Chrome, Vivaldi, FF and Safari at my end, and I am unable to replicate the bottom clipping on the search box tags. The Search by prompt does overlap with X for certain in-betweeen screen sizes.

In its current state, the landing link shows the Total Payment Volume numbers and its breakdown. But it makes further filtration by the user a bit uncomfortable. The recording here may illustrate this better.

Screen.Capture.on.2024-04-30.at.21-55-53.mov

@rogermattic , Hi, we need your help here for the view of the search bar within Transactions report results - when

  • There are a larger number of search terms, probably warping into next line
  • More likely on a mobile or a narrow screen profile

In our case because of the filter needed for TPV transactions ). This disrupts the appearance of the search prompt. It is possible to add further search tags though, but visibility is a bit bad.

@jessy-p I was wondering if I should create a separate case for this. Would this be a blocker for the current PR?

@@ -123,6 +123,8 @@ $gap-small: 12px;

.woocommerce-select-control__control {
height: 38px;
overflow: scroll;
align-items: flex-start;
Copy link
Member

@Jinksi Jinksi May 1, 2024

Choose a reason for hiding this comment

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

Although it is a minor fix, this change isn't behind the feature flag.

Perhaps it would help communicate this change if we had 2 changelog entries:

  1. Fix for view report behind feature flag.
  2. Fix for Transaction List styles

Alternatively, relevant to this comment:

@jessy-p I was wondering if I should create a separate case for this. Would this be a blocker for the current PR?

We could move this change to a separate issue/PR. This may help us step back and look at the problem/solution separate to the Payment Activity Card.

Copy link
Member

Choose a reason for hiding this comment

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

As an alternative UX to overflow: scroll, I would consider letting the search box to increase in height when necessary, example:

image

image

(avoiding the !important if possible 😉)

Copy link
Contributor Author

@nagpai nagpai May 1, 2024

Choose a reason for hiding this comment

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

Although it is a minor fix, this change isn't behind the feature flag.

I had completely missed this! Thanks for sharing!.

I would favor creating a separate issue + PR. It would be tiny but keep things clear.

I did a deeper check and it looks like we need some more work to do for responsive view ( for narrow screens ) . e.g. The Date filter with Between appears botched in mobile screen, and the search prompt disappears too in the narrow screen. I will create a separate issue for this.

Within this PR however, I will include the change @Jinksi suggested to increase the height. - 75a65a4. Since it will help immediately with how the tags appear when there are too many.

Choose a reason for hiding this comment

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

@nagpai Thanks for rising it and @Jinksi thanks for coming up with the fix. I feel like the increase in height is the best we can do now. For the narrower (mobile) screens - I don't know if this is possible – but I'd:

  1. put the applied filter (tags) in one line (could they be horizontally scrollable?)
  2. have the x cross sign for the user to clear the filters visible
  3. have the next (2nd) line empty so that the user can search if they want

In a nutshell, I'd prioritise the user's ability to search over seeing all the applied filters.

Ugh, does it make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rogermattic Thanks, Magda! I will add this guidance in the new issue I create for improving the mobile UI 🙏 !

Choose a reason for hiding this comment

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

Thanks @nagpai ! if you have anything for me to look at, just ping me:)

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 have created #8781 to track this change here!

@Jinksi Jinksi requested a review from a team May 1, 2024 06:20
@nagpai
Copy link
Contributor Author

nagpai commented May 1, 2024

Via - 16d12d2

Moved the view report search params generating function outside, to help add similar terms to other tiles

const searchTermsForViewReportLink = {
		totalPaymentVolume: [
			'charge',
			'payment',
			'payment_failure_refund',
			'payment_refund',
			'refund',
			'refund_failure',
			'dispute',
			'dispute_reversal',
			'card_reader_fee',
		],
	};

	const getSearchParams = ( searchTerms: string[] ) => {
		return searchTerms.reduce(
			( acc, term, index ) => ( {
				...acc,
				[ `search[${ index }]` ]: term,
			} ),
			{}
		);
	};

For refunds, charges and disputes, there will be similar arrays added like totalPaymentVolume seen above.

and the getSearchParams function will add each search term in the URL.

@nagpai nagpai requested a review from Jinksi May 1, 2024 15:22
],
};

const getSearchParams = ( searchTerms: string[] ) => {
Copy link
Member

@Jinksi Jinksi May 2, 2024

Choose a reason for hiding this comment

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

💭 This is not an issue per se (feel free to ignore), but I'd consider moving this function and searchTerms declaration outside of the React component scope (alongside getDateRange) since it doesn't require any component variables/state.

E.g. if it is declared outside the component, it explicitly lets us know it is decoupled from the component and can be used elsewhere, moved, unit tested, etc.

Copy link
Contributor Author

@nagpai nagpai May 2, 2024

Choose a reason for hiding this comment

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

That is a valuable feedback. Note-to-self on deciding where to scope. 🙌 .

Copy link
Contributor Author

@nagpai nagpai May 2, 2024

Choose a reason for hiding this comment

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

done here!

4b53bac

Copy link
Member

@Jinksi Jinksi left a comment

Choose a reason for hiding this comment

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

This tests well @nagpai 🙌

I've tested with the account mentioned in the description and the view report link works as expected.

On iOS, the search input height may not be visually ideal, but it works well.

As you suggest, I agree we should followup on the mobile UI issues with the transaction filters as separate issues.

@nagpai nagpai enabled auto-merge May 2, 2024 08:51
@nagpai nagpai added this pull request to the merge queue May 2, 2024
Merged via the queue into develop with commit b6e8874 May 2, 2024
23 checks passed
@nagpai nagpai deleted the fix/8706-tpv-view-report-link branch May 2, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] - Fix the View report link on the Total payment volume tile
5 participants