Skip to main content

TypeScript Types

Sorting

main.ts
type SortBy =
"price_min_to_max"
| "price_max_to_min"
| "creation_date"
| "creation_date_oldest"
| "popularity"
| "reviews"
| "a_to_z"
| "z_to_a"
| 'relevency'
| 'relevance'

Narrow

main.ts
type Narrow = [FilterGroupName, FilterValue]
type FilterGroupName = string
type FilterValue = string

Facet

main.ts
type Facet = [string, FacetValues[] | CategoryFacetValue[], string, boolean, number]
type FacetValues = [string, number]
type CategoryFacetValue = [string, number, string, string]

Server Product

interface ServerProduct {
c: string
c_date?: number
d: string
f: number
id: string
iso: boolean
l: string
p: string
p_c: string
p_max: string
p_max_c: string
p_min: string
p_min_c: string
p_spl: number
review: number
reviews_count: number
s: string
sku: string
skus: string[]
t: string
t2: string
u: string
v_c: number
vra: ServerVariant[] //product variants
vrc: object
att?: ServerAttribute[] // product attribiutes
alt?: ServerAlternativeProduct[] // alternative (sibiling) products
}
type ServerVariant = [number, ServerVariantData[]]
type ServerVariantData = [string, ServerVariantsAttribute]
type ServerVariantsAttribute = string | number | boolean | string[] | boolean[] | number[] | undefined

type ServerAttribute = [string, ServerAttributeData[] | string[]]
type ServerAttributeData = [string, string[]]

type ServerAlternativeProduct = [ServerAlternativeProductName, ServerAlternativeProductURL, ServerAlternativeProductID?]
type ServerAlternativeProductName = string
type ServerAlternativeProductURL = string
type ServerAlternativeProductID = number

Smart Collection Response

main.ts
interface SmartCollectionResponse {
ancestor_categories: [string, string, string][],
category_description: string,
category_id: string,
category_name: string,
category_url: string,
description: string,
facets: Facet[],
facets_completed: boolean
handle: string,
isp_quick_view_mode: number,
items: ServerProduct[],
p: number,
products: {},
sort_by: SortBy,
term: string,
title: string,
total_p: number,
total_results: number,
use_personalized_collection: boolean,
uuid: string,
storeID?: string
getFacetsOnly?: () => Promise<Facet[]> | undefined,
}

Search Response

"main.ts
interface SearchResponse {
alternatives?: string[]
auto_facets: boolean,
facets: Facet[],
facets_completed: boolean,
ids?: string[],
isp_quick_view_mode: number,
items: ServerProduct[],
p: number,
products: {},
sort_by: SortBy,
term: string,
title: string,
total: number,
total_p: number,
total_results: number,
turbolink?: string,
uuid: string,
storeID?: string,
related_results: boolean,
results_for?:string,
personalized_products?: number[]
getFacetsOnly?: () => Promise<Facet[]> | undefined,
}

Autocomplete Response

main.ts
interface AutocompleteResponse{
items:{
products:ServerProduct[],
collections:AutocompleteCollectionResponse[],
articles:AutocompleteArticlesResponse[],
turbolink:AutocompleteTurboLinksResponse[],
popularSearches:string[]
}
}

interface AutocompleteCollectionResponse {
d:string,
id:string,
l:string,
p_id:string,
t:string,
u:string,
}
interface AutocompleteTurboLinksResponse {
l:string,
t:string,
u:string,
}
interface AutocompleteArticlesResponse {
l:string,
t:string,
u:string,
}

Dashboard Config

