Skip to content

ProductReviewModule

Module in @evolve-framework/commercetools

Product reviews on commercetools' own reviews: the approved ones and how their ratings spread on a product, and writing one from a delivered order line.

import { ProductReviewModule } from "@evolve-framework/commercetools";

Serves the Product review part of the GraphQL API: productReviewCreate, productReviewPhotoUpload.

new ProductReviewModule(options?: ProductReviewModuleOptions)
OptionTypeDescription
customTypeKey?string

The review type with variantSku (String), fit (String), verifiedPurchase (Boolean), photoUrls (Set of String) and, with photos, photoIds (Set of String) fields. Without one, a review keeps only its rating, title and text.

photos?AttachmentStore

Where buyers upload a review's photos, such as storageAttachmentStore; a review takes the image types it accepts. Needs customTypeKey, which keeps their handles. Without one, a review takes no photos.

rejectedStateKey?string

The state a moderator moves a refused review to. Defaults to ReviewRejected.

AttachmentStore3The fields of photos.
FieldTypeDescription
contentTypesstring[]

The content types it accepts, such as image/jpeg.

createUpload(request: { filename: string; contentType: string; customerId: string; }) => Promise<{ attachmentId: string; uploadUrl: string; expiresAt: string; }>
read(attachmentId: string, customerId: string) => Promise<StoredAttachment | undefined>

Undefined when the id is unknown, was never uploaded, or is not the customer's.

Extends AbstractModule<CommercetoolsLoaderContext>.