@fast-simon/dashboard-utilities 1.0.141-beta.4 → 1.0.141

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.
@@ -31,6 +31,8 @@ export interface autocompleteProps {
31
31
  variation_id?: string | null;
32
32
  force_and?: boolean;
33
33
  ps?: 'new' | 'returning' | null;
34
+ spv?: string | null;
35
+ personalization?: string | null;
34
36
  }
35
37
  export interface AutocompleteReasoningResponse {
36
38
  auto_facets?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../../src/@types/autocomplete.ts"],"names":[],"mappings":"","sourcesContent":["import {ServerProduct} from \"./product\";\nimport {Facet, FastCategory, FastTurbolinks} from \"./facets\";\nimport {PopularSearch, ContextFilteringData, QueryUnderstanding} from \"./results\";\nimport {SortBy} from \"./sortBy\";\n\n\n\nexport interface AutocompleteResults {\n totalResults: number,\n categories?: FastCategory[],\n products: ServerProduct[]\n turbolinks?: FastTurbolinks[]\n popularSearches: PopularSearch[]\n query: string\n}\n\nexport interface autocompleteProps {\n storeID: number\n uuid: string\n siteKey?:string\n cdn?: number\n term: string,\n userToken: string,\n sessionStart: number,\n withAttributes?: boolean\n segments?: string[],\n hasShopifyMarkets?: boolean,\n disable_turbolinks?:boolean\n disable_strategies?:boolean\n disable_merchandising?:boolean\n disable_semantics?:boolean\n disable_merchandising_rules?:boolean\n disable_antonyms?:boolean\n market_context?: string | null // Region code for market-specific filtering (e.g., \"US\", \"CA\", \"UK\")\n variation_id?: string | null // A/B test variation ID for reasoning/experiment tracking\n force_and?: boolean\n ps?: 'new' | 'returning' | null\n}\nexport interface AutocompleteReasoningResponse {\n auto_facets?: boolean\n isp_quick_view_mode?: number\n products: ServerProduct[]\n merch: {\n prorduct:any,\n rules:any,\n strategy:any,\n visual:any\n }\n personalized_products:any[]\n term:string\n totalResults: number\n uuid:string\n\n //all bellow wont be never field but to keep consistent with all the AIExplainer implementation\n sortBy?:SortBy\n within_search_results_for?: string,\n isNoResults?:any,\n pageCount?:number,\n narrow?: [string, string, string][],\n facets?: Facet[],\n page?: number,\n results_for?: string,\n id_list?:number[]\n turbolink?: string\n context?: ContextFilteringData // Context-based filtering data (market contexts)\n query_understanding?: QueryUnderstanding\n reformulation_source?: string\n request_url?: string // Full URL with all params that was executed (for debugging)\n}"]}
1
+ {"version":3,"file":"autocomplete.js","sourceRoot":"","sources":["../../src/@types/autocomplete.ts"],"names":[],"mappings":"","sourcesContent":["import {ServerProduct} from \"./product\";\nimport {Facet, FastCategory, FastTurbolinks} from \"./facets\";\nimport {PopularSearch, ContextFilteringData, QueryUnderstanding} from \"./results\";\nimport {SortBy} from \"./sortBy\";\n\n\n\nexport interface AutocompleteResults {\n totalResults: number,\n categories?: FastCategory[],\n products: ServerProduct[]\n turbolinks?: FastTurbolinks[]\n popularSearches: PopularSearch[]\n query: string\n}\n\nexport interface autocompleteProps {\n storeID: number\n uuid: string\n siteKey?:string\n cdn?: number\n term: string,\n userToken: string,\n sessionStart: number,\n withAttributes?: boolean\n segments?: string[],\n hasShopifyMarkets?: boolean,\n disable_turbolinks?:boolean\n disable_strategies?:boolean\n disable_merchandising?:boolean\n disable_semantics?:boolean\n disable_merchandising_rules?:boolean\n disable_antonyms?:boolean\n market_context?: string | null // Region code for market-specific filtering (e.g., \"US\", \"CA\", \"UK\")\n variation_id?: string | null // A/B test variation ID for reasoning/experiment tracking\n force_and?: boolean\n ps?: 'new' | 'returning' | null\n spv?: string | null // Session Product Views JSON for personalization preview\n personalization?: string | null // Comma-separated personalization types to enable (e.g., 'gender')\n}\nexport interface AutocompleteReasoningResponse {\n auto_facets?: boolean\n isp_quick_view_mode?: number\n products: ServerProduct[]\n merch: {\n prorduct:any,\n rules:any,\n strategy:any,\n visual:any\n }\n personalized_products:any[]\n term:string\n totalResults: number\n uuid:string\n\n //all bellow wont be never field but to keep consistent with all the AIExplainer implementation\n sortBy?:SortBy\n within_search_results_for?: string,\n isNoResults?:any,\n pageCount?:number,\n narrow?: [string, string, string][],\n facets?: Facet[],\n page?: number,\n results_for?: string,\n id_list?:number[]\n turbolink?: string\n context?: ContextFilteringData // Context-based filtering data (market contexts)\n query_understanding?: QueryUnderstanding\n reformulation_source?: string\n request_url?: string // Full URL with all params that was executed (for debugging)\n}"]}
@@ -64,6 +64,8 @@ export interface smartCollectionsProps {
64
64
  market_context?: string | null;
65
65
  variation_id?: string | null;
66
66
  ps?: 'new' | 'returning' | null;
67
+ spv?: string | null;
68
+ personalization?: string | null;
67
69
  force_and?: boolean;
68
70
  }
69
71
  export type FacetRequired = 0 | 1 | 2;
