From 877941002d32d059aa0958a1c452b93137f518e4 Mon Sep 17 00:00:00 2001 From: giurigaud Date: Wed, 18 Sep 2024 17:17:01 -0300 Subject: [PATCH 1/7] fix: return from skuFromRefIds --- CHANGELOG.md | 4 ++++ node/resolvers/search/index.ts | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e59388a..8e3ff9fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Fixed the return from skuFromRefIds and improve the return from getSkuSellerInfo + ## [3.15.8] - 2024-10-02 ### Fixed diff --git a/node/resolvers/search/index.ts b/node/resolvers/search/index.ts index a4501393..1cd0a0da 100644 --- a/node/resolvers/search/index.ts +++ b/node/resolvers/search/index.ts @@ -136,16 +136,16 @@ const getSkuSellers = async ( .then((res: any) => { const validSellers = res.data?.SkuSellers ? res.data.SkuSellers.filter((seller: any) => { - // check if seller is active and available in current sales channel - return ( - seller.IsActive === true && sellersIds.has(seller.SellerId) - ) - }).map(({ SellerId }: any) => { - return { - id: SellerId, - name: sellerIdNameMap.get(SellerId), - } - }) + // check if seller is active and available in current sales channel + return ( + seller.IsActive === true && sellersIds.has(seller.SellerId) + ) + }).map(({ SellerId }: any) => { + return { + id: SellerId, + name: sellerIdNameMap.get(SellerId), + } + }) : null return { @@ -303,7 +303,7 @@ export const queries = { } else { // ensures that each item in the result array has a sellers array that only includes sellers with a defined and non-null availability property. // If no such sellers exist, the sellers array will be empty. - items = result.map((item: { sellers: any[] }) => ({ + items = result.map((item: { sellers: any[] }) => ({ ...item, sellers: item.sellers?.filter((seller: any) => 'availability' in seller && From b4eb9f8c939b5c9a5644250ea2cf41b802b36fce Mon Sep 17 00:00:00 2001 From: Josmar Soares Trigueiro Junior Date: Wed, 25 Sep 2024 13:50:15 -0300 Subject: [PATCH 2/7] fix: differentiates message displayed in the status column for inactive skus --- messages/ar.json | 3 ++- messages/context.json | 3 ++- messages/en.json | 1 + messages/es.json | 3 ++- messages/id.json | 3 ++- messages/ko.json | 3 ++- messages/pt.json | 3 ++- messages/ro.json | 3 ++- node/yarn.lock | 2 +- react/TextAreaBlock.tsx | 1 + react/components/ReviewBlock.tsx | 39 ++++++++++++++++++++++++-------- react/utils/messages.ts | 3 +++ 12 files changed, 49 insertions(+), 18 deletions(-) diff --git a/messages/ar.json b/messages/ar.json index 65ce6c03..428fbd1d 100644 --- a/messages/ar.json +++ b/messages/ar.json @@ -35,6 +35,7 @@ "store/quickorder.available": "متاحة", "store/quickorder.back": "عودة", "store/quickorder.cannotBeDelivered": "لا يمكن تسليمه", + "store/quickorder.inactive": "غير متوفر", "store/quickorder.cannotGetSkuInfo": "تعذر الحصول على معلومات وحدة SKU", "store/quickorder.category.addButton": "إضافة عناصر إلى العربة", "store/quickorder.category.loading": "جاري التحميل...", @@ -63,4 +64,4 @@ "store/toaster.cart.error": "خطأ في إضافة المنتجات إلى عربة التسوق", "store/toaster.cart.seeCart": "مشاهدة العربة", "store/toaster.cart.success": "تم إضافة المنتجات بنجاح إلى عربة التسوق" -} \ No newline at end of file +} diff --git a/messages/context.json b/messages/context.json index 452e9d2a..04475e5c 100644 --- a/messages/context.json +++ b/messages/context.json @@ -35,6 +35,7 @@ "store/quickorder.available": "store/quickorder.available", "store/quickorder.back": "store/quickorder.back", "store/quickorder.cannotBeDelivered": "store/quickorder.cannotBeDelivered", + "store/quickorder.inactive": "store/quickorder.inactive", "store/quickorder.cannotGetSkuInfo": "store/quickorder.cannotGetSkuInfo", "store/quickorder.category.addButton": "store/quickorder.category.addButton", "store/quickorder.category.loading": "store/quickorder.category.loading", @@ -63,4 +64,4 @@ "store/toaster.cart.error": "store/toaster.cart.error", "store/toaster.cart.seeCart": "store/toaster.cart.seeCart", "store/toaster.cart.success": "store/toaster.cart.success" -} \ No newline at end of file +} diff --git a/messages/en.json b/messages/en.json index 7ff993fb..e3f90db2 100644 --- a/messages/en.json +++ b/messages/en.json @@ -35,6 +35,7 @@ "store/quickorder.available": "Available", "store/quickorder.back": "Back", "store/quickorder.cannotBeDelivered": "Cannot be delivered", + "store/quickorder.inactive": "Unavailable", "store/quickorder.cannotGetSkuInfo": "Could not get SKU information", "store/quickorder.category.addButton": "Add items to Cart", "store/quickorder.category.loading": "Loading...", diff --git a/messages/es.json b/messages/es.json index c661ee9c..bea7d92d 100644 --- a/messages/es.json +++ b/messages/es.json @@ -35,6 +35,7 @@ "store/quickorder.available": "Disponible", "store/quickorder.back": "Atrás", "store/quickorder.cannotBeDelivered": "No se puede entregar", + "store/quickorder.inactive": "No disponible", "store/quickorder.cannotGetSkuInfo": "No se pudo obtener la información de SKU", "store/quickorder.category.addButton": "Agregar ítems al carrito", "store/quickorder.category.loading": "Cargando...", @@ -63,4 +64,4 @@ "store/toaster.cart.error": "Error al agregar productos al carrito", "store/toaster.cart.seeCart": "Ver el carrito", "store/toaster.cart.success": "Productos agregados correctamente" -} \ No newline at end of file +} diff --git a/messages/id.json b/messages/id.json index 40492a42..a0bb0795 100644 --- a/messages/id.json +++ b/messages/id.json @@ -35,6 +35,7 @@ "store/quickorder.available": "Tersedia", "store/quickorder.back": "Kembali", "store/quickorder.cannotBeDelivered": "Tidak dapat dikirimkan", + "store/quickorder.inactive": "Tidak tersedia", "store/quickorder.cannotGetSkuInfo": "Tidak bisa mendapat informasi SKU", "store/quickorder.category.addButton": "Tambahkan item ke Troli", "store/quickorder.category.loading": "Memuat…", @@ -63,4 +64,4 @@ "store/toaster.cart.error": "Terjadi kesalahan saat menambahkan produk ke troli", "store/toaster.cart.seeCart": "Lihat troli", "store/toaster.cart.success": "Produk berhasil ditambahkan ke troli" -} \ No newline at end of file +} diff --git a/messages/ko.json b/messages/ko.json index 76af4291..d865bfb7 100644 --- a/messages/ko.json +++ b/messages/ko.json @@ -35,6 +35,7 @@ "store/quickorder.available": "주문 가능", "store/quickorder.back": "뒤", "store/quickorder.cannotBeDelivered": "배송 불가", + "store/quickorder.inactive": "사용 불가능", "store/quickorder.cannotGetSkuInfo": "SKU 정보를 가져올 수 없습니다", "store/quickorder.category.addButton": "장바구니가 비어있습니다", "store/quickorder.category.loading": "로딩 중...", @@ -63,4 +64,4 @@ "store/toaster.cart.error": "장바구니에 담기가 실패하였습니다", "store/toaster.cart.seeCart": "장바구니", "store/toaster.cart.success": "장바구니에 제품을 추가했습니다" -} \ No newline at end of file +} diff --git a/messages/pt.json b/messages/pt.json index c6097752..42285bcd 100644 --- a/messages/pt.json +++ b/messages/pt.json @@ -35,6 +35,7 @@ "store/quickorder.available": "Disponível", "store/quickorder.back": "Voltar", "store/quickorder.cannotBeDelivered": "Não pode ser entregue", + "store/quickorder.inactive": "Indisponível", "store/quickorder.cannotGetSkuInfo": "Não foi possível obter informações do SKU", "store/quickorder.category.addButton": "Adicionar itens ao carrinho", "store/quickorder.category.loading": "Carregando...", @@ -63,4 +64,4 @@ "store/toaster.cart.error": "Erro adicionando produtos ao carrinho", "store/toaster.cart.seeCart": "Ver o carrinho", "store/toaster.cart.success": "Produtos adicionados com sucesso" -} \ No newline at end of file +} diff --git a/messages/ro.json b/messages/ro.json index 2abe0a06..853d1817 100644 --- a/messages/ro.json +++ b/messages/ro.json @@ -35,6 +35,7 @@ "store/quickorder.available": "Disponibil", "store/quickorder.back": "Inapoi", "store/quickorder.cannotBeDelivered": "Nu poate fi livrat", + "store/quickorder.inactive": "Indisponibil", "store/quickorder.cannotGetSkuInfo": "Nu s-au primit informațiile SKU", "store/quickorder.category.addButton": "Adauga articole in carucior", "store/quickorder.category.loading": "Se incarca...", @@ -63,4 +64,4 @@ "store/toaster.cart.error": "Eroare la adaugarea produselor in cos", "store/toaster.cart.seeCart": "Vezi cos", "store/toaster.cart.success": "Produse adaugate in cos" -} \ No newline at end of file +} diff --git a/node/yarn.lock b/node/yarn.lock index 6ee9c44f..27be11ef 100644 --- a/node/yarn.lock +++ b/node/yarn.lock @@ -6071,7 +6071,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: diff --git a/react/TextAreaBlock.tsx b/react/TextAreaBlock.tsx index d992ad4a..882e01af 100644 --- a/react/TextAreaBlock.tsx +++ b/react/TextAreaBlock.tsx @@ -310,6 +310,7 @@ const TextAreaBlock: FunctionComponent< reviewedItems={reviewItems} hiddenColumns={hiddenColumns ?? []} onReviewItems={onReviewItems} + refidLoading={refidLoading} onRefidLoading={onRefidLoading} backList={backList} /> diff --git a/react/components/ReviewBlock.tsx b/react/components/ReviewBlock.tsx index 81962bdb..05c77c9e 100644 --- a/react/components/ReviewBlock.tsx +++ b/react/components/ReviewBlock.tsx @@ -30,6 +30,7 @@ const ReviewBlock: FunctionComponent = ({ onReviewItems, hiddenColumns, reviewedItems, + refidLoading, onRefidLoading, intl, backList, @@ -92,6 +93,7 @@ const ReviewBlock: FunctionComponent = ({ messages.withoutPriceFulfillment, 'store/quickorder.limited': messages.limited, 'store/quickorder.cannotBeDelivered': messages.cannotBeDelivered, + 'store/quickorder.inactive': messages.inactive, 'store/quickorder.ORD002': messages.ORD002, 'store/quickorder.ORD003': messages.ORD003, 'store/quickorder.ORD004': messages.ORD004, @@ -125,13 +127,14 @@ const ReviewBlock: FunctionComponent = ({ const validateRefids = async (refidData: any, reviewed: any) => { let error = false - // drops sellers without stock from refidData + // drops sellers from refidData refidData?.skuFromRefIds.items.forEach((item: any) => { if (!item?.sellers) return item.sellers = item.sellers.filter( (seller: any) => seller?.availability === 'available' || - seller?.availability === 'partiallyAvailable' + seller?.availability === 'partiallyAvailable' || + seller?.availability === 'withoutStock' ) }) @@ -218,6 +221,10 @@ const ReviewBlock: FunctionComponent = ({ ? partialStockError : `store/quickorder.withoutStock` + if (found?.sku && found?.sellers?.length === 0) { + return 'store/quickorder.inactive' + } + ret = notfound ? 'store/quickorder.skuNotFound' : availabilityError ?? itemRestricted @@ -525,12 +532,14 @@ const ReviewBlock: FunctionComponent = ({ return (
{ - return { - label: item.name, - value: item.id, - } - })} + options={rowData.sellers + .filter((seller) => seller?.availability !== 'withoutStock') + .map((item: any) => { + return { + label: item.name, + value: item.id, + } + })} value={rowData.seller} onChange={(_: any, v: any) => { updateLineSeller(rowData.index, v) @@ -540,7 +549,14 @@ const ReviewBlock: FunctionComponent = ({ ) } - return rowData?.sellers?.length ? rowData.sellers[0].name : '' + const hasStock = rowData?.sellers?.find( + (seller?: { availability: string; [key: string]: unknown }) => + seller?.availability !== 'withoutStock' + ) + + return rowData?.sellers?.length && hasStock + ? rowData.sellers[0].name + : '' }, } } @@ -572,7 +588,10 @@ const ReviewBlock: FunctionComponent = ({ ) } - return intl.formatMessage({ id: 'store/quickorder.valid' }) + return ( + !refidLoading && + intl.formatMessage({ id: 'store/quickorder.valid' }) + ) }, } } diff --git a/react/utils/messages.ts b/react/utils/messages.ts index 69c86022..dccfb8e6 100644 --- a/react/utils/messages.ts +++ b/react/utils/messages.ts @@ -31,6 +31,9 @@ export const reviewMessages = defineMessages({ cannotBeDelivered: { id: `${storePrefix}cannotBeDelivered`, }, + inactive: { + id: `${storePrefix}inactive`, + }, ORD002: { id: `${storePrefix}ORD002`, }, From 7b7d5d1419589268139452b8d7a1912766042761 Mon Sep 17 00:00:00 2001 From: Josmar Soares Trigueiro Junior Date: Wed, 25 Sep 2024 14:07:11 -0300 Subject: [PATCH 3/7] doc: update change log file --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e3ff9fe..bae71de3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed +- Fixed the message in the status column of the SKU table, specifically inactive skus + +### Fixed + - Fixed the return from skuFromRefIds and improve the return from getSkuSellerInfo ## [3.15.8] - 2024-10-02 From ebcf8c44be887123f4e4a355d5e4d19097c40d9b Mon Sep 17 00:00:00 2001 From: Josmar Junior Date: Tue, 1 Oct 2024 11:42:53 -0300 Subject: [PATCH 4/7] Update messages/es.json Co-authored-by: ataideverton <56592231+ataideverton@users.noreply.github.com> --- messages/es.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messages/es.json b/messages/es.json index bea7d92d..5f4c5ac8 100644 --- a/messages/es.json +++ b/messages/es.json @@ -35,7 +35,7 @@ "store/quickorder.available": "Disponible", "store/quickorder.back": "Atrás", "store/quickorder.cannotBeDelivered": "No se puede entregar", - "store/quickorder.inactive": "No disponible", + "store/quickorder.inactive": "Indisponible", "store/quickorder.cannotGetSkuInfo": "No se pudo obtener la información de SKU", "store/quickorder.category.addButton": "Agregar ítems al carrito", "store/quickorder.category.loading": "Cargando...", From aeba95d0882a15b743da87bd761cfc66e1e5acbd Mon Sep 17 00:00:00 2001 From: Josmar Junior Date: Tue, 1 Oct 2024 11:46:22 -0300 Subject: [PATCH 5/7] Update CHANGELOG.md Co-authored-by: ataideverton <56592231+ataideverton@users.noreply.github.com> --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bae71de3..e3cb67f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed +- Fixed the message in the status column of the SKU table, specifically inactive skus +- Fixed the return from skuFromRefIds and improve the return from getSkuSellerInfo + - Fixed the message in the status column of the SKU table, specifically inactive skus ### Fixed From 598162032ecd73b3b030dbb5ae37929453ceeb78 Mon Sep 17 00:00:00 2001 From: Josmar Junior Date: Tue, 1 Oct 2024 11:47:48 -0300 Subject: [PATCH 6/7] Update CHANGELOG.md --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3cb67f4..80edc4e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed the message in the status column of the SKU table, specifically inactive skus - Fixed the return from skuFromRefIds and improve the return from getSkuSellerInfo -- Fixed the message in the status column of the SKU table, specifically inactive skus - ### Fixed - Fixed the return from skuFromRefIds and improve the return from getSkuSellerInfo From 9a8f68acff8db8130e2d5951f801122e73500177 Mon Sep 17 00:00:00 2001 From: Josmar Junior Date: Tue, 1 Oct 2024 11:49:02 -0300 Subject: [PATCH 7/7] Update CHANGELOG.md --- CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80edc4e0..2312f0a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,10 +12,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed the message in the status column of the SKU table, specifically inactive skus - Fixed the return from skuFromRefIds and improve the return from getSkuSellerInfo -### Fixed - -- Fixed the return from skuFromRefIds and improve the return from getSkuSellerInfo - ## [3.15.8] - 2024-10-02 ### Fixed