@alphabite/medusa-reviews
Version:
Alphabite's Medusa Reviews Plugin
50 lines (49 loc) • 2.62 kB
TypeScript
import { Context } from "@medusajs/framework/types";
import { EntityManager } from "@mikro-orm/knex";
import { z } from "@medusajs/framework/zod";
import { AggregateCounts } from "../../api/store/reviews/types";
declare const optionsSchema: z.ZodObject<{
allowOnlyVerifiedPurchases: z.ZodDefault<z.ZodBoolean>;
allowMultipleReviewsPerProduct: z.ZodDefault<z.ZodBoolean>;
}, z.core.$strip>;
export type AlphabiteReviewsPluginOptionsType = z.infer<typeof optionsSchema>;
export type AlphabiteReviewsPluginOptions = {
/**
* Whether only verified purchases are allowed to leave reviews.
* Default: false
*/
allowOnlyVerifiedPurchases?: boolean;
/**
* Whether a customer can leave multiple reviews for the same product.
* Default: false
*/
allowMultipleReviewsPerProduct?: boolean;
};
export type PluginType = {
resolve: string;
options: {};
};
export type ReviewsPluginType = {
resolve: "@alphabite/medusa-reviews";
options: AlphabiteReviewsPluginOptionsType;
};
declare const ReviewModuleService_base: import("@medusajs/framework/utils").MedusaServiceReturnType<import("@medusajs/framework/utils").ModelConfigurationsToConfigTemplate<{
readonly Review: import("@medusajs/framework/utils").DmlEntity<import("@medusajs/framework/utils").DMLEntitySchemaBuilder<{
id: import("@medusajs/framework/utils").PrimaryKeyModifier<string, import("@medusajs/framework/utils").IdProperty>;
title: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
content: import("@medusajs/framework/utils").NullableModifier<string, import("@medusajs/framework/utils").TextProperty>;
rating: import("@medusajs/framework/utils").NumberProperty;
status: import("@medusajs/framework/utils").EnumProperty<["pending", "approved", "rejected"]>;
product_id: import("@medusajs/framework/utils").TextProperty;
customer_id: import("@medusajs/framework/utils").TextProperty;
image_urls: import("@medusajs/framework/utils").ArrayProperty;
is_verified_purchase: import("@medusajs/framework/utils").BooleanProperty;
}>, "review">;
}>>;
declare class ReviewModuleService extends ReviewModuleService_base {
_options: AlphabiteReviewsPluginOptionsType;
static validateOptions(_options: AlphabiteReviewsPluginOptionsType): void | never;
constructor({}: {}, options: AlphabiteReviewsPluginOptionsType);
getRatingAggregate(productId: string, sharedContext?: Context<EntityManager>): Promise<AggregateCounts>;
}
export default ReviewModuleService;