@@ -1 +1 @@
1
- {"version":3,"file":"categories.js","sourceRoot":"","sources":["../../src/@types/categories.ts"],"names":[],"mappings":"","sourcesContent":["import {SortBy} from \"./sortBy\";\nimport {Narrow, ServerNarrow} from \"./narrow\";\nimport { ServerProduct} from \"./product\";\nimport {ServerFacet} from \"./facets\";\nimport {ContextFilteringData, QueryUnderstanding} from \"./results\";\n\n\nexport type AncestorCategory = [string, string, string] // category_id, category_name, category_url\nexport interface RelatedCategory {\n id: string\n l: string\n t: string\n u: string\n}\nexport type CategoryAncestor = [string, string, string]\nexport interface Category {\n d: string\n id: string\n l: string\n p_id: string\n t: string\n u: string\n parent_name?: string\n}\nexport interface FastCategory {\n d: string\n id: string\n l: string\n p_id: string\n t: string\n u: string\n parent_name?: string\n}\nexport interface smartCollectionsProps {\n storeID: number\n uuid: string\n siteKey?:string\n cdn: number\n categoryID: string,\n userToken: string,\n sessionStart: number,\n page?: number\n productsPerPage?: number\n sortBy?: SortBy\n narrowBy?: ServerNarrow[]\n facetRequired?: FacetRequired\n withAttributes?: boolean\n recent?: string\n rec?: boolean\n searchWithinSearch?: string,\n segments?: string[],\n hasShopifyMarkets?: boolean,\n disable_turbolinks?:boolean\n disable_strategies?:boolean\n disable_merchandising?:boolean\n disable_semantics?:boolean\n disable_merchandising_rules?:boolean\n disable_antonyms?:boolean\n custom_sort_settings?:{personalization_rank: number, creation_date: number, popularity: number, inventory: number}\n with_product_analytics?:boolean\n market_context?: string | null // Region code for market-specific filtering (e.g., \"US\", \"CA\", \"UK\")\n variation_id?: string | null // A/B test variation ID for reasoning/experiment tracking\n ps?: 'new' | 'returning' | null // Personalization segment for user segment coefficient preview (new/returning user)\n force_and?: boolean\n}\nexport type FacetRequired = 0 | 1 | 2\nexport type smartCollectionsCallback = ({}: {\n action: \"products\" | \"facets and products\"\n payload: smartCollectionsResults\n}) => void\nexport interface smartCollectionsResults {\n ancestors: CategoryAncestor[]\n categoryID: string\n name: string\n category_name: string\n products: ServerProduct[]\n facets?: ServerFacet[]\n totalResults: number\n sortBy?: SortBy,\n narrow?: Narrow[],\n isNoResults?: boolean\n page?: number\n pageCount?: number\n avoidPrefixList?: string[]\n merch?: any\n bannerHTML?: string\n turbolink?:string\n hiddenProducts?:ServerProduct[]\n within_search_results_for?:string\n results_for?: string\n id_list?:number[]\n context?: ContextFilteringData // Context-based filtering data (market contexts)\n analytics?: {\n badges?: {\n winners?: Record<string, string> // Product ID -> tooltip message\n overexposed?: Record<string, string> // Product ID -> tooltip message\n new_arrivals?: string[]\n }\n key_hidden_winners?: string\n key_overexposed?: string\n }\n matching_sets?: Record<string, string> // Product ID -> set name\n query_understanding?: QueryUnderstanding\n reformulation_source?: string\n request_url?: string // Full URL with all params that was executed (for debugging)\n\n}\nexport type inventoryCallback = ({}: {\n action: \"products inventory\"\n payload: {productsInventory: productsInventoryResults[]}\n}) => void\nexport interface productsInventoryResults {\n id: string;\n totalInventory: number;\n}"]}
1
+ {"version":3,"file":"categories.js","sourceRoot":"","sources":["../../src/@types/categories.ts"],"names":[],"mappings":"","sourcesContent":["import {SortBy} from \"./sortBy\";\nimport {Narrow, ServerNarrow} from \"./narrow\";\nimport { ServerProduct} from \"./product\";\nimport {ServerFacet} from \"./facets\";\nimport {ContextFilteringData, QueryUnderstanding} from \"./results\";\n\n\nexport type AncestorCategory = [string, string, string] // category_id, category_name, category_url\nexport interface RelatedCategory {\n id: string\n l: string\n t: string\n u: string\n}\nexport type CategoryAncestor = [string, string, string]\nexport interface Category {\n d: string\n id: string\n l: string\n p_id: string\n t: string\n u: string\n parent_name?: string\n}\nexport interface FastCategory {\n d: string\n id: string\n l: string\n p_id: string\n t: string\n u: string\n parent_name?: string\n}\nexport interface smartCollectionsProps {\n storeID: number\n uuid: string\n siteKey?:string\n cdn: number\n categoryID: string,\n userToken: string,\n sessionStart: number,\n page?: number\n productsPerPage?: number\n sortBy?: SortBy\n narrowBy?: ServerNarrow[]\n facetRequired?: FacetRequired\n withAttributes?: boolean\n recent?: string\n rec?: boolean\n searchWithinSearch?: string,\n segments?: string[],\n hasShopifyMarkets?: boolean,\n disable_turbolinks?:boolean\n disable_strategies?:boolean\n disable_merchandising?:boolean\n disable_semantics?:boolean\n disable_merchandising_rules?:boolean\n disable_antonyms?:boolean\n custom_sort_settings?:{personalization_rank: number, creation_date: number, popularity: number, inventory: number}\n with_product_analytics?:boolean\n market_context?: string | null // Region code for market-specific filtering (e.g., \"US\", \"CA\", \"UK\")\n variation_id?: string | null // A/B test variation ID for reasoning/experiment tracking\n ps?: 'new' | 'returning' | null // Personalization segment for user segment coefficient preview (new/returning user)\n spv?: string | null // Session Product Views JSON for personalization preview (e.g., '{\"pid1\":ts,\"pid2\":ts}')\n personalization?: string | null // Comma-separated personalization types to enable (e.g., 'gender')\n force_and?: boolean\n}\nexport type FacetRequired = 0 | 1 | 2\nexport type smartCollectionsCallback = ({}: {\n action: \"products\" | \"facets and products\"\n payload: smartCollectionsResults\n}) => void\nexport interface smartCollectionsResults {\n ancestors: CategoryAncestor[]\n categoryID: string\n name: string\n category_name: string\n products: ServerProduct[]\n facets?: ServerFacet[]\n totalResults: number\n sortBy?: SortBy,\n narrow?: Narrow[],\n isNoResults?: boolean\n page?: number\n pageCount?: number\n avoidPrefixList?: string[]\n merch?: any\n bannerHTML?: string\n turbolink?:string\n hiddenProducts?:ServerProduct[]\n within_search_results_for?:string\n results_for?: string\n id_list?:number[]\n context?: ContextFilteringData // Context-based filtering data (market contexts)\n analytics?: {\n badges?: {\n winners?: Record<string, string> // Product ID -> tooltip message\n overexposed?: Record<string, string> // Product ID -> tooltip message\n new_arrivals?: string[]\n }\n key_hidden_winners?: string\n key_overexposed?: string\n }\n matching_sets?: Record<string, string> // Product ID -> set name\n query_understanding?: QueryUnderstanding\n reformulation_source?: string\n request_url?: string // Full URL with all params that was executed (for debugging)\n\n}\nexport type inventoryCallback = ({}: {\n action: \"products inventory\"\n payload: {productsInventory: productsInventoryResults[]}\n}) => void\nexport interface productsInventoryResults {\n id: string;\n totalInventory: number;\n}"]}
@@ -23,6 +23,7 @@ export interface ProductAnalytics {
23
23
  is_overexposed?: boolean;
24
24
  explanation?: string;
25
25
  user_segment_coef?: number;
26
+ gender_coef?: number;
26
27
  }
