Feedbacks
Tajrobe review flow (seed, order rating, product reviews, stats, and uploads).
Review flow methods
For Profile → Orders feedback, use getSeed → createOrderRating →
submitProductReview.
Show ثبت دیدگاه only when both normalized flags are true:
generalInfo.settings.features.tajrobeEnabled === true and
generalInfo.settings.tajrobe.enabled === true. These correspond to
features.activate_tajrobe.enabled and tajrobe.configurations.enabled in the
raw general-info response. Require the selected order's non-empty
orderIdentifier; never use its display orderNumber. There is no order-status
filter in the supplied storefront flow.
For a hosted flow, open /review/{encodedOrderIdentifier} on the storefront
origin in a new tab. For your own UI, use the calls below. They reuse the SDK's
configured HTTP client and session; same-origin storefront calls do not establish
cross-origin authentication or CORS guarantees.
Use the complete flow helper
feedbacks.submitOrderFeedback(input, options?) is the shortest safe integration
for a native UI. It loads a fresh seed (or accepts one already loaded by the
host), skips already-submitted orders, creates one order rating, and submits the
selected product reviews sequentially. Build each review with
buildProductReviewInput(item, commentId, draft) when you need to use the
lower-level methods yourself.
const seedResponse = await client.feedbacks.getSeed(selectedOrder.orderIdentifier);
if (seedResponse.error) throw new Error(seedResponse.error.message);
const seed = seedResponse.data;
const result = await client.feedbacks.submitOrderFeedback({
orderIdentifier: selectedOrder.orderIdentifier,
orderRate: 5,
seed, // Reuse the seed rendered by the form; this avoids a second GET.
reviews: seed.items.map((item) => ({
item,
draft: {
productRate: 5,
text: 'Great quality.',
pros: ['Quality'],
recommendationStatus: 'RECOMMENDED'
}
}))
});
if (result.error) {
// result.error.details.feedback contains commentId and submittedProductCount.
// Keep the form values and resume product requests; do not create another rating.
} else if (result.data.status === 'already_submitted') {
// Show the completion state without posting again.
}The helper accepts an empty or partial reviews array for UIs where product
reviews are optional. It rejects items that do not belong to the loaded seed or
that are repeated. State-changing requests are sequential and never retried
automatically; a product failure returns progress so the host can resume safely.
Get Seed
Use: feedbacks.getSeed(orderIdentifier, options?).
Gets review seed data for the selected order.
| Parameter | Type | Required | Description |
|---|---|---|---|
orderIdentifier | string | Required | Selected order's orderIdentifier token. |
options | RequestOptions | Optional | Per-request controls. |
Returns: SazitoResponse<FeedbackSeed>.
The identifier is validated and URL-encoded. Seeds are fetched fresh to avoid
reusing stale hasCommentAlready state. Malformed seeds and seeds for another
identifier return an api error. IDs in the returned seed remain strings;
additional item fields are retained as returned. Spread the
whole selected seed item when submitting its review.
When hasCommentAlready is true, show completion without creating another
comment. An empty items array is returned as-is: decide how to handle it before
starting a submission.
Create Order Rating
Use: feedbacks.createOrderRating(input, options?).
Submits an order-level rating.
| Field | Type | Required | Description |
|---|---|---|---|
input.orderId | number | string | Required | Positive integer order ID from the seed; numeric strings are converted to JSON numbers. |
input.orderIdentifier | string | Required | Order identifier from the same seed. |
input.orderRate | number | Required | Integer order rate (1..5). |
options | RequestOptions | Optional | Per-request controls. |
Returns: SazitoResponse<{ id: string }> where id is commentId.
Both credentials are required. Invalid input returns a validation error.
A response without a valid comment ID returns an api error; retain the form
inputs and do not advance to product reviews.
Submit Product Review
Use: feedbacks.submitProductReview(input, options?).
Submits a product review.
| Field | Type | Required / default |
|---|---|---|
commentId | number | string | Required; use the successful store-rating response ID. |
productId, productVariantId | number | string | Required positive integer IDs; numeric strings are accepted. |
productRate | number | Required integer from 1 to 5. |
productName, productAttributes, productImage, additional seed fields | Seed item fields | Preserve them by spreading the seed item. |
text | string | Optional; defaults to ''. |
pros, cons | string[] | Optional; default to []. |
recommendationStatus | 'RECOMMENDED' | 'NEUTRAL' | 'NOT-RECOMMENDED' | 'NONE' | Optional; defaults to 'NONE'. |
isAnonymous | boolean | Optional; defaults to false. |
attachmentsServeKeys | string[] | Optional; defaults to []. Only completed non-empty serve keys. |
owner | boolean | Optional; defaults to true for order feedback. |
Returns: SazitoResponse<void>.
Seed attributes may contain structured values such as color metadata, and seed images may contain additional fields; these values are preserved in the request. Submit products sequentially and advance only after each success.
createOrderRating and submitProductReview force retries: 0, including when
request options or global configuration enable retries. The SDK does not
automatically resume submissions or prevent separate repeated calls.
Keep the returned comment ID and successful product progress in the host UI;
retain inputs and stop on failures. Do not claim completion until every product
submission succeeds. A network failure can have an unknown server outcome.
Get Product Statistics
Use: feedbacks.getProductStatistics(productId, options?).
Reads review statistics for the selected product.
Returns: SazitoResponse<ProductStatistics>.
Get Product Reviews
Use: feedbacks.getProductReviews(productId, filters?, options?).
Reads paginated reviews for the selected product.
| Field | Type | Required | Description |
|---|---|---|---|
filters.pageNumber | number | Optional | Page number (default 1). |
filters.pageSize | number | Optional | Page size (default 10). |
Returns: SazitoResponse<ProductReviewsResponse>.
Upload Review Images
Use: feedbacks.uploadReviewImages(images, options?).
Uploads review images and returns their serve keys.
| Field | Type | Required | Description |
|---|---|---|---|
images[].file | File | Blob | Required | Image file. |
images[].name | string | Optional | File display name. |
images[].alt | string | Optional | Alt text. |
Returns: SazitoResponse<{ images: ReviewUploadedImage[] }> where each image includes serveKey.
Wait for uploads to complete, then pass images.map(image => image.serveKey) to
the review request. Disable submission while uploads or requests are pending.
The SDK rejects empty files, empty upload lists, and responses without completed
serve keys. Pass File or Blob objects to uploadReviewImages(); the SDK
handles the upload request. Do not set a Content-Type header yourself. Ratings, inputs, error messages, RTL layout, and
accessible controls belong to the host UI.
Example: End-to-end review submission
// Check both feature flags before showing the action in your UI.
const seed = await client.feedbacks.getSeed(selectedOrder.orderIdentifier);
if (seed.error) throw new Error(seed.error.message);
if (!seed.data.hasCommentAlready && seed.data.items.length > 0) {
const orderRating = await client.feedbacks.createOrderRating({
orderId: seed.data.orderId,
orderIdentifier: seed.data.orderIdentifier,
orderRate: 5
});
if (orderRating.error) throw new Error(orderRating.error.message);
// Save this ID and progress in host state; never recreate the rating on a
// product failure. This loop illustrates a first submission, not recovery.
for (const item of seed.data.items) {
const productReview = await client.feedbacks.submitProductReview({
...item,
commentId: orderRating.data.id,
productRate: 5,
text: 'Great product.',
pros: ['Quality'],
cons: [],
recommendationStatus: 'RECOMMENDED',
attachmentsServeKeys: [],
owner: true,
isAnonymous: false
});
if (productReview.error) throw new Error(productReview.error.message);
}
}Use the customer's chosen ratings and draft fields in a real UI. Show a thank-you state after all product submissions succeed, explain that publication follows store approval, and offer a return action to Orders. If seed loading fails, show an explicit unavailable state or return to the storefront.
Type Details
The following tables are generated from SDK TypeScript types and include nested object fields.
FeedbackSeedItem
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
[key: string] | unknown | N/A |
productId | string | Required |
productVariantId | string | Required |
productName | string | Required |
productAttributes | FeedbackProductAttribute[] | Required |
productImage | FeedbackProductImage | Required |
FeedbackSeed
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
orderId | string | Required |
orderIdentifier | string | Required |
hasCommentAlready | boolean | Required |
items | FeedbackSeedItem[] | Required |
CreateOrderRatingInput
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
orderId | string | number | Required |
orderIdentifier | string | Required |
orderRate | number | Required |
CommentResponse
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
id | string | Required |
ProductReviewRequest
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
[key: string] | unknown | N/A |
commentId | string | number | Required |
productId | string | number | Required |
productVariantId | string | number | Required |
productName | string | Optional |
productAttributes | FeedbackProductAttribute[] | Optional |
productImage | FeedbackProductImage | Optional |
productRate | number | Required |
text | string | Optional |
pros | string[] | Optional |
cons | string[] | Optional |
recommendationStatus | RecommendationStatus | Optional |
attachmentsServeKeys | string[] | Optional |
owner | boolean | Optional |
isAnonymous | boolean | Optional |
ProductReviewDraft
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
productRate | number | Required |
text | string | Optional |
pros | string[] | Optional |
cons | string[] | Optional |
recommendationStatus | RecommendationStatus | Optional |
attachmentsServeKeys | string[] | Optional |
owner | boolean | Optional |
isAnonymous | boolean | Optional |
SubmitOrderFeedbackInput
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
orderIdentifier | string | Required |
orderRate | number | Required |
seed | FeedbackSeed | Optional |
reviews | Array<{ item: FeedbackSeedItem; draft: ProductReviewDraft; }> | Optional |
reviews.[].item | FeedbackSeedItem | Required |
reviews.[].draft | ProductReviewDraft | Required |
SubmitOrderFeedbackResult
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
status | 'submitted' | 'already_submitted' | Required |
seed | FeedbackSeed | Required |
commentId | string | Optional |
submittedProductCount | number | Required |
requestedProductCount | number | Required |
ProductStatistics
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
productStatistics | { averageRate: number; totalCount: number; recommendations: { recommendedPercentage: number; recommendedTotalCount: number; }; } | Required |
productStatistics.averageRate | number | Required |
productStatistics.totalCount | number | Required |
productStatistics.recommendations | { recommendedPercentage: number; recommendedTotalCount: number; } | Required |
productStatistics.recommendations.recommendedPercentage | number | Required |
productStatistics.recommendations.recommendedTotalCount | number | Required |
ProductReview
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
productRate | number | Required |
userFirstName | string | Required |
userLastName | string | Required |
createdAt | string | Required |
owner | boolean | Required |
text | string | Required |
recommendationStatus | RecommendationStatus | Required |
pros | string[] | Required |
cons | string[] | Required |
isAnonymous | boolean | Required |
metadata | { variantOptions: any[]; productName: string; variantId: string; } | Required |
metadata.variantOptions | any[] | Required |
metadata.productName | string | Required |
metadata.variantId | string | Required |
attachments | Array<{ serveUrl: string; }> | Required |
attachments.[].serveUrl | string | Required |
ProductReviewsFilters
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
pageNumber | number | Optional |
pageSize | number | Optional |
ProductReviewsResponse
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
entities | ProductReview[] | Required |
pageNumber | number | Required |
pageSize | number | Required |
totalCount | number | Required |
averageRate | number | Required |
recommendations | { recommendedPercentage: number; recommendedTotalCount: number; } | Required |
recommendations.recommendedPercentage | number | Required |
recommendations.recommendedTotalCount | number | Required |
ReviewAttachmentInput
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
file | File | Blob | Required |
name | string | Optional |
alt | string | Optional |
ReviewUploadedImage
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
id | string | Required |
url | string | Required |
alt | string | Required |
serveUrl | string | Required |
serveKey | string | Required |
ReviewImageUploadResponse
Source: src/api/feedbacks.ts
| Field | Type | Required |
|---|---|---|
images | ReviewUploadedImage[] | Required |