@fast-simon/dashboard-utilities 1.0.141-beta.3 → 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.
Files changed (35) hide show
  1. package/dist/@types/autocomplete.d.ts +2 -0
  2. package/dist/@types/autocomplete.js.map +1 -1
  3. package/dist/@types/categories.d.ts +3 -0
  4. package/dist/@types/categories.js.map +1 -1
  5. package/dist/@types/product.d.ts +1 -0
  6. package/dist/@types/product.js.map +1 -1
  7. package/dist/@types/results.d.ts +4 -0
  8. package/dist/@types/results.js.map +1 -1
  9. package/dist/components/FastSimonApi/FastSimonApi.js +52 -22
  10. package/dist/components/FastSimonApi/FastSimonApi.js.map +1 -1
  11. package/dist/components/FastSimonApi/context.d.ts +4 -1
  12. package/dist/components/FastSimonApi/context.js.map +1 -1
  13. package/dist/components/FastSimonApi/reducer.d.ts +15 -1
  14. package/dist/components/FastSimonApi/reducer.js +2 -0
  15. package/dist/components/FastSimonApi/reducer.js.map +1 -1
  16. package/dist/components/productGrid/ProductGrid.d.ts +1 -0
  17. package/dist/components/productGrid/ProductGrid.js +2 -2
  18. package/dist/components/productGrid/ProductGrid.js.map +1 -1
  19. package/dist/components/productGrid/styles.module.css +6 -6
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.js +2 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/services/autocomplete.d.ts +1 -1
  24. package/dist/services/autocomplete.js +2 -2
  25. package/dist/services/autocomplete.js.map +1 -1
  26. package/dist/services/search.d.ts +3 -3
  27. package/dist/services/search.js +6 -6
  28. package/dist/services/search.js.map +1 -1
  29. package/dist/services/smartCollections.d.ts +2 -2
  30. package/dist/services/smartCollections.js +4 -4
  31. package/dist/services/smartCollections.js.map +1 -1
  32. package/dist/utils/personalizationPreview.d.ts +16 -0
  33. package/dist/utils/personalizationPreview.js +30 -0
  34. package/dist/utils/personalizationPreview.js.map +1 -0
  35. package/package.json +1 -1
@@ -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;
@@ -102,6 +104,7 @@ export interface smartCollectionsResults {
102
104
  key_hidden_winners?: string;
103
105
  key_overexposed?: string;
104
106
  };
107
+ matching_sets?: Record<string, string>;
105
108
  query_understanding?: QueryUnderstanding;
106
109
  reformulation_source?: string;
107
110
  request_url?: string;
@@ -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 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[];
@@ -139,6 +142,7 @@ export interface FullTextServerResponseAll extends fullTextSearchResponse {
139
142
  key_hidden_winners?: string;
140
143
  key_overexposed?: string;
141
144
  };
145
+ matching_sets?: Record<string, string>;
142
146
  query_understanding?: QueryUnderstanding;
143
147
  reformulation_source?: string;
144
148
  request_url?: string;
@@ -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 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,17 +561,20 @@ 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');
567
573
  }
568
- // Preserve existing analytics if new response doesn't have it
574
+ // Preserve existing analytics and matching_sets if new response doesn't have them
569
575
  const existingAnalytics = results === null || results === void 0 ? void 0 : results.analytics;
570
- response = getFormatedData(response, existingAnalytics);
576
+ const existingMatchingSets = results === null || results === void 0 ? void 0 : results.matching_sets;
577
+ response = getFormatedData(response, existingAnalytics, existingMatchingSets);
571
578
  // Handle turbolink responses - skip additional API calls to prevent errors
572
579
  if (response.turbolink && response.totalResults === 0) {
573
580
  mergeResults(response, isInfiniteScroll);
@@ -587,6 +594,9 @@ const FastSimonApi = (_a) => {
587
594
  listIdRequestProps.market_context = marketContext;
588
595
  listIdRequestProps.variation_id = state.variation_id;
589
596
  listIdRequestProps.force_and = state.force_and;
597
+ listIdRequestProps.ps = personalizationSegment;
598
+ listIdRequestProps.spv = personalizationParams.spv;
599
+ listIdRequestProps.personalization = personalizationParams.personalization;
590
600
  let listIdRes = yield FullTextSearch.getReasoningFullTextSearchProductsIds(listIdRequestProps).then((response) => {
591
601
  return response;
592
602
  });
@@ -599,6 +609,9 @@ const FastSimonApi = (_a) => {
599
609
  facetsRequestProps.market_context = marketContext;
600
610
  facetsRequestProps.variation_id = state.variation_id;
601
611
  facetsRequestProps.force_and = state.force_and;
612
+ facetsRequestProps.ps = personalizationSegment;
613
+ facetsRequestProps.spv = personalizationParams.spv;
614
+ facetsRequestProps.personalization = personalizationParams.personalization;
602
615
  let facetsRes = yield FullTextSearch.getReasoningFullTextSearch(facetsRequestProps).then((response) => {
603
616
  return response;
604
617
  });
@@ -627,7 +640,7 @@ const FastSimonApi = (_a) => {
627
640
  console.log("[Compare Mode] Making comparison IDs call...");
628
641
  try {
629
642
  // Get all IDs WITHOUT hybrid_search_settings
630
- 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 }));
631
644
  const hybridOffIds = (comparisonResponse.id_list || []).map(id => id.toString());
632
645
  const hybridOnIds = (response.id_list || []).map(id => id.toString());
633
646
  console.log("[Compare Mode] Hybrid ON IDs count:", hybridOnIds.length);
@@ -649,9 +662,11 @@ const FastSimonApi = (_a) => {
649
662
  }));