27
28
  export declare enum FeaturedRanking {
28
29
  FEATURED_RANK_NO = 0,
@@ -1 +1 @@
1
- {"version":3,"file":"product.js","sourceRoot":"","sources":["../../src/@types/product.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,6EAAgB,CAAA;IAChB,yFAAsB,CAAA;IACtB,qFAAoB,CAAA;IACpB,mFAAmB,CAAA;AACvB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B","sourcesContent":["import type {Currency} from \"./currency\";\nimport {PromoTileConfig} from \"./promoTile\";\n\nexport interface ProductAnalytics {\n global_impressions?: string\n context_impressions?: string\n global_cpi?: string\n context_cpi?: string\n global_rpi?: string\n context_rpi?: string\n global_rpi_corrected?: number\n context_rpi_corrected?: number\n global_rpi_cp_lower?: number\n context_rpi_cp_lower?: number\n global_rpi_corrected_cp_lower?: number\n context_rpi_corrected_cp_lower?: number\n beta_alpha_post_local?: number\n beta_beta_post_local?: number\n aov_for_cdf_local?: number\n sales_days?: number[]\n sales_weeks?: number[]\n sales_months?: number[]\n is_hidden_winner?: boolean\n is_overexposed?: boolean\n explanation?: string\n user_segment_coef?: number\n}\n\nexport enum FeaturedRanking {\n FEATURED_RANK_NO,\n FEATURED_RANK_ON_MATCH,\n FEATURED_RANK_ALWAYS,\n FEATURED_RANK_NEVER,\n}\n\nexport interface ServerProduct {\n c: Currency\n d: string\n f: FeaturedRanking\n id: productID\n iso: boolean\n l: string\n p: string\n p_c: string\n p_max: string\n p_max_c: string\n p_min: string\n p_min_c: string\n p_spl: number\n p_spl_id?: string\n review?: number\n reviews_count?: number\n s: string\n sku: string\n skus: string[]\n t: string\n t2: string\n u: string\n v_c: number\n v: string\n vra: ServerVariant[]\n vrc: object\n att?: Attribute[]\n real_sku?: string\n image_id?: string\n alt?: AlternativeColor[]\n inventory_lvl?: number\n promotile?: boolean\n imageID?: string\n rec_src?: number\n analytics?: ProductAnalytics\n}\n\nexport type ServerVariant = [number, VariantData[]]\nexport type VariantData = [string, string[]]\n\nexport type Attribute = [string, AttributeData[]]\nexport type AttributeData = string[] | string[][]\n\nexport interface ServerAltProductVariant {\n sellable: boolean;\n size: string;\n v_id: number;\n}\n\nexport interface ServerAltProductData {\n l: string;\n p: string;\n p_c: string;\n p_spl: number;\n p_spl_id?: number;\n sku?: string;\n t: string[];\n vra: ServerAltProductVariant[];\n review?: number;\n reviews_count?: number;\n att?: any[];\n s?: string;\n p_min: string;\n p_max: string;\n}\n\nexport type AlternativeColor = [AlternativeColorName, AlternativeColorURL, productID?, ServerAltProductData?]\n\ntype AlternativeColorName = string\ntype AlternativeColorURL = string\ntype productID = number\n\nexport interface Badge {\n tag: string;\n url: string;\n}\n\nexport interface TextBadge {\n badgeText: string;\n tag: string;\n badgeStyle: {\n backgroundColor: string;\n borderColor: string;\n borderRadius: number;\n horizontal: string;\n vertical: string;\n size: number;\n textColor: string;\n }\n}\n\nexport interface Products {\n [id: string]: Product\n}\n\nexport interface Product {\n currency: Currency\n id: string\n title: string\n description: string\n variants: Variants\n isSoldOut: boolean\n price: number\n minPrice: number\n maxPrice: number\n maxCompare: number\n comparePrice: number\n maxFormattedCompare: string;\n reviewScore: number | undefined\n reviewCount: number | undefined\n imageURL: string\n imageURL2: string\n optimizedURL?: string;\n formattedPrice: string\n formattedCompare: string | undefined\n vendor: string\n sku: string\n s: string\n inventory_lvl?: number\n imagesSrcset: string\n productURL: string\n productBadges: Badge[]\n productTextBadges?: TextBadge[]\n alternativeProducts?: AlternativeProduct[]\n tags?: string[]\n promoTileConfig?: PromoTileConfig\n attributes?: Attribute[]\n p_spl?: number\n p_spl_id?: string\n isIspNoPrice?: boolean\n imageID?: string\n vrc?: object\n analytics?: ProductAnalytics\n}\n\nexport interface Variant {\n id: number,\n attributes: {\n [key: string]: VariantsAttribute\n }\n}\n\nexport type Variants = Variant[]\n\nexport type VariantsAttribute = string | number | boolean | string[] | undefined\n\nexport interface AlternativeProduct {\n color: string,\n url: string,\n id: string,\n variants?: Variants,\n s?: string,\n price: number\n comparePrice: number,\n formattedCompare?: string,\n formattedPrice?: string,\n attributes?: Attribute[] | undefined\n}\n\nexport interface ServerPromotile {\n height: number;\n id: string;\n image: string;\n link: string;\n width: number;\n title: string;\n}"]}
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../../src/@types/product.ts"],"names":[],"mappings":"AA6BA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACvB,6EAAgB,CAAA;IAChB,yFAAsB,CAAA;IACtB,qFAAoB,CAAA;IACpB,mFAAmB,CAAA;AACvB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B","sourcesContent":["import type {Currency} from \"./currency\";\nimport {PromoTileConfig} from \"./promoTile\";\n\nexport interface ProductAnalytics {\n global_impressions?: string\n context_impressions?: string\n global_cpi?: string\n context_cpi?: string\n global_rpi?: string\n context_rpi?: string\n global_rpi_corrected?: number\n context_rpi_corrected?: number\n global_rpi_cp_lower?: number\n context_rpi_cp_lower?: number\n global_rpi_corrected_cp_lower?: number\n context_rpi_corrected_cp_lower?: number\n beta_alpha_post_local?: number\n beta_beta_post_local?: number\n aov_for_cdf_local?: number\n sales_days?: number[]\n sales_weeks?: number[]\n sales_months?: number[]\n is_hidden_winner?: boolean\n is_overexposed?: boolean\n explanation?: string\n user_segment_coef?: number\n gender_coef?: number // Gender-based RPI correction factor (1.0 = no change)\n}\n\nexport enum FeaturedRanking {\n FEATURED_RANK_NO,\n FEATURED_RANK_ON_MATCH,\n FEATURED_RANK_ALWAYS,\n FEATURED_RANK_NEVER,\n}\n\nexport interface ServerProduct {\n c: Currency\n d: string\n f: FeaturedRanking\n id: productID\n iso: boolean\n l: string\n p: string\n p_c: string\n p_max: string\n p_max_c: string\n p_min: string\n p_min_c: string\n p_spl: number\n p_spl_id?: string\n review?: number\n reviews_count?: number\n s: string\n sku: string\n skus: string[]\n t: string\n t2: string\n u: string\n v_c: number\n v: string\n vra: ServerVariant[]\n vrc: object\n att?: Attribute[]\n real_sku?: string\n image_id?: string\n alt?: AlternativeColor[]\n inventory_lvl?: number\n promotile?: boolean\n imageID?: string\n rec_src?: number\n analytics?: ProductAnalytics\n}\n\nexport type ServerVariant = [number, VariantData[]]\nexport type VariantData = [string, string[]]\n\nexport type Attribute = [string, AttributeData[]]\nexport type AttributeData = string[] | string[][]\n\nexport interface ServerAltProductVariant {\n sellable: boolean;\n size: string;\n v_id: number;\n}\n\nexport interface ServerAltProductData {\n l: string;\n p: string;\n p_c: string;\n p_spl: number;\n p_spl_id?: number;\n sku?: string;\n t: string[];\n vra: ServerAltProductVariant[];\n review?: number;\n reviews_count?: number;\n att?: any[];\n s?: string;\n p_min: string;\n p_max: string;\n}\n\nexport type AlternativeColor = [AlternativeColorName, AlternativeColorURL, productID?, ServerAltProductData?]\n\ntype AlternativeColorName = string\ntype AlternativeColorURL = string\ntype productID = number\n\nexport interface Badge {\n tag: string;\n url: string;\n}\n\nexport interface TextBadge {\n badgeText: string;\n tag: string;\n badgeStyle: {\n backgroundColor: string;\n borderColor: string;\n borderRadius: number;\n horizontal: string;\n vertical: string;\n size: number;\n textColor: string;\n }\n}\n\nexport interface Products {\n [id: string]: Product\n}\n\nexport interface Product {\n currency: Currency\n id: string\n title: string\n description: string\n variants: Variants\n isSoldOut: boolean\n price: number\n minPrice: number\n maxPrice: number\n maxCompare: number\n comparePrice: number\n maxFormattedCompare: string;\n reviewScore: number | undefined\n reviewCount: number | undefined\n imageURL: string\n imageURL2: string\n optimizedURL?: string;\n formattedPrice: string\n formattedCompare: string | undefined\n vendor: string\n sku: string\n s: string\n inventory_lvl?: number\n imagesSrcset: string\n productURL: string\n productBadges: Badge[]\n productTextBadges?: TextBadge[]\n alternativeProducts?: AlternativeProduct[]\n tags?: string[]\n promoTileConfig?: PromoTileConfig\n attributes?: Attribute[]\n p_spl?: number\n p_spl_id?: string\n isIspNoPrice?: boolean\n imageID?: string\n vrc?: object\n analytics?: ProductAnalytics\n}\n\nexport interface Variant {\n id: number,\n attributes: {\n [key: string]: VariantsAttribute\n }\n}\n\nexport type Variants = Variant[]\n\nexport type VariantsAttribute = string | number | boolean | string[] | undefined\n\nexport interface AlternativeProduct {\n color: string,\n url: string,\n id: string,\n variants?: Variants,\n s?: string,\n price: number\n comparePrice: number,\n formattedCompare?: string,\n formattedPrice?: string,\n attributes?: Attribute[] | undefined\n}\n\nexport interface ServerPromotile {\n height: number;\n id: string;\n image: string;\n link: string;\n width: number;\n title: string;\n}"]}
@@ -80,6 +80,9 @@ export interface fullTextSearchProps {
80
80
  market_context?: string | null;
81
81
  variation_id?: string | null;
82
82
  force_and?: boolean;
83
+ ps?: 'new' | 'returning' | null;
84
+ spv?: string | null;
85
+ personalization?: string | null;
83
86
  }
