Michael Bromley 3af21d5486 chore: Update github org name in links 1 週間 前
..
api 436c7b9d37 fix(dashboard): Form control rendering 6 ヶ月 前
dashboard 112cb9d9e8 feat(dashboard): Support localization for dashboard extensions (#3962) 2 ヶ月 前
entities 155f376997 feat(dashboard): Custom form components for custom fields (#3610) 6 ヶ月 前
ui 6c21cc90c1 chore(docs): Update code block language code 2 年 前
.gitignore 2b9ce33915 chore(dev-server): Add test plugins for new UI extension APIs 2 年 前
README.md 2b9ce33915 chore(dev-server): Add test plugins for new UI extension APIs 2 年 前
generated-admin-types.ts 6c21cc90c1 chore(docs): Update code block language code 2 年 前
generated-shop-types.ts 6c21cc90c1 chore(docs): Update code block language code 2 年 前
index.ts e445bdb85d feat(dashboard): Support compilation of external plugins (#3663) 6 ヶ月 前
package.json 3af21d5486 chore: Update github org name in links 1 週間 前
reviews-plugin.ts ced9371b4b feat(dashboard): Add handleNestedFormSubmit utility for nested forms (#3835) 3 ヶ月 前
tsconfig.json e445bdb85d feat(dashboard): Support compilation of external plugins (#3663) 6 ヶ月 前
types.ts 2b9ce33915 chore(dev-server): Add test plugins for new UI extension APIs 2 年 前

README.md

Reviews Plugin

The reviews plugin add product reviews to Vendure.

Screenshot of the Admin UI product details page with reviews

This plugin demonstrates many capabilities of the Vendure plugin system:

  • Creation of new database entities (see ./entities)
  • Extension of the GraphQL APIs with new types, extensions of existing types, new queries and new mutations (see ./api/api-extensions.ts)
  • Implementation of custom resolvers for those GraphQL extensions (e.g. ./api/product-entity.resolver.ts)
  • Modifying the VendureConfig to add CustomFields (see ./reviews-plugin.ts)
  • Extending the Admin UI with custom UI components for those CustomFields as well as list and details views for managing reviews.
  • Adding a custom widget to the Admin UI dashboard
  • End-to-end testing of the GraphQL extensions & business logic with Vitest & the @vendure/testing package.

Usage

Start the Vendure server and then in the Shop API (http://localhost:3000/shop-api) try the following mutation:

mutation {
  submitProductReview(input: {
    productId: 2
    summary: "Good tablet"
    body: "The screen is clear, bright and sharp!"
    rating: 5
    authorName: "Joe Smith"
    authorLocation: "London"
  }) {
    id
    state
  }
}

You should then be able to log into the Admin UI (http://localhost:3000/admin) and see the new "Product Reviews" menu item on the left. Clicking this takes you to a brand new extension module listing all product reviews. You can approve the review that was just submitted.

When viewing the Tablet product (http://localhost:3000/admin/catalog/inventory/2) you'll now see the review rating and count which make use of the custom UI controls defined in the ui extension.