-
Notifications
You must be signed in to change notification settings - Fork 68
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
Transactions Download functionality Improvements #10211
base: develop
Are you sure you want to change the base?
Conversation
Test the buildOption 1. Jetpack Beta
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:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: +533 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
- The response is changed to an array - If the file times out, don't show an error. The file may be emailed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a hard time verifying that this change works, which is weird because couple days ago, when I reviewed https://github.com/Automattic/transact-platform-server/pull/7154, I also tested using this PR for the client side and I could see the file got downloaded after polling.
Some caveats:
- Since the code checks if the download URL consists of
exports.wordpress.com
, when testing locally, I had to comment that part out. - I also increase the timeout interval to give me time to keep refreshing my WCPay server so the async job that generates the download file executes.
Check my screen recording, it shows:
- The above code changes locally.
- I clicked the download button.
- I refreshed my WCPay server page and shows that the email had been sent, indicating that the download was successfully.
- It shows the
Your CSV export is ready to download
notice. - It shows under the dev console's Network tab that the CSV file is accessed.
- It shows that my download history is empty. The file was not downloaded.
I have a suspicion that maybe it's because my WCPay server's URL is http and Chrome's security just blocks it. Accessing the URL directly works, ie it downloads the file just fine.
Screen.Recording.2025-01-29.at.19.17.58.mov
Since I have a high confidence that this would work on production, I'm approving.
What is weird is that couple days ago, I could swear that the file got downloaded just fine.
const { page, path, ...params } = getQuery(); | ||
const userEmail = wcpaySettings.currentUserEmail; | ||
const onDownload = async () => { | ||
recordEvent( 'wcpay_transactions_download_csv_click', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, we don't pass download_type
for event wcpay_transactions_download_csv_click
.
I see by definition, download_type
is not nullable. Would not passing it cause a problem? Should we change the definition to mark download_type
as nullable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labelInCsv
shouldn't be required anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The UI shows time in website time zone and export still shows UTC time zone. Can you elaborate why this would not be needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the labelInCSV
prop here should be used for the column header in the client-side generated CSV. This is no longer necessary with the server-side export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have tested locally which didn't allow for download (even though a URL was returned) but emailing worked everytime.
Tested on a demo site and worked as expected. ✅
I thought this change was for all CSV's but only for transactions.
Design feedback:
the notice that pops up to say "Your download is being prepared" is easy to miss. likewise with the snackbar notice to say download is ready
IMHO I think this PR would benefit from a design review before we merge, to ensure we're using these elements correctly and giving users the appropriate UI feedback on their actions. I won't ping directly here, in case I've missed a prior discussion about this on P2 etc. |
Fixes #10255 which is part of the Epic #9969
Changes proposed in this Pull Request
@woocommerce/csv-export
based JS export on the Transactions pagetransactions/download
endpoint for all downloads instead.export_id
transactions/download/<export_id>
endpoint to get the download URL.By removing the browser export and using only server based export, the functionality is simplified and made consistent. We also preserve the functionality for the merchant by making the file available immediately in the browser whenever possible.
Testing instructions
To be tested with server PR https://github.com/Automattic/transact-platform-server/pull/7154
npm run changelog
to add a changelog file, choosepatch
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.Post merge