84
87
  export interface ContextFilteringData {
85
88
  hidden: number[];
@@ -1 +1 @@
1
- {"version":3,"file":"results.js","sourceRoot":"","sources":["../../src/@types/results.ts"],"names":[],"mappings":"","sourcesContent":["import type {Narrow, ServerNarrow} from \"./narrow\";\nimport type {SortBy} from \"./sortBy\";\n\nimport type { Facet} from \"./facets\";\nimport {AncestorCategory, RelatedCategory} from \"./categories\";\n\nimport {Product, ServerProduct} from \"./product\";\n\nexport interface PopularSearch {\n label: string\n type: \"p\"\n}\ninterface Base {\n narrow: Narrow,\n sortBy: SortBy,\n totalResults: number,\n page: number,\n totalPages: number,\n products: Product[],\n facets: Facet[],\n avoidTagPrefixes: string[],\n sort: SortBy,\n productIDS: string[],\n bannerHTML: string,\n bannerHTMLMobile: string,\n // ancestors: Ancestor[]\n}\n\nexport interface SearchResults extends Base {\n query: string,\n totalCMS: number,\n didYouMean?: string[],\n personalizedProductIds: number[],\n sessionProductIds: number[],\n resultsFor?: string,\n isRelatedResults?: boolean\n relatedSearch?: string[]\n}\n\nexport interface CategoryResults extends Base {\n categoryID: string,\n categoryName: string,\n personalizationRecencyLimit?: number,\n personalizedProductIds: number[],\n sessionProductIds: number[],\n relatedCategories: RelatedCategory[],\n}\n\nexport interface LandingPageResults extends Base {\n lpSlug: string,\n title: string,\n indexPage: number\n}\n\nexport type FacetRequired = 0 | 1 | 2\nexport type CategoryAncestor = [string, string, string]\n\nexport interface fullTextSearchProps {\n term: string\n storeID: number\n siteKey?:string\n uuid: string\n cdn?: number\n userToken: string,\n sessionStart: number,\n page?: number\n productsPerPage?: number\n sortBy?: SortBy\n narrowBy?: ServerNarrow[]\n facetRequired?: FacetRequired\n withAttributes?: boolean\n recent?: string\n searchWithinSearch?: string,\n segments?: string[]\n hasShopifyMarkets?: boolean\n disable_turbolinks?:boolean\n disable_strategies?:boolean\n disable_merchandising?:boolean\n disable_semantics?:boolean\n disable_merchandising_rules?:boolean\n disable_antonyms?:boolean\n custom_sort_settings?:{personalization_rank: number, creation_date: number, popularity: number, inventory: number}\n with_product_analytics?:boolean\n market_context?: string | null // Region code for market-specific filtering (e.g., \"US\", \"CA\", \"UK\")\n variation_id?: string | null // A/B test variation ID for reasoning/experiment tracking\n force_and?: boolean\n}\nexport interface ContextFilteringData {\n hidden: number[] // Product IDs hidden by context filtering\n unpublished: Record<number, string> // product_id -> region_code (e.g., \"US\", \"CA\")\n unsellable: Record<number, string> // product_id -> region_code (e.g., \"UK\", \"FR\")\n}\n\nexport interface fullTextSearchResponse {\n products: ServerProduct[]\n facets: Facet[]\n total_results: number\n facets_completed?: boolean\n sortBy?: SortBy,\n narrow: [string, string, string][]\n pop_products_no_results?: boolean\n page: number\n total_p: number\n personalized_products?: number[],\n ancestor_categories?: CategoryAncestor[]\n avoid_tag_prefixes?: string\n merch?: any\n}\nexport interface QueryUnderstanding {\n query: string\n has_ai_enrichment: boolean\n structured_attributes: Record<string, string[]>\n social_attributes: Record<string, string[]>\n intent_mapping: string[]\n}\n\nexport interface FullTextServerResponseAll extends fullTextSearchResponse{\n alternatives?: string[]\n term: string\n cms_number_found?: number\n within_search_results_for?: string\n banner_html: string\n banner_html_mobile: string\n turbolink?: string\n personalized_products?: number[]\n session_products?: number[]\n results_for?: string\n related_results?: boolean,\n ancestor_categories?: AncestorCategory[],\n related_search?: string[],\n hidden?:any,\n isNoResults?:any,\n totalResults?:any,\n hiddenProducts?:ServerProduct[],\n pageCount?:number,\n sort_by?: SortBy,\n id_list?:number[]\n context?: ContextFilteringData // Context-based filtering data (market contexts)\n analytics?: {\n badges?: {\n winners?: Record<string, string> // Product ID -> tooltip message\n overexposed?: Record<string, string> // Product ID -> tooltip message\n new_arrivals?: string[]\n }\n key_hidden_winners?: string\n key_overexposed?: string\n }\n matching_sets?: Record<string, string> // Product ID -> set name\n query_understanding?: QueryUnderstanding\n reformulation_source?: string\n request_url?: string // Full URL with all params that was executed (for debugging)\n\n}"]}
1
+ {"version":3,"file":"results.js","sourceRoot":"","sources":["../../src/@types/results.ts"],"names":[],"mappings":"","sourcesContent":["import type {Narrow, ServerNarrow} from \"./narrow\";\nimport type {SortBy} from \"./sortBy\";\n\nimport type { Facet} from \"./facets\";\nimport {AncestorCategory, RelatedCategory} from \"./categories\";\n\nimport {Product, ServerProduct} from \"./product\";\n\nexport interface PopularSearch {\n label: string\n type: \"p\"\n}\ninterface Base {\n narrow: Narrow,\n sortBy: SortBy,\n totalResults: number,\n page: number,\n totalPages: number,\n products: Product[],\n facets: Facet[],\n avoidTagPrefixes: string[],\n sort: SortBy,\n productIDS: string[],\n bannerHTML: string,\n bannerHTMLMobile: string,\n // ancestors: Ancestor[]\n}\n\nexport interface SearchResults extends Base {\n query: string,\n totalCMS: number,\n didYouMean?: string[],\n personalizedProductIds: number[],\n sessionProductIds: number[],\n resultsFor?: string,\n isRelatedResults?: boolean\n relatedSearch?: string[]\n}\n\nexport interface CategoryResults extends Base {\n categoryID: string,\n categoryName: string,\n personalizationRecencyLimit?: number,\n personalizedProductIds: number[],\n sessionProductIds: number[],\n relatedCategories: RelatedCategory[],\n}\n\nexport interface LandingPageResults extends Base {\n lpSlug: string,\n title: string,\n indexPage: number\n}\n\nexport type FacetRequired = 0 | 1 | 2\nexport type CategoryAncestor = [string, string, string]\n\nexport interface fullTextSearchProps {\n term: string\n storeID: number\n siteKey?:string\n uuid: string\n cdn?: number\n userToken: string,\n sessionStart: number,\n page?: number\n productsPerPage?: number\n sortBy?: SortBy\n narrowBy?: ServerNarrow[]\n facetRequired?: FacetRequired\n withAttributes?: boolean\n recent?: string\n searchWithinSearch?: string,\n segments?: string[]\n hasShopifyMarkets?: boolean\n disable_turbolinks?:boolean\n disable_strategies?:boolean\n disable_merchandising?:boolean\n disable_semantics?:boolean\n disable_merchandising_rules?:boolean\n disable_antonyms?:boolean\n custom_sort_settings?:{personalization_rank: number, creation_date: number, popularity: number, inventory: number}\n with_product_analytics?:boolean\n market_context?: string | null // Region code for market-specific filtering (e.g., \"US\", \"CA\", \"UK\")\n variation_id?: string | null // A/B test variation ID for reasoning/experiment tracking\n force_and?: boolean\n ps?: 'new' | 'returning' | null // Personalization segment for user segment coefficient preview (new/returning user)\n spv?: string | null // Session Product Views JSON for personalization preview (e.g., '{\"pid1\":ts,\"pid2\":ts}')\n personalization?: string | null // Comma-separated personalization types to enable (e.g., 'gender')\n}\nexport interface ContextFilteringData {\n hidden: number[] // Product IDs hidden by context filtering\n unpublished: Record<number, string> // product_id -> region_code (e.g., \"US\", \"CA\")\n unsellable: Record<number, string> // product_id -> region_code (e.g., \"UK\", \"FR\")\n}\n\nexport interface fullTextSearchResponse {\n products: ServerProduct[]\n facets: Facet[]\n total_results: number\n facets_completed?: boolean\n sortBy?: SortBy,\n narrow: [string, string, string][]\n pop_products_no_results?: boolean\n page: number\n total_p: number\n personalized_products?: number[],\n ancestor_categories?: CategoryAncestor[]\n avoid_tag_prefixes?: string\n merch?: any\n}\nexport interface QueryUnderstanding {\n query: string\n has_ai_enrichment: boolean\n structured_attributes: Record<string, string[]>\n social_attributes: Record<string, string[]>\n intent_mapping: string[]\n}\n\nexport interface FullTextServerResponseAll extends fullTextSearchResponse{\n alternatives?: string[]\n term: string\n cms_number_found?: number\n within_search_results_for?: string\n banner_html: string\n banner_html_mobile: string\n turbolink?: string\n personalized_products?: number[]\n session_products?: number[]\n results_for?: string\n related_results?: boolean,\n ancestor_categories?: AncestorCategory[],\n related_search?: string[],\n hidden?:any,\n isNoResults?:any,\n totalResults?:any,\n hiddenProducts?:ServerProduct[],\n pageCount?:number,\n sort_by?: SortBy,\n id_list?:number[]\n context?: ContextFilteringData // Context-based filtering data (market contexts)\n analytics?: {\n badges?: {\n winners?: Record<string, string> // Product ID -> tooltip message\n overexposed?: Record<string, string> // Product ID -> tooltip message\n new_arrivals?: string[]\n }\n key_hidden_winners?: string\n key_overexposed?: string\n }\n matching_sets?: Record<string, string> // Product ID -> set name\n query_understanding?: QueryUnderstanding\n reformulation_source?: string\n request_url?: string // Full URL with all params that was executed (for debugging)\n\n}"]}
@@ -27,6 +27,7 @@ import { newObject } from "../common";
27
27
  import { getShowSalesAnalyticsSetting } from "../../utils/getSalesAnalyticsSettings";
28
28
  import { getLSVectorSearchOn } from "../../utils/getLSVectorSearch";
29
29
  import { getPersonalizationSegment } from "../../utils/userSegmentPreview";
30
+ import { buildPersonalizationParams } from "../../utils/personalizationPreview";
30
31
  import { FullTextSearch } from "../../services/search";
31
32
  import { SmartCollections } from "../../services/smartCollections";
32
33
  import { Autocomplete } from "../../services/autocomplete";
@@ -63,6 +64,7 @@ const FastSimonApi = (_a) => {
63
64
  variation_id: variationId,
64
65
  force_and: false,
65
66
  user_segment_preview: 'none',
67
+ personalization_preview: null,
66
68
  // Compare Mode state
67
69
  comparisonData: null,
68
70
  isComparing: false
@@ -70,8 +72,10 @@ const FastSimonApi = (_a) => {
70
72
  // Ref for user_segment_preview: enables synchronous reads across closures
71
73
  // so that any fetch triggered in the same handler (e.g. setCustomSort) reads the latest value
72
74
  const userSegmentPreviewRef = useRef(state.user_segment_preview);
73
- const lastFetchedSegmentRef = useRef(state.user_segment_preview);
74
75
  userSegmentPreviewRef.current = state.user_segment_preview;
76
+ // Ref for personalization_preview: enables synchronous reads across closures
77
+ const personalizationPreviewRef = useRef(state.personalization_preview);
78
+ personalizationPreviewRef.current = state.personalization_preview;
75
79
  const [categories, setCategories] = useState([]);
76
80
  const [analyticsFetched, setAnalyticsFetched] = useState(false);
77
81
  const [lastAnalyticsQuery, setLastAnalyticsQuery] = useState('');
@@ -117,6 +121,10 @@ const FastSimonApi = (_a) => {
117
121
  userSegmentPreviewRef.current = preview;
118
122
  dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'setUserSegmentPreview', payload: preview });
119
123
  }
124
+ function setPersonalizationPreview(preview) {
125
+ personalizationPreviewRef.current = preview;
126
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'setPersonalizationPreview', payload: preview });
127
+ }
120
128
  // Compute detailed comparison between Hybrid ON and Hybrid OFF using full ID lists
