Skip to content

Commit

Permalink
Merge b04cbe3 into a615252
Browse files Browse the repository at this point in the history
  • Loading branch information
estacioneto committed May 27, 2019
2 parents a615252 + b04cbe3 commit 4e92703
Show file tree
Hide file tree
Showing 47 changed files with 63 additions and 29 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,9 @@ 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
- `contentSchemas.json` for definition of content properties.
- i18n content edition support through CMS.

## [2.21.0] - 2019-05-21
### Fixed
Expand Down
6 changes: 4 additions & 2 deletions manifest.json
Expand Up @@ -15,9 +15,11 @@
"postreleasy": "vtex publish --verbose"
},
"dependencies": {
"vtex.native-types": "0.x",
"vtex.store-components": "3.x",
"vtex.store-resources": "0.x",
"vtex.product-review-interfaces": "1.x",
"vtex.styleguide": "9.x"
}
}
},
"$schema": "https://raw.githubusercontent.com/vtex/node-vtex-api/master/gen/manifest.schema"
}
4 changes: 4 additions & 0 deletions react/__mocks__/vtex.native-types/index.js
@@ -0,0 +1,4 @@
import React from 'react'
import { FormattedMessage } from 'react-intl'

export const IOMessage = props => <FormattedMessage {...props} />
12 changes: 11 additions & 1 deletion react/__tests__/ProductSummary.test.js
@@ -1,11 +1,19 @@
import React from 'react'
import { render } from '@vtex/test-tools/react'
const fs = require('fs')

import ProductSummary from '../legacy/index'

