diff --git a/README.md b/README.md index f30b43b..a7d09a3 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ There are several preset schema components that can be used - Author - ItemReviewed - Location +- Offer - Product - Question - Rating diff --git a/src/core/schemas/Offer.js b/src/core/schemas/Offer.js new file mode 100644 index 0000000..4f8e1df --- /dev/null +++ b/src/core/schemas/Offer.js @@ -0,0 +1,16 @@ +import JSONLDAbstractNode from '../JSONLDAbstractNode'; + +class Offer extends JSONLDAbstractNode { + getJSON(isFirstChildNode = false, schema) { + const parseChildren = super.parseChildren(); + const details = { + '@type': 'Offer', + ...schema + } + return isFirstChildNode + ? Object.assign(details, ...parseChildren) + : Object.assign({offer: details}, ...parseChildren); + } +} + +export default Offer; diff --git a/src/core/schemas/index.js b/src/core/schemas/index.js index 969e9f6..a7e6b3f 100644 --- a/src/core/schemas/index.js +++ b/src/core/schemas/index.js @@ -11,3 +11,4 @@ export { default as ItemReviewed } from './ItemReviewed'; export { default as Question } from './Question'; export { default as Answer } from './Answer'; export { default as Graph } from './Graph'; +export { default as Offer } from './Offer';