@86d-app/reviews 0.0.4 → 0.0.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/.turbo/turbo-build.log +1 -0
- package/AGENTS.md +54 -18
- package/README.md +150 -41
- package/dist/__tests__/controllers.test.d.ts +2 -0
- package/dist/__tests__/controllers.test.d.ts.map +1 -0
- package/dist/__tests__/endpoint-security.test.d.ts +2 -0
- package/dist/__tests__/endpoint-security.test.d.ts.map +1 -0
- package/dist/__tests__/new-features.test.d.ts +2 -0
- package/dist/__tests__/new-features.test.d.ts.map +1 -0
- package/dist/__tests__/service-impl.test.d.ts +2 -0
- package/dist/__tests__/service-impl.test.d.ts.map +1 -0
- package/dist/admin/components/index.d.ts +4 -0
- package/dist/admin/components/index.d.ts.map +1 -0
- package/dist/admin/components/review-analytics.d.ts +2 -0
- package/dist/admin/components/review-analytics.d.ts.map +1 -0
- package/dist/admin/components/review-list.d.ts +2 -0
- package/dist/admin/components/review-list.d.ts.map +1 -0
- package/dist/admin/components/review-moderation.d.ts +6 -0
- package/dist/admin/components/review-moderation.d.ts.map +1 -0
- package/dist/admin/endpoints/approve-review.d.ts +16 -0
- package/dist/admin/endpoints/approve-review.d.ts.map +1 -0
- package/dist/admin/endpoints/delete-review.d.ts +16 -0
- package/dist/admin/endpoints/delete-review.d.ts.map +1 -0
- package/dist/admin/endpoints/get-review.d.ts +16 -0
- package/dist/admin/endpoints/get-review.d.ts.map +1 -0
- package/dist/admin/endpoints/index.d.ts +167 -0
- package/dist/admin/endpoints/index.d.ts.map +1 -0
- package/dist/admin/endpoints/list-reports.d.ts +17 -0
- package/dist/admin/endpoints/list-reports.d.ts.map +1 -0
- package/dist/admin/endpoints/list-review-requests.d.ts +11 -0
- package/dist/admin/endpoints/list-review-requests.d.ts.map +1 -0
- package/dist/admin/endpoints/list-reviews.d.ts +18 -0
- package/dist/admin/endpoints/list-reviews.d.ts.map +1 -0
- package/dist/admin/endpoints/reject-review.d.ts +16 -0
- package/dist/admin/endpoints/reject-review.d.ts.map +1 -0
- package/dist/admin/endpoints/respond-review.d.ts +19 -0
- package/dist/admin/endpoints/respond-review.d.ts.map +1 -0
- package/dist/admin/endpoints/review-analytics.d.ts +6 -0
- package/dist/admin/endpoints/review-analytics.d.ts.map +1 -0
- package/dist/admin/endpoints/review-request-stats.d.ts +6 -0
- package/dist/admin/endpoints/review-request-stats.d.ts.map +1 -0
- package/dist/admin/endpoints/send-review-request.d.ts +23 -0
- package/dist/admin/endpoints/send-review-request.d.ts.map +1 -0
- package/dist/admin/endpoints/update-report.d.ts +22 -0
- package/dist/admin/endpoints/update-report.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/schema.d.ts +136 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/service-impl.d.ts +6 -0
- package/dist/service-impl.d.ts.map +1 -0
- package/dist/service.d.ts +149 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/store/components/_hooks.d.ts +6 -0
- package/dist/store/components/_hooks.d.ts.map +1 -0
- package/dist/store/components/_utils.d.ts +3 -0
- package/dist/store/components/_utils.d.ts.map +1 -0
- package/dist/store/components/distribution-bars.d.ts +5 -0
- package/dist/store/components/distribution-bars.d.ts.map +1 -0
- package/dist/store/components/index.d.ts +18 -0
- package/dist/store/components/index.d.ts.map +1 -0
- package/dist/store/components/product-reviews.d.ts +5 -0
- package/dist/store/components/product-reviews.d.ts.map +1 -0
- package/dist/store/components/review-card.d.ts +18 -0
- package/dist/store/components/review-card.d.ts.map +1 -0
- package/dist/store/components/review-form.d.ts +5 -0
- package/dist/store/components/review-form.d.ts.map +1 -0
- package/dist/store/components/reviews-summary.d.ts +4 -0
- package/dist/store/components/reviews-summary.d.ts.map +1 -0
- package/dist/store/components/star-display.d.ts +5 -0
- package/dist/store/components/star-display.d.ts.map +1 -0
- package/dist/store/components/star-picker.d.ts +5 -0
- package/dist/store/components/star-picker.d.ts.map +1 -0
- package/dist/store/endpoints/index.d.ts +116 -0
- package/dist/store/endpoints/index.d.ts.map +1 -0
- package/dist/store/endpoints/list-my-reviews.d.ts +30 -0
- package/dist/store/endpoints/list-my-reviews.d.ts.map +1 -0
- package/dist/store/endpoints/list-product-reviews.d.ts +23 -0
- package/dist/store/endpoints/list-product-reviews.d.ts.map +1 -0
- package/dist/store/endpoints/mark-helpful.d.ts +18 -0
- package/dist/store/endpoints/mark-helpful.d.ts.map +1 -0
- package/dist/store/endpoints/report-review.d.ts +27 -0
- package/dist/store/endpoints/report-review.d.ts.map +1 -0
- package/dist/store/endpoints/submit-review.d.ts +25 -0
- package/dist/store/endpoints/submit-review.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/__tests__/controllers.test.ts +1074 -0
- package/src/__tests__/endpoint-security.test.ts +559 -0
- package/src/__tests__/new-features.test.ts +618 -0
- package/src/__tests__/service-impl.test.ts +1 -1
- package/src/admin/endpoints/index.ts +4 -0
- package/src/admin/endpoints/list-reports.ts +25 -0
- package/src/admin/endpoints/update-report.ts +22 -0
- package/src/index.ts +7 -1
- package/src/schema.ts +28 -0
- package/src/service-impl.ts +151 -3
- package/src/service.ts +61 -0
- package/src/store/endpoints/index.ts +2 -0
- package/src/store/endpoints/list-my-reviews.ts +1 -1
- package/src/store/endpoints/list-product-reviews.ts +6 -2
- package/src/store/endpoints/mark-helpful.ts +21 -2
- package/src/store/endpoints/report-review.ts +38 -0
- package/src/store/endpoints/submit-review.ts +33 -7
- package/COMPONENTS.md +0 -34
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
export declare const adminEndpoints: {
|
|
2
|
+
"/admin/reviews": import("better-call").StrictEndpoint<"/admin/reviews", {
|
|
3
|
+
method: "GET";
|
|
4
|
+
query: import("zod").ZodObject<{
|
|
5
|
+
status: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
6
|
+
pending: "pending";
|
|
7
|
+
approved: "approved";
|
|
8
|
+
rejected: "rejected";
|
|
9
|
+
}>>;
|
|
10
|
+
productId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
11
|
+
take: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
12
|
+
skip: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
13
|
+
}, import("zod/v4/core").$strip>;
|
|
14
|
+
}, {
|
|
15
|
+
reviews: import("../..").Review[];
|
|
16
|
+
total: number;
|
|
17
|
+
}>;
|
|
18
|
+
"/admin/reviews/analytics": import("better-call").StrictEndpoint<"/admin/reviews/analytics", {
|
|
19
|
+
method: "GET";
|
|
20
|
+
}, {
|
|
21
|
+
analytics: import("../..").ReviewAnalytics;
|
|
22
|
+
}>;
|
|
23
|
+
"/admin/reviews/reports": import("better-call").StrictEndpoint<"/admin/reviews/reports", {
|
|
24
|
+
method: "GET";
|
|
25
|
+
query: import("zod").ZodObject<{
|
|
26
|
+
status: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
27
|
+
pending: "pending";
|
|
28
|
+
resolved: "resolved";
|
|
29
|
+
dismissed: "dismissed";
|
|
30
|
+
}>>;
|
|
31
|
+
reviewId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
32
|
+
take: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
33
|
+
skip: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
34
|
+
}, import("zod/v4/core").$strip>;
|
|
35
|
+
}, {
|
|
36
|
+
reports: import("../..").ReviewReport[];
|
|
37
|
+
}>;
|
|
38
|
+
"/admin/reviews/reports/:id/update": import("better-call").StrictEndpoint<"/admin/reviews/reports/:id/update", {
|
|
39
|
+
method: "PUT";
|
|
40
|
+
params: import("zod").ZodObject<{
|
|
41
|
+
id: import("zod").ZodString;
|
|
42
|
+
}, import("zod/v4/core").$strip>;
|
|
43
|
+
body: import("zod").ZodObject<{
|
|
44
|
+
status: import("zod").ZodEnum<{
|
|
45
|
+
resolved: "resolved";
|
|
46
|
+
dismissed: "dismissed";
|
|
47
|
+
}>;
|
|
48
|
+
}, import("zod/v4/core").$strip>;
|
|
49
|
+
}, {
|
|
50
|
+
error: string;
|
|
51
|
+
status: number;
|
|
52
|
+
report?: never;
|
|
53
|
+
} | {
|
|
54
|
+
report: import("../..").ReviewReport;
|
|
55
|
+
error?: never;
|
|
56
|
+
status?: never;
|
|
57
|
+
}>;
|
|
58
|
+
"/admin/reviews/requests": import("better-call").StrictEndpoint<"/admin/reviews/requests", {
|
|
59
|
+
method: "GET";
|
|
60
|
+
query: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
61
|
+
take: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
62
|
+
skip: import("zod").ZodOptional<import("zod").ZodCoercedNumber<unknown>>;
|
|
63
|
+
}, import("zod/v4/core").$strip>>;
|
|
64
|
+
}, {
|
|
65
|
+
requests: import("../..").ReviewRequest[];
|
|
66
|
+
}>;
|
|
67
|
+
"/admin/reviews/request-stats": import("better-call").StrictEndpoint<"/admin/reviews/request-stats", {
|
|
68
|
+
method: "GET";
|
|
69
|
+
}, {
|
|
70
|
+
stats: import("../..").ReviewRequestStats;
|
|
71
|
+
}>;
|
|
72
|
+
"/admin/reviews/send-request": import("better-call").StrictEndpoint<"/admin/reviews/send-request", {
|
|
73
|
+
method: "POST";
|
|
74
|
+
body: import("zod").ZodObject<{
|
|
75
|
+
orderId: import("zod").ZodString;
|
|
76
|
+
orderNumber: import("zod").ZodString;
|
|
77
|
+
email: import("zod").ZodString;
|
|
78
|
+
customerName: import("zod").ZodString;
|
|
79
|
+
items: import("zod").ZodArray<import("zod").ZodObject<{
|
|
80
|
+
productId: import("zod").ZodString;
|
|
81
|
+
name: import("zod").ZodString;
|
|
82
|
+
}, import("zod/v4/core").$strip>>;
|
|
83
|
+
}, import("zod/v4/core").$strip>;
|
|
84
|
+
}, {
|
|
85
|
+
error: string;
|
|
86
|
+
status: number;
|
|
87
|
+
request?: never;
|
|
88
|
+
} | {
|
|
89
|
+
request: import("../..").ReviewRequest;
|
|
90
|
+
error?: never;
|
|
91
|
+
status?: never;
|
|
92
|
+
}>;
|
|
93
|
+
"/admin/reviews/:id": import("better-call").StrictEndpoint<"/admin/reviews/:id", {
|
|
94
|
+
method: "GET";
|
|
95
|
+
params: import("zod").ZodObject<{
|
|
96
|
+
id: import("zod").ZodString;
|
|
97
|
+
}, import("zod/v4/core").$strip>;
|
|
98
|
+
}, {
|
|
99
|
+
error: string;
|
|
100
|
+
status: number;
|
|
101
|
+
review?: never;
|
|
102
|
+
} | {
|
|
103
|
+
review: import("../..").Review;
|
|
104
|
+
error?: never;
|
|
105
|
+
status?: never;
|
|
106
|
+
}>;
|
|
107
|
+
"/admin/reviews/:id/approve": import("better-call").StrictEndpoint<"/admin/reviews/:id/approve", {
|
|
108
|
+
method: "PUT";
|
|
109
|
+
params: import("zod").ZodObject<{
|
|
110
|
+
id: import("zod").ZodString;
|
|
111
|
+
}, import("zod/v4/core").$strip>;
|
|
112
|
+
}, {
|
|
113
|
+
error: string;
|
|
114
|
+
status: number;
|
|
115
|
+
review?: never;
|
|
116
|
+
} | {
|
|
117
|
+
review: import("../..").Review;
|
|
118
|
+
error?: never;
|
|
119
|
+
status?: never;
|
|
120
|
+
}>;
|
|
121
|
+
"/admin/reviews/:id/reject": import("better-call").StrictEndpoint<"/admin/reviews/:id/reject", {
|
|
122
|
+
method: "PUT";
|
|
123
|
+
params: import("zod").ZodObject<{
|
|
124
|
+
id: import("zod").ZodString;
|
|
125
|
+
}, import("zod/v4/core").$strip>;
|
|
126
|
+
}, {
|
|
127
|
+
error: string;
|
|
128
|
+
status: number;
|
|
129
|
+
review?: never;
|
|
130
|
+
} | {
|
|
131
|
+
review: import("../..").Review;
|
|
132
|
+
error?: never;
|
|
133
|
+
status?: never;
|
|
134
|
+
}>;
|
|
135
|
+
"/admin/reviews/:id/respond": import("better-call").StrictEndpoint<"/admin/reviews/:id/respond", {
|
|
136
|
+
method: "POST";
|
|
137
|
+
params: import("zod").ZodObject<{
|
|
138
|
+
id: import("zod").ZodString;
|
|
139
|
+
}, import("zod/v4/core").$strip>;
|
|
140
|
+
body: import("zod").ZodObject<{
|
|
141
|
+
response: import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<string, string>>;
|
|
142
|
+
}, import("zod/v4/core").$strip>;
|
|
143
|
+
}, {
|
|
144
|
+
error: string;
|
|
145
|
+
status: number;
|
|
146
|
+
review?: never;
|
|
147
|
+
} | {
|
|
148
|
+
review: import("../..").Review;
|
|
149
|
+
error?: never;
|
|
150
|
+
status?: never;
|
|
151
|
+
}>;
|
|
152
|
+
"/admin/reviews/:id/delete": import("better-call").StrictEndpoint<"/admin/reviews/:id/delete", {
|
|
153
|
+
method: "DELETE";
|
|
154
|
+
params: import("zod").ZodObject<{
|
|
155
|
+
id: import("zod").ZodString;
|
|
156
|
+
}, import("zod/v4/core").$strip>;
|
|
157
|
+
}, {
|
|
158
|
+
error: string;
|
|
159
|
+
status: number;
|
|
160
|
+
deleted?: never;
|
|
161
|
+
} | {
|
|
162
|
+
deleted: boolean;
|
|
163
|
+
error?: never;
|
|
164
|
+
status?: never;
|
|
165
|
+
}>;
|
|
166
|
+
};
|
|
167
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa1B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "@86d-app/core";
|
|
2
|
+
export declare const listReports: import("better-call").StrictEndpoint<"/admin/reviews/reports", {
|
|
3
|
+
method: "GET";
|
|
4
|
+
query: z.ZodObject<{
|
|
5
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
pending: "pending";
|
|
7
|
+
resolved: "resolved";
|
|
8
|
+
dismissed: "dismissed";
|
|
9
|
+
}>>;
|
|
10
|
+
reviewId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
take: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
skip: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, {
|
|
15
|
+
reports: import("../..").ReviewReport[];
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=list-reports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-reports.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/list-reports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;EAqBvB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "@86d-app/core";
|
|
2
|
+
export declare const listReviewRequests: import("better-call").StrictEndpoint<"/admin/reviews/requests", {
|
|
3
|
+
method: "GET";
|
|
4
|
+
query: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
take: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
6
|
+
skip: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
}, {
|
|
9
|
+
requests: import("../..").ReviewRequest[];
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=list-review-requests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-review-requests.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/list-review-requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,kBAAkB;;;;;;;;EAmB9B,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "@86d-app/core";
|
|
2
|
+
export declare const listReviews: import("better-call").StrictEndpoint<"/admin/reviews", {
|
|
3
|
+
method: "GET";
|
|
4
|
+
query: z.ZodObject<{
|
|
5
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
pending: "pending";
|
|
7
|
+
approved: "approved";
|
|
8
|
+
rejected: "rejected";
|
|
9
|
+
}>>;
|
|
10
|
+
productId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
take: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
12
|
+
skip: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, {
|
|
15
|
+
reviews: import("../..").Review[];
|
|
16
|
+
total: number;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=list-reviews.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-reviews.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/list-reviews.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAqBvB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "@86d-app/core";
|
|
2
|
+
export declare const rejectReview: import("better-call").StrictEndpoint<"/admin/reviews/:id/reject", {
|
|
3
|
+
method: "PUT";
|
|
4
|
+
params: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
}, {
|
|
8
|
+
error: string;
|
|
9
|
+
status: number;
|
|
10
|
+
review?: never;
|
|
11
|
+
} | {
|
|
12
|
+
review: import("../..").Review;
|
|
13
|
+
error?: never;
|
|
14
|
+
status?: never;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=reject-review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reject-review.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/reject-review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,YAAY;;;;;;;;;;;;;EAexB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "@86d-app/core";
|
|
2
|
+
export declare const respondReview: import("better-call").StrictEndpoint<"/admin/reviews/:id/respond", {
|
|
3
|
+
method: "POST";
|
|
4
|
+
params: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
body: z.ZodObject<{
|
|
8
|
+
response: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
}, {
|
|
11
|
+
error: string;
|
|
12
|
+
status: number;
|
|
13
|
+
review?: never;
|
|
14
|
+
} | {
|
|
15
|
+
review: import("../..").Review;
|
|
16
|
+
error?: never;
|
|
17
|
+
status?: never;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=respond-review.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"respond-review.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/respond-review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,CAAC,EAAE,MAAM,eAAe,CAAC;AAGrE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;EAkBzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-analytics.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/review-analytics.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,eAAe;;;;EAU3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-request-stats.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/review-request-stats.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;;;;EAQ9B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "@86d-app/core";
|
|
2
|
+
export declare const sendReviewRequest: import("better-call").StrictEndpoint<"/admin/reviews/send-request", {
|
|
3
|
+
method: "POST";
|
|
4
|
+
body: z.ZodObject<{
|
|
5
|
+
orderId: z.ZodString;
|
|
6
|
+
orderNumber: z.ZodString;
|
|
7
|
+
email: z.ZodString;
|
|
8
|
+
customerName: z.ZodString;
|
|
9
|
+
items: z.ZodArray<z.ZodObject<{
|
|
10
|
+
productId: z.ZodString;
|
|
11
|
+
name: z.ZodString;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
}, {
|
|
15
|
+
error: string;
|
|
16
|
+
status: number;
|
|
17
|
+
request?: never;
|
|
18
|
+
} | {
|
|
19
|
+
request: import("../..").ReviewRequest;
|
|
20
|
+
error?: never;
|
|
21
|
+
status?: never;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=send-review-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-review-request.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/send-review-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;EAqC7B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "@86d-app/core";
|
|
2
|
+
export declare const updateReport: import("better-call").StrictEndpoint<"/admin/reviews/reports/:id/update", {
|
|
3
|
+
method: "PUT";
|
|
4
|
+
params: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
body: z.ZodObject<{
|
|
8
|
+
status: z.ZodEnum<{
|
|
9
|
+
resolved: "resolved";
|
|
10
|
+
dismissed: "dismissed";
|
|
11
|
+
}>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
}, {
|
|
14
|
+
error: string;
|
|
15
|
+
status: number;
|
|
16
|
+
report?: never;
|
|
17
|
+
} | {
|
|
18
|
+
report: import("../..").ReviewReport;
|
|
19
|
+
error?: never;
|
|
20
|
+
status?: never;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=update-report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-report.d.ts","sourceRoot":"","sources":["../../../src/admin/endpoints/update-report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;EAkBxB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Module, ModuleConfig } from "@86d-app/core";
|
|
2
|
+
export type { RatingSummary, ReportStatus, Review, ReviewAnalytics, ReviewController, ReviewImage, ReviewReport, ReviewRequest, ReviewRequestStats, ReviewSortBy, ReviewStatus, ReviewVote, } from "./service";
|
|
3
|
+
export interface ReviewsOptions extends ModuleConfig {
|
|
4
|
+
/** Auto-approve reviews (no moderation queue) */
|
|
5
|
+
autoApprove?: string;
|
|
6
|
+
}
|
|
7
|
+
export default function reviews(options?: ReviewsOptions): Module;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAC;AAMzE,YAAY,EACX,aAAa,EACb,YAAY,EACZ,MAAM,EACN,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,YAAY,EACZ,UAAU,GACV,MAAM,WAAW,CAAC;AAEnB,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,iDAAiD;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAoDhE"}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
export declare const reviewsSchema: {
|
|
2
|
+
review: {
|
|
3
|
+
fields: {
|
|
4
|
+
id: {
|
|
5
|
+
type: "string";
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
productId: {
|
|
9
|
+
type: "string";
|
|
10
|
+
required: true;
|
|
11
|
+
};
|
|
12
|
+
customerId: {
|
|
13
|
+
type: "string";
|
|
14
|
+
required: false;
|
|
15
|
+
};
|
|
16
|
+
authorName: {
|
|
17
|
+
type: "string";
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
authorEmail: {
|
|
21
|
+
type: "string";
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
rating: {
|
|
25
|
+
type: "number";
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
title: {
|
|
29
|
+
type: "string";
|
|
30
|
+
required: false;
|
|
31
|
+
};
|
|
32
|
+
body: {
|
|
33
|
+
type: "string";
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
36
|
+
status: {
|
|
37
|
+
type: "string";
|
|
38
|
+
required: true;
|
|
39
|
+
defaultValue: string;
|
|
40
|
+
};
|
|
41
|
+
isVerifiedPurchase: {
|
|
42
|
+
type: "boolean";
|
|
43
|
+
required: true;
|
|
44
|
+
defaultValue: false;
|
|
45
|
+
};
|
|
46
|
+
helpfulCount: {
|
|
47
|
+
type: "number";
|
|
48
|
+
required: true;
|
|
49
|
+
defaultValue: number;
|
|
50
|
+
};
|
|
51
|
+
images: {
|
|
52
|
+
type: "json";
|
|
53
|
+
required: false;
|
|
54
|
+
};
|
|
55
|
+
merchantResponse: {
|
|
56
|
+
type: "string";
|
|
57
|
+
required: false;
|
|
58
|
+
};
|
|
59
|
+
merchantResponseAt: {
|
|
60
|
+
type: "date";
|
|
61
|
+
required: false;
|
|
62
|
+
};
|
|
63
|
+
moderationNote: {
|
|
64
|
+
type: "string";
|
|
65
|
+
required: false;
|
|
66
|
+
};
|
|
67
|
+
createdAt: {
|
|
68
|
+
type: "date";
|
|
69
|
+
required: true;
|
|
70
|
+
defaultValue: () => Date;
|
|
71
|
+
};
|
|
72
|
+
updatedAt: {
|
|
73
|
+
type: "date";
|
|
74
|
+
required: true;
|
|
75
|
+
defaultValue: () => Date;
|
|
76
|
+
onUpdate: () => Date;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
reviewVote: {
|
|
81
|
+
fields: {
|
|
82
|
+
id: {
|
|
83
|
+
type: "string";
|
|
84
|
+
required: true;
|
|
85
|
+
};
|
|
86
|
+
reviewId: {
|
|
87
|
+
type: "string";
|
|
88
|
+
required: true;
|
|
89
|
+
};
|
|
90
|
+
voterId: {
|
|
91
|
+
type: "string";
|
|
92
|
+
required: true;
|
|
93
|
+
};
|
|
94
|
+
createdAt: {
|
|
95
|
+
type: "date";
|
|
96
|
+
required: true;
|
|
97
|
+
defaultValue: () => Date;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
reviewReport: {
|
|
102
|
+
fields: {
|
|
103
|
+
id: {
|
|
104
|
+
type: "string";
|
|
105
|
+
required: true;
|
|
106
|
+
};
|
|
107
|
+
reviewId: {
|
|
108
|
+
type: "string";
|
|
109
|
+
required: true;
|
|
110
|
+
};
|
|
111
|
+
reporterId: {
|
|
112
|
+
type: "string";
|
|
113
|
+
required: false;
|
|
114
|
+
};
|
|
115
|
+
reason: {
|
|
116
|
+
type: "string";
|
|
117
|
+
required: true;
|
|
118
|
+
};
|
|
119
|
+
details: {
|
|
120
|
+
type: "string";
|
|
121
|
+
required: false;
|
|
122
|
+
};
|
|
123
|
+
status: {
|
|
124
|
+
type: "string";
|
|
125
|
+
required: true;
|
|
126
|
+
defaultValue: string;
|
|
127
|
+
};
|
|
128
|
+
createdAt: {
|
|
129
|
+
type: "date";
|
|
130
|
+
required: true;
|
|
131
|
+
defaultValue: () => Date;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DF,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModuleDataService } from "@86d-app/core";
|
|
2
|
+
import type { ReviewController } from "./service";
|
|
3
|
+
export declare function createReviewController(data: ModuleDataService, options?: {
|
|
4
|
+
autoApprove?: boolean;
|
|
5
|
+
}): ReviewController;
|
|
6
|
+
//# sourceMappingURL=service-impl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-impl.d.ts","sourceRoot":"","sources":["../src/service-impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAEX,gBAAgB,EAMhB,MAAM,WAAW,CAAC;AAwBnB,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,iBAAiB,EACvB,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GACjC,gBAAgB,CAsXlB"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type { ModuleController } from "@86d-app/core";
|
|
2
|
+
export type ReviewStatus = "pending" | "approved" | "rejected";
|
|
3
|
+
export type ReportStatus = "pending" | "resolved" | "dismissed";
|
|
4
|
+
export type ReviewSortBy = "recent" | "oldest" | "highest" | "lowest" | "helpful";
|
|
5
|
+
export interface ReviewImage {
|
|
6
|
+
url: string;
|
|
7
|
+
caption?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface Review {
|
|
10
|
+
id: string;
|
|
11
|
+
productId: string;
|
|
12
|
+
customerId?: string | undefined;
|
|
13
|
+
authorName: string;
|
|
14
|
+
authorEmail: string;
|
|
15
|
+
rating: number;
|
|
16
|
+
title?: string | undefined;
|
|
17
|
+
body: string;
|
|
18
|
+
status: ReviewStatus;
|
|
19
|
+
isVerifiedPurchase: boolean;
|
|
20
|
+
helpfulCount: number;
|
|
21
|
+
images?: ReviewImage[] | undefined;
|
|
22
|
+
merchantResponse?: string | undefined;
|
|
23
|
+
merchantResponseAt?: Date | undefined;
|
|
24
|
+
moderationNote?: string | undefined;
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
updatedAt: Date;
|
|
27
|
+
}
|
|
28
|
+
export interface RatingSummary {
|
|
29
|
+
average: number;
|
|
30
|
+
count: number;
|
|
31
|
+
distribution: Record<string, number>;
|
|
32
|
+
}
|
|
33
|
+
export interface ReviewVote {
|
|
34
|
+
id: string;
|
|
35
|
+
reviewId: string;
|
|
36
|
+
voterId: string;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
}
|
|
39
|
+
export interface ReviewReport {
|
|
40
|
+
id: string;
|
|
41
|
+
reviewId: string;
|
|
42
|
+
reporterId?: string | undefined;
|
|
43
|
+
reason: string;
|
|
44
|
+
details?: string | undefined;
|
|
45
|
+
status: ReportStatus;
|
|
46
|
+
createdAt: Date;
|
|
47
|
+
}
|
|
48
|
+
export interface ReviewController extends ModuleController {
|
|
49
|
+
createReview(params: {
|
|
50
|
+
productId: string;
|
|
51
|
+
authorName: string;
|
|
52
|
+
authorEmail: string;
|
|
53
|
+
rating: number;
|
|
54
|
+
title?: string | undefined;
|
|
55
|
+
body: string;
|
|
56
|
+
customerId?: string | undefined;
|
|
57
|
+
isVerifiedPurchase?: boolean | undefined;
|
|
58
|
+
images?: ReviewImage[] | undefined;
|
|
59
|
+
}): Promise<Review>;
|
|
60
|
+
getReview(id: string): Promise<Review | null>;
|
|
61
|
+
listReviewsByProduct(productId: string, params?: {
|
|
62
|
+
approvedOnly?: boolean | undefined;
|
|
63
|
+
take?: number | undefined;
|
|
64
|
+
skip?: number | undefined;
|
|
65
|
+
sortBy?: ReviewSortBy | undefined;
|
|
66
|
+
}): Promise<Review[]>;
|
|
67
|
+
listReviews(params?: {
|
|
68
|
+
productId?: string | undefined;
|
|
69
|
+
status?: ReviewStatus | undefined;
|
|
70
|
+
take?: number | undefined;
|
|
71
|
+
skip?: number | undefined;
|
|
72
|
+
}): Promise<Review[]>;
|
|
73
|
+
updateReviewStatus(id: string, status: ReviewStatus, moderationNote?: string | undefined): Promise<Review | null>;
|
|
74
|
+
deleteReview(id: string): Promise<boolean>;
|
|
75
|
+
getProductRatingSummary(productId: string): Promise<RatingSummary>;
|
|
76
|
+
addMerchantResponse(id: string, response: string): Promise<Review | null>;
|
|
77
|
+
markHelpful(id: string): Promise<Review | null>;
|
|
78
|
+
voteHelpful(reviewId: string, voterId: string): Promise<{
|
|
79
|
+
review: Review;
|
|
80
|
+
alreadyVoted: boolean;
|
|
81
|
+
} | null>;
|
|
82
|
+
getReviewAnalytics(): Promise<ReviewAnalytics>;
|
|
83
|
+
createReviewRequest(params: {
|
|
84
|
+
orderId: string;
|
|
85
|
+
orderNumber: string;
|
|
86
|
+
email: string;
|
|
87
|
+
customerName: string;
|
|
88
|
+
items: Array<{
|
|
89
|
+
productId: string;
|
|
90
|
+
name: string;
|
|
91
|
+
}>;
|
|
92
|
+
}): Promise<ReviewRequest>;
|
|
93
|
+
getReviewRequest(orderId: string): Promise<ReviewRequest | null>;
|
|
94
|
+
listReviewRequests(params?: {
|
|
95
|
+
take?: number | undefined;
|
|
96
|
+
skip?: number | undefined;
|
|
97
|
+
}): Promise<ReviewRequest[]>;
|
|
98
|
+
getReviewRequestStats(): Promise<ReviewRequestStats>;
|
|
99
|
+
listReviewsByCustomer(customerId: string, params?: {
|
|
100
|
+
status?: ReviewStatus | undefined;
|
|
101
|
+
take?: number | undefined;
|
|
102
|
+
skip?: number | undefined;
|
|
103
|
+
}): Promise<{
|
|
104
|
+
reviews: Review[];
|
|
105
|
+
total: number;
|
|
106
|
+
}>;
|
|
107
|
+
hasReviewedProduct(customerId: string, productId: string): Promise<boolean>;
|
|
108
|
+
reportReview(params: {
|
|
109
|
+
reviewId: string;
|
|
110
|
+
reporterId?: string | undefined;
|
|
111
|
+
reason: string;
|
|
112
|
+
details?: string | undefined;
|
|
113
|
+
}): Promise<ReviewReport>;
|
|
114
|
+
listReports(params?: {
|
|
115
|
+
status?: ReportStatus | undefined;
|
|
116
|
+
reviewId?: string | undefined;
|
|
117
|
+
take?: number | undefined;
|
|
118
|
+
skip?: number | undefined;
|
|
119
|
+
}): Promise<ReviewReport[]>;
|
|
120
|
+
updateReportStatus(id: string, status: ReportStatus): Promise<ReviewReport | null>;
|
|
121
|
+
getReportCount(reviewId: string): Promise<number>;
|
|
122
|
+
}
|
|
123
|
+
export interface ReviewAnalytics {
|
|
124
|
+
totalReviews: number;
|
|
125
|
+
pendingCount: number;
|
|
126
|
+
approvedCount: number;
|
|
127
|
+
rejectedCount: number;
|
|
128
|
+
averageRating: number;
|
|
129
|
+
ratingsDistribution: Record<string, number>;
|
|
130
|
+
withMerchantResponse: number;
|
|
131
|
+
reportedCount: number;
|
|
132
|
+
}
|
|
133
|
+
export interface ReviewRequest {
|
|
134
|
+
id: string;
|
|
135
|
+
orderId: string;
|
|
136
|
+
orderNumber: string;
|
|
137
|
+
email: string;
|
|
138
|
+
customerName: string;
|
|
139
|
+
items: Array<{
|
|
140
|
+
productId: string;
|
|
141
|
+
name: string;
|
|
142
|
+
}>;
|
|
143
|
+
sentAt: Date;
|
|
144
|
+
}
|
|
145
|
+
export interface ReviewRequestStats {
|
|
146
|
+
totalSent: number;
|
|
147
|
+
uniqueOrders: number;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=service.d.ts.map
|