@devx-commerce/plugin-product-reviews
Version:
Product Reviews Plugin for Medusa
323 lines (322 loc) • 9.43 kB
TypeScript
import { type MiddlewareRoute } from "@medusajs/framework";
import { QueryConfig } from "@medusajs/types";
import { z } from "zod";
import { ProductReview } from "../../../modules/product-review/types";
export declare const listStoreProductReviewsQuerySchema: z.ZodObject<{
offset: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
limit: z.ZodEffects<z.ZodDefault<z.ZodOptional<z.ZodNumber>>, number, unknown>;
fields: z.ZodOptional<z.ZodString>;
order: z.ZodOptional<z.ZodString> | z.ZodDefault<z.ZodOptional<z.ZodString>>;
q: z.ZodOptional<z.ZodString>;
id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
product_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
order_id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
rating: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodArray<z.ZodNumber, "many">]>>;
created_at: z.ZodOptional<z.ZodUnion<[any, z.ZodObject<{
$eq: any;
$ne: any;
$in: any;
$nin: any;
$like: any;
$ilike: any;
$re: any;
$contains: any;
$gt: any;
$gte: any;
$lt: any;
$lte: any;
}, "strip", z.ZodTypeAny, {
$eq?: any;
$ne?: any;
$in?: any;
$nin?: any;
$like?: any;
$ilike?: any;
$re?: any;
$contains?: any;
$gt?: any;
$gte?: any;
$lt?: any;
$lte?: any;
}, {
$eq?: any;
$ne?: any;
$in?: any;
$nin?: any;
$like?: any;
$ilike?: any;
$re?: any;
$contains?: any;
$gt?: any;
$gte?: any;
$lt?: any;
$lte?: any;
}>]>>;
updated_at: z.ZodOptional<z.ZodUnion<[any, z.ZodObject<{
$eq: any;
$ne: any;
$in: any;
$nin: any;
$like: any;
$ilike: any;
$re: any;
$contains: any;
$gt: any;
$gte: any;
$lt: any;
$lte: any;
}, "strip", z.ZodTypeAny, {
$eq?: any;
$ne?: any;
$in?: any;
$nin?: any;
$like?: any;
$ilike?: any;
$re?: any;
$contains?: any;
$gt?: any;
$gte?: any;
$lt?: any;
$lte?: any;
}, {
$eq?: any;
$ne?: any;
$in?: any;
$nin?: any;
$like?: any;
$ilike?: any;
$re?: any;
$contains?: any;
$gt?: any;
$gte?: any;
$lt?: any;
$lte?: any;
}>]>>;
}, "strip", z.ZodTypeAny, {
offset: number;
limit: number;
fields?: string | undefined;
order?: string | undefined;
q?: string | undefined;
id?: string | string[] | undefined;
product_id?: string | string[] | undefined;
order_id?: string | string[] | undefined;
rating?: number | number[] | undefined;
created_at?: any;
updated_at?: any;
}, {
offset?: unknown;
limit?: unknown;
fields?: string | undefined;
order?: string | undefined;
q?: string | undefined;
id?: string | string[] | undefined;
product_id?: string | string[] | undefined;
order_id?: string | string[] | undefined;
rating?: number | number[] | undefined;
created_at?: any;
updated_at?: any;
}>;
export declare const upsertProductReviewsSchema: z.ZodObject<{
phone: z.ZodOptional<z.ZodString>;
email: z.ZodOptional<z.ZodString>;
name: z.ZodOptional<z.ZodString>;
reviews: z.ZodArray<z.ZodObject<{
product_id: z.ZodString;
order_id: z.ZodOptional<z.ZodString>;
order_item_id: z.ZodOptional<z.ZodString>;
rating: z.ZodNumber;
title: z.ZodString;
description: z.ZodString;
media: z.ZodArray<z.ZodObject<{
url: z.ZodString;
type: z.ZodEnum<["IMAGE", "VIDEO"]>;
}, "strip", z.ZodTypeAny, {
url: string;
type: "IMAGE" | "VIDEO";
}, {
url: string;
type: "IMAGE" | "VIDEO";
}>, "many">;
}, "strip", z.ZodTypeAny, {
rating: number;
title: string;
description: string;
product_id: string;
media: {
url: string;
type: "IMAGE" | "VIDEO";
}[];
order_id?: string | undefined;
order_item_id?: string | undefined;
}, {
rating: number;
title: string;
description: string;
product_id: string;
media: {
url: string;
type: "IMAGE" | "VIDEO";
}[];
order_id?: string | undefined;
order_item_id?: string | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
reviews: {
rating: number;
title: string;
description: string;
product_id: string;
media: {
url: string;
type: "IMAGE" | "VIDEO";
}[];
order_id?: string | undefined;
order_item_id?: string | undefined;
}[];
phone?: string | undefined;
email?: string | undefined;
name?: string | undefined;
}, {
reviews: {
rating: number;
title: string;
description: string;
product_id: string;
media: {
url: string;
type: "IMAGE" | "VIDEO";
}[];
order_id?: string | undefined;
order_item_id?: string | undefined;
}[];
phone?: string | undefined;
email?: string | undefined;
name?: string | undefined;
}>;
export type UpsertProductReviewsSchema = z.infer<typeof upsertProductReviewsSchema>;
export declare const createProductReviewsSchema: z.ZodObject<{
phone: z.ZodOptional<z.ZodString>;
email: z.ZodOptional<z.ZodString>;
name: z.ZodOptional<z.ZodString>;
product_id: z.ZodString;
order: z.ZodOptional<z.ZodObject<{
id: z.ZodString;
item_id: z.ZodString;
}, "strip", z.ZodTypeAny, {
id: string;
item_id: string;
}, {
id: string;
item_id: string;
}>>;
rating: z.ZodNumber;
title: z.ZodOptional<z.ZodString>;
description: z.ZodString;
medias: z.ZodArray<z.ZodObject<{
url: z.ZodString;
type: z.ZodEnum<["IMAGE", "VIDEO"]>;
}, "strip", z.ZodTypeAny, {
url: string;
type: "IMAGE" | "VIDEO";
}, {
url: string;
type: "IMAGE" | "VIDEO";
}>, "many">;
}, "strip", z.ZodTypeAny, {
rating: number;
description: string;
product_id: string;
medias: {
url: string;
type: "IMAGE" | "VIDEO";
}[];
phone?: string | undefined;
email?: string | undefined;
name?: string | undefined;
order?: {
id: string;
item_id: string;
} | undefined;
title?: string | undefined;
}, {
rating: number;
description: string;
product_id: string;
medias: {
url: string;
type: "IMAGE" | "VIDEO";
}[];
phone?: string | undefined;
email?: string | undefined;
name?: string | undefined;
order?: {
id: string;
item_id: string;
} | undefined;
title?: string | undefined;
}>;
export type CreateProductReviewsSchemaType = z.infer<typeof createProductReviewsSchema>;
export declare const updateProductReviewsSchema: z.ZodObject<{
rating: z.ZodOptional<z.ZodNumber>;
title: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
medias: z.ZodOptional<z.ZodArray<z.ZodObject<{
url: z.ZodString;
type: z.ZodEnum<["IMAGE", "VIDEO"]>;
}, "strip", z.ZodTypeAny, {
url: string;
type: "IMAGE" | "VIDEO";
}, {
url: string;
type: "IMAGE" | "VIDEO";
}>, "many">>;
}, "strip", z.ZodTypeAny, {
rating?: number | undefined;
title?: string | undefined;
description?: string | undefined;
medias?: {
url: string;
type: "IMAGE" | "VIDEO";
}[] | undefined;
}, {
rating?: number | undefined;
title?: string | undefined;
description?: string | undefined;
medias?: {
url: string;
type: "IMAGE" | "VIDEO";
}[] | undefined;
}>;
export type UpdateProductReviewsSchemaType = z.infer<typeof updateProductReviewsSchema>;
export declare const defaultStoreProductReviewFields: string[];
export declare const allowedStoreProductReviewFields: string[];
export declare const defaultStoreReviewsQueryConfig: QueryConfig<ProductReview>;
export declare const checkReviewEligibilityQuerySchema: z.ZodEffects<z.ZodObject<{
customer_id: z.ZodOptional<z.ZodString>;
email: z.ZodOptional<z.ZodString>;
phone: z.ZodOptional<z.ZodString>;
product_id: z.ZodString;
}, "strip", z.ZodTypeAny, {
product_id: string;
customer_id?: string | undefined;
email?: string | undefined;
phone?: string | undefined;
}, {
product_id: string;
customer_id?: string | undefined;
email?: string | undefined;
phone?: string | undefined;
}>, {
product_id: string;
customer_id?: string | undefined;
email?: string | undefined;
phone?: string | undefined;
}, {
product_id: string;
customer_id?: string | undefined;
email?: string | undefined;
phone?: string | undefined;
}>;
export type CheckReviewEligibilityQuery = z.infer<typeof checkReviewEligibilityQuerySchema>;
export declare const storeProductReviewRoutesMiddlewares: MiddlewareRoute[];