Types: Review to VariantPickerProps
The types of @poltura/theme-sdk/product, Review to VariantPickerProps.
Ezen az oldalon
import { … } from '@poltura/theme-sdk/product';Review
A published review of a product.
idrequiredstringThe review's id.
productIdrequiredstringThe product the review is about.
authorrequiredstringThe reviewer's display name.
ratingrequirednumberThe star rating, from 1 to 5.
titlerequiredstringThe review's title.
bodyrequiredstringThe review's text.
verifiedPurchaserequiredbooleanWhether the reviewer bought the product from the store.
storeReply{ readonly body: string; readonly createdAt: string | null; } | nullThe store's public reply under the review; the review itself is always the customer's.
createdAtrequiredstringWhen the review was written, as an ISO 8601 instant.
source'store' | 'imported'Where the review was written: in this store, or imported from another platform; absent reads as `store`.
sourceLabelstring | nullAn imported review's source line in the page language ("Imported from Trustpilot"), shown in place of the verified mark; else null.
ReviewPage
One page of a product's reviews with its score.
reviewsrequiredreadonly Review[]The reviews on this page, newest first.
statsrequiredRatingStatsThe product's review score over every review.
pagerequirednumberThe page number, from 1.
pageCountrequirednumberHow many pages there are.
policyReviewPolicyHow the store checks reviews before they appear, which the review block states.
ReviewPolicy
How the store checks reviews, from its own settings.
checkedrequired'all' | 'unverified' | 'verified' | 'none'Which reviews wait for the store's check: every one, the unverified, the verified or none.
checkedBelowRatingrequirednumber | nullReviews under this many stars also wait for a check; null when no rating rule is set.
importedbooleanSome reviews were imported from another platform, unchecked by the store.
rewardedbooleanWriting a review can earn loyalty points, whatever the rating.
statementreadonly string[]The store's review statement in the page language, one sentence each, to show under the score as `RatingSummary` does.
Spec
One row of a product's specification table.
handlerequiredstringThe attribute's stable key, for styling or picking one row.
labelrequiredstringThe attribute's name in the page language.
valuesrequiredreadonly string[]The raw values, one per entry.
itemsrequiredreadonly SpecValue[]The values with their icons, one per entry of `values`, in the same order.
displayrequiredstringThe values formatted for display, with units and the locale's numbers.
unitrequiredstring | nullThe unit the values are in, or null.
SpecGroup
A titled section of a product's specification table.
idrequiredstring | nullThe group's id, or null for the ungrouped rows.
labelrequiredstring | nullThe group's title, or null for the ungrouped rows, which come first.
specsrequiredreadonly Spec[]The group's rows.
SpecValue
One value of a spec as the shopper reads it.
labelrequiredstringThe value's text in the page language.
iconrequiredIconValue | nullThe icon shown beside the label, as `ContentIcon` draws it (a platform logo such as `logo:steam`, a content icon or an uploaded SVG), or null.
Swatch
The swatch a variant option value shows instead of a text button.
colorrequiredstring | nullThe swatch colour as `#rrggbb`, or null when it is an image.
color2requiredstring | nullA second colour for a split swatch, or null.
imagerequiredMediaImageRef | nullA pattern or photo swatch, or null when it is a colour.
UnavailableReason
Why a variant cannot be bought right now.
type UnavailableReason = 'outOfStock' | 'preorderFull' | 'paused' | 'restricted'Variant
One buyable version of a product, such as the red one in size M.
idrequiredstringThe variant's id; pass it to the cart.
titlerequiredstringThe variant's title, such as "Red / M".
skurequiredstring | nullThe stock keeping unit, or null.
optionsrequiredReadonly<Record<string, string>>The chosen value id per option id.
pricerequiredPriceViewThe variant's price.
availabilityrequiredAvailabilityWhether and how the variant can be bought.
imageIdsrequiredreadonly string[]Ids of the product images that show this variant, first one leading.
unitPricingrequiredUnitPricing | nullThe variant's contents and unit-price base, or null when it has no measured contents.
VariantPickerValue
One value of an option in the variant picker, with what choosing it would lead to.
idrequiredstringThe value's id.
labelrequiredstringThe value in the page language.
swatchrequiredSwatch | nullThe value's swatch, or null when it has none.
selectedrequiredbooleanWhether the value is the current choice.
selectablerequiredbooleanWhether choosing it can still lead to a variant that can be bought.
availabilityrequiredAvailability | nullThe availability of the variant this value completes with the other choices, or null when none does.
VariantPickerOption
One option of the variant picker, such as colour or size.
idrequiredstringThe option's id.
titlerequiredstringThe option's name in the page language.
displayrequiredProductOptionDisplayHow the merchant asked the values to be shown.
valuesrequiredreadonly VariantPickerValue[]The values, in the merchant's order.
VariantPickerState
The variant picker's state: the options with their values, the current choice and the variant it picks.
optionsrequiredreadonly VariantPickerOption[]The options that pick a variant; empty for a single-variant product or outside a product.
selectrequired(optionId: string, valueId: string) => voidChooses a value of an option.
selectedrequiredReadonly<Record<string, string>>The chosen value id per option id.
variantrequiredVariant | nullThe variant the choice picks, or null while the choice matches none.
VariantPickerClasses
Class names for the pieces of VariantPicker and VariantOption.
optionstringEach option, its name and values together.
titlestringEach option's name.
valuesstringThe row or dropdown holding an option's values.
valuestringEach value; set by {@link VariantPicker}.
VariantPickerProps
Props of VariantPicker.
display'auto' | 'dropdown'`dropdown` shows every option as a dropdown; `auto` follows each option's own display.
showTitlesbooleanShows each option's name above its values; on by default.
boxedbooleanDraws the picker in a card box.
classesVariantPickerClassesClasses added to the pieces.
classNamestringClasses added to the picker.