@reactionary/core 0.3.11 → 0.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/providers/index.js +1 -0
- package/providers/product-reviews.provider.js +18 -0
- package/schemas/capabilities.schema.js +1 -0
- package/schemas/models/identifiers.model.js +12 -0
- package/schemas/models/index.js +1 -0
- package/schemas/models/product-associations.model.js +25 -0
- package/schemas/models/product-reviews.model.js +35 -0
- package/schemas/mutations/index.js +1 -0
- package/schemas/mutations/product-reviews.mutation.js +13 -0
- package/schemas/queries/index.js +1 -0
- package/schemas/queries/product-reviews.query.js +14 -0
- package/src/client/client.d.ts +2 -0
- package/src/providers/index.d.ts +1 -0
- package/src/providers/product-reviews.provider.d.ts +35 -0
- package/src/schemas/capabilities.schema.d.ts +1 -0
- package/src/schemas/models/identifiers.model.d.ts +15 -1
- package/src/schemas/models/index.d.ts +1 -0
- package/src/schemas/models/product-associations.model.d.ts +105 -0
- package/src/schemas/models/product-reviews.model.d.ts +66 -0
- package/src/schemas/mutations/index.d.ts +1 -0
- package/src/schemas/mutations/product-reviews.mutation.d.ts +12 -0
- package/src/schemas/queries/index.d.ts +1 -0
- package/src/schemas/queries/product-reviews.query.d.ts +18 -0
package/package.json
CHANGED
package/providers/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./profile.provider.js";
|
|
|
11
11
|
export * from "./product-search.provider.js";
|
|
12
12
|
export * from "./product-recommendations.provider.js";
|
|
13
13
|
export * from "./product-associations.provider.js";
|
|
14
|
+
export * from "./product-reviews.provider.js";
|
|
14
15
|
export * from "./store.provider.js";
|
|
15
16
|
export * from "./order.provider.js";
|
|
16
17
|
export * from "./order-search.provider.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseProvider } from "./base.provider.js";
|
|
2
|
+
import {} from "../schemas/models/identifiers.model.js";
|
|
3
|
+
class ProductReviewsProvider extends BaseProvider {
|
|
4
|
+
createEmptyProductRatingSummary(key) {
|
|
5
|
+
return {
|
|
6
|
+
identifier: key,
|
|
7
|
+
averageRating: 0,
|
|
8
|
+
totalRatings: void 0,
|
|
9
|
+
ratingDistribution: void 0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
getResourceName() {
|
|
13
|
+
return "product-reviews";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
ProductReviewsProvider
|
|
18
|
+
};
|
|
@@ -89,6 +89,15 @@ const ProductRecommendationIdentifierSchema = z.looseObject({
|
|
|
89
89
|
key: z.string(),
|
|
90
90
|
algorithm: z.string()
|
|
91
91
|
});
|
|
92
|
+
const ProductAssociationsIdentifierSchema = z.looseObject({
|
|
93
|
+
key: z.string()
|
|
94
|
+
});
|
|
95
|
+
const ProductRatingIdentifierSchema = z.looseObject({
|
|
96
|
+
product: ProductIdentifierSchema.meta({ description: "The product this rating summary is for." })
|
|
97
|
+
});
|
|
98
|
+
const ProductReviewIdentifierSchema = z.looseObject({
|
|
99
|
+
key: z.string().meta({ description: "The unique identifier for the product review." })
|
|
100
|
+
});
|
|
92
101
|
const ProductSearchIdentifierSchema = z.looseObject({
|
|
93
102
|
term: z.string().meta({ description: "The search term used to find products." }),
|
|
94
103
|
facets: z.array(FacetValueIdentifierSchema).meta({ description: "The facets applied to filter the search results." }),
|
|
@@ -127,12 +136,15 @@ export {
|
|
|
127
136
|
PaymentMethodIdentifierSchema,
|
|
128
137
|
PickupPointIdentifierSchema,
|
|
129
138
|
PriceIdentifierSchema,
|
|
139
|
+
ProductAssociationsIdentifierSchema,
|
|
130
140
|
ProductAttributeIdentifierSchema,
|
|
131
141
|
ProductAttributeValueIdentifierSchema,
|
|
132
142
|
ProductIdentifierSchema,
|
|
133
143
|
ProductOptionIdentifierSchema,
|
|
134
144
|
ProductOptionValueIdentifierSchema,
|
|
145
|
+
ProductRatingIdentifierSchema,
|
|
135
146
|
ProductRecommendationIdentifierSchema,
|
|
147
|
+
ProductReviewIdentifierSchema,
|
|
136
148
|
ProductSearchIdentifierSchema,
|
|
137
149
|
ProductVariantIdentifierSchema,
|
|
138
150
|
ShippingMethodIdentifierSchema,
|
package/schemas/models/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./payment.model.js";
|
|
|
10
10
|
export * from "./price.model.js";
|
|
11
11
|
export * from "./product.model.js";
|
|
12
12
|
export * from "./product-search.model.js";
|
|
13
|
+
export * from "./product-reviews.model.js";
|
|
13
14
|
export * from "./profile.model.js";
|
|
14
15
|
export * from "./shipping-method.model.js";
|
|
15
16
|
export * from "./store.model.js";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ProductIdentifierSchema, ProductAssociationsIdentifierSchema, ProductVariantIdentifierSchema } from "./identifiers.model.js";
|
|
3
|
+
import { ProductSearchResultItemSchema } from "./product-search.model.js";
|
|
4
|
+
import { BaseModelSchema } from "./base.model.js";
|
|
5
|
+
const BaseProductAssociationsSchema = BaseModelSchema.extend({
|
|
6
|
+
associationIdentifier: ProductAssociationsIdentifierSchema.meta({ description: "The identifier for the product recommendation, which includes a key and an algorithm and any other vendor specific/instance specific data " })
|
|
7
|
+
});
|
|
8
|
+
const ProductAssociationsIdOnlySchema = BaseProductAssociationsSchema.extend({
|
|
9
|
+
associationReturnType: z.literal("idOnly").meta({ description: "The type of recommendation return" }),
|
|
10
|
+
product: ProductIdentifierSchema.meta({ description: "The identifier for the recommended product." })
|
|
11
|
+
});
|
|
12
|
+
const ProductAssociationsProductSearchResultItemSchema = BaseProductAssociationsSchema.extend({
|
|
13
|
+
associationReturnType: z.literal("productSearchResultItem").meta({ description: "The type of recommendation return" }),
|
|
14
|
+
product: ProductSearchResultItemSchema.meta({ description: "The recommended product, including its identifier, name, slug, and variants. This can be used to display the recommended product directly on the frontend without needing to make an additional request to fetch the product details." })
|
|
15
|
+
});
|
|
16
|
+
const ProductAssociationsSchema = z.discriminatedUnion("associationReturnType", [
|
|
17
|
+
ProductAssociationsIdOnlySchema,
|
|
18
|
+
ProductAssociationsProductSearchResultItemSchema
|
|
19
|
+
]);
|
|
20
|
+
export {
|
|
21
|
+
BaseProductAssociationsSchema,
|
|
22
|
+
ProductAssociationsIdOnlySchema,
|
|
23
|
+
ProductAssociationsProductSearchResultItemSchema,
|
|
24
|
+
ProductAssociationsSchema
|
|
25
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { BaseModelSchema, createPaginatedResponseSchema } from "./base.model.js";
|
|
3
|
+
import { ProductIdentifierSchema, ProductRatingIdentifierSchema, ProductReviewIdentifierSchema } from "./identifiers.model.js";
|
|
4
|
+
const ProductRatingSummarySchema = BaseModelSchema.extend({
|
|
5
|
+
identifier: ProductRatingIdentifierSchema,
|
|
6
|
+
averageRating: z.number().min(0).max(5).meta({ description: "The average rating for the product." }),
|
|
7
|
+
totalRatings: z.number().min(0).optional().meta({ description: "The total number of ratings for the product." }),
|
|
8
|
+
ratingDistribution: z.looseObject({
|
|
9
|
+
"1": z.number().min(0).meta({ description: "Number of 1-star ratings." }),
|
|
10
|
+
"2": z.number().min(0).meta({ description: "Number of 2-star ratings." }),
|
|
11
|
+
"3": z.number().min(0).meta({ description: "Number of 3-star ratings." }),
|
|
12
|
+
"4": z.number().min(0).meta({ description: "Number of 4-star ratings." }),
|
|
13
|
+
"5": z.number().min(0).meta({ description: "Number of 5-star ratings." })
|
|
14
|
+
}).optional().meta({ description: "Distribution of ratings across different star levels." })
|
|
15
|
+
});
|
|
16
|
+
const ProductReviewSchema = BaseModelSchema.extend({
|
|
17
|
+
identifier: ProductReviewIdentifierSchema,
|
|
18
|
+
product: ProductIdentifierSchema.meta({ description: "The product this review is for." }),
|
|
19
|
+
authorName: z.string().meta({ description: "The name of the review author." }),
|
|
20
|
+
authorId: z.string().optional().meta({ description: "Optional unique identifier for the review author." }),
|
|
21
|
+
rating: z.number().min(0).max(5).meta({ description: "The rating given by the reviewer (0-5)." }),
|
|
22
|
+
title: z.string().meta({ description: "The title or headline of the review." }),
|
|
23
|
+
content: z.string().meta({ description: "The main content/body of the review." }),
|
|
24
|
+
reply: z.string().optional().meta({ description: "Optional reply from the store to this review." }),
|
|
25
|
+
repliedAt: z.string().optional().meta({ description: "ISO8601 timestamp when the reply was made." }),
|
|
26
|
+
createdAt: z.string().meta({ description: "ISO8601 timestamp when the review was created." }),
|
|
27
|
+
updatedAt: z.string().optional().meta({ description: "ISO8601 timestamp when the review was last updated." }),
|
|
28
|
+
verified: z.boolean().meta({ description: "Whether this is a verified purchase review." })
|
|
29
|
+
});
|
|
30
|
+
const ProductReviewPaginatedResultSchema = createPaginatedResponseSchema(ProductReviewSchema);
|
|
31
|
+
export {
|
|
32
|
+
ProductRatingSummarySchema,
|
|
33
|
+
ProductReviewPaginatedResultSchema,
|
|
34
|
+
ProductReviewSchema
|
|
35
|
+
};
|
|
@@ -5,6 +5,7 @@ export * from "./identity.mutation.js";
|
|
|
5
5
|
export * from "./inventory.mutation.js";
|
|
6
6
|
export * from "./price.mutation.js";
|
|
7
7
|
export * from "./product.mutation.js";
|
|
8
|
+
export * from "./product-reviews.mutation.js";
|
|
8
9
|
export * from "./profile.mutation.js";
|
|
9
10
|
export * from "./search.mutation.js";
|
|
10
11
|
export * from "./checkout.mutation.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { BaseMutationSchema } from "./base.mutation.js";
|
|
3
|
+
import { ProductIdentifierSchema } from "../models/identifiers.model.js";
|
|
4
|
+
const ProductReviewMutationSubmitSchema = BaseMutationSchema.extend({
|
|
5
|
+
product: ProductIdentifierSchema.meta({ description: "The product to review." }),
|
|
6
|
+
rating: z.number().min(1).max(5).meta({ description: "The rating value from 1 to 5." }),
|
|
7
|
+
title: z.string().meta({ description: "The title or headline of the review." }),
|
|
8
|
+
content: z.string().meta({ description: "The main content/body of the review." }),
|
|
9
|
+
authorName: z.string().meta({ description: "The name of the review author." })
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
ProductReviewMutationSubmitSchema
|
|
13
|
+
};
|
package/schemas/queries/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./price.query.js";
|
|
|
8
8
|
export * from "./product.query.js";
|
|
9
9
|
export * from "./profile.query.js";
|
|
10
10
|
export * from "./product-search.query.js";
|
|
11
|
+
export * from "./product-reviews.query.js";
|
|
11
12
|
export * from "./store.query.js";
|
|
12
13
|
export * from "./order.query.js";
|
|
13
14
|
export * from "./checkout.query.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { BaseQuerySchema } from "./base.query.js";
|
|
3
|
+
import { PaginationOptionsSchema, ProductIdentifierSchema } from "../models/index.js";
|
|
4
|
+
const ProductReviewsListQuerySchema = BaseQuerySchema.extend({
|
|
5
|
+
product: ProductIdentifierSchema.meta({ description: "The product to list reviews for." }),
|
|
6
|
+
paginationOptions: PaginationOptionsSchema.optional().meta({ description: "Optional pagination options for the review list." })
|
|
7
|
+
});
|
|
8
|
+
const ProductReviewsGetRatingSummaryQuerySchema = BaseQuerySchema.extend({
|
|
9
|
+
product: ProductIdentifierSchema.meta({ description: "The product to get rating summary for." })
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
ProductReviewsGetRatingSummaryQuerySchema,
|
|
13
|
+
ProductReviewsListQuerySchema
|
|
14
|
+
};
|
package/src/client/client.d.ts
CHANGED
|
@@ -10,11 +10,13 @@ import type { AnalyticsProvider, CheckoutProvider, OrderProvider, ProfileProvide
|
|
|
10
10
|
import type { OrderSearchProvider } from "../providers/order-search.provider.js";
|
|
11
11
|
import type { ProductRecommendationsProvider } from "../providers/product-recommendations.provider.js";
|
|
12
12
|
import type { ProductAssociationsProvider } from "../providers/product-associations.provider.js";
|
|
13
|
+
import type { ProductReviewsProvider } from "../providers/product-reviews.provider.js";
|
|
13
14
|
export interface Client {
|
|
14
15
|
product: ProductProvider;
|
|
15
16
|
productSearch: ProductSearchProvider;
|
|
16
17
|
productRecommendations: ProductRecommendationsProvider;
|
|
17
18
|
productAssociations: ProductAssociationsProvider;
|
|
19
|
+
productReviews: ProductReviewsProvider;
|
|
18
20
|
identity: IdentityProvider;
|
|
19
21
|
cache: Cache;
|
|
20
22
|
cart: CartProvider;
|
package/src/providers/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from './profile.provider.js';
|
|
|
11
11
|
export * from './product-search.provider.js';
|
|
12
12
|
export * from './product-recommendations.provider.js';
|
|
13
13
|
export * from './product-associations.provider.js';
|
|
14
|
+
export * from './product-reviews.provider.js';
|
|
14
15
|
export * from './store.provider.js';
|
|
15
16
|
export * from './order.provider.js';
|
|
16
17
|
export * from './order-search.provider.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Result, ProductReview, ProductRatingSummary, ProductReviewPaginatedResult } from '../schemas/index.js';
|
|
2
|
+
import type { ProductReviewsListQuery, ProductReviewsGetRatingSummaryQuery } from '../schemas/queries/product-reviews.query.js';
|
|
3
|
+
import type { ProductReviewMutationSubmit } from '../schemas/mutations/product-reviews.mutation.js';
|
|
4
|
+
import { BaseProvider } from './base.provider.js';
|
|
5
|
+
import { type ProductRatingIdentifier } from '../schemas/models/identifiers.model.js';
|
|
6
|
+
/**
|
|
7
|
+
* The product reviews provider is responsible for providing detailed product reviews from customers.
|
|
8
|
+
* Reviews contain ratings along with textual feedback, author information, and verification status.
|
|
9
|
+
* This provider also handles aggregated rating summaries for products.
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class ProductReviewsProvider extends BaseProvider {
|
|
12
|
+
/**
|
|
13
|
+
* Get the rating summary for a product, including average rating and distribution.
|
|
14
|
+
*
|
|
15
|
+
* Usecase: Display rating summary on product detail pages or product listing pages.
|
|
16
|
+
* @param query The product to get ratings for
|
|
17
|
+
*/
|
|
18
|
+
abstract getRatingSummary(query: ProductReviewsGetRatingSummaryQuery): Promise<Result<ProductRatingSummary>>;
|
|
19
|
+
/**
|
|
20
|
+
* Get a paginated list of reviews for a product.
|
|
21
|
+
*
|
|
22
|
+
* Usecase: Display customer reviews on product detail pages with filtering and sorting options.
|
|
23
|
+
* @param query The query parameters including product, pagination, sorting, and filtering options
|
|
24
|
+
*/
|
|
25
|
+
abstract findReviews(query: ProductReviewsListQuery): Promise<Result<ProductReviewPaginatedResult>>;
|
|
26
|
+
/**
|
|
27
|
+
* Submit a review for a product.
|
|
28
|
+
*
|
|
29
|
+
* Usecase: Allow customers to submit detailed reviews with ratings for products they have purchased.
|
|
30
|
+
* @param mutation The review submission data including rating, title, and content
|
|
31
|
+
*/
|
|
32
|
+
abstract submitReview(mutation: ProductReviewMutationSubmit): Promise<Result<ProductReview>>;
|
|
33
|
+
protected createEmptyProductRatingSummary(key: ProductRatingIdentifier): ProductRatingSummary;
|
|
34
|
+
getResourceName(): string;
|
|
35
|
+
}
|
|
@@ -6,6 +6,7 @@ export declare const CapabilitiesSchema: z.ZodObject<{
|
|
|
6
6
|
productSearch: z.ZodBoolean;
|
|
7
7
|
productAssociations: z.ZodBoolean;
|
|
8
8
|
productRecommendations: z.ZodBoolean;
|
|
9
|
+
productReviews: z.ZodBoolean;
|
|
9
10
|
analytics: z.ZodBoolean;
|
|
10
11
|
identity: z.ZodBoolean;
|
|
11
12
|
cart: z.ZodBoolean;
|
|
@@ -112,6 +112,17 @@ export declare const ProductRecommendationIdentifierSchema: z.ZodObject<{
|
|
|
112
112
|
key: z.ZodString;
|
|
113
113
|
algorithm: z.ZodString;
|
|
114
114
|
}, z.core.$loose>;
|
|
115
|
+
export declare const ProductAssociationsIdentifierSchema: z.ZodObject<{
|
|
116
|
+
key: z.ZodString;
|
|
117
|
+
}, z.core.$loose>;
|
|
118
|
+
export declare const ProductRatingIdentifierSchema: z.ZodObject<{
|
|
119
|
+
product: z.ZodObject<{
|
|
120
|
+
key: z.ZodString;
|
|
121
|
+
}, z.core.$loose>;
|
|
122
|
+
}, z.core.$loose>;
|
|
123
|
+
export declare const ProductReviewIdentifierSchema: z.ZodObject<{
|
|
124
|
+
key: z.ZodString;
|
|
125
|
+
}, z.core.$loose>;
|
|
115
126
|
export declare const ProductSearchIdentifierSchema: z.ZodObject<{
|
|
116
127
|
term: z.ZodString;
|
|
117
128
|
facets: z.ZodArray<z.ZodObject<{
|
|
@@ -184,4 +195,7 @@ export type ProductOptionValueIdentifier = InferType<typeof ProductOptionValueId
|
|
|
184
195
|
export type ProductAttributeIdentifier = InferType<typeof ProductAttributeIdentifierSchema>;
|
|
185
196
|
export type ProductAttributeValueIdentifier = InferType<typeof ProductAttributeValueIdentifierSchema>;
|
|
186
197
|
export type ProductRecommendationIdentifier = InferType<typeof ProductRecommendationIdentifierSchema>;
|
|
187
|
-
export type
|
|
198
|
+
export type ProductAssociationsIdentifier = InferType<typeof ProductAssociationsIdentifierSchema>;
|
|
199
|
+
export type ProductRatingIdentifier = InferType<typeof ProductRatingIdentifierSchema>;
|
|
200
|
+
export type ProductReviewIdentifier = InferType<typeof ProductReviewIdentifierSchema>;
|
|
201
|
+
export type IdentifierType = ProductIdentifier | ProductVariantIdentifier | SearchIdentifier | FacetIdentifier | FacetValueIdentifier | CartIdentifier | CartItemIdentifier | PriceIdentifier | CategoryIdentifier | WebStoreIdentifier | InventoryIdentifier | ProductRecommendationIdentifier | FulfillmentCenterIdentifier | IdentityIdentifier | ShippingMethodIdentifier | PaymentMethodIdentifier | AddressIdentifier | PaymentInstructionIdentifier | OrderIdentifier | OrderItemIdentifier | CheckoutIdentifier | CheckoutItemIdentifier | StoreIdentifier | ProductOptionIdentifier | ProductOptionValueIdentifier | PickupPointIdentifier | ProductAttributeIdentifier | ProductAttributeValueIdentifier | ProductRatingIdentifier | ProductReviewIdentifier;
|
|
@@ -10,6 +10,7 @@ export * from './payment.model.js';
|
|
|
10
10
|
export * from './price.model.js';
|
|
11
11
|
export * from './product.model.js';
|
|
12
12
|
export * from './product-search.model.js';
|
|
13
|
+
export * from './product-reviews.model.js';
|
|
13
14
|
export * from './profile.model.js';
|
|
14
15
|
export * from './shipping-method.model.js';
|
|
15
16
|
export * from './store.model.js';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import type { InferType } from "../../zod-utils.js";
|
|
3
|
+
export declare const BaseProductAssociationsSchema: z.ZodObject<{
|
|
4
|
+
associationIdentifier: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
}, z.core.$loose>;
|
|
8
|
+
export declare const ProductAssociationsIdOnlySchema: z.ZodObject<{
|
|
9
|
+
associationIdentifier: z.ZodObject<{
|
|
10
|
+
key: z.ZodString;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
associationReturnType: z.ZodLiteral<"idOnly">;
|
|
13
|
+
product: z.ZodObject<{
|
|
14
|
+
key: z.ZodString;
|
|
15
|
+
}, z.core.$loose>;
|
|
16
|
+
}, z.core.$loose>;
|
|
17
|
+
export declare const ProductAssociationsProductSearchResultItemSchema: z.ZodObject<{
|
|
18
|
+
associationIdentifier: z.ZodObject<{
|
|
19
|
+
key: z.ZodString;
|
|
20
|
+
}, z.core.$loose>;
|
|
21
|
+
associationReturnType: z.ZodLiteral<"productSearchResultItem">;
|
|
22
|
+
product: z.ZodObject<{
|
|
23
|
+
identifier: z.ZodObject<{
|
|
24
|
+
key: z.ZodString;
|
|
25
|
+
}, z.core.$loose>;
|
|
26
|
+
name: z.ZodString;
|
|
27
|
+
slug: z.ZodString;
|
|
28
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
29
|
+
variant: z.ZodObject<{
|
|
30
|
+
sku: z.ZodString;
|
|
31
|
+
}, z.core.$loose>;
|
|
32
|
+
image: z.ZodObject<{
|
|
33
|
+
sourceUrl: z.ZodDefault<z.ZodString>;
|
|
34
|
+
altText: z.ZodDefault<z.ZodString>;
|
|
35
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$loose>;
|
|
38
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
39
|
+
identifier: z.ZodObject<{
|
|
40
|
+
key: z.ZodString;
|
|
41
|
+
}, z.core.$loose>;
|
|
42
|
+
name: z.ZodString;
|
|
43
|
+
value: z.ZodObject<{
|
|
44
|
+
identifier: z.ZodObject<{
|
|
45
|
+
option: z.ZodObject<{
|
|
46
|
+
key: z.ZodString;
|
|
47
|
+
}, z.core.$loose>;
|
|
48
|
+
key: z.ZodString;
|
|
49
|
+
}, z.core.$loose>;
|
|
50
|
+
label: z.ZodString;
|
|
51
|
+
}, z.core.$loose>;
|
|
52
|
+
}, z.core.$loose>>;
|
|
53
|
+
}, z.core.$loose>>;
|
|
54
|
+
}, z.core.$loose>;
|
|
55
|
+
}, z.core.$loose>;
|
|
56
|
+
export declare const ProductAssociationsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
57
|
+
associationIdentifier: z.ZodObject<{
|
|
58
|
+
key: z.ZodString;
|
|
59
|
+
}, z.core.$loose>;
|
|
60
|
+
associationReturnType: z.ZodLiteral<"idOnly">;
|
|
61
|
+
product: z.ZodObject<{
|
|
62
|
+
key: z.ZodString;
|
|
63
|
+
}, z.core.$loose>;
|
|
64
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
65
|
+
associationIdentifier: z.ZodObject<{
|
|
66
|
+
key: z.ZodString;
|
|
67
|
+
}, z.core.$loose>;
|
|
68
|
+
associationReturnType: z.ZodLiteral<"productSearchResultItem">;
|
|
69
|
+
product: z.ZodObject<{
|
|
70
|
+
identifier: z.ZodObject<{
|
|
71
|
+
key: z.ZodString;
|
|
72
|
+
}, z.core.$loose>;
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
slug: z.ZodString;
|
|
75
|
+
variants: z.ZodArray<z.ZodObject<{
|
|
76
|
+
variant: z.ZodObject<{
|
|
77
|
+
sku: z.ZodString;
|
|
78
|
+
}, z.core.$loose>;
|
|
79
|
+
image: z.ZodObject<{
|
|
80
|
+
sourceUrl: z.ZodDefault<z.ZodString>;
|
|
81
|
+
altText: z.ZodDefault<z.ZodString>;
|
|
82
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
}, z.core.$loose>;
|
|
85
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
identifier: z.ZodObject<{
|
|
87
|
+
key: z.ZodString;
|
|
88
|
+
}, z.core.$loose>;
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
value: z.ZodObject<{
|
|
91
|
+
identifier: z.ZodObject<{
|
|
92
|
+
option: z.ZodObject<{
|
|
93
|
+
key: z.ZodString;
|
|
94
|
+
}, z.core.$loose>;
|
|
95
|
+
key: z.ZodString;
|
|
96
|
+
}, z.core.$loose>;
|
|
97
|
+
label: z.ZodString;
|
|
98
|
+
}, z.core.$loose>;
|
|
99
|
+
}, z.core.$loose>>;
|
|
100
|
+
}, z.core.$loose>>;
|
|
101
|
+
}, z.core.$loose>;
|
|
102
|
+
}, z.core.$loose>], "associationReturnType">;
|
|
103
|
+
export type ProductAssociationsIdOnly = InferType<typeof ProductAssociationsIdOnlySchema>;
|
|
104
|
+
export type ProductAssociationsSearchItem = InferType<typeof ProductAssociationsProductSearchResultItemSchema>;
|
|
105
|
+
export type ProductAssociations = InferType<typeof ProductAssociationsSchema>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* All our reviews are normalized to 1-5 star ratings
|
|
5
|
+
*/
|
|
6
|
+
export declare const ProductRatingSummarySchema: z.ZodObject<{
|
|
7
|
+
identifier: z.ZodObject<{
|
|
8
|
+
product: z.ZodObject<{
|
|
9
|
+
key: z.ZodString;
|
|
10
|
+
}, z.core.$loose>;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
averageRating: z.ZodNumber;
|
|
13
|
+
totalRatings: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
ratingDistribution: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
'1': z.ZodNumber;
|
|
16
|
+
'2': z.ZodNumber;
|
|
17
|
+
'3': z.ZodNumber;
|
|
18
|
+
'4': z.ZodNumber;
|
|
19
|
+
'5': z.ZodNumber;
|
|
20
|
+
}, z.core.$loose>>;
|
|
21
|
+
}, z.core.$loose>;
|
|
22
|
+
export declare const ProductReviewSchema: z.ZodObject<{
|
|
23
|
+
identifier: z.ZodObject<{
|
|
24
|
+
key: z.ZodString;
|
|
25
|
+
}, z.core.$loose>;
|
|
26
|
+
product: z.ZodObject<{
|
|
27
|
+
key: z.ZodString;
|
|
28
|
+
}, z.core.$loose>;
|
|
29
|
+
authorName: z.ZodString;
|
|
30
|
+
authorId: z.ZodOptional<z.ZodString>;
|
|
31
|
+
rating: z.ZodNumber;
|
|
32
|
+
title: z.ZodString;
|
|
33
|
+
content: z.ZodString;
|
|
34
|
+
reply: z.ZodOptional<z.ZodString>;
|
|
35
|
+
repliedAt: z.ZodOptional<z.ZodString>;
|
|
36
|
+
createdAt: z.ZodString;
|
|
37
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
38
|
+
verified: z.ZodBoolean;
|
|
39
|
+
}, z.core.$loose>;
|
|
40
|
+
export declare const ProductReviewPaginatedResultSchema: z.ZodObject<{
|
|
41
|
+
pageNumber: z.ZodNumber;
|
|
42
|
+
pageSize: z.ZodNumber;
|
|
43
|
+
totalCount: z.ZodNumber;
|
|
44
|
+
totalPages: z.ZodNumber;
|
|
45
|
+
items: z.ZodArray<z.ZodObject<{
|
|
46
|
+
identifier: z.ZodObject<{
|
|
47
|
+
key: z.ZodString;
|
|
48
|
+
}, z.core.$loose>;
|
|
49
|
+
product: z.ZodObject<{
|
|
50
|
+
key: z.ZodString;
|
|
51
|
+
}, z.core.$loose>;
|
|
52
|
+
authorName: z.ZodString;
|
|
53
|
+
authorId: z.ZodOptional<z.ZodString>;
|
|
54
|
+
rating: z.ZodNumber;
|
|
55
|
+
title: z.ZodString;
|
|
56
|
+
content: z.ZodString;
|
|
57
|
+
reply: z.ZodOptional<z.ZodString>;
|
|
58
|
+
repliedAt: z.ZodOptional<z.ZodString>;
|
|
59
|
+
createdAt: z.ZodString;
|
|
60
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
61
|
+
verified: z.ZodBoolean;
|
|
62
|
+
}, z.core.$loose>>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export type ProductReviewPaginatedResult = InferType<typeof ProductReviewPaginatedResultSchema>;
|
|
65
|
+
export type ProductReview = InferType<typeof ProductReviewSchema>;
|
|
66
|
+
export type ProductRatingSummary = InferType<typeof ProductRatingSummarySchema>;
|
|
@@ -5,6 +5,7 @@ export * from './identity.mutation.js';
|
|
|
5
5
|
export * from './inventory.mutation.js';
|
|
6
6
|
export * from './price.mutation.js';
|
|
7
7
|
export * from './product.mutation.js';
|
|
8
|
+
export * from './product-reviews.mutation.js';
|
|
8
9
|
export * from './profile.mutation.js';
|
|
9
10
|
export * from './search.mutation.js';
|
|
10
11
|
export * from './checkout.mutation.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
3
|
+
export declare const ProductReviewMutationSubmitSchema: z.ZodObject<{
|
|
4
|
+
product: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
rating: z.ZodNumber;
|
|
8
|
+
title: z.ZodString;
|
|
9
|
+
content: z.ZodString;
|
|
10
|
+
authorName: z.ZodString;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
export type ProductReviewMutationSubmit = InferType<typeof ProductReviewMutationSubmitSchema>;
|
|
@@ -8,6 +8,7 @@ export * from './price.query.js';
|
|
|
8
8
|
export * from './product.query.js';
|
|
9
9
|
export * from './profile.query.js';
|
|
10
10
|
export * from './product-search.query.js';
|
|
11
|
+
export * from './product-reviews.query.js';
|
|
11
12
|
export * from './store.query.js';
|
|
12
13
|
export * from './order.query.js';
|
|
13
14
|
export * from './checkout.query.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as z from 'zod';
|
|
2
|
+
import type { InferType } from '../../zod-utils.js';
|
|
3
|
+
export declare const ProductReviewsListQuerySchema: z.ZodObject<{
|
|
4
|
+
product: z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
paginationOptions: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
pageNumber: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
pageSize: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
}, z.core.$loose>>;
|
|
11
|
+
}, z.core.$loose>;
|
|
12
|
+
export declare const ProductReviewsGetRatingSummaryQuerySchema: z.ZodObject<{
|
|
13
|
+
product: z.ZodObject<{
|
|
14
|
+
key: z.ZodString;
|
|
15
|
+
}, z.core.$loose>;
|
|
16
|
+
}, z.core.$loose>;
|
|
17
|
+
export type ProductReviewsListQuery = InferType<typeof ProductReviewsListQuerySchema>;
|
|
18
|
+
export type ProductReviewsGetRatingSummaryQuery = InferType<typeof ProductReviewsGetRatingSummaryQuerySchema>;
|