From 0cece63e9d7080412180d86b7baa586ccffc92fe Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Mon, 27 Feb 2023 12:01:50 -0500 Subject: [PATCH 01/81] changes for setup in obidev --- manifest.json | 6 ++--- node/clients/checkout.ts | 2 +- node/clients/index.ts | 2 +- node/middlewares/getRequestList.ts | 2 +- node/package.json | 7 +++-- node/resolvers/ReturnRequestResponse.ts | 2 +- node/resolvers/appSettings.ts | 2 +- node/resolvers/categoryTreeName.ts | 2 +- node/resolvers/createReturnRequest.ts | 2 +- node/resolvers/nearestPickupPoints.ts | 2 +- node/resolvers/orderToReturnSummary.ts | 2 +- node/resolvers/ordersAvailableToReturn.ts | 2 +- node/resolvers/returnRequest.ts | 2 +- node/resolvers/returnRequestList.ts | 2 +- node/resolvers/updateReturnRequestStatus.ts | 2 +- node/services/createReturnRequestService.ts | 2 +- node/services/returnRequestListService.ts | 2 +- node/services/returnRequestService.ts | 2 +- node/services/updateRequestStatusService.ts | 2 +- node/typings/mailClient.d.ts | 2 +- node/utils/appSettingsValidation.ts | 2 +- node/utils/canReturnAllItems.ts | 2 +- node/utils/constants.ts | 2 +- node/utils/createItemsToReturn.ts | 2 +- node/utils/createOrUpdateStatusPayload.ts | 2 +- node/utils/createOrdersToReturnSummary.ts | 2 +- node/utils/createRefundData.ts | 2 +- node/utils/createRefundableTotals.ts | 2 +- node/utils/handleRefund.ts | 2 +- node/utils/transformOrderClientProfileData.ts | 2 +- node/utils/transformShippingData.ts | 2 +- node/utils/translateItems.ts | 2 +- node/utils/validateCanUseDropoffPoints.ts | 2 +- node/utils/validateItemCondition.ts | 2 +- node/utils/validatePaymentMethod.ts | 2 +- node/utils/validateReturnReason.ts | 2 +- node/utils/validateStatusUpdate.ts | 2 +- node/yarn.lock | 26 ++++++++----------- package.json | 2 +- pages/pages.json | 4 +-- .../components/UpdateRequestStatus.tsx | 2 +- .../VerifyItems/VerifyItemsPage.tsx | 2 +- .../VerifyItems/VerifyItemsTable.tsx | 2 +- .../VerifyItems/verifyItemsModalSchema.tsx | 2 +- .../VerifyItems/verifyItemsTableSchema.tsx | 2 +- .../VerifyItems/verifyTotalsTableSchema.tsx | 2 +- .../graphql/updateReturnRequestStatus.gql | 2 +- .../provider/UpdateRequestStatusProvider.tsx | 2 +- react/admin/settings/RMASettings.tsx | 2 +- .../CustomReasons/CustomReasonModal.tsx | 2 +- .../CustomReasons/CustomReasons.tsx | 2 +- .../CustomReasons/TranslationsModal.tsx | 2 +- .../components/ExcludedCategories.tsx | 2 +- .../settings/components/PaymentOptions.tsx | 2 +- .../admin/settings/graphql/getAppSettings.gql | 2 +- .../settings/graphql/getCategoryTreeName.gql | 2 +- .../settings/graphql/saveAppSettings.gql | 2 +- .../settings/provider/SettingsProvider.tsx | 2 +- .../settings/provider/settingsReducer.ts | 2 +- react/common/components/RenderStatus.tsx | 2 +- .../ItemDetails/ItemDetailsList.tsx | 2 +- .../ItemDetails/itemDetailsSchema.tsx | 2 +- .../ReturnDetails/RefundMethodDetail.tsx | 2 +- .../StatusTimeline/CommentList.tsx | 2 +- .../StatusTimeline/StatusTag.tsx | 2 +- .../components/returnList/ListTableFilter.tsx | 2 +- .../returnList/StatusActionMenu.tsx | 2 +- react/common/graphql/getRequestDetails.gql | 2 +- .../common/provider/ReturnDetailsProvider.tsx | 2 +- react/graphql/getReturnRequestList.gql | 2 +- react/hooks/useReturnRequestList.ts | 2 +- react/package.json | 7 +++-- .../CreateReturnRequest.tsx | 2 +- .../OrderListContainer.tsx | 2 +- .../components/AddressDetails.tsx | 2 +- .../components/ConfirmAndSubmit.tsx | 2 +- .../components/ConfirmContactDetails.tsx | 2 +- .../components/ConfirmPaymentMethods.tsx | 2 +- .../ConfirmPickupAddressDetails.tsx | 2 +- .../components/ItemsDetails.tsx | 2 +- .../components/OrderList.tsx | 2 +- .../components/PaymentMethods.tsx | 2 +- .../components/PickupPointSelector.tsx | 2 +- .../components/RenderConditionDropdown.tsx | 2 +- .../components/ReturnDetails.tsx | 2 +- .../components/ReturnInformationTable.tsx | 2 +- .../graphql/createReturnRequest.gql | 2 +- .../graphql/getGeoCoordinates.gql | 2 +- .../graphql/getOrderToReturnSummary.gql | 2 +- .../graphql/getOrdersAvailableToReturn.gql | 2 +- .../graphql/nearestPickupPoints.gql | 2 +- react/store/graphql/getStoreSettings.gql | 2 +- react/store/provider/OrderToReturnReducer.ts | 2 +- .../store/provider/StoreSettingsProvider.tsx | 2 +- react/store/utils/constants.ts | 2 +- react/store/utils/createItemsSummary.ts | 2 +- react/store/utils/formatItemsToReturn.ts | 2 +- .../utils/generateCustomReasonOptions.ts | 2 +- react/store/utils/parseReturnRequestError.ts | 2 +- react/store/utils/setInitialPickupAddress.ts | 2 +- .../utils/validateNewReturnRequestFields.ts | 2 +- react/tsconfig.json | 17 +++++++++--- react/utils/requestStatus.ts | 2 +- react/yarn.lock | 24 +++++++---------- 104 files changed, 142 insertions(+), 143 deletions(-) diff --git a/manifest.json b/manifest.json index 4617a349a..f18a6d65e 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { - "vendor": "vtex", - "name": "return-app", - "version": "3.5.6", + "vendor": "obidev", + "name": "obi-return-app", + "version": "0.0.1", "title": "Return app", "description": "Return app", "dependencies": { diff --git a/node/clients/checkout.ts b/node/clients/checkout.ts index 53dd2670e..d220fdfab 100644 --- a/node/clients/checkout.ts +++ b/node/clients/checkout.ts @@ -1,6 +1,6 @@ import type { InstanceOptions, IOContext } from '@vtex/api' import { JanusClient } from '@vtex/api' -import type { NearPickupPointQueryResponse } from 'vtex.return-app' +import type { NearPickupPointQueryResponse } from 'obidev.obi-return-app' export default class Checkout extends JanusClient { constructor(ctx: IOContext, options?: InstanceOptions) { diff --git a/node/clients/index.ts b/node/clients/index.ts index 2a1a2d876..8976fc7ba 100644 --- a/node/clients/index.ts +++ b/node/clients/index.ts @@ -1,6 +1,6 @@ import { IOClients, Sphinx } from '@vtex/api' import { vbaseFor, masterDataFor } from '@vtex/clients' -import { ReturnAppSettings, ReturnRequest } from 'vtex.return-app' +import { ReturnAppSettings, ReturnRequest } from 'obidev.obi-return-app' import { Catalog } from './catalog' import { OMSCustom as OMS } from './oms' diff --git a/node/middlewares/getRequestList.ts b/node/middlewares/getRequestList.ts index 86342c8c1..b1aa23c37 100644 --- a/node/middlewares/getRequestList.ts +++ b/node/middlewares/getRequestList.ts @@ -1,4 +1,4 @@ -import type { Status } from 'vtex.return-app' +import type { Status } from 'obidev.obi-return-app' import { returnRequestListService } from '../services/returnRequestListService' diff --git a/node/package.json b/node/package.json index c39e70938..61a1ce631 100644 --- a/node/package.json +++ b/node/package.json @@ -14,18 +14,17 @@ "@vtex/api": "6.45.15", "@vtex/test-tools": "^1.0.0", "@vtex/tsconfig": "^0.6.0", + "obidev.obi-return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app", "tslint": "^6.1.3", "tslint-config-vtex": "^2.1.0", - "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.101.1/public/@types/vtex.catalog-graphql", + "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", "vtex.easypost": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost", "vtex.format-currency": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency", "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.0/public/@types/vtex.return-app", - "vtex.store-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.155.32/public/@types/vtex.store-graphql", - "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide", + "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, "scripts": { diff --git a/node/resolvers/ReturnRequestResponse.ts b/node/resolvers/ReturnRequestResponse.ts index c3a3de160..2d15d3ee1 100644 --- a/node/resolvers/ReturnRequestResponse.ts +++ b/node/resolvers/ReturnRequestResponse.ts @@ -1,4 +1,4 @@ -import type { ReturnRequest } from 'vtex.return-app' +import type { ReturnRequest } from 'obidev.obi-return-app' type VtexProduct = 'admin' | 'store' | undefined diff --git a/node/resolvers/appSettings.ts b/node/resolvers/appSettings.ts index 2f93cc131..b8dfce1e9 100644 --- a/node/resolvers/appSettings.ts +++ b/node/resolvers/appSettings.ts @@ -1,7 +1,7 @@ import type { ReturnAppSettings, MutationSaveReturnAppSettingsArgs, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { validateMaxDaysCustomReasons, diff --git a/node/resolvers/categoryTreeName.ts b/node/resolvers/categoryTreeName.ts index 5c41ee5f8..e5dee55a6 100644 --- a/node/resolvers/categoryTreeName.ts +++ b/node/resolvers/categoryTreeName.ts @@ -1,4 +1,4 @@ -import type { CategoryInfo } from 'vtex.return-app' +import type { CategoryInfo } from 'obidev.obi-return-app' const transformCategoryTree = ( categoryTree: CategoryTree[], diff --git a/node/resolvers/createReturnRequest.ts b/node/resolvers/createReturnRequest.ts index a175df82a..00a097873 100644 --- a/node/resolvers/createReturnRequest.ts +++ b/node/resolvers/createReturnRequest.ts @@ -1,4 +1,4 @@ -import type { MutationCreateReturnRequestArgs } from 'vtex.return-app' +import type { MutationCreateReturnRequestArgs } from 'obidev.obi-return-app' import { createReturnRequestService } from '../services/createReturnRequestService' diff --git a/node/resolvers/nearestPickupPoints.ts b/node/resolvers/nearestPickupPoints.ts index 9fc715569..fca66d474 100644 --- a/node/resolvers/nearestPickupPoints.ts +++ b/node/resolvers/nearestPickupPoints.ts @@ -1,7 +1,7 @@ import type { QueryNearestPickupPointsArgs, NearPickupPointQueryResponse, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' export const nearestPickupPoints = async ( _: unknown, diff --git a/node/resolvers/orderToReturnSummary.ts b/node/resolvers/orderToReturnSummary.ts index e0d92170d..297cccaf5 100644 --- a/node/resolvers/orderToReturnSummary.ts +++ b/node/resolvers/orderToReturnSummary.ts @@ -1,5 +1,5 @@ import { ResolverError, UserInputError } from '@vtex/api' -import type { OrderToReturnSummary } from 'vtex.return-app' +import type { OrderToReturnSummary } from 'obidev.obi-return-app' import { SETTINGS_PATH } from '../utils/constants' import { createOrdersToReturnSummary } from '../utils/createOrdersToReturnSummary' diff --git a/node/resolvers/ordersAvailableToReturn.ts b/node/resolvers/ordersAvailableToReturn.ts index 1d0b0729a..f13145ba4 100644 --- a/node/resolvers/ordersAvailableToReturn.ts +++ b/node/resolvers/ordersAvailableToReturn.ts @@ -1,5 +1,5 @@ import { ResolverError } from '@vtex/api' -import type { OrdersToReturnList, OrderToReturnSummary } from 'vtex.return-app' +import type { OrdersToReturnList, OrderToReturnSummary } from 'obidev.obi-return-app' import { SETTINGS_PATH } from '../utils/constants' import { createOrdersToReturnSummary } from '../utils/createOrdersToReturnSummary' diff --git a/node/resolvers/returnRequest.ts b/node/resolvers/returnRequest.ts index 1f6f21426..ce1f900fd 100644 --- a/node/resolvers/returnRequest.ts +++ b/node/resolvers/returnRequest.ts @@ -1,4 +1,4 @@ -import type { QueryReturnRequestArgs } from 'vtex.return-app' +import type { QueryReturnRequestArgs } from 'obidev.obi-return-app' import { returnRequestService } from '../services/returnRequestService' diff --git a/node/resolvers/returnRequestList.ts b/node/resolvers/returnRequestList.ts index 51ba25467..06a0752a9 100644 --- a/node/resolvers/returnRequestList.ts +++ b/node/resolvers/returnRequestList.ts @@ -1,4 +1,4 @@ -import type { QueryReturnRequestListArgs } from 'vtex.return-app' +import type { QueryReturnRequestListArgs } from 'obidev.obi-return-app' import { returnRequestListService } from '../services/returnRequestListService' diff --git a/node/resolvers/updateReturnRequestStatus.ts b/node/resolvers/updateReturnRequestStatus.ts index 60aba4c91..4338d3208 100644 --- a/node/resolvers/updateReturnRequestStatus.ts +++ b/node/resolvers/updateReturnRequestStatus.ts @@ -1,7 +1,7 @@ import type { MutationUpdateReturnRequestStatusArgs, ReturnRequest, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { updateRequestStatusService } from '../services/updateRequestStatusService' diff --git a/node/services/createReturnRequestService.ts b/node/services/createReturnRequestService.ts index 55c30b8ab..0153bb0e9 100644 --- a/node/services/createReturnRequestService.ts +++ b/node/services/createReturnRequestService.ts @@ -1,4 +1,4 @@ -import type { ReturnRequestCreated, ReturnRequestInput } from 'vtex.return-app' +import type { ReturnRequestCreated, ReturnRequestInput } from 'obidev.obi-return-app' import { UserInputError, ResolverError } from '@vtex/api' import type { DocumentResponse } from '@vtex/clients' diff --git a/node/services/returnRequestListService.ts b/node/services/returnRequestListService.ts index 955f8d612..1bb6c33ac 100644 --- a/node/services/returnRequestListService.ts +++ b/node/services/returnRequestListService.ts @@ -2,7 +2,7 @@ import type { QueryReturnRequestListArgs, ReturnRequestFilters, Maybe, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { ForbiddenError } from '@vtex/api' const filterDate = (date: string): string => { diff --git a/node/services/returnRequestService.ts b/node/services/returnRequestService.ts index d4a25a722..f9a0d7b33 100644 --- a/node/services/returnRequestService.ts +++ b/node/services/returnRequestService.ts @@ -1,5 +1,5 @@ import { ResolverError, ForbiddenError } from '@vtex/api' -import type { ReturnRequest } from 'vtex.return-app' +import type { ReturnRequest } from 'obidev.obi-return-app' export const returnRequestService = async (ctx: Context, requestId: string) => { const { diff --git a/node/services/updateRequestStatusService.ts b/node/services/updateRequestStatusService.ts index f1d21ead3..8893566d3 100644 --- a/node/services/updateRequestStatusService.ts +++ b/node/services/updateRequestStatusService.ts @@ -3,7 +3,7 @@ import type { ReturnRequest, Status, RefundItemInput, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { ResolverError, ForbiddenError, diff --git a/node/typings/mailClient.d.ts b/node/typings/mailClient.d.ts index ddf9d8987..eeb9daf7f 100644 --- a/node/typings/mailClient.d.ts +++ b/node/typings/mailClient.d.ts @@ -1,4 +1,4 @@ -import type { ReturnRequestItem, Status } from 'vtex.return-app' +import type { ReturnRequestItem, Status } from 'obidev.obi-return-app' export type ReturnRequestConfirmation = string diff --git a/node/utils/appSettingsValidation.ts b/node/utils/appSettingsValidation.ts index f096a74c3..d08e03e94 100644 --- a/node/utils/appSettingsValidation.ts +++ b/node/utils/appSettingsValidation.ts @@ -3,7 +3,7 @@ import type { PaymentTypeInput, CustomReturnReasonInput, PaymentOptions, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' export const validatePaymentOptions = ( paymentOptions: PaymentOptionsInput diff --git a/node/utils/canReturnAllItems.ts b/node/utils/canReturnAllItems.ts index b305ec8da..d47d67748 100644 --- a/node/utils/canReturnAllItems.ts +++ b/node/utils/canReturnAllItems.ts @@ -3,7 +3,7 @@ import type { ReturnRequestItemInput, ReturnAppSettings, ReturnRequest, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { ResolverError } from '@vtex/api' import { createOrdersToReturnSummary } from './createOrdersToReturnSummary' diff --git a/node/utils/constants.ts b/node/utils/constants.ts index 6ddfc5ddd..70eb628bb 100644 --- a/node/utils/constants.ts +++ b/node/utils/constants.ts @@ -1,4 +1,4 @@ -import type { OrderToReturnValidation } from 'vtex.return-app' +import type { OrderToReturnValidation } from 'obidev.obi-return-app' import type { ReturnRequestConfirmation, diff --git a/node/utils/createItemsToReturn.ts b/node/utils/createItemsToReturn.ts index ad78fe015..c7f052a38 100644 --- a/node/utils/createItemsToReturn.ts +++ b/node/utils/createItemsToReturn.ts @@ -4,7 +4,7 @@ import type { PriceTag, SellerDetail, } from '@vtex/clients' -import type { ReturnRequestItemInput, ReturnRequestItem } from 'vtex.return-app' +import type { ReturnRequestItemInput, ReturnRequestItem } from 'obidev.obi-return-app' import type { CatalogGQL } from '../clients/catalogGQL' import { translateItemName } from './translateItems' diff --git a/node/utils/createOrUpdateStatusPayload.ts b/node/utils/createOrUpdateStatusPayload.ts index 6e87fe5c0..e4472cd9d 100644 --- a/node/utils/createOrUpdateStatusPayload.ts +++ b/node/utils/createOrUpdateStatusPayload.ts @@ -4,7 +4,7 @@ import type { ReturnRequest, ReturnRequestCommentInput, Status, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' export const createOrUpdateStatusPayload = ({ refundStatusData, diff --git a/node/utils/createOrdersToReturnSummary.ts b/node/utils/createOrdersToReturnSummary.ts index ba6105845..97ff09a66 100644 --- a/node/utils/createOrdersToReturnSummary.ts +++ b/node/utils/createOrdersToReturnSummary.ts @@ -6,7 +6,7 @@ import type { ProcessedItem, ReturnAppSettings, ReturnRequest, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { getInvoicedItems } from './getInvoicedItems' import { mapItemIndexAndQuantity } from './mapItemIndexAndQuantity' diff --git a/node/utils/createRefundData.ts b/node/utils/createRefundData.ts index f364558ea..d37b873ff 100644 --- a/node/utils/createRefundData.ts +++ b/node/utils/createRefundData.ts @@ -1,4 +1,4 @@ -import type { Maybe, RefundDataInput, ReturnRequest } from 'vtex.return-app' +import type { Maybe, RefundDataInput, ReturnRequest } from 'obidev.obi-return-app' import { UserInputError } from '@vtex/api' export const createRefundData = ({ diff --git a/node/utils/createRefundableTotals.ts b/node/utils/createRefundableTotals.ts index 9e1b0070c..7ec3526f8 100644 --- a/node/utils/createRefundableTotals.ts +++ b/node/utils/createRefundableTotals.ts @@ -1,4 +1,4 @@ -import type { RefundableAmountTotal, ReturnRequest } from 'vtex.return-app' +import type { RefundableAmountTotal, ReturnRequest } from 'obidev.obi-return-app' import type { ItemTotal } from '@vtex/clients' export const createRefundableTotals = ( diff --git a/node/utils/handleRefund.ts b/node/utils/handleRefund.ts index 949a5d382..c72fd5546 100644 --- a/node/utils/handleRefund.ts +++ b/node/utils/handleRefund.ts @@ -1,4 +1,4 @@ -import type { Status, Maybe, ReturnRequest, GiftCard } from 'vtex.return-app' +import type { Status, Maybe, ReturnRequest, GiftCard } from 'obidev.obi-return-app' import { ResolverError } from '@vtex/api' import type { OMSCustom } from '../clients/oms' diff --git a/node/utils/transformOrderClientProfileData.ts b/node/utils/transformOrderClientProfileData.ts index 8d860b9d7..33f69961e 100644 --- a/node/utils/transformOrderClientProfileData.ts +++ b/node/utils/transformOrderClientProfileData.ts @@ -1,5 +1,5 @@ import type { ClientProfileDetail } from '@vtex/clients' -import type { ClientProfileData } from 'vtex.return-app' +import type { ClientProfileData } from 'obidev.obi-return-app' export const transformOrderClientProfileData = ( clientProfileData: ClientProfileDetail, diff --git a/node/utils/transformShippingData.ts b/node/utils/transformShippingData.ts index 38779deb4..53c8ad101 100644 --- a/node/utils/transformShippingData.ts +++ b/node/utils/transformShippingData.ts @@ -1,5 +1,5 @@ import type { ShippingDetail } from '@vtex/clients' -import type { ShippingData } from 'vtex.return-app' +import type { ShippingData } from 'obidev.obi-return-app' export const transformShippingData = ( shippingData: ShippingDetail diff --git a/node/utils/translateItems.ts b/node/utils/translateItems.ts index fd3a156e5..8da785fa1 100644 --- a/node/utils/translateItems.ts +++ b/node/utils/translateItems.ts @@ -1,4 +1,4 @@ -import type { InvoicedItem } from 'vtex.return-app' +import type { InvoicedItem } from 'obidev.obi-return-app' import type { CatalogGQL } from '../clients/catalogGQL' diff --git a/node/utils/validateCanUseDropoffPoints.ts b/node/utils/validateCanUseDropoffPoints.ts index 9c925ea7f..5935bd009 100644 --- a/node/utils/validateCanUseDropoffPoints.ts +++ b/node/utils/validateCanUseDropoffPoints.ts @@ -1,4 +1,4 @@ -import type { PickupReturnDataInput } from 'vtex.return-app' +import type { PickupReturnDataInput } from 'obidev.obi-return-app' import { ResolverError, UserInputError } from '@vtex/api' export const validateCanUsedropoffPoints = ( diff --git a/node/utils/validateItemCondition.ts b/node/utils/validateItemCondition.ts index a85ea2bca..0ff66d0e2 100644 --- a/node/utils/validateItemCondition.ts +++ b/node/utils/validateItemCondition.ts @@ -1,4 +1,4 @@ -import type { ReturnRequestItemInput } from 'vtex.return-app' +import type { ReturnRequestItemInput } from 'obidev.obi-return-app' import { UserInputError } from '@vtex/api' export const validateItemCondition = ( diff --git a/node/utils/validatePaymentMethod.ts b/node/utils/validatePaymentMethod.ts index 3d27c54f0..d3735f0e1 100644 --- a/node/utils/validatePaymentMethod.ts +++ b/node/utils/validatePaymentMethod.ts @@ -1,4 +1,4 @@ -import type { RefundPaymentDataInput, PaymentOptions } from 'vtex.return-app' +import type { RefundPaymentDataInput, PaymentOptions } from 'obidev.obi-return-app' import { ResolverError } from '@vtex/api' import { isValidIBANNumber } from './isValidIBANNumber' diff --git a/node/utils/validateReturnReason.ts b/node/utils/validateReturnReason.ts index 5ffc21360..403b0fb69 100644 --- a/node/utils/validateReturnReason.ts +++ b/node/utils/validateReturnReason.ts @@ -1,7 +1,7 @@ import type { ReturnRequestItemInput, CustomReturnReason, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { ResolverError, UserInputError } from '@vtex/api' import { isWithinMaxDaysToReturn } from './dateHelpers' diff --git a/node/utils/validateStatusUpdate.ts b/node/utils/validateStatusUpdate.ts index a7548344e..210ce9444 100644 --- a/node/utils/validateStatusUpdate.ts +++ b/node/utils/validateStatusUpdate.ts @@ -1,5 +1,5 @@ import { ResolverError, UserInputError } from '@vtex/api' -import type { Status } from 'vtex.return-app' +import type { Status } from 'obidev.obi-return-app' const statusAllowed: Record = { new: ['new', 'processing', 'denied', 'cancelled'], diff --git a/node/yarn.lock b/node/yarn.lock index cd5405e8f..f376b68ce 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -4685,6 +4685,10 @@ oauth-sign@~0.9.0: resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== +"obidev.obi-return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app": + version "0.0.1" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app#0dfffb76a73d3c034412acc546740a002e9fb827" + object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -5610,7 +5614,7 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" -"stats-lite@github:vtex/node-stats-lite#dist": +stats-lite@vtex/node-stats-lite#dist: version "2.2.0" resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797" dependencies: @@ -6127,9 +6131,9 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.101.1/public/@types/vtex.catalog-graphql": - version "1.101.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.101.1/public/@types/vtex.catalog-graphql#8f4d8981c04429e94b30188acb9c6f1a6b912197" +"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql": + version "1.102.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql#ad1dfac8d076034d4326a00a3da20a3915951f53" "vtex.css-handles@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles": version "0.4.4" @@ -6155,17 +6159,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.0/public/@types/vtex.return-app": - version "3.5.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.0/public/@types/vtex.return-app#29e8ca8294b52af366586fcea7ae995870bc0271" - -"vtex.store-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.155.32/public/@types/vtex.store-graphql": - version "2.155.32" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.155.32/public/@types/vtex.store-graphql#abafbe1d80f453bbebc70024a829e4226bf6cc20" - -"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide": - version "9.146.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide#66db40ca1b78ad77ce4beedabecee320e1ef2ead" +"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": + version "9.146.3" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" "vtex.tenant-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql": version "0.1.2" diff --git a/package.json b/package.json index b15d7d29e..1e2501585 100644 --- a/package.json +++ b/package.json @@ -36,4 +36,4 @@ "@typescript-eslint/parser": "^4.14.1", "axios": "^0.20.0" } -} +} \ No newline at end of file diff --git a/pages/pages.json b/pages/pages.json index 964ecedb1..760f0c697 100644 --- a/pages/pages.json +++ b/pages/pages.json @@ -1,9 +1,9 @@ { "extensions": { - "my-account-portal/routes/vtex.return-app": { + "my-account-portal/routes/obidev.obi-return-app": { "component": "ExtensionRouter" }, - "my-account-portal/menu-links-after/vtex.return-app": { + "my-account-portal/menu-links-after/obidev.obi-return-app": { "component": "ExtensionLinks" } } diff --git a/react/admin/ReturnDetails/components/UpdateRequestStatus.tsx b/react/admin/ReturnDetails/components/UpdateRequestStatus.tsx index b45e652d7..d1353eeae 100644 --- a/react/admin/ReturnDetails/components/UpdateRequestStatus.tsx +++ b/react/admin/ReturnDetails/components/UpdateRequestStatus.tsx @@ -10,7 +10,7 @@ import { Tooltip, IconInfo, } from 'vtex.styleguide' -import type { Status } from 'vtex.return-app' +import type { Status } from 'obidev.obi-return-app' import { useReturnDetails } from '../../../common/hooks/useReturnDetails' import { diff --git a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx index a51480bb7..4a8914bfb 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx @@ -7,7 +7,7 @@ import { IconInfo, } from 'vtex.styleguide' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { RefundItemInput } from 'vtex.return-app' +import type { RefundItemInput } from 'obidev.obi-return-app' import { useReturnDetails } from '../../../../common/hooks/useReturnDetails' import { VerifyItemsTable } from './VerifyItemsTable' diff --git a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsTable.tsx b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsTable.tsx index 6471c80cc..f8774a683 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsTable.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsTable.tsx @@ -1,7 +1,7 @@ import React from 'react' import { FormattedMessage } from 'react-intl' import { Table } from 'vtex.styleguide' -import type { ReturnRequestItem } from 'vtex.return-app' +import type { ReturnRequestItem } from 'obidev.obi-return-app' import { verifyItemsTableSchema } from './verifyItemsTableSchema' import type { RefundItemMap, UpdateItemsChange } from './VerifyItemsPage' diff --git a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsModalSchema.tsx b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsModalSchema.tsx index 07109c857..cdf405530 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsModalSchema.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsModalSchema.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { ReturnRequestItem, CultureInfoData } from 'vtex.return-app' +import type { ReturnRequestItem, CultureInfoData } from 'obidev.obi-return-app' import type { RefundItemMap } from './VerifyItemsPage' import { AlignItemRight } from '../AlignItemRight' diff --git a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx index 5131d4bc5..973a71b39 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx @@ -1,7 +1,7 @@ import type { ChangeEvent } from 'react' import React from 'react' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { ReturnRequestItem, CultureInfoData } from 'vtex.return-app' +import type { ReturnRequestItem, CultureInfoData } from 'obidev.obi-return-app' import { NumericStepper, InputCurrency } from 'vtex.styleguide' import type { RefundItemMap, UpdateItemsChange } from './VerifyItemsPage' diff --git a/react/admin/ReturnDetails/components/VerifyItems/verifyTotalsTableSchema.tsx b/react/admin/ReturnDetails/components/VerifyItems/verifyTotalsTableSchema.tsx index 37d516b07..3e0a7c649 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/verifyTotalsTableSchema.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/verifyTotalsTableSchema.tsx @@ -2,7 +2,7 @@ import type { ChangeEvent } from 'react' import React from 'react' import { FormattedMessage, FormattedNumber } from 'react-intl' import { InputCurrency } from 'vtex.styleguide' -import type { CultureInfoData } from 'vtex.return-app' +import type { CultureInfoData } from 'obidev.obi-return-app' import { AlignItemRight } from '../AlignItemRight' diff --git a/react/admin/graphql/updateReturnRequestStatus.gql b/react/admin/graphql/updateReturnRequestStatus.gql index c571444fa..5c8b01319 100644 --- a/react/admin/graphql/updateReturnRequestStatus.gql +++ b/react/admin/graphql/updateReturnRequestStatus.gql @@ -11,7 +11,7 @@ mutation updateReturnRequestStatus( status: $status comment: $comment refundData: $refundData - ) @context(provider: "vtex.return-app") { + ) @context(provider: "obidev.obi-return-app") { ...ReturnDetailsAdminFragment } } diff --git a/react/admin/provider/UpdateRequestStatusProvider.tsx b/react/admin/provider/UpdateRequestStatusProvider.tsx index 262676725..00e2aa47e 100644 --- a/react/admin/provider/UpdateRequestStatusProvider.tsx +++ b/react/admin/provider/UpdateRequestStatusProvider.tsx @@ -6,7 +6,7 @@ import type { RefundDataInput, ReturnRequestResponse, MutationUpdateReturnRequestStatusArgs, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { useMutation } from 'react-apollo' import { FormattedMessage } from 'react-intl' diff --git a/react/admin/settings/RMASettings.tsx b/react/admin/settings/RMASettings.tsx index 317e257e7..d7828515c 100644 --- a/react/admin/settings/RMASettings.tsx +++ b/react/admin/settings/RMASettings.tsx @@ -3,7 +3,7 @@ import type { FormEvent, ReactElement } from 'react' import type { PaymentOptions as PaymentOptionsInterface, PaymentType, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { FormattedMessage } from 'react-intl' import { Layout, diff --git a/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx b/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx index ef75db2d4..491dee597 100644 --- a/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx +++ b/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx @@ -1,7 +1,7 @@ import type { ChangeEvent, FormEvent } from 'react' import React, { useState, useEffect } from 'react' import { FormattedMessage, useIntl } from 'react-intl' -import type { CustomReturnReason } from 'vtex.return-app' +import type { CustomReturnReason } from 'obidev.obi-return-app' import { Modal, Input, Button } from 'vtex.styleguide' import { useSettings } from '../../hooks/useSettings' diff --git a/react/admin/settings/components/CustomReasons/CustomReasons.tsx b/react/admin/settings/components/CustomReasons/CustomReasons.tsx index 5534925a8..8c348c2fb 100644 --- a/react/admin/settings/components/CustomReasons/CustomReasons.tsx +++ b/react/admin/settings/components/CustomReasons/CustomReasons.tsx @@ -1,7 +1,7 @@ import type { ReactElement } from 'react' import React, { useState } from 'react' import { FormattedMessage } from 'react-intl' -import type { CustomReturnReason } from 'vtex.return-app' +import type { CustomReturnReason } from 'obidev.obi-return-app' import { ButtonWithIcon, IconPlusLines, diff --git a/react/admin/settings/components/CustomReasons/TranslationsModal.tsx b/react/admin/settings/components/CustomReasons/TranslationsModal.tsx index ec827d5d0..e51dfd7e0 100644 --- a/react/admin/settings/components/CustomReasons/TranslationsModal.tsx +++ b/react/admin/settings/components/CustomReasons/TranslationsModal.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react' import { useQuery } from 'react-apollo' import type { Tenant, Binding } from 'vtex.tenant-graphql' import { ModalDialog, Table, Input, Spinner, EmptyState } from 'vtex.styleguide' -import type { CustomReturnReasonTranslation } from 'vtex.return-app' +import type { CustomReturnReasonTranslation } from 'obidev.obi-return-app' import { FormattedMessage } from 'react-intl' import TENANT_INFO from './graphql/tenant.gql' diff --git a/react/admin/settings/components/ExcludedCategories.tsx b/react/admin/settings/components/ExcludedCategories.tsx index 4cf5255dc..e56e053c4 100644 --- a/react/admin/settings/components/ExcludedCategories.tsx +++ b/react/admin/settings/components/ExcludedCategories.tsx @@ -2,7 +2,7 @@ import React, { useMemo } from 'react' import { useQuery } from 'react-apollo' import { useIntl, FormattedMessage } from 'react-intl' import { AutocompleteInput, IconWarning, IconDeny } from 'vtex.styleguide' -import type { CategoryInfo } from 'vtex.return-app' +import type { CategoryInfo } from 'obidev.obi-return-app' import GET_CATEGORY_TREE_INFO from '../graphql/getCategoryTreeName.gql' import { useSettings } from '../hooks/useSettings' diff --git a/react/admin/settings/components/PaymentOptions.tsx b/react/admin/settings/components/PaymentOptions.tsx index 5ac1e96a3..dc40370ed 100644 --- a/react/admin/settings/components/PaymentOptions.tsx +++ b/react/admin/settings/components/PaymentOptions.tsx @@ -2,7 +2,7 @@ import type { ChangeEvent, ComponentPropsWithoutRef } from 'react' import React, { forwardRef } from 'react' import type { IntlShape } from 'react-intl' import { defineMessages, FormattedMessage, useIntl } from 'react-intl' -import type { PaymentType } from 'vtex.return-app' +import type { PaymentType } from 'obidev.obi-return-app' import { Toggle, CheckboxGroup } from 'vtex.styleguide' import { useSettings } from '../hooks/useSettings' diff --git a/react/admin/settings/graphql/getAppSettings.gql b/react/admin/settings/graphql/getAppSettings.gql index f7bf76975..a66c2927e 100644 --- a/react/admin/settings/graphql/getAppSettings.gql +++ b/react/admin/settings/graphql/getAppSettings.gql @@ -1,5 +1,5 @@ query returnAppSettings { - returnAppSettings @context(provider: "vtex.return-app") { + returnAppSettings @context(provider: "obidev.obi-return-app") { maxDays excludedCategories paymentOptions { diff --git a/react/admin/settings/graphql/getCategoryTreeName.gql b/react/admin/settings/graphql/getCategoryTreeName.gql index 45eeca2f1..fa991d3f9 100644 --- a/react/admin/settings/graphql/getCategoryTreeName.gql +++ b/react/admin/settings/graphql/getCategoryTreeName.gql @@ -1,5 +1,5 @@ query categoryTreeName { - categoryTreeName @context(provider: "vtex.return-app") { + categoryTreeName @context(provider: "obidev.obi-return-app") { id name } diff --git a/react/admin/settings/graphql/saveAppSettings.gql b/react/admin/settings/graphql/saveAppSettings.gql index b8798e841..218d3b32d 100644 --- a/react/admin/settings/graphql/saveAppSettings.gql +++ b/react/admin/settings/graphql/saveAppSettings.gql @@ -1,4 +1,4 @@ mutation saveAppSettings($settings: ReturnAppSettingsInput!) { saveReturnAppSettings(settings: $settings) - @context(provider: "vtex.return-app") + @context(provider: "obidev.obi-return-app") } diff --git a/react/admin/settings/provider/SettingsProvider.tsx b/react/admin/settings/provider/SettingsProvider.tsx index a4532f830..22b78817c 100644 --- a/react/admin/settings/provider/SettingsProvider.tsx +++ b/react/admin/settings/provider/SettingsProvider.tsx @@ -3,7 +3,7 @@ import type { FC, Dispatch } from 'react' import React, { createContext, useReducer, useEffect } from 'react' import { useQuery, useMutation } from 'react-apollo' import { FormattedMessage } from 'react-intl' -import type { ReturnAppSettings, ReturnAppSettingsInput } from 'vtex.return-app' +import type { ReturnAppSettings, ReturnAppSettingsInput } from 'obidev.obi-return-app' import APP_SETTINGS from '../graphql/getAppSettings.gql' import SAVE_APP_SETTINGS from '../graphql/saveAppSettings.gql' diff --git a/react/admin/settings/provider/settingsReducer.ts b/react/admin/settings/provider/settingsReducer.ts index 68e0063db..55cd321cf 100644 --- a/react/admin/settings/provider/settingsReducer.ts +++ b/react/admin/settings/provider/settingsReducer.ts @@ -3,7 +3,7 @@ import type { PaymentOptions, ReturnAppSettings, ReturnOption, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' export const initialSettingsState: ReturnAppSettings = { maxDays: 0, diff --git a/react/common/components/RenderStatus.tsx b/react/common/components/RenderStatus.tsx index 80d3101de..12f9df2b5 100644 --- a/react/common/components/RenderStatus.tsx +++ b/react/common/components/RenderStatus.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { Status } from 'vtex.return-app' +import type { Status } from 'obidev.obi-return-app' import { FormattedMessage } from 'react-intl' import { IconClock, diff --git a/react/common/components/ReturnDetails/ItemDetails/ItemDetailsList.tsx b/react/common/components/ReturnDetails/ItemDetails/ItemDetailsList.tsx index ec26e5a35..67ab83df7 100644 --- a/react/common/components/ReturnDetails/ItemDetails/ItemDetailsList.tsx +++ b/react/common/components/ReturnDetails/ItemDetails/ItemDetailsList.tsx @@ -5,7 +5,7 @@ import type { RefundData, Status, Maybe, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' import { useIntl } from 'react-intl' diff --git a/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx b/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx index 0cd009200..44720a3cd 100644 --- a/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx +++ b/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx @@ -2,7 +2,7 @@ import type { ReactElement } from 'react' import React from 'react' import type { IntlFormatters } from 'react-intl' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { ReturnRequestItem } from 'vtex.return-app' +import type { ReturnRequestItem } from 'obidev.obi-return-app' import type { ItemStatusInterface } from './ItemDetailsList' import { AlignItemRight } from '../../../../admin/ReturnDetails/components/AlignItemRight' diff --git a/react/common/components/ReturnDetails/RefundMethodDetail.tsx b/react/common/components/ReturnDetails/RefundMethodDetail.tsx index 7fc1078a4..652f5f4ea 100644 --- a/react/common/components/ReturnDetails/RefundMethodDetail.tsx +++ b/react/common/components/ReturnDetails/RefundMethodDetail.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { GiftCard, Maybe, RefundPaymentData } from 'vtex.return-app' +import type { GiftCard, Maybe, RefundPaymentData } from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/common/components/ReturnDetails/StatusTimeline/CommentList.tsx b/react/common/components/ReturnDetails/StatusTimeline/CommentList.tsx index 9d7c7c1be..00092c8a8 100644 --- a/react/common/components/ReturnDetails/StatusTimeline/CommentList.tsx +++ b/react/common/components/ReturnDetails/StatusTimeline/CommentList.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { RefundStatusComment, UserRole } from 'vtex.return-app' +import type { RefundStatusComment, UserRole } from 'obidev.obi-return-app' import { useRuntime } from 'vtex.render-runtime' import { FormattedMessage } from 'react-intl' import { Tag } from 'vtex.styleguide' diff --git a/react/common/components/ReturnDetails/StatusTimeline/StatusTag.tsx b/react/common/components/ReturnDetails/StatusTimeline/StatusTag.tsx index 90a472aaf..c47e78905 100644 --- a/react/common/components/ReturnDetails/StatusTimeline/StatusTag.tsx +++ b/react/common/components/ReturnDetails/StatusTimeline/StatusTag.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { Status } from 'vtex.return-app' +import type { Status } from 'obidev.obi-return-app' import { IconSuccess, IconClear } from 'vtex.styleguide' import { useIntl } from 'react-intl' diff --git a/react/common/components/returnList/ListTableFilter.tsx b/react/common/components/returnList/ListTableFilter.tsx index 0f7d1e47f..acb6185bc 100644 --- a/react/common/components/returnList/ListTableFilter.tsx +++ b/react/common/components/returnList/ListTableFilter.tsx @@ -6,7 +6,7 @@ import type { QueryReturnRequestListArgs, ReturnRequestList, Status, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import type { ApolloQueryResult } from 'apollo-client' import { useRuntime } from 'vtex.render-runtime' import { useCssHandles } from 'vtex.css-handles' diff --git a/react/common/components/returnList/StatusActionMenu.tsx b/react/common/components/returnList/StatusActionMenu.tsx index 6a62b6f5d..c649f74a4 100644 --- a/react/common/components/returnList/StatusActionMenu.tsx +++ b/react/common/components/returnList/StatusActionMenu.tsx @@ -1,6 +1,6 @@ import React from 'react' import { defineMessages, useIntl } from 'react-intl' -import type { Status } from 'vtex.return-app' +import type { Status } from 'obidev.obi-return-app' import { ActionMenu } from 'vtex.styleguide' import type { FilterKeys } from './ListTableFilter' diff --git a/react/common/graphql/getRequestDetails.gql b/react/common/graphql/getRequestDetails.gql index 2f5d49544..085174e16 100644 --- a/react/common/graphql/getRequestDetails.gql +++ b/react/common/graphql/getRequestDetails.gql @@ -2,7 +2,7 @@ query getRequestDetails($requestId: ID!) { returnRequestDetails: returnRequest(requestId: $requestId) - @context(provider: "vtex.return-app") { + @context(provider: "obidev.obi-return-app") { ...ReturnDetailsAdminFragment } } diff --git a/react/common/provider/ReturnDetailsProvider.tsx b/react/common/provider/ReturnDetailsProvider.tsx index c8bd2d212..39c9a5380 100644 --- a/react/common/provider/ReturnDetailsProvider.tsx +++ b/react/common/provider/ReturnDetailsProvider.tsx @@ -5,7 +5,7 @@ import { useQuery } from 'react-apollo' import type { ReturnRequestResponse, QueryReturnRequestArgs, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import GET_REQUEST_DETAILS from '../graphql/getRequestDetails.gql' diff --git a/react/graphql/getReturnRequestList.gql b/react/graphql/getReturnRequestList.gql index 27b8feaa8..78ec4498a 100644 --- a/react/graphql/getReturnRequestList.gql +++ b/react/graphql/getReturnRequestList.gql @@ -1,6 +1,6 @@ query getReturnRequestList($filter: ReturnRequestFilters, $page: Int!) { returnRequestList(filter: $filter, page: $page) - @context(provider: "vtex.return-app") { + @context(provider: "obidev.obi-return-app") { list { id sequenceNumber diff --git a/react/hooks/useReturnRequestList.ts b/react/hooks/useReturnRequestList.ts index ef958c40b..8e391f863 100644 --- a/react/hooks/useReturnRequestList.ts +++ b/react/hooks/useReturnRequestList.ts @@ -2,7 +2,7 @@ import { useQuery } from 'react-apollo' import type { ReturnRequestList as ReturnRequestListResponse, QueryReturnRequestListArgs, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import RETURN_REQUEST_LIST from '../graphql/getReturnRequestList.gql' diff --git a/react/package.json b/react/package.json index 8ed03b80c..4fd18518f 100644 --- a/react/package.json +++ b/react/package.json @@ -25,17 +25,16 @@ "@types/react-router": "^5.1.18", "@vtex/test-tools": "^0.3.2", "@vtex/tsconfig": "^0.6.0", + "obidev.obi-return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app", "prop-types": "^15.7.2", - "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.101.1/public/@types/vtex.catalog-graphql", + "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", "vtex.easypost": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost", "vtex.format-currency": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency", "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.0/public/@types/vtex.return-app", - "vtex.store-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.155.32/public/@types/vtex.store-graphql", - "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide", + "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, "version": "3.5.6" diff --git a/react/store/createReturnRequest/CreateReturnRequest.tsx b/react/store/createReturnRequest/CreateReturnRequest.tsx index 3dfa71844..859699406 100644 --- a/react/store/createReturnRequest/CreateReturnRequest.tsx +++ b/react/store/createReturnRequest/CreateReturnRequest.tsx @@ -4,7 +4,7 @@ import { useQuery } from 'react-apollo' import type { OrderToReturnSummary, QueryOrderToReturnSummaryArgs, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { PageHeader, PageBlock } from 'vtex.styleguide' import { FormattedMessage } from 'react-intl' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/OrderListContainer.tsx b/react/store/createReturnRequest/OrderListContainer.tsx index bab24c031..fb3568ad8 100644 --- a/react/store/createReturnRequest/OrderListContainer.tsx +++ b/react/store/createReturnRequest/OrderListContainer.tsx @@ -3,7 +3,7 @@ import { useQuery } from 'react-apollo' import type { OrdersToReturnList, QueryOrdersAvailableToReturnArgs, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { ContentWrapper, BaseLoading } from 'vtex.my-account-commons' import { FormattedMessage } from 'react-intl' diff --git a/react/store/createReturnRequest/components/AddressDetails.tsx b/react/store/createReturnRequest/components/AddressDetails.tsx index 60f8436b7..a6e4600e8 100644 --- a/react/store/createReturnRequest/components/AddressDetails.tsx +++ b/react/store/createReturnRequest/components/AddressDetails.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react' import type { ChangeEvent } from 'react' import { useIntl, defineMessages, FormattedMessage } from 'react-intl' import { Input, Tooltip, Toggle, IconInfo } from 'vtex.styleguide' -import type { AddressType, ShippingData } from 'vtex.return-app' +import type { AddressType, ShippingData } from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { useReturnRequest } from '../../hooks/useReturnRequest' diff --git a/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx b/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx index 199465734..b3afa406f 100644 --- a/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx +++ b/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx @@ -5,7 +5,7 @@ import { useRuntime } from 'vtex.render-runtime' import type { MutationCreateReturnRequestArgs, ReturnRequestCreated, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { Card, Button, Alert } from 'vtex.styleguide' diff --git a/react/store/createReturnRequest/components/ConfirmContactDetails.tsx b/react/store/createReturnRequest/components/ConfirmContactDetails.tsx index b5070d13b..bdc81301b 100644 --- a/react/store/createReturnRequest/components/ConfirmContactDetails.tsx +++ b/react/store/createReturnRequest/components/ConfirmContactDetails.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage } from 'react-intl' -import type { CustomerProfileDataInput } from 'vtex.return-app' +import type { CustomerProfileDataInput } from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx b/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx index 45b0a8ba5..fdfccf38f 100644 --- a/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx +++ b/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage, useIntl } from 'react-intl' -import type { RefundPaymentDataInput } from 'vtex.return-app' +import type { RefundPaymentDataInput } from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx b/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx index 5bd3e6413..6d08c44e4 100644 --- a/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx +++ b/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage } from 'react-intl' -import type { PickupReturnDataInput } from 'vtex.return-app' +import type { PickupReturnDataInput } from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/components/ItemsDetails.tsx b/react/store/createReturnRequest/components/ItemsDetails.tsx index 86170c24a..f58fbc930 100644 --- a/react/store/createReturnRequest/components/ItemsDetails.tsx +++ b/react/store/createReturnRequest/components/ItemsDetails.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { ItemCondition } from 'vtex.return-app' +import type { ItemCondition } from 'obidev.obi-return-app' import { NumericStepper } from 'vtex.styleguide' import { useCssHandles } from 'vtex.css-handles' import { FormattedMessage } from 'react-intl' diff --git a/react/store/createReturnRequest/components/OrderList.tsx b/react/store/createReturnRequest/components/OrderList.tsx index 523b99de4..3c6ca448a 100644 --- a/react/store/createReturnRequest/components/OrderList.tsx +++ b/react/store/createReturnRequest/components/OrderList.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react' -import type { OrdersToReturnList, OrderToReturnSummary } from 'vtex.return-app' +import type { OrdersToReturnList, OrderToReturnSummary } from 'obidev.obi-return-app' import { FormattedMessage, FormattedDate } from 'react-intl' import { useRuntime } from 'vtex.render-runtime/' import { Table, Button } from 'vtex.styleguide' diff --git a/react/store/createReturnRequest/components/PaymentMethods.tsx b/react/store/createReturnRequest/components/PaymentMethods.tsx index 5f9fce122..fa71e38d1 100644 --- a/react/store/createReturnRequest/components/PaymentMethods.tsx +++ b/react/store/createReturnRequest/components/PaymentMethods.tsx @@ -6,7 +6,7 @@ import type { RefundPaymentDataInput, PaymentType, RefundPaymentMethod, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { Input, RadioGroup } from 'vtex.styleguide' import { useStoreSettings } from '../../hooks/useStoreSettings' diff --git a/react/store/createReturnRequest/components/PickupPointSelector.tsx b/react/store/createReturnRequest/components/PickupPointSelector.tsx index b8c93efc8..e0d7149de 100644 --- a/react/store/createReturnRequest/components/PickupPointSelector.tsx +++ b/react/store/createReturnRequest/components/PickupPointSelector.tsx @@ -5,7 +5,7 @@ import type { QueryNearestPickupPointsArgs, NearPickupPointQueryResponse, PickupPoint, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { Dropdown, Spinner } from 'vtex.styleguide' import { FormattedMessage } from 'react-intl' diff --git a/react/store/createReturnRequest/components/RenderConditionDropdown.tsx b/react/store/createReturnRequest/components/RenderConditionDropdown.tsx index 2a2759160..8383a039f 100644 --- a/react/store/createReturnRequest/components/RenderConditionDropdown.tsx +++ b/react/store/createReturnRequest/components/RenderConditionDropdown.tsx @@ -1,7 +1,7 @@ import type { ChangeEvent } from 'react' import React from 'react' import { useIntl } from 'react-intl' -import type { ItemCondition } from 'vtex.return-app' +import type { ItemCondition } from 'obidev.obi-return-app' import { Dropdown } from 'vtex.styleguide' import { useCssHandles } from 'vtex.css-handles' diff --git a/react/store/createReturnRequest/components/ReturnDetails.tsx b/react/store/createReturnRequest/components/ReturnDetails.tsx index 601f2b26d..356702b51 100644 --- a/react/store/createReturnRequest/components/ReturnDetails.tsx +++ b/react/store/createReturnRequest/components/ReturnDetails.tsx @@ -1,7 +1,7 @@ import React from 'react' import { FormattedDate, FormattedMessage } from 'react-intl' import type { RouteComponentProps } from 'react-router' -import type { ShippingData } from 'vtex.return-app' +import type { ShippingData } from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { Divider, Button } from 'vtex.styleguide' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/components/ReturnInformationTable.tsx b/react/store/createReturnRequest/components/ReturnInformationTable.tsx index 6ddaf35d2..54fe77a71 100644 --- a/react/store/createReturnRequest/components/ReturnInformationTable.tsx +++ b/react/store/createReturnRequest/components/ReturnInformationTable.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage, useIntl } from 'react-intl' -import type { ReturnRequestItemInput } from 'vtex.return-app' +import type { ReturnRequestItemInput } from 'obidev.obi-return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/graphql/createReturnRequest.gql b/react/store/createReturnRequest/graphql/createReturnRequest.gql index 44cb187a7..9b2aaafaf 100644 --- a/react/store/createReturnRequest/graphql/createReturnRequest.gql +++ b/react/store/createReturnRequest/graphql/createReturnRequest.gql @@ -1,6 +1,6 @@ mutation CreateReturn($returnRequest: ReturnRequestInput!) { createReturnRequest(returnRequest: $returnRequest) - @context(provider: "vtex.return-app") { + @context(provider: "obidev.obi-return-app") { returnRequestId } } diff --git a/react/store/createReturnRequest/graphql/getGeoCoordinates.gql b/react/store/createReturnRequest/graphql/getGeoCoordinates.gql index d6b28de8b..c5b5a2044 100644 --- a/react/store/createReturnRequest/graphql/getGeoCoordinates.gql +++ b/react/store/createReturnRequest/graphql/getGeoCoordinates.gql @@ -1,6 +1,6 @@ query getGeoCoordinates($orderId: ID!) { orderToReturnSummary(orderId: $orderId) - @context(provider: "vtex.return-app") { + @context(provider: "obidev.obi-return-app") { shippingData { geoCoordinates } diff --git a/react/store/createReturnRequest/graphql/getOrderToReturnSummary.gql b/react/store/createReturnRequest/graphql/getOrderToReturnSummary.gql index 553d27d86..6a405c404 100644 --- a/react/store/createReturnRequest/graphql/getOrderToReturnSummary.gql +++ b/react/store/createReturnRequest/graphql/getOrderToReturnSummary.gql @@ -1,6 +1,6 @@ query orderToReturnSummary($orderId: ID!) { orderToReturnSummary(orderId: $orderId) - @context(provider: "vtex.return-app") { + @context(provider: "obidev.obi-return-app") { orderId creationDate invoicedItems { diff --git a/react/store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql b/react/store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql index 38907a3e9..ddf179ac8 100644 --- a/react/store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql +++ b/react/store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql @@ -1,5 +1,5 @@ query ordersAvailableToReturn($page: Int!) { - ordersAvailableToReturn(page: $page) @context(provider: "vtex.return-app") { + ordersAvailableToReturn(page: $page) @context(provider: "obidev.obi-return-app") { list { orderId creationDate diff --git a/react/store/createReturnRequest/graphql/nearestPickupPoints.gql b/react/store/createReturnRequest/graphql/nearestPickupPoints.gql index a7676bbe5..bdc4133b2 100644 --- a/react/store/createReturnRequest/graphql/nearestPickupPoints.gql +++ b/react/store/createReturnRequest/graphql/nearestPickupPoints.gql @@ -1,6 +1,6 @@ query nearestPickupPoints($lat: String!, $long: String!) { nearestPickupPoints(lat: $lat, long: $long) - @context(provider: "vtex.return-app") { + @context(provider: "obidev.obi-return-app") { items { pickupPoint { friendlyName diff --git a/react/store/graphql/getStoreSettings.gql b/react/store/graphql/getStoreSettings.gql index 7b655a3f8..eb840b938 100644 --- a/react/store/graphql/getStoreSettings.gql +++ b/react/store/graphql/getStoreSettings.gql @@ -1,5 +1,5 @@ query storeAppSettings { - returnAppSettings @context(provider: "vtex.return-app") { + returnAppSettings @context(provider: "obidev.obi-return-app") { termsUrl customReturnReasons { reason diff --git a/react/store/provider/OrderToReturnReducer.ts b/react/store/provider/OrderToReturnReducer.ts index 4ceebfa56..71aa45ca5 100644 --- a/react/store/provider/OrderToReturnReducer.ts +++ b/react/store/provider/OrderToReturnReducer.ts @@ -4,7 +4,7 @@ import type { RefundPaymentDataInput, ReturnRequestItemInput, Maybe, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' type PartialBy = Omit & Partial> diff --git a/react/store/provider/StoreSettingsProvider.tsx b/react/store/provider/StoreSettingsProvider.tsx index 31ece748e..709bd45c1 100644 --- a/react/store/provider/StoreSettingsProvider.tsx +++ b/react/store/provider/StoreSettingsProvider.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react' import React, { createContext, useState } from 'react' import { useQuery } from 'react-apollo' import { FormattedMessage } from 'react-intl' -import type { ReturnAppSettings } from 'vtex.return-app' +import type { ReturnAppSettings } from 'obidev.obi-return-app' import { Alert } from 'vtex.styleguide' import STORE_SETTING from '../graphql/getStoreSettings.gql' diff --git a/react/store/utils/constants.ts b/react/store/utils/constants.ts index 044e2789e..4fb330bbc 100644 --- a/react/store/utils/constants.ts +++ b/react/store/utils/constants.ts @@ -1,4 +1,4 @@ -import type { OrderToReturnValidation } from 'vtex.return-app' +import type { OrderToReturnValidation } from 'obidev.obi-return-app' export const ORDER_TO_RETURN_VALIDATON: Record< OrderToReturnValidation, diff --git a/react/store/utils/createItemsSummary.ts b/react/store/utils/createItemsSummary.ts index 6cf1ff3ef..ce99125c3 100644 --- a/react/store/utils/createItemsSummary.ts +++ b/react/store/utils/createItemsSummary.ts @@ -1,4 +1,4 @@ -import type { OrderToReturnSummary } from 'vtex.return-app' +import type { OrderToReturnSummary } from 'obidev.obi-return-app' import { formatItemsToReturn } from './formatItemsToReturn' diff --git a/react/store/utils/formatItemsToReturn.ts b/react/store/utils/formatItemsToReturn.ts index 8dcb2812b..70169e5eb 100644 --- a/react/store/utils/formatItemsToReturn.ts +++ b/react/store/utils/formatItemsToReturn.ts @@ -1,4 +1,4 @@ -import type { OrderToReturnSummary } from 'vtex.return-app' +import type { OrderToReturnSummary } from 'obidev.obi-return-app' export function formatItemsToReturn( orderToReturn: OrderToReturnSummary diff --git a/react/store/utils/generateCustomReasonOptions.ts b/react/store/utils/generateCustomReasonOptions.ts index 6baa5a356..38074f56f 100644 --- a/react/store/utils/generateCustomReasonOptions.ts +++ b/react/store/utils/generateCustomReasonOptions.ts @@ -1,4 +1,4 @@ -import type { CustomReturnReason } from 'vtex.return-app' +import type { CustomReturnReason } from 'obidev.obi-return-app' import { isWithinMaxDaysToReturn } from '../../../node/utils/dateHelpers' diff --git a/react/store/utils/parseReturnRequestError.ts b/react/store/utils/parseReturnRequestError.ts index 177747032..75173d535 100644 --- a/react/store/utils/parseReturnRequestError.ts +++ b/react/store/utils/parseReturnRequestError.ts @@ -1,6 +1,6 @@ import type { ApolloError } from 'apollo-client' import { defineMessages } from 'react-intl' -import type { OrderToReturnValidation } from 'vtex.return-app' +import type { OrderToReturnValidation } from 'obidev.obi-return-app' import { ORDER_TO_RETURN_VALIDATON } from './constants' diff --git a/react/store/utils/setInitialPickupAddress.ts b/react/store/utils/setInitialPickupAddress.ts index c9e584176..672b9795d 100644 --- a/react/store/utils/setInitialPickupAddress.ts +++ b/react/store/utils/setInitialPickupAddress.ts @@ -1,4 +1,4 @@ -import type { ShippingData } from 'vtex.return-app' +import type { ShippingData } from 'obidev.obi-return-app' import type { OrderDetailsState } from '../provider/OrderToReturnReducer' diff --git a/react/store/utils/validateNewReturnRequestFields.ts b/react/store/utils/validateNewReturnRequestFields.ts index c6c8cb595..0cc5934aa 100644 --- a/react/store/utils/validateNewReturnRequestFields.ts +++ b/react/store/utils/validateNewReturnRequestFields.ts @@ -1,7 +1,7 @@ import type { ReturnRequestItemInput, ReturnRequestInput, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import type { OrderDetailsState } from '../provider/OrderToReturnReducer' import { isValidIBANNumber } from './isValidIBANNumber' diff --git a/react/tsconfig.json b/react/tsconfig.json index f41d22a5a..343f18824 100644 --- a/react/tsconfig.json +++ b/react/tsconfig.json @@ -5,12 +5,21 @@ "target": "es2017", "jsx": "preserve", "allowSyntheticDefaultImports": true, - "lib": ["es2017", "dom"], + "lib": [ + "es2017", + "dom" + ], "strict": true, "skipLibCheck": true, "noImplicitAny": false }, - "exclude": ["node_modules"], - "include": ["./typings/*.d.ts", "./**/*.tsx", "./**/*.ts"], + "exclude": [ + "node_modules" + ], + "include": [ + "./typings/*.d.ts", + "./**/*.tsx", + "./**/*.ts" + ], "extends": "@vtex/tsconfig" -} +} \ No newline at end of file diff --git a/react/utils/requestStatus.ts b/react/utils/requestStatus.ts index cee799ee2..bb1159468 100644 --- a/react/utils/requestStatus.ts +++ b/react/utils/requestStatus.ts @@ -2,7 +2,7 @@ import type { Status, RefundStatusData, RefundStatusComment, -} from 'vtex.return-app' +} from 'obidev.obi-return-app' import { defineMessages } from 'react-intl' const statusSequence: Status[] = [ diff --git a/react/yarn.lock b/react/yarn.lock index 494192068..4d4cd004e 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -3946,6 +3946,10 @@ oauth-sign@~0.9.0: resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== +"obidev.obi-return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app": + version "0.0.1" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app#0dfffb76a73d3c034412acc546740a002e9fb827" + object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -5178,9 +5182,9 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.101.1/public/@types/vtex.catalog-graphql": - version "1.101.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.101.1/public/@types/vtex.catalog-graphql#8f4d8981c04429e94b30188acb9c6f1a6b912197" +"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql": + version "1.102.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql#ad1dfac8d076034d4326a00a3da20a3915951f53" "vtex.css-handles@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles": version "0.4.4" @@ -5206,17 +5210,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.0/public/@types/vtex.return-app": - version "3.5.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.0/public/@types/vtex.return-app#29e8ca8294b52af366586fcea7ae995870bc0271" - -"vtex.store-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.155.32/public/@types/vtex.store-graphql": - version "2.155.32" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.store-graphql@2.155.32/public/@types/vtex.store-graphql#abafbe1d80f453bbebc70024a829e4226bf6cc20" - -"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide": - version "9.146.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.1/public/@types/vtex.styleguide#66db40ca1b78ad77ce4beedabecee320e1ef2ead" +"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": + version "9.146.3" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" "vtex.tenant-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql": version "0.1.2" From d852dafdd5d12c630a98576af366b2b468f40b67 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Mon, 27 Feb 2023 15:29:26 -0500 Subject: [PATCH 02/81] preparing app for using vtex vendor --- manifest.json | 6 +++--- node/clients/checkout.ts | 2 +- node/clients/index.ts | 2 +- node/middlewares/getRequestList.ts | 2 +- node/package.json | 2 +- node/resolvers/ReturnRequestResponse.ts | 2 +- node/resolvers/appSettings.ts | 2 +- node/resolvers/categoryTreeName.ts | 2 +- node/resolvers/createReturnRequest.ts | 2 +- node/resolvers/nearestPickupPoints.ts | 2 +- node/resolvers/orderToReturnSummary.ts | 2 +- node/resolvers/ordersAvailableToReturn.ts | 2 +- node/resolvers/returnRequest.ts | 2 +- node/resolvers/returnRequestList.ts | 2 +- node/resolvers/updateReturnRequestStatus.ts | 2 +- node/services/createReturnRequestService.ts | 2 +- node/services/returnRequestListService.ts | 2 +- node/services/returnRequestService.ts | 2 +- node/services/updateRequestStatusService.ts | 2 +- node/typings/mailClient.d.ts | 2 +- node/utils/appSettingsValidation.ts | 2 +- node/utils/canReturnAllItems.ts | 2 +- node/utils/constants.ts | 2 +- node/utils/createItemsToReturn.ts | 2 +- node/utils/createOrUpdateStatusPayload.ts | 2 +- node/utils/createOrdersToReturnSummary.ts | 2 +- node/utils/createRefundData.ts | 2 +- node/utils/createRefundableTotals.ts | 2 +- node/utils/handleRefund.ts | 2 +- node/utils/transformOrderClientProfileData.ts | 2 +- node/utils/transformShippingData.ts | 2 +- node/utils/translateItems.ts | 2 +- node/utils/validateCanUseDropoffPoints.ts | 2 +- node/utils/validateItemCondition.ts | 2 +- node/utils/validatePaymentMethod.ts | 2 +- node/utils/validateReturnReason.ts | 2 +- node/utils/validateStatusUpdate.ts | 2 +- node/yarn.lock | 8 ++++---- pages/pages.json | 4 ++-- .../ReturnDetails/components/UpdateRequestStatus.tsx | 2 +- .../components/VerifyItems/VerifyItemsPage.tsx | 2 +- .../components/VerifyItems/VerifyItemsTable.tsx | 2 +- .../components/VerifyItems/verifyItemsModalSchema.tsx | 2 +- .../components/VerifyItems/verifyItemsTableSchema.tsx | 2 +- .../components/VerifyItems/verifyTotalsTableSchema.tsx | 2 +- react/admin/graphql/updateReturnRequestStatus.gql | 2 +- react/admin/provider/UpdateRequestStatusProvider.tsx | 2 +- react/admin/settings/RMASettings.tsx | 2 +- .../components/CustomReasons/CustomReasonModal.tsx | 2 +- .../settings/components/CustomReasons/CustomReasons.tsx | 2 +- .../components/CustomReasons/TranslationsModal.tsx | 2 +- react/admin/settings/components/ExcludedCategories.tsx | 2 +- react/admin/settings/components/PaymentOptions.tsx | 2 +- react/admin/settings/graphql/getAppSettings.gql | 2 +- react/admin/settings/graphql/getCategoryTreeName.gql | 2 +- react/admin/settings/graphql/saveAppSettings.gql | 2 +- react/admin/settings/provider/SettingsProvider.tsx | 2 +- react/admin/settings/provider/settingsReducer.ts | 2 +- react/common/components/RenderStatus.tsx | 2 +- .../ReturnDetails/ItemDetails/ItemDetailsList.tsx | 2 +- .../ReturnDetails/ItemDetails/itemDetailsSchema.tsx | 2 +- .../components/ReturnDetails/RefundMethodDetail.tsx | 2 +- .../ReturnDetails/StatusTimeline/CommentList.tsx | 2 +- .../components/ReturnDetails/StatusTimeline/StatusTag.tsx | 2 +- react/common/components/returnList/ListTableFilter.tsx | 2 +- react/common/components/returnList/StatusActionMenu.tsx | 2 +- react/common/graphql/getRequestDetails.gql | 2 +- react/common/provider/ReturnDetailsProvider.tsx | 2 +- react/graphql/getReturnRequestList.gql | 2 +- react/hooks/useReturnRequestList.ts | 2 +- react/package.json | 2 +- react/store/createReturnRequest/CreateReturnRequest.tsx | 2 +- react/store/createReturnRequest/OrderListContainer.tsx | 2 +- .../createReturnRequest/components/AddressDetails.tsx | 2 +- .../createReturnRequest/components/ConfirmAndSubmit.tsx | 2 +- .../components/ConfirmContactDetails.tsx | 2 +- .../components/ConfirmPaymentMethods.tsx | 2 +- .../components/ConfirmPickupAddressDetails.tsx | 2 +- .../store/createReturnRequest/components/ItemsDetails.tsx | 2 +- react/store/createReturnRequest/components/OrderList.tsx | 2 +- .../createReturnRequest/components/PaymentMethods.tsx | 2 +- .../components/PickupPointSelector.tsx | 2 +- .../components/RenderConditionDropdown.tsx | 2 +- .../createReturnRequest/components/ReturnDetails.tsx | 2 +- .../components/ReturnInformationTable.tsx | 2 +- .../createReturnRequest/graphql/createReturnRequest.gql | 2 +- .../createReturnRequest/graphql/getGeoCoordinates.gql | 2 +- .../graphql/getOrderToReturnSummary.gql | 2 +- .../graphql/getOrdersAvailableToReturn.gql | 2 +- .../createReturnRequest/graphql/nearestPickupPoints.gql | 2 +- react/store/graphql/getStoreSettings.gql | 2 +- react/store/provider/OrderToReturnReducer.ts | 2 +- react/store/provider/StoreSettingsProvider.tsx | 2 +- react/store/utils/constants.ts | 2 +- react/store/utils/createItemsSummary.ts | 2 +- react/store/utils/formatItemsToReturn.ts | 2 +- react/store/utils/generateCustomReasonOptions.ts | 2 +- react/store/utils/parseReturnRequestError.ts | 2 +- react/store/utils/setInitialPickupAddress.ts | 2 +- react/store/utils/validateNewReturnRequestFields.ts | 2 +- react/utils/requestStatus.ts | 2 +- react/yarn.lock | 8 ++++---- 102 files changed, 111 insertions(+), 111 deletions(-) diff --git a/manifest.json b/manifest.json index f18a6d65e..4617a349a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { - "vendor": "obidev", - "name": "obi-return-app", - "version": "0.0.1", + "vendor": "vtex", + "name": "return-app", + "version": "3.5.6", "title": "Return app", "description": "Return app", "dependencies": { diff --git a/node/clients/checkout.ts b/node/clients/checkout.ts index d220fdfab..53dd2670e 100644 --- a/node/clients/checkout.ts +++ b/node/clients/checkout.ts @@ -1,6 +1,6 @@ import type { InstanceOptions, IOContext } from '@vtex/api' import { JanusClient } from '@vtex/api' -import type { NearPickupPointQueryResponse } from 'obidev.obi-return-app' +import type { NearPickupPointQueryResponse } from 'vtex.return-app' export default class Checkout extends JanusClient { constructor(ctx: IOContext, options?: InstanceOptions) { diff --git a/node/clients/index.ts b/node/clients/index.ts index 8976fc7ba..2a1a2d876 100644 --- a/node/clients/index.ts +++ b/node/clients/index.ts @@ -1,6 +1,6 @@ import { IOClients, Sphinx } from '@vtex/api' import { vbaseFor, masterDataFor } from '@vtex/clients' -import { ReturnAppSettings, ReturnRequest } from 'obidev.obi-return-app' +import { ReturnAppSettings, ReturnRequest } from 'vtex.return-app' import { Catalog } from './catalog' import { OMSCustom as OMS } from './oms' diff --git a/node/middlewares/getRequestList.ts b/node/middlewares/getRequestList.ts index b1aa23c37..86342c8c1 100644 --- a/node/middlewares/getRequestList.ts +++ b/node/middlewares/getRequestList.ts @@ -1,4 +1,4 @@ -import type { Status } from 'obidev.obi-return-app' +import type { Status } from 'vtex.return-app' import { returnRequestListService } from '../services/returnRequestListService' diff --git a/node/package.json b/node/package.json index 61a1ce631..2ac54002a 100644 --- a/node/package.json +++ b/node/package.json @@ -14,7 +14,6 @@ "@vtex/api": "6.45.15", "@vtex/test-tools": "^1.0.0", "@vtex/tsconfig": "^0.6.0", - "obidev.obi-return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app", "tslint": "^6.1.3", "tslint-config-vtex": "^2.1.0", "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", @@ -24,6 +23,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", + "vtex.return-app": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/node/resolvers/ReturnRequestResponse.ts b/node/resolvers/ReturnRequestResponse.ts index 2d15d3ee1..c3a3de160 100644 --- a/node/resolvers/ReturnRequestResponse.ts +++ b/node/resolvers/ReturnRequestResponse.ts @@ -1,4 +1,4 @@ -import type { ReturnRequest } from 'obidev.obi-return-app' +import type { ReturnRequest } from 'vtex.return-app' type VtexProduct = 'admin' | 'store' | undefined diff --git a/node/resolvers/appSettings.ts b/node/resolvers/appSettings.ts index b8dfce1e9..2f93cc131 100644 --- a/node/resolvers/appSettings.ts +++ b/node/resolvers/appSettings.ts @@ -1,7 +1,7 @@ import type { ReturnAppSettings, MutationSaveReturnAppSettingsArgs, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { validateMaxDaysCustomReasons, diff --git a/node/resolvers/categoryTreeName.ts b/node/resolvers/categoryTreeName.ts index e5dee55a6..5c41ee5f8 100644 --- a/node/resolvers/categoryTreeName.ts +++ b/node/resolvers/categoryTreeName.ts @@ -1,4 +1,4 @@ -import type { CategoryInfo } from 'obidev.obi-return-app' +import type { CategoryInfo } from 'vtex.return-app' const transformCategoryTree = ( categoryTree: CategoryTree[], diff --git a/node/resolvers/createReturnRequest.ts b/node/resolvers/createReturnRequest.ts index 00a097873..a175df82a 100644 --- a/node/resolvers/createReturnRequest.ts +++ b/node/resolvers/createReturnRequest.ts @@ -1,4 +1,4 @@ -import type { MutationCreateReturnRequestArgs } from 'obidev.obi-return-app' +import type { MutationCreateReturnRequestArgs } from 'vtex.return-app' import { createReturnRequestService } from '../services/createReturnRequestService' diff --git a/node/resolvers/nearestPickupPoints.ts b/node/resolvers/nearestPickupPoints.ts index fca66d474..9fc715569 100644 --- a/node/resolvers/nearestPickupPoints.ts +++ b/node/resolvers/nearestPickupPoints.ts @@ -1,7 +1,7 @@ import type { QueryNearestPickupPointsArgs, NearPickupPointQueryResponse, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' export const nearestPickupPoints = async ( _: unknown, diff --git a/node/resolvers/orderToReturnSummary.ts b/node/resolvers/orderToReturnSummary.ts index 297cccaf5..e0d92170d 100644 --- a/node/resolvers/orderToReturnSummary.ts +++ b/node/resolvers/orderToReturnSummary.ts @@ -1,5 +1,5 @@ import { ResolverError, UserInputError } from '@vtex/api' -import type { OrderToReturnSummary } from 'obidev.obi-return-app' +import type { OrderToReturnSummary } from 'vtex.return-app' import { SETTINGS_PATH } from '../utils/constants' import { createOrdersToReturnSummary } from '../utils/createOrdersToReturnSummary' diff --git a/node/resolvers/ordersAvailableToReturn.ts b/node/resolvers/ordersAvailableToReturn.ts index f13145ba4..1d0b0729a 100644 --- a/node/resolvers/ordersAvailableToReturn.ts +++ b/node/resolvers/ordersAvailableToReturn.ts @@ -1,5 +1,5 @@ import { ResolverError } from '@vtex/api' -import type { OrdersToReturnList, OrderToReturnSummary } from 'obidev.obi-return-app' +import type { OrdersToReturnList, OrderToReturnSummary } from 'vtex.return-app' import { SETTINGS_PATH } from '../utils/constants' import { createOrdersToReturnSummary } from '../utils/createOrdersToReturnSummary' diff --git a/node/resolvers/returnRequest.ts b/node/resolvers/returnRequest.ts index ce1f900fd..1f6f21426 100644 --- a/node/resolvers/returnRequest.ts +++ b/node/resolvers/returnRequest.ts @@ -1,4 +1,4 @@ -import type { QueryReturnRequestArgs } from 'obidev.obi-return-app' +import type { QueryReturnRequestArgs } from 'vtex.return-app' import { returnRequestService } from '../services/returnRequestService' diff --git a/node/resolvers/returnRequestList.ts b/node/resolvers/returnRequestList.ts index 06a0752a9..51ba25467 100644 --- a/node/resolvers/returnRequestList.ts +++ b/node/resolvers/returnRequestList.ts @@ -1,4 +1,4 @@ -import type { QueryReturnRequestListArgs } from 'obidev.obi-return-app' +import type { QueryReturnRequestListArgs } from 'vtex.return-app' import { returnRequestListService } from '../services/returnRequestListService' diff --git a/node/resolvers/updateReturnRequestStatus.ts b/node/resolvers/updateReturnRequestStatus.ts index 4338d3208..60aba4c91 100644 --- a/node/resolvers/updateReturnRequestStatus.ts +++ b/node/resolvers/updateReturnRequestStatus.ts @@ -1,7 +1,7 @@ import type { MutationUpdateReturnRequestStatusArgs, ReturnRequest, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { updateRequestStatusService } from '../services/updateRequestStatusService' diff --git a/node/services/createReturnRequestService.ts b/node/services/createReturnRequestService.ts index 0153bb0e9..55c30b8ab 100644 --- a/node/services/createReturnRequestService.ts +++ b/node/services/createReturnRequestService.ts @@ -1,4 +1,4 @@ -import type { ReturnRequestCreated, ReturnRequestInput } from 'obidev.obi-return-app' +import type { ReturnRequestCreated, ReturnRequestInput } from 'vtex.return-app' import { UserInputError, ResolverError } from '@vtex/api' import type { DocumentResponse } from '@vtex/clients' diff --git a/node/services/returnRequestListService.ts b/node/services/returnRequestListService.ts index 1bb6c33ac..955f8d612 100644 --- a/node/services/returnRequestListService.ts +++ b/node/services/returnRequestListService.ts @@ -2,7 +2,7 @@ import type { QueryReturnRequestListArgs, ReturnRequestFilters, Maybe, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { ForbiddenError } from '@vtex/api' const filterDate = (date: string): string => { diff --git a/node/services/returnRequestService.ts b/node/services/returnRequestService.ts index f9a0d7b33..d4a25a722 100644 --- a/node/services/returnRequestService.ts +++ b/node/services/returnRequestService.ts @@ -1,5 +1,5 @@ import { ResolverError, ForbiddenError } from '@vtex/api' -import type { ReturnRequest } from 'obidev.obi-return-app' +import type { ReturnRequest } from 'vtex.return-app' export const returnRequestService = async (ctx: Context, requestId: string) => { const { diff --git a/node/services/updateRequestStatusService.ts b/node/services/updateRequestStatusService.ts index 8893566d3..f1d21ead3 100644 --- a/node/services/updateRequestStatusService.ts +++ b/node/services/updateRequestStatusService.ts @@ -3,7 +3,7 @@ import type { ReturnRequest, Status, RefundItemInput, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { ResolverError, ForbiddenError, diff --git a/node/typings/mailClient.d.ts b/node/typings/mailClient.d.ts index eeb9daf7f..ddf9d8987 100644 --- a/node/typings/mailClient.d.ts +++ b/node/typings/mailClient.d.ts @@ -1,4 +1,4 @@ -import type { ReturnRequestItem, Status } from 'obidev.obi-return-app' +import type { ReturnRequestItem, Status } from 'vtex.return-app' export type ReturnRequestConfirmation = string diff --git a/node/utils/appSettingsValidation.ts b/node/utils/appSettingsValidation.ts index d08e03e94..f096a74c3 100644 --- a/node/utils/appSettingsValidation.ts +++ b/node/utils/appSettingsValidation.ts @@ -3,7 +3,7 @@ import type { PaymentTypeInput, CustomReturnReasonInput, PaymentOptions, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' export const validatePaymentOptions = ( paymentOptions: PaymentOptionsInput diff --git a/node/utils/canReturnAllItems.ts b/node/utils/canReturnAllItems.ts index d47d67748..b305ec8da 100644 --- a/node/utils/canReturnAllItems.ts +++ b/node/utils/canReturnAllItems.ts @@ -3,7 +3,7 @@ import type { ReturnRequestItemInput, ReturnAppSettings, ReturnRequest, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { ResolverError } from '@vtex/api' import { createOrdersToReturnSummary } from './createOrdersToReturnSummary' diff --git a/node/utils/constants.ts b/node/utils/constants.ts index 70eb628bb..6ddfc5ddd 100644 --- a/node/utils/constants.ts +++ b/node/utils/constants.ts @@ -1,4 +1,4 @@ -import type { OrderToReturnValidation } from 'obidev.obi-return-app' +import type { OrderToReturnValidation } from 'vtex.return-app' import type { ReturnRequestConfirmation, diff --git a/node/utils/createItemsToReturn.ts b/node/utils/createItemsToReturn.ts index c7f052a38..ad78fe015 100644 --- a/node/utils/createItemsToReturn.ts +++ b/node/utils/createItemsToReturn.ts @@ -4,7 +4,7 @@ import type { PriceTag, SellerDetail, } from '@vtex/clients' -import type { ReturnRequestItemInput, ReturnRequestItem } from 'obidev.obi-return-app' +import type { ReturnRequestItemInput, ReturnRequestItem } from 'vtex.return-app' import type { CatalogGQL } from '../clients/catalogGQL' import { translateItemName } from './translateItems' diff --git a/node/utils/createOrUpdateStatusPayload.ts b/node/utils/createOrUpdateStatusPayload.ts index e4472cd9d..6e87fe5c0 100644 --- a/node/utils/createOrUpdateStatusPayload.ts +++ b/node/utils/createOrUpdateStatusPayload.ts @@ -4,7 +4,7 @@ import type { ReturnRequest, ReturnRequestCommentInput, Status, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' export const createOrUpdateStatusPayload = ({ refundStatusData, diff --git a/node/utils/createOrdersToReturnSummary.ts b/node/utils/createOrdersToReturnSummary.ts index 97ff09a66..ba6105845 100644 --- a/node/utils/createOrdersToReturnSummary.ts +++ b/node/utils/createOrdersToReturnSummary.ts @@ -6,7 +6,7 @@ import type { ProcessedItem, ReturnAppSettings, ReturnRequest, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { getInvoicedItems } from './getInvoicedItems' import { mapItemIndexAndQuantity } from './mapItemIndexAndQuantity' diff --git a/node/utils/createRefundData.ts b/node/utils/createRefundData.ts index d37b873ff..f364558ea 100644 --- a/node/utils/createRefundData.ts +++ b/node/utils/createRefundData.ts @@ -1,4 +1,4 @@ -import type { Maybe, RefundDataInput, ReturnRequest } from 'obidev.obi-return-app' +import type { Maybe, RefundDataInput, ReturnRequest } from 'vtex.return-app' import { UserInputError } from '@vtex/api' export const createRefundData = ({ diff --git a/node/utils/createRefundableTotals.ts b/node/utils/createRefundableTotals.ts index 7ec3526f8..9e1b0070c 100644 --- a/node/utils/createRefundableTotals.ts +++ b/node/utils/createRefundableTotals.ts @@ -1,4 +1,4 @@ -import type { RefundableAmountTotal, ReturnRequest } from 'obidev.obi-return-app' +import type { RefundableAmountTotal, ReturnRequest } from 'vtex.return-app' import type { ItemTotal } from '@vtex/clients' export const createRefundableTotals = ( diff --git a/node/utils/handleRefund.ts b/node/utils/handleRefund.ts index c72fd5546..949a5d382 100644 --- a/node/utils/handleRefund.ts +++ b/node/utils/handleRefund.ts @@ -1,4 +1,4 @@ -import type { Status, Maybe, ReturnRequest, GiftCard } from 'obidev.obi-return-app' +import type { Status, Maybe, ReturnRequest, GiftCard } from 'vtex.return-app' import { ResolverError } from '@vtex/api' import type { OMSCustom } from '../clients/oms' diff --git a/node/utils/transformOrderClientProfileData.ts b/node/utils/transformOrderClientProfileData.ts index 33f69961e..8d860b9d7 100644 --- a/node/utils/transformOrderClientProfileData.ts +++ b/node/utils/transformOrderClientProfileData.ts @@ -1,5 +1,5 @@ import type { ClientProfileDetail } from '@vtex/clients' -import type { ClientProfileData } from 'obidev.obi-return-app' +import type { ClientProfileData } from 'vtex.return-app' export const transformOrderClientProfileData = ( clientProfileData: ClientProfileDetail, diff --git a/node/utils/transformShippingData.ts b/node/utils/transformShippingData.ts index 53c8ad101..38779deb4 100644 --- a/node/utils/transformShippingData.ts +++ b/node/utils/transformShippingData.ts @@ -1,5 +1,5 @@ import type { ShippingDetail } from '@vtex/clients' -import type { ShippingData } from 'obidev.obi-return-app' +import type { ShippingData } from 'vtex.return-app' export const transformShippingData = ( shippingData: ShippingDetail diff --git a/node/utils/translateItems.ts b/node/utils/translateItems.ts index 8da785fa1..fd3a156e5 100644 --- a/node/utils/translateItems.ts +++ b/node/utils/translateItems.ts @@ -1,4 +1,4 @@ -import type { InvoicedItem } from 'obidev.obi-return-app' +import type { InvoicedItem } from 'vtex.return-app' import type { CatalogGQL } from '../clients/catalogGQL' diff --git a/node/utils/validateCanUseDropoffPoints.ts b/node/utils/validateCanUseDropoffPoints.ts index 5935bd009..9c925ea7f 100644 --- a/node/utils/validateCanUseDropoffPoints.ts +++ b/node/utils/validateCanUseDropoffPoints.ts @@ -1,4 +1,4 @@ -import type { PickupReturnDataInput } from 'obidev.obi-return-app' +import type { PickupReturnDataInput } from 'vtex.return-app' import { ResolverError, UserInputError } from '@vtex/api' export const validateCanUsedropoffPoints = ( diff --git a/node/utils/validateItemCondition.ts b/node/utils/validateItemCondition.ts index 0ff66d0e2..a85ea2bca 100644 --- a/node/utils/validateItemCondition.ts +++ b/node/utils/validateItemCondition.ts @@ -1,4 +1,4 @@ -import type { ReturnRequestItemInput } from 'obidev.obi-return-app' +import type { ReturnRequestItemInput } from 'vtex.return-app' import { UserInputError } from '@vtex/api' export const validateItemCondition = ( diff --git a/node/utils/validatePaymentMethod.ts b/node/utils/validatePaymentMethod.ts index d3735f0e1..3d27c54f0 100644 --- a/node/utils/validatePaymentMethod.ts +++ b/node/utils/validatePaymentMethod.ts @@ -1,4 +1,4 @@ -import type { RefundPaymentDataInput, PaymentOptions } from 'obidev.obi-return-app' +import type { RefundPaymentDataInput, PaymentOptions } from 'vtex.return-app' import { ResolverError } from '@vtex/api' import { isValidIBANNumber } from './isValidIBANNumber' diff --git a/node/utils/validateReturnReason.ts b/node/utils/validateReturnReason.ts index 403b0fb69..5ffc21360 100644 --- a/node/utils/validateReturnReason.ts +++ b/node/utils/validateReturnReason.ts @@ -1,7 +1,7 @@ import type { ReturnRequestItemInput, CustomReturnReason, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { ResolverError, UserInputError } from '@vtex/api' import { isWithinMaxDaysToReturn } from './dateHelpers' diff --git a/node/utils/validateStatusUpdate.ts b/node/utils/validateStatusUpdate.ts index 210ce9444..a7548344e 100644 --- a/node/utils/validateStatusUpdate.ts +++ b/node/utils/validateStatusUpdate.ts @@ -1,5 +1,5 @@ import { ResolverError, UserInputError } from '@vtex/api' -import type { Status } from 'obidev.obi-return-app' +import type { Status } from 'vtex.return-app' const statusAllowed: Record = { new: ['new', 'processing', 'denied', 'cancelled'], diff --git a/node/yarn.lock b/node/yarn.lock index f376b68ce..bed02b4b8 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -4685,10 +4685,6 @@ oauth-sign@~0.9.0: resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -"obidev.obi-return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app": - version "0.0.1" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app#0dfffb76a73d3c034412acc546740a002e9fb827" - object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -6159,6 +6155,10 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" +"vtex.return-app@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app": + version "3.5.6" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app#11353347392aa168c3b0fe16496b70448f4a840b" + "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" diff --git a/pages/pages.json b/pages/pages.json index 760f0c697..964ecedb1 100644 --- a/pages/pages.json +++ b/pages/pages.json @@ -1,9 +1,9 @@ { "extensions": { - "my-account-portal/routes/obidev.obi-return-app": { + "my-account-portal/routes/vtex.return-app": { "component": "ExtensionRouter" }, - "my-account-portal/menu-links-after/obidev.obi-return-app": { + "my-account-portal/menu-links-after/vtex.return-app": { "component": "ExtensionLinks" } } diff --git a/react/admin/ReturnDetails/components/UpdateRequestStatus.tsx b/react/admin/ReturnDetails/components/UpdateRequestStatus.tsx index d1353eeae..b45e652d7 100644 --- a/react/admin/ReturnDetails/components/UpdateRequestStatus.tsx +++ b/react/admin/ReturnDetails/components/UpdateRequestStatus.tsx @@ -10,7 +10,7 @@ import { Tooltip, IconInfo, } from 'vtex.styleguide' -import type { Status } from 'obidev.obi-return-app' +import type { Status } from 'vtex.return-app' import { useReturnDetails } from '../../../common/hooks/useReturnDetails' import { diff --git a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx index 4a8914bfb..a51480bb7 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx @@ -7,7 +7,7 @@ import { IconInfo, } from 'vtex.styleguide' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { RefundItemInput } from 'obidev.obi-return-app' +import type { RefundItemInput } from 'vtex.return-app' import { useReturnDetails } from '../../../../common/hooks/useReturnDetails' import { VerifyItemsTable } from './VerifyItemsTable' diff --git a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsTable.tsx b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsTable.tsx index f8774a683..6471c80cc 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsTable.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsTable.tsx @@ -1,7 +1,7 @@ import React from 'react' import { FormattedMessage } from 'react-intl' import { Table } from 'vtex.styleguide' -import type { ReturnRequestItem } from 'obidev.obi-return-app' +import type { ReturnRequestItem } from 'vtex.return-app' import { verifyItemsTableSchema } from './verifyItemsTableSchema' import type { RefundItemMap, UpdateItemsChange } from './VerifyItemsPage' diff --git a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsModalSchema.tsx b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsModalSchema.tsx index cdf405530..07109c857 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsModalSchema.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsModalSchema.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { ReturnRequestItem, CultureInfoData } from 'obidev.obi-return-app' +import type { ReturnRequestItem, CultureInfoData } from 'vtex.return-app' import type { RefundItemMap } from './VerifyItemsPage' import { AlignItemRight } from '../AlignItemRight' diff --git a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx index 973a71b39..5131d4bc5 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx @@ -1,7 +1,7 @@ import type { ChangeEvent } from 'react' import React from 'react' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { ReturnRequestItem, CultureInfoData } from 'obidev.obi-return-app' +import type { ReturnRequestItem, CultureInfoData } from 'vtex.return-app' import { NumericStepper, InputCurrency } from 'vtex.styleguide' import type { RefundItemMap, UpdateItemsChange } from './VerifyItemsPage' diff --git a/react/admin/ReturnDetails/components/VerifyItems/verifyTotalsTableSchema.tsx b/react/admin/ReturnDetails/components/VerifyItems/verifyTotalsTableSchema.tsx index 3e0a7c649..37d516b07 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/verifyTotalsTableSchema.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/verifyTotalsTableSchema.tsx @@ -2,7 +2,7 @@ import type { ChangeEvent } from 'react' import React from 'react' import { FormattedMessage, FormattedNumber } from 'react-intl' import { InputCurrency } from 'vtex.styleguide' -import type { CultureInfoData } from 'obidev.obi-return-app' +import type { CultureInfoData } from 'vtex.return-app' import { AlignItemRight } from '../AlignItemRight' diff --git a/react/admin/graphql/updateReturnRequestStatus.gql b/react/admin/graphql/updateReturnRequestStatus.gql index 5c8b01319..c571444fa 100644 --- a/react/admin/graphql/updateReturnRequestStatus.gql +++ b/react/admin/graphql/updateReturnRequestStatus.gql @@ -11,7 +11,7 @@ mutation updateReturnRequestStatus( status: $status comment: $comment refundData: $refundData - ) @context(provider: "obidev.obi-return-app") { + ) @context(provider: "vtex.return-app") { ...ReturnDetailsAdminFragment } } diff --git a/react/admin/provider/UpdateRequestStatusProvider.tsx b/react/admin/provider/UpdateRequestStatusProvider.tsx index 00e2aa47e..262676725 100644 --- a/react/admin/provider/UpdateRequestStatusProvider.tsx +++ b/react/admin/provider/UpdateRequestStatusProvider.tsx @@ -6,7 +6,7 @@ import type { RefundDataInput, ReturnRequestResponse, MutationUpdateReturnRequestStatusArgs, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { useMutation } from 'react-apollo' import { FormattedMessage } from 'react-intl' diff --git a/react/admin/settings/RMASettings.tsx b/react/admin/settings/RMASettings.tsx index d7828515c..317e257e7 100644 --- a/react/admin/settings/RMASettings.tsx +++ b/react/admin/settings/RMASettings.tsx @@ -3,7 +3,7 @@ import type { FormEvent, ReactElement } from 'react' import type { PaymentOptions as PaymentOptionsInterface, PaymentType, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { FormattedMessage } from 'react-intl' import { Layout, diff --git a/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx b/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx index 491dee597..ef75db2d4 100644 --- a/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx +++ b/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx @@ -1,7 +1,7 @@ import type { ChangeEvent, FormEvent } from 'react' import React, { useState, useEffect } from 'react' import { FormattedMessage, useIntl } from 'react-intl' -import type { CustomReturnReason } from 'obidev.obi-return-app' +import type { CustomReturnReason } from 'vtex.return-app' import { Modal, Input, Button } from 'vtex.styleguide' import { useSettings } from '../../hooks/useSettings' diff --git a/react/admin/settings/components/CustomReasons/CustomReasons.tsx b/react/admin/settings/components/CustomReasons/CustomReasons.tsx index 8c348c2fb..5534925a8 100644 --- a/react/admin/settings/components/CustomReasons/CustomReasons.tsx +++ b/react/admin/settings/components/CustomReasons/CustomReasons.tsx @@ -1,7 +1,7 @@ import type { ReactElement } from 'react' import React, { useState } from 'react' import { FormattedMessage } from 'react-intl' -import type { CustomReturnReason } from 'obidev.obi-return-app' +import type { CustomReturnReason } from 'vtex.return-app' import { ButtonWithIcon, IconPlusLines, diff --git a/react/admin/settings/components/CustomReasons/TranslationsModal.tsx b/react/admin/settings/components/CustomReasons/TranslationsModal.tsx index e51dfd7e0..ec827d5d0 100644 --- a/react/admin/settings/components/CustomReasons/TranslationsModal.tsx +++ b/react/admin/settings/components/CustomReasons/TranslationsModal.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useState } from 'react' import { useQuery } from 'react-apollo' import type { Tenant, Binding } from 'vtex.tenant-graphql' import { ModalDialog, Table, Input, Spinner, EmptyState } from 'vtex.styleguide' -import type { CustomReturnReasonTranslation } from 'obidev.obi-return-app' +import type { CustomReturnReasonTranslation } from 'vtex.return-app' import { FormattedMessage } from 'react-intl' import TENANT_INFO from './graphql/tenant.gql' diff --git a/react/admin/settings/components/ExcludedCategories.tsx b/react/admin/settings/components/ExcludedCategories.tsx index e56e053c4..4cf5255dc 100644 --- a/react/admin/settings/components/ExcludedCategories.tsx +++ b/react/admin/settings/components/ExcludedCategories.tsx @@ -2,7 +2,7 @@ import React, { useMemo } from 'react' import { useQuery } from 'react-apollo' import { useIntl, FormattedMessage } from 'react-intl' import { AutocompleteInput, IconWarning, IconDeny } from 'vtex.styleguide' -import type { CategoryInfo } from 'obidev.obi-return-app' +import type { CategoryInfo } from 'vtex.return-app' import GET_CATEGORY_TREE_INFO from '../graphql/getCategoryTreeName.gql' import { useSettings } from '../hooks/useSettings' diff --git a/react/admin/settings/components/PaymentOptions.tsx b/react/admin/settings/components/PaymentOptions.tsx index dc40370ed..5ac1e96a3 100644 --- a/react/admin/settings/components/PaymentOptions.tsx +++ b/react/admin/settings/components/PaymentOptions.tsx @@ -2,7 +2,7 @@ import type { ChangeEvent, ComponentPropsWithoutRef } from 'react' import React, { forwardRef } from 'react' import type { IntlShape } from 'react-intl' import { defineMessages, FormattedMessage, useIntl } from 'react-intl' -import type { PaymentType } from 'obidev.obi-return-app' +import type { PaymentType } from 'vtex.return-app' import { Toggle, CheckboxGroup } from 'vtex.styleguide' import { useSettings } from '../hooks/useSettings' diff --git a/react/admin/settings/graphql/getAppSettings.gql b/react/admin/settings/graphql/getAppSettings.gql index a66c2927e..f7bf76975 100644 --- a/react/admin/settings/graphql/getAppSettings.gql +++ b/react/admin/settings/graphql/getAppSettings.gql @@ -1,5 +1,5 @@ query returnAppSettings { - returnAppSettings @context(provider: "obidev.obi-return-app") { + returnAppSettings @context(provider: "vtex.return-app") { maxDays excludedCategories paymentOptions { diff --git a/react/admin/settings/graphql/getCategoryTreeName.gql b/react/admin/settings/graphql/getCategoryTreeName.gql index fa991d3f9..45eeca2f1 100644 --- a/react/admin/settings/graphql/getCategoryTreeName.gql +++ b/react/admin/settings/graphql/getCategoryTreeName.gql @@ -1,5 +1,5 @@ query categoryTreeName { - categoryTreeName @context(provider: "obidev.obi-return-app") { + categoryTreeName @context(provider: "vtex.return-app") { id name } diff --git a/react/admin/settings/graphql/saveAppSettings.gql b/react/admin/settings/graphql/saveAppSettings.gql index 218d3b32d..b8798e841 100644 --- a/react/admin/settings/graphql/saveAppSettings.gql +++ b/react/admin/settings/graphql/saveAppSettings.gql @@ -1,4 +1,4 @@ mutation saveAppSettings($settings: ReturnAppSettingsInput!) { saveReturnAppSettings(settings: $settings) - @context(provider: "obidev.obi-return-app") + @context(provider: "vtex.return-app") } diff --git a/react/admin/settings/provider/SettingsProvider.tsx b/react/admin/settings/provider/SettingsProvider.tsx index 22b78817c..a4532f830 100644 --- a/react/admin/settings/provider/SettingsProvider.tsx +++ b/react/admin/settings/provider/SettingsProvider.tsx @@ -3,7 +3,7 @@ import type { FC, Dispatch } from 'react' import React, { createContext, useReducer, useEffect } from 'react' import { useQuery, useMutation } from 'react-apollo' import { FormattedMessage } from 'react-intl' -import type { ReturnAppSettings, ReturnAppSettingsInput } from 'obidev.obi-return-app' +import type { ReturnAppSettings, ReturnAppSettingsInput } from 'vtex.return-app' import APP_SETTINGS from '../graphql/getAppSettings.gql' import SAVE_APP_SETTINGS from '../graphql/saveAppSettings.gql' diff --git a/react/admin/settings/provider/settingsReducer.ts b/react/admin/settings/provider/settingsReducer.ts index 55cd321cf..68e0063db 100644 --- a/react/admin/settings/provider/settingsReducer.ts +++ b/react/admin/settings/provider/settingsReducer.ts @@ -3,7 +3,7 @@ import type { PaymentOptions, ReturnAppSettings, ReturnOption, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' export const initialSettingsState: ReturnAppSettings = { maxDays: 0, diff --git a/react/common/components/RenderStatus.tsx b/react/common/components/RenderStatus.tsx index 12f9df2b5..80d3101de 100644 --- a/react/common/components/RenderStatus.tsx +++ b/react/common/components/RenderStatus.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { Status } from 'obidev.obi-return-app' +import type { Status } from 'vtex.return-app' import { FormattedMessage } from 'react-intl' import { IconClock, diff --git a/react/common/components/ReturnDetails/ItemDetails/ItemDetailsList.tsx b/react/common/components/ReturnDetails/ItemDetails/ItemDetailsList.tsx index 67ab83df7..ec26e5a35 100644 --- a/react/common/components/ReturnDetails/ItemDetails/ItemDetailsList.tsx +++ b/react/common/components/ReturnDetails/ItemDetails/ItemDetailsList.tsx @@ -5,7 +5,7 @@ import type { RefundData, Status, Maybe, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' import { useIntl } from 'react-intl' diff --git a/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx b/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx index 44720a3cd..0cd009200 100644 --- a/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx +++ b/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx @@ -2,7 +2,7 @@ import type { ReactElement } from 'react' import React from 'react' import type { IntlFormatters } from 'react-intl' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { ReturnRequestItem } from 'obidev.obi-return-app' +import type { ReturnRequestItem } from 'vtex.return-app' import type { ItemStatusInterface } from './ItemDetailsList' import { AlignItemRight } from '../../../../admin/ReturnDetails/components/AlignItemRight' diff --git a/react/common/components/ReturnDetails/RefundMethodDetail.tsx b/react/common/components/ReturnDetails/RefundMethodDetail.tsx index 652f5f4ea..7fc1078a4 100644 --- a/react/common/components/ReturnDetails/RefundMethodDetail.tsx +++ b/react/common/components/ReturnDetails/RefundMethodDetail.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage, FormattedNumber } from 'react-intl' -import type { GiftCard, Maybe, RefundPaymentData } from 'obidev.obi-return-app' +import type { GiftCard, Maybe, RefundPaymentData } from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/common/components/ReturnDetails/StatusTimeline/CommentList.tsx b/react/common/components/ReturnDetails/StatusTimeline/CommentList.tsx index 00092c8a8..9d7c7c1be 100644 --- a/react/common/components/ReturnDetails/StatusTimeline/CommentList.tsx +++ b/react/common/components/ReturnDetails/StatusTimeline/CommentList.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { RefundStatusComment, UserRole } from 'obidev.obi-return-app' +import type { RefundStatusComment, UserRole } from 'vtex.return-app' import { useRuntime } from 'vtex.render-runtime' import { FormattedMessage } from 'react-intl' import { Tag } from 'vtex.styleguide' diff --git a/react/common/components/ReturnDetails/StatusTimeline/StatusTag.tsx b/react/common/components/ReturnDetails/StatusTimeline/StatusTag.tsx index c47e78905..90a472aaf 100644 --- a/react/common/components/ReturnDetails/StatusTimeline/StatusTag.tsx +++ b/react/common/components/ReturnDetails/StatusTimeline/StatusTag.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { Status } from 'obidev.obi-return-app' +import type { Status } from 'vtex.return-app' import { IconSuccess, IconClear } from 'vtex.styleguide' import { useIntl } from 'react-intl' diff --git a/react/common/components/returnList/ListTableFilter.tsx b/react/common/components/returnList/ListTableFilter.tsx index acb6185bc..0f7d1e47f 100644 --- a/react/common/components/returnList/ListTableFilter.tsx +++ b/react/common/components/returnList/ListTableFilter.tsx @@ -6,7 +6,7 @@ import type { QueryReturnRequestListArgs, ReturnRequestList, Status, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import type { ApolloQueryResult } from 'apollo-client' import { useRuntime } from 'vtex.render-runtime' import { useCssHandles } from 'vtex.css-handles' diff --git a/react/common/components/returnList/StatusActionMenu.tsx b/react/common/components/returnList/StatusActionMenu.tsx index c649f74a4..6a62b6f5d 100644 --- a/react/common/components/returnList/StatusActionMenu.tsx +++ b/react/common/components/returnList/StatusActionMenu.tsx @@ -1,6 +1,6 @@ import React from 'react' import { defineMessages, useIntl } from 'react-intl' -import type { Status } from 'obidev.obi-return-app' +import type { Status } from 'vtex.return-app' import { ActionMenu } from 'vtex.styleguide' import type { FilterKeys } from './ListTableFilter' diff --git a/react/common/graphql/getRequestDetails.gql b/react/common/graphql/getRequestDetails.gql index 085174e16..2f5d49544 100644 --- a/react/common/graphql/getRequestDetails.gql +++ b/react/common/graphql/getRequestDetails.gql @@ -2,7 +2,7 @@ query getRequestDetails($requestId: ID!) { returnRequestDetails: returnRequest(requestId: $requestId) - @context(provider: "obidev.obi-return-app") { + @context(provider: "vtex.return-app") { ...ReturnDetailsAdminFragment } } diff --git a/react/common/provider/ReturnDetailsProvider.tsx b/react/common/provider/ReturnDetailsProvider.tsx index 39c9a5380..c8bd2d212 100644 --- a/react/common/provider/ReturnDetailsProvider.tsx +++ b/react/common/provider/ReturnDetailsProvider.tsx @@ -5,7 +5,7 @@ import { useQuery } from 'react-apollo' import type { ReturnRequestResponse, QueryReturnRequestArgs, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import GET_REQUEST_DETAILS from '../graphql/getRequestDetails.gql' diff --git a/react/graphql/getReturnRequestList.gql b/react/graphql/getReturnRequestList.gql index 78ec4498a..27b8feaa8 100644 --- a/react/graphql/getReturnRequestList.gql +++ b/react/graphql/getReturnRequestList.gql @@ -1,6 +1,6 @@ query getReturnRequestList($filter: ReturnRequestFilters, $page: Int!) { returnRequestList(filter: $filter, page: $page) - @context(provider: "obidev.obi-return-app") { + @context(provider: "vtex.return-app") { list { id sequenceNumber diff --git a/react/hooks/useReturnRequestList.ts b/react/hooks/useReturnRequestList.ts index 8e391f863..ef958c40b 100644 --- a/react/hooks/useReturnRequestList.ts +++ b/react/hooks/useReturnRequestList.ts @@ -2,7 +2,7 @@ import { useQuery } from 'react-apollo' import type { ReturnRequestList as ReturnRequestListResponse, QueryReturnRequestListArgs, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import RETURN_REQUEST_LIST from '../graphql/getReturnRequestList.gql' diff --git a/react/package.json b/react/package.json index 4fd18518f..39181e108 100644 --- a/react/package.json +++ b/react/package.json @@ -25,7 +25,6 @@ "@types/react-router": "^5.1.18", "@vtex/test-tools": "^0.3.2", "@vtex/tsconfig": "^0.6.0", - "obidev.obi-return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app", "prop-types": "^15.7.2", "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", @@ -34,6 +33,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", + "vtex.return-app": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/react/store/createReturnRequest/CreateReturnRequest.tsx b/react/store/createReturnRequest/CreateReturnRequest.tsx index 859699406..3dfa71844 100644 --- a/react/store/createReturnRequest/CreateReturnRequest.tsx +++ b/react/store/createReturnRequest/CreateReturnRequest.tsx @@ -4,7 +4,7 @@ import { useQuery } from 'react-apollo' import type { OrderToReturnSummary, QueryOrderToReturnSummaryArgs, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { PageHeader, PageBlock } from 'vtex.styleguide' import { FormattedMessage } from 'react-intl' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/OrderListContainer.tsx b/react/store/createReturnRequest/OrderListContainer.tsx index fb3568ad8..bab24c031 100644 --- a/react/store/createReturnRequest/OrderListContainer.tsx +++ b/react/store/createReturnRequest/OrderListContainer.tsx @@ -3,7 +3,7 @@ import { useQuery } from 'react-apollo' import type { OrdersToReturnList, QueryOrdersAvailableToReturnArgs, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { ContentWrapper, BaseLoading } from 'vtex.my-account-commons' import { FormattedMessage } from 'react-intl' diff --git a/react/store/createReturnRequest/components/AddressDetails.tsx b/react/store/createReturnRequest/components/AddressDetails.tsx index a6e4600e8..60f8436b7 100644 --- a/react/store/createReturnRequest/components/AddressDetails.tsx +++ b/react/store/createReturnRequest/components/AddressDetails.tsx @@ -2,7 +2,7 @@ import React, { useState } from 'react' import type { ChangeEvent } from 'react' import { useIntl, defineMessages, FormattedMessage } from 'react-intl' import { Input, Tooltip, Toggle, IconInfo } from 'vtex.styleguide' -import type { AddressType, ShippingData } from 'obidev.obi-return-app' +import type { AddressType, ShippingData } from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { useReturnRequest } from '../../hooks/useReturnRequest' diff --git a/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx b/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx index b3afa406f..199465734 100644 --- a/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx +++ b/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx @@ -5,7 +5,7 @@ import { useRuntime } from 'vtex.render-runtime' import type { MutationCreateReturnRequestArgs, ReturnRequestCreated, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { Card, Button, Alert } from 'vtex.styleguide' diff --git a/react/store/createReturnRequest/components/ConfirmContactDetails.tsx b/react/store/createReturnRequest/components/ConfirmContactDetails.tsx index bdc81301b..b5070d13b 100644 --- a/react/store/createReturnRequest/components/ConfirmContactDetails.tsx +++ b/react/store/createReturnRequest/components/ConfirmContactDetails.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage } from 'react-intl' -import type { CustomerProfileDataInput } from 'obidev.obi-return-app' +import type { CustomerProfileDataInput } from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx b/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx index fdfccf38f..45b0a8ba5 100644 --- a/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx +++ b/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage, useIntl } from 'react-intl' -import type { RefundPaymentDataInput } from 'obidev.obi-return-app' +import type { RefundPaymentDataInput } from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx b/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx index 6d08c44e4..5bd3e6413 100644 --- a/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx +++ b/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage } from 'react-intl' -import type { PickupReturnDataInput } from 'obidev.obi-return-app' +import type { PickupReturnDataInput } from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/components/ItemsDetails.tsx b/react/store/createReturnRequest/components/ItemsDetails.tsx index f58fbc930..86170c24a 100644 --- a/react/store/createReturnRequest/components/ItemsDetails.tsx +++ b/react/store/createReturnRequest/components/ItemsDetails.tsx @@ -1,5 +1,5 @@ import React from 'react' -import type { ItemCondition } from 'obidev.obi-return-app' +import type { ItemCondition } from 'vtex.return-app' import { NumericStepper } from 'vtex.styleguide' import { useCssHandles } from 'vtex.css-handles' import { FormattedMessage } from 'react-intl' diff --git a/react/store/createReturnRequest/components/OrderList.tsx b/react/store/createReturnRequest/components/OrderList.tsx index 3c6ca448a..523b99de4 100644 --- a/react/store/createReturnRequest/components/OrderList.tsx +++ b/react/store/createReturnRequest/components/OrderList.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react' -import type { OrdersToReturnList, OrderToReturnSummary } from 'obidev.obi-return-app' +import type { OrdersToReturnList, OrderToReturnSummary } from 'vtex.return-app' import { FormattedMessage, FormattedDate } from 'react-intl' import { useRuntime } from 'vtex.render-runtime/' import { Table, Button } from 'vtex.styleguide' diff --git a/react/store/createReturnRequest/components/PaymentMethods.tsx b/react/store/createReturnRequest/components/PaymentMethods.tsx index fa71e38d1..5f9fce122 100644 --- a/react/store/createReturnRequest/components/PaymentMethods.tsx +++ b/react/store/createReturnRequest/components/PaymentMethods.tsx @@ -6,7 +6,7 @@ import type { RefundPaymentDataInput, PaymentType, RefundPaymentMethod, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { Input, RadioGroup } from 'vtex.styleguide' import { useStoreSettings } from '../../hooks/useStoreSettings' diff --git a/react/store/createReturnRequest/components/PickupPointSelector.tsx b/react/store/createReturnRequest/components/PickupPointSelector.tsx index e0d7149de..b8c93efc8 100644 --- a/react/store/createReturnRequest/components/PickupPointSelector.tsx +++ b/react/store/createReturnRequest/components/PickupPointSelector.tsx @@ -5,7 +5,7 @@ import type { QueryNearestPickupPointsArgs, NearPickupPointQueryResponse, PickupPoint, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { Dropdown, Spinner } from 'vtex.styleguide' import { FormattedMessage } from 'react-intl' diff --git a/react/store/createReturnRequest/components/RenderConditionDropdown.tsx b/react/store/createReturnRequest/components/RenderConditionDropdown.tsx index 8383a039f..2a2759160 100644 --- a/react/store/createReturnRequest/components/RenderConditionDropdown.tsx +++ b/react/store/createReturnRequest/components/RenderConditionDropdown.tsx @@ -1,7 +1,7 @@ import type { ChangeEvent } from 'react' import React from 'react' import { useIntl } from 'react-intl' -import type { ItemCondition } from 'obidev.obi-return-app' +import type { ItemCondition } from 'vtex.return-app' import { Dropdown } from 'vtex.styleguide' import { useCssHandles } from 'vtex.css-handles' diff --git a/react/store/createReturnRequest/components/ReturnDetails.tsx b/react/store/createReturnRequest/components/ReturnDetails.tsx index 356702b51..601f2b26d 100644 --- a/react/store/createReturnRequest/components/ReturnDetails.tsx +++ b/react/store/createReturnRequest/components/ReturnDetails.tsx @@ -1,7 +1,7 @@ import React from 'react' import { FormattedDate, FormattedMessage } from 'react-intl' import type { RouteComponentProps } from 'react-router' -import type { ShippingData } from 'obidev.obi-return-app' +import type { ShippingData } from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { Divider, Button } from 'vtex.styleguide' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/components/ReturnInformationTable.tsx b/react/store/createReturnRequest/components/ReturnInformationTable.tsx index 54fe77a71..6ddaf35d2 100644 --- a/react/store/createReturnRequest/components/ReturnInformationTable.tsx +++ b/react/store/createReturnRequest/components/ReturnInformationTable.tsx @@ -1,6 +1,6 @@ import React from 'react' import { FormattedMessage, useIntl } from 'react-intl' -import type { ReturnRequestItemInput } from 'obidev.obi-return-app' +import type { ReturnRequestItemInput } from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { useRuntime } from 'vtex.render-runtime' diff --git a/react/store/createReturnRequest/graphql/createReturnRequest.gql b/react/store/createReturnRequest/graphql/createReturnRequest.gql index 9b2aaafaf..44cb187a7 100644 --- a/react/store/createReturnRequest/graphql/createReturnRequest.gql +++ b/react/store/createReturnRequest/graphql/createReturnRequest.gql @@ -1,6 +1,6 @@ mutation CreateReturn($returnRequest: ReturnRequestInput!) { createReturnRequest(returnRequest: $returnRequest) - @context(provider: "obidev.obi-return-app") { + @context(provider: "vtex.return-app") { returnRequestId } } diff --git a/react/store/createReturnRequest/graphql/getGeoCoordinates.gql b/react/store/createReturnRequest/graphql/getGeoCoordinates.gql index c5b5a2044..d6b28de8b 100644 --- a/react/store/createReturnRequest/graphql/getGeoCoordinates.gql +++ b/react/store/createReturnRequest/graphql/getGeoCoordinates.gql @@ -1,6 +1,6 @@ query getGeoCoordinates($orderId: ID!) { orderToReturnSummary(orderId: $orderId) - @context(provider: "obidev.obi-return-app") { + @context(provider: "vtex.return-app") { shippingData { geoCoordinates } diff --git a/react/store/createReturnRequest/graphql/getOrderToReturnSummary.gql b/react/store/createReturnRequest/graphql/getOrderToReturnSummary.gql index 6a405c404..553d27d86 100644 --- a/react/store/createReturnRequest/graphql/getOrderToReturnSummary.gql +++ b/react/store/createReturnRequest/graphql/getOrderToReturnSummary.gql @@ -1,6 +1,6 @@ query orderToReturnSummary($orderId: ID!) { orderToReturnSummary(orderId: $orderId) - @context(provider: "obidev.obi-return-app") { + @context(provider: "vtex.return-app") { orderId creationDate invoicedItems { diff --git a/react/store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql b/react/store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql index ddf179ac8..38907a3e9 100644 --- a/react/store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql +++ b/react/store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql @@ -1,5 +1,5 @@ query ordersAvailableToReturn($page: Int!) { - ordersAvailableToReturn(page: $page) @context(provider: "obidev.obi-return-app") { + ordersAvailableToReturn(page: $page) @context(provider: "vtex.return-app") { list { orderId creationDate diff --git a/react/store/createReturnRequest/graphql/nearestPickupPoints.gql b/react/store/createReturnRequest/graphql/nearestPickupPoints.gql index bdc4133b2..a7676bbe5 100644 --- a/react/store/createReturnRequest/graphql/nearestPickupPoints.gql +++ b/react/store/createReturnRequest/graphql/nearestPickupPoints.gql @@ -1,6 +1,6 @@ query nearestPickupPoints($lat: String!, $long: String!) { nearestPickupPoints(lat: $lat, long: $long) - @context(provider: "obidev.obi-return-app") { + @context(provider: "vtex.return-app") { items { pickupPoint { friendlyName diff --git a/react/store/graphql/getStoreSettings.gql b/react/store/graphql/getStoreSettings.gql index eb840b938..7b655a3f8 100644 --- a/react/store/graphql/getStoreSettings.gql +++ b/react/store/graphql/getStoreSettings.gql @@ -1,5 +1,5 @@ query storeAppSettings { - returnAppSettings @context(provider: "obidev.obi-return-app") { + returnAppSettings @context(provider: "vtex.return-app") { termsUrl customReturnReasons { reason diff --git a/react/store/provider/OrderToReturnReducer.ts b/react/store/provider/OrderToReturnReducer.ts index 71aa45ca5..4ceebfa56 100644 --- a/react/store/provider/OrderToReturnReducer.ts +++ b/react/store/provider/OrderToReturnReducer.ts @@ -4,7 +4,7 @@ import type { RefundPaymentDataInput, ReturnRequestItemInput, Maybe, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' type PartialBy = Omit & Partial> diff --git a/react/store/provider/StoreSettingsProvider.tsx b/react/store/provider/StoreSettingsProvider.tsx index 709bd45c1..31ece748e 100644 --- a/react/store/provider/StoreSettingsProvider.tsx +++ b/react/store/provider/StoreSettingsProvider.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react' import React, { createContext, useState } from 'react' import { useQuery } from 'react-apollo' import { FormattedMessage } from 'react-intl' -import type { ReturnAppSettings } from 'obidev.obi-return-app' +import type { ReturnAppSettings } from 'vtex.return-app' import { Alert } from 'vtex.styleguide' import STORE_SETTING from '../graphql/getStoreSettings.gql' diff --git a/react/store/utils/constants.ts b/react/store/utils/constants.ts index 4fb330bbc..044e2789e 100644 --- a/react/store/utils/constants.ts +++ b/react/store/utils/constants.ts @@ -1,4 +1,4 @@ -import type { OrderToReturnValidation } from 'obidev.obi-return-app' +import type { OrderToReturnValidation } from 'vtex.return-app' export const ORDER_TO_RETURN_VALIDATON: Record< OrderToReturnValidation, diff --git a/react/store/utils/createItemsSummary.ts b/react/store/utils/createItemsSummary.ts index ce99125c3..6cf1ff3ef 100644 --- a/react/store/utils/createItemsSummary.ts +++ b/react/store/utils/createItemsSummary.ts @@ -1,4 +1,4 @@ -import type { OrderToReturnSummary } from 'obidev.obi-return-app' +import type { OrderToReturnSummary } from 'vtex.return-app' import { formatItemsToReturn } from './formatItemsToReturn' diff --git a/react/store/utils/formatItemsToReturn.ts b/react/store/utils/formatItemsToReturn.ts index 70169e5eb..8dcb2812b 100644 --- a/react/store/utils/formatItemsToReturn.ts +++ b/react/store/utils/formatItemsToReturn.ts @@ -1,4 +1,4 @@ -import type { OrderToReturnSummary } from 'obidev.obi-return-app' +import type { OrderToReturnSummary } from 'vtex.return-app' export function formatItemsToReturn( orderToReturn: OrderToReturnSummary diff --git a/react/store/utils/generateCustomReasonOptions.ts b/react/store/utils/generateCustomReasonOptions.ts index 38074f56f..6baa5a356 100644 --- a/react/store/utils/generateCustomReasonOptions.ts +++ b/react/store/utils/generateCustomReasonOptions.ts @@ -1,4 +1,4 @@ -import type { CustomReturnReason } from 'obidev.obi-return-app' +import type { CustomReturnReason } from 'vtex.return-app' import { isWithinMaxDaysToReturn } from '../../../node/utils/dateHelpers' diff --git a/react/store/utils/parseReturnRequestError.ts b/react/store/utils/parseReturnRequestError.ts index 75173d535..177747032 100644 --- a/react/store/utils/parseReturnRequestError.ts +++ b/react/store/utils/parseReturnRequestError.ts @@ -1,6 +1,6 @@ import type { ApolloError } from 'apollo-client' import { defineMessages } from 'react-intl' -import type { OrderToReturnValidation } from 'obidev.obi-return-app' +import type { OrderToReturnValidation } from 'vtex.return-app' import { ORDER_TO_RETURN_VALIDATON } from './constants' diff --git a/react/store/utils/setInitialPickupAddress.ts b/react/store/utils/setInitialPickupAddress.ts index 672b9795d..c9e584176 100644 --- a/react/store/utils/setInitialPickupAddress.ts +++ b/react/store/utils/setInitialPickupAddress.ts @@ -1,4 +1,4 @@ -import type { ShippingData } from 'obidev.obi-return-app' +import type { ShippingData } from 'vtex.return-app' import type { OrderDetailsState } from '../provider/OrderToReturnReducer' diff --git a/react/store/utils/validateNewReturnRequestFields.ts b/react/store/utils/validateNewReturnRequestFields.ts index 0cc5934aa..c6c8cb595 100644 --- a/react/store/utils/validateNewReturnRequestFields.ts +++ b/react/store/utils/validateNewReturnRequestFields.ts @@ -1,7 +1,7 @@ import type { ReturnRequestItemInput, ReturnRequestInput, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import type { OrderDetailsState } from '../provider/OrderToReturnReducer' import { isValidIBANNumber } from './isValidIBANNumber' diff --git a/react/utils/requestStatus.ts b/react/utils/requestStatus.ts index bb1159468..cee799ee2 100644 --- a/react/utils/requestStatus.ts +++ b/react/utils/requestStatus.ts @@ -2,7 +2,7 @@ import type { Status, RefundStatusData, RefundStatusComment, -} from 'obidev.obi-return-app' +} from 'vtex.return-app' import { defineMessages } from 'react-intl' const statusSequence: Status[] = [ diff --git a/react/yarn.lock b/react/yarn.lock index 4d4cd004e..7041e69be 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -3946,10 +3946,6 @@ oauth-sign@~0.9.0: resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== -"obidev.obi-return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app": - version "0.0.1" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/obidev.obi-return-app@0.0.1+build1677516652/public/@types/obidev.obi-return-app#0dfffb76a73d3c034412acc546740a002e9fb827" - object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -5210,6 +5206,10 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" +"vtex.return-app@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app": + version "3.5.6" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app#11353347392aa168c3b0fe16496b70448f4a840b" + "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" From 6a82d4e738adae3b964dc9010b37ae001fff8c3c Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Mon, 27 Feb 2023 17:07:08 -0500 Subject: [PATCH 03/81] added field 'sellerName' on MasterData --- masterdata/returnRequest/schema.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/masterdata/returnRequest/schema.json b/masterdata/returnRequest/schema.json index 1b3a06b2b..4405baa98 100644 --- a/masterdata/returnRequest/schema.json +++ b/masterdata/returnRequest/schema.json @@ -3,6 +3,9 @@ "orderId": { "type": "string" }, + "sellerName": { + "type": "string" + }, "refundableAmount": { "type": "integer" }, From 9866e7fc48e6fd5ec3c478c854f2b7e9fe8aa191 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Wed, 1 Mar 2023 15:26:29 -0500 Subject: [PATCH 04/81] added support for create, update and get return request with field seller name --- graphql/schema.graphql | 1 + graphql/types/ReturnRequest.graphql | 3 +++ masterdata/returnRequest/schema.json | 6 ++++-- messages/bg.json | 2 ++ messages/context.json | 2 ++ messages/en.json | 2 ++ messages/es.json | 2 ++ messages/fr.json | 2 ++ messages/it.json | 1 + messages/nl.json | 1 + messages/pt.json | 2 ++ messages/ro.json | 1 + messages/th.json | 1 + node/middlewares/getRequestList.ts | 2 ++ node/middlewares/updateRequestStatus.ts | 2 +- node/package.json | 2 +- node/services/createReturnRequestService.ts | 2 ++ node/services/returnRequestListService.ts | 9 ++++++++- node/services/updateRequestStatusService.ts | 3 ++- node/yarn.lock | 4 ++-- .../ReturnDetails/CurrentRequestStatus.tsx | 8 +++++++- .../components/returnList/ListTableFilter.tsx | 17 +++++++++++++++++ .../components/returnList/ListTableSchema.tsx | 6 ++++++ react/common/graphql/returnDetailsFragment.gql | 1 + react/graphql/getReturnRequestList.gql | 1 + react/package.json | 2 +- react/yarn.lock | 4 ++-- 27 files changed, 77 insertions(+), 12 deletions(-) diff --git a/graphql/schema.graphql b/graphql/schema.graphql index a99d4aafb..e2926e9de 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -38,6 +38,7 @@ type Mutation { saveReturnAppSettings(settings: ReturnAppSettingsInput!): Boolean updateReturnRequestStatus( requestId: ID! + sellerName: String status: Status! comment: ReturnRequestCommentInput refundData: RefundDataInput diff --git a/graphql/types/ReturnRequest.graphql b/graphql/types/ReturnRequest.graphql index 7ae4911d0..50d67f97f 100644 --- a/graphql/types/ReturnRequest.graphql +++ b/graphql/types/ReturnRequest.graphql @@ -1,5 +1,6 @@ input ReturnRequestInput { orderId: String! + sellerName: String items: [ReturnRequestItemInput!]! customerProfileData: CustomerProfileDataInput! pickupReturnData: PickupReturnDataInput! @@ -67,6 +68,7 @@ enum RefundPaymentMethod { type ReturnRequestResponse { id: ID! + sellerName: String orderId: String! refundableAmount: Int! sequenceNumber: String! @@ -186,6 +188,7 @@ input ReturnRequestFilters { status: Status sequenceNumber: String id: String + sellerName: String """ createdIn: It uses the field dateSubmitted in the return request schema to search for documents. The field createdIn is auto generated when the document is created, not reflecting the real value for documents migrated from older versions. diff --git a/masterdata/returnRequest/schema.json b/masterdata/returnRequest/schema.json index 4405baa98..7569cc260 100644 --- a/masterdata/returnRequest/schema.json +++ b/masterdata/returnRequest/schema.json @@ -303,7 +303,8 @@ "orderId", "sequenceNumber", "dateSubmitted", - "status" + "status", + "sellerName" ], "v-indexed": [ "id", @@ -312,7 +313,8 @@ "customerProfileData", "status", "sequenceNumber", - "dateSubmitted" + "dateSubmitted", + "sellerName" ], "v-immediate-indexing": true } diff --git a/messages/bg.json b/messages/bg.json index 0542664c6..6af69dbfa 100644 --- a/messages/bg.json +++ b/messages/bg.json @@ -278,6 +278,7 @@ "return-app.return-request-list.table-data.requestId": "ИД на заявката", "return-app.return-request-list.table-data.sequenceNumber": "Номер на поредността", "return-app.return-request-list.table-data.orderId": "ИД на поръчка", + "return-app.return-request-list.table-data.sellerName": "Seller Name", "return-app.return-request-list.table-data.createdDate": "Дата на създаване", "return-app.return-request-list.table-data.status": "Статус", "return-app.return-request-list.table-filters.fromDate": "От дата", @@ -307,6 +308,7 @@ "return-app.return-request-details.order-id.link": "Поръчка {orderId}", "return-app.return-request-details.current-status.request-id": "ИД на заявката: {id}", "return-app.return-request-details.current-status.status": "Статус:", + "return-app.return-request-details.current-status.sellerName": "SellerName: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "Клиентите виждат ИД на заявката си вътре в подробностите за заявката", "admin/return-app.settings.modal-warning.title": "Моля, прегледайте настройките си", "admin/return-app.settings.modal-warning.first-paragraph": "Изглежда се опитвате да запазите персонализирани опции за връщане, никоя от които не достига {maxDays}. Това е максималният набор дни за връщане.", diff --git a/messages/context.json b/messages/context.json index 428dda41d..d49f77298 100644 --- a/messages/context.json +++ b/messages/context.json @@ -279,6 +279,7 @@ "return-app.return-request-list.table-data.requestId": "Data title of a return request: id", "return-app.return-request-list.table-data.sequenceNumber": "Data title of a return request: sequence number", "return-app.return-request-list.table-data.orderId": "Data title of a return request: order id", + "return-app.return-request-list.table-data.sellerName": "Data title of a return request: seller name", "return-app.return-request-list.table-data.createdDate": "Data title of a return request: created date", "return-app.return-request-list.table-data.status": "Data title of a return request: status", "return-app.return-request-list.table-filters.fromDate": "Filter placeholder: from date", @@ -308,6 +309,7 @@ "return-app.return-request-details.order-id.link": "Order {orderId}", "return-app.return-request-details.current-status.request-id": "Request id: {id}", "return-app.return-request-details.current-status.status": "Status:", + "return-app.return-request-details.current-status.sellerName": "SellerName: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "Tooltip with an explanation of how the customer can access the data", "admin/return-app.settings.modal-warning.title": "Title of a modal to warn about max days settings", "admin/return-app.settings.modal-warning.first-paragraph": "First parahraph describing the warning", diff --git a/messages/en.json b/messages/en.json index 03bbc0c2f..c57be32af 100644 --- a/messages/en.json +++ b/messages/en.json @@ -279,6 +279,7 @@ "return-app.return-request-list.table-data.requestId": "Request ID", "return-app.return-request-list.table-data.sequenceNumber": "Sequence Number", "return-app.return-request-list.table-data.orderId": "Order ID", + "return-app.return-request-list.table-data.sellerName": "Seller Name", "return-app.return-request-list.table-data.createdDate": "Created Date", "return-app.return-request-list.table-data.status": "Status", "return-app.return-request-list.table-filters.fromDate": "From date", @@ -308,6 +309,7 @@ "return-app.return-request-details.order-id.link": "Order {orderId}", "return-app.return-request-details.current-status.request-id": "Request ID: {id}", "return-app.return-request-details.current-status.status": "Status:", + "return-app.return-request-details.current-status.sellerName": "SellerName: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "Customers can see their request ID inside the request details", "admin/return-app.settings.modal-warning.title": "Please review your settings", "admin/return-app.settings.modal-warning.first-paragraph": "It looks like you are trying to save custom return options, none of which reach {maxDays}. This is the maximum days set for a return.", diff --git a/messages/es.json b/messages/es.json index f2d4f05a8..11bfa8e4e 100644 --- a/messages/es.json +++ b/messages/es.json @@ -278,6 +278,7 @@ "return-app.return-request-list.table-data.requestId": "ID de la solicitud", "return-app.return-request-list.table-data.sequenceNumber": "Número de secuencia", "return-app.return-request-list.table-data.orderId": "ID del pedido", + "return-app.return-request-list.table-data.sellerName": "Vendedor", "return-app.return-request-list.table-data.createdDate": "Fecha de creación", "return-app.return-request-list.table-data.status": "Status", "return-app.return-request-list.table-filters.fromDate": "Desde", @@ -307,6 +308,7 @@ "return-app.return-request-details.order-id.link": "Pedido {orderId}", "return-app.return-request-details.current-status.request-id": "ID de la solicitud: {id}", "return-app.return-request-details.current-status.status": "Status:", + "return-app.return-request-details.current-status.sellerName": "Vendedor: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "Los clientes pueden ver el ID de la solicitud en los detalles de la solicitud", "admin/return-app.settings.modal-warning.title": "Por favor, revisa tu configuración", "admin/return-app.settings.modal-warning.first-paragraph": "Parece que estás intentando guardar opciones de devolución personalizadas, ninguna que llegue a {maxDays}. Este es el plazo máximo en días para solicitar una devolución.", diff --git a/messages/fr.json b/messages/fr.json index ebcda77c2..2f95d0996 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -278,6 +278,7 @@ "return-app.return-request-list.table-data.requestId": "Demander une référence", "return-app.return-request-list.table-data.sequenceNumber": "Numéro de séquence", "return-app.return-request-list.table-data.orderId": "ID de commande", + "return-app.return-request-list.table-data.sellerName": "Nom du Vendeur", "return-app.return-request-list.table-data.createdDate": "Date de création", "return-app.return-request-list.table-data.status": "Statut", "return-app.return-request-list.table-filters.fromDate": "À partir de", @@ -307,6 +308,7 @@ "return-app.return-request-details.order-id.link": "Commande {orderId}", "return-app.return-request-details.current-status.request-id": "ID de la requête : {id}", "return-app.return-request-details.current-status.status": "Statut :", + "return-app.return-request-details.current-status.sellerName": "SellerName: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "Les clients peuvent voir leur ID de demande dans les détails de la demande", "admin/return-app.settings.modal-warning.title": "Veuillez vérifier vos paramètres", "admin/return-app.settings.modal-warning.first-paragraph": "Il semble que vous essayez d’enregistrer les options de retour personnalisées, dont aucune n’atteint {maxDays}. Ceci est le nombre maximum de jours définis pour une déclaration.", diff --git a/messages/it.json b/messages/it.json index 4380fe542..39881fd88 100644 --- a/messages/it.json +++ b/messages/it.json @@ -278,6 +278,7 @@ "return-app.return-request-list.table-data.requestId": "ID richiesta", "return-app.return-request-list.table-data.sequenceNumber": "Numero sequenziale", "return-app.return-request-list.table-data.orderId": "ID ordine", + "return-app.return-request-list.table-data.sellerName": "Nome venditore", "return-app.return-request-list.table-data.createdDate": "Data di creazione", "return-app.return-request-list.table-data.status": "Stato", "return-app.return-request-list.table-filters.fromDate": "Dal", diff --git a/messages/nl.json b/messages/nl.json index d67956c80..a9e38bf80 100644 --- a/messages/nl.json +++ b/messages/nl.json @@ -307,6 +307,7 @@ "return-app.return-request-details.order-id.link": "Bestelling {orderId}\"", "return-app.return-request-details.current-status.request-id": "Aanvraag-ID: {id}", "return-app.return-request-details.current-status.status": "Status:", + "return-app.return-request-details.current-status.sellerName": "SellerName: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "Klanten kunnen hun aanvraag-ID zien in de aanvraaggegevens", "admin/return-app.settings.modal-warning.title": "Controleer uw instellingen", "admin/return-app.settings.modal-warning.first-paragraph": "Het lijkt erop dat u probeert de aangepaste retouropties op te slaan, waarvan er geen alle {maxDays} bereiken. Dit is het maximum aantal dagen voor een retouraanvraag.", diff --git a/messages/pt.json b/messages/pt.json index a415fd4b0..f24ce3fbd 100644 --- a/messages/pt.json +++ b/messages/pt.json @@ -278,6 +278,7 @@ "return-app.return-request-list.table-data.requestId": "ID da solicitação", "return-app.return-request-list.table-data.sequenceNumber": "Número sequencial", "return-app.return-request-list.table-data.orderId": "ID do pedido", + "return-app.return-request-list.table-data.sellerName": "Nome do Vendedor", "return-app.return-request-list.table-data.createdDate": "Data de criação", "return-app.return-request-list.table-data.status": "Status", "return-app.return-request-list.table-filters.fromDate": "De", @@ -307,6 +308,7 @@ "return-app.return-request-details.order-id.link": "Pedido {orderId}", "return-app.return-request-details.current-status.request-id": "ID da solicitação: {id}", "return-app.return-request-details.current-status.status": "Status:", + "return-app.return-request-details.current-status.sellerName": "SellerName: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "Os clientes podem ver o ID da solicitação nos dados da própria solicitação", "admin/return-app.settings.modal-warning.title": "Por favor, verifique suas configurações", "admin/return-app.settings.modal-warning.first-paragraph": "Parece que você está tentando salvar opções personalizadas de devolução, nenhuma que chegue a {maxDays}. Este é o prazo máximo em dias para solicitar uma devolução.", diff --git a/messages/ro.json b/messages/ro.json index 21e979f33..0df22f8ac 100644 --- a/messages/ro.json +++ b/messages/ro.json @@ -307,6 +307,7 @@ "return-app.return-request-details.order-id.link": "Comanda {orderId}", "return-app.return-request-details.current-status.request-id": "ID cerere: {id}", "return-app.return-request-details.current-status.status": "Status:", + "return-app.return-request-details.current-status.sellerName": "SellerName: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "Clienții pot vedea ID-ul cererii în detaliile acesteia", "admin/return-app.settings.modal-warning.title": "Te rugăm să îți verifici setările", "admin/return-app.settings.modal-warning.first-paragraph": "Se pare că încerci să salvezi opțiuni de retur personalizate, dintre care niciuna dintre ele nu ajunge la {maxDays}; ziua maximă prevăzută pentru retur.", diff --git a/messages/th.json b/messages/th.json index 2ec1aba28..c9bc8e39d 100644 --- a/messages/th.json +++ b/messages/th.json @@ -307,6 +307,7 @@ "return-app.return-request-details.order-id.link": "คำสั่ง {orderId}", "return-app.return-request-details.current-status.request-id": "รหัสอ้างอิง: {id}", "return-app.return-request-details.current-status.status": "สถานะ:", + "return-app.return-request-details.current-status.sellerName": "SellerName: {sellerName}", "admin/return-app.return-request-list.table-data.requestId.tooltip": "ลูกค้าสามารถมองเห็นรหัสคำขอของตนได้ในรายละเอียดคำสั่งซื้อ", "admin/return-app.settings.modal-warning.title": "โปรดทบทวนการตั้งค่าของงคุณ", "admin/return-app.settings.modal-warning.first-paragraph": "ดูเหมือนว่าคุณกำลังพยายามบันทึกตัวเลือกการคืนแบบกำหนดเองและยังไม่มีตัวใดถึง {maxDays} ซึ่งเป็นจำนวนวันสูงสุดที่กำหนดไว้สำหรับการคืน", diff --git a/node/middlewares/getRequestList.ts b/node/middlewares/getRequestList.ts index 86342c8c1..f60603842 100644 --- a/node/middlewares/getRequestList.ts +++ b/node/middlewares/getRequestList.ts @@ -15,6 +15,7 @@ export async function getRequestList(ctx: Context) { _orderId, _userEmail, _allFields, + _sellerName } = query const [from, to] = (_dateSubmitted as string | undefined)?.split(',') ?? [] @@ -35,6 +36,7 @@ export async function getRequestList(ctx: Context) { createdIn: _dateSubmitted ? { from, to } : undefined, orderId: _orderId as string | undefined, userEmail: _userEmail as string | undefined, + sellerName: _sellerName as string | undefined, }, }, getAllFields diff --git a/node/middlewares/updateRequestStatus.ts b/node/middlewares/updateRequestStatus.ts index e1e063933..7041c7cfb 100644 --- a/node/middlewares/updateRequestStatus.ts +++ b/node/middlewares/updateRequestStatus.ts @@ -13,7 +13,7 @@ export async function updateRequestStatus(ctx: Context) { const { requestId } = params as { requestId: string } const body = await json(req) - + const updatedRequest = await updateRequestStatusService(ctx, { ...body, requestId, diff --git a/node/package.json b/node/package.json index 2ac54002a..93c95cd09 100644 --- a/node/package.json +++ b/node/package.json @@ -23,7 +23,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/node/services/createReturnRequestService.ts b/node/services/createReturnRequestService.ts index 55c30b8ab..e952923df 100644 --- a/node/services/createReturnRequestService.ts +++ b/node/services/createReturnRequestService.ts @@ -37,6 +37,7 @@ export const createReturnRequestService = async ( const { orderId, + sellerName, items, customerProfileData, pickupReturnData, @@ -234,6 +235,7 @@ export const createReturnRequestService = async ( try { rmaDocument = await returnRequestClient.save({ orderId, + sellerName: sellerName || undefined, refundableAmount, sequenceNumber, status: 'new', diff --git a/node/services/returnRequestListService.ts b/node/services/returnRequestListService.ts index 955f8d612..56e1d17f2 100644 --- a/node/services/returnRequestListService.ts +++ b/node/services/returnRequestListService.ts @@ -39,6 +39,12 @@ const buildWhereClause = (filter: Maybe | undefined) => { return where } + if (key === 'sellerName') { + where += `sellerName = "${value}"` + + return where + } + if (key === 'createdIn' && typeof value !== 'string') { where += `dateSubmitted between ${filterDate( value.from @@ -111,8 +117,9 @@ export const returnRequestListService = async ( 'createdIn', 'status', 'dateSubmitted', + 'sellerName' ] - + const rmaSearchResult = await returnRequestClient.searchRaw( { page, diff --git a/node/services/updateRequestStatusService.ts b/node/services/updateRequestStatusService.ts index f1d21ead3..e01cf79d7 100644 --- a/node/services/updateRequestStatusService.ts +++ b/node/services/updateRequestStatusService.ts @@ -101,7 +101,7 @@ export const updateRequestStatusService = async ( vtex: { logger }, } = ctx - const { status, requestId, comment, refundData } = args + const { status, requestId, comment, refundData, sellerName } = args const { role, firstName, lastName, email, userId } = userProfile ?? {} @@ -201,6 +201,7 @@ export const updateRequestStatusService = async ( const updatedRequest = { ...formatRequestToPartialUpdate(returnRequest), + sellerName: sellerName || undefined, status: requestStatus, refundStatusData, refundData: refundInvoice diff --git a/node/yarn.lock b/node/yarn.lock index bed02b4b8..5d7fe78ac 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -6155,9 +6155,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app": +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app": version "3.5.6" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app#11353347392aa168c3b0fe16496b70448f4a840b" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app#75de6c6998923c3dc8d3a5c24a8252feeb5c82e6" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" diff --git a/react/common/components/ReturnDetails/CurrentRequestStatus.tsx b/react/common/components/ReturnDetails/CurrentRequestStatus.tsx index 616a725da..8f4903c95 100644 --- a/react/common/components/ReturnDetails/CurrentRequestStatus.tsx +++ b/react/common/components/ReturnDetails/CurrentRequestStatus.tsx @@ -16,7 +16,7 @@ export const CurrentRequestStatus = () => { if (!data) return null - const { id, status } = data.returnRequestDetails + const { id, status, sellerName } = data.returnRequestDetails return (
@@ -26,6 +26,12 @@ export const CurrentRequestStatus = () => { values={{ id, b: renderChunks }} />
+
+ +
{ @@ -164,6 +166,21 @@ const ListTableFilter = (props: Props) => { )}
+
+ + {(formattedMessage) => ( + ) => + handleOnChange('sellerName', e.currentTarget.value) + } + readOnly={isDisabled && !isFiltering} + /> + )} + +
{(formattedMessage) => ( diff --git a/react/common/components/returnList/ListTableSchema.tsx b/react/common/components/returnList/ListTableSchema.tsx index fa37d94c9..80daed0e7 100644 --- a/react/common/components/returnList/ListTableSchema.tsx +++ b/react/common/components/returnList/ListTableSchema.tsx @@ -80,6 +80,12 @@ const ReturnListSchema = () => { ), minWidth: 160, }, + sellerName: { + title: ( + + ), + minWidth: 140, + }, createdIn: { title: ( diff --git a/react/common/graphql/returnDetailsFragment.gql b/react/common/graphql/returnDetailsFragment.gql index 429b52db7..69cff95b3 100644 --- a/react/common/graphql/returnDetailsFragment.gql +++ b/react/common/graphql/returnDetailsFragment.gql @@ -3,6 +3,7 @@ fragment ReturnDetailsAdminFragment on ReturnRequestResponse { status orderId refundableAmount + sellerName items { orderItemIndex name diff --git a/react/graphql/getReturnRequestList.gql b/react/graphql/getReturnRequestList.gql index 27b8feaa8..12578b5ec 100644 --- a/react/graphql/getReturnRequestList.gql +++ b/react/graphql/getReturnRequestList.gql @@ -7,6 +7,7 @@ query getReturnRequestList($filter: ReturnRequestFilters, $page: Int!) { createdIn status orderId + sellerName } paging { total diff --git a/react/package.json b/react/package.json index 39181e108..3e0df2404 100644 --- a/react/package.json +++ b/react/package.json @@ -33,7 +33,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/react/yarn.lock b/react/yarn.lock index 7041e69be..b98102915 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -5206,9 +5206,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app": +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app": version "3.5.6" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.return-app@3.5.6/public/@types/vtex.return-app#11353347392aa168c3b0fe16496b70448f4a840b" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app#75de6c6998923c3dc8d3a5c24a8252feeb5c82e6" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" From 4095e09119ca452860955482f8c2b21c92849525 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Thu, 2 Mar 2023 17:48:58 -0500 Subject: [PATCH 05/81] feat: preparing services for app settings --- node/index.ts | 20 +++++++--- node/middlewares/appSettings.ts | 23 ++++++++++++ node/middlewares/index.ts | 19 ++++++++++ node/service.json | 4 ++ node/services/AppSettingsService.ts | 57 +++++++++++++++++++++++++++++ 5 files changed, 118 insertions(+), 5 deletions(-) create mode 100644 node/middlewares/appSettings.ts create mode 100644 node/middlewares/index.ts create mode 100644 node/services/AppSettingsService.ts diff --git a/node/index.ts b/node/index.ts index a6181e080..617d0b5b8 100644 --- a/node/index.ts +++ b/node/index.ts @@ -10,11 +10,17 @@ import { Clients } from './clients' import { errorHandler } from './middlewares/errorHandler' import { mutations, queries, resolvers } from './resolvers' import { schemaDirectives } from './directives' -import { auth } from './middlewares/auth' -import { createReturn } from './middlewares/createReturn' -import { getRequest } from './middlewares/getRequest' -import { getRequestList } from './middlewares/getRequestList' -import { updateRequestStatus } from './middlewares/updateRequestStatus' +import {middlewares} from './middlewares' + +const { + auth, + createReturn, + getRequest, + getRequestList, + updateRequestStatus, + saveAppSetting, + returnAppSetting +} = middlewares const TIMEOUT_MS = 5000 const catalogMemoryCache = new LRUCache({ max: 5000 }) @@ -54,6 +60,10 @@ export default new Service({ GET: [errorHandler, auth, getRequest], PUT: [errorHandler, auth, updateRequestStatus], }), + settings: method({ + POST: [errorHandler, auth, saveAppSetting], + GET: [errorHandler, auth, returnAppSetting], + }) }, graphql: { resolvers: { diff --git a/node/middlewares/appSettings.ts b/node/middlewares/appSettings.ts new file mode 100644 index 000000000..a16f2750e --- /dev/null +++ b/node/middlewares/appSettings.ts @@ -0,0 +1,23 @@ +import { json } from 'co-body' +import { saveAppSettingService } from '../services/AppSettingsService' +import { SETTINGS_PATH } from '../utils/constants' + +export async function saveAppSetting(ctx: Context) { + const { req } = ctx + + const body = await json(req) + + ctx.body = await saveAppSettingService(ctx, body) + ctx.status = 201 +} + +export async function returnAppSetting(ctx: Context) { + const { + clients: { appSettings }, + } = ctx + + const settings = await appSettings.get(SETTINGS_PATH, true) + + ctx.body = settings + ctx.status = 201 +} \ No newline at end of file diff --git a/node/middlewares/index.ts b/node/middlewares/index.ts new file mode 100644 index 000000000..9d777ee7b --- /dev/null +++ b/node/middlewares/index.ts @@ -0,0 +1,19 @@ +import { saveAppSetting, returnAppSetting } from './appSettings' +import { auth } from './auth' +import { createReturn } from './createReturn' +import { errorHandler } from './errorHandler' +import { getRequest } from './getRequest' +import { getRequestList } from './getRequestList' +import { updateRequestStatus } from './updateRequestStatus' + +export const middlewares = { + saveAppSetting, + returnAppSetting, + auth, + createReturn, + errorHandler, + getRequest, + getRequestList, + updateRequestStatus +} + diff --git a/node/service.json b/node/service.json index 709aa46e5..6b286e997 100644 --- a/node/service.json +++ b/node/service.json @@ -12,6 +12,10 @@ "returnRequest": { "path": "/_v/return-request/:requestId", "public": true + }, + "settings": { + "path": "/_v/returns/settings", + "public": true } } } diff --git a/node/services/AppSettingsService.ts b/node/services/AppSettingsService.ts new file mode 100644 index 000000000..a8360fa2d --- /dev/null +++ b/node/services/AppSettingsService.ts @@ -0,0 +1,57 @@ +import type { + ReturnAppSettings, + MutationSaveReturnAppSettingsArgs, +} from 'vtex.return-app' + +import { SETTINGS_PATH } from '../utils/constants' +import { + validateMaxDaysCustomReasons, + validatePaymentOptions, + valideteUniqueCustomReasonsPerLocale, +} from '../utils/appSettingsValidation' + +export async function saveAppSettingService(ctx: Context, args: MutationSaveReturnAppSettingsArgs): Promise { + const { clients: { appSettings } } = ctx + + const { settings } = args ?? {} + const { + maxDays, + customReturnReasons, + paymentOptions + } = settings ?? {} + + // validate if all custom reasons have max days smaller than the general max days + validateMaxDaysCustomReasons( + maxDays, + customReturnReasons + ) + + // validate if all custom reasons have unique locales for their translations + valideteUniqueCustomReasonsPerLocale(customReturnReasons) + + const currentSettings = { + ...settings, + // validate that there is at least one payment method selected or user has to use the same as in the order + paymentOptions: validatePaymentOptions(paymentOptions), + } + + await appSettings.save(SETTINGS_PATH, currentSettings) + + return true +} + + +export async function returnAppSettingService(ctx: Context): Promise { + const { + clients: { appSettings }, + } = ctx + + const settings = await appSettings.get(SETTINGS_PATH, true) + + if (!settings) return null + + return settings +} + + + From 885964cc2a84c461e314c250361598e970509138 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Fri, 3 Mar 2023 15:56:57 -0500 Subject: [PATCH 06/81] feat: added seller name to return request payload --- node/services/createReturnRequestService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/services/createReturnRequestService.ts b/node/services/createReturnRequestService.ts index e952923df..5abdad62a 100644 --- a/node/services/createReturnRequestService.ts +++ b/node/services/createReturnRequestService.ts @@ -235,7 +235,7 @@ export const createReturnRequestService = async ( try { rmaDocument = await returnRequestClient.save({ orderId, - sellerName: sellerName || undefined, + sellerName: sellerName || sellers?.[0]?.id || undefined, refundableAmount, sequenceNumber, status: 'new', From 0b272fc77635b7e655afbb251f1b8876e78818dd Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Tue, 7 Mar 2023 09:51:46 -0500 Subject: [PATCH 07/81] feat: add support for get and update setting of seller --- graphql/schema.graphql | 4 ++ graphql/types/SellerSetting.graphql | 27 ++++++++ masterdata/sellerSetting/schema.json | 90 ++++++++++++++++++++++++++ masterdata/sellerSetting/security.json | 3 + node/clients/index.ts | 7 +- node/index.ts | 10 ++- node/middlewares/index.ts | 5 +- node/middlewares/sellerSetting.ts | 60 +++++++++++++++++ node/package.json | 2 +- node/service.json | 8 +++ node/services/SellerSettingService.ts | 74 +++++++++++++++++++++ node/yarn.lock | 4 +- react/package.json | 2 +- react/yarn.lock | 4 +- 14 files changed, 291 insertions(+), 9 deletions(-) create mode 100644 graphql/types/SellerSetting.graphql create mode 100644 masterdata/sellerSetting/schema.json create mode 100644 masterdata/sellerSetting/security.json create mode 100644 node/middlewares/sellerSetting.ts create mode 100644 node/services/SellerSettingService.ts diff --git a/graphql/schema.graphql b/graphql/schema.graphql index e2926e9de..46b488642 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -30,12 +30,16 @@ type Query { @withUserProfile @cacheControl(scope: PRIVATE, maxAge: SHORT) nearestPickupPoints(lat: String!, long: String!): NearPickupPointQueryResponse + sellerSetting(sellerId: String!): SellerSetting + sellerSettingList: SellerSettingResponseList @cacheControl(maxAge: ZERO) } type Mutation { createReturnRequest(returnRequest: ReturnRequestInput!): returnRequestCreated @withUserProfile saveReturnAppSettings(settings: ReturnAppSettingsInput!): Boolean + saveSellerSetting(settings: SellerSettingInput!): Boolean + updateSellerSetting(sellerId: String!, settings: SellerSettingInput!): Boolean updateReturnRequestStatus( requestId: ID! sellerName: String diff --git a/graphql/types/SellerSetting.graphql b/graphql/types/SellerSetting.graphql new file mode 100644 index 000000000..0a79b99cc --- /dev/null +++ b/graphql/types/SellerSetting.graphql @@ -0,0 +1,27 @@ +type SellerSetting { + id: String + sellerId: String! + parentAccount: String! + maxDays: Int! + excludedCategories: [String!]! + paymentOptions: PaymentOptions! + termsUrl: String! + customReturnReasons: [CustomReturnReason!] + options: ReturnOption +} + +type SellerSettingResponseList { + sellers: [SellerSetting] +} + +input SellerSettingInput { + id: String + sellerId: String! + parentAccount: String! + maxDays: Int! + excludedCategories: [String!]! + paymentOptions: PaymentOptionsInput! + termsUrl: String! + customReturnReasons: [CustomReturnReasonInput!] + options: ReturnOptionInput +} diff --git a/masterdata/sellerSetting/schema.json b/masterdata/sellerSetting/schema.json new file mode 100644 index 000000000..1610402a0 --- /dev/null +++ b/masterdata/sellerSetting/schema.json @@ -0,0 +1,90 @@ +{ + "properties": { + "sellerId": { + "type": "string" + }, + "parentAccount": { + "type": "string" + }, + "maxDays": { + "type": "integer" + }, + "excludedCategories": { + "type": "array" + }, + "paymentOptions": { + "type": "object", + "properties": { + "enablePaymentMethodSelection": { + "type": "boolean" + }, + "allowedPaymentTypes": { + "type": "object", + "properties": { + "bank": { + "type": "boolean" + }, + "card": { + "type": "boolean" + }, + "giftCard": { + "type": "boolean" + } + } + }, + "automaticallyRefundPaymentMethod": { + "type": "boolean" + } + } + }, + "termsUrl": { + "type": "string" + }, + "customReturnReasons": { + "type": "array", + "properties": { + "reason": { + "type": "string" + }, + "maxDays": { + "type": "integer" + } + } + }, + "options": { + "type": "object", + "properties": { + "enableOtherOptionSelection": { + "type": "boolean" + }, + "enablePickupPoints": { + "type": "boolean" + }, + "enableProportionalShippingValue": { + "type": "boolean" + }, + "enableSelectItemCondition": { + "type": "boolean" + } + } + } + }, + "required": [ + "sellerId", + "parentAccount" + ], + "v-cache": false, + "v-default-fields": [ + "id", + "createdIn", + "sellerId", + "parentAccount" + ], + "v-indexed": [ + "id", + "createdIn", + "sellerId", + "parentAccount" + ], + "v-immediate-indexing": true +} diff --git a/masterdata/sellerSetting/security.json b/masterdata/sellerSetting/security.json new file mode 100644 index 000000000..b58836cc6 --- /dev/null +++ b/masterdata/sellerSetting/security.json @@ -0,0 +1,3 @@ +{ + "allowGetAll": true +} diff --git a/node/clients/index.ts b/node/clients/index.ts index 2a1a2d876..e3989478f 100644 --- a/node/clients/index.ts +++ b/node/clients/index.ts @@ -1,6 +1,6 @@ import { IOClients, Sphinx } from '@vtex/api' import { vbaseFor, masterDataFor } from '@vtex/clients' -import { ReturnAppSettings, ReturnRequest } from 'vtex.return-app' +import { ReturnAppSettings, ReturnRequest, SellerSetting } from 'vtex.return-app' import { Catalog } from './catalog' import { OMSCustom as OMS } from './oms' @@ -12,6 +12,7 @@ import { CatalogGQL } from './catalogGQL' const ReturnAppSettings = vbaseFor('appSettings') const ReturnRequest = masterDataFor('returnRequest') +const SellerSetting = masterDataFor('sellerSetting') export class Clients extends IOClients { public get oms() { @@ -34,6 +35,10 @@ export class Clients extends IOClients { return this.getOrSet('returnRequest', ReturnRequest) } + public get sellerSetting() { + return this.getOrSet('sellerSetting', SellerSetting) + } + public get giftCard() { return this.getOrSet('giftCard', GiftCard) } diff --git a/node/index.ts b/node/index.ts index 617d0b5b8..f574d88f2 100644 --- a/node/index.ts +++ b/node/index.ts @@ -19,7 +19,9 @@ const { getRequestList, updateRequestStatus, saveAppSetting, - returnAppSetting + returnAppSetting, + saveSellerSetting, + returnSellerSetting } = middlewares const TIMEOUT_MS = 5000 @@ -63,6 +65,12 @@ export default new Service({ settings: method({ POST: [errorHandler, auth, saveAppSetting], GET: [errorHandler, auth, returnAppSetting], + }), + sellerSetting: method({ + POST: [errorHandler, auth, saveSellerSetting], + }), + sellerSettings: method({ + GET: [errorHandler, auth, returnSellerSetting], }) }, graphql: { diff --git a/node/middlewares/index.ts b/node/middlewares/index.ts index 9d777ee7b..f622ce68b 100644 --- a/node/middlewares/index.ts +++ b/node/middlewares/index.ts @@ -5,6 +5,7 @@ import { errorHandler } from './errorHandler' import { getRequest } from './getRequest' import { getRequestList } from './getRequestList' import { updateRequestStatus } from './updateRequestStatus' +import { saveSellerSetting, returnSellerSetting } from './sellerSetting' export const middlewares = { saveAppSetting, @@ -14,6 +15,8 @@ export const middlewares = { errorHandler, getRequest, getRequestList, - updateRequestStatus + updateRequestStatus, + saveSellerSetting, + returnSellerSetting } diff --git a/node/middlewares/sellerSetting.ts b/node/middlewares/sellerSetting.ts new file mode 100644 index 000000000..154c81201 --- /dev/null +++ b/node/middlewares/sellerSetting.ts @@ -0,0 +1,60 @@ +import { json } from 'co-body' +import { saveSellerSettingService, returnSellerSettingService } from '../services/SellerSettingService' +import { SETTINGS_PATH } from '../utils/constants' + +export async function saveSellerSetting(ctx: Context) { + const { req } = ctx + + const body = await json(req) + ctx.set('Cache-Control', 'no-cache') + + try { + ctx.body = await saveSellerSettingService(ctx, body) + + ctx.status = 200 + } catch (error) { + ctx.status = 400 + } +} + +export async function returnSellerSetting(ctx: Context) { + const { + clients: { appSettings }, + vtex: { + route: { params }, + }, + } = ctx + + const { sellerId } = params as { sellerId: string } + + try { + const settings = await returnSellerSettingService(ctx, sellerId) + + if(!settings){ + const settingsMkt: any = await appSettings.get(SETTINGS_PATH, true) + + const newSettings = { + settings: { + ...settingsMkt, + sellerId, + parentAccount: ctx.vtex.account + } + } + + await saveSellerSettingService(ctx, newSettings) + + const settingsSeller = await returnSellerSettingService(ctx, sellerId) + + ctx.body = settingsSeller + ctx.status = 200 + } else { + ctx.body = settings + ctx.status = 200 + } + } catch (error) { + ctx.body = error + ctx.status = 400 + } + + ctx.set('Cache-Control', 'no-cache') +} \ No newline at end of file diff --git a/node/package.json b/node/package.json index 93c95cd09..0e309d7ed 100644 --- a/node/package.json +++ b/node/package.json @@ -23,7 +23,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/node/service.json b/node/service.json index 6b286e997..8d379f6b0 100644 --- a/node/service.json +++ b/node/service.json @@ -16,6 +16,14 @@ "settings": { "path": "/_v/returns/settings", "public": true + }, + "sellerSetting": { + "path": "/_v/returns/seller/settings", + "public": true + }, + "sellerSettings": { + "path": "/_v/returns/seller/settings/:sellerId", + "public": true } } } diff --git a/node/services/SellerSettingService.ts b/node/services/SellerSettingService.ts new file mode 100644 index 000000000..371752c0b --- /dev/null +++ b/node/services/SellerSettingService.ts @@ -0,0 +1,74 @@ +import type { + SellerSetting, + MutationSaveSellerSettingArgs +} from 'vtex.return-app' + +import { + validateMaxDaysCustomReasons, + validatePaymentOptions, + valideteUniqueCustomReasonsPerLocale, +} from '../utils/appSettingsValidation' + +export async function saveSellerSettingService(ctx: Context, args: MutationSaveSellerSettingArgs): Promise { + const { clients: { sellerSetting } } = ctx + + const { settings } = args ?? {} + const { + maxDays, + customReturnReasons, + paymentOptions, + } = settings ?? {} + + // validate if all custom reasons have max days smaller than the general max days + validateMaxDaysCustomReasons( + maxDays, + customReturnReasons + ) + + // validate if all custom reasons have unique locales for their translations + valideteUniqueCustomReasonsPerLocale(customReturnReasons) + + const currentSettings = { + ...settings, + // validate that there is at least one payment method selected or user has to use the same as in the order + paymentOptions: validatePaymentOptions(paymentOptions), + } + + const response = await sellerSetting.saveOrUpdate({ + ...currentSettings, + id: currentSettings.id || undefined + }) + + return response +} + + +export async function returnSellerSettingService(ctx: Context, sellerId: string): Promise { + const { + clients: { sellerSetting }, + } = ctx + + const fields = [ + 'id', + 'sellerId', + 'parentAccount', + 'maxDays', + 'excludedCategories', + 'paymentOptions', + 'termsUrl', + 'customReturnReasons', + 'options' + ] + + const settings = await sellerSetting.search( + { page: 1, pageSize: 1 }, + fields, + undefined, + `sellerId=${sellerId}` + ) + + return settings?.[0] || null +} + + + diff --git a/node/yarn.lock b/node/yarn.lock index 5d7fe78ac..e6f811693 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -6155,9 +6155,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app": +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app": version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app#75de6c6998923c3dc8d3a5c24a8252feeb5c82e6" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app#71fea75f43373c04db93daf568ed826c9a83b834" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" diff --git a/react/package.json b/react/package.json index 3e0df2404..eb8c66a89 100644 --- a/react/package.json +++ b/react/package.json @@ -33,7 +33,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/react/yarn.lock b/react/yarn.lock index b98102915..f701befe4 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -5206,9 +5206,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app": +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app": version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1677702220/public/@types/vtex.return-app#75de6c6998923c3dc8d3a5c24a8252feeb5c82e6" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app#71fea75f43373c04db93daf568ed826c9a83b834" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" From 0e0c74f7daa7480db2c9be5786d0bd534b5c2890 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Tue, 7 Mar 2023 12:28:32 -0500 Subject: [PATCH 08/81] fix: seller setting response --- node/middlewares/sellerSetting.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/node/middlewares/sellerSetting.ts b/node/middlewares/sellerSetting.ts index 154c81201..859e18886 100644 --- a/node/middlewares/sellerSetting.ts +++ b/node/middlewares/sellerSetting.ts @@ -27,6 +27,8 @@ export async function returnSellerSetting(ctx: Context) { const { sellerId } = params as { sellerId: string } + ctx.set('Cache-Control', 'no-cache') + try { const settings = await returnSellerSettingService(ctx, sellerId) @@ -41,11 +43,13 @@ export async function returnSellerSetting(ctx: Context) { } } - await saveSellerSettingService(ctx, newSettings) + const res = await saveSellerSettingService(ctx, newSettings) - const settingsSeller = await returnSellerSettingService(ctx, sellerId) + ctx.body = { + ...newSettings?.settings, + id: res.DocumentId + } - ctx.body = settingsSeller ctx.status = 200 } else { ctx.body = settings @@ -55,6 +59,4 @@ export async function returnSellerSetting(ctx: Context) { ctx.body = error ctx.status = 400 } - - ctx.set('Cache-Control', 'no-cache') } \ No newline at end of file From a162e8c33b9c18fffb86091b98bb778dbe7c82f8 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Tue, 7 Mar 2023 12:29:15 -0500 Subject: [PATCH 09/81] feat: added support for update status from seller --- node/middlewares/updateRequestStatus.ts | 11 +-- .../updateRequestStatusFromSellerService.ts | 99 +++++++++++++++++++ node/services/updateRequestStatusService.ts | 2 +- node/utils/handleRefund.ts | 1 + 4 files changed, 106 insertions(+), 7 deletions(-) create mode 100644 node/services/updateRequestStatusFromSellerService.ts diff --git a/node/middlewares/updateRequestStatus.ts b/node/middlewares/updateRequestStatus.ts index 7041c7cfb..707c5ef06 100644 --- a/node/middlewares/updateRequestStatus.ts +++ b/node/middlewares/updateRequestStatus.ts @@ -1,6 +1,6 @@ import { json } from 'co-body' -import { updateRequestStatusService } from '../services/updateRequestStatusService' +import { updateRequestStatusFromSellerService } from '../services/updateRequestStatusFromSellerService' export async function updateRequestStatus(ctx: Context) { const { @@ -14,10 +14,9 @@ export async function updateRequestStatus(ctx: Context) { const body = await json(req) - const updatedRequest = await updateRequestStatusService(ctx, { - ...body, - requestId, - }) - + const updatedRequest = await updateRequestStatusFromSellerService(ctx, body, requestId) + + ctx.set('Cache-Control', 'no-cache') ctx.body = updatedRequest + ctx.status = 200 } diff --git a/node/services/updateRequestStatusFromSellerService.ts b/node/services/updateRequestStatusFromSellerService.ts new file mode 100644 index 000000000..abd2e2322 --- /dev/null +++ b/node/services/updateRequestStatusFromSellerService.ts @@ -0,0 +1,99 @@ +import type { ReturnRequest } from 'vtex.return-app' +import { ResolverError } from '@vtex/api' + +import { OMS_RETURN_REQUEST_STATUS_UPDATE } from '../utils/constants' +import { OMS_RETURN_REQUEST_STATUS_UPDATE_TEMPLATE } from '../utils/templates' +import type { StatusUpdateMailData } from '../typings/mailClient' + + +export const updateRequestStatusFromSellerService = async ( + ctx: Context, + args: ReturnRequest, + requestId: string, +): Promise => { + const { + clients: { + returnRequest: returnRequestClient, + mail, + }, + vtex: { logger }, + } = ctx + + const { sellerName } = args + + const updatedRequest = { + ...args, + sellerName: sellerName || undefined + } + + try { + await returnRequestClient.update(requestId, updatedRequest) + } catch (error) { + const mdValidationErrors = error?.response?.data?.errors[0]?.errors + + const errorMessageString = mdValidationErrors + ? JSON.stringify( + { + message: 'Schema Validation error', + errors: mdValidationErrors, + }, + null, + 2 + ) + : error.message + + throw new ResolverError(errorMessageString, error.response?.status || 500) + } + + const { cultureInfoData } = updatedRequest + + // We add a try/catch here so we avoid sending an error to the browser only if the email fails. + try { + const templateExists = await mail.getTemplate( + OMS_RETURN_REQUEST_STATUS_UPDATE(cultureInfoData?.locale) + ) + + if (!templateExists) { + await mail.publishTemplate( + OMS_RETURN_REQUEST_STATUS_UPDATE_TEMPLATE(cultureInfoData?.locale) + ) + } + + const { + status: updatedStatus, + items, + customerProfileData, + refundStatusData: updatedRefundStatusData, + refundPaymentData, + refundData: updatedRefundData, + } = updatedRequest + + const mailData: StatusUpdateMailData = { + templateName: OMS_RETURN_REQUEST_STATUS_UPDATE(cultureInfoData?.locale), + jsonData: { + data: { + status: updatedStatus, + name: customerProfileData?.name ?? '', + DocumentId: requestId, + email: customerProfileData?.email ?? '', + paymentMethod: refundPaymentData?.refundPaymentMethod ?? '', + iban: refundPaymentData?.iban ?? '', + refundedAmount: + Number(updatedRefundData?.refundedItemsValue) + + Number(updatedRefundData?.refundedShippingValue), + }, + products: items, + refundStatusData: updatedRefundStatusData, + }, + } + + await mail.sendMail(mailData) + } catch (error) { + logger.warn({ + message: `Failed to send email for return request ${requestId}`, + error, + }) + } + + return { id: requestId, ...updatedRequest } +} diff --git a/node/services/updateRequestStatusService.ts b/node/services/updateRequestStatusService.ts index e01cf79d7..0ba6a98a1 100644 --- a/node/services/updateRequestStatusService.ts +++ b/node/services/updateRequestStatusService.ts @@ -100,7 +100,7 @@ export const updateRequestStatusService = async ( }, vtex: { logger }, } = ctx - + const { status, requestId, comment, refundData, sellerName } = args const { role, firstName, lastName, email, userId } = userProfile ?? {} diff --git a/node/utils/handleRefund.ts b/node/utils/handleRefund.ts index 949a5d382..249303833 100644 --- a/node/utils/handleRefund.ts +++ b/node/utils/handleRefund.ts @@ -106,6 +106,7 @@ export const handleRefund = async ({ return null } catch (error) { + console.log('ERRROR: ', error?.response?.data) throw new ResolverError('Error creating refund invoice') } } From 8d000ffd3d1fe418fc193b616a5f53302aeaf6d6 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Tue, 7 Mar 2023 14:38:19 -0500 Subject: [PATCH 10/81] fix: validation update config to seller --- node/middlewares/sellerSetting.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/node/middlewares/sellerSetting.ts b/node/middlewares/sellerSetting.ts index 859e18886..c0fc4ce4b 100644 --- a/node/middlewares/sellerSetting.ts +++ b/node/middlewares/sellerSetting.ts @@ -9,6 +9,12 @@ export async function saveSellerSetting(ctx: Context) { ctx.set('Cache-Control', 'no-cache') try { + const settings = await returnSellerSettingService(ctx, body?.settings?.sellerId) + + if(settings){ + body.settings.id = settings.id + } + ctx.body = await saveSellerSettingService(ctx, body) ctx.status = 200 From a9bfda633b8a96d06fdc65d38240ce91b13c964e Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Tue, 7 Mar 2023 15:49:54 -0500 Subject: [PATCH 11/81] fix: return message error --- node/middlewares/createReturn.ts | 9 +++++++-- node/middlewares/sellerSetting.ts | 7 ++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/node/middlewares/createReturn.ts b/node/middlewares/createReturn.ts index c13a0802c..fa0e31fe6 100644 --- a/node/middlewares/createReturn.ts +++ b/node/middlewares/createReturn.ts @@ -16,6 +16,11 @@ export async function createReturn(ctx: Context) { ctx.vtex.locale = locale - ctx.body = await createReturnRequestService(ctx, body) - ctx.status = 201 + try { + ctx.body = await createReturnRequestService(ctx, body) + ctx.status = 200 + } catch (error) { + ctx.body = error?.response?.data || error.response.statusText || error + ctx.status = error.response?.status || 400 + } } diff --git a/node/middlewares/sellerSetting.ts b/node/middlewares/sellerSetting.ts index c0fc4ce4b..2081fd648 100644 --- a/node/middlewares/sellerSetting.ts +++ b/node/middlewares/sellerSetting.ts @@ -19,7 +19,8 @@ export async function saveSellerSetting(ctx: Context) { ctx.status = 200 } catch (error) { - ctx.status = 400 + ctx.body = error?.response?.data || error.response.statusText || error + ctx.status = error.response?.status || 400 } } @@ -62,7 +63,7 @@ export async function returnSellerSetting(ctx: Context) { ctx.status = 200 } } catch (error) { - ctx.body = error - ctx.status = 400 + ctx.body = error?.response?.data || error.response.statusText || error + ctx.status = error.response?.status || 400 } } \ No newline at end of file From c49c673f931d5a09f63ea12838165bd09ca060d6 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Tue, 7 Mar 2023 16:34:30 -0500 Subject: [PATCH 12/81] feat: preparing seller validation --- node/index.ts | 3 +- node/middlewares/index.ts | 6 ++-- node/middlewares/sellerSetting.ts | 47 +++++++++++++++------------ node/middlewares/sellerValidation.ts | 29 +++++++++++++++++ node/package.json | 2 +- node/services/SellerSettingService.ts | 2 +- node/utils/appSettingsValidation.ts | 2 +- node/yarn.lock | 4 +-- react/package.json | 2 +- react/yarn.lock | 4 +-- 10 files changed, 69 insertions(+), 32 deletions(-) create mode 100644 node/middlewares/sellerValidation.ts diff --git a/node/index.ts b/node/index.ts index f574d88f2..9c26b6f97 100644 --- a/node/index.ts +++ b/node/index.ts @@ -21,7 +21,8 @@ const { saveAppSetting, returnAppSetting, saveSellerSetting, - returnSellerSetting + returnSellerSetting, + // sellerValidation } = middlewares const TIMEOUT_MS = 5000 diff --git a/node/middlewares/index.ts b/node/middlewares/index.ts index f622ce68b..27f0ce510 100644 --- a/node/middlewares/index.ts +++ b/node/middlewares/index.ts @@ -5,7 +5,8 @@ import { errorHandler } from './errorHandler' import { getRequest } from './getRequest' import { getRequestList } from './getRequestList' import { updateRequestStatus } from './updateRequestStatus' -import { saveSellerSetting, returnSellerSetting } from './sellerSetting' +import { saveSellerSetting, returnSellerSetting } from './sellerSetting' +import { sellerValidation } from './sellerValidation' export const middlewares = { saveAppSetting, @@ -17,6 +18,7 @@ export const middlewares = { getRequestList, updateRequestStatus, saveSellerSetting, - returnSellerSetting + returnSellerSetting, + sellerValidation } diff --git a/node/middlewares/sellerSetting.ts b/node/middlewares/sellerSetting.ts index 2081fd648..d06265c38 100644 --- a/node/middlewares/sellerSetting.ts +++ b/node/middlewares/sellerSetting.ts @@ -1,3 +1,4 @@ +import { UserInputError } from '@vtex/api' import { json } from 'co-body' import { saveSellerSettingService, returnSellerSettingService } from '../services/SellerSettingService' import { SETTINGS_PATH } from '../utils/constants' @@ -37,30 +38,34 @@ export async function returnSellerSetting(ctx: Context) { ctx.set('Cache-Control', 'no-cache') try { - const settings = await returnSellerSettingService(ctx, sellerId) - - if(!settings){ - const settingsMkt: any = await appSettings.get(SETTINGS_PATH, true) - - const newSettings = { - settings: { - ...settingsMkt, - sellerId, - parentAccount: ctx.vtex.account + if(sellerId){ + const settings = await returnSellerSettingService(ctx, sellerId) + + if(!settings){ + const settingsMkt: any = await appSettings.get(SETTINGS_PATH, true) + + const newSettings = { + settings: { + ...settingsMkt, + sellerId, + parentAccount: ctx.vtex.account + } } + + const res = await saveSellerSettingService(ctx, newSettings) + + ctx.body = { + ...newSettings?.settings, + id: res.DocumentId + } + + ctx.status = 200 + } else { + ctx.body = settings + ctx.status = 200 } - - const res = await saveSellerSettingService(ctx, newSettings) - - ctx.body = { - ...newSettings?.settings, - id: res.DocumentId - } - - ctx.status = 200 } else { - ctx.body = settings - ctx.status = 200 + throw new UserInputError('sellerId is required') } } catch (error) { ctx.body = error?.response?.data || error.response.statusText || error diff --git a/node/middlewares/sellerValidation.ts b/node/middlewares/sellerValidation.ts new file mode 100644 index 000000000..9905fc7ea --- /dev/null +++ b/node/middlewares/sellerValidation.ts @@ -0,0 +1,29 @@ +import { json } from 'co-body' +import { AuthenticationError } from '@vtex/api' + +export async function sellerValidation(ctx: Context, next: () => Promise) { + const { + req, + header, + query, + vtex: { + route: { params }, + } + } = ctx + + const originAccount = header['x-vtex-origin-account'] as string | undefined + + const { _sellerName } = query + + const {sellerName} = await json(req) + + const { sellerId } = params as { sellerId: string } + console.log('_sellerName: ', _sellerName) + console.log('sellerName: ', sellerName) + console.log('sellerId: ', sellerId) + if(_sellerName !== originAccount && sellerName !== originAccount && sellerId !== originAccount || !originAccount){ + throw new AuthenticationError('Request failed with status code 401') + } + + await next() +} diff --git a/node/package.json b/node/package.json index 0e309d7ed..3b84fca6b 100644 --- a/node/package.json +++ b/node/package.json @@ -23,7 +23,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/node/services/SellerSettingService.ts b/node/services/SellerSettingService.ts index 371752c0b..b62b4eb81 100644 --- a/node/services/SellerSettingService.ts +++ b/node/services/SellerSettingService.ts @@ -33,7 +33,7 @@ export async function saveSellerSettingService(ctx: Context, args: MutationSaveS // validate that there is at least one payment method selected or user has to use the same as in the order paymentOptions: validatePaymentOptions(paymentOptions), } - + const response = await sellerSetting.saveOrUpdate({ ...currentSettings, id: currentSettings.id || undefined diff --git a/node/utils/appSettingsValidation.ts b/node/utils/appSettingsValidation.ts index f096a74c3..f8b6b80ad 100644 --- a/node/utils/appSettingsValidation.ts +++ b/node/utils/appSettingsValidation.ts @@ -28,7 +28,7 @@ export const validatePaymentOptions = ( // Make automaticallyRefundPaymentMethod null when enablePaymentMethodSelection is true. This way we avoid confusion. We cannot have this value as true when payment method selection is eneble. const adjustedPaymentOptions = { ...paymentOptions, - automaticallyRefundPaymentMethod: null, + automaticallyRefundPaymentMethod: false, } for (const paymentType of Object.keys(allowedPaymentTypes)) { diff --git a/node/yarn.lock b/node/yarn.lock index e6f811693..9b4de037b 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -6155,9 +6155,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app": +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app": version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app#71fea75f43373c04db93daf568ed826c9a83b834" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app#e640c9033e13959eb160ddddbc56abd68aa8d187" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" diff --git a/react/package.json b/react/package.json index eb8c66a89..04891cda6 100644 --- a/react/package.json +++ b/react/package.json @@ -33,7 +33,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/react/yarn.lock b/react/yarn.lock index f701befe4..aa55824fd 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -5206,9 +5206,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app": +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app": version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678197819/public/@types/vtex.return-app#71fea75f43373c04db93daf568ed826c9a83b834" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app#e640c9033e13959eb160ddddbc56abd68aa8d187" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" From 9b90bb6e687dc4f2e37f27cb577be4d11f4e3253 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Wed, 8 Mar 2023 16:19:17 -0500 Subject: [PATCH 13/81] feat: added middleware for seller validation --- node/clients/mail.ts | 2 +- node/clients/oms.ts | 2 +- node/clients/vtexId.ts | 9 ++++++ node/index.ts | 8 ++--- node/middlewares/sellerValidation.ts | 25 +++++++++++----- node/package.json | 6 ++-- node/yarn.lock | 44 +++++++++++++++++----------- react/package.json | 2 +- react/yarn.lock | 4 +-- 9 files changed, 65 insertions(+), 37 deletions(-) diff --git a/node/clients/mail.ts b/node/clients/mail.ts index 8aee9ad4c..d40a91048 100644 --- a/node/clients/mail.ts +++ b/node/clients/mail.ts @@ -38,7 +38,7 @@ export class MailClient extends JanusClient { return this.http.post(TEMPLATE_RENDER_PATH, template, { headers: { ...this.options?.headers, - VtexIdClientAutCookie: this.context.adminUserAuthToken, + VtexIdClientAutCookie: this.context.adminUserAuthToken || '', }, metric: 'mail-post-template', }) diff --git a/node/clients/oms.ts b/node/clients/oms.ts index 8c65a4f6b..701d619a7 100644 --- a/node/clients/oms.ts +++ b/node/clients/oms.ts @@ -57,7 +57,7 @@ export class OMSCustom extends OMS { invoice, { headers: { - VtexIdClientAutCookie: this.context.adminUserAuthToken, + VtexIdClientAutCookie: this.context.adminUserAuthToken || '', }, metric: 'oms-create-invoice', } diff --git a/node/clients/vtexId.ts b/node/clients/vtexId.ts index 888240c13..60597904b 100644 --- a/node/clients/vtexId.ts +++ b/node/clients/vtexId.ts @@ -53,4 +53,13 @@ export class VtexId extends JanusClient { }, }) } + + public getAccount(token: string, account: string): Promise { + return this.http.get(`/api/vlm/account?an=${account}`, { + metric: 'vtexid-get-account', + headers: { + VtexIdClientAutCookie: token || '', + }, + }) + } } diff --git a/node/index.ts b/node/index.ts index 9c26b6f97..ebc0225ab 100644 --- a/node/index.ts +++ b/node/index.ts @@ -22,7 +22,7 @@ const { returnAppSetting, saveSellerSetting, returnSellerSetting, - // sellerValidation + sellerValidation } = middlewares const TIMEOUT_MS = 5000 @@ -56,7 +56,7 @@ export default new Service({ clients, routes: { returnRequests: method({ - POST: [errorHandler, auth, createReturn], + POST: [errorHandler, auth, sellerValidation, createReturn], GET: [errorHandler, auth, getRequestList], }), returnRequest: method({ @@ -68,10 +68,10 @@ export default new Service({ GET: [errorHandler, auth, returnAppSetting], }), sellerSetting: method({ - POST: [errorHandler, auth, saveSellerSetting], + POST: [errorHandler, auth, sellerValidation, saveSellerSetting], }), sellerSettings: method({ - GET: [errorHandler, auth, returnSellerSetting], + GET: [errorHandler, auth, sellerValidation, returnSellerSetting], }) }, graphql: { diff --git a/node/middlewares/sellerValidation.ts b/node/middlewares/sellerValidation.ts index 9905fc7ea..5b89608ed 100644 --- a/node/middlewares/sellerValidation.ts +++ b/node/middlewares/sellerValidation.ts @@ -3,26 +3,35 @@ import { AuthenticationError } from '@vtex/api' export async function sellerValidation(ctx: Context, next: () => Promise) { const { - req, header, + req, query, vtex: { route: { params }, - } + }, + clients: { vtexId }, } = ctx - const originAccount = header['x-vtex-origin-account'] as string | undefined + const authCookie = header.vtexidclientautcookie as string | undefined const { _sellerName } = query const {sellerName} = await json(req) const { sellerId } = params as { sellerId: string } - console.log('_sellerName: ', _sellerName) - console.log('sellerName: ', sellerName) - console.log('sellerId: ', sellerId) - if(_sellerName !== originAccount && sellerName !== originAccount && sellerId !== originAccount || !originAccount){ - throw new AuthenticationError('Request failed with status code 401') + + if(authCookie && (_sellerName || sellerName || sellerId) ){ + const accountName = _sellerName || sellerName || sellerId + + try { + const account = await vtexId.getAccount(authCookie, accountName) + + if(!account){ + throw new AuthenticationError('Request failed with status code 401') + } + } catch (error) { + throw new AuthenticationError('Request failed with status code 401') + } } await next() diff --git a/node/package.json b/node/package.json index 3b84fca6b..3ffb154a5 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "@vtex/api": "6.45.15", + "@vtex/api": "6.46.0-beta.0", "@vtex/clients": "^2.13.0", "co-body": "^6.0.0", "graphql": "^14.0.0", @@ -11,7 +11,7 @@ "@types/co-body": "^0.0.3", "@types/jest": "^24.0.18", "@types/node": "^12.0.0", - "@vtex/api": "6.45.15", + "@vtex/api": "6.46.0-beta.0", "@vtex/test-tools": "^1.0.0", "@vtex/tsconfig": "^0.6.0", "tslint": "^6.1.3", @@ -23,7 +23,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/node/yarn.lock b/node/yarn.lock index 9b4de037b..4a6b9a6f2 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -1528,10 +1528,10 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.3.tgz#781d360c282436494b32fe7d9f7f8e64b3118aa3" integrity sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw== -"@vtex/api@6.45.15": - version "6.45.15" - resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.45.15.tgz#aa987d22f7df16ce2861130deda6ffd63156817b" - integrity sha512-Rg1VGDzJ4hHUNp1vSidMdGGPojr1PikMTptlZsJ3oNZVdEo4cPx2l8ZcAEwHWORL7QjPjXaEgmeA5ZOSf+boCQ== +"@vtex/api@6.46.0-beta.0": + version "6.46.0-beta.0" + resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.46.0-beta.0.tgz#05848fe0afe887faa50c885ed4ce6fd1a9e5df17" + integrity sha512-d1zXUGf8hfOmz1Byem85zmyxBtSXKAoP330qiZLYwef2CVVZ3UVpDG5umJajSMTTWMPVjvUaETyid6EkfgHqig== dependencies: "@types/koa" "^2.11.0" "@types/koa-compose" "^3.2.3" @@ -1540,7 +1540,7 @@ agentkeepalive "^4.0.2" apollo-server-errors "^2.2.1" archiver "^3.0.0" - axios "^0.21.1" + axios "0.27.2" axios-retry "^3.1.2" bluebird "^3.5.4" chalk "^2.4.2" @@ -1958,12 +1958,13 @@ axios@0.18.0: follow-redirects "^1.3.0" is-buffer "^1.1.5" -axios@^0.21.1: - version "0.21.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" - integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== +axios@0.27.2: + version "0.27.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" + integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== dependencies: - follow-redirects "^1.10.0" + follow-redirects "^1.14.9" + form-data "^4.0.0" babel-jest@^24.4.0, babel-jest@^24.9.0: version "24.9.0" @@ -2366,7 +2367,7 @@ colorette@^1.2.2: resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== -combined-stream@^1.0.6, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -2985,10 +2986,10 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -follow-redirects@^1.10.0: - version "1.13.0" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db" - integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA== +follow-redirects@^1.14.9: + version "1.15.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" + integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== follow-redirects@^1.3.0: version "1.14.1" @@ -3012,6 +3013,15 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= +form-data@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" + integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -6155,9 +6165,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app": +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app": version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app#e640c9033e13959eb160ddddbc56abd68aa8d187" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app#21f888d1fad65152de0c5e778dd763a3f3560c08" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" diff --git a/react/package.json b/react/package.json index 04891cda6..f3fc58aad 100644 --- a/react/package.json +++ b/react/package.json @@ -33,7 +33,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/react/yarn.lock b/react/yarn.lock index aa55824fd..5ce8cf26b 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -5206,9 +5206,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app": +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app": version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678224599/public/@types/vtex.return-app#e640c9033e13959eb160ddddbc56abd68aa8d187" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app#21f888d1fad65152de0c5e778dd763a3f3560c08" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" From f7cfeb6fb878171cf99e9165067f0cf26ffe6563 Mon Sep 17 00:00:00 2001 From: Natalia Manrique Date: Tue, 14 Mar 2023 11:05:23 -0500 Subject: [PATCH 14/81] feature add seller settings --- admin/navigation.json | 4 + admin/routes.json | 8 + graphql/schema.graphql | 10 + graphql/types/ReturnSettings.graphql | 23 ++ messages/en.json | 4 + messages/es.json | 4 + node/package.json | 16 +- node/resolvers/index.ts | 4 + node/resolvers/returnSellerSettings.ts | 13 ++ node/resolvers/returnSettingsList.ts | 11 + node/services/returnSellerSettingsService.ts | 43 ++++ node/services/returnSettingsListService.ts | 123 ++++++++++ node/utils/handleRefund.ts | 1 - node/yarn.lock | 76 ++---- react/AdminSettingDetail.tsx | 4 + react/AdminSettingReturnList.tsx | 3 + react/admin/AdminSettingDetail.tsx | 21 ++ react/admin/AdminSettingReturnList.tsx | 3 + .../ReturnSettingsListContainer.tsx | 27 +++ .../SettingDetailsContainer.tsx | 219 ++++++++++++++++++ .../settings/components/GeneralOptions.tsx | 4 +- .../settings/components/RequiredOptions.tsx | 4 +- .../settings/graphql/getSellerSettings.gql | 32 +++ react/admin/settings/hooks/useSettings.ts | 3 + .../provider/SettingsDetailProvider.tsx | 124 ++++++++++ .../components/returnList/ListTable.tsx | 1 + .../returnListSettings/JumpToPageSettings.tsx | 80 +++++++ .../ListTableFilterSettings.tsx | 137 +++++++++++ .../ListTableSchemaSettings.tsx | 63 +++++ .../returnListSettings/ListTableSettings.tsx | 124 ++++++++++ react/graphql/getSettingsRequestList.gql | 27 +++ react/hooks/useSettingsRequestList.ts | 23 ++ react/package.json | 12 +- react/yarn.lock | 40 ---- 34 files changed, 1161 insertions(+), 130 deletions(-) create mode 100644 graphql/types/ReturnSettings.graphql create mode 100644 node/resolvers/returnSellerSettings.ts create mode 100644 node/resolvers/returnSettingsList.ts create mode 100644 node/services/returnSellerSettingsService.ts create mode 100644 node/services/returnSettingsListService.ts create mode 100644 react/AdminSettingDetail.tsx create mode 100644 react/AdminSettingReturnList.tsx create mode 100644 react/admin/AdminSettingDetail.tsx create mode 100644 react/admin/AdminSettingReturnList.tsx create mode 100644 react/admin/ReturnSettingsList/ReturnSettingsListContainer.tsx create mode 100644 react/admin/settings/SettingDetails/SettingDetailsContainer.tsx create mode 100644 react/admin/settings/graphql/getSellerSettings.gql create mode 100644 react/admin/settings/provider/SettingsDetailProvider.tsx create mode 100644 react/common/components/returnListSettings/JumpToPageSettings.tsx create mode 100644 react/common/components/returnListSettings/ListTableFilterSettings.tsx create mode 100644 react/common/components/returnListSettings/ListTableSchemaSettings.tsx create mode 100644 react/common/components/returnListSettings/ListTableSettings.tsx create mode 100644 react/graphql/getSettingsRequestList.gql create mode 100644 react/hooks/useSettingsRequestList.ts diff --git a/admin/navigation.json b/admin/navigation.json index 8d76fa071..1b5be9276 100644 --- a/admin/navigation.json +++ b/admin/navigation.json @@ -10,6 +10,10 @@ { "labelId": "admin/return-app.settings.navigation.label", "path": "/admin/returns/settings" + }, + { + "labelId": "admin/return-app.sellers.settings.navigation.label", + "path": "/admin/returns/sellers/settings" } ] } diff --git a/admin/routes.json b/admin/routes.json index c194b0a54..291eca4a9 100644 --- a/admin/routes.json +++ b/admin/routes.json @@ -3,6 +3,14 @@ "component": "AdminReturnList", "path": "/admin/app/returns/requests/" }, + "admin.app.return-settings-list": { + "component": "AdminSettingReturnList", + "path": "/admin/app/returns/sellers/settings/" + }, + "admin.app.return-setting-details": { + "component": "AdminSettingDetail", + "path": "/admin/app/returns/sellers/settings/:id/details/" + }, "admin.app.return-settings": { "component": "AdminReturnSettings", "path": "/admin/app/returns/settings/" diff --git a/graphql/schema.graphql b/graphql/schema.graphql index 46b488642..def11f1f1 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -1,5 +1,8 @@ type Query { returnAppSettings: ReturnAppSettings @cacheControl(maxAge: ZERO) + returnSellerSettings(sellerId: String!): ReturnAppSettings + @withUserProfile + @cacheControl(maxAge: ZERO) categoryTreeName: [CategoryInfo]! @cacheControl(maxAge: MEDIUM) """ storeUserEmail: If not passed, resolver will try to parse it from session cookie. @@ -32,6 +35,13 @@ type Query { nearestPickupPoints(lat: String!, long: String!): NearPickupPointQueryResponse sellerSetting(sellerId: String!): SellerSetting sellerSettingList: SellerSettingResponseList @cacheControl(maxAge: ZERO) + returnSettingsList( + filter: ReturnSettingsFilters + page: Int! + perPage: Int + ): ReturnSettingsList + @withUserProfile + @cacheControl(scope: PRIVATE, maxAge: SHORT) } type Mutation { diff --git a/graphql/types/ReturnSettings.graphql b/graphql/types/ReturnSettings.graphql new file mode 100644 index 000000000..359ead4b1 --- /dev/null +++ b/graphql/types/ReturnSettings.graphql @@ -0,0 +1,23 @@ +input ReturnSettingsFilters { + id: String + sellerName: String + +} + +type ReturnSettingsList { + list: [ReturnSettingsResponse!]! + paging: Pagination! +} + + +type ReturnSettingsResponse { + id: ID! + sellerId: String + maxDays: Int! + excludedCategories: [String!]! + paymentOptions: PaymentOptions! + termsUrl: String! + customReturnReasons: [CustomReturnReason!] + options: ReturnOption + +} diff --git a/messages/en.json b/messages/en.json index c57be32af..71eb63dbb 100644 --- a/messages/en.json +++ b/messages/en.json @@ -1,6 +1,7 @@ { "admin/return-app.navigation.label": "Returns", "navigation.labelRequests": "Requests", + "admin/return-app.sellers.settings.navigation.label":"Sellers Returns Settings", "admin/return-app.settings.navigation.label": "Returns Settings", "admin/return-app.settings.max-days.label": "Max days:", "admin/return-app.settings.error.header": "Error loading settings", @@ -270,13 +271,16 @@ "return-app-status.timeline.denied": "Denied", "return-app-status.timeline.cancelled": "Cancelled", "admin/return-app.return-request-list.page-header.title": "Return Request List", + "admin/return-app.sellers-settings-list.page-header.title": "Sellers Settings List", "admin/return-app.return-request-list.page-header.subTitle": "All return requests created by store users. Click a request ID to see more.", + "admin/return-app.sellers-settings-list.page-header.subTitle": "All settings created by sellers return app. Click a settings ID to see more.", "return-app.return-request-list.error.title": "Error loading list", "return-app.return-request-list.error.description": "An error occurred while loading the request list. Please try again.", "return-app.return-request-list.table.emptyState": "No results available", "return-app.return-request-list.table.emptyState-children": "Try different filters for your search", "return-app.return-request-list.table-pagination.textOf": "of", "return-app.return-request-list.table-data.requestId": "Request ID", + "return-app.sellers-settings-list.table-data.settingId": "Setting ID", "return-app.return-request-list.table-data.sequenceNumber": "Sequence Number", "return-app.return-request-list.table-data.orderId": "Order ID", "return-app.return-request-list.table-data.sellerName": "Seller Name", diff --git a/messages/es.json b/messages/es.json index 11bfa8e4e..9484b071f 100644 --- a/messages/es.json +++ b/messages/es.json @@ -1,6 +1,7 @@ { "admin/return-app.navigation.label": "Devoluciones", "navigation.labelRequests": "Solicitudes", + "admin/return-app.sellers.settings.navigation.label":"Configuración de devolución de sellers", "admin/return-app.settings.navigation.label": "Configuración de devolución", "admin/return-app.settings.max-days.label": "Max. días:", "admin/return-app.settings.error.header": "Error al cargar la configuración", @@ -269,13 +270,16 @@ "return-app-status.timeline.denied": "Denegado", "return-app-status.timeline.cancelled": "Cancelado", "admin/return-app.return-request-list.page-header.title": "Lista de solicitudes de devolución", + "admin/return-app.sellers-settings-list.page-header.title": "Lista de configuraciones de sellers", "admin/return-app.return-request-list.page-header.subTitle": "Todas las solicitudes de devolución creadas por los usuarios de la tienda. Haz clic en el ID de una solicitud para ver más.", + "admin/return-app.sellers-settings-list.page-header.subTitle": "Todas las configuraciones de sellers. Haz clic en el ID de una configuración para ver más.", "return-app.return-request-list.error.title": "Error al cargar la lista", "return-app.return-request-list.error.description": "Se produjo un error al cargar la lista de solicitudes. Por favor, vuelve a intentarlo.", "return-app.return-request-list.table.emptyState": "No hay resultados disponibles", "return-app.return-request-list.table.emptyState-children": "Intenta utilizar filtros diferentes en tu búsqueda", "return-app.return-request-list.table-pagination.textOf": "de", "return-app.return-request-list.table-data.requestId": "ID de la solicitud", + "return-app.sellers-settings-list.table-data.settingId": "ID de la configuración", "return-app.return-request-list.table-data.sequenceNumber": "Número de secuencia", "return-app.return-request-list.table-data.orderId": "ID del pedido", "return-app.return-request-list.table-data.sellerName": "Vendedor", diff --git a/node/package.json b/node/package.json index 3ffb154a5..70c6806e4 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "dependencies": { - "@vtex/api": "6.46.0-beta.0", + "@vtex/api": "6.45.15", "@vtex/clients": "^2.13.0", "co-body": "^6.0.0", "graphql": "^14.0.0", @@ -11,21 +11,11 @@ "@types/co-body": "^0.0.3", "@types/jest": "^24.0.18", "@types/node": "^12.0.0", - "@vtex/api": "6.46.0-beta.0", + "@vtex/api": "6.45.15", "@vtex/test-tools": "^1.0.0", "@vtex/tsconfig": "^0.6.0", "tslint": "^6.1.3", - "tslint-config-vtex": "^2.1.0", - "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", - "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", - "vtex.easypost": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost", - "vtex.format-currency": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency", - "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", - "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", - "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app", - "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", - "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" + "tslint-config-vtex": "^2.1.0" }, "scripts": { "lint": "tsc --noEmit --pretty && tslint -c tslint.json --fix './**/*.ts'" diff --git a/node/resolvers/index.ts b/node/resolvers/index.ts index e462ffcbf..1178e07f2 100644 --- a/node/resolvers/index.ts +++ b/node/resolvers/index.ts @@ -8,9 +8,11 @@ import { ordersAvailableToReturn } from './ordersAvailableToReturn' import { orderToReturnSummary } from './orderToReturnSummary' import { returnRequest } from './returnRequest' import { returnRequestList } from './returnRequestList' +import { returnSettingsList } from './returnSettingsList' import { ReturnRequestResponse } from './ReturnRequestResponse' import { updateReturnRequestStatus } from './updateReturnRequestStatus' import { nearestPickupPoints } from './nearestPickupPoints' +import { returnSellerSettings } from './returnSellerSettings' export const mutations = { createReturnRequest, @@ -20,12 +22,14 @@ export const mutations = { export const queries = { ...settingsQuery, + returnSellerSettings, categoryTreeName, ordersAvailableToReturn, orderToReturnSummary, returnRequest, returnRequestList, nearestPickupPoints, + returnSettingsList } export const resolvers = { ReturnRequestResponse } diff --git a/node/resolvers/returnSellerSettings.ts b/node/resolvers/returnSellerSettings.ts new file mode 100644 index 000000000..87560c308 --- /dev/null +++ b/node/resolvers/returnSellerSettings.ts @@ -0,0 +1,13 @@ + +import { returnSellerSettingsService } from '../services/returnSellerSettingsService' +import type { + QueryReturnSellerSettingsArgs, +} from 'vtex.return-app' + +export const returnSellerSettings = async ( + _: unknown, + { sellerId } : QueryReturnSellerSettingsArgs, + ctx: Context +) => { + return returnSellerSettingsService(ctx, sellerId) +} diff --git a/node/resolvers/returnSettingsList.ts b/node/resolvers/returnSettingsList.ts new file mode 100644 index 000000000..34cd7cef4 --- /dev/null +++ b/node/resolvers/returnSettingsList.ts @@ -0,0 +1,11 @@ +import type { QueryReturnRequestListArgs } from 'vtex.return-app' + +import { returnSettingsListService } from '../services/returnSettingsListService' + +export const returnSettingsList = ( + _: unknown, + args: QueryReturnRequestListArgs, + ctx: Context +) => { + return returnSettingsListService(ctx, args) +} diff --git a/node/services/returnSellerSettingsService.ts b/node/services/returnSellerSettingsService.ts new file mode 100644 index 000000000..386dfdef4 --- /dev/null +++ b/node/services/returnSellerSettingsService.ts @@ -0,0 +1,43 @@ +import type { + ReturnAppSettings, +} from 'vtex.return-app' + +export async function returnSellerSettingsService(ctx: Context, sellerId: string): Promise { + const { + clients: { sellerSetting }, + } = ctx + const fields = [ + 'id', + 'sellerId', + 'parentAccount', + 'maxDays', + 'excludedCategories', + 'paymentOptions', + 'termsUrl', + 'customReturnReasons', + 'options' + ] + const settings = await sellerSetting.search( + { page: 1, pageSize: 1 }, + fields, + undefined, + `sellerId=${sellerId}` + ) + if(settings?.[0]){ + const response: ReturnAppSettings = { + maxDays: settings?.[0]?.maxDays, + excludedCategories: settings?.[0]?.excludedCategories, + paymentOptions: settings?.[0]?.paymentOptions, + termsUrl: settings?.[0]?.termsUrl, + customReturnReasons:settings?.[0]?.customReturnReasons, + options: settings?.[0]?.options, + } + return response + }else{ + return null + } + +} + + + diff --git a/node/services/returnSettingsListService.ts b/node/services/returnSettingsListService.ts new file mode 100644 index 000000000..7f61ffc97 --- /dev/null +++ b/node/services/returnSettingsListService.ts @@ -0,0 +1,123 @@ +import type { + QueryReturnRequestListArgs, + ReturnRequestFilters, + Maybe, +} from 'vtex.return-app' +import { ForbiddenError } from '@vtex/api' +/* +const filterDate = (date: string): string => { + const newDate = new Date(date) + const day = newDate.getDate() + const month = newDate.getMonth() + 1 + const year = newDate.getFullYear() + + return `${year}-${month < 10 ? `0${month}` : `${month}`}-${ + day < 10 ? `0${day}` : `${day}` + }` +}*/ + +const buildWhereClause = (filter: Maybe | undefined) => { + if (!filter) return + + const returnFilters = Object.entries(filter) + const whereFilter = returnFilters.reduce((where, [key, value]) => { + if (!value) return where + + if (where.length) { + where += ` AND ` + } + + if (key === 'sellerName') { + where += `sellerId = "${value}"` + + return where + } + + where += `${key}=${value}` + + return where + }, '') + + return whereFilter +} + +export const returnSettingsListService = async ( + ctx: Context, + args: QueryReturnRequestListArgs, + getAllFields = true +) => { + const { + clients: { sellerSetting: sellerSettingClient }, + request: { header }, + state: { userProfile, appkey }, + } = ctx + + const { page, perPage, filter } = args + const { + userId: userIdProfile, + email: userEmailProfile, + role, + } = userProfile ?? {} + + const { userId: userIdArg, userEmail: userEmailArg } = filter ?? {} + + const userIsAdmin = Boolean(appkey) || role === 'admin' + + // only admin users can pass userId or userEmail in the request. + // For non admin users, the userId or userEmail must be gotten from cookie session. + // Otherwise, a non admin user could search for another user's return requests + const userId = userIsAdmin ? userIdArg || userIdProfile : userIdProfile + const userEmail = userIsAdmin + ? userEmailArg || userEmailProfile + : userEmailProfile + + // vtexProduct is undefined when coming from GraphQL IDE or from a external request + const vtexProduct = header['x-vtex-product'] as 'admin' | 'store' | undefined + + // When the user is not admin or the request is coming from the store, we need to apply the user filter to get the right requests + const requireFilterByUser = + !userIsAdmin || vtexProduct === 'store' || role === 'store-user' + + const hasUserIdOrEmail = Boolean(userId || userEmail) + + if (requireFilterByUser && !hasUserIdOrEmail) { + throw new ForbiddenError('Missing params to filter by store user') + } + + const adjustedFilter = requireFilterByUser + ? { ...filter, userId, userEmail } + : filter + + const resultFields = getAllFields + ? ['_all'] + : [ + 'id', + 'sellerId', + 'maxDays', + 'paymentOptions', + 'customReturnReasons', + 'excludedCategories', + 'createdIn' + ] + const rmaSearchResult = await sellerSettingClient.searchRaw( + { + page, + pageSize: perPage && perPage <= 100 ? perPage : 25, + }, + resultFields, + 'createdIn DESC', + buildWhereClause(adjustedFilter) + ) + const { data, pagination } = rmaSearchResult + const { page: currentPage, pageSize, total } = pagination + + return { + list: data, + paging: { + total, + perPage: pageSize, + currentPage, + pages: Math.ceil(total / pageSize), + }, + } +} diff --git a/node/utils/handleRefund.ts b/node/utils/handleRefund.ts index 249303833..949a5d382 100644 --- a/node/utils/handleRefund.ts +++ b/node/utils/handleRefund.ts @@ -106,7 +106,6 @@ export const handleRefund = async ({ return null } catch (error) { - console.log('ERRROR: ', error?.response?.data) throw new ResolverError('Error creating refund invoice') } } diff --git a/node/yarn.lock b/node/yarn.lock index 4a6b9a6f2..5bafc79f9 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -1528,10 +1528,10 @@ resolved "https://registry.yarnpkg.com/@types/zen-observable/-/zen-observable-0.8.3.tgz#781d360c282436494b32fe7d9f7f8e64b3118aa3" integrity sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw== -"@vtex/api@6.46.0-beta.0": - version "6.46.0-beta.0" - resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.46.0-beta.0.tgz#05848fe0afe887faa50c885ed4ce6fd1a9e5df17" - integrity sha512-d1zXUGf8hfOmz1Byem85zmyxBtSXKAoP330qiZLYwef2CVVZ3UVpDG5umJajSMTTWMPVjvUaETyid6EkfgHqig== +"@vtex/api@6.45.15": + version "6.45.15" + resolved "https://registry.yarnpkg.com/@vtex/api/-/api-6.45.15.tgz#aa987d22f7df16ce2861130deda6ffd63156817b" + integrity sha512-Rg1VGDzJ4hHUNp1vSidMdGGPojr1PikMTptlZsJ3oNZVdEo4cPx2l8ZcAEwHWORL7QjPjXaEgmeA5ZOSf+boCQ== dependencies: "@types/koa" "^2.11.0" "@types/koa-compose" "^3.2.3" @@ -1540,7 +1540,7 @@ agentkeepalive "^4.0.2" apollo-server-errors "^2.2.1" archiver "^3.0.0" - axios "0.27.2" + axios "^0.21.1" axios-retry "^3.1.2" bluebird "^3.5.4" chalk "^2.4.2" @@ -1958,13 +1958,12 @@ axios@0.18.0: follow-redirects "^1.3.0" is-buffer "^1.1.5" -axios@0.27.2: - version "0.27.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" - integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== +axios@^0.21.1: + version "0.21.4" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" + integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== dependencies: - follow-redirects "^1.14.9" - form-data "^4.0.0" + follow-redirects "^1.14.0" babel-jest@^24.4.0, babel-jest@^24.9.0: version "24.9.0" @@ -2367,7 +2366,7 @@ colorette@^1.2.2: resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== -combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: +combined-stream@^1.0.6, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== @@ -2986,7 +2985,7 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -follow-redirects@^1.14.9: +follow-redirects@^1.14.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== @@ -3013,15 +3012,6 @@ forever-agent@~0.6.1: resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91" integrity sha1-+8cfDEGt6zf5bFd60e1C2P2sypE= -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - form-data@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.3.tgz#dcce52c05f644f298c6a7ab936bd724ceffbf3a6" @@ -5620,7 +5610,7 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" -stats-lite@vtex/node-stats-lite#dist: +"stats-lite@github:vtex/node-stats-lite#dist": version "2.2.0" resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797" dependencies: @@ -6137,46 +6127,6 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql": - version "1.102.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql#ad1dfac8d076034d4326a00a3da20a3915951f53" - -"vtex.css-handles@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles": - version "0.4.4" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles#8c45c6decf9acd2b944e07261686decff93d6422" - -"vtex.easypost@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost": - version "0.1.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost#078a135b63bb4fc5e39e6ad789d0caf9ea368f35" - -"vtex.format-currency@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency": - version "0.4.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency#aaed82b498270f0bb6f37e93eff7e7f401e4d283" - -"vtex.my-account-commons@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons": - version "1.6.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons#3715228fb82e81e955e6a90d11e7975e72b37b2e" - -"vtex.my-account@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account": - version "1.25.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account#3bc46389c0aa28f4e3e2e008fe3690f5901b1f2a" - -"vtex.render-runtime@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime": - version "8.132.4" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" - -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app": - version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app#21f888d1fad65152de0c5e778dd763a3f3560c08" - -"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": - version "9.146.3" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" - -"vtex.tenant-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql": - version "0.1.2" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql#74673fe86baefe74f21a6d2615993ea0ccb5e79e" - w3c-hr-time@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" diff --git a/react/AdminSettingDetail.tsx b/react/AdminSettingDetail.tsx new file mode 100644 index 000000000..6178c96a4 --- /dev/null +++ b/react/AdminSettingDetail.tsx @@ -0,0 +1,4 @@ +import { AdminSettingDetail } from './admin/AdminSettingDetail' +import './styles.global.css' + +export default AdminSettingDetail diff --git a/react/AdminSettingReturnList.tsx b/react/AdminSettingReturnList.tsx new file mode 100644 index 000000000..bc2709813 --- /dev/null +++ b/react/AdminSettingReturnList.tsx @@ -0,0 +1,3 @@ +import AdminSettingReturnList from './admin/AdminSettingReturnList' + +export default AdminSettingReturnList diff --git a/react/admin/AdminSettingDetail.tsx b/react/admin/AdminSettingDetail.tsx new file mode 100644 index 000000000..06f5a11a0 --- /dev/null +++ b/react/admin/AdminSettingDetail.tsx @@ -0,0 +1,21 @@ +import React from 'react' + +import { AlertProvider } from './provider/AlertProvider' +import { SettingsDetailProvider } from './settings/provider/SettingsDetailProvider' +import { SettingDetailsContainer } from './settings/SettingDetails/SettingDetailsContainer' + +interface CustomRouteProps { + params: { + id: string + } +} + +export const AdminSettingDetail = ({ params }: CustomRouteProps) => { + return ( + + + + + + ) +} diff --git a/react/admin/AdminSettingReturnList.tsx b/react/admin/AdminSettingReturnList.tsx new file mode 100644 index 000000000..232d2aae0 --- /dev/null +++ b/react/admin/AdminSettingReturnList.tsx @@ -0,0 +1,3 @@ +import { AdminSettingReturnList } from './ReturnSettingsList/ReturnSettingsListContainer' + +export default AdminSettingReturnList diff --git a/react/admin/ReturnSettingsList/ReturnSettingsListContainer.tsx b/react/admin/ReturnSettingsList/ReturnSettingsListContainer.tsx new file mode 100644 index 000000000..812ef86f5 --- /dev/null +++ b/react/admin/ReturnSettingsList/ReturnSettingsListContainer.tsx @@ -0,0 +1,27 @@ +import React from 'react' +import { Layout, PageHeader, PageBlock } from 'vtex.styleguide' +import { FormattedMessage } from 'react-intl' + +import ListTableSettings from '../../common/components/returnListSettings/ListTableSettings' + +export const AdminSettingReturnList = () => { + return ( + + } + subtitle={ + + } + /> + } + > + + + + + ) +} diff --git a/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx b/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx new file mode 100644 index 000000000..0f70007ac --- /dev/null +++ b/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx @@ -0,0 +1,219 @@ +import React, { useState, useEffect, useRef } from 'react' +import type { FormEvent, ReactElement } from 'react' +import type { + PaymentOptions as PaymentOptionsInterface, + PaymentType, +} from 'vtex.return-app' +import { FormattedMessage } from 'react-intl' +import { + Layout, + PageHeader, + PageBlock, + Divider, + Button, + Spinner, + EmptyState, +} from 'vtex.styleguide' + +import { CustomReasons } from '../components/CustomReasons' +import { ExcludedCategories } from '../components/ExcludedCategories' +import { GeneralOptions } from '../components/GeneralOptions' +import { PaymentOptions } from '../components/PaymentOptions' +import { RequiredOptions } from '../components/RequiredOptions' +import { WarningModal } from '../components/WarningModal' +import { useSettingsDetail } from '../hooks/useSettings' + +export interface ModalWarningState { + openModal: boolean + customMaxDays: number + attemptNewSave: boolean +} + +export interface CheckboxProps { + label: ReactElement + checked: boolean + name: string +} + +const validateOptions = (paymentOptions: PaymentOptionsInterface) => { + const { enablePaymentMethodSelection, allowedPaymentTypes } = paymentOptions + + // If the user has not enabled the payment method selection, then the allowed payment types can be all unselected. + if (!enablePaymentMethodSelection) return true + + let result = false + + for (const paymentType of Object.keys(allowedPaymentTypes)) { + // If we have at least one payment method selected, then the payment options are valid. + if (allowedPaymentTypes[paymentType] && paymentType !== '__typename') { + result = true + break + } + } + + return result +} + +export const SettingDetailsContainer = () => { + const { + appSettings, + loading, + error, + savingAppSettings, + actions: { handleSaveAppSettings, dispatch }, + } = useSettingsDetail() + console.log("SETTINGS " ,appSettings) + + const [maxDaysWarning, setWarning] = useState({ + openModal: false, + customMaxDays: 0, + attemptNewSave: false, + }) + + const [hasPaymentMethodError, setHasPaymentMethodError] = useState(false) + + const paymentMethodsRef = useRef(null) + + useEffect(() => { + if (!maxDaysWarning.attemptNewSave) return + + handleSaveAppSettings() + + setWarning({ + ...maxDaysWarning, + attemptNewSave: false, + }) + }, [handleSaveAppSettings, maxDaysWarning]) + + const handleSubmit = (e: FormEvent) => { + e.preventDefault() + + const { customReturnReasons, maxDays, paymentOptions } = appSettings + + const maxCustomOptionsDays = customReturnReasons?.reduce( + (maxDay, option) => (maxDay > option.maxDays ? maxDay : option.maxDays), + 0 + ) + + if (maxCustomOptionsDays && maxCustomOptionsDays < maxDays) { + setWarning({ + ...maxDaysWarning, + openModal: true, + customMaxDays: maxCustomOptionsDays, + }) + + return + } + + if (!validateOptions(paymentOptions)) { + setHasPaymentMethodError(true) + paymentMethodsRef.current?.scrollIntoView() + + return + } + + setHasPaymentMethodError(false) + + handleSaveAppSettings() + } + + const handleOptionSelection = (options: { string: CheckboxProps }) => { + const paymentOptions = Object.keys(options) + + const updatedPaymentOptions = paymentOptions.reduce( + (acc, paymentOption) => { + return { + ...acc, + [paymentOption]: options[paymentOption].checked, + } + }, + {} + ) + + const paymentOptionsPayload = { + ...appSettings.paymentOptions, + allowedPaymentTypes: updatedPaymentOptions, + } + + dispatch({ + type: 'updatePaymentOptions', + payload: { + ...appSettings.paymentOptions, + allowedPaymentTypes: updatedPaymentOptions, + }, + }) + + if (!validateOptions(paymentOptionsPayload)) { + setHasPaymentMethodError(true) + + return + } + + setHasPaymentMethodError(false) + } + return ( + + } + /> + } + > + + {error ? ( + + } + > +

+ +

+
+ ) : loading ? ( + + ) : ( + <> + {maxDaysWarning.openModal && ( + + )} +
+ + + + + + + + + + +
+ +
+ + + )} +
+
+ ) +} diff --git a/react/admin/settings/components/GeneralOptions.tsx b/react/admin/settings/components/GeneralOptions.tsx index 41a8915f4..ca1355012 100644 --- a/react/admin/settings/components/GeneralOptions.tsx +++ b/react/admin/settings/components/GeneralOptions.tsx @@ -42,10 +42,12 @@ const messages = defineMessages({ export const GeneralOptions = () => { const { appSettings, - actions: { dispatch }, + actions , } = useSettings() const intl = useIntl() + + const dispatch = actions?.dispatch const handleToggle = (e: ChangeEvent) => { const { name, checked } = e.target diff --git a/react/admin/settings/components/RequiredOptions.tsx b/react/admin/settings/components/RequiredOptions.tsx index 3d31ad311..992b68418 100644 --- a/react/admin/settings/components/RequiredOptions.tsx +++ b/react/admin/settings/components/RequiredOptions.tsx @@ -8,9 +8,11 @@ import { useSettings } from '../hooks/useSettings' export const RequiredOptions = () => { const { appSettings, - actions: { dispatch }, + actions , } = useSettings() + const dispatch = actions?.dispatch + const handleMaxDaysInput = (e: ChangeEvent) => { const { value } = e.target const maxDays = Number(value) diff --git a/react/admin/settings/graphql/getSellerSettings.gql b/react/admin/settings/graphql/getSellerSettings.gql new file mode 100644 index 000000000..34c7d6eec --- /dev/null +++ b/react/admin/settings/graphql/getSellerSettings.gql @@ -0,0 +1,32 @@ + +query getSellerSettings($sellerId: String!) { + returnSellerSettings(sellerId: $sellerId) + @context(provider: "vtex.return-app") { + maxDays + excludedCategories + paymentOptions { + enablePaymentMethodSelection + allowedPaymentTypes { + bank + card + giftCard + } + automaticallyRefundPaymentMethod + } + termsUrl + customReturnReasons { + reason + maxDays + translations { + locale + translation + } + } + options { + enableOtherOptionSelection + enablePickupPoints + enableProportionalShippingValue + enableSelectItemCondition + } + } +} diff --git a/react/admin/settings/hooks/useSettings.ts b/react/admin/settings/hooks/useSettings.ts index f21439491..16cde208e 100644 --- a/react/admin/settings/hooks/useSettings.ts +++ b/react/admin/settings/hooks/useSettings.ts @@ -1,5 +1,8 @@ import { useContext } from 'react' import { SettingsContext } from '../provider/SettingsProvider' +import { SettingsDetailContext } from '../provider/SettingsDetailProvider' export const useSettings = () => useContext(SettingsContext) + +export const useSettingsDetail = () => useContext(SettingsDetailContext) diff --git a/react/admin/settings/provider/SettingsDetailProvider.tsx b/react/admin/settings/provider/SettingsDetailProvider.tsx new file mode 100644 index 000000000..23314050a --- /dev/null +++ b/react/admin/settings/provider/SettingsDetailProvider.tsx @@ -0,0 +1,124 @@ +import type { ApolloError } from 'apollo-client' +import type { FC, Dispatch } from 'react' +import React, { createContext, useReducer, useEffect } from 'react' +import { useQuery, useMutation } from 'react-apollo' +import { FormattedMessage } from 'react-intl' +import type {ReturnAppSettings, ReturnAppSettingsInput } from 'vtex.return-app' + +import APP_SETTINGS from '../graphql/getSellerSettings.gql' +import SAVE_APP_SETTINGS from '../graphql/saveAppSettings.gql' +import { useAlert } from '../../hooks/userAlert' +import { Actions, initialSettingsState } from './settingsReducer' +import { settingsReducer } from './settingsReducer' + +interface SettingsDetailContextInterface { + appSettings: ReturnAppSettings + actions: { + dispatch: Dispatch + handleSaveAppSettings: () => Promise + } + loading: boolean + error?: ApolloError + savingAppSettings: boolean +} + +export interface CustomRouteProps { + sellerId: string +} + +export const SettingsDetailContext = createContext( + {} as SettingsDetailContextInterface +) + +export const SettingsDetailProvider: FC = ({ + sellerId, + children }) => { + + console.log(sellerId) + + const [appSettings, dispatch] = useReducer( + settingsReducer, + initialSettingsState + ) + + const { openAlert } = useAlert() + + const { data, loading, error } = + useQuery<{ returnSellerSettings: ReturnAppSettings }>(APP_SETTINGS , { + variables: { + sellerId + } + }); + + const [saveAppSettings, { loading: savingAppSettings }] = useMutation< + { saveReturnAppSettings: boolean }, + { settings: ReturnAppSettingsInput } + >(SAVE_APP_SETTINGS) + + useEffect(() => { + if (data?.returnSellerSettings) { + dispatch({ + type: 'updateInitialState', + payload: data.returnSellerSettings, + }) + } + }, [data]) + + + useEffect(() => { + console.log(error) + }, [error]) + + const handleSaveAppSettings = async () => { + try { + const { paymentOptions } = appSettings + + const { automaticallyRefundPaymentMethod } = paymentOptions + + const adjustedPaymentOptions = paymentOptions.enablePaymentMethodSelection + ? paymentOptions + : { + ...paymentOptions, + automaticallyRefundPaymentMethod: Boolean( + automaticallyRefundPaymentMethod + ), + } + + const { data: mutationResult, errors } = await saveAppSettings({ + variables: { + settings: { ...appSettings, paymentOptions: adjustedPaymentOptions }, + }, + }) + + if (errors) { + throw new Error('Error saving app settings') + } + + if (mutationResult?.saveReturnAppSettings) { + openAlert( + 'success', + + ) + } + } catch { + openAlert( + 'error', + + ) + } + } + + return ( + + {children} + + ) +} diff --git a/react/common/components/returnList/ListTable.tsx b/react/common/components/returnList/ListTable.tsx index 2a825b04d..c05464bbf 100644 --- a/react/common/components/returnList/ListTable.tsx +++ b/react/common/components/returnList/ListTable.tsx @@ -9,6 +9,7 @@ import JumpToPage from './JumpToPage' import ListTableFilter from './ListTableFilter' import { useReturnRequestList } from '../../../hooks/useReturnRequestList' + const CSS_HANDLES = ['listTableContainer'] as const const ListTable = () => { diff --git a/react/common/components/returnListSettings/JumpToPageSettings.tsx b/react/common/components/returnListSettings/JumpToPageSettings.tsx new file mode 100644 index 000000000..9d4e29571 --- /dev/null +++ b/react/common/components/returnListSettings/JumpToPageSettings.tsx @@ -0,0 +1,80 @@ +import type { FormEvent } from 'react' +import React, { useEffect, useState } from 'react' +import { FormattedMessage } from 'react-intl' +import { Input, Button } from 'vtex.styleguide' +import { useCssHandles } from 'vtex.css-handles' + +const CSS_HANDLES = ['jumpToPageContainer'] as const + +interface Props { + handleJumpToPage: (page: number) => void + currentPage: number + maxPage: number +} + +const JumpToPageSettings = (props: Props) => { + const handles = useCssHandles(CSS_HANDLES) + + const { handleJumpToPage, currentPage, maxPage } = props + + const [desiredPage, setDesiredPage] = useState(currentPage) + const [canSubmit, setEnableSubmit] = useState(true) + + useEffect(() => { + if (desiredPage > maxPage || desiredPage <= 0) { + setEnableSubmit(false) + + return + } + + setEnableSubmit(true) + }, [desiredPage, maxPage]) + + const handleOnChange = (page: number) => { + setDesiredPage(page) + } + + const handleSubmit = () => { + handleJumpToPage(desiredPage) + } + + return ( +
+
+
+ + {' '} + {`${currentPage} - ${maxPage}`} + +
+
+ ) => + handleOnChange(Number(e.currentTarget.value)) + } + /> +
+
+ +
+
+
+ ) +} + +export default JumpToPageSettings diff --git a/react/common/components/returnListSettings/ListTableFilterSettings.tsx b/react/common/components/returnListSettings/ListTableFilterSettings.tsx new file mode 100644 index 000000000..c41af242b --- /dev/null +++ b/react/common/components/returnListSettings/ListTableFilterSettings.tsx @@ -0,0 +1,137 @@ +import type { FormEvent } from 'react' +import React, { useState } from 'react' +import { FormattedMessage } from 'react-intl' +import { Input, Button } from 'vtex.styleguide' +import type { + QueryReturnSettingsListArgs, + ReturnSettingsList +} from 'vtex.return-app' +import type { ApolloQueryResult } from 'apollo-client' +import { useRuntime } from 'vtex.render-runtime' +import { useCssHandles } from 'vtex.css-handles' + + +const CSS_HANDLES = ['listTableFilterContainer'] as const + +interface Props { + refetch: (variables?: QueryReturnSettingsListArgs | undefined) => Promise< + ApolloQueryResult<{ + returnSettingsList: ReturnSettingsList + }> + > + loading: boolean + isDisabled: boolean +} + +interface Filters { + id: string + sellerName: string +} + +type Keys = keyof Filters +export type FilterKeys = Exclude + +const initialFilters = { + id: '', + sellerName: '' +} as Filters + +const ListTableFilterSettings = (props: Props) => { + const handles = useCssHandles(CSS_HANDLES) + + const { refetch, loading, isDisabled } = props + + const { route } = useRuntime() + const [isFiltering, setIsFiltering] = useState(false) + const [filters, setFilters] = useState(initialFilters) + + // Used solely for refetch's variables + const selectedFilters = Object.keys(filters) + .filter((key) => filters[key]) + .reduce((newFilters, key) => { + newFilters[key] = filters[key] + + return newFilters + }, {}) + + const hasSelectedFilters = Object.keys(selectedFilters).length > 0 + + const handleSubmitFilters = (e: FormEvent) => { + e.preventDefault() + setIsFiltering(true) + refetch({ filter: selectedFilters, page: 1 }) + } + + const handleResetFilters = () => { + setIsFiltering(false) + setFilters(initialFilters) + refetch({ filter: undefined, page: 1 }) + } + + const handleOnChange = (key: FilterKeys, value: string) => { + setFilters({ + ...filters, + [key]: value, + }) + } + + return ( +
+
+ {route.domain === 'admin' ? ( +
+ + {(formattedMessage) => ( + ) => + handleOnChange('id', e.currentTarget.value) + } + readOnly={isDisabled && !isFiltering} + /> + )} + +
+ ) : null} +
+ + {(formattedMessage) => ( + ) => + handleOnChange('sellerName', e.currentTarget.value) + } + readOnly={isDisabled && !isFiltering} + /> + )} + +
+
+ +
+
+ +
+
+
+ ) +} + +export default ListTableFilterSettings diff --git a/react/common/components/returnListSettings/ListTableSchemaSettings.tsx b/react/common/components/returnListSettings/ListTableSchemaSettings.tsx new file mode 100644 index 000000000..9f596bb7d --- /dev/null +++ b/react/common/components/returnListSettings/ListTableSchemaSettings.tsx @@ -0,0 +1,63 @@ +import React from 'react' +import { FormattedMessage } from 'react-intl' +import { useRuntime } from 'vtex.render-runtime' +import { ButtonPlain } from 'vtex.styleguide' + + +const ReturnListTableSchemaSettings = () => { + const { + navigate, + route: { domain }, + } = useRuntime() + + const isAdmin = domain === 'admin' + + const navigateToRequest = (id: string) => { + const page = isAdmin + ? `/admin/app/returns/sellers/settings/${id}/details/ ` + : `#/my-returns/details/${id}` + + navigate({ + to: page, + }) + } + + return { + properties: { + ...(isAdmin && { + sellerId: { + title: ( + + ), + minWidth: 140, + cellRenderer({ cellData }) { + return ( + navigateToRequest(cellData)} + > + {cellData} + + ) + }, + }, + id: { + title: ( + + ), + minWidth: 310, + headerRenderer({ title }) { + return ( +
+ {title} +
+ ) + }, + }, + }), + + }, + } +} + +export default ReturnListTableSchemaSettings diff --git a/react/common/components/returnListSettings/ListTableSettings.tsx b/react/common/components/returnListSettings/ListTableSettings.tsx new file mode 100644 index 000000000..2b61ba99f --- /dev/null +++ b/react/common/components/returnListSettings/ListTableSettings.tsx @@ -0,0 +1,124 @@ +import React, { useMemo } from 'react' +import { FormattedMessage } from 'react-intl' +import { Table, EmptyState } from 'vtex.styleguide' +import { useCssHandles } from 'vtex.css-handles' +import { useRuntime } from 'vtex.render-runtime' + +import ReturnListTableSchemaSettings from './ListTableSchemaSettings' +import JumpToPageSettings from './JumpToPageSettings' +import ListTableFilterSettings from './ListTableFilterSettings' +import { useSettingsRequestList } from '../../../hooks/useSettingsRequestList' + +const CSS_HANDLES = ['listTableContainer'] as const + +const ListTableSettings = () => { + const { + returnRequestData: { data, loading, error, refetch }, + } = useSettingsRequestList() + + const { + route: { domain }, + hints: { mobile, phone }, + } = useRuntime() + + const isAdmin = domain === 'admin' + + const handles = useCssHandles(CSS_HANDLES) + + const { returnSettingsList } = data ?? {} + const { list, paging } = returnSettingsList ?? {} + + let pageItemFrom = 0 + let pageItemTo = 0 + + if (paging && list?.length) { + const { currentPage, total, perPage, pages } = paging + + pageItemFrom = currentPage === 1 ? 1 : (currentPage - 1) * perPage + 1 + pageItemTo = currentPage === pages ? total : currentPage * perPage + } + + const handleNextPage = () => { + if (!paging) return + + const { currentPage, pages } = paging + + if (currentPage === pages) return + + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + refetch({ page: currentPage + 1 }) + } + + const handlePrevPage = () => { + if (!paging) return + + const { currentPage } = paging + + if (currentPage === 1) return + + refetch({ page: currentPage - 1 }) + } + + const handleJumpToPage = (desiredPage: number) => { + desiredPage && refetch({ page: desiredPage }) + } + + const returnsListSchema = useMemo(() => ReturnListTableSchemaSettings(), []) + + if (error) { + return ( + + } + > + + + ) + } + + return ( +
+ {mobile && !isAdmin ? null : ( + + )} + + } + emptyStateChildren={ +

+ +

+ } + schema={returnsListSchema} + pagination={{ + textOf: ( + + ), + onNextClick: handleNextPage, + onPrevClick: handlePrevPage, + currentItemFrom: pageItemFrom, + currentItemTo: pageItemTo, + totalItems: paging?.total, + }} + /> + {!phone && paging && list?.length && !loading ? ( + + ) : null} + + ) +} + +export default ListTableSettings diff --git a/react/graphql/getSettingsRequestList.gql b/react/graphql/getSettingsRequestList.gql new file mode 100644 index 000000000..027c540af --- /dev/null +++ b/react/graphql/getSettingsRequestList.gql @@ -0,0 +1,27 @@ +query getSettingsRequestList($filter: ReturnSettingsFilters, $page: Int!) { + returnSettingsList(filter: $filter, page: $page) + @context(provider: "vtex.return-app") { + list{ + id + sellerId + maxDays + paymentOptions{ + allowedPaymentTypes{ + bank + card + giftCard + } + } + customReturnReasons{ + reason + } + excludedCategories + } + paging { + total + pages + currentPage + perPage + } + } +} diff --git a/react/hooks/useSettingsRequestList.ts b/react/hooks/useSettingsRequestList.ts new file mode 100644 index 000000000..c1fb431a4 --- /dev/null +++ b/react/hooks/useSettingsRequestList.ts @@ -0,0 +1,23 @@ +import { useQuery } from 'react-apollo' +import type { + ReturnSettingsList as ReturnSettingsListResponse, + QueryReturnRequestListArgs, +} from 'vtex.return-app' + +import SETTINGS_REQUEST_LIST from '../graphql/getSettingsRequestList.gql' + +export const useSettingsRequestList = () => { + const { data, loading, error, refetch } = useQuery< + { + returnSettingsList: ReturnSettingsListResponse + }, + QueryReturnRequestListArgs + >(SETTINGS_REQUEST_LIST, { + variables: { + page: 1, + }, + notifyOnNetworkStatusChange: true, + fetchPolicy: 'no-cache', + }) + return { returnRequestData: { data, loading, error, refetch } } +} diff --git a/react/package.json b/react/package.json index f3fc58aad..a7885a820 100644 --- a/react/package.json +++ b/react/package.json @@ -25,17 +25,7 @@ "@types/react-router": "^5.1.18", "@vtex/test-tools": "^0.3.2", "@vtex/tsconfig": "^0.6.0", - "prop-types": "^15.7.2", - "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", - "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", - "vtex.easypost": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost", - "vtex.format-currency": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency", - "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", - "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", - "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app", - "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", - "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" + "prop-types": "^15.7.2" }, "version": "3.5.6" } diff --git a/react/yarn.lock b/react/yarn.lock index 5ce8cf26b..10750b81c 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -5178,46 +5178,6 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql": - version "1.102.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql#ad1dfac8d076034d4326a00a3da20a3915951f53" - -"vtex.css-handles@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles": - version "0.4.4" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles#8c45c6decf9acd2b944e07261686decff93d6422" - -"vtex.easypost@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost": - version "0.1.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost#078a135b63bb4fc5e39e6ad789d0caf9ea368f35" - -"vtex.format-currency@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency": - version "0.4.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency#aaed82b498270f0bb6f37e93eff7e7f401e4d283" - -"vtex.my-account-commons@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons": - version "1.6.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons#3715228fb82e81e955e6a90d11e7975e72b37b2e" - -"vtex.my-account@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account": - version "1.25.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account#3bc46389c0aa28f4e3e2e008fe3690f5901b1f2a" - -"vtex.render-runtime@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime": - version "8.132.4" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" - -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app": - version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678287051/public/@types/vtex.return-app#21f888d1fad65152de0c5e778dd763a3f3560c08" - -"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": - version "9.146.3" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" - -"vtex.tenant-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql": - version "0.1.2" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql#74673fe86baefe74f21a6d2615993ea0ccb5e79e" - w3c-hr-time@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" From a6f9afaa882b6df9e31382828db11b95326b80cc Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Tue, 14 Mar 2023 17:16:57 -0500 Subject: [PATCH 15/81] feat: added support for list and update config to sellers --- graphql/schema.graphql | 4 +- graphql/types/SellerSetting.graphql | 4 +- masterdata/sellerSetting/schema.json | 3 +- node/package.json | 12 +- node/resolvers/index.ts | 2 + node/resolvers/updateSellerSetting.ts | 43 ++++++ node/services/SellerSettingService.ts | 2 +- node/services/returnSellerSettingsService.ts | 34 +++-- node/yarn.lock | 42 +++++- react/admin/AdminSettingDetail.tsx | 6 +- .../SettingDetailsContainer.tsx | 15 ++- .../CustomReasons/CustomReasonModal.tsx | 7 +- .../CustomReasons/CustomReasons.tsx | 7 +- .../CustomReasons/TranslationsModal.tsx | 7 +- .../components/ExcludedCategories.tsx | 12 +- .../settings/components/GeneralOptions.tsx | 4 +- .../settings/components/PaymentOptions.tsx | 8 +- .../settings/components/RequiredOptions.tsx | 4 +- .../settings/graphql/getSellerSettings.gql | 2 + .../settings/graphql/updateSellerSetting.gql | 4 + react/admin/settings/hooks/useSettings.ts | 3 - .../admin/settings/hooks/useSettingsSeller.ts | 5 + .../provider/SettingsDetailProvider.tsx | 124 ------------------ .../settings/provider/SettingsProvider.tsx | 58 +++++--- .../settings/provider/settingsReducer.ts | 19 ++- react/package.json | 12 +- react/yarn.lock | 40 ++++++ 27 files changed, 280 insertions(+), 203 deletions(-) create mode 100644 node/resolvers/updateSellerSetting.ts create mode 100644 react/admin/settings/graphql/updateSellerSetting.gql create mode 100644 react/admin/settings/hooks/useSettingsSeller.ts delete mode 100644 react/admin/settings/provider/SettingsDetailProvider.tsx diff --git a/graphql/schema.graphql b/graphql/schema.graphql index def11f1f1..3a98a4f7b 100644 --- a/graphql/schema.graphql +++ b/graphql/schema.graphql @@ -1,6 +1,6 @@ type Query { returnAppSettings: ReturnAppSettings @cacheControl(maxAge: ZERO) - returnSellerSettings(sellerId: String!): ReturnAppSettings + returnSellerSettings(sellerId: String!): SellerSetting @withUserProfile @cacheControl(maxAge: ZERO) categoryTreeName: [CategoryInfo]! @cacheControl(maxAge: MEDIUM) @@ -49,7 +49,7 @@ type Mutation { @withUserProfile saveReturnAppSettings(settings: ReturnAppSettingsInput!): Boolean saveSellerSetting(settings: SellerSettingInput!): Boolean - updateSellerSetting(sellerId: String!, settings: SellerSettingInput!): Boolean + updateSellerSetting(id: ID!, settings: SellerSettingInput!): Boolean updateReturnRequestStatus( requestId: ID! sellerName: String diff --git a/graphql/types/SellerSetting.graphql b/graphql/types/SellerSetting.graphql index 0a79b99cc..0eb5e606a 100644 --- a/graphql/types/SellerSetting.graphql +++ b/graphql/types/SellerSetting.graphql @@ -1,7 +1,7 @@ type SellerSetting { id: String sellerId: String! - parentAccount: String! + parentAccount: String maxDays: Int! excludedCategories: [String!]! paymentOptions: PaymentOptions! @@ -17,7 +17,7 @@ type SellerSettingResponseList { input SellerSettingInput { id: String sellerId: String! - parentAccount: String! + parentAccount: String maxDays: Int! excludedCategories: [String!]! paymentOptions: PaymentOptionsInput! diff --git a/masterdata/sellerSetting/schema.json b/masterdata/sellerSetting/schema.json index 1610402a0..3e69f27ef 100644 --- a/masterdata/sellerSetting/schema.json +++ b/masterdata/sellerSetting/schema.json @@ -70,8 +70,7 @@ } }, "required": [ - "sellerId", - "parentAccount" + "sellerId" ], "v-cache": false, "v-default-fields": [ diff --git a/node/package.json b/node/package.json index 70c6806e4..3c5dec57b 100644 --- a/node/package.json +++ b/node/package.json @@ -15,7 +15,17 @@ "@vtex/test-tools": "^1.0.0", "@vtex/tsconfig": "^0.6.0", "tslint": "^6.1.3", - "tslint-config-vtex": "^2.1.0" + "tslint-config-vtex": "^2.1.0", + "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", + "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", + "vtex.easypost": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost", + "vtex.format-currency": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency", + "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", + "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", + "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app", + "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", + "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, "scripts": { "lint": "tsc --noEmit --pretty && tslint -c tslint.json --fix './**/*.ts'" diff --git a/node/resolvers/index.ts b/node/resolvers/index.ts index 1178e07f2..70458a29a 100644 --- a/node/resolvers/index.ts +++ b/node/resolvers/index.ts @@ -13,10 +13,12 @@ import { ReturnRequestResponse } from './ReturnRequestResponse' import { updateReturnRequestStatus } from './updateReturnRequestStatus' import { nearestPickupPoints } from './nearestPickupPoints' import { returnSellerSettings } from './returnSellerSettings' +import { updateSellerSetting } from './updateSellerSetting' export const mutations = { createReturnRequest, updateReturnRequestStatus, + updateSellerSetting, ...settingsMutation, } diff --git a/node/resolvers/updateSellerSetting.ts b/node/resolvers/updateSellerSetting.ts new file mode 100644 index 000000000..93744174a --- /dev/null +++ b/node/resolvers/updateSellerSetting.ts @@ -0,0 +1,43 @@ +import type { + MutationUpdateSellerSettingArgs, +} from 'vtex.return-app' + +import { + validateMaxDaysCustomReasons, + validatePaymentOptions, + valideteUniqueCustomReasonsPerLocale, +} from '../utils/appSettingsValidation' + +export const updateSellerSetting = async ( + _: unknown, + args: MutationUpdateSellerSettingArgs, + ctx: Context +) => { + const { + clients: { sellerSetting }, + } = ctx + + const {id, settings} = args || {} + + // validate if all custom reasons have max days smaller than the general max days + validateMaxDaysCustomReasons( + settings.maxDays, + settings.customReturnReasons + ) + + // validate if all custom reasons have unique locales for their translations + valideteUniqueCustomReasonsPerLocale(settings.customReturnReasons) + + const currentSettings: any = { + ...settings, + // validate that there is at least one payment method selected or user has to use the same as in the order + paymentOptions: validatePaymentOptions(settings.paymentOptions), + } + console.log('id: ', id) + if(id){ + await sellerSetting.update(id, currentSettings) + return true + } + + return false +} \ No newline at end of file diff --git a/node/services/SellerSettingService.ts b/node/services/SellerSettingService.ts index b62b4eb81..2d39323fd 100644 --- a/node/services/SellerSettingService.ts +++ b/node/services/SellerSettingService.ts @@ -28,7 +28,7 @@ export async function saveSellerSettingService(ctx: Context, args: MutationSaveS // validate if all custom reasons have unique locales for their translations valideteUniqueCustomReasonsPerLocale(customReturnReasons) - const currentSettings = { + const currentSettings: any = { ...settings, // validate that there is at least one payment method selected or user has to use the same as in the order paymentOptions: validatePaymentOptions(paymentOptions), diff --git a/node/services/returnSellerSettingsService.ts b/node/services/returnSellerSettingsService.ts index 386dfdef4..bfa365948 100644 --- a/node/services/returnSellerSettingsService.ts +++ b/node/services/returnSellerSettingsService.ts @@ -1,8 +1,6 @@ -import type { - ReturnAppSettings, -} from 'vtex.return-app' +import type { SellerSetting } from 'vtex.return-app' -export async function returnSellerSettingsService(ctx: Context, sellerId: string): Promise { +export async function returnSellerSettingsService(ctx: Context, sellerId: string): Promise { const { clients: { sellerSetting }, } = ctx @@ -23,20 +21,20 @@ export async function returnSellerSettingsService(ctx: Context, sellerId: string undefined, `sellerId=${sellerId}` ) - if(settings?.[0]){ - const response: ReturnAppSettings = { - maxDays: settings?.[0]?.maxDays, - excludedCategories: settings?.[0]?.excludedCategories, - paymentOptions: settings?.[0]?.paymentOptions, - termsUrl: settings?.[0]?.termsUrl, - customReturnReasons:settings?.[0]?.customReturnReasons, - options: settings?.[0]?.options, - } - return response - }else{ - return null - } - + // if(settings?.[0]){ + // const response: ReturnAppSettings = { + // maxDays: settings?.[0]?.maxDays, + // excludedCategories: settings?.[0]?.excludedCategories, + // paymentOptions: settings?.[0]?.paymentOptions, + // termsUrl: settings?.[0]?.termsUrl, + // customReturnReasons:settings?.[0]?.customReturnReasons, + // options: settings?.[0]?.options, + // } + // return response + // }else{ + // return null + // } + return settings?.[0] || null } diff --git a/node/yarn.lock b/node/yarn.lock index 5bafc79f9..931d77ff1 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -5610,7 +5610,7 @@ static-extend@^0.1.1: define-property "^0.2.5" object-copy "^0.1.0" -"stats-lite@github:vtex/node-stats-lite#dist": +stats-lite@vtex/node-stats-lite#dist: version "2.2.0" resolved "https://codeload.github.com/vtex/node-stats-lite/tar.gz/1b0d39cc41ef7aaecfd541191f877887a2044797" dependencies: @@ -6127,6 +6127,46 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql": + version "1.102.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql#ad1dfac8d076034d4326a00a3da20a3915951f53" + +"vtex.css-handles@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles": + version "0.4.4" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles#8c45c6decf9acd2b944e07261686decff93d6422" + +"vtex.easypost@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost": + version "0.1.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost#078a135b63bb4fc5e39e6ad789d0caf9ea368f35" + +"vtex.format-currency@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency": + version "0.4.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency#aaed82b498270f0bb6f37e93eff7e7f401e4d283" + +"vtex.my-account-commons@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons": + version "1.6.0" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons#3715228fb82e81e955e6a90d11e7975e72b37b2e" + +"vtex.my-account@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account": + version "1.25.0" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account#3bc46389c0aa28f4e3e2e008fe3690f5901b1f2a" + +"vtex.render-runtime@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime": + version "8.132.4" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" + +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app": + version "3.5.6" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app#0124b7290d3b9942cba402a8954b855ae5eba40a" + +"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": + version "9.146.3" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" + +"vtex.tenant-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql": + version "0.1.2" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql#74673fe86baefe74f21a6d2615993ea0ccb5e79e" + w3c-hr-time@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" diff --git a/react/admin/AdminSettingDetail.tsx b/react/admin/AdminSettingDetail.tsx index 06f5a11a0..bb1baf9e4 100644 --- a/react/admin/AdminSettingDetail.tsx +++ b/react/admin/AdminSettingDetail.tsx @@ -1,7 +1,7 @@ import React from 'react' import { AlertProvider } from './provider/AlertProvider' -import { SettingsDetailProvider } from './settings/provider/SettingsDetailProvider' +import { SettingsProvider } from './settings/provider/SettingsProvider' import { SettingDetailsContainer } from './settings/SettingDetails/SettingDetailsContainer' interface CustomRouteProps { @@ -13,9 +13,9 @@ interface CustomRouteProps { export const AdminSettingDetail = ({ params }: CustomRouteProps) => { return ( - + - + ) } diff --git a/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx b/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx index 0f70007ac..ac3b0f49f 100644 --- a/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx +++ b/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx @@ -21,7 +21,7 @@ import { GeneralOptions } from '../components/GeneralOptions' import { PaymentOptions } from '../components/PaymentOptions' import { RequiredOptions } from '../components/RequiredOptions' import { WarningModal } from '../components/WarningModal' -import { useSettingsDetail } from '../hooks/useSettings' +import { useSettings } from '../hooks/useSettings' export interface ModalWarningState { openModal: boolean @@ -60,9 +60,10 @@ export const SettingDetailsContainer = () => { loading, error, savingAppSettings, - actions: { handleSaveAppSettings, dispatch }, - } = useSettingsDetail() - console.log("SETTINGS " ,appSettings) + actions, + } = useSettings() + + const { handleSaveAppSettings, dispatch } = actions || {} const [maxDaysWarning, setWarning] = useState({ openModal: false, @@ -88,7 +89,7 @@ export const SettingDetailsContainer = () => { const handleSubmit = (e: FormEvent) => { e.preventDefault() - const { customReturnReasons, maxDays, paymentOptions } = appSettings + const { customReturnReasons, maxDays, paymentOptions } = appSettings || {} const maxCustomOptionsDays = customReturnReasons?.reduce( (maxDay, option) => (maxDay > option.maxDays ? maxDay : option.maxDays), @@ -131,14 +132,14 @@ export const SettingDetailsContainer = () => { ) const paymentOptionsPayload = { - ...appSettings.paymentOptions, + ...appSettings?.paymentOptions, allowedPaymentTypes: updatedPaymentOptions, } dispatch({ type: 'updatePaymentOptions', payload: { - ...appSettings.paymentOptions, + ...appSettings?.paymentOptions, allowedPaymentTypes: updatedPaymentOptions, }, }) diff --git a/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx b/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx index ef75db2d4..ece6b7548 100644 --- a/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx +++ b/react/admin/settings/components/CustomReasons/CustomReasonModal.tsx @@ -21,10 +21,13 @@ export const CustomReasonModal = ({ customReasonOnFocus, }: CustomReasonModalProps) => { const { - appSettings: { maxDays, customReturnReasons }, - actions: { dispatch }, + appSettings, + actions, } = useSettings() + const { dispatch } = actions || {} + const { maxDays, customReturnReasons } = appSettings || {} + const [tempReason, setTempReason] = useState( {} as CustomReturnReason ) diff --git a/react/admin/settings/components/CustomReasons/CustomReasons.tsx b/react/admin/settings/components/CustomReasons/CustomReasons.tsx index 5534925a8..918bdcebb 100644 --- a/react/admin/settings/components/CustomReasons/CustomReasons.tsx +++ b/react/admin/settings/components/CustomReasons/CustomReasons.tsx @@ -88,10 +88,13 @@ export const CustomReasons = () => { useState(null) const { - appSettings: { customReturnReasons }, - actions: { dispatch }, + appSettings, + actions, } = useSettings() + const { customReturnReasons } = appSettings || {} + const { dispatch } = actions || {} + const handleDeleteCustomReason = (reasonIndex: number) => { setIndexToDelete(reasonIndex) } diff --git a/react/admin/settings/components/CustomReasons/TranslationsModal.tsx b/react/admin/settings/components/CustomReasons/TranslationsModal.tsx index ec827d5d0..c15d9eb6e 100644 --- a/react/admin/settings/components/CustomReasons/TranslationsModal.tsx +++ b/react/admin/settings/components/CustomReasons/TranslationsModal.tsx @@ -97,10 +97,13 @@ export const TranslationsModal = ({ >([]) const { - appSettings: { customReturnReasons }, - actions: { dispatch }, + appSettings, + actions, } = useSettings() + const { customReturnReasons } = appSettings || {} + const { dispatch } = actions || {} + const { data, loading, error } = useQuery<{ tenantInfo: Tenant }>(TENANT_INFO) useEffect(() => { diff --git a/react/admin/settings/components/ExcludedCategories.tsx b/react/admin/settings/components/ExcludedCategories.tsx index 4cf5255dc..616bdc498 100644 --- a/react/admin/settings/components/ExcludedCategories.tsx +++ b/react/admin/settings/components/ExcludedCategories.tsx @@ -38,7 +38,7 @@ const filterSearchCategories = ({ const removeExcluded = categoryList.filter(({ id }) => { if (!id) return false - return !excludedCategories.includes(id) + return !excludedCategories?.includes(id) }) const formattedLabels = removeExcluded.map(({ id, name }) => { @@ -56,10 +56,14 @@ const filterSearchCategories = ({ export const ExcludedCategories = () => { const [searchedCategory, setSearchedCategory] = React.useState('') const { - appSettings: { excludedCategories }, - actions: { dispatch }, + appSettings, + actions, } = useSettings() + const { dispatch } = actions || {} + + const { excludedCategories } = appSettings || {} + const intl = useIntl() const { data, loading, error } = useQuery<{ categoryTreeName: CategoryInfo[] @@ -141,7 +145,7 @@ export const ExcludedCategories = () => { /> - {!excludedCategories.length ? null : ( + {!excludedCategories?.length ? null : (
    {excludedCategories.map((categoryId) => { const categoryName = categoryNamesMap[categoryId] diff --git a/react/admin/settings/components/GeneralOptions.tsx b/react/admin/settings/components/GeneralOptions.tsx index ca1355012..d90d006b6 100644 --- a/react/admin/settings/components/GeneralOptions.tsx +++ b/react/admin/settings/components/GeneralOptions.tsx @@ -52,7 +52,7 @@ export const GeneralOptions = () => { const handleToggle = (e: ChangeEvent) => { const { name, checked } = e.target - const selectedOption = appSettings.options ?? {} + const selectedOption = appSettings?.options ?? {} const updatedSelection = { ...selectedOption, [name]: checked } dispatch({ type: 'updateOptions', payload: updatedSelection }) @@ -73,7 +73,7 @@ export const GeneralOptions = () => { label={intl.formatMessage(messages[`${option}-label`])} helpText={intl.formatMessage(messages[`${option}-description`])} onChange={handleToggle} - checked={appSettings.options?.[option]} + checked={appSettings?.options?.[option]} /> {i === self.length - 1 ? null : (
    diff --git a/react/admin/settings/components/PaymentOptions.tsx b/react/admin/settings/components/PaymentOptions.tsx index 5ac1e96a3..f29fd4368 100644 --- a/react/admin/settings/components/PaymentOptions.tsx +++ b/react/admin/settings/components/PaymentOptions.tsx @@ -56,9 +56,11 @@ export const PaymentOptions = forwardRef( ({ handleOptionSelection, hasError }, ref) => { const { appSettings, - actions: { dispatch }, + actions, } = useSettings() + const { dispatch } = actions || {} + const intl = useIntl() const optionsLabel = createOptionsLabel( @@ -76,7 +78,7 @@ export const PaymentOptions = forwardRef( payload: { ...appSettings?.paymentOptions, enablePaymentMethodSelection: checked, - allowedPaymentTypes: appSettings.paymentOptions.allowedPaymentTypes, + allowedPaymentTypes: appSettings?.paymentOptions?.allowedPaymentTypes, // Always return to the default state when use checks / unchecks the checkbox. This way we avaiod a confusing state where buttons is disable but set to on. automaticallyRefundPaymentMethod: false, }, @@ -98,7 +100,7 @@ export const PaymentOptions = forwardRef( } const { enablePaymentMethodSelection, automaticallyRefundPaymentMethod } = - appSettings.paymentOptions ?? {} + appSettings?.paymentOptions ?? {} return (
    diff --git a/react/admin/settings/components/RequiredOptions.tsx b/react/admin/settings/components/RequiredOptions.tsx index 992b68418..9b5a9fb2b 100644 --- a/react/admin/settings/components/RequiredOptions.tsx +++ b/react/admin/settings/components/RequiredOptions.tsx @@ -36,7 +36,7 @@ export const RequiredOptions = () => {
    {
    useContext(SettingsContext) - -export const useSettingsDetail = () => useContext(SettingsDetailContext) diff --git a/react/admin/settings/hooks/useSettingsSeller.ts b/react/admin/settings/hooks/useSettingsSeller.ts new file mode 100644 index 000000000..b1a8b75df --- /dev/null +++ b/react/admin/settings/hooks/useSettingsSeller.ts @@ -0,0 +1,5 @@ +import { useContext } from 'react' + +import { SettingsDetailContextSeller } from '../provider/SettingsDetailProvider' + +export const useSettingsDetail = () => useContext(SettingsDetailContextSeller) \ No newline at end of file diff --git a/react/admin/settings/provider/SettingsDetailProvider.tsx b/react/admin/settings/provider/SettingsDetailProvider.tsx deleted file mode 100644 index 23314050a..000000000 --- a/react/admin/settings/provider/SettingsDetailProvider.tsx +++ /dev/null @@ -1,124 +0,0 @@ -import type { ApolloError } from 'apollo-client' -import type { FC, Dispatch } from 'react' -import React, { createContext, useReducer, useEffect } from 'react' -import { useQuery, useMutation } from 'react-apollo' -import { FormattedMessage } from 'react-intl' -import type {ReturnAppSettings, ReturnAppSettingsInput } from 'vtex.return-app' - -import APP_SETTINGS from '../graphql/getSellerSettings.gql' -import SAVE_APP_SETTINGS from '../graphql/saveAppSettings.gql' -import { useAlert } from '../../hooks/userAlert' -import { Actions, initialSettingsState } from './settingsReducer' -import { settingsReducer } from './settingsReducer' - -interface SettingsDetailContextInterface { - appSettings: ReturnAppSettings - actions: { - dispatch: Dispatch - handleSaveAppSettings: () => Promise - } - loading: boolean - error?: ApolloError - savingAppSettings: boolean -} - -export interface CustomRouteProps { - sellerId: string -} - -export const SettingsDetailContext = createContext( - {} as SettingsDetailContextInterface -) - -export const SettingsDetailProvider: FC = ({ - sellerId, - children }) => { - - console.log(sellerId) - - const [appSettings, dispatch] = useReducer( - settingsReducer, - initialSettingsState - ) - - const { openAlert } = useAlert() - - const { data, loading, error } = - useQuery<{ returnSellerSettings: ReturnAppSettings }>(APP_SETTINGS , { - variables: { - sellerId - } - }); - - const [saveAppSettings, { loading: savingAppSettings }] = useMutation< - { saveReturnAppSettings: boolean }, - { settings: ReturnAppSettingsInput } - >(SAVE_APP_SETTINGS) - - useEffect(() => { - if (data?.returnSellerSettings) { - dispatch({ - type: 'updateInitialState', - payload: data.returnSellerSettings, - }) - } - }, [data]) - - - useEffect(() => { - console.log(error) - }, [error]) - - const handleSaveAppSettings = async () => { - try { - const { paymentOptions } = appSettings - - const { automaticallyRefundPaymentMethod } = paymentOptions - - const adjustedPaymentOptions = paymentOptions.enablePaymentMethodSelection - ? paymentOptions - : { - ...paymentOptions, - automaticallyRefundPaymentMethod: Boolean( - automaticallyRefundPaymentMethod - ), - } - - const { data: mutationResult, errors } = await saveAppSettings({ - variables: { - settings: { ...appSettings, paymentOptions: adjustedPaymentOptions }, - }, - }) - - if (errors) { - throw new Error('Error saving app settings') - } - - if (mutationResult?.saveReturnAppSettings) { - openAlert( - 'success', - - ) - } - } catch { - openAlert( - 'error', - - ) - } - } - - return ( - - {children} - - ) -} diff --git a/react/admin/settings/provider/SettingsProvider.tsx b/react/admin/settings/provider/SettingsProvider.tsx index a4532f830..b59b3e084 100644 --- a/react/admin/settings/provider/SettingsProvider.tsx +++ b/react/admin/settings/provider/SettingsProvider.tsx @@ -1,18 +1,25 @@ import type { ApolloError } from 'apollo-client' -import type { FC, Dispatch } from 'react' -import React, { createContext, useReducer, useEffect } from 'react' +import type { Dispatch } from 'react' +import React, { createContext, useReducer, useEffect, ReactNode } from 'react' import { useQuery, useMutation } from 'react-apollo' import { FormattedMessage } from 'react-intl' -import type { ReturnAppSettings, ReturnAppSettingsInput } from 'vtex.return-app' +import type { ReturnAppSettings, SellerSetting, ReturnAppSettingsInput, SellerSettingInput } from 'vtex.return-app' import APP_SETTINGS from '../graphql/getAppSettings.gql' +import APP_SETTINGS_SELLERS from '../graphql/getSellerSettings.gql' import SAVE_APP_SETTINGS from '../graphql/saveAppSettings.gql' +import UPDATE_APP_SETTINGS_SELLERS from '../graphql/updateSellerSetting.gql' import { useAlert } from '../../hooks/userAlert' import type { Actions } from './settingsReducer' import { settingsReducer, initialSettingsState } from './settingsReducer' + +interface ISettingsProvider { + children: ReactNode + sellerId?: string +} interface SettingsContextInterface { - appSettings: ReturnAppSettings + appSettings: ReturnAppSettings | SellerSetting actions: { dispatch: Dispatch handleSaveAppSettings: () => Promise @@ -20,33 +27,42 @@ interface SettingsContextInterface { loading: boolean error?: ApolloError savingAppSettings: boolean + updatingAppSettings: boolean } export const SettingsContext = createContext( {} as SettingsContextInterface ) -export const SettingsProvider: FC = ({ children }) => { - const [appSettings, dispatch] = useReducer( +export const SettingsProvider = ({ children, sellerId }: ISettingsProvider) => { + const [appSettings, dispatch]: any = useReducer( settingsReducer, initialSettingsState ) const { openAlert } = useAlert() + const QUERY = sellerId ? APP_SETTINGS_SELLERS : APP_SETTINGS + const VARIABLES = sellerId ? {variables: {sellerId}} : {} + const { data, loading, error } = - useQuery<{ returnAppSettings: ReturnAppSettings }>(APP_SETTINGS) + useQuery<{ returnAppSettings: ReturnAppSettings, returnSellerSettings: SellerSetting}>(QUERY, VARIABLES) const [saveAppSettings, { loading: savingAppSettings }] = useMutation< - { saveReturnAppSettings: boolean }, - { settings: ReturnAppSettingsInput } + { saveReturnAppSettings: boolean, updateSellerSetting: boolean }, + { settings: ReturnAppSettingsInput} >(SAVE_APP_SETTINGS) + const [updateSellerSetting, { loading: updatingAppSettings }] = useMutation< + { updateSellerSetting: boolean, saveReturnAppSettings: boolean }, + { settings: SellerSettingInput} + >(UPDATE_APP_SETTINGS_SELLERS) + useEffect(() => { - if (data?.returnAppSettings) { + if (data?.returnAppSettings || data?.returnSellerSettings) { dispatch({ type: 'updateInitialState', - payload: data.returnAppSettings, + payload: sellerId ? data?.returnSellerSettings : data.returnAppSettings, }) } }, [data]) @@ -65,18 +81,23 @@ export const SettingsProvider: FC = ({ children }) => { automaticallyRefundPaymentMethod ), } - - const { data: mutationResult, errors } = await saveAppSettings({ - variables: { - settings: { ...appSettings, paymentOptions: adjustedPaymentOptions }, - }, - }) + + const {id, ...payload } = appSettings + const MUTATION_VARIABLES = sellerId ? { + id, + settings: {...payload, paymentOptions: adjustedPaymentOptions }, + } : { + settings: {...payload, paymentOptions: adjustedPaymentOptions }, + } + console.log('MUTATION_VARIABLES: ', MUTATION_VARIABLES) + + const { data: mutationResult, errors } = sellerId ? await updateSellerSetting({ variables: MUTATION_VARIABLES }) : await saveAppSettings({ variables: MUTATION_VARIABLES }) if (errors) { throw new Error('Error saving app settings') } - if (mutationResult?.saveReturnAppSettings) { + if (mutationResult?.saveReturnAppSettings || mutationResult?.updateSellerSetting) { openAlert( 'success', @@ -97,6 +118,7 @@ export const SettingsProvider: FC = ({ children }) => { loading, error, savingAppSettings, + updatingAppSettings, actions: { dispatch, handleSaveAppSettings }, }} > diff --git a/react/admin/settings/provider/settingsReducer.ts b/react/admin/settings/provider/settingsReducer.ts index 68e0063db..19e0ab0de 100644 --- a/react/admin/settings/provider/settingsReducer.ts +++ b/react/admin/settings/provider/settingsReducer.ts @@ -3,9 +3,10 @@ import type { PaymentOptions, ReturnAppSettings, ReturnOption, + SellerSetting } from 'vtex.return-app' -export const initialSettingsState: ReturnAppSettings = { +export const initialSettingsState: ReturnAppSettings | SellerSetting = { maxDays: 0, excludedCategories: [], termsUrl: '', @@ -70,13 +71,20 @@ export const optionsAction = (options: ReturnOption) => { } } -export const initialStateAction = (initialState: ReturnAppSettings) => { +export const initialStateAction = (initialState: ReturnAppSettings | SellerSetting) => { return { type: 'updateInitialState' as const, payload: initialState, } } +export const initialStateActionSeller = (initialStateSeller: ReturnAppSettings | SellerSetting) => { + return { + type: 'updateInitialStateSeller' as const, + payload: initialStateSeller, + } +} + export type Actions = | ReturnType | ReturnType @@ -85,8 +93,9 @@ export type Actions = | ReturnType | ReturnType | ReturnType + | ReturnType -export const settingsReducer = (state: ReturnAppSettings, action: Actions) => { +export const settingsReducer = (state: ReturnAppSettings | SellerSetting, action: Actions) => { switch (action.type) { case 'updateMaxDays': { return { @@ -134,6 +143,10 @@ export const settingsReducer = (state: ReturnAppSettings, action: Actions) => { return action.payload } + case 'updateInitialStateSeller': { + return action.payload + } + default: { return state } diff --git a/react/package.json b/react/package.json index a7885a820..62078d9ee 100644 --- a/react/package.json +++ b/react/package.json @@ -25,7 +25,17 @@ "@types/react-router": "^5.1.18", "@vtex/test-tools": "^0.3.2", "@vtex/tsconfig": "^0.6.0", - "prop-types": "^15.7.2" + "prop-types": "^15.7.2", + "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", + "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", + "vtex.easypost": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost", + "vtex.format-currency": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency", + "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", + "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", + "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", + "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app", + "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", + "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, "version": "3.5.6" } diff --git a/react/yarn.lock b/react/yarn.lock index 10750b81c..f81915ec5 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -5178,6 +5178,46 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql": + version "1.102.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql#ad1dfac8d076034d4326a00a3da20a3915951f53" + +"vtex.css-handles@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles": + version "0.4.4" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles#8c45c6decf9acd2b944e07261686decff93d6422" + +"vtex.easypost@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost": + version "0.1.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost#078a135b63bb4fc5e39e6ad789d0caf9ea368f35" + +"vtex.format-currency@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency": + version "0.4.1" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency#aaed82b498270f0bb6f37e93eff7e7f401e4d283" + +"vtex.my-account-commons@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons": + version "1.6.0" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons#3715228fb82e81e955e6a90d11e7975e72b37b2e" + +"vtex.my-account@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account": + version "1.25.0" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account#3bc46389c0aa28f4e3e2e008fe3690f5901b1f2a" + +"vtex.render-runtime@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime": + version "8.132.4" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" + +"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app": + version "3.5.6" + resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app#0124b7290d3b9942cba402a8954b855ae5eba40a" + +"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": + version "9.146.3" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" + +"vtex.tenant-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql": + version "0.1.2" + resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql#74673fe86baefe74f21a6d2615993ea0ccb5e79e" + w3c-hr-time@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" From abd6bec812654e9b0f0d9dd0836ce5a340fa128c Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Thu, 16 Mar 2023 06:42:10 -0500 Subject: [PATCH 16/81] fix: seller validation --- node/middlewares/sellerSetting.ts | 4 +--- node/middlewares/sellerValidation.ts | 19 +++++++++++++------ node/package.json | 2 +- node/resolvers/updateSellerSetting.ts | 2 +- node/yarn.lock | 4 ++-- react/package.json | 2 +- react/yarn.lock | 4 ++-- 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/node/middlewares/sellerSetting.ts b/node/middlewares/sellerSetting.ts index d06265c38..24d75f541 100644 --- a/node/middlewares/sellerSetting.ts +++ b/node/middlewares/sellerSetting.ts @@ -1,12 +1,10 @@ import { UserInputError } from '@vtex/api' -import { json } from 'co-body' import { saveSellerSettingService, returnSellerSettingService } from '../services/SellerSettingService' import { SETTINGS_PATH } from '../utils/constants' export async function saveSellerSetting(ctx: Context) { - const { req } = ctx + const { body }: any = ctx || {} - const body = await json(req) ctx.set('Cache-Control', 'no-cache') try { diff --git a/node/middlewares/sellerValidation.ts b/node/middlewares/sellerValidation.ts index 5b89608ed..f0b7a1e7a 100644 --- a/node/middlewares/sellerValidation.ts +++ b/node/middlewares/sellerValidation.ts @@ -13,26 +13,33 @@ export async function sellerValidation(ctx: Context, next: () => Promise) } = ctx const authCookie = header.vtexidclientautcookie as string | undefined - const { _sellerName } = query - const {sellerName} = await json(req) + const {settings} = await json(req) + const sellerName = settings?.sellerId const { sellerId } = params as { sellerId: string } if(authCookie && (_sellerName || sellerName || sellerId) ){ const accountName = _sellerName || sellerName || sellerId - + try { const account = await vtexId.getAccount(authCookie, accountName) - - if(!account){ + + if(account.accountName != accountName){ throw new AuthenticationError('Request failed with status code 401') } + + ctx.body = { + settings + } + + await next() } catch (error) { throw new AuthenticationError('Request failed with status code 401') } + } else { + throw new AuthenticationError('Request failed with status code 401') } - await next() } diff --git a/node/package.json b/node/package.json index 3c5dec57b..ad8ec70a8 100644 --- a/node/package.json +++ b/node/package.json @@ -23,7 +23,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app", + "vtex.return-app": "https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/node/resolvers/updateSellerSetting.ts b/node/resolvers/updateSellerSetting.ts index 93744174a..d41fbea89 100644 --- a/node/resolvers/updateSellerSetting.ts +++ b/node/resolvers/updateSellerSetting.ts @@ -33,7 +33,7 @@ export const updateSellerSetting = async ( // validate that there is at least one payment method selected or user has to use the same as in the order paymentOptions: validatePaymentOptions(settings.paymentOptions), } - console.log('id: ', id) + if(id){ await sellerSetting.update(id, currentSettings) return true diff --git a/node/yarn.lock b/node/yarn.lock index 931d77ff1..c36dff5c8 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -6155,9 +6155,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app": +"vtex.return-app@https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app": version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app#0124b7290d3b9942cba402a8954b855ae5eba40a" + resolved "https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app#00cefaf09ee59b6a5237e60ee2386fb016edae99" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" diff --git a/react/package.json b/react/package.json index 62078d9ee..012e17bee 100644 --- a/react/package.json +++ b/react/package.json @@ -33,7 +33,7 @@ "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app", + "vtex.return-app": "https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app", "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" }, diff --git a/react/yarn.lock b/react/yarn.lock index f81915ec5..84139039a 100644 --- a/react/yarn.lock +++ b/react/yarn.lock @@ -5206,9 +5206,9 @@ verror@1.10.0: version "8.132.4" resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" -"vtex.return-app@https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app": +"vtex.return-app@https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app": version "3.5.6" - resolved "https://eurango--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678830792/public/@types/vtex.return-app#0124b7290d3b9942cba402a8954b855ae5eba40a" + resolved "https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app#00cefaf09ee59b6a5237e60ee2386fb016edae99" "vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": version "9.146.3" From 7ad1a0b4046059de1c39cb11851d0de0d75771f2 Mon Sep 17 00:00:00 2001 From: Natalia Manrique Date: Fri, 17 Mar 2023 13:15:22 -0500 Subject: [PATCH 17/81] Fix : validation service and create return by post --- node/clients/vtexId.ts | 22 +++++++++++------- node/middlewares/createReturn.ts | 4 +--- node/middlewares/sellerValidation.ts | 34 ++++++++++++---------------- 3 files changed, 29 insertions(+), 31 deletions(-) diff --git a/node/clients/vtexId.ts b/node/clients/vtexId.ts index 60597904b..841590d18 100644 --- a/node/clients/vtexId.ts +++ b/node/clients/vtexId.ts @@ -1,4 +1,4 @@ -import type { IOContext, InstanceOptions } from '@vtex/api' +import { IOContext, InstanceOptions, AuthenticationError } from '@vtex/api' import { JanusClient } from '@vtex/api' interface VtexIdLoginResponse { @@ -54,12 +54,18 @@ export class VtexId extends JanusClient { }) } - public getAccount(token: string, account: string): Promise { - return this.http.get(`/api/vlm/account?an=${account}`, { - metric: 'vtexid-get-account', - headers: { - VtexIdClientAutCookie: token || '', - }, - }) + public async getAccount(token: string, account: string): Promise { + try { + const response = await this.http.get(`/api/vlm/account?an=${account}`, { + metric: 'vtexid-get-account', + headers: { + VtexIdClientAutCookie: token || '', + }, + }) + return response + } catch (error) { + throw new AuthenticationError('Request failed with status code 401') + + } } } diff --git a/node/middlewares/createReturn.ts b/node/middlewares/createReturn.ts index fa0e31fe6..e76413eea 100644 --- a/node/middlewares/createReturn.ts +++ b/node/middlewares/createReturn.ts @@ -1,12 +1,10 @@ import { UserInputError } from '@vtex/api' -import { json } from 'co-body' import { createReturnRequestService } from '../services/createReturnRequestService' export async function createReturn(ctx: Context) { - const { req } = ctx - const body = await json(req) + const { body }: any = ctx || {} const { locale } = body diff --git a/node/middlewares/sellerValidation.ts b/node/middlewares/sellerValidation.ts index f0b7a1e7a..d4713860e 100644 --- a/node/middlewares/sellerValidation.ts +++ b/node/middlewares/sellerValidation.ts @@ -11,33 +11,27 @@ export async function sellerValidation(ctx: Context, next: () => Promise) }, clients: { vtexId }, } = ctx - const authCookie = header.vtexidclientautcookie as string | undefined const { _sellerName } = query - const {settings} = await json(req) - const sellerName = settings?.sellerId - - const { sellerId } = params as { sellerId: string } - - if(authCookie && (_sellerName || sellerName || sellerId) ){ - const accountName = _sellerName || sellerName || sellerId + const body = await json(req) - try { - const account = await vtexId.getAccount(authCookie, accountName) + const {settings , sellerName} = body + let seller = "" + const sellerNameSettintgs = settings?.sellerId + seller = sellerNameSettintgs || sellerName + const { sellerId } = params as { sellerId: string } - if(account.accountName != accountName){ - throw new AuthenticationError('Request failed with status code 401') - } - - ctx.body = { - settings - } - - await next() - } catch (error) { + if(authCookie && (_sellerName || seller || sellerId) ){ + const accountName = String ( _sellerName || seller || sellerId ) + const account = await vtexId.getAccount(authCookie, accountName) + if(account.accountName != accountName){ throw new AuthenticationError('Request failed with status code 401') } + + ctx.body = body + + await next() } else { throw new AuthenticationError('Request failed with status code 401') } From 549400231ccce37c297027828013d6286497ee91 Mon Sep 17 00:00:00 2001 From: Elkin Urango Date: Wed, 22 Mar 2023 10:37:51 -0500 Subject: [PATCH 18/81] Release v3.5.7-beta.0 --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 4617a349a..67e2ad1b5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "vendor": "vtex", "name": "return-app", - "version": "3.5.6", + "version": "3.5.7-beta.0", "title": "Return app", "description": "Return app", "dependencies": { From b928fb41572cb8ce3170ff074780979f91164021 Mon Sep 17 00:00:00 2001 From: John Martinez <34136393+johnmartinez93@users.noreply.github.com> Date: Mon, 27 Mar 2023 14:25:43 -0500 Subject: [PATCH 19/81] Feature/new return in admin (#3) * Auto stash before merge of "develop" and "origin/develop" * add orders table and create new return * filter by order id * add english message and fixed filter bugs * Auto stash before merge of "develop" and "origin/develop" * add orders table and create new return * feat: changes for create a new request return * removed: console log * added translations * fixed bug for order malformed and center loader * fix: translations for admin and store * updated translations * fiex translation new request button in end user --------- Co-authored-by: Elkin Urango --- .DS_Store | Bin 0 -> 8196 bytes admin/routes.json | 8 + graphql/schema.graphql | 10 +- graphql/types/OrderToReturn.graphql | 12 + messages/.DS_Store | Bin 0 -> 6148 bytes messages/bg.json | 104 ++++++++- messages/context.json | 109 ++++++++- messages/en.json | 121 ++++++++-- messages/es.json | 106 ++++++++- messages/fr.json | 104 ++++++++- messages/it.json | 104 ++++++++- messages/nl.json | 104 ++++++++- messages/pt.json | 104 ++++++++- messages/ro.json | 104 ++++++++- messages/th.json | 104 ++++++++- node/clients/index.ts | 6 +- node/clients/oms.ts | 12 +- node/clients/vtexId.ts | 6 +- node/index.ts | 6 +- node/middlewares/appSettings.ts | 3 +- node/middlewares/createReturn.ts | 1 - node/middlewares/getRequestList.ts | 2 +- node/middlewares/index.ts | 5 +- node/middlewares/sellerSetting.ts | 39 ++-- node/middlewares/sellerValidation.ts | 23 +- node/middlewares/updateRequestStatus.ts | 10 +- node/package.json | 12 +- node/resolvers/index.ts | 2 +- node/resolvers/orderToReturnSummary.ts | 3 +- node/resolvers/ordersAvailableToReturn.ts | 62 +++++- node/resolvers/returnSellerSettings.ts | 6 +- node/resolvers/updateSellerSetting.ts | 18 +- node/services/AppSettingsService.ts | 28 +-- node/services/SellerSettingService.ts | 39 ++-- node/services/returnRequestListService.ts | 6 +- node/services/returnSellerSettingsService.ts | 13 +- node/services/returnSettingsListService.ts | 8 +- .../updateRequestStatusFromSellerService.ts | 14 +- node/services/updateRequestStatusService.ts | 2 +- node/utils/createOrdersToReturnSummary.ts | 6 +- node/utils/createRefundData.ts | 1 + node/utils/createRefundableTotals.ts | 24 +- node/utils/getCostumerEmail.ts | 2 +- node/yarn.lock | 40 ---- react/AdminReturnAdd.tsx | 4 + react/AdminReturnOrderList.tsx | 4 + react/admin/AdminLoader.tsx | 6 +- react/admin/AdminReturnAdd.tsx | 24 ++ react/admin/AdminReturnOrderList.tsx | 28 +++ react/admin/AdminSettingDetail.tsx | 8 +- react/admin/OrderList/OrderListContainer.tsx | 123 +++++++++++ react/admin/ReturnAdd/ReturnAddContainer.tsx | 25 +++ .../VerifyItems/VerifyItemsPage.tsx | 2 + .../VerifyItems/verifyItemsTableSchema.tsx | 3 + .../admin/ReturnList/ReturnListContainer.tsx | 13 +- .../SettingDetailsContainer.tsx | 10 +- .../CustomReasons/CustomReasonModal.tsx | 5 +- .../CustomReasons/CustomReasons.tsx | 5 +- .../CustomReasons/TranslationsModal.tsx | 5 +- .../components/ExcludedCategories.tsx | 5 +- .../settings/components/GeneralOptions.tsx | 9 +- .../settings/components/PaymentOptions.tsx | 5 +- .../settings/components/RequiredOptions.tsx | 9 +- .../admin/settings/hooks/useSettingsSeller.ts | 2 +- .../settings/provider/SettingsProvider.tsx | 59 +++-- .../settings/provider/settingsReducer.ts | 15 +- .../ItemDetails/itemDetailsSchema.tsx | 1 + .../ReturnValues/ApprovedValues.tsx | 2 + .../ReturnValues/RequestedValues.tsx | 1 + .../components/ordersList/JumpToPage.tsx | 80 +++++++ .../components/ordersList/ListTable.tsx | 189 ++++++++++++++++ .../components/ordersList/ListTableFilter.tsx | 207 ++++++++++++++++++ .../components/ordersList/ListTableSchema.tsx | 118 ++++++++++ .../ordersList/StatusActionMenu.tsx | 78 +++++++ .../components/returnList/ListTable.tsx | 1 - .../components/returnList/ListTableFilter.tsx | 2 +- .../ListTableFilterSettings.tsx | 7 +- .../ListTableSchemaSettings.tsx | 8 +- react/hooks/useSettingsRequestList.ts | 1 + react/package.json | 12 +- react/store/ReturnRequest/StoreReturnList.tsx | 2 +- .../CreateReturnRequest.tsx | 27 ++- .../components/AddressDetails.tsx | 18 +- .../components/ConfirmAndSubmit.tsx | 17 +- .../components/ConfirmComment.tsx | 2 +- .../components/ConfirmContactDetails.tsx | 2 +- .../components/ConfirmPaymentMethods.tsx | 10 +- .../ConfirmPickupAddressDetails.tsx | 2 +- .../components/ContactDetails.tsx | 15 +- .../components/ItemsDetails.tsx | 7 +- .../components/ItemsList.tsx | 17 +- .../components/OrderList.tsx | 14 +- .../components/PaymentMethods.tsx | 16 +- .../components/PickupPointSelector.tsx | 4 +- .../components/RenderReasonDropdown.tsx | 10 +- .../components/ReturnDetails.tsx | 22 +- .../components/ReturnInformationTable.tsx | 8 +- .../components/TermsAndConditions.tsx | 7 +- .../components/UserCommentDetails.tsx | 2 +- .../graphql/getOrdersAvailableToReturn.gql | 15 +- .../utils/defaultPaymentMethodsMessages.ts | 8 +- .../utils/defaultReturnReasonsMessages.ts | 32 +-- react/yarn.lock | 40 ---- 103 files changed, 2325 insertions(+), 541 deletions(-) create mode 100644 .DS_Store create mode 100644 messages/.DS_Store create mode 100644 react/AdminReturnAdd.tsx create mode 100644 react/AdminReturnOrderList.tsx create mode 100644 react/admin/AdminReturnAdd.tsx create mode 100644 react/admin/AdminReturnOrderList.tsx create mode 100644 react/admin/OrderList/OrderListContainer.tsx create mode 100644 react/admin/ReturnAdd/ReturnAddContainer.tsx create mode 100644 react/common/components/ordersList/JumpToPage.tsx create mode 100644 react/common/components/ordersList/ListTable.tsx create mode 100644 react/common/components/ordersList/ListTableFilter.tsx create mode 100644 react/common/components/ordersList/ListTableSchema.tsx create mode 100644 react/common/components/ordersList/StatusActionMenu.tsx diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..bfd069272834e4b1f21011f95de23455fbcadca4 GIT binary patch literal 8196 zcmeHML2uJA6n@@Xn$itb0;F+3io|sqE$lLJDcvSOLLgBD2S6ohx-Kk>OOsNes#5Oo z8~6*H`6K)nPVhb3o0_ym;)0m4CHr&i_r))tpW`|uBGDcPO`75Fz4z@E*?S+VcyURzoPtOEa~0{nh( zkr`VCGmYxifkGVtfF(4mggVXvisKq=8O$^)D(=mhr@$RBgSm4*^S%~%HR{obBuy|5Mgiv|SW%uOZWdToSog`NF%7_oz#kMCp9+i; z7!qS81-l;wy9(|&!c!0FnBEutSQ`|qH{q)XuR}V5KMAGq<{eNj)$7ZgUY8Y<8GVcw z;4Ue7dEb;)^Be~p9wmYGfNObsrP6Qh{Yf%3-(bG^!zfJBM&r9!TQ8L_Rh)`bbKZ20 z<)o8(={RY7qgQ2hV@9y5&c6S?%*|s}vHX2P_?Cs5FRpGLV+C)JfZje+KOl7Z*jq#eQB@<40XVf0J{&vpw!j*8P^a z@3GFhKNI(3{&$a7iMv6an_KC;_vjRO&d&{DGIX!WGDA?A4BcBiWZlA~@8+R}5ikNq zAVYv_w#4K(sI^AG2pEAK0eL@orf35@UIBC@#1Внимание: Статусът на тази заявка ще бъде зададен като ОТКАЗАНА.

    Това ще извести потребителя по имейл и ще му позволи да създаде нова заявка за възстановяване на сума с артикулите от отказаната заявка.

    Ако не това е намерението ви, задайте заявката като ОТХВЪРЛЕНА.

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    За съжаление, не е възможно да откажете тази заявка заради текущия ѝ статус.

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    Отказването на тази заявка ще позволи използването на текущите артикули в нова заявка за възстановяване.

    Това действие е необратимо.

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    За съжаление, трябва да се свържете с екипа по поддръжката, за да откажете тази заявка заради текущия ѝ статус.

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    За съжаление, трябва да се свържете с екипа по поддръжката, за да откажете тази заявка заради текущия ѝ статус.

    ", + + "return-app.return-order-details.page-header.link": "Назад към поръчките", + "return-app.return-order-details.page-header.title": "Формуляр за заявка за връщане", + "return-app.return-order-details.page-header.subtitle": "Изберете продуктите, които искате да възстановите", + "return-app.return-order-details.section-products": "Продукти, налични за връщане", + "return-app.return-order-details.section-details": "Информация за връзка", + "return-app.return-order-details.section-payment": "Начин на плащане за възстановяване", + "return-app.return-order-details.page-header.creation-date": "Дата на създаване", + "return-app.return-order-details.table-header.product": "Продукт", + "return-app.return-order-details.table-header.quantity": "Количество", + "return-app.return-order-details.table-header.available-to-return": "Наличен за връщане", + "return-app.return-order-details.table-header.quantity-to-return": "Количество за връщане", + "return-app.return-order-details.table-header.reason": "Причина", + "return-app.return-order-details.table-header.condition": "Състояние", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Случайна поръчка", + "return-app.return-order-details.dropdown-reasons.better-price": "По-добра цена", + "return-app.return-order-details.dropdown-reasons.performance": "производителност", + "return-app.return-order-details.dropdown-reasons.incompatible": "Несъвместим", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Повреден артикул", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Пропусната доставка", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Липсващи части", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Повредена кутия", + "return-app.return-order-details.dropdown-reasons.different-product": "Различен продукт", + "return-app.return-order-details.dropdown-reasons.defective": "Дефектен", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Пристигна като екстра", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "Не е нужно повече", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Неразрешена покупка", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Различно от уебсайта", + "return-app.return-order-details.dropdown-reasons.other-reason": "Друга причина", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Изберете причина", + "return-app.return-order-details.title.contact-details": "Данни за контакт", + "return-app.return-order-details.inputs.name-input": "Име", + "return-app.return-order-details.inputs.email-input": "електронна поща", + "return-app.return-order-details.inputs.phone-input": "Телефон", + "return-app.return-order-details.title.pickup-address": "Адрес за доставка", + "return-app.return-order-details.title.tooltip.pickup-address": "Изберете адреса за доставка, който искате за доставка или получаване", + "return-app.return-order-details.title.extra-comment": "Допълнителен коментар", + "return-app.return-order-details.payment-options.card": "карта", + "return-app.return-order-details.payment-options.bank": "банка", + "return-app.return-order-details.payment-options.gift-card": "Карта за подарък", + "return-app.return-order-details.payment-method.description": "Изберете метода на плащане, към който ще бъде възстановена сумата", + "return-app.return-order-details.payment-method.default": "Сумата ще бъде възстановена по начина на плащане, използван за тази поръчка", + "return-app.return-order-details.payment-method.account-holder": "Име на титуляра на сметката", + "return-app.return-order-details.payment-method.iban": "ОТИВАХА", + "return-app.return-order-details.terms-and-conditions.form-agree": "Прочетох и приемам {link}", + "return-app.return-order-details.terms-and-conditions.link": "правила и условия", + "return-app.return-order-details.button.next": "Следващия", + "return-app.return-order-details.page-header.order-id": "ID на поръчката", + "return-app.return-item-details.excluded-items.warning": "Магазинът не позволява връщане на този продукт", + "return-app.return-item-details.dropdown-reason.error": "Изисква се причина", + "return-app.return-item-details.dropdown-condition.error": "Изисква се условие", + "return-app.return-payment-methods.input-payment-method.error": "Изисква се начин на плащане", + "return-app.return-payment-methods.input-iban.error": "Изисква се IBAN", + "return-app.return-payment-methods.input-iban-invalid.error": "IBAN не е валиден", + "return-app.return-payment-methods.input-account-holder.error": "Изисква се титуляр на акаунт", + "return-app.return-terms-and-conditions.checkbox.error": "Моля, приемете правилата и условията.", + "return-app.return-items-list.no-items-selected.error": "Няма избрани елементи", + "return-app.return-address-details.address-input.error": "Изисква се адрес", + "return-app.return-address-details.city-input.error": "Изисква се град", + "return-app.return-address-details.state-input.error": "Държавата е задължителна", + "return-app.return-address-details.zip-input.error": "Изисква се пощенски код", + "return-app.return-address-details.country-input.error": "Изисква се държава", + "return-app.return-contact-details.name-input.error": "Името е задължително", + "return-app.return-contact-details.phone-input.error": "Изисква се телефон", + "return-app.confirm-and-submit.page-header.title": "Потвърдете подробностите за връщане", + "return-app.confirm-and-submit.refund-method.title": "Начин на плащане за възстановяване", + "return-app.confirm-and-submit.alert.label": "Вижте вашия списък за връщане", + "return-app.confirm-and-submit.alert.error.label": "Опитайте отново", + "return-app.confirm-and-submit.alert.success": "Заявката за връщане е създадена успешно.", + "return-app.confirm-and-submit.alert.error": "Нещо се обърка. Моля, опитайте отново.", + "return-app.confirm-and-submit.button.back": "обратно", + "return-app.confirm-and-submit.button.submit": "Изпращане", + "return-app.confirm-and-submit.pickup-address.title": "Адрес за доставка", + "return-app.confirm-and-submit.contact-details.title": "Данни за контакт", + "return-app.confirm-and-submit.user-comment.title": "Коментирайте", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Име на получател:", + "return-app.confirm-payment-methods.refund-method.p-iban": "Банков превод по сметка:", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Същото като при покупка", + "return-app.return-information-table.table-row.p-condition": "Състояние:", + "return-app.return-information-table.table-row.p-reason": "причина:", + "return-app.return-order-details.pickup-address.drop-off-points": "Изберете точка за пускане", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "Можете да върнете артикулите си в един от нашите избрани пунктове за връщане", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Изберете точка за пускане", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "Възникна грешка при зареждането на точките за връщане" } diff --git a/messages/context.json b/messages/context.json index d49f77298..e5cfd860e 100644 --- a/messages/context.json +++ b/messages/context.json @@ -53,108 +53,193 @@ "store/return-app.link": "My Returns", "store/return-app.request-return.page.header": "Request a new return", "store/return-app.request-return.page.header.subtitle": "Select an order to start the return request process", - "store/return-app.return-order-list.table-header.order-id": "OrderId", - "store/return-app.return-order-list.table-header.creation-date": "Creation Date", - "store/return-app.return-order-list.table-header.items-to-return": "Available Items To Return", - "store/return-app.return-order-list.table-header.select-order": "Select Order", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "No orders available for return", - "store/return-app.return-order-list.table-pagination.text-of": "Text of", + "return-app.return-order-list.table-header.order-id": "OrderId", + "return-app.return-order-list.table-header.seller-name": "Seller name", + "return-app.return-order-list.table-header.linkLabel": "Back to returns", + "return-app.return-order-list.table-header.creation-date": "Creation Date", + "return-app.return-order-list.table-header.items-to-return": "Available Items To Return", + "return-app.return-order-list.table-header.select-order": "Select Order", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "No orders available for return", + "return-app.return-order-list.table-pagination.text-of": "Text of", "store/return-app.return-order-details.page-header.link": "Back to orders", + "return-app.return-order-details.page-header.link": "Back to orders", "store/return-app.return-order-details.page-header.title": "Return request form", + "return-app.return-order-details.page-header.title": "Return request form", "store/return-app.return-order-details.page-header.subtitle": "Select the Product(s) you want to make a Refund", - "store/return-app.return-order-details.section-products": "Products available for return", + "return-app.return-order-details.page-header.subtitle": "Select the Product(s) you want to make a Refund", + "return-app.return-order-details.section-products": "Products available for return", "store/return-app.return-order-details.section-details": "Contact information", + "return-app.return-order-details.section-details": "Contact information", "store/return-app.return-order-details.section-payment": "Refund payment method", + "return-app.return-order-details.section-payment": "Refund payment method", "store/return-app.return-order-details.page-header.creation-date": "Creation Date", + "return-app.return-order-details.page-header.creation-date": "Creation Date", "store/return-app.return-order-details.table-header.product": "Product", + "return-app.return-order-details.table-header.product": "Product", "store/return-app.return-order-details.table-header.quantity": "Quantity", + "return-app.return-order-details.table-header.quantity": "Quantity", "store/return-app.return-order-details.table-header.available-to-return": "Available to return", + "return-app.return-order-details.table-header.available-to-return": "Available to return", "store/return-app.return-order-details.table-header.quantity-to-return": "Quantity to return", + "return-app.return-order-details.table-header.quantity-to-return": "Quantity to return", "store/return-app.return-order-details.table-header.reason": "Reason", + "return-app.return-order-details.table-header.reason": "Reason", "store/return-app.return-order-details.table-header.condition": "Condition", + "return-app.return-order-details.table-header.condition": "Condition", "return-app.return-order-details.conditions.new-with-box": "New with box", "return-app.return-order-details.conditions.new-without-box": "New without box", "return-app.return-order-details.conditions.used-with-box": "Used with box", "return-app.return-order-details.conditions.used-without-box": "Used without box", "return-app.return-order-details.dropdown-conditions.placeholder.select-condition": "Select condition", "store/return-app.return-order-details.dropdown-reasons.accidental-order": "Accidental order", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Accidental order", "store/return-app.return-order-details.dropdown-reasons.better-price": "Better price", + "return-app.return-order-details.dropdown-reasons.better-price": "Better price", "store/return-app.return-order-details.dropdown-reasons.performance": "Performance", + "return-app.return-order-details.dropdown-reasons.performance": "Performance", "store/return-app.return-order-details.dropdown-reasons.incompatible": "Incompatible", + "return-app.return-order-details.dropdown-reasons.incompatible": "Incompatible", "store/return-app.return-order-details.dropdown-reasons.item-damaged": "Item damaged", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Item damaged", "store/return-app.return-order-details.dropdown-reasons.missed-delivery": "Missed delivery", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Missed delivery", "store/return-app.return-order-details.dropdown-reasons.missing-parts": "Missing parts", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Missing parts", "store/return-app.return-order-details.dropdown-reasons.box-damaged": "Box damaged", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Box damaged", "store/return-app.return-order-details.dropdown-reasons.different-product": "Different product", + "return-app.return-order-details.dropdown-reasons.different-product": "Different product", "store/return-app.return-order-details.dropdown-reasons.defective": "Defective", + "return-app.return-order-details.dropdown-reasons.defective": "Defective", "store/return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Arrived in addition", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Arrived in addition", "store/return-app.return-order-details.dropdown-reasons.no-longer-needed": "No longer needed", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "No longer needed", "store/return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Unauthorized purchase", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Unauthorized purchase", "store/return-app.return-order-details.dropdown-reasons.different-from-website": "Different from website", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Different from website", "store/return-app.return-order-details.dropdown-reasons.other-reason": "Other reason", + "return-app.return-order-details.dropdown-reasons.other-reason": "Other reason", "store/return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Select reason", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Select reason", "store/return-app.return-order-details.error.order-not-invoiced": "The order is not invoiced", "store/return-app.return-order-details.error.out-of-max-days": "The order exceeds the maximum return period", "store/return-app.return-order-details.error.order-not-found": "Order not found", "store/return-app.return-order-details.error.forbidden": "You don't have access to this order", "store/return-app.return-order-details.error.unknown": "Something failed, please try again.", "store/return-app.return-order-details.title.contact-details": "Contact details", + "return-app.return-order-details.title.contact-details": "Contact details", "store/return-app.return-order-details.inputs.name-input": "Name", + "return-app.return-order-details.inputs.name-input": "Name", "store/return-app.return-order-details.inputs.email-input": "Email", + "return-app.return-order-details.inputs.email-input": "Email", "store/return-app.return-order-details.inputs.phone-input": "Phone", + "return-app.return-order-details.inputs.phone-input": "Phone", "store/return-app.return-order-details.title.pickup-address": "Delivery address", + "return-app.return-order-details.title.pickup-address": "Delivery address", "store/return-app.return-order-details.title.tooltip.pickup-address": "Select the Shipping Address you want to deliver or have your items picked up at", + "return-app.return-order-details.title.tooltip.pickup-address": "Select the Shipping Address you want to deliver or have your items picked up at", "store/return-app.return-order-details.title.extra-comment": "Extra comment", + "return-app.return-order-details.title.extra-comment": "Extra comment", "store/return-app.return-order-details.inputs.address-input": "Address", + "admin/return-app.return-order-details.inputs.address-input": "Address", "store/return-app.return-order-details.inputs.city-input": "City", + "admin/return-app.return-order-details.inputs.city-input": "City", "store/return-app.return-order-details.inputs.state-input": "State", + "admin/return-app.return-order-details.inputs.state-input": "State", "store/return-app.return-order-details.inputs.zip-input": "Zip", + "admin/return-app.return-order-details.inputs.zip-input": "Zip", "store/return-app.return-order-details.inputs.country-input": "Country", + "admin/return-app.return-order-details.inputs.country-input": "Country", "store/return-app.return-order-details.setting-provider.error.retry-action": "Try again", "store/return-app.return-order-details.setting-provider.error": "There was an error loading app settings.", "store/return-app.return-order-details.payment-options.card": "Card", + "return-app.return-order-details.payment-options.card": "Card", "store/return-app.return-order-details.payment-options.bank": "Bank", + "return-app.return-order-details.payment-options.bank": "Bank", "store/return-app.return-order-details.payment-options.gift-card": "Gift card", + "return-app.return-order-details.payment-options.gift-card": "Gift card", "store/return-app.return-order-details.payment-method.description": "Select the Payment Method to be refunded to", + "return-app.return-order-details.payment-method.description": "Select the Payment Method to be refunded to", "store/return-app.return-order-details.payment-method.default": "The refund will be emitted to the payment method used for this order", + "return-app.return-order-details.payment-method.default": "The refund will be emitted to the payment method used for this order", "store/return-app.return-order-details.payment-method.account-holder": "Account holder name", + "return-app.return-order-details.payment-method.account-holder": "Account holder name", "store/return-app.return-order-details.payment-method.iban": "IBAN", + "return-app.return-order-details.payment-method.iban": "IBAN", "store/return-app.return-order-details.terms-and-conditions.form-agree": "I have read and accept the {link}", + "return-app.return-order-details.terms-and-conditions.form-agree": "I have read and accept the {link}", "store/return-app.return-order-details.terms-and-conditions.link": "terms and conditions", + "return-app.return-order-details.terms-and-conditions.link": "terms and conditions", "store/return-app.return-order-details.button.next": "Next", + "return-app.return-order-details.button.next": "Next", "store/return-app.return-order-details.page-header.order-id": "Order ID", + "return-app.return-order-details.page-header.order-id": "Order ID", "store/return-app.return-item-details.excluded-items.warning": "Store does not allow this product to be returned", + "return-app.return-item-details.excluded-items.warning": "Store does not allow this product to be returned", "store/return-app.return-item-details.dropdown-reason.error": "Reason is required", + "return-app.return-item-details.dropdown-reason.error": "Reason is required", "store/return-app.return-item-details.dropdown-condition.error": "Condition is required", + "return-app.return-item-details.dropdown-condition.error": "Condition is required", "store/return-app.return-payment-methods.input-payment-method.error": "Payment method required", + "return-app.return-payment-methods.input-payment-method.error": "Payment method required", "store/return-app.return-payment-methods.input-iban.error": "Iban is required", + "return-app.return-payment-methods.input-iban.error": "Iban is required", "store/return-app.return-payment-methods.input-iban-invalid.error": "IBAN is not valid", + "return-app.return-payment-methods.input-iban-invalid.error": "IBAN is not valid", "store/return-app.return-payment-methods.input-account-holder.error": "Account holder is required", + "return-app.return-payment-methods.input-account-holder.error": "Account holder is required", "store/return-app.return-terms-and-conditions.checkbox.error": "Accept terms and conditions, please.", + "return-app.return-terms-and-conditions.checkbox.error": "Accept terms and conditions, please.", "store/return-app.return-items-list.no-items-selected.error": "No items selected", + "return-app.return-items-list.no-items-selected.error": "No items selected", "store/return-app.return-address-details.address-input.error": "Address is required", + "return-app.return-address-details.address-input.error": "Address is required", "store/return-app.return-address-details.city-input.error": "City is required", + "return-app.return-address-details.city-input.error": "City is required", "store/return-app.return-address-details.state-input.error": "State is required", + "return-app.return-address-details.state-input.error": "State is required", "store/return-app.return-address-details.zip-input.error": "Zip is required", + "return-app.return-address-details.zip-input.error": "Zip is required", "store/return-app.return-address-details.country-input.error": "Country is required", + "return-app.return-address-details.country-input.error": "Country is required", "store/return-app.return-contact-details.name-input.error": "Name is required", + "return-app.return-contact-details.name-input.error": "Name is required", "store/return-app.return-contact-details.phone-input.error": "Phone is required", + "return-app.return-contact-details.phone-input.error": "Phone is required", "store/return-app.confirm-and-submit.page-header.title": "Confirm Return Details", + "return-app.confirm-and-submit.page-header.title": "Confirm Return Details", "store/return-app.confirm-and-submit.refund-method.title": "Refund payment method", + "return-app.confirm-and-submit.refund-method.title": "Refund payment method", "store/return-app.confirm-and-submit.alert.label": "See your returns list", + "return-app.confirm-and-submit.alert.label": "See your returns list", "store/return-app.confirm-and-submit.alert.error.label": "Retry", + "return-app.confirm-and-submit.alert.error.label": "Retry", "store/return-app.confirm-and-submit.alert.success": "The return request was created successfully.", + "return-app.confirm-and-submit.alert.success": "The return request was created successfully.", "store/return-app.confirm-and-submit.alert.error": "Something went wrong, please try again.", + "return-app.confirm-and-submit.alert.error": "Something went wrong, please try again.", "store/return-app.confirm-and-submit.button.back": "Back", + "return-app.confirm-and-submit.button.back": "Back", "store/return-app.confirm-and-submit.button.submit": "Submit", + "return-app.confirm-and-submit.button.submit": "Submit", "store/return-app.confirm-and-submit.pickup-address.title": "Delivery address", + "return-app.confirm-and-submit.pickup-address.title": "Delivery address", "store/return-app.confirm-and-submit.contact-details.title": "Contact details", + "return-app.confirm-and-submit.contact-details.title": "Contact details", "store/return-app.confirm-and-submit.user-comment.title": "Comment", + "return-app.confirm-and-submit.user-comment.title": "Comment", "store/return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Beneficiary name: ", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Beneficiary name: ", "store/return-app.confirm-payment-methods.refund-method.p-iban": "Bank transfer into account: ", + "return-app.confirm-payment-methods.refund-method.p-iban": "Bank transfer into account: ", "store/return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Same as purchase", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Same as purchase", "store/return-app.return-information-table.table-row.p-condition": "Condition:", + "return-app.return-information-table.table-row.p-condition": "Condition:", "store/return-app.return-information-table.table-row.p-reason": "Reason:", + "return-app.return-information-table.table-row.p-reason": "Reason:", "admin/return-app.settings.section.payment-options.available-payment-methods.card": "Credit Card", "admin/return-app.settings.section.payment-options.available-payment-methods.gift-card": "Gift Card", "admin/return-app.settings.section.payment-options.available-payment-methods.bank": "Bank Transfer", @@ -290,7 +375,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "GO", "store/return-app.return-request-list.page-header.title": "My Returns", "store/return-app.return-request-list.page-header.goBack": "Go Back", - "store/return-app.return-request-list.page-header.cta": "New Request", + "return-app.return-request-list.page-header.cta": "New Request", "return-app.return-request-list.table.status.new": "New", "return-app.return-request-list.table.status.processing": "Processing", "return-app.return-request-list.table.status.pickedup-from-client": "Picked up from client", @@ -318,9 +403,13 @@ "admin/return-app.settings.modal-warning.confirm": "Warning modal confirm CTA", "admin/return-app.settings.modal-warning.cancel": "Warning modal cancel CTA", "store/return-app.return-order-details.pickup-address.drop-off-points": "Select a drop off point", + "return-app.return-order-details.pickup-address.drop-off-points": "Select a drop off point", "store/return-app.return-order-details.pickup-address.drop-off-points.tooltip": "You can return your items in one of our selected drop off points", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "You can return your items in one of our selected drop off points", "store/return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Select a drop off point", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Select a drop off point", "store/return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "There was an error loading the drop off points", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "There was an error loading the drop off points", "admin/return-app.return-request-details.localized-product-name.tooltip": "Tooltip for localized product names", "admin/return-app.settings.section.payment-options.refund-method-strategy.checkbox.label": "Automatically refund requests", "admin/return-app.settings.section.payment-options.refund-method-strategy.checkbox.description": "Automatically create the return invoice in the OMS for the requests", @@ -331,5 +420,7 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "Text message for allowing a cancellation for admins", "return-app.return-request-details.cancellation.modal.adminRefuse": "Text message for refusing a cancellation for admins", "return-app.return-request-details.cancellation.modal.storeAllow": "Text message for allowing a cancellation for store users", - "return-app.return-request-details.cancellation.modal.storeRefuse": "Text message for refusing a cancellation for store users" + "return-app.return-request-details.cancellation.modal.storeRefuse": "Text message for refusing a cancellation for store users", + "return-app.return-order-list.page-header.title": "Order List", + "return-app.return-order-list.page-header.subTitle": "All return orders. Click on an order ID to create a return." } diff --git a/messages/en.json b/messages/en.json index 71eb63dbb..51425e6d3 100644 --- a/messages/en.json +++ b/messages/en.json @@ -1,7 +1,7 @@ { "admin/return-app.navigation.label": "Returns", "navigation.labelRequests": "Requests", - "admin/return-app.sellers.settings.navigation.label":"Sellers Returns Settings", + "admin/return-app.sellers.settings.navigation.label": "Sellers Returns Settings", "admin/return-app.settings.navigation.label": "Returns Settings", "admin/return-app.settings.max-days.label": "Max days:", "admin/return-app.settings.error.header": "Error loading settings", @@ -54,108 +54,185 @@ "store/return-app.link": "My Returns", "store/return-app.request-return.page.header": "Request New Return", "store/return-app.request-return.page.header.subtitle": "Select an order to start the return request process", - "store/return-app.return-order-list.table-header.order-id": "Order ID", - "store/return-app.return-order-list.table-header.creation-date": "Created Date", - "store/return-app.return-order-list.table-header.items-to-return": "Items Available for Return", - "store/return-app.return-order-list.table-header.select-order": "Select Order", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "No orders available for return", - "store/return-app.return-order-list.table-pagination.text-of": "of", "store/return-app.return-order-details.page-header.link": "Back to orders", + "return-app.return-order-details.page-header.link": "Back to orders", "store/return-app.return-order-details.page-header.title": "Return Request Form", + "return-app.return-order-details.page-header.title": "Return Request Form", "store/return-app.return-order-details.page-header.subtitle": "Select the products you want to refund", - "store/return-app.return-order-details.section-products": "Products available for return", - "store/return-app.return-order-details.section-details": "Contact Details", + "return-app.return-order-details.page-header.subtitle": "Select the products you want to refund", + "return-app.return-order-details.section-products": "Products available for return", + "store/return-app.return-order-details.section-details": "Contact information", + "return-app.return-order-details.section-details": "Contact information", "store/return-app.return-order-details.section-payment": "Refund payment method", + "return-app.return-order-details.section-payment": "Refund payment method", "store/return-app.return-order-details.page-header.creation-date": "Creation Date", + "return-app.return-order-details.page-header.creation-date": "Creation Date", + "return-app.return-order-details.table-header.product": "Product", "store/return-app.return-order-details.table-header.product": "Product", "store/return-app.return-order-details.table-header.quantity": "Quantity", - "store/return-app.return-order-details.table-header.available-to-return": "Available for Return", - "store/return-app.return-order-details.table-header.quantity-to-return": "Return Quantity", + "return-app.return-order-details.table-header.quantity": "Quantity", + "store/return-app.return-order-details.table-header.available-to-return": "Available to return", + "return-app.return-order-details.table-header.available-to-return": "Available to return", + "store/return-app.return-order-details.table-header.quantity-to-return": "Quantity to return", + "return-app.return-order-details.table-header.quantity-to-return": "Quantity to return", "store/return-app.return-order-details.table-header.reason": "Reason", + "return-app.return-order-details.table-header.reason": "Reason", "store/return-app.return-order-details.table-header.condition": "Condition", + "return-app.return-order-details.table-header.condition": "Condition", "return-app.return-order-details.conditions.new-with-box": "New With Box", "return-app.return-order-details.conditions.new-without-box": "New Without Box", "return-app.return-order-details.conditions.used-with-box": "Used With Box", "return-app.return-order-details.conditions.used-without-box": "Used Without Box", "return-app.return-order-details.dropdown-conditions.placeholder.select-condition": "Select condition", "store/return-app.return-order-details.dropdown-reasons.accidental-order": "Accidental Order", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Accidental Order", "store/return-app.return-order-details.dropdown-reasons.better-price": "Better Price", + "return-app.return-order-details.dropdown-reasons.better-price": "Better Price", "store/return-app.return-order-details.dropdown-reasons.performance": "Performance", + "return-app.return-order-details.dropdown-reasons.performance": "Performance", "store/return-app.return-order-details.dropdown-reasons.incompatible": "Incompatible", + "return-app.return-order-details.dropdown-reasons.incompatible": "Incompatible", "store/return-app.return-order-details.dropdown-reasons.item-damaged": "Damaged Item", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Damaged Item", "store/return-app.return-order-details.dropdown-reasons.missed-delivery": "Missed Delivery", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Missed Delivery", "store/return-app.return-order-details.dropdown-reasons.missing-parts": "Missing Parts", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Missing Parts", "store/return-app.return-order-details.dropdown-reasons.box-damaged": "Damaged Box", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Damaged Box", "store/return-app.return-order-details.dropdown-reasons.different-product": "Different Product", + "return-app.return-order-details.dropdown-reasons.different-product": "Different Product", "store/return-app.return-order-details.dropdown-reasons.defective": "Defective", + "return-app.return-order-details.dropdown-reasons.defective": "Defective", "store/return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Arrived as Extra", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Arrived as Extra", "store/return-app.return-order-details.dropdown-reasons.no-longer-needed": "No Longer Needed", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "No Longer Needed", "store/return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Unauthorized Purchase", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Unauthorized Purchase", "store/return-app.return-order-details.dropdown-reasons.different-from-website": "Different From Website", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Different From Website", "store/return-app.return-order-details.dropdown-reasons.other-reason": "Other Reason", + "return-app.return-order-details.dropdown-reasons.other-reason": "Other Reason", "store/return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Select reason", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Select reason", "store/return-app.return-order-details.error.order-not-invoiced": "The order is not invoiced", "store/return-app.return-order-details.error.out-of-max-days": "The order exceeds the maximum return period", "store/return-app.return-order-details.error.order-not-found": "Order not found", "store/return-app.return-order-details.error.forbidden": "You don't have access to this order", "store/return-app.return-order-details.error.unknown": "Something failed. Please try again.", - "store/return-app.return-order-details.title.contact-details": "Contact Details", + "store/return-app.return-order-details.title.contact-details": "Contact details", + "return-app.return-order-details.title.contact-details": "Contact details", "store/return-app.return-order-details.inputs.name-input": "Name", + "return-app.return-order-details.inputs.name-input": "Name", "store/return-app.return-order-details.inputs.email-input": "Email", + "return-app.return-order-details.inputs.email-input": "Email", "store/return-app.return-order-details.inputs.phone-input": "Phone", + "return-app.return-order-details.inputs.phone-input": "Phone", "store/return-app.return-order-details.title.pickup-address": "Delivery address", + "return-app.return-order-details.title.pickup-address": "Delivery address", "store/return-app.return-order-details.title.tooltip.pickup-address": "Select the shipping address you want for delivery or pickup", + "return-app.return-order-details.title.tooltip.pickup-address": "Select the shipping address you want for delivery or pickup", "store/return-app.return-order-details.title.extra-comment": "Additional Comment", + "return-app.return-order-details.title.extra-comment": "Additional Comment", "store/return-app.return-order-details.inputs.address-input": "Address", + "admin/return-app.return-order-details.inputs.address-input": "Address", "store/return-app.return-order-details.inputs.city-input": "City", + "admin/return-app.return-order-details.inputs.city-input": "City", "store/return-app.return-order-details.inputs.state-input": "State", + "admin/return-app.return-order-details.inputs.state-input": "State", "store/return-app.return-order-details.inputs.zip-input": "Postal code", + "admin/return-app.return-order-details.inputs.zip-input": "Postal code", "store/return-app.return-order-details.inputs.country-input": "Country", + "admin/return-app.return-order-details.inputs.country-input": "Country", "store/return-app.return-order-details.setting-provider.error.retry-action": "Try again", "store/return-app.return-order-details.setting-provider.error": "There was an error loading app settings.", "store/return-app.return-order-details.payment-options.card": "Card", + "return-app.return-order-details.payment-options.card": "Card", "store/return-app.return-order-details.payment-options.bank": "Bank", + "return-app.return-order-details.payment-options.bank": "Bank", "store/return-app.return-order-details.payment-options.gift-card": "Gift card", + "return-app.return-order-details.payment-options.gift-card": "Gift card", "store/return-app.return-order-details.payment-method.description": "Select the payment method to which the refund will be issued", + "return-app.return-order-details.payment-method.description": "Select the payment method to which the refund will be issued", "store/return-app.return-order-details.payment-method.default": "The refund will be issued to the payment method used for this order", + "return-app.return-order-details.payment-method.default": "The refund will be issued to the payment method used for this order", "store/return-app.return-order-details.payment-method.account-holder": "Account holder name", + "return-app.return-order-details.payment-method.account-holder": "Account holder name", "store/return-app.return-order-details.payment-method.iban": "IBAN", + "return-app.return-order-details.payment-method.iban": "IBAN", "store/return-app.return-order-details.terms-and-conditions.form-agree": "I have read and accept the {link}", + "return-app.return-order-details.terms-and-conditions.form-agree": "I have read and accept the {link}", "store/return-app.return-order-details.terms-and-conditions.link": "terms and conditions", + "return-app.return-order-details.terms-and-conditions.link": "terms and conditions", "store/return-app.return-order-details.button.next": "Next", + "return-app.return-order-details.button.next": "Next", "store/return-app.return-order-details.page-header.order-id": "Order ID", + "return-app.return-order-details.page-header.order-id": "Order ID", "store/return-app.return-item-details.excluded-items.warning": "Store does not allow this product to be returned", + "return-app.return-item-details.excluded-items.warning": "Store does not allow this product to be returned", "store/return-app.return-item-details.dropdown-reason.error": "Reason is required", + "return-app.return-item-details.dropdown-reason.error": "Reason is required", "store/return-app.return-item-details.dropdown-condition.error": "Condition is required", + "return-app.return-item-details.dropdown-condition.error": "Condition is required", "store/return-app.return-payment-methods.input-payment-method.error": "Payment method is required", + "return-app.return-payment-methods.input-payment-method.error": "Payment method is required", "store/return-app.return-payment-methods.input-iban.error": "IBAN is required", + "return-app.return-payment-methods.input-iban.error": "IBAN is required", "store/return-app.return-payment-methods.input-iban-invalid.error": "IBAN is not valid", + "return-app.return-payment-methods.input-iban-invalid.error": "IBAN is not valid", "store/return-app.return-payment-methods.input-account-holder.error": "Account holder is required", + "return-app.return-payment-methods.input-account-holder.error": "Account holder is required", "store/return-app.return-terms-and-conditions.checkbox.error": "Please accept the terms and conditions.", + "return-app.return-terms-and-conditions.checkbox.error": "Please accept the terms and conditions.", "store/return-app.return-items-list.no-items-selected.error": "No items selected", + "return-app.return-items-list.no-items-selected.error": "No items selected", "store/return-app.return-address-details.address-input.error": "Address is required", + "return-app.return-address-details.address-input.error": "Address is required", "store/return-app.return-address-details.city-input.error": "City is required", + "return-app.return-address-details.city-input.error": "City is required", "store/return-app.return-address-details.state-input.error": "State is required", + "return-app.return-address-details.state-input.error": "State is required", "store/return-app.return-address-details.zip-input.error": "Postal code is required", + "return-app.return-address-details.zip-input.error": "Postal code is required", "store/return-app.return-address-details.country-input.error": "Country is required", + "return-app.return-address-details.country-input.error": "Country is required", "store/return-app.return-contact-details.name-input.error": "Name is required", + "return-app.return-contact-details.name-input.error": "Name is required", "store/return-app.return-contact-details.phone-input.error": "Phone is required", + "return-app.return-contact-details.phone-input.error": "Phone is required", "store/return-app.confirm-and-submit.page-header.title": "Confirm Return Details", + "return-app.confirm-and-submit.page-header.title": "Confirm Return Details", "store/return-app.confirm-and-submit.refund-method.title": "Refund Payment Method", + "return-app.confirm-and-submit.refund-method.title": "Refund Payment Method", "store/return-app.confirm-and-submit.alert.label": "View your return list", + "return-app.confirm-and-submit.alert.label": "View your return list", "store/return-app.confirm-and-submit.alert.error.label": "Retry", + "return-app.confirm-and-submit.alert.error.label": "Retry", "store/return-app.confirm-and-submit.alert.success": "The return request was created successfully.", + "return-app.confirm-and-submit.alert.success": "The return request was created successfully.", "store/return-app.confirm-and-submit.alert.error": "Something went wrong. Please try again.", + "return-app.confirm-and-submit.alert.error": "Something went wrong. Please try again.", "store/return-app.confirm-and-submit.button.back": "Back", + "return-app.confirm-and-submit.button.back": "Back", "store/return-app.confirm-and-submit.button.submit": "Submit", + "return-app.confirm-and-submit.button.submit": "Submit", "store/return-app.confirm-and-submit.pickup-address.title": "Delivery Address", + "return-app.confirm-and-submit.pickup-address.title": "Delivery Address", "store/return-app.confirm-and-submit.contact-details.title": "Contact Details", + "return-app.confirm-and-submit.contact-details.title": "Contact Details", "store/return-app.confirm-and-submit.user-comment.title": "Comment", + "return-app.confirm-and-submit.user-comment.title": "Comment", "store/return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Recipient name: ", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Recipient name: ", "store/return-app.confirm-payment-methods.refund-method.p-iban": "Bank transfer into account: ", + "return-app.confirm-payment-methods.refund-method.p-iban": "Bank transfer into account: ", "store/return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Same as purchase", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Same as purchase", "store/return-app.return-information-table.table-row.p-condition": "Condition:", + "return-app.return-information-table.table-row.p-condition": "Condition:", "store/return-app.return-information-table.table-row.p-reason": "Reason:", + "return-app.return-information-table.table-row.p-reason": "Reason:", "admin/return-app.settings.section.payment-options.available-payment-methods.card": "Credit card", "admin/return-app.settings.section.payment-options.available-payment-methods.gift-card": "Gift card", "admin/return-app.settings.section.payment-options.available-payment-methods.bank": "Bank transfer", @@ -274,6 +351,8 @@ "admin/return-app.sellers-settings-list.page-header.title": "Sellers Settings List", "admin/return-app.return-request-list.page-header.subTitle": "All return requests created by store users. Click a request ID to see more.", "admin/return-app.sellers-settings-list.page-header.subTitle": "All settings created by sellers return app. Click a settings ID to see more.", + "admin/return-app.return-add.page-header.title": "New Return", + "admin/return-app.return-add.page-header.subTitle": "Select an item to start the return request process.", "return-app.return-request-list.error.title": "Error loading list", "return-app.return-request-list.error.description": "An error occurred while loading the request list. Please try again.", "return-app.return-request-list.table.emptyState": "No results available", @@ -294,7 +373,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "GO", "store/return-app.return-request-list.page-header.title": "My Returns", "store/return-app.return-request-list.page-header.goBack": "Go Back", - "store/return-app.return-request-list.page-header.cta": "New Request", + "return-app.return-request-list.page-header.cta": "New Request", "return-app.return-request-list.table.status.new": "New", "return-app.return-request-list.table.status.processing": "Processing", "return-app.return-request-list.table.status.pickedup-from-client": "Picked up from customer", @@ -322,9 +401,13 @@ "admin/return-app.settings.modal-warning.confirm": "Edit", "admin/return-app.settings.modal-warning.cancel": "Cancel", "store/return-app.return-order-details.pickup-address.drop-off-points": "Select a drop-off point", + "return-app.return-order-details.pickup-address.drop-off-points": "Select a drop-off point", "store/return-app.return-order-details.pickup-address.drop-off-points.tooltip": "You can return your items in one of our selected drop-off points", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "You can return your items in one of our selected drop-off points", "store/return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Select a drop-off point", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Select a drop-off point", "store/return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "There was an error loading the drop-off points", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "There was an error loading the drop-off points", "admin/return-app.return-request-details.localized-product-name.tooltip": "Original item name from the order", "admin/return-app.settings.section.payment-options.refund-method-strategy.checkbox.label": "Automatically refund requests", "admin/return-app.settings.section.payment-options.refund-method-strategy.checkbox.description": "Automatically create a return invoice in OMS for the requests", @@ -335,5 +418,15 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "

    Attention: This request's status will be set to CANCELLED.

    This will notify the user via email and allow them to create a new return request with the cancelled request's items.

    If that is not your intention, set the request as DENIED.

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    Sorry, it's not possible to cancel this request due to its current status.

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    Cancelling this request will allow the current items to be used in a new return request.

    This action is irreversible.

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Sorry, you need to contact the support team to cancel this request due to its current status.

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Sorry, you need to contact the support team to cancel this request due to its current status.

    ", + "return-app.return-order-list.table-header.order-id": "OrderId", + "return-app.return-order-list.table-header.creation-date": "Creation Date", + "return-app.return-order-list.table-header.items-to-return": "Available Items To Return", + "return-app.return-order-list.table-header.select-order": "Select Order", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "No orders available for return", + "return-app.return-order-list.table-pagination.text-of": "Text of", + "return-app.return-order-list.table-header.linkLabel": "Back to returns", + "return-app.return-order-list.page-header.title": "Order List", + "return-app.return-order-list.table-header.seller-name": "Seller name", + "return-app.return-order-list.page-header.subTitle": "All return orders. Click on an order ID to create a return." } diff --git a/messages/es.json b/messages/es.json index 9484b071f..fa5aad154 100644 --- a/messages/es.json +++ b/messages/es.json @@ -1,7 +1,7 @@ { "admin/return-app.navigation.label": "Devoluciones", "navigation.labelRequests": "Solicitudes", - "admin/return-app.sellers.settings.navigation.label":"Configuración de devolución de sellers", + "admin/return-app.sellers.settings.navigation.label": "Configuración de devolución de sellers", "admin/return-app.settings.navigation.label": "Configuración de devolución", "admin/return-app.settings.max-days.label": "Max. días:", "admin/return-app.settings.error.header": "Error al cargar la configuración", @@ -54,12 +54,16 @@ "store/return-app.link": "Mis devoluciones", "store/return-app.request-return.page.header": "Solicitar nueva devolución", "store/return-app.request-return.page.header.subtitle": "Selecciona un pedido para iniciar el proceso de solicitud de devolución", - "store/return-app.return-order-list.table-header.order-id": "ID de pedido", - "store/return-app.return-order-list.table-header.creation-date": "Fecha de creación", - "store/return-app.return-order-list.table-header.items-to-return": "Ítems disponibles para devolución", - "store/return-app.return-order-list.table-header.select-order": "Seleccionar pedido", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "No hay pedidos disponibles para devolución", - "store/return-app.return-order-list.table-pagination.text-of": "de", + "return-app.return-order-list.table-header.order-id": "ID de pedido", + "return-app.return-order-list.table-header.creation-date": "Fecha de creación", + "return-app.return-order-list.table-header.items-to-return": "Ítems disponibles para devolución", + "return-app.return-order-list.table-header.select-order": "Seleccionar pedido", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "No hay pedidos disponibles para devolución", + "return-app.return-order-list.table-pagination.text-of": "de", + "return-app.return-order-list.table-header.linkLabel": "Volver a devoluciones", + "return-app.return-order-list.page-header.title": "Lista de pedidos", + "return-app.return-order-list.table-header.seller-name": "Nombre del vendedor", + "return-app.return-order-list.page-header.subTitle": "Todos los pedidos de devolución. Haga clic en un ID de pedido para crear una devolución.", "store/return-app.return-order-details.page-header.link": "Volver a pedidos", "store/return-app.return-order-details.page-header.title": "Formulario de solicitud de devolución", "store/return-app.return-order-details.page-header.subtitle": "Selecciona los productos a reembolsar", @@ -293,7 +297,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "IR", "store/return-app.return-request-list.page-header.title": "Mis devoluciones", "store/return-app.return-request-list.page-header.goBack": "Volver", - "store/return-app.return-request-list.page-header.cta": "Nueva solicitud", + "return-app.return-request-list.page-header.cta": "Nueva solicitud", "return-app.return-request-list.table.status.new": "Nuevo", "return-app.return-request-list.table.status.processing": "En procesamiento", "return-app.return-request-list.table.status.pickedup-from-client": "Recogido del cliente", @@ -334,5 +338,89 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "

    Atención: El status de esta solicitud se establecerá como CANCELADA.

    El usuario será notificado por correo electrónico y podrá crear una nueva solicitud de devolución con los elementos de la solicitud cancelada.

    Si esa no es tu intención, define la solicitud como DENEGADA.

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    Lo sentimos, no se puede cancelar esta solicitud debido a su status actual.

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    Cancelar esta solicitud permitirá utilizar los ítems actuales en una nueva solicitud de devolución.

    Esta acción es irreversible.

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Lo sentimos, debes ponerte en contacto con el equipo de soporte para cancelar esta solicitud debido a su status actual.

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Lo sentimos, debes ponerte en contacto con el equipo de soporte para cancelar esta solicitud debido a su status actual.

    ", + + "return-app.return-order-details.page-header.link": "Volver a Pedidos", + "return-app.return-order-details.page-header.title": "Formulario de solicitud de devolución", + "return-app.return-order-details.page-header.subtitle": "Seleccione los productos que desea reembolsar", + "return-app.return-order-details.section-products": "Productos disponibles para devolución", + "return-app.return-order-details.section-details": "Información del contacto", + "return-app.return-order-details.section-payment": "Método de pago de reembolso", + "return-app.return-order-details.page-header.creation-date": "Fecha de creación", + "return-app.return-order-details.table-header.product": "Producto", + "return-app.return-order-details.table-header.quantity": "Cantidad", + "return-app.return-order-details.table-header.available-to-return": "Disponible para regresar", + "return-app.return-order-details.table-header.quantity-to-return": "Cantidad a devolver", + "return-app.return-order-details.table-header.reason": "Razón", + "return-app.return-order-details.table-header.condition": "Condición", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Orden accidental", + "return-app.return-order-details.dropdown-reasons.better-price": "Mejor precio", + "return-app.return-order-details.dropdown-reasons.performance": "Actuación", + "return-app.return-order-details.dropdown-reasons.incompatible": "Incompatible", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Artículo dañado", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Entrega perdida", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Partes faltantes", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Caja dañada", + "return-app.return-order-details.dropdown-reasons.different-product": "Producto diferente", + "return-app.return-order-details.dropdown-reasons.defective": "Defectuoso", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Llegó como extra", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "Ya no es necesario", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Compra no autorizada", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Diferente del sitio web", + "return-app.return-order-details.dropdown-reasons.other-reason": "Otra razon", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Selecciona el motivo", + "return-app.return-order-details.title.contact-details": "Detalles de contacto", + "return-app.return-order-details.inputs.name-input": "Nombre", + "return-app.return-order-details.inputs.email-input": "Correo electrónico", + "return-app.return-order-details.inputs.phone-input": "Teléfono", + "return-app.return-order-details.title.pickup-address": "Dirección de entrega", + "return-app.return-order-details.title.tooltip.pickup-address": "Seleccione la dirección de envío que desea para la entrega o recogida", + "return-app.return-order-details.title.extra-comment": "Comentario adicional", + "return-app.return-order-details.payment-options.card": "Tarjeta", + "return-app.return-order-details.payment-options.bank": "Banco", + "return-app.return-order-details.payment-options.gift-card": "Tarjeta de regalo", + "return-app.return-order-details.payment-method.description": "Seleccione el método de pago al que se emitirá el reembolso", + "return-app.return-order-details.payment-method.default": "El reembolso se emitirá al método de pago utilizado para este pedido.", + "return-app.return-order-details.payment-method.account-holder": "Nombre del titular de la cuenta", + "return-app.return-order-details.payment-method.iban": "IBAN", + "return-app.return-order-details.terms-and-conditions.form-agree": "He leído y acepto el {link}", + "return-app.return-order-details.terms-and-conditions.link": "Términos y condiciones", + "return-app.return-order-details.button.next": "Siguiente", + "return-app.return-order-details.page-header.order-id": "Solicitar ID", + "return-app.return-item-details.excluded-items.warning": "La tienda no permite la devolución de este producto.", + "return-app.return-item-details.dropdown-reason.error": "Se requiere razón", + "return-app.return-item-details.dropdown-condition.error": "Se requiere condición", + "return-app.return-payment-methods.input-payment-method.error": "Se requiere método de pago", + "return-app.return-payment-methods.input-iban.error": "Se requiere IBAN", + "return-app.return-payment-methods.input-iban-invalid.error": "IBAN no es válido", + "return-app.return-payment-methods.input-account-holder.error": "Se requiere titular de la cuenta", + "return-app.return-terms-and-conditions.checkbox.error": "Por favor acepte los términos y condiciones.", + "return-app.return-items-list.no-items-selected.error": "No hay elementos seleccionados", + "return-app.return-address-details.address-input.error": "La dirección es necesaria", + "return-app.return-address-details.city-input.error": "Ciudad es requerida", + "return-app.return-address-details.state-input.error": "Se requiere estado", + "return-app.return-address-details.zip-input.error": "Se requiere código postal", + "return-app.return-address-details.country-input.error": "El país es obligatorio", + "return-app.return-contact-details.name-input.error": "Se requiere el nombre", + "return-app.return-contact-details.phone-input.error": "Se requiere teléfono", + "return-app.confirm-and-submit.page-header.title": "Confirmar detalles de devolución", + "return-app.confirm-and-submit.refund-method.title": "Método de pago de reembolso", + "return-app.confirm-and-submit.alert.label": "Ver su lista de devoluciones", + "return-app.confirm-and-submit.alert.error.label": "Rever", + "return-app.confirm-and-submit.alert.success": "La solicitud de devolución se creó con éxito.", + "return-app.confirm-and-submit.alert.error": "Algo salió mal. Inténtalo de nuevo.", + "return-app.confirm-and-submit.button.back": "Atrás", + "return-app.confirm-and-submit.button.submit": "Entregar", + "return-app.confirm-and-submit.pickup-address.title": "Dirección de entrega", + "return-app.confirm-and-submit.contact-details.title": "Detalles de contacto", + "return-app.confirm-and-submit.user-comment.title": "Comentario", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Nombre del Recipiente:", + "return-app.confirm-payment-methods.refund-method.p-iban": "Transferencia bancaria a cuenta:", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Igual que la compra", + "return-app.return-information-table.table-row.p-condition": "Condición:", + "return-app.return-information-table.table-row.p-reason": "Razón:", + "return-app.return-order-details.pickup-address.drop-off-points": "Seleccione un punto de entrega", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "Puede devolver sus artículos en uno de nuestros puntos de entrega seleccionados", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Seleccione un punto de entrega", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "Hubo un error al cargar los puntos de entrega" } diff --git a/messages/fr.json b/messages/fr.json index 2f95d0996..df2eab7e9 100644 --- a/messages/fr.json +++ b/messages/fr.json @@ -53,12 +53,16 @@ "store/return-app.link": "Mes retours", "store/return-app.request-return.page.header": "Demander un nouveau retour", "store/return-app.request-return.page.header.subtitle": "Sélectionner une commande pour démarrer le processus de demande de retour", - "store/return-app.return-order-list.table-header.order-id": "ID de commande", - "store/return-app.return-order-list.table-header.creation-date": "Date de création", - "store/return-app.return-order-list.table-header.items-to-return": "Articles disponibles pour un retour", - "store/return-app.return-order-list.table-header.select-order": "Sélectionner la commande", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "Aucune commande disponible pour un retour", - "store/return-app.return-order-list.table-pagination.text-of": "of", + "return-app.return-order-list.table-header.order-id": "ID de commande", + "return-app.return-order-list.table-header.creation-date": "Date de création", + "return-app.return-order-list.table-header.items-to-return": "Articles disponibles pour un retour", + "return-app.return-order-list.table-header.select-order": "Sélectionner la commande", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "Aucune commande disponible pour un retour", + "return-app.return-order-list.table-pagination.text-of": "of", + "return-app.return-order-list.table-header.linkLabel": "Retour aux retours", + "return-app.return-order-list.page-header.title": "Liste de commandes", + "return-app.return-order-list.table-header.seller-name": "Nom du vendeur", + "return-app.return-order-list.page-header.subTitle": "Toutes les commandes de retour. Cliquez sur un ID de commande pour créer un retour.", "store/return-app.return-order-details.page-header.link": "Retour aux commandes", "store/return-app.return-order-details.page-header.title": "Formulaire de demande de retour", "store/return-app.return-order-details.page-header.subtitle": "Sélectionnez les articles que vous souhaitez rembourser", @@ -289,7 +293,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "OK", "store/return-app.return-request-list.page-header.title": "Mes retours", "store/return-app.return-request-list.page-header.goBack": "Retour", - "store/return-app.return-request-list.page-header.cta": "Nouvelle demande", + "return-app.return-request-list.page-header.cta": "Nouvelle demande", "return-app.return-request-list.table.status.new": "Nouveau", "return-app.return-request-list.table.status.processing": "En cours", "return-app.return-request-list.table.status.pickedup-from-client": "Retrait effectué par le client", @@ -330,5 +334,89 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "

    Attention : Le statut de cette demande sera défini sur ANNULÉ.

    Ceci avertira l’utilisateur par email et lui permettra de créer une nouvelle demande de retour avec les éléments de la demande annulée.

    Si ce n’est pas votre intention, définissez la requête comme REFUSÉ.

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    Désolé, il est impossible d’annuler cette demande en raison de son état actuel.

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    L’annulation de cette requête permettra aux articles actuels d’être utilisés dans une nouvelle demande de retour.

    Cette action est irréversible.

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Désolé, vous devez contacter l’équipe d’assistance pour annuler cette demande en raison de son statut actuel.

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Désolé, vous devez contacter l’équipe d’assistance pour annuler cette demande en raison de son statut actuel.

    ", + + "return-app.return-order-details.page-header.link": "Retour aux commandes", + "return-app.return-order-details.page-header.title": "Formulaire de demande de retour", + "return-app.return-order-details.page-header.subtitle": "Sélectionnez les produits que vous souhaitez rembourser", + "return-app.return-order-details.section-products": "Produits disponibles pour retour", + "return-app.return-order-details.section-details": "Coordonnées", + "return-app.return-order-details.section-payment": "Rembourser le mode de paiement", + "return-app.return-order-details.page-header.creation-date": "Date de création", + "return-app.return-order-details.table-header.product": "Produit", + "return-app.return-order-details.table-header.quantity": "Quantité", + "return-app.return-order-details.table-header.available-to-return": "Disponible pour retour", + "return-app.return-order-details.table-header.quantity-to-return": "Quantité à retourner", + "return-app.return-order-details.table-header.reason": "Raison", + "return-app.return-order-details.table-header.condition": "Condition", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Commande accidentelle", + "return-app.return-order-details.dropdown-reasons.better-price": "Meilleur prix", + "return-app.return-order-details.dropdown-reasons.performance": "Performance", + "return-app.return-order-details.dropdown-reasons.incompatible": "Incompatible", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Article endommagé", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Livraison manquée", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Parties manquantes", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Boîte endommagée", + "return-app.return-order-details.dropdown-reasons.different-product": "Produit différent", + "return-app.return-order-details.dropdown-reasons.defective": "Défectueux", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Arrivé en supplément", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "Ne sont plus nécessaires", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Achat non autorisé", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Différent du site Web", + "return-app.return-order-details.dropdown-reasons.other-reason": "Autre raison", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Sélectionnez la raison", + "return-app.return-order-details.title.contact-details": "Détails du contact", + "return-app.return-order-details.inputs.name-input": "Nom", + "return-app.return-order-details.inputs.email-input": "E-mail", + "return-app.return-order-details.inputs.phone-input": "Téléphone", + "return-app.return-order-details.title.pickup-address": "Adresse de livraison", + "return-app.return-order-details.title.tooltip.pickup-address": "Sélectionnez l'adresse de livraison que vous souhaitez pour la livraison ou le ramassage", + "return-app.return-order-details.title.extra-comment": "Commentaire additionnel", + "return-app.return-order-details.payment-options.card": "Carte", + "return-app.return-order-details.payment-options.bank": "Banque", + "return-app.return-order-details.payment-options.gift-card": "Carte cadeau", + "return-app.return-order-details.payment-method.description": "Sélectionnez le mode de paiement sur lequel le remboursement sera émis", + "return-app.return-order-details.payment-method.default": "Le remboursement sera effectué sur le mode de paiement utilisé pour cette commande", + "return-app.return-order-details.payment-method.account-holder": "Nom du titulaire du compte", + "return-app.return-order-details.payment-method.iban": "ALLAIENT", + "return-app.return-order-details.terms-and-conditions.form-agree": "J'ai lu et j'accepte les le {link}", + "return-app.return-order-details.terms-and-conditions.link": "termes et conditions", + "return-app.return-order-details.button.next": "Suivant", + "return-app.return-order-details.page-header.order-id": "numéro de commande", + "return-app.return-item-details.excluded-items.warning": "Le magasin n'autorise pas le retour de ce produit", + "return-app.return-item-details.dropdown-reason.error": "La raison est requise", + "return-app.return-item-details.dropdown-condition.error": "Condition requise", + "return-app.return-payment-methods.input-payment-method.error": "Le mode de paiement est requis", + "return-app.return-payment-methods.input-iban.error": "IBAN est requis", + "return-app.return-payment-methods.input-iban-invalid.error": "L'IBAN n'est pas valide", + "return-app.return-payment-methods.input-account-holder.error": "Le titulaire du compte est requis", + "return-app.return-terms-and-conditions.checkbox.error": "Veuillez accepter les termes et conditions.", + "return-app.return-items-list.no-items-selected.error": "Aucun élément sélectionné", + "return-app.return-address-details.address-input.error": "L'adresse est obligatoire", + "return-app.return-address-details.city-input.error": "La ville est obligatoire", + "return-app.return-address-details.state-input.error": "L'état est requis", + "return-app.return-address-details.zip-input.error": "Le code postal est requis", + "return-app.return-address-details.country-input.error": "Le pays est requis", + "return-app.return-contact-details.name-input.error": "Le nom est requis", + "return-app.return-contact-details.phone-input.error": "Le téléphone est requis", + "return-app.confirm-and-submit.page-header.title": "Confirmer les détails du retour", + "return-app.confirm-and-submit.refund-method.title": "Méthode de paiement de remboursement", + "return-app.confirm-and-submit.alert.label": "Consulter votre liste de retour", + "return-app.confirm-and-submit.alert.error.label": "Recommencez", + "return-app.confirm-and-submit.alert.success": "La demande de retour a été créée avec succès.", + "return-app.confirm-and-submit.alert.error": "Quelque chose s'est mal passé. Veuillez réessayer.", + "return-app.confirm-and-submit.button.back": "Dos", + "return-app.confirm-and-submit.button.submit": "Soumettre", + "return-app.confirm-and-submit.pickup-address.title": "Adresse de livraison", + "return-app.confirm-and-submit.contact-details.title": "Détails du contact", + "return-app.confirm-and-submit.user-comment.title": "Commentaire", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Nom du destinataire :", + "return-app.confirm-payment-methods.refund-method.p-iban": "Virement bancaire sur le compte :", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Identique à l'achat", + "return-app.return-information-table.table-row.p-condition": "Condition:", + "return-app.return-information-table.table-row.p-reason": "Raison:", + "return-app.return-order-details.pickup-address.drop-off-points": "Sélectionnez un point de chute", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "Vous pouvez retourner vos articles dans l'un de nos points de dépôt sélectionnés", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Sélectionnez un point de chute", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "Une erreur s'est produite lors du chargement des points de chute" } diff --git a/messages/it.json b/messages/it.json index 39881fd88..9144e884c 100644 --- a/messages/it.json +++ b/messages/it.json @@ -53,12 +53,16 @@ "store/return-app.link": "I miei resi", "store/return-app.request-return.page.header": "Richiedi nuovo reso", "store/return-app.request-return.page.header.subtitle": "Seleziona un ordine per avviare il processo di richiesta di reso", - "store/return-app.return-order-list.table-header.order-id": "ID ordine", - "store/return-app.return-order-list.table-header.creation-date": "Data di creazione", - "store/return-app.return-order-list.table-header.items-to-return": "Articoli idonei al reso", - "store/return-app.return-order-list.table-header.select-order": "Seleziona ordine", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "Nessun ordine idoneo al reso", - "store/return-app.return-order-list.table-pagination.text-of": "di", + "return-app.return-order-list.table-header.order-id": "ID ordine", + "return-app.return-order-list.table-header.creation-date": "Data di creazione", + "return-app.return-order-list.table-header.items-to-return": "Articoli idonei al reso", + "return-app.return-order-list.table-header.select-order": "Seleziona ordine", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "Nessun ordine idoneo al reso", + "return-app.return-order-list.table-pagination.text-of": "di", + "return-app.return-order-list.table-header.linkLabel": "Torna a resi", + "return-app.return-order-list.page-header.title": "Elenco ordini", + "return-app.return-order-list.table-header.seller-name": "Nome del venditore", + "return-app.return-order-list.page-header.subTitle": "Tutti gli ordini di reso. Fare clic su un ID ordine per creare un reso.", "store/return-app.return-order-details.page-header.link": "Torna agli ordini", "store/return-app.return-order-details.page-header.title": "Modulo per richieste di reso", "store/return-app.return-order-details.page-header.subtitle": "Seleziona i prodotti che si desiderano rimborsare", @@ -289,7 +293,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "VAI", "store/return-app.return-request-list.page-header.title": "I miei resi", "store/return-app.return-request-list.page-header.goBack": "Torna indietro", - "store/return-app.return-request-list.page-header.cta": "Nuova richiesta", + "return-app.return-request-list.page-header.cta": "Nuova richiesta", "return-app.return-request-list.table.status.new": "Nuovo", "return-app.return-request-list.table.status.processing": "In elaborazione", "return-app.return-request-list.table.status.pickedup-from-client": "Ritirato dal cliente", @@ -329,5 +333,89 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "

    Attenzione: lo stato di questa richiesta sarà impostato su ANNULLATO.

    L'utente verrà notificato via email e potrà creare una nuova richiesta di reso con gli articoli della richiesta annullata.

    Se questa non è la tua intenzione, imposta lo stato della richiesta su RIFIUTATO.

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    Siamo spiacenti, non è possibile annullare questa richiesta a causa del suo stato attuale.

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    L'annullamento di questa richiesta consentirà di utilizzare gli articoli attuali in una nuova richiesta di reso.

    Questa azione è irreversibile.

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Siamo spiacenti, è necessario contattare il team di assistenza per annullare questa richiesta a causa del suo stato attuale.

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Siamo spiacenti, è necessario contattare il team di assistenza per annullare questa richiesta a causa del suo stato attuale.

    ", + + "return-app.return-order-details.page-header.link": "Torniamo agli ordini", + "return-app.return-order-details.page-header.title": "Modulo richiesta reso", + "return-app.return-order-details.page-header.subtitle": "Seleziona i prodotti che desideri rimborsare", + "return-app.return-order-details.section-products": "Prodotti disponibili per il reso", + "return-app.return-order-details.section-details": "Informazioni sui contatti", + "return-app.return-order-details.section-payment": "Metodo di pagamento del rimborso", + "return-app.return-order-details.page-header.creation-date": "Data di creazione", + "return-app.return-order-details.table-header.product": "Prodotto", + "return-app.return-order-details.table-header.quantity": "Quantità", + "return-app.return-order-details.table-header.available-to-return": "Disponibile al reso", + "return-app.return-order-details.table-header.quantity-to-return": "Quantità da restituire", + "return-app.return-order-details.table-header.reason": "Motivo", + "return-app.return-order-details.table-header.condition": "Condizione", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Ordine accidentale", + "return-app.return-order-details.dropdown-reasons.better-price": "Prezzo migliore", + "return-app.return-order-details.dropdown-reasons.performance": "Prestazione", + "return-app.return-order-details.dropdown-reasons.incompatible": "Incompatibile", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Articolo danneggiato", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Mancata consegna", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Parti mancanti", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Scatola danneggiata", + "return-app.return-order-details.dropdown-reasons.different-product": "Prodotto diverso", + "return-app.return-order-details.dropdown-reasons.defective": "Difettoso", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Arrivato come Extra", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "Non è più necessario", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Acquisto non autorizzato", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Diverso dal sito web", + "return-app.return-order-details.dropdown-reasons.other-reason": "Un'altra ragione", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Seleziona il motivo", + "return-app.return-order-details.title.contact-details": "Dettagli del contatto", + "return-app.return-order-details.inputs.name-input": "Nome", + "return-app.return-order-details.inputs.email-input": "E-mail", + "return-app.return-order-details.inputs.phone-input": "Telefono", + "return-app.return-order-details.title.pickup-address": "Indirizzo di consegna", + "return-app.return-order-details.title.tooltip.pickup-address": "Seleziona l'indirizzo di spedizione che desideri per la consegna o il ritiro", + "return-app.return-order-details.title.extra-comment": "Commento aggiuntivo", + "return-app.return-order-details.payment-options.card": "Carta", + "return-app.return-order-details.payment-options.bank": "Banca", + "return-app.return-order-details.payment-options.gift-card": "Carta regalo", + "return-app.return-order-details.payment-method.description": "Seleziona il metodo di pagamento a cui verrà emesso il rimborso", + "return-app.return-order-details.payment-method.default": "Il rimborso verrà emesso sul metodo di pagamento utilizzato per questo ordine", + "return-app.return-order-details.payment-method.account-holder": "Nome del titolare", + "return-app.return-order-details.payment-method.iban": "STAVAMO ANDANDO", + "return-app.return-order-details.terms-and-conditions.form-agree": "Ho letto e accetto il {link}", + "return-app.return-order-details.terms-and-conditions.link": "Termini e Condizioni", + "return-app.return-order-details.button.next": "Prossimo", + "return-app.return-order-details.page-header.order-id": "ID ordine", + "return-app.return-item-details.excluded-items.warning": "Il negozio non consente la restituzione di questo prodotto", + "return-app.return-item-details.dropdown-reason.error": "La ragione è richiesta", + "return-app.return-item-details.dropdown-condition.error": "La condizione è richiesta", + "return-app.return-payment-methods.input-payment-method.error": "Il metodo di pagamento è obbligatorio", + "return-app.return-payment-methods.input-iban.error": "L'IBAN è obbligatorio", + "return-app.return-payment-methods.input-iban-invalid.error": "L'IBAN non è valido", + "return-app.return-payment-methods.input-account-holder.error": "Il titolare del conto è obbligatorio", + "return-app.return-terms-and-conditions.checkbox.error": "Si prega di accettare i termini e le condizioni.", + "return-app.return-items-list.no-items-selected.error": "Nessun elemento selezionato", + "return-app.return-address-details.address-input.error": "L'indirizzo è obbligatorio", + "return-app.return-address-details.city-input.error": "La città è obbligatoria", + "return-app.return-address-details.state-input.error": "Lo stato è obbligatorio", + "return-app.return-address-details.zip-input.error": "Il codice postale è obbligatorio", + "return-app.return-address-details.country-input.error": "Il paese è obbligatorio", + "return-app.return-contact-details.name-input.error": "Il nome è obbligatorio", + "return-app.return-contact-details.phone-input.error": "Il telefono è obbligatorio", + "return-app.confirm-and-submit.page-header.title": "Conferma i dettagli del reso", + "return-app.confirm-and-submit.refund-method.title": "Metodo di pagamento del rimborso", + "return-app.confirm-and-submit.alert.label": "Visualizza l'elenco dei resi", + "return-app.confirm-and-submit.alert.error.label": "Riprova", + "return-app.confirm-and-submit.alert.success": "La richiesta di reso è stata creata con successo.", + "return-app.confirm-and-submit.alert.error": "Qualcosa è andato storto. Per favore riprova.", + "return-app.confirm-and-submit.button.back": "Indietro", + "return-app.confirm-and-submit.button.submit": "Invia", + "return-app.confirm-and-submit.pickup-address.title": "Indirizzo di consegna", + "return-app.confirm-and-submit.contact-details.title": "Dettagli del contatto", + "return-app.confirm-and-submit.user-comment.title": "Commento", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Nome destinatario:", + "return-app.confirm-payment-methods.refund-method.p-iban": "Bonifico bancario in conto:", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Uguale all'acquisto", + "return-app.return-information-table.table-row.p-condition": "Condizione:", + "return-app.return-information-table.table-row.p-reason": "Motivo:", + "return-app.return-order-details.pickup-address.drop-off-points": "Seleziona un punto di consegna", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "Puoi restituire i tuoi articoli in uno dei nostri punti di consegna selezionati", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Seleziona un punto di consegna", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "Si è verificato un errore durante il caricamento dei punti di consegna" } diff --git a/messages/nl.json b/messages/nl.json index a9e38bf80..5eb865e4b 100644 --- a/messages/nl.json +++ b/messages/nl.json @@ -53,12 +53,16 @@ "store/return-app.link": "Mijn retourzendingen", "store/return-app.request-return.page.header": "Nieuwe retour aanvragen", "store/return-app.request-return.page.header.subtitle": "Selecteer een bestelling om het retourverzoek te starten", - "store/return-app.return-order-list.table-header.order-id": "Bestel-ID", - "store/return-app.return-order-list.table-header.creation-date": "Aanmaakdatum", - "store/return-app.return-order-list.table-header.items-to-return": "Beschikbare items voor retour", - "store/return-app.return-order-list.table-header.select-order": "Kies bestelling", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "Geen bestellingen beschikbaar om te retouren", - "store/return-app.return-order-list.table-pagination.text-of": "van", + "return-app.return-order-list.table-header.order-id": "Bestel-ID", + "return-app.return-order-list.table-header.creation-date": "Aanmaakdatum", + "return-app.return-order-list.table-header.items-to-return": "Beschikbare items voor retour", + "return-app.return-order-list.table-header.select-order": "Kies bestelling", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "Geen bestellingen beschikbaar om te retouren", + "return-app.return-order-list.table-pagination.text-of": "van", + "return-app.return-order-list.table-header.linkLabel": "Terug naar retourzendingen", + "return-app.return-order-list.page-header.title": "Bestellijst", + "return-app.return-order-list.table-header.seller-name": "Naam verkoper", + "return-app.return-order-list.page-header.subTitle": "Alle retourbestellingen. Klik op een bestel-ID om een retourzending te maken.", "store/return-app.return-order-details.page-header.link": "Terug naar bestellingen", "store/return-app.return-order-details.page-header.title": "Retouraanvraagformulier", "store/return-app.return-order-details.page-header.subtitle": "Selecteer de producten die u wilt terugbetalen", @@ -288,7 +292,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "GA", "store/return-app.return-request-list.page-header.title": "Mijn retourzendingen", "store/return-app.return-request-list.page-header.goBack": "Ga terug", - "store/return-app.return-request-list.page-header.cta": "Nieuwe aanvraag", + "return-app.return-request-list.page-header.cta": "Nieuwe aanvraag", "return-app.return-request-list.table.status.new": "Nieuw", "return-app.return-request-list.table.status.processing": "Verwerken", "return-app.return-request-list.table.status.pickedup-from-client": "Afgehaald bij klant", @@ -329,5 +333,89 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "

    Let op: De status van dit verzoek wordt ingesteld op GEANNULEERD.

    Dit stelt de gebruiker via e-mail op de hoogte en stelt hem in staat een nieuwe retouraanvraag te maken met de items van het geannuleerde verzoek.

    Als dat niet uw bedoeling is, stel het verzoek dan in als GEWEIGERD.

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    Sorry, het is niet mogelijk om dit verzoek te annuleren vanwege de huidige status.

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    Als u dit verzoek annuleert, kunnen de huidige items worden gebruikt in een nieuwe retouraanvraag.

    Deze actie is onomkeerbaar.

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Sorry, u moet contact opnemen met het ondersteuningsteam om dit verzoek te annuleren vanwege de huidige status.

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Sorry, u moet contact opnemen met het ondersteuningsteam om dit verzoek te annuleren vanwege de huidige status.

    ", + + "return-app.return-order-details.page-header.link": "Terug naar bestellingen", + "return-app.return-order-details.page-header.title": "Retour aanvraagformulier", + "return-app.return-order-details.page-header.subtitle": "Selecteer de producten die je wilt terugbetalen", + "return-app.return-order-details.section-products": "Producten beschikbaar voor retournering", + "return-app.return-order-details.section-details": "Contactgegevens", + "return-app.return-order-details.section-payment": "Betalingswijze terugbetalen", + "return-app.return-order-details.page-header.creation-date": "Aanmaakdatum", + "return-app.return-order-details.table-header.product": "Product", + "return-app.return-order-details.table-header.quantity": "Hoeveelheid", + "return-app.return-order-details.table-header.available-to-return": "Beschikbaar om te retourneren", + "return-app.return-order-details.table-header.quantity-to-return": "Aantal te retourneren", + "return-app.return-order-details.table-header.reason": "Reden", + "return-app.return-order-details.table-header.condition": "Voorwaarde", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Toevallige bestelling", + "return-app.return-order-details.dropdown-reasons.better-price": "Betere prijs", + "return-app.return-order-details.dropdown-reasons.performance": "Prestatie", + "return-app.return-order-details.dropdown-reasons.incompatible": "Onverenigbaar", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Beschadigd item", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Gemiste bezorging", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Missende onderdelen", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Beschadigde doos", + "return-app.return-order-details.dropdown-reasons.different-product": "Ander produkt", + "return-app.return-order-details.dropdown-reasons.defective": "Defecte", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Aangekomen als Extra", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "Niet langer nodig", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Ongeautoriseerde aankoop", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Anders dan website", + "return-app.return-order-details.dropdown-reasons.other-reason": "Andere reden", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Selecteer reden", + "return-app.return-order-details.title.contact-details": "Contact details", + "return-app.return-order-details.inputs.name-input": "Naam", + "return-app.return-order-details.inputs.email-input": "E-mail", + "return-app.return-order-details.inputs.phone-input": "Telefoon", + "return-app.return-order-details.title.pickup-address": "Bezorgadres", + "return-app.return-order-details.title.tooltip.pickup-address": "Selecteer het verzendadres dat u wilt laten bezorgen of ophalen", + "return-app.return-order-details.title.extra-comment": "Toegevoegd commentaar", + "return-app.return-order-details.payment-options.card": "Kaart", + "return-app.return-order-details.payment-options.bank": "Bank", + "return-app.return-order-details.payment-options.gift-card": "Cadeaukaart", + "return-app.return-order-details.payment-method.description": "Selecteer de betaalmethode waarop de terugbetaling zal worden uitgevoerd", + "return-app.return-order-details.payment-method.default": "De terugbetaling wordt uitgevoerd via de betaalmethode die voor deze bestelling is gebruikt", + "return-app.return-order-details.payment-method.account-holder": "Naam rekeninghouder", + "return-app.return-order-details.payment-method.iban": "WE GAAN", + "return-app.return-order-details.terms-and-conditions.form-agree": "Ik heb de {link} gelezen en geaccepteerd", + "return-app.return-order-details.terms-and-conditions.link": "voorwaarden", + "return-app.return-order-details.button.next": "Volgende", + "return-app.return-order-details.page-header.order-id": "Order ID", + "return-app.return-item-details.excluded-items.warning": "Store staat niet toe dat dit product wordt geretourneerd", + "return-app.return-item-details.dropdown-reason.error": "Reden is vereist", + "return-app.return-item-details.dropdown-condition.error": "Voorwaarde is vereist", + "return-app.return-payment-methods.input-payment-method.error": "Betaalmethode is vereist", + "return-app.return-payment-methods.input-iban.error": "IBAN is vereist", + "return-app.return-payment-methods.input-iban-invalid.error": "IBAN is niet geldig", + "return-app.return-payment-methods.input-account-holder.error": "Accounthouder is verplicht", + "return-app.return-terms-and-conditions.checkbox.error": "Accepteer de algemene voorwaarden.", + "return-app.return-items-list.no-items-selected.error": "Geen items geselecteerd", + "return-app.return-address-details.address-input.error": "adres is nodig", + "return-app.return-address-details.city-input.error": "Plaats is vereist", + "return-app.return-address-details.state-input.error": "Staat is vereist", + "return-app.return-address-details.zip-input.error": "Postcode is vereist", + "return-app.return-address-details.country-input.error": "Land is vereist", + "return-app.return-contact-details.name-input.error": "Naam is vereist", + "return-app.return-contact-details.phone-input.error": "Telefoon is verplicht", + "return-app.confirm-and-submit.page-header.title": "Bevestig retourgegevens", + "return-app.confirm-and-submit.refund-method.title": "Betalingswijze terugbetaling", + "return-app.confirm-and-submit.alert.label": "Bekijk je retourlijst", + "return-app.confirm-and-submit.alert.error.label": "Opnieuw proberen", + "return-app.confirm-and-submit.alert.success": "Het retourverzoek is succesvol aangemaakt.", + "return-app.confirm-and-submit.alert.error": "Er is iets fout gegaan. Probeer het opnieuw.", + "return-app.confirm-and-submit.button.back": "Rug", + "return-app.confirm-and-submit.button.submit": "Indienen", + "return-app.confirm-and-submit.pickup-address.title": "Bezorgadres", + "return-app.confirm-and-submit.contact-details.title": "Contact details", + "return-app.confirm-and-submit.user-comment.title": "Opmerking", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Naam ontvanger:", + "return-app.confirm-payment-methods.refund-method.p-iban": "Bankoverschrijving op rekening:", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "Zelfde als aankoop", + "return-app.return-information-table.table-row.p-condition": "Voorwaarde:", + "return-app.return-information-table.table-row.p-reason": "Reden:", + "return-app.return-order-details.pickup-address.drop-off-points": "Selecteer een afleverpunt", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "U kunt uw artikelen retourneren in een van onze geselecteerde inleverpunten", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Selecteer een afleverpunt", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "Er is een fout opgetreden bij het laden van de afleverpunten" } diff --git a/messages/pt.json b/messages/pt.json index f24ce3fbd..a4177baab 100644 --- a/messages/pt.json +++ b/messages/pt.json @@ -53,12 +53,16 @@ "store/return-app.link": "Minhas devoluções", "store/return-app.request-return.page.header": "Solicitar nova devolução", "store/return-app.request-return.page.header.subtitle": "Selecione um pedido para iniciar o processo de solicitação de devolução", - "store/return-app.return-order-list.table-header.order-id": "ID do pedido", - "store/return-app.return-order-list.table-header.creation-date": "Data de criação", - "store/return-app.return-order-list.table-header.items-to-return": "Itens disponíveis para devolução", - "store/return-app.return-order-list.table-header.select-order": "Selecionar pedido", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "Nenhum pedido disponível para devolução", - "store/return-app.return-order-list.table-pagination.text-of": "de", + "return-app.return-order-list.table-header.order-id": "ID do pedido", + "return-app.return-order-list.table-header.creation-date": "Data de criação", + "return-app.return-order-list.table-header.items-to-return": "Itens disponíveis para devolução", + "return-app.return-order-list.table-header.select-order": "Selecionar pedido", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "Nenhum pedido disponível para devolução", + "return-app.return-order-list.table-pagination.text-of": "de", + "return-app.return-order-list.table-header.linkLabel": "Voltar para devoluções", + "return-app.return-order-list.page-header.title": "Lista de pedidos", + "return-app.return-order-list.table-header.seller-name": "Nome do vendedor", + "return-app.return-order-list.page-header.subTitle": "Todos os pedidos de devolução. Clique em um ID de pedido para criar uma devolução.", "store/return-app.return-order-details.page-header.link": "Voltar aos pedidos", "store/return-app.return-order-details.page-header.title": "Formulário para solicitar devolução", "store/return-app.return-order-details.page-header.subtitle": "Selecione os produtos que serão reembolsados", @@ -289,7 +293,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "IR", "store/return-app.return-request-list.page-header.title": "Minhas devoluções", "store/return-app.return-request-list.page-header.goBack": "Voltar", - "store/return-app.return-request-list.page-header.cta": "Nova solicitação", + "return-app.return-request-list.page-header.cta": "Nova solicitação", "return-app.return-request-list.table.status.new": "Novo", "return-app.return-request-list.table.status.processing": "Em processamento", "return-app.return-request-list.table.status.pickedup-from-client": "Recebido do cliente", @@ -330,5 +334,89 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "

    Atenção: o status desta solicitação será definido como CANCELADO.

    Isso irá notificar o usuário por email e permitir a criação de uma nova solicitação de devolução com os itens do pedido cancelado.

    Se essa não for a sua intenção, defina a solicitação como NEGADA.

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    Não é possível cancelar este pedido devido ao seu status atual.

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    O cancelamento desta solicitação permitirá que os itens atuais sejam usados em uma nova solicitação de devolução.

    Esta ação é irreversível.

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Devido ao status atual do pedido, você precisa entrar em contato com a equipe de suporte para cancelá-lo.

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Devido ao status atual do pedido, você precisa entrar em contato com a equipe de suporte para cancelá-lo.

    ", + + "return-app.return-order-details.page-header.link": "de volta às encomendas", + "return-app.return-order-details.page-header.title": "Formulário de Solicitação de Devolução", + "return-app.return-order-details.page-header.subtitle": "Selecione os produtos que deseja reembolsar", + "return-app.return-order-details.section-products": "Produtos disponíveis para devolução", + "return-app.return-order-details.section-details": "Informações de contato", + "return-app.return-order-details.section-payment": "Forma de pagamento do reembolso", + "return-app.return-order-details.page-header.creation-date": "Data de criação", + "return-app.return-order-details.table-header.product": "produtos", + "return-app.return-order-details.table-header.quantity": "Quantidade", + "return-app.return-order-details.table-header.available-to-return": "Disponível para retornar", + "return-app.return-order-details.table-header.quantity-to-return": "Quantidade a devolver", + "return-app.return-order-details.table-header.reason": "Razão", + "return-app.return-order-details.table-header.condition": "Doença", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Ordem Acidental", + "return-app.return-order-details.dropdown-reasons.better-price": "Melhor preço", + "return-app.return-order-details.dropdown-reasons.performance": "Desempenho", + "return-app.return-order-details.dropdown-reasons.incompatible": "Incompatível", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Item danificado", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Entrega Perdida", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Partes faltando", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Caixa danificada", + "return-app.return-order-details.dropdown-reasons.different-product": "Produto diferente", + "return-app.return-order-details.dropdown-reasons.defective": "defeituoso", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "Chegou como Extra", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "Não é mais necessário", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Compra não autorizada", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Diferente do site", + "return-app.return-order-details.dropdown-reasons.other-reason": "Outra razão", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Selecione o motivo", + "return-app.return-order-details.title.contact-details": "Detalhes do contato", + "return-app.return-order-details.inputs.name-input": "Nome", + "return-app.return-order-details.inputs.email-input": "E-mail", + "return-app.return-order-details.inputs.phone-input": "Telefone", + "return-app.return-order-details.title.pickup-address": "Endereço de entrega", + "return-app.return-order-details.title.tooltip.pickup-address": "Selecione o endereço de entrega que deseja para entrega ou retirada", + "return-app.return-order-details.title.extra-comment": "Comentário adicional", + "return-app.return-order-details.payment-options.card": "Cartão", + "return-app.return-order-details.payment-options.bank": "Banco", + "return-app.return-order-details.payment-options.gift-card": "Cartão Presente", + "return-app.return-order-details.payment-method.description": "Selecione o método de pagamento para o qual o reembolso será emitido", + "return-app.return-order-details.payment-method.default": "O reembolso será emitido para o método de pagamento usado para este pedido", + "return-app.return-order-details.payment-method.account-holder": "Nome do titular da conta", + "return-app.return-order-details.payment-method.iban": "ESTAVAM INDO", + "return-app.return-order-details.terms-and-conditions.form-agree": "Eu li e aceito o {link}", + "return-app.return-order-details.terms-and-conditions.link": "termos e Condições", + "return-app.return-order-details.button.next": "Próximo", + "return-app.return-order-details.page-header.order-id": "ID do pedido", + "return-app.return-item-details.excluded-items.warning": "A loja não permite a devolução deste produto", + "return-app.return-item-details.dropdown-reason.error": "O motivo é obrigatório", + "return-app.return-item-details.dropdown-condition.error": "A condição é necessária", + "return-app.return-payment-methods.input-payment-method.error": "O método de pagamento é obrigatório", + "return-app.return-payment-methods.input-iban.error": "O IBAN é obrigatório", + "return-app.return-payment-methods.input-iban-invalid.error": "IBAN inválido", + "return-app.return-payment-methods.input-account-holder.error": "Titular da conta é obrigatório", + "return-app.return-terms-and-conditions.checkbox.error": "Aceite os termos e condições.", + "return-app.return-items-list.no-items-selected.error": "Nenhum item selecionado", + "return-app.return-address-details.address-input.error": "Endereço é necessário", + "return-app.return-address-details.city-input.error": "A cidade é obrigatória", + "return-app.return-address-details.state-input.error": "O estado é obrigatório", + "return-app.return-address-details.zip-input.error": "O código postal é obrigatório", + "return-app.return-address-details.country-input.error": "O país é obrigatório", + "return-app.return-contact-details.name-input.error": "O nome é obrigatório", + "return-app.return-contact-details.phone-input.error": "O telefone é obrigatório", + "return-app.confirm-and-submit.page-header.title": "Confirme os detalhes da devolução", + "return-app.confirm-and-submit.refund-method.title": "Forma de pagamento do reembolso", + "return-app.confirm-and-submit.alert.label": "Veja sua lista de devolução", + "return-app.confirm-and-submit.alert.error.label": "Tentar novamente", + "return-app.confirm-and-submit.alert.success": "A solicitação de devolução foi criada com sucesso.", + "return-app.confirm-and-submit.alert.error": "Algo deu errado. Por favor, tente novamente.", + "return-app.confirm-and-submit.button.back": "Voltar", + "return-app.confirm-and-submit.button.submit": "Enviar", + "return-app.confirm-and-submit.pickup-address.title": "Endereço de entrega", + "return-app.confirm-and-submit.contact-details.title": "Detalhes do contato", + "return-app.confirm-and-submit.user-comment.title": "Comente", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Nome do Destinatário:", + "return-app.confirm-payment-methods.refund-method.p-iban": "Transferência bancária na conta:", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "O mesmo que compra", + "return-app.return-information-table.table-row.p-condition": "Doença:", + "return-app.return-information-table.table-row.p-reason": "Razão:", + "return-app.return-order-details.pickup-address.drop-off-points": "Selecione um ponto de entrega", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "Você pode devolver seus itens em um de nossos pontos de entrega selecionados", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Selecione um ponto de entrega", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "Ocorreu um erro ao carregar os pontos de entrega" } diff --git a/messages/ro.json b/messages/ro.json index 0df22f8ac..1388620ae 100644 --- a/messages/ro.json +++ b/messages/ro.json @@ -53,12 +53,16 @@ "store/return-app.link": "Retururile mele", "store/return-app.request-return.page.header": "Solicită un nou retur", "store/return-app.request-return.page.header.subtitle": "Selectează o comandă pentru a începe procesul de solicitare a returului", - "store/return-app.return-order-list.table-header.order-id": "ID Comandă", - "store/return-app.return-order-list.table-header.creation-date": "Data creării", - "store/return-app.return-order-list.table-header.items-to-return": "Articole disponibile pentru retur", - "store/return-app.return-order-list.table-header.select-order": "Alegeți comanda", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "Nu există comenzi disponibile pentru retur", - "store/return-app.return-order-list.table-pagination.text-of": "of", + "return-app.return-order-list.table-header.order-id": "ID Comandă", + "return-app.return-order-list.table-header.creation-date": "Data creării", + "return-app.return-order-list.table-header.items-to-return": "Articole disponibile pentru retur", + "return-app.return-order-list.table-header.select-order": "Alegeți comanda", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "Nu există comenzi disponibile pentru retur", + "return-app.return-order-list.table-pagination.text-of": "of", + "return-app.return-order-list.table-header.linkLabel": "Înapoi la returnări", + "return-app.return-order-list.page-header.title": "Listă comenzi", + "return-app.return-order-list.table-header.seller-name": "Nume vânzător", + "return-app.return-order-list.page-header.subTitle": "Toate comenzile de returnare. Faceți clic pe un ID comandă pentru a crea o returnare.", "store/return-app.return-order-details.page-header.link": "Înapoi la comenzi", "store/return-app.return-order-details.page-header.title": "Formular de cerere de retur", "store/return-app.return-order-details.page-header.subtitle": "Selectați produsul (produsele) pentru care doriți să faceți retur", @@ -288,7 +292,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "ACCESEAZĂ", "store/return-app.return-request-list.page-header.title": "Retururile mele", "store/return-app.return-request-list.page-header.goBack": "Înapoi", - "store/return-app.return-request-list.page-header.cta": "Cerere nouă", + "return-app.return-request-list.page-header.cta": "Cerere nouă", "return-app.return-request-list.table.status.new": "Nouă", "return-app.return-request-list.table.status.processing": "Se procesează", "return-app.return-request-list.table.status.pickedup-from-client": "Ridicat de la client", @@ -329,5 +333,89 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "

    Atenție: Statusul acestei cereri va fi setat ca ANULATĂ.

    Astfel, utilizatorul va fi notificat prin e-mail și va putea crea o nouă cerere de retur cu articolele cererii anulate.

    Dacă nu asta ai intenționat, setează cererea ca REFUZATĂ.

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    Ne pare rău, această cerere nu se poate anula din cauza statusului actual.

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    Anularea acestei cereri va permite ca articolele actuale să fie folosite într-o nouă cerere de retur.

    Această acțiune e ireversibilă.

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Ne pare rău, trebuie să contactezi echipa de asistență pentru a anula această cerere din cauza statusului actual.

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    Ne pare rău, trebuie să contactezi echipa de asistență pentru a anula această cerere din cauza statusului actual.

    ", + + "return-app.return-order-details.page-header.link": "Înapoi la comenzi", + "return-app.return-order-details.page-header.title": "Formular de cerere de retur", + "return-app.return-order-details.page-header.subtitle": "Selectați produsele pe care doriți să le rambursați", + "return-app.return-order-details.section-products": "Produse disponibile pentru returnare", + "return-app.return-order-details.section-details": "Informații de contact", + "return-app.return-order-details.section-payment": "Metoda de plată a rambursării", + "return-app.return-order-details.page-header.creation-date": "Data crearii", + "return-app.return-order-details.table-header.product": "Produs", + "return-app.return-order-details.table-header.quantity": "Cantitate", + "return-app.return-order-details.table-header.available-to-return": "Disponibil pentru returnare", + "return-app.return-order-details.table-header.quantity-to-return": "Cantitate de returnat", + "return-app.return-order-details.table-header.reason": "Motiv", + "return-app.return-order-details.table-header.condition": "Condiție", + "return-app.return-order-details.dropdown-reasons.accidental-order": "Ordine accidentala", + "return-app.return-order-details.dropdown-reasons.better-price": "Pret mai bun", + "return-app.return-order-details.dropdown-reasons.performance": "Performanţă", + "return-app.return-order-details.dropdown-reasons.incompatible": "Incompatibil", + "return-app.return-order-details.dropdown-reasons.item-damaged": "Articol deteriorat", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "Livrare ratată", + "return-app.return-order-details.dropdown-reasons.missing-parts": "Părți lipsă", + "return-app.return-order-details.dropdown-reasons.box-damaged": "Cutie deteriorată", + "return-app.return-order-details.dropdown-reasons.different-product": "Produs diferit", + "return-app.return-order-details.dropdown-reasons.defective": "Defect", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "A sosit ca Extra", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "Nu mai e nevoie", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "Achiziție neautorizată", + "return-app.return-order-details.dropdown-reasons.different-from-website": "Diferit de site-ul web", + "return-app.return-order-details.dropdown-reasons.other-reason": "Alt motiv", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "Selectați motivul", + "return-app.return-order-details.title.contact-details": "Detalii de contact", + "return-app.return-order-details.inputs.name-input": "Nume", + "return-app.return-order-details.inputs.email-input": "E-mail", + "return-app.return-order-details.inputs.phone-input": "Telefon", + "return-app.return-order-details.title.pickup-address": "Adresă de livrare", + "return-app.return-order-details.title.tooltip.pickup-address": "Selectați adresa de livrare pe care o doriți pentru livrare sau ridicare", + "return-app.return-order-details.title.extra-comment": "Comentariu adițional", + "return-app.return-order-details.payment-options.card": "Card", + "return-app.return-order-details.payment-options.bank": "bancă", + "return-app.return-order-details.payment-options.gift-card": "Card cadou", + "return-app.return-order-details.payment-method.description": "Selectați metoda de plată pentru care va fi emisă rambursarea", + "return-app.return-order-details.payment-method.default": "Rambursarea va fi emisă prin metoda de plată utilizată pentru această comandă", + "return-app.return-order-details.payment-method.account-holder": "Numele deținătorului contului", + "return-app.return-order-details.payment-method.iban": "MERGEAU", + "return-app.return-order-details.terms-and-conditions.form-agree": "Am citit și accept {link}", + "return-app.return-order-details.terms-and-conditions.link": "Termeni și condiții", + "return-app.return-order-details.button.next": "Următorul", + "return-app.return-order-details.page-header.order-id": "Comanda ID", + "return-app.return-item-details.excluded-items.warning": "Magazinul nu permite returnarea acestui produs", + "return-app.return-item-details.dropdown-reason.error": "Se cere un motiv", + "return-app.return-item-details.dropdown-condition.error": "Este necesară condiția", + "return-app.return-payment-methods.input-payment-method.error": "Metoda de plată este necesară", + "return-app.return-payment-methods.input-iban.error": "IBAN este necesar", + "return-app.return-payment-methods.input-iban-invalid.error": "IBAN-ul nu este valid", + "return-app.return-payment-methods.input-account-holder.error": "Este necesar titularul de cont", + "return-app.return-terms-and-conditions.checkbox.error": "Vă rugăm să acceptați termenii și condițiile.", + "return-app.return-items-list.no-items-selected.error": "Niciun element selectat", + "return-app.return-address-details.address-input.error": "Adresa este obligatorie", + "return-app.return-address-details.city-input.error": "Orașul este necesar", + "return-app.return-address-details.state-input.error": "Se cere statul", + "return-app.return-address-details.zip-input.error": "Codul poștal este obligatoriu", + "return-app.return-address-details.country-input.error": "Țara este obligatorie", + "return-app.return-contact-details.name-input.error": "Numele este obligatoriu", + "return-app.return-contact-details.phone-input.error": "Este necesar telefonul", + "return-app.confirm-and-submit.page-header.title": "Confirmați detaliile de retur", + "return-app.confirm-and-submit.refund-method.title": "Metoda de plată a rambursării", + "return-app.confirm-and-submit.alert.label": "Vizualizați lista de returnări", + "return-app.confirm-and-submit.alert.error.label": "Reîncercați", + "return-app.confirm-and-submit.alert.success": "Solicitarea de returnare a fost creată cu succes.", + "return-app.confirm-and-submit.alert.error": "Ceva n-a mers bine. Vă rugăm să încercați din nou.", + "return-app.confirm-and-submit.button.back": "Înapoi", + "return-app.confirm-and-submit.button.submit": "Trimite", + "return-app.confirm-and-submit.pickup-address.title": "Adresă de livrare", + "return-app.confirm-and-submit.contact-details.title": "Detalii de contact", + "return-app.confirm-and-submit.user-comment.title": "cometariu", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "Nume Destinatar:", + "return-app.confirm-payment-methods.refund-method.p-iban": "Transfer bancar in cont:", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "La fel ca și achiziția", + "return-app.return-information-table.table-row.p-condition": "Condiție:", + "return-app.return-information-table.table-row.p-reason": "Motiv:", + "return-app.return-order-details.pickup-address.drop-off-points": "Selectați un punct de predare", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "Vă puteți returna articolele într-unul dintre punctele noastre de predare selectate", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "Selectați un punct de predare", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "A apărut o eroare la încărcarea punctelor de predare" } diff --git a/messages/th.json b/messages/th.json index c9bc8e39d..53828d1cf 100644 --- a/messages/th.json +++ b/messages/th.json @@ -53,12 +53,16 @@ "store/return-app.link": "การคืนของฉัน", "store/return-app.request-return.page.header": "ขอเพิ่มการคืน", "store/return-app.request-return.page.header.subtitle": "เลือกคำสั่งเพื่อเริ่มขั้นตอนคำขอส่งคืน", - "store/return-app.return-order-list.table-header.order-id": "รหัสคำสั่งซื้อ", - "store/return-app.return-order-list.table-header.creation-date": "วันที่สร้าง", - "store/return-app.return-order-list.table-header.items-to-return": "สินค้าที่มีให้ส่งคืน", - "store/return-app.return-order-list.table-header.select-order": "เลือกคำสั่งซื้อ", - "store/return-app.return-order-list.table-empty-state-label.no-orders-available": "ไม่มีคำสั่งซื้อให้ส่งคืน", - "store/return-app.return-order-list.table-pagination.text-of": "of", + "return-app.return-order-list.table-header.order-id": "รหัสคำสั่งซื้อ", + "return-app.return-order-list.table-header.creation-date": "วันที่สร้าง", + "return-app.return-order-list.table-header.items-to-return": "สินค้าที่มีให้ส่งคืน", + "return-app.return-order-list.table-header.select-order": "เลือกคำสั่งซื้อ", + "return-app.return-order-list.table-empty-state-label.no-orders-available": "ไม่มีคำสั่งซื้อให้ส่งคืน", + "return-app.return-order-list.table-pagination.text-of": "of", + "return-app.return-order-list.table-header.linkLabel": "กลับไปยังการคืนสินค้า", + "return-app.return-order-list.page-header.title": "รายการสั่งซื้อ", + "return-app.return-order-list.table-header.seller-name": "ชื่อผู้ขาย", + "return-app.return-order-list.page-header.subTitle": "การสั่งซื้อทั้งหมดที่คืนสินค้า คลิกที่รหัสการสั่งซื้อเพื่อสร้างการคืนสินค้า", "store/return-app.return-order-details.page-header.link": "กลับไปยังคำสั่งซื้อ", "store/return-app.return-order-details.page-header.title": "แบบฟอร์มการขอส่งคืน", "store/return-app.return-order-details.page-header.subtitle": "เลือกผลิตภัณฑ์ที่คุณต้องการเงินคืน", @@ -288,7 +292,7 @@ "return-app.return-request-list.table-jumpToPage.cta": "ไป", "store/return-app.return-request-list.page-header.title": "การคืนของฉัน", "store/return-app.return-request-list.page-header.goBack": "กลับไป", - "store/return-app.return-request-list.page-header.cta": "คำขอใหม่", + "return-app.return-request-list.page-header.cta": "คำขอใหม่", "return-app.return-request-list.table.status.new": "ใหม่", "return-app.return-request-list.table.status.processing": "กำลังประมวลผล", "return-app.return-request-list.table.status.pickedup-from-client": "รับของจากลูกค้าแล้ว", @@ -329,5 +333,89 @@ "return-app.return-request-details.cancellation.modal.adminAllow": "

    ข้อควรทราบ: สถานะคำขอจะถูกตั้งค่าเป็น ยกเลิกแล้ว

    โดยจะอีเมลแจ้งให้ผู้ใช้ทราบและอนุญาตให้สร้างคำขอการคืนครั้งใหม่สำหรับสินค้าในคำขอที่ยกเลิกแล้ว

    หากไม่ต้องการทำเช่นนี้ ให้ตั้งค่าคำขอเป็น ปฏิเสธแล้ว

    ", "return-app.return-request-details.cancellation.modal.adminRefuse": "

    ขออภัย ไม่สามารถยกเลิกคำขอนี้ สืบเนื่องจากสถานะปัจจุบัน

    ", "return-app.return-request-details.cancellation.modal.storeAllow": "

    การยกเลิกคำขอนี้จะทำให้สามารถใช้สินค้าปัจจุบันในคำขอสำหรับการคืนครั้งใหม่ได้

    รายการนี้จะไม่สามารถเลิกทำได้

    ", - "return-app.return-request-details.cancellation.modal.storeRefuse": "

    ขออภัย คุณต้องติดต่อทีมสนับสนุนเพื่อยกเลิกคำขอนี้ สืบเนื่องจากสถานะปัจจุบัน

    " + "return-app.return-request-details.cancellation.modal.storeRefuse": "

    ขออภัย คุณต้องติดต่อทีมสนับสนุนเพื่อยกเลิกคำขอนี้ สืบเนื่องจากสถานะปัจจุบัน

    ", + + "return-app.return-order-details.page-header.link": "กลับไปที่คำสั่ง", + "return-app.return-order-details.page-header.title": "แบบฟอร์มขอคืนสินค้า", + "return-app.return-order-details.page-header.subtitle": "เลือกสินค้าที่คุณต้องการคืนเงิน", + "return-app.return-order-details.section-products": "สินค้าพร้อมคืน", + "return-app.return-order-details.section-details": "ข้อมูลติดต่อ", + "return-app.return-order-details.section-payment": "วิธีการชำระเงินคืน", + "return-app.return-order-details.page-header.creation-date": "วันที่สร้าง", + "return-app.return-order-details.table-header.product": "ผลิตภัณฑ์", + "return-app.return-order-details.table-header.quantity": "ปริมาณ", + "return-app.return-order-details.table-header.available-to-return": "สามารถส่งคืนได้", + "return-app.return-order-details.table-header.quantity-to-return": "ปริมาณที่จะส่งคืน", + "return-app.return-order-details.table-header.reason": "เหตุผล", + "return-app.return-order-details.table-header.condition": "เงื่อนไข", + "return-app.return-order-details.dropdown-reasons.accidental-order": "การสั่งซื้อโดยไม่ได้ตั้งใจ", + "return-app.return-order-details.dropdown-reasons.better-price": "ราคาดีกว่า", + "return-app.return-order-details.dropdown-reasons.performance": "ผลงาน", + "return-app.return-order-details.dropdown-reasons.incompatible": "เข้ากันไม่ได้", + "return-app.return-order-details.dropdown-reasons.item-damaged": "รายการที่เสียหาย", + "return-app.return-order-details.dropdown-reasons.missed-delivery": "ขาดการจัดส่ง", + "return-app.return-order-details.dropdown-reasons.missing-parts": "ส่วนที่หายไป", + "return-app.return-order-details.dropdown-reasons.box-damaged": "กล่องเสียหาย", + "return-app.return-order-details.dropdown-reasons.different-product": "ผลิตภัณฑ์ที่แตกต่างกัน", + "return-app.return-order-details.dropdown-reasons.defective": "มีข้อบกพร่อง", + "return-app.return-order-details.dropdown-reasons.arrived-in-addition": "มาถึงเป็น Extra", + "return-app.return-order-details.dropdown-reasons.no-longer-needed": "ไม่ต้องการอีกต่อไป", + "return-app.return-order-details.dropdown-reasons.unauthorized-purchase": "การซื้อที่ไม่ได้รับอนุญาต", + "return-app.return-order-details.dropdown-reasons.different-from-website": "แตกต่างจากเว็บไซต์", + "return-app.return-order-details.dropdown-reasons.other-reason": "เหตุผลอื่น", + "return-app.return-order-details.dropdown-reasons.placeholder.select-reason": "เลือกเหตุผล", + "return-app.return-order-details.title.contact-details": "รายละเอียดการติดต่อ", + "return-app.return-order-details.inputs.name-input": "ชื่อ", + "return-app.return-order-details.inputs.email-input": "อีเมล", + "return-app.return-order-details.inputs.phone-input": "โทรศัพท์", + "return-app.return-order-details.title.pickup-address": "ที่อยู่สำหรับการจัดส่ง", + "return-app.return-order-details.title.tooltip.pickup-address": "เลือกที่อยู่สำหรับจัดส่งที่คุณต้องการสำหรับการจัดส่งหรือรับสินค้า", + "return-app.return-order-details.title.extra-comment": "ความคิดเห็นเพิ่มเติม", + "return-app.return-order-details.payment-options.card": "การ์ด", + "return-app.return-order-details.payment-options.bank": "ธนาคาร", + "return-app.return-order-details.payment-options.gift-card": "บัตรของขวัญ", + "return-app.return-order-details.payment-method.description": "เลือกวิธีการชำระเงินที่จะคืนเงิน", + "return-app.return-order-details.payment-method.default": "การคืนเงินจะออกไปยังวิธีการชำระเงินที่ใช้สำหรับคำสั่งซื้อนี้", + "return-app.return-order-details.payment-method.account-holder": "ชื่อเจ้าของบัญชี", + "return-app.return-order-details.payment-method.iban": "กำลังไป", + "return-app.return-order-details.terms-and-conditions.form-agree": "ฉันได้อ่านและยอมรับ {link}", + "return-app.return-order-details.terms-and-conditions.link": "ข้อกำหนดและเงื่อนไข", + "return-app.return-order-details.button.next": "ต่อไป", + "return-app.return-order-details.page-header.order-id": "รหัสคำสั่งซื้อ", + "return-app.return-item-details.excluded-items.warning": "ร้านค้าไม่อนุญาตให้ส่งคืนสินค้านี้", + "return-app.return-item-details.dropdown-reason.error": "ต้องระบุเหตุผล", + "return-app.return-item-details.dropdown-condition.error": "จำเป็นต้องมีเงื่อนไข", + "return-app.return-payment-methods.input-payment-method.error": "ต้องระบุวิธีการชำระเงิน", + "return-app.return-payment-methods.input-iban.error": "จำเป็นต้องมี IBAN", + "return-app.return-payment-methods.input-iban-invalid.error": "IBAN ไม่ถูกต้อง", + "return-app.return-payment-methods.input-account-holder.error": "จำเป็นต้องมีเจ้าของบัญชี", + "return-app.return-terms-and-conditions.checkbox.error": "โปรดยอมรับข้อกำหนดและเงื่อนไข", + "return-app.return-items-list.no-items-selected.error": "ไม่มีรายการที่เลือก", + "return-app.return-address-details.address-input.error": "ต้องระบุที่อยู่", + "return-app.return-address-details.city-input.error": "ต้องระบุเมือง", + "return-app.return-address-details.state-input.error": "จำเป็นต้องมีรัฐ", + "return-app.return-address-details.zip-input.error": "ต้องระบุรหัสไปรษณีย์", + "return-app.return-address-details.country-input.error": "ต้องระบุประเทศ", + "return-app.return-contact-details.name-input.error": "ต้องระบุชื่อ", + "return-app.return-contact-details.phone-input.error": "จำเป็นต้องใช้โทรศัพท์", + "return-app.confirm-and-submit.page-header.title": "ยืนยันรายละเอียดการคืนสินค้า", + "return-app.confirm-and-submit.refund-method.title": "วิธีการชำระเงินคืน", + "return-app.confirm-and-submit.alert.label": "ดูรายการส่งคืนของคุณ", + "return-app.confirm-and-submit.alert.error.label": "ลองอีกครั้ง", + "return-app.confirm-and-submit.alert.success": "สร้างคำขอส่งคืนสำเร็จแล้ว", + "return-app.confirm-and-submit.alert.error": "บางอย่างผิดพลาด. กรุณาลองอีกครั้ง.", + "return-app.confirm-and-submit.button.back": "กลับ", + "return-app.confirm-and-submit.button.submit": "ส่ง", + "return-app.confirm-and-submit.pickup-address.title": "ที่อยู่สำหรับการจัดส่ง", + "return-app.confirm-and-submit.contact-details.title": "รายละเอียดการติดต่อ", + "return-app.confirm-and-submit.user-comment.title": "ความคิดเห็น", + "return-app.confirm-payment-methods.refund-method.p-account-holder-name": "ชื่อผู้รับ:", + "return-app.confirm-payment-methods.refund-method.p-iban": "โอนเงินเข้าบัญชี:", + "return-app.confirm-payment-methods.refund-method.p-same-as-purchase": "เช่นเดียวกับการซื้อ", + "return-app.return-information-table.table-row.p-condition": "เงื่อนไข:", + "return-app.return-information-table.table-row.p-reason": "เหตุผล:", + "return-app.return-order-details.pickup-address.drop-off-points": "เลือกจุดส่ง", + "return-app.return-order-details.pickup-address.drop-off-points.tooltip": "คุณสามารถคืนสินค้าได้ที่จุดส่งของที่เราเลือกไว้", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.placehoder": "เลือกจุดส่ง", + "return-app.return-order-details.pickup-address.drop-off-points.dropdown.error": "เกิดข้อผิดพลาดในการโหลดจุดส่ง" } diff --git a/node/clients/index.ts b/node/clients/index.ts index e3989478f..b05479f6d 100644 --- a/node/clients/index.ts +++ b/node/clients/index.ts @@ -1,6 +1,10 @@ import { IOClients, Sphinx } from '@vtex/api' import { vbaseFor, masterDataFor } from '@vtex/clients' -import { ReturnAppSettings, ReturnRequest, SellerSetting } from 'vtex.return-app' +import { + ReturnAppSettings, + ReturnRequest, + SellerSetting, +} from 'vtex.return-app' import { Catalog } from './catalog' import { OMSCustom as OMS } from './oms' diff --git a/node/clients/oms.ts b/node/clients/oms.ts index 701d619a7..9f727a747 100644 --- a/node/clients/oms.ts +++ b/node/clients/oms.ts @@ -26,6 +26,7 @@ type InputInvoiceFields = Omit< > interface OrderListParams { + q: string clientEmail: string orderBy: 'creationDate,desc' f_status: 'invoiced' @@ -41,14 +42,19 @@ export class OMSCustom extends OMS { }) } - public listOrdersWithParams(params?: OrderListParams) { - return this.http.get(routes.orders, { + public listOrdersWithParams({ q, ...params }: OrderListParams) { + const requets = this.http.get(routes.orders, { headers: { VtexIdClientAutCookie: this.context.authToken, }, metric: 'oms-list-order-with-params', - ...(params ? { params } : {}), + params: { + q, + ...params, + }, }) + + return requets } public createInvoice(orderId: string, invoice: InputInvoiceFields) { diff --git a/node/clients/vtexId.ts b/node/clients/vtexId.ts index 841590d18..4cfc6de55 100644 --- a/node/clients/vtexId.ts +++ b/node/clients/vtexId.ts @@ -1,5 +1,5 @@ -import { IOContext, InstanceOptions, AuthenticationError } from '@vtex/api' -import { JanusClient } from '@vtex/api' +import type { IOContext, InstanceOptions } from '@vtex/api' +import { AuthenticationError, JanusClient } from '@vtex/api' interface VtexIdLoginResponse { authStatus: string @@ -62,10 +62,10 @@ export class VtexId extends JanusClient { VtexIdClientAutCookie: token || '', }, }) + return response } catch (error) { throw new AuthenticationError('Request failed with status code 401') - } } } diff --git a/node/index.ts b/node/index.ts index ebc0225ab..03e654bab 100644 --- a/node/index.ts +++ b/node/index.ts @@ -10,7 +10,7 @@ import { Clients } from './clients' import { errorHandler } from './middlewares/errorHandler' import { mutations, queries, resolvers } from './resolvers' import { schemaDirectives } from './directives' -import {middlewares} from './middlewares' +import { middlewares } from './middlewares' const { auth, @@ -22,7 +22,7 @@ const { returnAppSetting, saveSellerSetting, returnSellerSetting, - sellerValidation + sellerValidation, } = middlewares const TIMEOUT_MS = 5000 @@ -72,7 +72,7 @@ export default new Service({ }), sellerSettings: method({ GET: [errorHandler, auth, sellerValidation, returnSellerSetting], - }) + }), }, graphql: { resolvers: { diff --git a/node/middlewares/appSettings.ts b/node/middlewares/appSettings.ts index a16f2750e..850f15322 100644 --- a/node/middlewares/appSettings.ts +++ b/node/middlewares/appSettings.ts @@ -1,4 +1,5 @@ import { json } from 'co-body' + import { saveAppSettingService } from '../services/AppSettingsService' import { SETTINGS_PATH } from '../utils/constants' @@ -20,4 +21,4 @@ export async function returnAppSetting(ctx: Context) { ctx.body = settings ctx.status = 201 -} \ No newline at end of file +} diff --git a/node/middlewares/createReturn.ts b/node/middlewares/createReturn.ts index e76413eea..3845fe7e3 100644 --- a/node/middlewares/createReturn.ts +++ b/node/middlewares/createReturn.ts @@ -3,7 +3,6 @@ import { UserInputError } from '@vtex/api' import { createReturnRequestService } from '../services/createReturnRequestService' export async function createReturn(ctx: Context) { - const { body }: any = ctx || {} const { locale } = body diff --git a/node/middlewares/getRequestList.ts b/node/middlewares/getRequestList.ts index f60603842..ee32a5796 100644 --- a/node/middlewares/getRequestList.ts +++ b/node/middlewares/getRequestList.ts @@ -15,7 +15,7 @@ export async function getRequestList(ctx: Context) { _orderId, _userEmail, _allFields, - _sellerName + _sellerName, } = query const [from, to] = (_dateSubmitted as string | undefined)?.split(',') ?? [] diff --git a/node/middlewares/index.ts b/node/middlewares/index.ts index 27f0ce510..cb2a28a58 100644 --- a/node/middlewares/index.ts +++ b/node/middlewares/index.ts @@ -5,7 +5,7 @@ import { errorHandler } from './errorHandler' import { getRequest } from './getRequest' import { getRequestList } from './getRequestList' import { updateRequestStatus } from './updateRequestStatus' -import { saveSellerSetting, returnSellerSetting } from './sellerSetting' +import { saveSellerSetting, returnSellerSetting } from './sellerSetting' import { sellerValidation } from './sellerValidation' export const middlewares = { @@ -19,6 +19,5 @@ export const middlewares = { updateRequestStatus, saveSellerSetting, returnSellerSetting, - sellerValidation + sellerValidation, } - diff --git a/node/middlewares/sellerSetting.ts b/node/middlewares/sellerSetting.ts index 24d75f541..dceae8488 100644 --- a/node/middlewares/sellerSetting.ts +++ b/node/middlewares/sellerSetting.ts @@ -1,16 +1,23 @@ import { UserInputError } from '@vtex/api' -import { saveSellerSettingService, returnSellerSettingService } from '../services/SellerSettingService' + +import { + saveSellerSettingService, + returnSellerSettingService, +} from '../services/SellerSettingService' import { SETTINGS_PATH } from '../utils/constants' export async function saveSellerSetting(ctx: Context) { const { body }: any = ctx || {} ctx.set('Cache-Control', 'no-cache') - + try { - const settings = await returnSellerSettingService(ctx, body?.settings?.sellerId) - - if(settings){ + const settings = await returnSellerSettingService( + ctx, + body?.settings?.sellerId + ) + + if (settings) { body.settings.id = settings.id } @@ -36,27 +43,27 @@ export async function returnSellerSetting(ctx: Context) { ctx.set('Cache-Control', 'no-cache') try { - if(sellerId){ + if (sellerId) { const settings = await returnSellerSettingService(ctx, sellerId) - - if(!settings){ + + if (!settings) { const settingsMkt: any = await appSettings.get(SETTINGS_PATH, true) - + const newSettings = { settings: { ...settingsMkt, sellerId, - parentAccount: ctx.vtex.account - } + parentAccount: ctx.vtex.account, + }, } - + const res = await saveSellerSettingService(ctx, newSettings) - + ctx.body = { ...newSettings?.settings, - id: res.DocumentId + id: res.DocumentId, } - + ctx.status = 200 } else { ctx.body = settings @@ -69,4 +76,4 @@ export async function returnSellerSetting(ctx: Context) { ctx.body = error?.response?.data || error.response.statusText || error ctx.status = error.response?.status || 400 } -} \ No newline at end of file +} diff --git a/node/middlewares/sellerValidation.ts b/node/middlewares/sellerValidation.ts index d4713860e..245bd78cc 100644 --- a/node/middlewares/sellerValidation.ts +++ b/node/middlewares/sellerValidation.ts @@ -1,7 +1,10 @@ import { json } from 'co-body' import { AuthenticationError } from '@vtex/api' -export async function sellerValidation(ctx: Context, next: () => Promise) { +export async function sellerValidation( + ctx: Context, + next: () => Promise +) { const { header, req, @@ -11,29 +14,31 @@ export async function sellerValidation(ctx: Context, next: () => Promise) }, clients: { vtexId }, } = ctx + const authCookie = header.vtexidclientautcookie as string | undefined const { _sellerName } = query const body = await json(req) - const {settings , sellerName} = body - let seller = "" + const { settings, sellerName } = body + let seller = '' const sellerNameSettintgs = settings?.sellerId - seller = sellerNameSettintgs || sellerName + + seller = sellerNameSettintgs || sellerName const { sellerId } = params as { sellerId: string } - if(authCookie && (_sellerName || seller || sellerId) ){ - const accountName = String ( _sellerName || seller || sellerId ) + if (authCookie && (_sellerName || seller || sellerId)) { + const accountName = String(_sellerName || seller || sellerId) const account = await vtexId.getAccount(authCookie, accountName) - if(account.accountName != accountName){ + + if (account.accountName !== accountName) { throw new AuthenticationError('Request failed with status code 401') } ctx.body = body - + await next() } else { throw new AuthenticationError('Request failed with status code 401') } - } diff --git a/node/middlewares/updateRequestStatus.ts b/node/middlewares/updateRequestStatus.ts index 707c5ef06..cfb63fb78 100644 --- a/node/middlewares/updateRequestStatus.ts +++ b/node/middlewares/updateRequestStatus.ts @@ -13,9 +13,13 @@ export async function updateRequestStatus(ctx: Context) { const { requestId } = params as { requestId: string } const body = await json(req) - - const updatedRequest = await updateRequestStatusFromSellerService(ctx, body, requestId) - + + const updatedRequest = await updateRequestStatusFromSellerService( + ctx, + body, + requestId + ) + ctx.set('Cache-Control', 'no-cache') ctx.body = updatedRequest ctx.status = 200 diff --git a/node/package.json b/node/package.json index ad8ec70a8..70c6806e4 100644 --- a/node/package.json +++ b/node/package.json @@ -15,17 +15,7 @@ "@vtex/test-tools": "^1.0.0", "@vtex/tsconfig": "^0.6.0", "tslint": "^6.1.3", - "tslint-config-vtex": "^2.1.0", - "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", - "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", - "vtex.easypost": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost", - "vtex.format-currency": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency", - "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", - "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", - "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app", - "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", - "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" + "tslint-config-vtex": "^2.1.0" }, "scripts": { "lint": "tsc --noEmit --pretty && tslint -c tslint.json --fix './**/*.ts'" diff --git a/node/resolvers/index.ts b/node/resolvers/index.ts index 70458a29a..c9e164396 100644 --- a/node/resolvers/index.ts +++ b/node/resolvers/index.ts @@ -31,7 +31,7 @@ export const queries = { returnRequest, returnRequestList, nearestPickupPoints, - returnSettingsList + returnSettingsList, } export const resolvers = { ReturnRequestResponse } diff --git a/node/resolvers/orderToReturnSummary.ts b/node/resolvers/orderToReturnSummary.ts index e0d92170d..156150539 100644 --- a/node/resolvers/orderToReturnSummary.ts +++ b/node/resolvers/orderToReturnSummary.ts @@ -13,6 +13,7 @@ export const orderToReturnSummary = async ( ctx: Context ): Promise => { const { orderId, storeUserEmail } = args + const { state: { userProfile, appkey }, clients: { @@ -58,7 +59,7 @@ export const orderToReturnSummary = async ( { userProfile, appkey, - inputEmail: storeUserEmail, + inputEmail: storeUserEmail || clientProfileData?.email, }, { logger, diff --git a/node/resolvers/ordersAvailableToReturn.ts b/node/resolvers/ordersAvailableToReturn.ts index 1d0b0729a..54df439af 100644 --- a/node/resolvers/ordersAvailableToReturn.ts +++ b/node/resolvers/ordersAvailableToReturn.ts @@ -19,21 +19,54 @@ const createParams = ({ maxDays, userEmail, page = 1, + filters, }: { maxDays: number userEmail: string page: number + filters?: { + orderId: string + sellerName: string + createdIn: { from: string; to: string } + } }) => { const currentDate = getCurrentDate() + let query = '' + let seller = '' + let creationDate = `creationDate:[${substractDays( + currentDate, + maxDays + )} TO ${currentDate}]` + + if (filters) { + const { orderId, sellerName, createdIn } = filters + + query = orderId || '' + seller = sellerName || '' + creationDate = createdIn + ? `creationDate:[${createdIn.from} TO ${createdIn.to}]` + : creationDate + } + + console.info({ + clientEmail: userEmail, + orderBy: 'creationDate,desc' as const, + f_status: 'invoiced' as const, + f_creationDate: creationDate, + q: query, + f_sellerNames: seller, + page, + per_page: 10 as const, + }) + return { clientEmail: userEmail, orderBy: 'creationDate,desc' as const, f_status: 'invoiced' as const, - f_creationDate: `creationDate:[${substractDays( - currentDate, - maxDays - )} TO ${currentDate}]`, + f_creationDate: creationDate, + q: query, + f_sellerNames: seller, page, per_page: 10 as const, } @@ -41,7 +74,16 @@ const createParams = ({ export const ordersAvailableToReturn = async ( _: unknown, - args: { page: number; storeUserEmail?: string }, + args: { + page: number + storeUserEmail?: string + isAdmin?: boolean + filters?: { + orderId: string + sellerName: string + createdIn: { from: string; to: string } + } + }, ctx: Context ): Promise => { const { @@ -54,7 +96,7 @@ export const ordersAvailableToReturn = async ( }, } = ctx - const { page, storeUserEmail } = args + const { page, storeUserEmail, isAdmin, filters } = args const settings = await appSettings.get(SETTINGS_PATH, true) @@ -65,15 +107,15 @@ export const ordersAvailableToReturn = async ( const { maxDays, excludedCategories } = settings const { email } = userProfile ?? {} - const userEmail = storeUserEmail ?? email + let userEmail = (storeUserEmail ?? email) as string - if (!userEmail) { - throw new ResolverError('Missing user email', 400) + if (isAdmin) { + userEmail = '' } // Fetch order associated to the user email const { list, paging } = await oms.listOrdersWithParams( - createParams({ maxDays, userEmail, page }) + createParams({ maxDays, userEmail, page, filters }) ) const orderListPromises = [] diff --git a/node/resolvers/returnSellerSettings.ts b/node/resolvers/returnSellerSettings.ts index 87560c308..505104a28 100644 --- a/node/resolvers/returnSellerSettings.ts +++ b/node/resolvers/returnSellerSettings.ts @@ -1,12 +1,10 @@ +import type { QueryReturnSellerSettingsArgs } from 'vtex.return-app' import { returnSellerSettingsService } from '../services/returnSellerSettingsService' -import type { - QueryReturnSellerSettingsArgs, -} from 'vtex.return-app' export const returnSellerSettings = async ( _: unknown, - { sellerId } : QueryReturnSellerSettingsArgs, + { sellerId }: QueryReturnSellerSettingsArgs, ctx: Context ) => { return returnSellerSettingsService(ctx, sellerId) diff --git a/node/resolvers/updateSellerSetting.ts b/node/resolvers/updateSellerSetting.ts index d41fbea89..c69a6077a 100644 --- a/node/resolvers/updateSellerSetting.ts +++ b/node/resolvers/updateSellerSetting.ts @@ -1,6 +1,4 @@ -import type { - MutationUpdateSellerSettingArgs, -} from 'vtex.return-app' +import type { MutationUpdateSellerSettingArgs } from 'vtex.return-app' import { validateMaxDaysCustomReasons, @@ -17,13 +15,10 @@ export const updateSellerSetting = async ( clients: { sellerSetting }, } = ctx - const {id, settings} = args || {} + const { id, settings } = args || {} // validate if all custom reasons have max days smaller than the general max days - validateMaxDaysCustomReasons( - settings.maxDays, - settings.customReturnReasons - ) + validateMaxDaysCustomReasons(settings.maxDays, settings.customReturnReasons) // validate if all custom reasons have unique locales for their translations valideteUniqueCustomReasonsPerLocale(settings.customReturnReasons) @@ -33,11 +28,12 @@ export const updateSellerSetting = async ( // validate that there is at least one payment method selected or user has to use the same as in the order paymentOptions: validatePaymentOptions(settings.paymentOptions), } - - if(id){ + + if (id) { await sellerSetting.update(id, currentSettings) + return true } return false -} \ No newline at end of file +} diff --git a/node/services/AppSettingsService.ts b/node/services/AppSettingsService.ts index a8360fa2d..b9ac2e2ed 100644 --- a/node/services/AppSettingsService.ts +++ b/node/services/AppSettingsService.ts @@ -10,21 +10,19 @@ import { valideteUniqueCustomReasonsPerLocale, } from '../utils/appSettingsValidation' -export async function saveAppSettingService(ctx: Context, args: MutationSaveReturnAppSettingsArgs): Promise { - const { clients: { appSettings } } = ctx +export async function saveAppSettingService( + ctx: Context, + args: MutationSaveReturnAppSettingsArgs +): Promise { + const { + clients: { appSettings }, + } = ctx const { settings } = args ?? {} - const { - maxDays, - customReturnReasons, - paymentOptions - } = settings ?? {} + const { maxDays, customReturnReasons, paymentOptions } = settings ?? {} // validate if all custom reasons have max days smaller than the general max days - validateMaxDaysCustomReasons( - maxDays, - customReturnReasons - ) + validateMaxDaysCustomReasons(maxDays, customReturnReasons) // validate if all custom reasons have unique locales for their translations valideteUniqueCustomReasonsPerLocale(customReturnReasons) @@ -40,8 +38,9 @@ export async function saveAppSettingService(ctx: Context, args: MutationSaveRetu return true } - -export async function returnAppSettingService(ctx: Context): Promise { +export async function returnAppSettingService( + ctx: Context +): Promise { const { clients: { appSettings }, } = ctx @@ -52,6 +51,3 @@ export async function returnAppSettingService(ctx: Context): Promise { - const { clients: { sellerSetting } } = ctx +export async function saveSellerSettingService( + ctx: Context, + args: MutationSaveSellerSettingArgs +): Promise { + const { + clients: { sellerSetting }, + } = ctx const { settings } = args ?? {} - const { - maxDays, - customReturnReasons, - paymentOptions, - } = settings ?? {} + const { maxDays, customReturnReasons, paymentOptions } = settings ?? {} // validate if all custom reasons have max days smaller than the general max days - validateMaxDaysCustomReasons( - maxDays, - customReturnReasons - ) + validateMaxDaysCustomReasons(maxDays, customReturnReasons) // validate if all custom reasons have unique locales for their translations valideteUniqueCustomReasonsPerLocale(customReturnReasons) @@ -33,17 +31,19 @@ export async function saveSellerSettingService(ctx: Context, args: MutationSaveS // validate that there is at least one payment method selected or user has to use the same as in the order paymentOptions: validatePaymentOptions(paymentOptions), } - + const response = await sellerSetting.saveOrUpdate({ ...currentSettings, - id: currentSettings.id || undefined + id: currentSettings.id || undefined, }) return response } - -export async function returnSellerSettingService(ctx: Context, sellerId: string): Promise { +export async function returnSellerSettingService( + ctx: Context, + sellerId: string +): Promise { const { clients: { sellerSetting }, } = ctx @@ -57,7 +57,7 @@ export async function returnSellerSettingService(ctx: Context, sellerId: string) 'paymentOptions', 'termsUrl', 'customReturnReasons', - 'options' + 'options', ] const settings = await sellerSetting.search( @@ -66,9 +66,6 @@ export async function returnSellerSettingService(ctx: Context, sellerId: string) undefined, `sellerId=${sellerId}` ) - + return settings?.[0] || null } - - - diff --git a/node/services/returnRequestListService.ts b/node/services/returnRequestListService.ts index 56e1d17f2..f2b576dff 100644 --- a/node/services/returnRequestListService.ts +++ b/node/services/returnRequestListService.ts @@ -41,7 +41,7 @@ const buildWhereClause = (filter: Maybe | undefined) => { if (key === 'sellerName') { where += `sellerName = "${value}"` - + return where } @@ -117,9 +117,9 @@ export const returnRequestListService = async ( 'createdIn', 'status', 'dateSubmitted', - 'sellerName' + 'sellerName', ] - + const rmaSearchResult = await returnRequestClient.searchRaw( { page, diff --git a/node/services/returnSellerSettingsService.ts b/node/services/returnSellerSettingsService.ts index bfa365948..7137d5de0 100644 --- a/node/services/returnSellerSettingsService.ts +++ b/node/services/returnSellerSettingsService.ts @@ -1,9 +1,13 @@ import type { SellerSetting } from 'vtex.return-app' -export async function returnSellerSettingsService(ctx: Context, sellerId: string): Promise { +export async function returnSellerSettingsService( + ctx: Context, + sellerId: string +): Promise { const { clients: { sellerSetting }, } = ctx + const fields = [ 'id', 'sellerId', @@ -13,14 +17,16 @@ export async function returnSellerSettingsService(ctx: Context, sellerId: string 'paymentOptions', 'termsUrl', 'customReturnReasons', - 'options' + 'options', ] + const settings = await sellerSetting.search( { page: 1, pageSize: 1 }, fields, undefined, `sellerId=${sellerId}` ) + // if(settings?.[0]){ // const response: ReturnAppSettings = { // maxDays: settings?.[0]?.maxDays, @@ -36,6 +42,3 @@ export async function returnSellerSettingsService(ctx: Context, sellerId: string // } return settings?.[0] || null } - - - diff --git a/node/services/returnSettingsListService.ts b/node/services/returnSettingsListService.ts index 7f61ffc97..2d65d2ecb 100644 --- a/node/services/returnSettingsListService.ts +++ b/node/services/returnSettingsListService.ts @@ -14,7 +14,7 @@ const filterDate = (date: string): string => { return `${year}-${month < 10 ? `0${month}` : `${month}`}-${ day < 10 ? `0${day}` : `${day}` }` -}*/ +} */ const buildWhereClause = (filter: Maybe | undefined) => { if (!filter) return @@ -29,7 +29,7 @@ const buildWhereClause = (filter: Maybe | undefined) => { if (key === 'sellerName') { where += `sellerId = "${value}"` - + return where } @@ -97,8 +97,9 @@ export const returnSettingsListService = async ( 'paymentOptions', 'customReturnReasons', 'excludedCategories', - 'createdIn' + 'createdIn', ] + const rmaSearchResult = await sellerSettingClient.searchRaw( { page, @@ -108,6 +109,7 @@ export const returnSettingsListService = async ( 'createdIn DESC', buildWhereClause(adjustedFilter) ) + const { data, pagination } = rmaSearchResult const { page: currentPage, pageSize, total } = pagination diff --git a/node/services/updateRequestStatusFromSellerService.ts b/node/services/updateRequestStatusFromSellerService.ts index abd2e2322..da5c10cee 100644 --- a/node/services/updateRequestStatusFromSellerService.ts +++ b/node/services/updateRequestStatusFromSellerService.ts @@ -1,21 +1,17 @@ -import type { ReturnRequest } from 'vtex.return-app' +import type { ReturnRequest } from 'vtex.return-app' import { ResolverError } from '@vtex/api' import { OMS_RETURN_REQUEST_STATUS_UPDATE } from '../utils/constants' import { OMS_RETURN_REQUEST_STATUS_UPDATE_TEMPLATE } from '../utils/templates' import type { StatusUpdateMailData } from '../typings/mailClient' - export const updateRequestStatusFromSellerService = async ( ctx: Context, args: ReturnRequest, - requestId: string, + requestId: string ): Promise => { const { - clients: { - returnRequest: returnRequestClient, - mail, - }, + clients: { returnRequest: returnRequestClient, mail }, vtex: { logger }, } = ctx @@ -23,9 +19,9 @@ export const updateRequestStatusFromSellerService = async ( const updatedRequest = { ...args, - sellerName: sellerName || undefined + sellerName: sellerName || undefined, } - + try { await returnRequestClient.update(requestId, updatedRequest) } catch (error) { diff --git a/node/services/updateRequestStatusService.ts b/node/services/updateRequestStatusService.ts index 0ba6a98a1..e01cf79d7 100644 --- a/node/services/updateRequestStatusService.ts +++ b/node/services/updateRequestStatusService.ts @@ -100,7 +100,7 @@ export const updateRequestStatusService = async ( }, vtex: { logger }, } = ctx - + const { status, requestId, comment, refundData, sellerName } = args const { role, firstName, lastName, email, userId } = userProfile ?? {} diff --git a/node/utils/createOrdersToReturnSummary.ts b/node/utils/createOrdersToReturnSummary.ts index ba6105845..40fd54f18 100644 --- a/node/utils/createOrdersToReturnSummary.ts +++ b/node/utils/createOrdersToReturnSummary.ts @@ -112,13 +112,14 @@ export const createOrdersToReturnSummary = async ( // Associate itemIndex with the correspondent item in the order.item for (const [index, quantity] of quantityInvoiced.entries()) { + const newIndex = index === -1 ? 0 : index const { id, productId, name, imageUrl, additionalInfo: { categoriesIds }, - } = items[index] + } = items[newIndex] // Here we can add the fields we want to have in the final item array. TBD the needed ones const currentLength = invoicedItems.push({ @@ -160,9 +161,12 @@ export const createOrdersToReturnSummary = async ( } } + const sellerName = order.sellers[0].name + return { orderId, creationDate, + sellerName, invoicedItems: await handleTranlateItems(invoicedItems, catalogGQL), processedItems, excludedItems, diff --git a/node/utils/createRefundData.ts b/node/utils/createRefundData.ts index f364558ea..d1f3eaa56 100644 --- a/node/utils/createRefundData.ts +++ b/node/utils/createRefundData.ts @@ -76,6 +76,7 @@ export const createRefundData = ({ // invoiceNumber has to match the requestId. // This values is used to filter the invoices created via Return app when calculating the items available to be returned. invoiceNumber: requestId, + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands invoiceValue: refundedItemsValue + refundedShippingValue, refundedItemsValue, refundedShippingValue, diff --git a/node/utils/createRefundableTotals.ts b/node/utils/createRefundableTotals.ts index 9e1b0070c..2b34e705b 100644 --- a/node/utils/createRefundableTotals.ts +++ b/node/utils/createRefundableTotals.ts @@ -14,20 +14,26 @@ export const createRefundableTotals = ( totals.find(({ id }) => id === 'Discounts')?.value ?? 0 const itemsAmount = - itemsToReturn?.reduce((total, item) => { - const { quantity, sellingPrice } = item + itemsToReturn?.reduce( + (total: number, item: { quantity: any; sellingPrice: any }) => { + const { quantity, sellingPrice } = item - return total + (quantity ?? 0) * (sellingPrice ?? 0) - }, 0) ?? 0 + return total + (quantity ?? 0) * (sellingPrice ?? 0) + }, + 0 + ) ?? 0 const itemsTotal = { id: 'items' as const, value: itemsAmount } const taxAmount = - itemsToReturn?.reduce((total, item) => { - const { quantity, tax } = item - - return total + (quantity ?? 0) * (tax ?? 0) - }, 0) ?? 0 + itemsToReturn?.reduce( + (total: number, item: { quantity: any; tax: any }) => { + const { quantity, tax } = item + + return total + (quantity ?? 0) * (tax ?? 0) + }, + 0 + ) ?? 0 const taxTotal = { id: 'tax' as const, value: taxAmount } diff --git a/node/utils/getCostumerEmail.ts b/node/utils/getCostumerEmail.ts index 1adc18d3a..632d4238b 100644 --- a/node/utils/getCostumerEmail.ts +++ b/node/utils/getCostumerEmail.ts @@ -30,7 +30,7 @@ export const getCustomerEmail = ( } ): string => { const requesterIsStoreUser = - clientProfileData.userProfileId === userProfile?.userId + clientProfileData.userProfileId === userProfile?.userId // when the requester is the owner of the order, we can use the email parsed from the session cookie if (userProfile && requesterIsStoreUser) return userProfile.email diff --git a/node/yarn.lock b/node/yarn.lock index c36dff5c8..247be596b 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -6127,46 +6127,6 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -"vtex.catalog-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql": - version "1.102.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql#ad1dfac8d076034d4326a00a3da20a3915951f53" - -"vtex.css-handles@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles": - version "0.4.4" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles#8c45c6decf9acd2b944e07261686decff93d6422" - -"vtex.easypost@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost": - version "0.1.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost#078a135b63bb4fc5e39e6ad789d0caf9ea368f35" - -"vtex.format-currency@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency": - version "0.4.1" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency#aaed82b498270f0bb6f37e93eff7e7f401e4d283" - -"vtex.my-account-commons@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons": - version "1.6.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons#3715228fb82e81e955e6a90d11e7975e72b37b2e" - -"vtex.my-account@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account": - version "1.25.0" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account#3bc46389c0aa28f4e3e2e008fe3690f5901b1f2a" - -"vtex.render-runtime@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime": - version "8.132.4" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime#66bb41bd4d342e37c9d85172aad5f7eefebfb6dc" - -"vtex.return-app@https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app": - version "3.5.6" - resolved "https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app#00cefaf09ee59b6a5237e60ee2386fb016edae99" - -"vtex.styleguide@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide": - version "9.146.3" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide#05558160f29cd8f4aefe419844a4bd66e2b3fdbb" - -"vtex.tenant-graphql@http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql": - version "0.1.2" - resolved "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql#74673fe86baefe74f21a6d2615993ea0ccb5e79e" - w3c-hr-time@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" diff --git a/react/AdminReturnAdd.tsx b/react/AdminReturnAdd.tsx new file mode 100644 index 000000000..582f65315 --- /dev/null +++ b/react/AdminReturnAdd.tsx @@ -0,0 +1,4 @@ +import { AdminReturnAdd } from './admin/AdminReturnAdd' +import './styles.global.css' + +export default AdminReturnAdd diff --git a/react/AdminReturnOrderList.tsx b/react/AdminReturnOrderList.tsx new file mode 100644 index 000000000..6ec24c488 --- /dev/null +++ b/react/AdminReturnOrderList.tsx @@ -0,0 +1,4 @@ +import { AdminOrderList } from './admin/AdminReturnOrderList' +import './styles.global.css' + +export default AdminOrderList diff --git a/react/admin/AdminLoader.tsx b/react/admin/AdminLoader.tsx index bf388b6c9..d9d0be1ef 100644 --- a/react/admin/AdminLoader.tsx +++ b/react/admin/AdminLoader.tsx @@ -29,7 +29,11 @@ export const AdminLoader: FC = ({ } if (loading || !data) { - return + return ( + + + + ) } return <>{children} diff --git a/react/admin/AdminReturnAdd.tsx b/react/admin/AdminReturnAdd.tsx new file mode 100644 index 000000000..1688969f2 --- /dev/null +++ b/react/admin/AdminReturnAdd.tsx @@ -0,0 +1,24 @@ +import React from 'react' +import type { RouteComponentProps } from 'react-router' + +import { AlertProvider } from './provider/AlertProvider' +// import { ReturnAddContainer } from './ReturnAdd/ReturnAddContainer' +import { StoreSettingsPovider } from '../store/provider/StoreSettingsProvider' +import { OrderToReturnProvider } from '../store/provider/OrderToReturnProvider' +import { CreateReturnRequest } from '../store/createReturnRequest/CreateReturnRequest' + +type RouteProps = RouteComponentProps<{ orderId: string }> + +export const AdminReturnAdd = (props: RouteProps) => { + return ( + + {/* */} + + + + + + {/* */} + + ) +} diff --git a/react/admin/AdminReturnOrderList.tsx b/react/admin/AdminReturnOrderList.tsx new file mode 100644 index 000000000..b2cf610e5 --- /dev/null +++ b/react/admin/AdminReturnOrderList.tsx @@ -0,0 +1,28 @@ +import React from 'react' + +import { AlertProvider } from './provider/AlertProvider' +import { OrderListContainer } from './OrderList/OrderListContainer' + +// import { ReturnDetailsContainer } from './ReturnDetails/ReturnDetailsContainer' +// import { ReturnDetailsProvider } from '../common/provider/ReturnDetailsProvider' +// import { UpdateRequestStatusProvider } from './provider/UpdateRequestStatusProvider' + +// interface CustomRouteProps { +// params: { +// id: string +// } +// } + +export const AdminOrderList = () => { + // export const AdminReturnAdd = ({ params }: CustomRouteProps) => { + return ( + + + {/* + + + + */} + + ) +} diff --git a/react/admin/AdminSettingDetail.tsx b/react/admin/AdminSettingDetail.tsx index bb1baf9e4..d3a8a8354 100644 --- a/react/admin/AdminSettingDetail.tsx +++ b/react/admin/AdminSettingDetail.tsx @@ -13,9 +13,9 @@ interface CustomRouteProps { export const AdminSettingDetail = ({ params }: CustomRouteProps) => { return ( - - - - + + + + ) } diff --git a/react/admin/OrderList/OrderListContainer.tsx b/react/admin/OrderList/OrderListContainer.tsx new file mode 100644 index 000000000..7bd1e98cf --- /dev/null +++ b/react/admin/OrderList/OrderListContainer.tsx @@ -0,0 +1,123 @@ +import React, { useState, useEffect } from 'react' +import { useQuery } from 'react-apollo' +import type { + OrdersToReturnList, + QueryOrdersAvailableToReturnArgs, +} from 'vtex.return-app' +import { FormattedMessage } from 'react-intl' +import { Layout, PageHeader, PageBlock } from 'vtex.styleguide' +import { useRuntime } from 'vtex.render-runtime' + +import ORDERS_AVAILABLE_TO_RETURN from '../../store/createReturnRequest/graphql/getOrdersAvailableToReturn.gql' +import { OrderList } from '../../common/components/ordersList/ListTable' +import { AdminLoader } from '../AdminLoader' + +export const OrderListContainer = () => { + const [ordersToReturn, setOrdersToReturn] = useState([]) + const [currentPage, setCurrentPage] = useState(1) + const { navigate } = useRuntime() + + const { data, loading, error, fetchMore, refetch } = useQuery< + { ordersAvailableToReturn: OrdersToReturnList }, + QueryOrdersAvailableToReturnArgs + >(ORDERS_AVAILABLE_TO_RETURN, { + variables: { + page: 1, + isAdmin: true, + }, + fetchPolicy: 'no-cache', + }) + + useEffect(() => { + if (data) { + setOrdersToReturn([data.ordersAvailableToReturn]) + } + }, [data]) + + const handlePagination = async ( + page: number, + operation: 'next' | 'previous' + ): Promise => { + const alreadyFetched = ordersToReturn.find((ordersItem) => { + return ordersItem.paging?.currentPage === page + }) + + if (!alreadyFetched) { + await fetchMore({ + variables: { + page, + }, + updateQuery: (prevResult, { fetchMoreResult }) => { + if (!fetchMoreResult) return prevResult + + setOrdersToReturn((prevState) => [ + ...prevState, + fetchMoreResult.ordersAvailableToReturn, + ]) + + setCurrentPage( + Number(fetchMoreResult.ordersAvailableToReturn.paging?.currentPage) + ) + + return prevResult + }, + }) + + return + } + + operation === 'next' && setCurrentPage(page) + operation === 'previous' && setCurrentPage(page) + } + + return ( + + } + subtitle={ + + } + linkLabel={ + + } + onLinkClick={() => { + navigate({ + to: '/admin/app/returns/requests', + }) + }} + /> + } + > + + <> + {loading || error || !ordersToReturn.length ? ( + + ), + errorDescription: ( + + ), + }} + /> + ) : ( + + )} + + + + ) +} diff --git a/react/admin/ReturnAdd/ReturnAddContainer.tsx b/react/admin/ReturnAdd/ReturnAddContainer.tsx new file mode 100644 index 000000000..5d0d61858 --- /dev/null +++ b/react/admin/ReturnAdd/ReturnAddContainer.tsx @@ -0,0 +1,25 @@ +import React from 'react' +import { Layout, PageHeader, PageBlock } from 'vtex.styleguide' +import { FormattedMessage } from 'react-intl' + +export const ReturnAddContainer = ({children}) => { + return ( + + } + subtitle={ + + } + /> + } + > + + {children} + + + ) +} diff --git a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx index a51480bb7..48865136f 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/VerifyItemsPage.tsx @@ -112,8 +112,10 @@ export const VerifyItemsPage = ({ onViewVerifyItems }: Props) => { const { orderItemIndex, sellingPrice, tax } = item const returningItem = refundItemsInput.get(orderItemIndex) const { quantity = 0, restockFee = 0 } = returningItem ?? {} + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands const itemTotal = (sellingPrice + tax) * quantity - restockFee + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands return total + itemTotal }, 0) diff --git a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx index 5131d4bc5..e93b87d57 100644 --- a/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx +++ b/react/admin/ReturnDetails/components/VerifyItems/verifyItemsTableSchema.tsx @@ -82,6 +82,7 @@ export const verifyItemsTableSchema = ( return ( { subtitle={ } - /> + > + + } > diff --git a/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx b/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx index ac3b0f49f..2514fce55 100644 --- a/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx +++ b/react/admin/settings/SettingDetails/SettingDetailsContainer.tsx @@ -55,13 +55,8 @@ const validateOptions = (paymentOptions: PaymentOptionsInterface) => { } export const SettingDetailsContainer = () => { - const { - appSettings, - loading, - error, - savingAppSettings, - actions, - } = useSettings() + const { appSettings, loading, error, savingAppSettings, actions } = + useSettings() const { handleSaveAppSettings, dispatch } = actions || {} @@ -152,6 +147,7 @@ export const SettingDetailsContainer = () => { setHasPaymentMethodError(false) } + return ( { - const { - appSettings, - actions, - } = useSettings() + const { appSettings, actions } = useSettings() const { dispatch } = actions || {} const { maxDays, customReturnReasons } = appSettings || {} diff --git a/react/admin/settings/components/CustomReasons/CustomReasons.tsx b/react/admin/settings/components/CustomReasons/CustomReasons.tsx index 918bdcebb..adcfa7f84 100644 --- a/react/admin/settings/components/CustomReasons/CustomReasons.tsx +++ b/react/admin/settings/components/CustomReasons/CustomReasons.tsx @@ -87,10 +87,7 @@ export const CustomReasons = () => { const [customReasonToEdit, setCustomReasonToEdit] = useState(null) - const { - appSettings, - actions, - } = useSettings() + const { appSettings, actions } = useSettings() const { customReturnReasons } = appSettings || {} const { dispatch } = actions || {} diff --git a/react/admin/settings/components/CustomReasons/TranslationsModal.tsx b/react/admin/settings/components/CustomReasons/TranslationsModal.tsx index c15d9eb6e..d45893de3 100644 --- a/react/admin/settings/components/CustomReasons/TranslationsModal.tsx +++ b/react/admin/settings/components/CustomReasons/TranslationsModal.tsx @@ -96,10 +96,7 @@ export const TranslationsModal = ({ CustomReturnReasonTranslation[] >([]) - const { - appSettings, - actions, - } = useSettings() + const { appSettings, actions } = useSettings() const { customReturnReasons } = appSettings || {} const { dispatch } = actions || {} diff --git a/react/admin/settings/components/ExcludedCategories.tsx b/react/admin/settings/components/ExcludedCategories.tsx index 616bdc498..a68e29096 100644 --- a/react/admin/settings/components/ExcludedCategories.tsx +++ b/react/admin/settings/components/ExcludedCategories.tsx @@ -55,10 +55,7 @@ const filterSearchCategories = ({ export const ExcludedCategories = () => { const [searchedCategory, setSearchedCategory] = React.useState('') - const { - appSettings, - actions, - } = useSettings() + const { appSettings, actions } = useSettings() const { dispatch } = actions || {} diff --git a/react/admin/settings/components/GeneralOptions.tsx b/react/admin/settings/components/GeneralOptions.tsx index d90d006b6..310ec51e6 100644 --- a/react/admin/settings/components/GeneralOptions.tsx +++ b/react/admin/settings/components/GeneralOptions.tsx @@ -40,14 +40,11 @@ const messages = defineMessages({ }) export const GeneralOptions = () => { - const { - appSettings, - actions , - } = useSettings() + const { appSettings, actions } = useSettings() const intl = useIntl() - - const dispatch = actions?.dispatch + + const dispatch = actions?.dispatch const handleToggle = (e: ChangeEvent) => { const { name, checked } = e.target diff --git a/react/admin/settings/components/PaymentOptions.tsx b/react/admin/settings/components/PaymentOptions.tsx index f29fd4368..c968eaaa0 100644 --- a/react/admin/settings/components/PaymentOptions.tsx +++ b/react/admin/settings/components/PaymentOptions.tsx @@ -54,10 +54,7 @@ interface PaymentOptionsProps extends ComponentPropsWithoutRef<'div'> { export const PaymentOptions = forwardRef( ({ handleOptionSelection, hasError }, ref) => { - const { - appSettings, - actions, - } = useSettings() + const { appSettings, actions } = useSettings() const { dispatch } = actions || {} diff --git a/react/admin/settings/components/RequiredOptions.tsx b/react/admin/settings/components/RequiredOptions.tsx index 9b5a9fb2b..6b0843608 100644 --- a/react/admin/settings/components/RequiredOptions.tsx +++ b/react/admin/settings/components/RequiredOptions.tsx @@ -6,13 +6,10 @@ import { FormattedMessage } from 'react-intl' import { useSettings } from '../hooks/useSettings' export const RequiredOptions = () => { - const { - appSettings, - actions , - } = useSettings() + const { appSettings, actions } = useSettings() + + const dispatch = actions?.dispatch - const dispatch = actions?.dispatch - const handleMaxDaysInput = (e: ChangeEvent) => { const { value } = e.target const maxDays = Number(value) diff --git a/react/admin/settings/hooks/useSettingsSeller.ts b/react/admin/settings/hooks/useSettingsSeller.ts index b1a8b75df..1c20f71c5 100644 --- a/react/admin/settings/hooks/useSettingsSeller.ts +++ b/react/admin/settings/hooks/useSettingsSeller.ts @@ -2,4 +2,4 @@ import { useContext } from 'react' import { SettingsDetailContextSeller } from '../provider/SettingsDetailProvider' -export const useSettingsDetail = () => useContext(SettingsDetailContextSeller) \ No newline at end of file +export const useSettingsDetail = () => useContext(SettingsDetailContextSeller) diff --git a/react/admin/settings/provider/SettingsProvider.tsx b/react/admin/settings/provider/SettingsProvider.tsx index b59b3e084..ef97f4f6a 100644 --- a/react/admin/settings/provider/SettingsProvider.tsx +++ b/react/admin/settings/provider/SettingsProvider.tsx @@ -1,9 +1,14 @@ import type { ApolloError } from 'apollo-client' -import type { Dispatch } from 'react' -import React, { createContext, useReducer, useEffect, ReactNode } from 'react' +import type { Dispatch, ReactNode } from 'react' +import React, { createContext, useReducer, useEffect } from 'react' import { useQuery, useMutation } from 'react-apollo' import { FormattedMessage } from 'react-intl' -import type { ReturnAppSettings, SellerSetting, ReturnAppSettingsInput, SellerSettingInput } from 'vtex.return-app' +import type { + ReturnAppSettings, + SellerSetting, + ReturnAppSettingsInput, + SellerSettingInput, +} from 'vtex.return-app' import APP_SETTINGS from '../graphql/getAppSettings.gql' import APP_SETTINGS_SELLERS from '../graphql/getSellerSettings.gql' @@ -13,7 +18,6 @@ import { useAlert } from '../../hooks/userAlert' import type { Actions } from './settingsReducer' import { settingsReducer, initialSettingsState } from './settingsReducer' - interface ISettingsProvider { children: ReactNode sellerId?: string @@ -43,19 +47,21 @@ export const SettingsProvider = ({ children, sellerId }: ISettingsProvider) => { const { openAlert } = useAlert() const QUERY = sellerId ? APP_SETTINGS_SELLERS : APP_SETTINGS - const VARIABLES = sellerId ? {variables: {sellerId}} : {} + const VARIABLES = sellerId ? { variables: { sellerId } } : {} - const { data, loading, error } = - useQuery<{ returnAppSettings: ReturnAppSettings, returnSellerSettings: SellerSetting}>(QUERY, VARIABLES) + const { data, loading, error } = useQuery<{ + returnAppSettings: ReturnAppSettings + returnSellerSettings: SellerSetting + }>(QUERY, VARIABLES) const [saveAppSettings, { loading: savingAppSettings }] = useMutation< - { saveReturnAppSettings: boolean, updateSellerSetting: boolean }, - { settings: ReturnAppSettingsInput} + { saveReturnAppSettings: boolean; updateSellerSetting: boolean }, + { settings: ReturnAppSettingsInput } >(SAVE_APP_SETTINGS) const [updateSellerSetting, { loading: updatingAppSettings }] = useMutation< - { updateSellerSetting: boolean, saveReturnAppSettings: boolean }, - { settings: SellerSettingInput} + { updateSellerSetting: boolean; saveReturnAppSettings: boolean }, + { settings: SellerSettingInput } >(UPDATE_APP_SETTINGS_SELLERS) useEffect(() => { @@ -65,6 +71,7 @@ export const SettingsProvider = ({ children, sellerId }: ISettingsProvider) => { payload: sellerId ? data?.returnSellerSettings : data.returnAppSettings, }) } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [data]) const handleSaveAppSettings = async () => { @@ -81,23 +88,29 @@ export const SettingsProvider = ({ children, sellerId }: ISettingsProvider) => { automaticallyRefundPaymentMethod ), } - - const {id, ...payload } = appSettings - const MUTATION_VARIABLES = sellerId ? { - id, - settings: {...payload, paymentOptions: adjustedPaymentOptions }, - } : { - settings: {...payload, paymentOptions: adjustedPaymentOptions }, - } - console.log('MUTATION_VARIABLES: ', MUTATION_VARIABLES) - - const { data: mutationResult, errors } = sellerId ? await updateSellerSetting({ variables: MUTATION_VARIABLES }) : await saveAppSettings({ variables: MUTATION_VARIABLES }) + + const { id, ...payload } = appSettings + const MUTATION_VARIABLES = sellerId + ? { + id, + settings: { ...payload, paymentOptions: adjustedPaymentOptions }, + } + : { + settings: { ...payload, paymentOptions: adjustedPaymentOptions }, + } + + const { data: mutationResult, errors } = sellerId + ? await updateSellerSetting({ variables: MUTATION_VARIABLES }) + : await saveAppSettings({ variables: MUTATION_VARIABLES }) if (errors) { throw new Error('Error saving app settings') } - if (mutationResult?.saveReturnAppSettings || mutationResult?.updateSellerSetting) { + if ( + mutationResult?.saveReturnAppSettings || + mutationResult?.updateSellerSetting + ) { openAlert( 'success', diff --git a/react/admin/settings/provider/settingsReducer.ts b/react/admin/settings/provider/settingsReducer.ts index 19e0ab0de..6f8eb1f02 100644 --- a/react/admin/settings/provider/settingsReducer.ts +++ b/react/admin/settings/provider/settingsReducer.ts @@ -3,7 +3,7 @@ import type { PaymentOptions, ReturnAppSettings, ReturnOption, - SellerSetting + SellerSetting, } from 'vtex.return-app' export const initialSettingsState: ReturnAppSettings | SellerSetting = { @@ -71,14 +71,18 @@ export const optionsAction = (options: ReturnOption) => { } } -export const initialStateAction = (initialState: ReturnAppSettings | SellerSetting) => { +export const initialStateAction = ( + initialState: ReturnAppSettings | SellerSetting +) => { return { type: 'updateInitialState' as const, payload: initialState, } } -export const initialStateActionSeller = (initialStateSeller: ReturnAppSettings | SellerSetting) => { +export const initialStateActionSeller = ( + initialStateSeller: ReturnAppSettings | SellerSetting +) => { return { type: 'updateInitialStateSeller' as const, payload: initialStateSeller, @@ -95,7 +99,10 @@ export type Actions = | ReturnType | ReturnType -export const settingsReducer = (state: ReturnAppSettings | SellerSetting, action: Actions) => { +export const settingsReducer = ( + state: ReturnAppSettings | SellerSetting, + action: Actions +) => { switch (action.type) { case 'updateMaxDays': { return { diff --git a/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx b/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx index 0cd009200..fc3427bb1 100644 --- a/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx +++ b/react/common/components/ReturnDetails/ItemDetails/itemDetailsSchema.tsx @@ -175,6 +175,7 @@ export const itemDetailsSchema = ({ return ( { const { items, invoiceValue, refundedShippingValue } = refundData const amountItemRefund = items.reduce((total, item) => { + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands return total + item.price * item.quantity }, 0) const totalRestockFee = items.reduce((total, item) => { + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands return total + item.restockFee }, 0) diff --git a/react/common/components/ReturnDetails/ReturnValues/RequestedValues.tsx b/react/common/components/ReturnDetails/ReturnValues/RequestedValues.tsx index 9c6a26dd7..ba176ccfc 100644 --- a/react/common/components/ReturnDetails/ReturnValues/RequestedValues.tsx +++ b/react/common/components/ReturnDetails/ReturnValues/RequestedValues.tsx @@ -36,6 +36,7 @@ export const RequestedValues = () => { title={ } + // eslint-disable-next-line @typescript-eslint/restrict-plus-operands value={totalRefundableItems + totalRefundableTaxes} /> void + currentPage: number + maxPage: number +} + +const JumpToPage = (props: Props) => { + const handles = useCssHandles(CSS_HANDLES) + + const { handleJumpToPage, currentPage, maxPage } = props + + const [desiredPage, setDesiredPage] = useState(currentPage) + const [canSubmit, setEnableSubmit] = useState(true) + + useEffect(() => { + if (desiredPage > maxPage || desiredPage <= 0) { + setEnableSubmit(false) + + return + } + + setEnableSubmit(true) + }, [desiredPage, maxPage]) + + const handleOnChange = (page: number) => { + setDesiredPage(page) + } + + const handleSubmit = () => { + handleJumpToPage(desiredPage) + } + + return ( +
    +
    +
    + + {' '} + {`${currentPage} - ${maxPage}`} + +
    +
    + ) => + handleOnChange(Number(e.currentTarget.value)) + } + /> +
    +
    + +
    +
    +
    + ) +} + +export default JumpToPage diff --git a/react/common/components/ordersList/ListTable.tsx b/react/common/components/ordersList/ListTable.tsx new file mode 100644 index 000000000..2c2d6da3d --- /dev/null +++ b/react/common/components/ordersList/ListTable.tsx @@ -0,0 +1,189 @@ +import React, { useState } from 'react' +import type { OrdersToReturnList, OrderToReturnSummary } from 'vtex.return-app' +import { FormattedMessage, FormattedDate } from 'react-intl' +import { useRuntime } from 'vtex.render-runtime' +import { useCssHandles } from 'vtex.css-handles' +import { Table, Button } from 'vtex.styleguide' + +import { createItemsSummary } from '../../../store/utils/createItemsSummary' +import OrdersTableFilter from './ListTableFilter' + +const CSS_HANDLES = ['listTableContainer'] as const + +type Operation = 'next' | 'previous' +interface Props { + orders: OrdersToReturnList + handlePagination: (page: number, operation: Operation) => Promise + refetch: (variables?: any) => Promise + isLoading: boolean +} + +interface RowData { + rowData: OrderToReturnSummary +} + +type OrderListTableSchemaProps = { + navigate: (to: { to: string }) => void + isSmallScreen: boolean +} +const OrderlListTableSchema = ({ + navigate, + isSmallScreen, +}: OrderListTableSchemaProps) => { + const properties = { + orderId: { + title: ( + + ), + minWidth: 150, + }, + sellerName: { + title: ( + + ), + minWidth: 150, + }, + creationDate: { + title: ( + + ), + cellRenderer: function formatDate({ cellData }: { cellData: string }) { + return ( + + ) + }, + minWidth: 120, + }, + status: { + title: ( + + ), + cellRenderer: function availableProducts({ rowData }: RowData) { + const { quantityAvailable, quantity } = createItemsSummary(rowData) + + return

    {`${quantityAvailable} / ${quantity}`}

    + }, + }, + selectOrder: { + title: ( + + ), + cellRenderer: function SelectOrderButton({ rowData }: RowData) { + const { quantityAvailable } = createItemsSummary(rowData) + + return ( +
    + +
    + ) + }, + minWidth: 150, + }, + } + + const mobileOrder = { + orderId: null, + selectOrder: null, + } + + return { + properties: isSmallScreen + ? Object.assign(mobileOrder, properties) + : properties, + } +} + +export const OrderList = ({ + orders, + handlePagination, + refetch, + isLoading, +}: Props) => { + const { + navigate, + route: { domain }, + hints: { phone, mobile }, + } = useRuntime() + + const handles = useCssHandles(CSS_HANDLES) + + const isAdmin = domain === 'admin' + + const [fetchMoreState, setFetchMoreState] = useState<'IDLE' | 'LOADING'>( + 'IDLE' + ) + + const { paging } = orders + const currentPage = paging?.currentPage ?? 1 + const perPage = paging?.perPage ?? 0 + const totalItems = paging?.total ?? 0 + + const handlePaginationClick = async (operation: Operation) => { + if (currentPage === 1 && operation === 'previous') { + return + } + + const newPage = + operation === 'next' ? Number(currentPage) + 1 : Number(currentPage) - 1 + + setFetchMoreState('LOADING') + await handlePagination(newPage, 'next') + setFetchMoreState('IDLE') + } + + return ( +
    + {mobile && !isAdmin ? null : ( + + )} +
+ } + schema={OrderlListTableSchema({ + navigate, + isSmallScreen: phone, + })} + items={orders.list} + loading={fetchMoreState === 'LOADING'} + pagination={{ + onNextClick: () => handlePaginationClick('next'), + onPrevClick: () => handlePaginationClick('previous'), + currentItemFrom: perPage * currentPage - perPage + 1, + currentItemTo: + perPage * currentPage > totalItems + ? totalItems + : perPage * currentPage, + textOf: ( + + ), + totalItems, + }} + /> + + ) +} diff --git a/react/common/components/ordersList/ListTableFilter.tsx b/react/common/components/ordersList/ListTableFilter.tsx new file mode 100644 index 000000000..d4af89591 --- /dev/null +++ b/react/common/components/ordersList/ListTableFilter.tsx @@ -0,0 +1,207 @@ +import type { FormEvent } from 'react' +import React, { useState } from 'react' +import { FormattedMessage } from 'react-intl' +import { Input, DatePicker, Button } from 'vtex.styleguide' +import type { + QueryReturnRequestListArgs, + ReturnRequestList, + Status, +} from 'vtex.return-app' +import type { ApolloQueryResult } from 'apollo-client' +import { useCssHandles } from 'vtex.css-handles' + +const CSS_HANDLES = ['listTableFilterContainer'] as const + +interface Props { + refetch: (variables?: QueryReturnRequestListArgs | undefined) => Promise< + ApolloQueryResult<{ + returnRequestList: ReturnRequestList + }> + > + loading: boolean + isDisabled: boolean +} + +interface FilterDates { + from: string + to: string +} +interface Filters { + status: Status | '' + sequenceNumber: string + id: string + createdIn: FilterDates | undefined + orderId: string + sellerName: string +} + +type Keys = keyof Filters | keyof FilterDates +export type FilterKeys = Exclude + +const initialFilters = { + status: '', + sequenceNumber: '', + id: '', + createdIn: undefined, + orderId: '', + sellerName: '', +} as Filters + +const OrdersTableFilter = (props: Props) => { + const handles = useCssHandles(CSS_HANDLES) + + const { refetch, loading, isDisabled } = props + + const [isFiltering, setIsFiltering] = useState(false) + const [filters, setFilters] = useState(initialFilters) + + const { createdIn } = filters + const fromDate = createdIn ? new Date(createdIn.from) : '' + const toDate = createdIn ? new Date(createdIn.to) : '' + + // Used solely for refetch's variables + const selectedFilters = Object.keys(filters) + .filter((key) => filters[key]) + .reduce((newFilters, key) => { + newFilters[key] = filters[key] + + return newFilters + }, {}) + + const hasSelectedFilters = Object.keys(selectedFilters).length > 0 + + const handleSubmitFilters = (e: FormEvent) => { + e.preventDefault() + setIsFiltering(true) + refetch({ filters: selectedFilters, page: 1, isAdmin: true }) + } + + const handleResetFilters = () => { + setIsFiltering(false) + setFilters(initialFilters) + refetch({ filters: undefined, page: 1, isAdmin: true }) + } + + const handleOnChange = (key: FilterKeys, value: string) => { + /* Both dates are non nullable */ + if (key === 'to' || key === 'from') { + const filterDates = { + ...filters.createdIn, + [key]: value, + } as FilterDates + + if (!filterDates.to) { + filterDates.to = new Date().toISOString() + } + + if (!filterDates.from) { + filterDates.from = new Date(filterDates.to).toISOString() + } + + setFilters({ + ...filters, + createdIn: filterDates, + }) + console.info(filters) + + return + } + + setFilters({ + ...filters, + [key]: value, + }) + } + + return ( +
+
+
+ + {(formattedMessage) => ( + ) => + handleOnChange('orderId', e.currentTarget.value) + } + readOnly={isDisabled && !isFiltering} + /> + )} + +
+
+ + {(formattedMessage) => ( + ) => + handleOnChange('sellerName', e.currentTarget.value) + } + readOnly={isDisabled && !isFiltering} + /> + )} + +
+
+ + {(formattedMessage) => ( + + handleOnChange('from', new Date(date).toISOString()) + } + value={fromDate} + disabled={isDisabled && !isFiltering} + /> + )} + +
+
+ + {(formattedMessage) => ( + + handleOnChange('to', new Date(date).toISOString()) + } + value={toDate} + disabled={isDisabled && !isFiltering} + /> + )} + +
+
+ +
+
+ +
+
+ + ) +} + +export default OrdersTableFilter diff --git a/react/common/components/ordersList/ListTableSchema.tsx b/react/common/components/ordersList/ListTableSchema.tsx new file mode 100644 index 000000000..80daed0e7 --- /dev/null +++ b/react/common/components/ordersList/ListTableSchema.tsx @@ -0,0 +1,118 @@ +import React from 'react' +import { FormattedDate, FormattedMessage } from 'react-intl' +import { useRuntime } from 'vtex.render-runtime' +import { IconInfo, ButtonPlain, Tooltip } from 'vtex.styleguide' + +import { renderStatus } from '../RenderStatus' + +const ReturnListSchema = () => { + const { + navigate, + route: { domain }, + } = useRuntime() + + const isAdmin = domain === 'admin' + + const navigateToRequest = (id: string) => { + const page = isAdmin + ? `/admin/app/returns/${id}/details/` + : `#/my-returns/details/${id}` + + navigate({ + to: page, + }) + } + + return { + properties: { + ...(isAdmin && { + id: { + title: ( + + ), + headerRenderer({ title }) { + return ( +
+ {title} + + } + > + + + + +
+ ) + }, + minWidth: 310, + cellRenderer({ cellData }) { + return ( + navigateToRequest(cellData)} + > + {cellData} + + ) + }, + }, + }), + sequenceNumber: { + title: ( + + ), + minWidth: 100, + ...(!isAdmin && { + cellRenderer({ cellData, rowData }) { + return ( + navigateToRequest(rowData.id)}> + {cellData} + + ) + }, + }), + }, + orderId: { + title: ( + + ), + minWidth: 160, + }, + sellerName: { + title: ( + + ), + minWidth: 140, + }, + createdIn: { + title: ( + + ), + cellRenderer({ cellData }) { + return ( + + ) + }, + minWidth: 110, + }, + status: { + title: ( + + ), + minWidth: 250, + cellRenderer({ cellData }) { + return renderStatus(cellData) + }, + }, + }, + } +} + +export default ReturnListSchema diff --git a/react/common/components/ordersList/StatusActionMenu.tsx b/react/common/components/ordersList/StatusActionMenu.tsx new file mode 100644 index 000000000..6a62b6f5d --- /dev/null +++ b/react/common/components/ordersList/StatusActionMenu.tsx @@ -0,0 +1,78 @@ +import React from 'react' +import { defineMessages, useIntl } from 'react-intl' +import type { Status } from 'vtex.return-app' +import { ActionMenu } from 'vtex.styleguide' + +import type { FilterKeys } from './ListTableFilter' + +interface Props { + handleOnChange: (key: FilterKeys, value: string) => void + status: Status | '' + disabled: boolean +} + +const allStatusKey = 'allStatus' + +const keyedStatusMessages = defineMessages({ + [allStatusKey]: { + id: 'return-app.return-request-list.table.status.allStatus', + }, + new: { + id: 'return-app.return-request-list.table.status.new', + }, + processing: { + id: 'return-app.return-request-list.table.status.processing', + }, + pickedUpFromClient: { + id: 'return-app.return-request-list.table.status.pickedup-from-client', + }, + pendingVerification: { + id: 'return-app.return-request-list.table.status.pending-verification', + }, + packageVerified: { + id: 'return-app.return-request-list.table.status.package-verified', + }, + denied: { + id: 'return-app.return-request-list.table.status.denied', + }, + cancelled: { + id: 'return-app.return-request-list.table.status.cancelled', + }, + amountRefunded: { + id: 'return-app.return-request-list.table.status.refunded', + }, +}) + +const StatusActionMenu = (props: Props) => { + const { handleOnChange, status, disabled } = props + + const { formatMessage } = useIntl() + + const optionList = Object.keys(keyedStatusMessages).map((key) => { + const keyName = key === allStatusKey ? '' : key + + return { + label: formatMessage({ id: keyedStatusMessages[key].id }), + onClick: () => handleOnChange('status', keyName), + } + }) + + return ( + + ) +} + +export { StatusActionMenu } diff --git a/react/common/components/returnList/ListTable.tsx b/react/common/components/returnList/ListTable.tsx index c05464bbf..2a825b04d 100644 --- a/react/common/components/returnList/ListTable.tsx +++ b/react/common/components/returnList/ListTable.tsx @@ -9,7 +9,6 @@ import JumpToPage from './JumpToPage' import ListTableFilter from './ListTableFilter' import { useReturnRequestList } from '../../../hooks/useReturnRequestList' - const CSS_HANDLES = ['listTableContainer'] as const const ListTable = () => { diff --git a/react/common/components/returnList/ListTableFilter.tsx b/react/common/components/returnList/ListTableFilter.tsx index d19a251a6..2d8eebbf5 100644 --- a/react/common/components/returnList/ListTableFilter.tsx +++ b/react/common/components/returnList/ListTableFilter.tsx @@ -47,7 +47,7 @@ const initialFilters = { id: '', createdIn: undefined, orderId: '', - sellerName: '' + sellerName: '', } as Filters const ListTableFilter = (props: Props) => { diff --git a/react/common/components/returnListSettings/ListTableFilterSettings.tsx b/react/common/components/returnListSettings/ListTableFilterSettings.tsx index c41af242b..ee164369b 100644 --- a/react/common/components/returnListSettings/ListTableFilterSettings.tsx +++ b/react/common/components/returnListSettings/ListTableFilterSettings.tsx @@ -4,13 +4,12 @@ import { FormattedMessage } from 'react-intl' import { Input, Button } from 'vtex.styleguide' import type { QueryReturnSettingsListArgs, - ReturnSettingsList + ReturnSettingsList, } from 'vtex.return-app' import type { ApolloQueryResult } from 'apollo-client' import { useRuntime } from 'vtex.render-runtime' import { useCssHandles } from 'vtex.css-handles' - const CSS_HANDLES = ['listTableFilterContainer'] as const interface Props { @@ -28,12 +27,12 @@ interface Filters { sellerName: string } -type Keys = keyof Filters +type Keys = keyof Filters export type FilterKeys = Exclude const initialFilters = { id: '', - sellerName: '' + sellerName: '', } as Filters const ListTableFilterSettings = (props: Props) => { diff --git a/react/common/components/returnListSettings/ListTableSchemaSettings.tsx b/react/common/components/returnListSettings/ListTableSchemaSettings.tsx index 9f596bb7d..76c261ea3 100644 --- a/react/common/components/returnListSettings/ListTableSchemaSettings.tsx +++ b/react/common/components/returnListSettings/ListTableSchemaSettings.tsx @@ -3,7 +3,6 @@ import { FormattedMessage } from 'react-intl' import { useRuntime } from 'vtex.render-runtime' import { ButtonPlain } from 'vtex.styleguide' - const ReturnListTableSchemaSettings = () => { const { navigate, @@ -47,15 +46,10 @@ const ReturnListTableSchemaSettings = () => { ), minWidth: 310, headerRenderer({ title }) { - return ( -
- {title} -
- ) + return
{title}
}, }, }), - }, } } diff --git a/react/hooks/useSettingsRequestList.ts b/react/hooks/useSettingsRequestList.ts index c1fb431a4..41f8a6a22 100644 --- a/react/hooks/useSettingsRequestList.ts +++ b/react/hooks/useSettingsRequestList.ts @@ -19,5 +19,6 @@ export const useSettingsRequestList = () => { notifyOnNetworkStatusChange: true, fetchPolicy: 'no-cache', }) + return { returnRequestData: { data, loading, error, refetch } } } diff --git a/react/package.json b/react/package.json index 012e17bee..a7885a820 100644 --- a/react/package.json +++ b/react/package.json @@ -25,17 +25,7 @@ "@types/react-router": "^5.1.18", "@vtex/test-tools": "^0.3.2", "@vtex/tsconfig": "^0.6.0", - "prop-types": "^15.7.2", - "vtex.catalog-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.catalog-graphql@1.102.1/public/@types/vtex.catalog-graphql", - "vtex.css-handles": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.css-handles@0.4.4/public/@types/vtex.css-handles", - "vtex.easypost": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.easypost@0.1.1/public/@types/vtex.easypost", - "vtex.format-currency": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.format-currency@0.4.1/public/@types/vtex.format-currency", - "vtex.my-account": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account@1.25.0/public/@types/vtex.my-account", - "vtex.my-account-commons": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.my-account-commons@1.6.0/public/@types/vtex.my-account-commons", - "vtex.render-runtime": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.render-runtime@8.132.4/public/@types/vtex.render-runtime", - "vtex.return-app": "https://develop--obidev.myvtex.com/_v/private/typings/linked/v1/vtex.return-app@3.5.6+build1678885921/public/@types/vtex.return-app", - "vtex.styleguide": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.styleguide@9.146.3/public/@types/vtex.styleguide", - "vtex.tenant-graphql": "http://vtex.vtexassets.com/_v/public/typings/v1/vtex.tenant-graphql@0.1.2/public/@types/vtex.tenant-graphql" + "prop-types": "^15.7.2" }, "version": "3.5.6" } diff --git a/react/store/ReturnRequest/StoreReturnList.tsx b/react/store/ReturnRequest/StoreReturnList.tsx index e15aecd7e..01c8ce0ed 100644 --- a/react/store/ReturnRequest/StoreReturnList.tsx +++ b/react/store/ReturnRequest/StoreReturnList.tsx @@ -33,7 +33,7 @@ export const StoreReturnList = () => { disabled={loading} href="#/my-returns/add" > - + ) diff --git a/react/store/createReturnRequest/CreateReturnRequest.tsx b/react/store/createReturnRequest/CreateReturnRequest.tsx index 3dfa71844..bb344fbbe 100644 --- a/react/store/createReturnRequest/CreateReturnRequest.tsx +++ b/react/store/createReturnRequest/CreateReturnRequest.tsx @@ -24,37 +24,35 @@ export type Page = 'form-details' | 'submit-form' type RouteProps = RouteComponentProps<{ orderId: string }> -const createPageHeaderProps = (page: Page, navigate: any) => { +const createPageHeaderProps = (page: Page, navigate: any, isAdmin: boolean) => { if (page === 'submit-form') { return { title: ( - + ), } } return { title: ( - + ), linkLabel: ( - + ), onLinkClick: () => { navigate({ - to: '#/my-returns/add', + to: isAdmin ? '/admin/app/returns/orders/' : '#/my-returns/add', }) }, } } -export const CreateReturnRequest = (props: RouteProps) => { - const { - match: { - params: { orderId }, - }, - } = props - +export const CreateReturnRequest = (props: any) => { + const orderId = props?.match?.params?.orderId || props?.params?.orderId + + const isAdmin = props?.page ? true : false + const [page, setPage] = useState('form-details') const [items, setItemsToReturn] = useState([]) @@ -119,7 +117,7 @@ export const CreateReturnRequest = (props: RouteProps) => { return (
- + {page === 'form-details' && data ? ( <> @@ -132,11 +130,12 @@ export const CreateReturnRequest = (props: RouteProps) => { data?.orderToReturnSummary.paymentData.canRefundCard } shippingData={data.orderToReturnSummary.shippingData} + isAdmin /> ) : null} {page === 'submit-form' ? ( - + ) : null} diff --git a/react/store/createReturnRequest/components/AddressDetails.tsx b/react/store/createReturnRequest/components/AddressDetails.tsx index 60f8436b7..8d5f0408e 100644 --- a/react/store/createReturnRequest/components/AddressDetails.tsx +++ b/react/store/createReturnRequest/components/AddressDetails.tsx @@ -125,11 +125,11 @@ export const AddressDetails = ({ shippingData }: Props) => {
+ } >

- +

@@ -137,7 +137,7 @@ export const AddressDetails = ({ shippingData }: Props) => {
+ } position="left" > @@ -146,7 +146,7 @@ export const AddressDetails = ({ shippingData }: Props) => {

- +

@@ -174,7 +174,7 @@ export const AddressDetails = ({ shippingData }: Props) => { + } /> ) : null} @@ -192,7 +192,7 @@ export const AddressDetails = ({ shippingData }: Props) => { + } /> ) : null} @@ -210,7 +210,7 @@ export const AddressDetails = ({ shippingData }: Props) => { + } /> ) : null} @@ -228,7 +228,7 @@ export const AddressDetails = ({ shippingData }: Props) => { + } /> ) : null} @@ -246,7 +246,7 @@ export const AddressDetails = ({ shippingData }: Props) => { + } /> ) : null} diff --git a/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx b/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx index 199465734..f8cc5bce1 100644 --- a/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx +++ b/react/store/createReturnRequest/components/ConfirmAndSubmit.tsx @@ -23,6 +23,7 @@ import { useStoreSettings } from '../../hooks/useStoreSettings' interface Props { onPageChange: (page: Page) => void items: ItemToReturn[] + isAdmin: boolean } type SubmissionStatus = 'success' | 'error' | 'idle' @@ -36,7 +37,7 @@ const CSS_HANDLES = [ 'submitButtonWrapper', ] as const -export const ConfirmAndSubmit = ({ onPageChange, items }: Props) => { +export const ConfirmAndSubmit = ({ onPageChange, items, isAdmin }: Props) => { const { returnRequest, termsAndConditions } = useReturnRequest() const [createReturnRequest, { loading: creatingReturnRequest }] = useMutation< @@ -94,7 +95,7 @@ export const ConfirmAndSubmit = ({ onPageChange, items }: Props) => { const handleAlertRedirect = () => { setConfirmationStatus('idle') navigate({ - to: `#/my-returns`, + to: isAdmin ? '/admin/app/returns/orders/' : `#/my-returns`, replace: true, }) } @@ -156,12 +157,12 @@ export const ConfirmAndSubmit = ({ onPageChange, items }: Props) => { type={confirmationStatus} action={{ label: ( - + ), onClick: () => handleAlertRedirect(), }} > - + )} {confirmationStatus !== 'error' ? null : ( @@ -169,12 +170,12 @@ export const ConfirmAndSubmit = ({ onPageChange, items }: Props) => { type={confirmationStatus} action={{ label: ( - + ), onClick: () => handleCreateReturnRequest(), }} > - + )} {confirmationStatus !== 'idle' ? null : ( @@ -194,7 +195,7 @@ export const ConfirmAndSubmit = ({ onPageChange, items }: Props) => { variation="secondary" onClick={() => handlePageChange()} > - +
{ onClick={handleCreateReturnRequest} isLoading={creatingReturnRequest} > - +
diff --git a/react/store/createReturnRequest/components/ConfirmComment.tsx b/react/store/createReturnRequest/components/ConfirmComment.tsx index 1fd063450..88dafbf3f 100644 --- a/react/store/createReturnRequest/components/ConfirmComment.tsx +++ b/react/store/createReturnRequest/components/ConfirmComment.tsx @@ -16,7 +16,7 @@ export const ConfirmComment = ({ userComment }: Props) => { {!userComment ? null : (

- +

{userComment}

diff --git a/react/store/createReturnRequest/components/ConfirmContactDetails.tsx b/react/store/createReturnRequest/components/ConfirmContactDetails.tsx index b5070d13b..ea80d6828 100644 --- a/react/store/createReturnRequest/components/ConfirmContactDetails.tsx +++ b/react/store/createReturnRequest/components/ConfirmContactDetails.tsx @@ -28,7 +28,7 @@ export const ConfirmContactDetails = ({ contactDetails }: Props) => { }`} >

- +

{contactDetails.name} diff --git a/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx b/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx index 45b0a8ba5..5735acd02 100644 --- a/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx +++ b/react/store/createReturnRequest/components/ConfirmPaymentMethods.tsx @@ -35,13 +35,13 @@ export const ConfirmPaymentMethods = ({ refundPaymentData }: Props) => { }`} >

- +

{refundPaymentData?.refundPaymentMethod === 'bank' ? ( <>

- +

{refundPaymentData.accountHolderName} @@ -49,7 +49,7 @@ export const ConfirmPaymentMethods = ({ refundPaymentData }: Props) => {

- +

{refundPaymentData.iban} @@ -59,9 +59,7 @@ export const ConfirmPaymentMethods = ({ refundPaymentData }: Props) => { ) : (

{formatMessage( - defaultPaymentMethodsMessages[ - refundPaymentData?.refundPaymentMethod - ] + defaultPaymentMethodsMessages[refundPaymentData?.refundPaymentMethod] )}

)} diff --git a/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx b/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx index 5bd3e6413..1bbe9caca 100644 --- a/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx +++ b/react/store/createReturnRequest/components/ConfirmPickupAddressDetails.tsx @@ -27,7 +27,7 @@ export const ConfirmPickupAddressDetails = ({ pickupReturnData }: Props) => { }`} >

- +

{pickupReturnData.address} diff --git a/react/store/createReturnRequest/components/ContactDetails.tsx b/react/store/createReturnRequest/components/ContactDetails.tsx index caa6d3bf6..af5f72296 100644 --- a/react/store/createReturnRequest/components/ContactDetails.tsx +++ b/react/store/createReturnRequest/components/ContactDetails.tsx @@ -9,13 +9,13 @@ import { CustomMessage } from './layout/CustomMessage' const messages = defineMessages({ nameInput: { - id: 'store/return-app.return-order-details.inputs.name-input', + id: 'return-app.return-order-details.inputs.name-input', }, emailInput: { - id: 'store/return-app.return-order-details.inputs.email-input', + id: 'return-app.return-order-details.inputs.email-input', }, phoneInput: { - id: 'store/return-app.return-order-details.inputs.phone-input', + id: 'return-app.return-order-details.inputs.phone-input', }, }) @@ -27,9 +27,10 @@ const CSS_HANDLES = [ 'contactPhoneInputWrapper', ] as const + export const ContactDetails = () => { const handles = useCssHandles(CSS_HANDLES) - + const { returnRequest: { customerProfileData }, inputErrors, @@ -59,7 +60,7 @@ export const ContactDetails = () => { className={`${handles.contactDetailsContainer} flex-ns flex-wrap flex-auto flex-column pa4`} >

- +

{ + } /> ) : null} @@ -100,7 +101,7 @@ export const ContactDetails = () => { + } /> ) : null} diff --git a/react/store/createReturnRequest/components/ItemsDetails.tsx b/react/store/createReturnRequest/components/ItemsDetails.tsx index 86170c24a..cb8e31445 100644 --- a/react/store/createReturnRequest/components/ItemsDetails.tsx +++ b/react/store/createReturnRequest/components/ItemsDetails.tsx @@ -181,7 +181,7 @@ export const ItemsDetails = (props: Props) => { + } /> ) : null} @@ -203,12 +203,13 @@ export const ItemsDetails = (props: Props) => { otherReason={currentItem?.returnReason?.otherReason ?? ''} onReasonChange={handleReasonChange} creationDate={creationDate} + isAdmin /> {reasonError && reasonErrorEmptyValue ? ( + } /> ) : null} @@ -224,7 +225,7 @@ export const ItemsDetails = (props: Props) => { + } /> ) : null} diff --git a/react/store/createReturnRequest/components/ItemsList.tsx b/react/store/createReturnRequest/components/ItemsList.tsx index 91db3aab6..a754ac61e 100644 --- a/react/store/createReturnRequest/components/ItemsList.tsx +++ b/react/store/createReturnRequest/components/ItemsList.tsx @@ -36,25 +36,26 @@ const mobileOrder = [ export const messages = defineMessages({ product: { - id: 'store/return-app.return-order-details.table-header.product', + id: 'return-app.return-order-details.table-header.product', }, quantity: { - id: 'store/return-app.return-order-details.table-header.quantity', + id: 'return-app.return-order-details.table-header.quantity', }, 'available-to-return': { - id: 'store/return-app.return-order-details.table-header.available-to-return', + id: 'return-app.return-order-details.table-header.available-to-return', }, 'quantity-to-return': { - id: 'store/return-app.return-order-details.table-header.quantity-to-return', + id: 'return-app.return-order-details.table-header.quantity-to-return', }, reason: { - id: 'store/return-app.return-order-details.table-header.reason', + id: 'return-app.return-order-details.table-header.reason', }, condition: { - id: 'store/return-app.return-order-details.table-header.condition', + id: 'return-app.return-order-details.table-header.condition', }, }) + const TableHeaderRenderer = ( formatMessage: IntlFormatters['formatMessage'], addCondition: boolean @@ -94,7 +95,7 @@ export const ItemsList = (props: Props) => { const TableHeader = TableHeaderRenderer( formatMessage, - Boolean(enableSelectItemCondition) + Boolean(enableSelectItemCondition), ) return ( @@ -124,7 +125,7 @@ export const ItemsList = (props: Props) => { + } /> ) : null} diff --git a/react/store/createReturnRequest/components/OrderList.tsx b/react/store/createReturnRequest/components/OrderList.tsx index 523b99de4..6a89f5257 100644 --- a/react/store/createReturnRequest/components/OrderList.tsx +++ b/react/store/createReturnRequest/components/OrderList.tsx @@ -27,13 +27,13 @@ const OrderlListTableSchema = ({ const properties = { orderId: { title: ( - + ), minWidth: 150, }, creationDate: { title: ( - + ), cellRenderer: function formatDate({ cellData }: { cellData: string }) { return ( @@ -49,7 +49,7 @@ const OrderlListTableSchema = ({ }, status: { title: ( - + ), cellRenderer: function availableProducts({ rowData }: RowData) { const { quantityAvailable, quantity } = createItemsSummary(rowData) @@ -59,7 +59,7 @@ const OrderlListTableSchema = ({ }, selectOrder: { title: ( - + ), cellRenderer: function SelectOrderButton({ rowData }: RowData) { const { quantityAvailable } = createItemsSummary(rowData) @@ -79,7 +79,7 @@ const OrderlListTableSchema = ({ collapseLeft disabled={!quantityAvailable} > - +
) @@ -136,7 +136,7 @@ export const OrderList = ({ orders, handlePagination }: Props) => {
+ } schema={OrderlListTableSchema({ navigate, @@ -153,7 +153,7 @@ export const OrderList = ({ orders, handlePagination }: Props) => { ? totalItems : perPage * currentPage, textOf: ( - + ), totalItems, }} diff --git a/react/store/createReturnRequest/components/PaymentMethods.tsx b/react/store/createReturnRequest/components/PaymentMethods.tsx index 5f9fce122..f26d0c88f 100644 --- a/react/store/createReturnRequest/components/PaymentMethods.tsx +++ b/react/store/createReturnRequest/components/PaymentMethods.tsx @@ -27,9 +27,9 @@ type PaymentMethodsOptions = { const CSS_HANDLES = ['paymentMethodContainer', 'paymentBankWrapper'] as const const messages = defineMessages({ - formIBAN: { id: 'store/return-app.return-order-details.payment-method.iban' }, + formIBAN: { id: 'return-app.return-order-details.payment-method.iban' }, formAccountHolder: { - id: 'store/return-app.return-order-details.payment-method.account-holder', + id: 'return-app.return-order-details.payment-method.account-holder', }, }) @@ -118,11 +118,11 @@ export const PaymentMethods = ({ canRefundCard }: Props) => { className={`${handles.paymentMethodContainer} flex-ns flex-wrap flex-auto flex-column pa4 mb6`} >

- +

{!enablePaymentMethodSelection ? (

- +

) : ( <> @@ -137,7 +137,7 @@ export const PaymentMethods = ({ canRefundCard }: Props) => { + } /> ) : null} @@ -156,7 +156,7 @@ export const PaymentMethods = ({ canRefundCard }: Props) => { + } /> ) : null} @@ -172,7 +172,7 @@ export const PaymentMethods = ({ canRefundCard }: Props) => { + } /> ) : null} @@ -182,7 +182,7 @@ export const PaymentMethods = ({ canRefundCard }: Props) => { + } /> ) : null} diff --git a/react/store/createReturnRequest/components/PickupPointSelector.tsx b/react/store/createReturnRequest/components/PickupPointSelector.tsx index b8c93efc8..582b28af4 100644 --- a/react/store/createReturnRequest/components/PickupPointSelector.tsx +++ b/react/store/createReturnRequest/components/PickupPointSelector.tsx @@ -113,14 +113,14 @@ export const PickupPointSelector = ({ geoCoordinates }: Props) => { ) : ( - + {(placehoder) => ( + ) : undefined } placeholder={placehoder} diff --git a/react/store/createReturnRequest/components/RenderReasonDropdown.tsx b/react/store/createReturnRequest/components/RenderReasonDropdown.tsx index d0f2975b7..a6978a96f 100644 --- a/react/store/createReturnRequest/components/RenderReasonDropdown.tsx +++ b/react/store/createReturnRequest/components/RenderReasonDropdown.tsx @@ -18,11 +18,17 @@ interface Props { onReasonChange: (reason: string, otherReason?: string) => void isExcluded: boolean creationDate?: string + isAdmin: boolean } export const RenderReasonDropdown = (props: Props) => { - const { reason, otherReason, onReasonChange, isExcluded, creationDate } = - props + const { + reason, + otherReason, + onReasonChange, + isExcluded, + creationDate, + } = props const { formatMessage } = useIntl() const handles = useCssHandles(CSS_HANDLES) diff --git a/react/store/createReturnRequest/components/ReturnDetails.tsx b/react/store/createReturnRequest/components/ReturnDetails.tsx index 601f2b26d..79a869d5f 100644 --- a/react/store/createReturnRequest/components/ReturnDetails.tsx +++ b/react/store/createReturnRequest/components/ReturnDetails.tsx @@ -1,6 +1,5 @@ import React from 'react' import { FormattedDate, FormattedMessage } from 'react-intl' -import type { RouteComponentProps } from 'react-router' import type { ShippingData } from 'vtex.return-app' import { useCssHandles } from 'vtex.css-handles' import { Divider, Button } from 'vtex.styleguide' @@ -30,12 +29,11 @@ interface Props { } export const ReturnDetails = ( - props: RouteComponentProps<{ orderId: string }> & Props + props: any & Props ) => { + const orderId = props?.match?.params?.orderId || props?.params?.orderId + const { - match: { - params: { orderId }, - }, onPageChange, items, creationDate, @@ -64,7 +62,7 @@ export const ReturnDetails = (
- +
@@ -73,7 +71,7 @@ export const ReturnDetails = ( >
- +
{orderId}
@@ -85,7 +83,7 @@ export const ReturnDetails = ( >
- +
@@ -102,7 +100,7 @@ export const ReturnDetails = (
- +
@@ -112,7 +110,7 @@ export const ReturnDetails = (
- +
@@ -125,14 +123,14 @@ export const ReturnDetails = (
- +
diff --git a/react/store/createReturnRequest/components/ReturnInformationTable.tsx b/react/store/createReturnRequest/components/ReturnInformationTable.tsx index 6ddaf35d2..9cba418b7 100644 --- a/react/store/createReturnRequest/components/ReturnInformationTable.tsx +++ b/react/store/createReturnRequest/components/ReturnInformationTable.tsx @@ -38,12 +38,12 @@ export const ReturnInformationTable = ({ items, selectedItems }: Props) => {
@@ -73,7 +73,7 @@ export const ReturnInformationTable = ({ items, selectedItems }: Props) => { {!condition ? null : (

- +

{formatMessage( @@ -85,7 +85,7 @@ export const ReturnInformationTable = ({ items, selectedItems }: Props) => {

{' '} - {' '} + {' '}

{returnReason?.otherReason diff --git a/react/store/createReturnRequest/components/TermsAndConditions.tsx b/react/store/createReturnRequest/components/TermsAndConditions.tsx index 1424f0a79..3fbbcacdd 100644 --- a/react/store/createReturnRequest/components/TermsAndConditions.tsx +++ b/react/store/createReturnRequest/components/TermsAndConditions.tsx @@ -13,6 +13,7 @@ const CSS_HANDLES = [ 'termsAndConditionsLink', ] as const + export const TermsAndConditions = () => { const { termsAndConditions, @@ -44,7 +45,7 @@ export const TermsAndConditions = () => { key="formAgreeCheckbox" label={ @@ -54,7 +55,7 @@ export const TermsAndConditions = () => { target="_blank" href={data?.termsUrl} > - + ), @@ -69,7 +70,7 @@ export const TermsAndConditions = () => { + } /> ) : null} diff --git a/react/store/createReturnRequest/components/UserCommentDetails.tsx b/react/store/createReturnRequest/components/UserCommentDetails.tsx index 3671815e5..df147220f 100644 --- a/react/store/createReturnRequest/components/UserCommentDetails.tsx +++ b/react/store/createReturnRequest/components/UserCommentDetails.tsx @@ -30,7 +30,7 @@ export const UserCommentDetails = () => { return (

- +

- + - +