From a83343eb6b1cd4af4ee429b4750ba81aed0935ae Mon Sep 17 00:00:00 2001 From: Santiago Sanz Date: Fri, 9 Sep 2022 11:52:48 +0200 Subject: [PATCH] feat: minor changes --- docs/README.md | 15 ++++++- messages/en.json | 2 +- node/report/json_return-request-map.ts | 40 ++++++++++--------- .../components/ReportStatus.tsx | 6 ++- 4 files changed, 41 insertions(+), 22 deletions(-) diff --git a/docs/README.md b/docs/README.md index f687f98d0..f0a102898 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,6 +3,13 @@ Return app v3 is still in BETA. v2 will no longer be supported so please do not install it. Docs are WIP. + - Table of contents + - [Features](#features) + - [API](#api) + - [Customization](#customization) + - [Known issues](#known-issues) + - [Development](#development) + ## Description The **Return App** gives merchants the option to allow customers to request a return for their items and it gives them the ability to manage the Return Request Process on their store. @@ -303,11 +310,17 @@ In order to apply CSS customizations in this and other blocks, follow the instru |'termsAndConditionsLink'| |'userCommentDetailsContainer'| -## Knowing issues +## Known issues - When a store has a process to create return invoices ([invoice type input](https://developers.vtex.com/vtex-rest-api/reference/invoicenotification)) outside the return app, the app will consider those items and they will not be able to be returned via the app. However when an item is already committed in a return request and an invoice is created considering that item with a invoice number different than the return request id, there will be more processed items to return then invoices items - It can be seen using the query `orderToReturnSummary` on GraphQL. - When installing the app in a workspace - or creating a new one - the app will not behavior as expected. This is due to the masterdata builder not creating a schema for that workspace automatically. To fix that, one can just link the app in the workspace using the toolbelt. Doing so, there will be a new masterdata schema related to that workspace and the app should work fine. +## Development + +### Export feature (Report) + +This app leverages the Report API to export all return documents into a single file. For this to work, we maintain a matrix transformation MAP inside **/node/report**. If any key or value of the object is changed, next time any account that opens the module will have their map created/updated. The ID is the identifier we use to compare them, there's no need of changing it every time we modify the object. + --- Documentation for v2 [here](https://github.com/vtex-apps/return-app/tree/v2). diff --git a/messages/en.json b/messages/en.json index 1efc4fe19..61b4e54cf 100644 --- a/messages/en.json +++ b/messages/en.json @@ -335,7 +335,7 @@ "admin/return-app.export-module.modal-close": "CLOSE", "admin/return-app.export-module.content.first-paragraph": "The Export module is the system responsible for merging all return requests into a single file called report, this can be then sent to an email or downloaded directly from this module", "admin/return-app.export-module.content.second-paragraph": "Keep in mind that download links are not permanent, they expire after 6 hours following their availability", - "admin/return-app.export-module.content.warning-paragraph": "It is important to remember that depending on the quantity of return requests, the process can take a long time to finish. If you chose to generate a download link, you can leave the module open and it will update when its available for download", + "admin/return-app.export-module.content.warning-paragraph": "As the export process runs in the backround, If you chose to only generate a download link, you can close this page and check back later.", "admin/return-app.export-module.content.format-disclaimer": "Supported formats:", "admin/return-app.export-module.content.skip-disclaimer": "Documents containing errors will be skipped", "admin/return-app.export-module.report.status-title": "Last report", diff --git a/node/report/json_return-request-map.ts b/node/report/json_return-request-map.ts index dff381a7e..0bc6af1d8 100644 --- a/node/report/json_return-request-map.ts +++ b/node/report/json_return-request-map.ts @@ -1,3 +1,7 @@ +/** + * @todo + * Test translationPrefix for the status column by creating new messages + */ export const localMap: ReportMap = { id: '7a42a323-1faa-11ed-835d-16acdede38c5', name: 'Return Requests', @@ -63,105 +67,105 @@ export const localMap: ReportMap = { defaultLanguage: null, }, { - header: 'customer_profile_data_id', + header: 'customer_user_id', query: 'customerProfileData.userId', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'customer_profile_data_name', + header: 'customer_name', query: 'customerProfileData.name', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'customer_profile_data_email', + header: 'customer_email', query: 'customerProfileData.email', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'customer_profile_data_phone', + header: 'customer_phone_number', query: 'customerProfileData.phoneNumber', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'pickup_return_data_id', + header: 'pickup_address_id', query: 'pickupReturnData.addressId', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'pickup_return_data_address', + header: 'pickup_address', query: 'pickupReturnData.address', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'pickup_return_data_city', + header: 'pickup_city', query: 'pickupReturnData.city', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'pickup_return_data_state', + header: 'pickup_state', query: 'pickupReturnData.state', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'pickup_return_data_country', + header: 'pickup_country', query: 'pickupReturnData.country', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'pickup_return_data_zip_code', + header: 'pickup_zip_code', query: 'pickupReturnData.zipCode', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'pickup_return_data_type', + header: 'pickup_address_type', query: 'pickupReturnData.addressType', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'pickup_return_data_return_label', + header: 'pickup_return_label', query: "pickupReturnData.( returnLabel ? returnLabel : 'NA' )", usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'refund_payment_data_payment_method', + header: 'refund_payment_method', query: 'refundPaymentData.refundPaymentMethod', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'refund_payment_data_payment_iban', + header: 'refund_payment_iban', query: "refundPaymentData.( iban ? iban : 'NA' )", usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'refund_payment_data_payment_account_holder_name', + header: 'refund_payment_account_holder_name', query: "refundPaymentData.( accountHolderName ? accountHolderName : 'NA' )", usePath: false, @@ -169,7 +173,7 @@ export const localMap: ReportMap = { defaultLanguage: null, }, { - header: 'refund_payment_data_payment_automatic_refund', + header: 'refund_payment_automatic_refund', query: "refundPaymentData.( automaticallyRefundPaymentMethod ? automaticallyRefundPaymentMethod : 'NA' )", usePath: true, @@ -177,14 +181,14 @@ export const localMap: ReportMap = { defaultLanguage: null, }, { - header: 'culture_info_data_currency_code', + header: 'currency_code', query: 'cultureInfoData.currencyCode', usePath: false, translationPrefix: null, defaultLanguage: null, }, { - header: 'culture_info_data_currency_locale', + header: 'locale', query: 'cultureInfoData.locale', usePath: false, translationPrefix: null, diff --git a/react/admin/ExportReturnRequestsModal/components/ReportStatus.tsx b/react/admin/ExportReturnRequestsModal/components/ReportStatus.tsx index d0d8f5a46..39e219442 100644 --- a/react/admin/ExportReturnRequestsModal/components/ReportStatus.tsx +++ b/react/admin/ExportReturnRequestsModal/components/ReportStatus.tsx @@ -17,6 +17,8 @@ const ReportStatus = () => { staleLink, } = exportStatus ?? {} + const disableDownload = inProgress || !downloadLink || staleLink + return ( <>

@@ -26,8 +28,8 @@ const ReportStatus = () => {

false : downloadLink} + disabled={disableDownload} target="_blank" >