@plentymarkets/shop-api / reviewGetters
Variable: reviewGetters ​
constreviewGetters:object
Defined in: getters/reviewGetters.ts:226
Type Declaration ​
getAverageRating ​
getAverageRating: (
counts,roundOption?) =>number
Returns the average rating value from a review counts object.
Parameters ​
counts ​
The review counts object.
roundOption? ​
"half" | "tenth"
Optional rounding strategy: 'half' rounds to the nearest 0.5, 'tenth' rounds to the nearest 0.1.
Returns ​
number
The average rating as a number, or 0 if not set.
getCurrentReviewsPage ​
getCurrentReviewsPage: (
review) =>number
Returns the current page number from the review pagination data.
Parameters ​
review ​
The review object.
Returns ​
number
The current page number as a number.
getRatesCount ​
getRatesCount: (
review) =>AgnosticRateCount[]
Parameters ​
review ​
The review object (currently unused).
Returns ​
AgnosticRateCount[]
An empty array.
Deprecated ​
Not yet implemented — always returns an empty array.
getReplyAuthor ​
getReplyAuthor: (
replyItem) =>string
Returns the author name of a review reply.
Parameters ​
replyItem ​
The reply review item.
Returns ​
string
The reply author name string.
getReplyDate ​
getReplyDate: (
replyItem) =>string
Returns the creation date of a review reply as a formatted date string. Falls back to the current date if the date is not parseable.
Parameters ​
replyItem ​
The reply review item.
Returns ​
string
The formatted date string (e.g. "Mon Jan 01 2024").
getReplyMessage ​
getReplyMessage: (
replyItem) =>string
Returns the text message of a review reply.
Parameters ​
replyItem ​
The reply review item.
Returns ​
string
The reply message string.
getReplyTargetId ​
getReplyTargetId: (
replyItem) =>number
Returns the target relation ID of a review reply (the ID of the review being replied to).
Parameters ​
replyItem ​
The reply review item.
Returns ​
number
The target relation ID as a number.
getReviewAuthor ​
getReviewAuthor: (
item) =>string
Returns the author name of a review item.
Parameters ​
item ​
The review item.
Returns ​
string
The author name string, or an empty string if not set.
getReviewCounts ​
getReviewCounts: (
review) =>ReviewCounts
Returns the review counts summary from a review object.
Parameters ​
review ​
The review object.
Returns ​
The ReviewCounts object containing rating totals and averages.
getReviewCountsOrPercentagesByRatingDesc ​
getReviewCountsOrPercentagesByRatingDesc: (
reviewCounts,returnPercentage) =>number[]
Returns the review counts (or percentages) per star rating in descending order (5 stars to 1 star).
Parameters ​
reviewCounts ​
The review counts object.
returnPercentage? ​
boolean = false
When true, returns percentages relative to the total; otherwise returns raw counts.
Returns ​
number[]
An array of five numbers [5-star, 4-star, 3-star, 2-star, 1-star] as counts or percentages.
getReviewDate ​
getReviewDate: (
item) =>string
Returns the creation date of a review item as a formatted date string. Falls back to the current date if the date is not parseable.
Parameters ​
item ​
The review item.
Returns ​
string
The formatted date string (e.g. "Mon Jan 01 2024").
getReviewId ​
getReviewId: (
item) =>string
Returns the unique ID of a review item as a string.
Parameters ​
item ​
The review item.
Returns ​
string
The review ID string, or an empty string if not set.
getReviewItems ​
getReviewItems: (
review) =>ReviewItem[]
Returns all review feedback items from a review object.
Parameters ​
review ​
The review object.
Returns ​
An array of ReviewItem objects, or an empty array if none exist.
getReviewMessage ​
getReviewMessage: (
item) =>string
Returns the text message of a review item.
Parameters ​
item ​
The review item.
Returns ​
string
The review message string, or an empty string if not set.
getReviewPagination ​
getReviewPagination: (
review) =>ReviewPagination
Returns the pagination data from a review object.
Parameters ​
review ​
The review object.
Returns ​
The ReviewPagination object.
getReviewRating ​
getReviewRating: (
item) =>number
Returns the numeric star rating of a review item.
Parameters ​
item ​
The review item.
Returns ​
number
The rating value (typically 1–5), or 0 if not set.
getReviewReplies ​
getReviewReplies: (
item) =>ReviewItem[]
Returns the reply items (responses) for a review item.
Parameters ​
item ​
The review item.
Returns ​
An array of reply ReviewItem objects.
getReviewTitle ​
getReviewTitle: (
item) =>string
Returns the title of a review item.
Parameters ​
item ​
The review item.
Returns ​
string
The review title string, or an empty string if not set.
getReviewVisibility ​
getReviewVisibility: (
item) =>boolean
Returns whether a review item is publicly visible.
Parameters ​
item ​
The review item.
Returns ​
boolean
true if the review is visible, otherwise false.
getTotalReviews ​
getTotalReviews: (
counts) =>number
Returns the total number of reviews from a review counts object.
Parameters ​
counts ​
The review counts object.
Returns ​
number
The total review count, or 0 if not set.
getVerifiedPurchase ​
getVerifiedPurchase: (
item) =>boolean
Returns whether the review is from a verified purchaser. A review is considered verified if any of its source relations has type "orderItem".
Parameters ​
item ​
The review item.
Returns ​
boolean
true if the reviewer made a verified purchase, otherwise false.