650
663
  };
651
664
  const onAutocompleteSearch = (props) => {
665
+ var _a;
652
666
  setIsLoading({ products: true, filters: true });
653
667
  const personalizationSegment = getPersonalizationSegment(userSegmentPreviewRef.current);
654
- 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* () {
655
670
  response = getFormatedData(response);
656
671
  mergeResults(response, false);
657
672
  if (!customTitleChange) {
@@ -673,6 +688,7 @@ const FastSimonApi = (_a) => {
673
688
  }));
674
689
  };
675
690
  const onCollection = (props, isInfiniteScroll) => {
691
+ var _a;
676
692
  setIsLoading({ products: true, filters: true });
677
693
  // Pass with_product_analytics only on first request for this collection OR when switching from search to collection
678
694
  // AND only if merchant is enterprise or subscription level 5
@@ -682,19 +698,20 @@ const FastSimonApi = (_a) => {
682
698
  const currentForceAnalytics = forceProductAnalytics || getShowSalesAnalyticsSetting();
683
699
  const shouldFetchAnalytics = currentForceAnalytics || (isAnalyticsEnabled && (currentCollection !== lastAnalyticsCollection || lastAnalyticsMode !== 'collection'));
684
700
  const personalizationSegment = getPersonalizationSegment(userSegmentPreviewRef.current);
685
- lastFetchedSegmentRef.current = userSegmentPreviewRef.current;
686
- 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 }))
687
703
  .then((response) => __awaiter(void 0, void 0, void 0, function* () {
688
- var _a;
704
+ var _b;
689
705
  // Mark analytics as fetched only if response contains analytics data with badges
690
- 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)) {
691
707
  setAnalyticsFetched(true);
692
708
  setLastAnalyticsCollection(currentCollection);
693
709
  setLastAnalyticsMode('collection');
694
710
  }
695
- // Preserve existing analytics if new response doesn't have it
711
+ // Preserve existing analytics and matching_sets if new response doesn't have them
696
712
  const existingAnalytics = results === null || results === void 0 ? void 0 : results.analytics;
697
- response = getFormatedData(response, existingAnalytics);
713
+ const existingMatchingSets = results === null || results === void 0 ? void 0 : results.matching_sets;
714
+ response = getFormatedData(response, existingAnalytics, existingMatchingSets);
698
715
  const listIdRequestProps = Object.assign({}, props);
699
716
  listIdRequestProps.searchWithinSearch = undefined;
700
717
  listIdRequestProps.productsPerPage = 1000000;
@@ -703,6 +720,8 @@ const FastSimonApi = (_a) => {
703
720
  listIdRequestProps.variation_id = state.variation_id;
704
721
  listIdRequestProps.force_and = state.force_and;
705
722
  listIdRequestProps.ps = personalizationSegment;
723
+ listIdRequestProps.spv = personalizationParams.spv;
724
+ listIdRequestProps.personalization = personalizationParams.personalization;
706
725
  let listIdRes = yield SmartCollections.getSmartCollectionsProductsIds(listIdRequestProps).then((response) => {
707
726
  return response;
708
727
  });
@@ -716,6 +735,8 @@ const FastSimonApi = (_a) => {
716
735
  facetsRequestProps.variation_id = state.variation_id;
717
736
  facetsRequestProps.force_and = state.force_and;
718
737
  facetsRequestProps.ps = personalizationSegment;
738
+ facetsRequestProps.spv = personalizationParams.spv;
739
+ facetsRequestProps.personalization = personalizationParams.personalization;
719
740
  let facetsRes = yield SmartCollections.getSmartCollections(facetsRequestProps).then((response) => {
720
741
  return response;
721
742
  });
@@ -752,7 +773,7 @@ const FastSimonApi = (_a) => {
752
773
  setCategories(data);
753
774
  return data;
754
775
  }), [categories]);
755
- const getFormatedData = (response, existingAnalytics) => {
776
+ const getFormatedData = (response, existingAnalytics, existingMatchingSets) => {
756
777
  const results = response;
757
778
  results.products = response.items;
758
779
  delete results.items;
@@ -786,6 +807,14 @@ const FastSimonApi = (_a) => {
786
807
  else if (existingAnalytics) {
787
808
  results.analytics = existingAnalytics;
788
809
  }
810
+ // Preserve matching_sets field if present (product ID -> set name)
811
+ // If response has new matching_sets, use it; otherwise keep existing
812
+ if (response.matching_sets) {
813
+ results.matching_sets = response.matching_sets;
814
+ }
815
+ else if (existingMatchingSets) {
816
+ results.matching_sets = existingMatchingSets;
817
+ }
789
818
  return results;
790
819
  };
791
820
  // Memoize state context to prevent unnecessary re-renders
@@ -827,6 +856,7 @@ const FastSimonApi = (_a) => {
827
856
  setVariationId,
828
857
  setForceAnd,
829
858
  setUserSegmentPreview,
859
+ setPersonalizationPreview,
830
860
  updateSettingsAndRefetch
831
861
  } }, { children: _jsx(FastState.Provider, Object.assign({ value: stateContextValue }, { children: _jsx(ThemeProvider, Object.assign({ theme: mergedTheme }, { children: children })) })) })));
832
862
  };