main.js
interface DashboardConfigResponse {
ab_testing_variations: {
[id: string]: {
[variant: string]: {
active: boolean;
};
}}
autocomplete_items_order:string[]
autocomplete_renames:any
avoid_mobile_optimized:boolean
avoid_price_non_login_users:boolean
avoid_tag_prefixes:string
background:string
background_gradient_1:string
background_gradient_2:string
background_old_browsers:string
categories_products_per_page:number
cdn_cache_key:number
collectionsPersonalization:{active: boolean, avoidProducts: string, avoidCategories: string[], disableCategories: string[], recencyLimit: number,maxRecencyLimit:number}
currency_symbol_position:string
custom_css:string
custom_html_bottom:string
custom_missing_product_img:string
custom_ranked_product_img:string
dim_background_on_focus:boolean
direct_load_factor:number,
disable_categories_suggestions:boolean,
disable_recent_suggestions:boolean,
disable_turbolink_suggestions:boolean,
discovery_mode:number,
display_horizontal:boolean,
display_price:boolean,
display_tagline:boolean,
display_wide:boolean,
dropdown_border_color:string,
dropdown_border_radius:number,
dropdown_border_width:number,
dropdown_shadow_blur:number,
dropdown_shadow_color:string,
dropdown_shadow_h:number,
dropdown_shadow_v:number,
dropdown_width:number,
enable_on_legacy_browsers:boolean,
endpoint:string,
endpoint_autocomplete:string,
headers_background_color:string,
headers_language:string,
headers_text_color:string,
hide_color_swatch_in_products:boolean,
hide_product_color_swatch:boolean,
hide_product_description:boolean,
hide_product_description_serp:boolean,
inventory_level_badge_min:number,
is_content:boolean,
isp_category_navigation_tree:boolean,
isp_custom_colors:any,
isp_desktop_show_hide_filters_button:boolean,
isp_desktop_show_price_slider:boolean,
isp_desktop_show_search_within_filters:boolean,
isp_horizontal_serp_filters:boolean,
isp_horizontal_serp_filters_with_apply:boolean,
isp_infinite_scroll_enabled:boolean,
isp_inventory_level_badge_enabled:boolean,
isp_look_a_like_enabled:boolean,
isp_mobile_filters_slider_direction:string,
isp_mobile_modern_slidebar_filters:boolean,
isp_pagination_progress_bar_enabled:boolean,
isp_personalized_collection_enabled:boolean,
isp_personalized_search_enabled:boolean,
isp_results_page:boolean,
isp_results_page_default_sort:number,
isp_results_page_disable_add_to_cart:boolean,
isp_results_page_enable_sorting:number,
isp_results_page_hide_search_box:boolean,
isp_results_page_in_stock_banner_enabled:boolean,
isp_results_page_product_takeover:boolean,
isp_results_page_quick_view_enabled:boolean,
isp_results_page_show_sku:boolean,
isp_results_page_sold_out_banner_enabled:boolean,
isp_results_page_type:number,
isp_second_serp_image_flip_enabled:boolean,
isp_serp_product_image_carousel:boolean,
isp_serp_results_counters:boolean,
isp_serp_search_within_search:boolean,
isp_smart_nav_default_sort:number,
isp_sort_options:boolean[],
isp_takeover_categories_navigation:boolean,
max_filter_value_suggestions:number,
max_filter_value_visible:number,
max_filters:number,
max_popular_categories_suggestions:number,
max_popular_searches_suggestions:number,
max_product_suggestions:number,
max_recent_suggestions:number,
max_turbolink_suggestions:number,
optimized_mobile_header_search:boolean,
platform:string,
price_range_format:string,
product_editor_settings:any,
product_position:string,
products_per_page:number,
reviews_provider:number,
searchPersonalization:boolean,
serp_enable_add_to_cart_ajax_animation:boolean,
serp_enable_add_to_cart_variants:boolean,
serp_enable_favorites:boolean,
show_popular_products_on_focus:boolean,
site_domain:string,
site_url:string,
sort?:{active:boolean,name:string,id:string}[],
subscription:string,
text_badges: TextBadge[],
text_color:string,
text_color_hover:string,
using_isp_api:boolean,
}
interface TextBadge {
badgeStyle:{backgroundColor:string,borderColor:string,borderRadius:number,horizontal:string,size:number,textColor:string,vertical:string}
badgeText:string
tag:string
}