Skip to content

Commit

Permalink
Merge 135d336 into 87de50e
Browse files Browse the repository at this point in the history
  • Loading branch information
jgfidelis committed Mar 3, 2020
2 parents 87de50e + 135d336 commit 5865d80
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- `ProductSummaryList`: `installmentCriteria` prop to use in `products` query.
- `ProductSummaryList`: Messages and translations to be able to edit `skusFilter` and `installmentCriteria` in site editor.

### Fixed
- Props passed to `ProductSummaryList`

## [2.51.7] - 2020-03-02
### Changed
Expand Down
17 changes: 17 additions & 0 deletions docs/ProductSummaryList.md
Expand Up @@ -35,3 +35,20 @@ This block is used to specify what variation of `product-summary` to be used to
| `orderBy` | `Enum` | Ordination type of the items. Possible values: `OrderByTopSaleDESC`, `OrderByReleaseDateDESC`, `OrderByBestDiscountDESC`, `OrderByPriceDESC`, `OrderByPriceASC`, `OrderByNameASC`, `OrderByNameDESC` | `OrderByTopSaleDESC` |
| `hideUnavailableItems` | `Boolean` | Hides items that are unavailable. | `false` |
| `maxItems` | `Number` | Maximum items to be fetched. | `10` |
| `skusFilter` | `SkusFilterEnum` | Control SKUs returned for each product in the query. The less SKUs needed to be returned, the more performant your shelf query will be. | `"ALL_AVAILABLE"` |
| `installmentCriteria` | `InstallmentCriteriaEnum` | ControlControl what price to be shown when price has different installments options. | `"MAX_WITHOUT_INTEREST"` |

For `SkusFilterEnum`:

| Name | Value | Description |
| ---- | ----- | ----------- |
| First Available | `FIRST_AVAILABLE` | Most performant, ideal if you do not have a SKU selector in your shelf. Will return only the first available SKU for that product in your shelf query. |
| All Available | `ALL_AVAILABLE` | A bit better performace, will only return SKUs that are available, ideal if you have a SKU selector but still want a better performance. |
| All | `ALL` | Returns all SKUs related to that product, least performant option. |

For `InstallmentCriteriaEnum`:

| Name | Value | Description |
| ---- | ----- | ----------- |
| Maximum without interest | `MAX_WITHOUT_INTEREST` | Will display the maximum installment option with no interest. |
| Maximum | `MAX_WITH_INTEREST` | Will display the maximum installment option having interest or not. |
11 changes: 10 additions & 1 deletion messages/context.json
Expand Up @@ -54,5 +54,14 @@
"admin/editor.productSummaryList.orderType.nameDesc": "Name, descending",
"admin/editor.productSummaryList.orderType.releaseDate": "Release Date",
"admin/editor.productSummaryList.orderType.discount": "Discount",
"admin/editor.productSummaryList.orderType.relevance": "Relevance"
"admin/editor.productSummaryList.orderType.relevance": "Relevance",
"admin/editor.productSummaryList.skusFilter.title": "Title of skus filter property",
"admin/editor.productSummaryList.skusFilter.description": "Description of skus filter property",
"admin/editor.productSummaryList.skusFilter.none": "Value none of skus filter enum",
"admin/editor.productSummaryList.skusFilter.first-available": "Value first available of skus filter enum",
"admin/editor.productSummaryList.skusFilter.all-available": "Value all available of skus filter enum",
"admin/editor.productSummaryList.installmentCriteria.title": "Title of installment criteria property",
"admin/editor.productSummaryList.installmentCriteria.description": "Description of installment criteria property",
"admin/editor.productSummaryList.installmentCriteria.max-without-interest": "Maximum without interest enum name",
"admin/editor.productSummaryList.installmentCriteria.max-with-interest": "Maximum with interest enum name"
}
11 changes: 10 additions & 1 deletion messages/en.json
Expand Up @@ -54,5 +54,14 @@
"admin/editor.productSummaryList.orderType.nameDesc": "Name, descending",
"admin/editor.productSummaryList.orderType.releaseDate": "Release Date",
"admin/editor.productSummaryList.orderType.discount": "Discount",
"admin/editor.productSummaryList.orderType.relevance": "Relevance"
"admin/editor.productSummaryList.orderType.relevance": "Relevance",
"admin/editor.productSummaryList.skusFilter.title": "SKUs Filter",
"admin/editor.productSummaryList.skusFilter.description": "Setting the first available filter might make your query much faster!",
"admin/editor.productSummaryList.skusFilter.none": "None",
"admin/editor.productSummaryList.skusFilter.first-available": "First available",
"admin/editor.productSummaryList.skusFilter.all-available": "All available",
"admin/editor.productSummaryList.installmentCriteria.title": "Displayed installments",
"admin/editor.productSummaryList.installmentCriteria.description": "Choose what type of installments to be showed (e.g.: maximum without interest or with interest).",
"admin/editor.productSummaryList.installmentCriteria.max-without-interest": "Maximum without interest",
"admin/editor.productSummaryList.installmentCriteria.max-with-interest": "Maximum"
}
11 changes: 10 additions & 1 deletion messages/es.json
Expand Up @@ -54,5 +54,14 @@
"admin/editor.productSummaryList.orderType.nameDesc": "Nombre, descendiendo",
"admin/editor.productSummaryList.orderType.releaseDate": "Fecha de lanzamiento",
"admin/editor.productSummaryList.orderType.discount": "Descuento",
"admin/editor.productSummaryList.orderType.relevance": "Relevancia"
"admin/editor.productSummaryList.orderType.relevance": "Relevancia",
"admin/editor.productSummaryList.skusFilter.title": "Filtro de SKUs",
"admin/editor.productSummaryList.skusFilter.description": "¡Establecer el primer iten disponible agiliza su consulta!",
"admin/editor.productSummaryList.skusFilter.none": "Ninguno",
"admin/editor.productSummaryList.skusFilter.first-available": "Primero disponible",
"admin/editor.productSummaryList.skusFilter.all-available": "Todos disponibles",
"admin/editor.productSummaryList.installmentCriteria.title": "Criterio de cuotas",
"admin/editor.productSummaryList.installmentCriteria.description": "Elija qué tipo de cuota se mostrará en los productos (p. Ej., Máximo sin interés o con interés).",
"admin/editor.productSummaryList.installmentCriteria.max-without-interest": "Máximo sin interés",
"admin/editor.productSummaryList.installmentCriteria.max-with-interest": "Máximo"
}
11 changes: 10 additions & 1 deletion messages/pt.json
Expand Up @@ -54,5 +54,14 @@
"admin/editor.productSummaryList.orderType.nameDesc": "Nome, decrescente",
"admin/editor.productSummaryList.orderType.releaseDate": "Data de lançamento",
"admin/editor.productSummaryList.orderType.discount": "Desconto",
"admin/editor.productSummaryList.orderType.relevance": "Relevância"
"admin/editor.productSummaryList.orderType.relevance": "Relevância",
"admin/editor.productSummaryList.skusFilter.title": "Filtro de SKUs",
"admin/editor.productSummaryList.skusFilter.description": "Configurando o valor de primeiro disponível pode fazer sua query ser mais rápida!",
"admin/editor.productSummaryList.skusFilter.none": "Nenhum",
"admin/editor.productSummaryList.skusFilter.first-available": "Primeiro Disponível",
"admin/editor.productSummaryList.skusFilter.all-available": "Todos Disponíveis",
"admin/editor.productSummaryList.installmentCriteria.title": "Parcelamento",
"admin/editor.productSummaryList.installmentCriteria.description": "Escolha qual tipo de parcelamento a ser mostrado nos produtos (ex.: máximo sem juros, ou com juros).",
"admin/editor.productSummaryList.installmentCriteria.max-without-interest": "Máxima sem juros",
"admin/editor.productSummaryList.installmentCriteria.max-with-interest": "Máxima"
}
30 changes: 27 additions & 3 deletions react/ProductSummaryList.js
Expand Up @@ -60,9 +60,9 @@ const ProductSummaryList = ({
specificationFilters = [],
maxItems = 10,
skusFilter,
installmentCriteria,
}) => {
const { data, loading, error } = useQuery(productsQuery, {
name: 'productList',
variables: {
category,
...(collection != null
Expand All @@ -76,6 +76,7 @@ const ProductSummaryList = ({
to: maxItems - 1,
hideUnavailableItems,
skusFilter,
installmentCriteria,
},
})

Expand Down Expand Up @@ -114,12 +115,12 @@ const ProductSummaryList = ({
)
}

const EnhancedProductList = ({ children }) => {
const EnhancedProductList = ({ children, ...props }) => {
const { ProductListProvider } = ProductListContext

return (
<ProductListProvider>
<ProductSummaryList>{children}</ProductSummaryList>
<ProductSummaryList {...props}>{children}</ProductSummaryList>
<ProductListEventCaller />
</ProductListProvider>
)
Expand Down Expand Up @@ -182,6 +183,29 @@ EnhancedProductList.getSchema = () => ({
isLayout: false,
default: 10,
},
skusFilter: {
title: 'admin/editor.productSummaryList.skusFilter.title',
description: 'admin/editor.productSummaryList.skusFilter.description',
type: 'string',
default: 'ALL_AVAILABLE',
enum: ['ALL_AVAILABLE', 'ALL', 'FIRST_AVAILABLE'],
enumNames: [
'admin/editor.productSummaryList.skusFilter.all-available',
'admin/editor.productSummaryList.skusFilter.none',
'admin/editor.productSummaryList.skusFilter.first-available'
]
},
installmentCriteria: {
title: 'admin/editor.productSummaryList.installmentCriteria.title',
description: 'admin/editor.productSummaryList.installmentCriteria.description',
type: 'string',
default: 'MAX_WITHOUT_INTEREST',
enum: ['MAX_WITHOUT_INTEREST', 'MAX_WITH_INTEREST'],
enumNames: [
'admin/editor.productSummaryList.installmentCriteria.max-without-interest',
'admin/editor.productSummaryList.installmentCriteria.max-with-interest'
]
},
},
})

Expand Down

0 comments on commit 5865d80

Please sign in to comment.