describe('<ProductSummary /> component', () => {
// TODO: Remove this later when we have a better way to resolve contentSchemas.json at test-tools
const rawData = fs.readFileSync('../store/contentSchemas.json')
const contentSchema = JSON.parse(rawData)
const buyButtonText =
contentSchema.definitions.ProductSummary.properties.buyButtonText.default

const props = {
runtime: { hints: {} },
buyButtonText,
product: {
productId: '123456789',
linkText: 'linkText',
Expand Down Expand Up @@ -101,7 +109,9 @@ describe('<ProductSummary /> component', () => {
describe('Site editor editable', () => {
it('should export getSchema and return object with title', () => {
const schema = ProductSummary.schema || ProductSummary.getSchema({})
expect(schema).toEqual(expect.objectContaining({title: expect.any(String)}))
expect(schema).toEqual(
expect.objectContaining({ title: expect.any(String) })
)
})
})
})
Expand Up @@ -3,7 +3,7 @@ import BuyButton from 'vtex.store-components/BuyButton'
import { withRuntimeContext } from 'vtex.render-runtime'
import { equals, path } from 'ramda'
import classNames from 'classnames'
import { FormattedMessage } from 'react-intl'
import { IOMessage } from 'vtex.native-types'

import ProductSummaryContext from '../ProductSummaryContext'
import displayButtonTypes, {
Expand Down Expand Up @@ -79,7 +79,7 @@ const ProductSummaryBuyButton = ({
}
isOneClickBuy={isOneClickBuy}
>
{buyButtonText || <FormattedMessage id="store/button-label" />}
<IOMessage id="store/button-label" />
</BuyButton>
</div>
</div>
Expand Down Expand Up @@ -128,11 +128,6 @@ ProductSummaryBuyButton.getSchema = () => {
default: displayButtonTypes.DISPLAY_ALWAYS.value,
isLayout: true,
},
buyButtonText: {
type: 'string',
title: 'admin/editor.productSummary.buyButtonText.title',
isLayout: false,
},
},
}
}
Expand Down
5 changes: 0 additions & 5 deletions react/components/ProductSummaryImage/ProductImage.js
Expand Up @@ -173,11 +173,6 @@ ProductImage.getSchema = () => {
default: ProductImage.defaultProps.showBadge,
isLayout: true,
},
badgeText: {
type: 'string',
title: 'admin/editor.productSummary.badgeText.title',
isLayout: false,
},
showCollections: {
type: 'boolean',
title: 'admin/editor.productSummary.showCollections.title',
Expand Down
4 changes: 2 additions & 2 deletions react/legacy/components/ProductSummaryBuyButton.js
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import BuyButton from 'vtex.store-components/BuyButton'
import { equals, path } from 'ramda'
import classNames from 'classnames'
import { FormattedMessage } from 'react-intl'
import { IOMessage } from 'vtex.native-types'

import displayButtonTypes from '../../utils/displayButtonTypes'
import productSummary from '../../productSummary.css'
Expand Down Expand Up @@ -72,7 +72,7 @@ const ProductSummaryBuyButton = ({
}
isOneClickBuy={isOneClickBuy}
>
{buyButtonText || <FormattedMessage id="store/button-label" />}
<IOMessage id={buyButtonText} />
</BuyButton>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions react/legacy/components/ProductSummaryNormal.js
Expand Up @@ -63,6 +63,7 @@ class ProductSummaryNormal extends Component {

const descriptionClasses = `${productSummary.description} c-muted-2 t-small`


return (
<section
className={containerClasses}
Expand Down
10 changes: 0 additions & 10 deletions react/legacy/index.js
Expand Up @@ -203,16 +203,6 @@ const defaultSchema = {
default: true,
isLayout: true,
},
badgeText: {
type: 'string',
title: 'admin/editor.productSummary.badgeText.title',
isLayout: false,
},
buyButtonText: {
type: 'string',
title: 'admin/editor.productSummary.buyButtonText.title',
isLayout: false,
},
displayBuyButton: {
title: 'admin/editor.productSummary.displayBuyButton.title',
type: 'string',
Expand Down
Binary file removed resources/images/500x500-img-pro1.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro10.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro11.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro12.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro13.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro14.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro15.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro16.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro17.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro18.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro19.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro2.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro20.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro21.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro22.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro23.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro24.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro3.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro4.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro5.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro6.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro7.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro8.png
Binary file not shown.
Binary file removed resources/images/500x500-img-pro9.png
Binary file not shown.
Binary file removed resources/images/imagem-prod-summary1.png
Binary file not shown.
Binary file removed resources/images/imagem-prod-summary10.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary11.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary12.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary2.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary3.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary4.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary5.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary6.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary7.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary8.png
Diff not rendered.
Binary file removed resources/images/imagem-prod-summary9.png
Diff not rendered.
17 changes: 17 additions & 0 deletions store/contentSchemas.json
@@ -0,0 +1,17 @@
{
"definitions": {
"ProductSummary": {
"properties": {
"badgeText": {
"title": "admin/editor.productSummary.badgeText.title",
"$ref": "app:vtex.native-types#/definitions/text"
},
"buyButtonText": {
"title": "admin/editor.productSummary.buyButtonText.title",
"$ref": "app:vtex.native-types#/definitions/text",
"default": "store/button-label"
}
}
}
}
}
21 changes: 19 additions & 2 deletions store/interfaces.json
@@ -1,6 +1,9 @@
{
"product-summary": {
"component": "ProductSummaryLegacy",
"content": {
"$ref": "#/definitions/ProductSummary"
},
"allowed": ["addon-summary-btn"]
},
"product-summary.shelf": {
Expand Down Expand Up @@ -66,13 +69,27 @@
"component": "ProductSummaryAttachmentList"
},
"product-summary-buy-button": {
"component": "ProductSummaryBuyButton"
"component": "ProductSummaryBuyButton",
"content": {
"properties": {
"buyButtonText": {
"$ref": "#/definitions/ProductSummary/properties/buyButtonText"
}
}
}
},
"product-summary-description": {
"component": "ProductSummaryDescription"
},
"product-summary-image": {
"component": "ProductSummaryImage"
"component": "ProductSummaryImage",
"content": {
"properties": {
"badgeText": {
"$ref": "#/definitions/ProductSummary/properties/badgeText"
}
}
}
},
"product-summary-name": {
"component": "ProductSummaryName"
Expand Down

0 comments on commit 4e92703

Please sign in to comment.