121
129
  function computeComparisonFromIds(hybridOnIds, hybridOffIds) {
122
130
  // Create rank maps (1-based index)
@@ -508,14 +516,9 @@ const FastSimonApi = (_a) => {
508
516
  window.removeEventListener('fast-simon-update-is-autocomplete', handleSetIsAutocomplete);
509
517
  };
510
518
  }, []);
511
- // Refetch collection when user_segment_preview changes, but only if not already fetched with this value
512
- // (e.g. setCustomSort may have already triggered a fetch with the correct ref value)
513
- useEffect(() => {
514
- if (state.collectionID && state.user_segment_preview !== lastFetchedSegmentRef.current) {
515
- setCollectionID(state.collectionID);
516
- }
517
- }, [state.user_segment_preview]);
518
519
  // Settings modal refetch: triggered after state is updated (no race conditions)
520
+ // All settings (force_and, flags, custom_sort, user_segment_preview, personalization_preview)
521
+ // are batched via updateSettingsAndRefetch to avoid double-fetches and stale-state reads.
519
522
  useEffect(() => {
520
523
  var _a, _b, _c, _d, _e, _f, _g;
521
524
  if (!state.refetchTrigger)
@@ -545,6 +548,7 @@ const FastSimonApi = (_a) => {
545
548
  fetchResults(fetchParams, isInfiniteScroll, state.isAutocomplete);
546
549
  }, [state.refetchTrigger]);
547
550
  const onSearch = (props, isInfiniteScroll) => {
551
+ var _a;
548
552
  setIsLoading({ products: true, filters: true });
549
553
  // Clear previous comparison data when starting new search
550
554
  setComparisonData(null);
@@ -557,10 +561,12 @@ const FastSimonApi = (_a) => {
557
561
  const shouldFetchAnalytics = currentForceAnalytics || (isAnalyticsEnabled && (currentQuery !== lastAnalyticsQuery || lastAnalyticsMode !== 'search'));
558
562
  // Check if hybrid search is enabled - we'll need to make a comparison call
559
563
  const isHybridEnabled = getLSVectorSearchOn();
560
- FullTextSearch.getReasoningFullTextSearch(Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, with_product_analytics: shouldFetchAnalytics, market_context: marketContext, variation_id: state.variation_id, force_and: state.force_and })).then((response) => __awaiter(void 0, void 0, void 0, function* () {
561
- var _a;
564
+ const personalizationSegment = getPersonalizationSegment(userSegmentPreviewRef.current);
565
+ const personalizationParams = buildPersonalizationParams((_a = personalizationPreviewRef.current) !== null && _a !== void 0 ? _a : { enabled: false, spvJson: '', types: ['gender'] });
566
+ FullTextSearch.getReasoningFullTextSearch(Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, with_product_analytics: shouldFetchAnalytics, market_context: marketContext, variation_id: state.variation_id, force_and: state.force_and, ps: personalizationSegment, spv: personalizationParams.spv, personalization: personalizationParams.personalization })).then((response) => __awaiter(void 0, void 0, void 0, function* () {
567
+ var _b;
562
568
  // Mark analytics as fetched only if response contains analytics data with badges
563
- if (shouldFetchAnalytics && ((_a = response.analytics) === null || _a === void 0 ? void 0 : _a.badges)) {
569
+ if (shouldFetchAnalytics && ((_b = response.analytics) === null || _b === void 0 ? void 0 : _b.badges)) {
564
570
  setAnalyticsFetched(true);
565
571
  setLastAnalyticsQuery(currentQuery);
566
572
  setLastAnalyticsMode('search');
@@ -588,6 +594,9 @@ const FastSimonApi = (_a) => {
588
594
  listIdRequestProps.market_context = marketContext;
589
595
  listIdRequestProps.variation_id = state.variation_id;
590
596
  listIdRequestProps.force_and = state.force_and;
597
+ listIdRequestProps.ps = personalizationSegment;
598
+ listIdRequestProps.spv = personalizationParams.spv;
599
+ listIdRequestProps.personalization = personalizationParams.personalization;
591
600
  let listIdRes = yield FullTextSearch.getReasoningFullTextSearchProductsIds(listIdRequestProps).then((response) => {
592
601
  return response;
593
602
  });
@@ -600,6 +609,9 @@ const FastSimonApi = (_a) => {
600
609
  facetsRequestProps.market_context = marketContext;
601
610
  facetsRequestProps.variation_id = state.variation_id;
602
611
  facetsRequestProps.force_and = state.force_and;
612
+ facetsRequestProps.ps = personalizationSegment;
613
+ facetsRequestProps.spv = personalizationParams.spv;
614
+ facetsRequestProps.personalization = personalizationParams.personalization;
603
615
  let facetsRes = yield FullTextSearch.getReasoningFullTextSearch(facetsRequestProps).then((response) => {
604
616
  return response;
605
617
  });
@@ -628,7 +640,7 @@ const FastSimonApi = (_a) => {
628
640
  console.log("[Compare Mode] Making comparison IDs call...");
629
641
  try {
630
642
  // Get all IDs WITHOUT hybrid_search_settings
631
- const comparisonResponse = yield FullTextSearch.getComparisonProductIds(Object.assign(Object.assign({}, props), { market_context: marketContext, variation_id: state.variation_id, force_and: state.force_and }));
643
+ const comparisonResponse = yield FullTextSearch.getComparisonProductIds(Object.assign(Object.assign({}, props), { market_context: marketContext, variation_id: state.variation_id, force_and: state.force_and, ps: personalizationSegment, spv: personalizationParams.spv, personalization: personalizationParams.personalization }));
632
644
  const hybridOffIds = (comparisonResponse.id_list || []).map(id => id.toString());
633
645
  const hybridOnIds = (response.id_list || []).map(id => id.toString());
634
646
  console.log("[Compare Mode] Hybrid ON IDs count:", hybridOnIds.length);
@@ -650,9 +662,11 @@ const FastSimonApi = (_a) => {
650
662
  }));
651
663
  };
652
664
  const onAutocompleteSearch = (props) => {
665
+ var _a;
653
666
  setIsLoading({ products: true, filters: true });
654
667
  const personalizationSegment = getPersonalizationSegment(userSegmentPreviewRef.current);
655
- Autocomplete.getAutocompleteReasoning(Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, market_context: marketContext, variation_id: state.variation_id, force_and: state.force_and, ps: personalizationSegment })).then((response) => __awaiter(void 0, void 0, void 0, function* () {
668
+ const personalizationParams = buildPersonalizationParams((_a = personalizationPreviewRef.current) !== null && _a !== void 0 ? _a : { enabled: false, spvJson: '', types: ['gender'] });
669
+ Autocomplete.getAutocompleteReasoning(Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, market_context: marketContext, variation_id: state.variation_id, force_and: state.force_and, ps: personalizationSegment, spv: personalizationParams.spv, personalization: personalizationParams.personalization })).then((response) => __awaiter(void 0, void 0, void 0, function* () {
656
670
  response = getFormatedData(response);
657
671
  mergeResults(response, false);
658
672
  if (!customTitleChange) {
@@ -674,6 +688,7 @@ const FastSimonApi = (_a) => {
674
688
  }));
675
689
  };
676
690
  const onCollection = (props, isInfiniteScroll) => {
691
+ var _a;
677
692
  setIsLoading({ products: true, filters: true });
678
693
  // Pass with_product_analytics only on first request for this collection OR when switching from search to collection
679
694
  // AND only if merchant is enterprise or subscription level 5
@@ -683,12 +698,12 @@ const FastSimonApi = (_a) => {
683
698
  const currentForceAnalytics = forceProductAnalytics || getShowSalesAnalyticsSetting();
684
699
  const shouldFetchAnalytics = currentForceAnalytics || (isAnalyticsEnabled && (currentCollection !== lastAnalyticsCollection || lastAnalyticsMode !== 'collection'));
685
700
  const personalizationSegment = getPersonalizationSegment(userSegmentPreviewRef.current);
686
- lastFetchedSegmentRef.current = userSegmentPreviewRef.current;
687
- SmartCollections.getSmartCollections(Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, with_product_analytics: shouldFetchAnalytics, market_context: marketContext, variation_id: state.variation_id, ps: personalizationSegment, force_and: state.force_and }))
701
+ const personalizationParams = buildPersonalizationParams((_a = personalizationPreviewRef.current) !== null && _a !== void 0 ? _a : { enabled: false, spvJson: '', types: ['gender'] });
702
+ SmartCollections.getSmartCollections(Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, with_product_analytics: shouldFetchAnalytics, market_context: marketContext, variation_id: state.variation_id, ps: personalizationSegment, spv: personalizationParams.spv, personalization: personalizationParams.personalization, force_and: state.force_and }))
688
703
  .then((response) => __awaiter(void 0, void 0, void 0, function* () {
689
- var _a;
704
+ var _b;
690
705
  // Mark analytics as fetched only if response contains analytics data with badges
691
- if (shouldFetchAnalytics && ((_a = response.analytics) === null || _a === void 0 ? void 0 : _a.badges)) {
706
+ if (shouldFetchAnalytics && ((_b = response.analytics) === null || _b === void 0 ? void 0 : _b.badges)) {
692
707
  setAnalyticsFetched(true);
693
708
  setLastAnalyticsCollection(currentCollection);
694
709
  setLastAnalyticsMode('collection');
@@ -705,6 +720,8 @@ const FastSimonApi = (_a) => {
705
720
  listIdRequestProps.variation_id = state.variation_id;
706
721
  listIdRequestProps.force_and = state.force_and;
707
722
  listIdRequestProps.ps = personalizationSegment;
723
+ listIdRequestProps.spv = personalizationParams.spv;
724
+ listIdRequestProps.personalization = personalizationParams.personalization;
708
725
  let listIdRes = yield SmartCollections.getSmartCollectionsProductsIds(listIdRequestProps).then((response) => {
709
726
  return response;
710
727
  });
@@ -718,6 +735,8 @@ const FastSimonApi = (_a) => {
718
735
  facetsRequestProps.variation_id = state.variation_id;
719
736
  facetsRequestProps.force_and = state.force_and;
720
737
  facetsRequestProps.ps = personalizationSegment;
738
+ facetsRequestProps.spv = personalizationParams.spv;
739
+ facetsRequestProps.personalization = personalizationParams.personalization;
721
740
  let facetsRes = yield SmartCollections.getSmartCollections(facetsRequestProps).then((response) => {
722
741
  return response;
723
742
  });
@@ -837,6 +856,7 @@ const FastSimonApi = (_a) => {
837
856
  setVariationId,
838
857
  setForceAnd,
839
858
  setUserSegmentPreview,
859
+ setPersonalizationPreview,
840
860
  updateSettingsAndRefetch
841
861
  } }, { children: _jsx(FastState.Provider, Object.assign({ value: stateContextValue }, { children: _jsx(ThemeProvider, Object.assign({ theme: mergedTheme }, { children: children })) })) })));
842
862
  };