@fast-simon/dashboard-utilities 1.0.138-beta.2 → 1.0.138-beta.4
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.
- package/dist/@types/autocomplete.d.ts +2 -0
- package/dist/@types/autocomplete.js.map +1 -1
- package/dist/@types/categories.d.ts +1 -0
- package/dist/@types/categories.js.map +1 -1
- package/dist/@types/results.d.ts +1 -0
- package/dist/@types/results.js.map +1 -1
- package/dist/components/FastSimonApi/FastSimonApi.js +61 -7
- package/dist/components/FastSimonApi/FastSimonApi.js.map +1 -1
- package/dist/components/FastSimonApi/context.d.ts +4 -0
- package/dist/components/FastSimonApi/context.js.map +1 -1
- package/dist/components/FastSimonApi/reducer.d.ts +10 -0
- package/dist/components/FastSimonApi/reducer.js +5 -1
- package/dist/components/FastSimonApi/reducer.js.map +1 -1
- package/dist/services/autocomplete.d.ts +1 -1
- package/dist/services/autocomplete.js +4 -2
- package/dist/services/autocomplete.js.map +1 -1
- package/dist/services/search.d.ts +3 -3
- package/dist/services/search.js +6 -6
- package/dist/services/search.js.map +1 -1
- package/dist/services/smartCollections.d.ts +2 -2
- package/dist/services/smartCollections.js +2 -2
- package/dist/services/smartCollections.js.map +1 -1
- package/package.json +1 -1
|
@@ -29,6 +29,8 @@ export interface autocompleteProps {
|
|
|
29
29
|
disable_antonyms?: boolean;
|
|
30
30
|
market_context?: string | null;
|
|
31
31
|
variation_id?: string | null;
|
|
32
|
+
force_and?: boolean;
|
|
33
|
+
ps?: 'new' | 'returning' | null;
|
|
32
34
|
}
|
|
33
35
|
export interface AutocompleteReasoningResponse {
|
|
34
36
|
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}\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}\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,7 @@ export interface smartCollectionsProps {
|
|
|
64
64
|
market_context?: string | null;
|
|
65
65
|
variation_id?: string | null;
|
|
66
66
|
ps?: 'new' | 'returning' | null;
|
|
67
|
+
force_and?: boolean;
|
|
67
68
|
}
|
|
68
69
|
export type FacetRequired = 0 | 1 | 2;
|
|
69
70
|
export type smartCollectionsCallback = ({}: {
|
|
@@ -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}\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 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}"]}
|
package/dist/@types/results.d.ts
CHANGED
|
@@ -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}\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}\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}"]}
|
|
@@ -61,6 +61,7 @@ const FastSimonApi = (_a) => {
|
|
|
61
61
|
custom_sort_settings: undefined,
|
|
62
62
|
isAutocomplete: false,
|
|
63
63
|
variation_id: variationId,
|
|
64
|
+
force_and: false,
|
|
64
65
|
user_segment_preview: 'none',
|
|
65
66
|
// Compare Mode state
|
|
66
67
|
comparisonData: null,
|
|
@@ -106,6 +107,12 @@ const FastSimonApi = (_a) => {
|
|
|
106
107
|
function setIsComparing(isComparing) {
|
|
107
108
|
dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'setIsComparing', payload: isComparing });
|
|
108
109
|
}
|
|
110
|
+
function setForceAnd(forceAnd) {
|
|
111
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'setForceAnd', payload: forceAnd });
|
|
112
|
+
}
|
|
113
|
+
function updateSettingsAndRefetch(settings) {
|
|
114
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'updateSettingsAndRefetch', payload: settings });
|
|
115
|
+
}
|
|
109
116
|
function setUserSegmentPreview(preview) {
|
|
110
117
|
userSegmentPreviewRef.current = preview;
|
|
111
118
|
dispatch === null || dispatch === void 0 ? void 0 : dispatch({ type: 'setUserSegmentPreview', payload: preview });
|
|
@@ -187,6 +194,7 @@ const FastSimonApi = (_a) => {
|
|
|
187
194
|
disable_merchandising_rules: state.flag.find((f) => f == "disable_merchandising_rules") ? 1 : 0,
|
|
188
195
|
disable_antonyms: state.flag.find((f) => f == "disable_antonyms") ? 1 : 0,
|
|
189
196
|
variation_id: state.variation_id,
|
|
197
|
+
force_and: state.force_and,
|
|
190
198
|
};
|
|
191
199
|
fetchResults(fetchParams, isInfiniteScroll, isAutocomplete ? isAutocomplete : false);
|
|
192
200
|
}
|
|
@@ -212,6 +220,7 @@ const FastSimonApi = (_a) => {
|
|
|
212
220
|
disable_merchandising_rules: state.flag.find((f) => f == "disable_merchandising_rules") ? 1 : 0,
|
|
213
221
|
disable_antonyms: state.flag.find((f) => f == "disable_antonyms") ? 1 : 0,
|
|
214
222
|
variation_id: state.variation_id,
|
|
223
|
+
force_and: state.force_and,
|
|
215
224
|
};
|
|
216
225
|
fetchResults(fetchParams, isInfiniteScroll);
|
|
217
226
|
}
|
|
@@ -232,6 +241,7 @@ const FastSimonApi = (_a) => {
|
|
|
232
241
|
searchWithinSearch: state.searchWithinSearch,
|
|
233
242
|
custom_sort_settings: state.custom_sort_settings,
|
|
234
243
|
variation_id: state.variation_id,
|
|
244
|
+
force_and: state.force_and,
|
|
235
245
|
};
|
|
236
246
|
if (flags.length > 0) {
|
|
237
247
|
flags.forEach((f) => {
|
|
@@ -265,6 +275,7 @@ const FastSimonApi = (_a) => {
|
|
|
265
275
|
disable_merchandising_rules: state.flag.find((f) => f == "disable_merchandising_rules") ? 1 : 0,
|
|
266
276
|
disable_antonyms: state.flag.find((f) => f == "disable_antonyms") ? 1 : 0,
|
|
267
277
|
variation_id: state.variation_id,
|
|
278
|
+
force_and: state.force_and,
|
|
268
279
|
};
|
|
269
280
|
fetchResults(fetchParams, isInfiniteScroll);
|
|
270
281
|
}
|
|
@@ -289,6 +300,7 @@ const FastSimonApi = (_a) => {
|
|
|
289
300
|
disable_merchandising_rules: state.flag.find((f) => f == "disable_merchandising_rules") ? 1 : 0,
|
|
290
301
|
disable_antonyms: state.flag.find((f) => f == "disable_antonyms") ? 1 : 0,
|
|
291
302
|
variation_id: state.variation_id,
|
|
303
|
+
force_and: state.force_and,
|
|
292
304
|
};
|
|
293
305
|
fetchResults(fetchParams, isInfiniteScroll, state.isAutocomplete);
|
|
294
306
|
}
|
|
@@ -314,6 +326,7 @@ const FastSimonApi = (_a) => {
|
|
|
314
326
|
disable_merchandising_rules: state.flag.find((f) => f == "disable_merchandising_rules") ? 1 : 0,
|
|
315
327
|
disable_antonyms: state.flag.find((f) => f == "disable_antonyms") ? 1 : 0,
|
|
316
328
|
variation_id: state.variation_id,
|
|
329
|
+
force_and: state.force_and,
|
|
317
330
|
};
|
|
318
331
|
fetchResults(fetchParams, isInfiniteScroll);
|
|
319
332
|
}
|
|
@@ -339,6 +352,7 @@ const FastSimonApi = (_a) => {
|
|
|
339
352
|
disable_merchandising_rules: state.flag.find((f) => f == "disable_merchandising_rules") ? 1 : 0,
|
|
340
353
|
disable_antonyms: state.flag.find((f) => f == "disable_antonyms") ? 1 : 0,
|
|
341
354
|
variation_id: state.variation_id,
|
|
355
|
+
force_and: state.force_and,
|
|
342
356
|
};
|
|
343
357
|
fetchResults(fetchParams, isInfiniteScroll);
|
|
344
358
|
}
|
|
@@ -363,6 +377,7 @@ const FastSimonApi = (_a) => {
|
|
|
363
377
|
disable_merchandising_rules: state.flag.find((f) => f == "disable_merchandising_rules") ? 1 : 0,
|
|
364
378
|
disable_antonyms: state.flag.find((f) => f == "disable_antonyms") ? 1 : 0,
|
|
365
379
|
variation_id: state.variation_id,
|
|
380
|
+
force_and: state.force_and,
|
|
366
381
|
};
|
|
367
382
|
fetchResults(fetchParams, isInfiniteScroll);
|
|
368
383
|
}
|
|
@@ -383,6 +398,7 @@ const FastSimonApi = (_a) => {
|
|
|
383
398
|
page: newState.page,
|
|
384
399
|
segments: newState.segments,
|
|
385
400
|
variation_id: state.variation_id,
|
|
401
|
+
force_and: state.force_and,
|
|
386
402
|
}, Boolean(!results && isInfiniteScroll && newState.page && newState.page > 1));
|
|
387
403
|
}
|
|
388
404
|
function setSingleProducts(products) {
|
|
@@ -412,6 +428,7 @@ const FastSimonApi = (_a) => {
|
|
|
412
428
|
disable_merchandising_rules: state.flag.find((f) => f == "disable_merchandising_rules") ? 1 : 0,
|
|
413
429
|
disable_antonyms: state.flag.find((f) => f == "disable_antonyms") ? 1 : 0,
|
|
414
430
|
variation_id: state.variation_id,
|
|
431
|
+
force_and: state.force_and,
|
|
415
432
|
};
|
|
416
433
|
fetchResults(fetchParams, isInfiniteScroll);
|
|
417
434
|
}
|
|
@@ -442,7 +459,7 @@ const FastSimonApi = (_a) => {
|
|
|
442
459
|
setFlag(event.details);
|
|
443
460
|
}
|
|
444
461
|
function handleSetCollectionEvent(event) {
|
|
445
|
-
setCollectionID(event.detail);
|
|
462
|
+
setCollectionID(typeof event.detail === 'string' ? event.detail : event.detail.collectionID);
|
|
446
463
|
}
|
|
447
464
|
function handleSetCollectionURLEvent(event) {
|
|
448
465
|
getAllCategories().then(r => {
|
|
@@ -498,6 +515,35 @@ const FastSimonApi = (_a) => {
|
|
|
498
515
|
setCollectionID(state.collectionID);
|
|
499
516
|
}
|
|
500
517
|
}, [state.user_segment_preview]);
|
|
518
|
+
// Settings modal refetch: triggered after state is updated (no race conditions)
|
|
519
|
+
useEffect(() => {
|
|
520
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
521
|
+
if (!state.refetchTrigger)
|
|
522
|
+
return;
|
|
523
|
+
// Build fetchParams from the now-updated state
|
|
524
|
+
const fetchParams = {
|
|
525
|
+
siteKey: siteKey,
|
|
526
|
+
uuid: uuid,
|
|
527
|
+
storeID: storeID,
|
|
528
|
+
term: state.query,
|
|
529
|
+
narrowBy: state.narrow,
|
|
530
|
+
sortBy: (_a = state.sortBy) !== null && _a !== void 0 ? _a : defaultSort,
|
|
531
|
+
categoryID: state.collectionID,
|
|
532
|
+
segments: state.segments,
|
|
533
|
+
withProductAttributes: withProductAttributes,
|
|
534
|
+
searchWithinSearch: state.searchWithinSearch,
|
|
535
|
+
custom_sort_settings: state.custom_sort_settings,
|
|
536
|
+
disable_merchandising: ((_b = state.flag) === null || _b === void 0 ? void 0 : _b.find((f) => f == "disable_merchandising")) ? 1 : 0,
|
|
537
|
+
disable_semantics: ((_c = state.flag) === null || _c === void 0 ? void 0 : _c.find((f) => f == "disable_semantics")) ? 1 : 0,
|
|
538
|
+
disable_turbolinks: ((_d = state.flag) === null || _d === void 0 ? void 0 : _d.find((f) => f == "disable_turbolinks")) ? 1 : 0,
|
|
539
|
+
disable_strategies: ((_e = state.flag) === null || _e === void 0 ? void 0 : _e.find((f) => f == "disable_strategies")) ? 1 : 0,
|
|
540
|
+
disable_merchandising_rules: ((_f = state.flag) === null || _f === void 0 ? void 0 : _f.find((f) => f == "disable_merchandising_rules")) ? 1 : 0,
|
|
541
|
+
disable_antonyms: ((_g = state.flag) === null || _g === void 0 ? void 0 : _g.find((f) => f == "disable_antonyms")) ? 1 : 0,
|
|
542
|
+
variation_id: state.variation_id,
|
|
543
|
+
force_and: state.force_and,
|
|
544
|
+
};
|
|
545
|
+
fetchResults(fetchParams, isInfiniteScroll, state.isAutocomplete);
|
|
546
|
+
}, [state.refetchTrigger]);
|
|
501
547
|
const onSearch = (props, isInfiniteScroll) => {
|
|
502
548
|
setIsLoading({ products: true, filters: true });
|
|
503
549
|
// Clear previous comparison data when starting new search
|
|
@@ -511,7 +557,7 @@ const FastSimonApi = (_a) => {
|
|
|
511
557
|
const shouldFetchAnalytics = currentForceAnalytics || (isAnalyticsEnabled && (currentQuery !== lastAnalyticsQuery || lastAnalyticsMode !== 'search'));
|
|
512
558
|
// Check if hybrid search is enabled - we'll need to make a comparison call
|
|
513
559
|
const isHybridEnabled = getLSVectorSearchOn();
|
|
514
|
-
FullTextSearch.getReasoningFullTextSearch(Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, with_product_analytics: shouldFetchAnalytics, market_context: marketContext, variation_id: state.variation_id })).then((response) => __awaiter(void 0, void 0, void 0, function* () {
|
|
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* () {
|
|
515
561
|
var _a;
|
|
516
562
|
// Mark analytics as fetched only if response contains analytics data with badges
|
|
517
563
|
if (shouldFetchAnalytics && ((_a = response.analytics) === null || _a === void 0 ? void 0 : _a.badges)) {
|
|
@@ -540,6 +586,7 @@ const FastSimonApi = (_a) => {
|
|
|
540
586
|
listIdRequestProps.page = 1;
|
|
541
587
|
listIdRequestProps.market_context = marketContext;
|
|
542
588
|
listIdRequestProps.variation_id = state.variation_id;
|
|
589
|
+
listIdRequestProps.force_and = state.force_and;
|
|
543
590
|
let listIdRes = yield FullTextSearch.getReasoningFullTextSearchProductsIds(listIdRequestProps).then((response) => {
|
|
544
591
|
return response;
|
|
545
592
|
});
|
|
@@ -551,6 +598,7 @@ const FastSimonApi = (_a) => {
|
|
|
551
598
|
facetsRequestProps.page = props.page;
|
|
552
599
|
facetsRequestProps.market_context = marketContext;
|
|
553
600
|
facetsRequestProps.variation_id = state.variation_id;
|
|
601
|
+
facetsRequestProps.force_and = state.force_and;
|
|
554
602
|
let facetsRes = yield FullTextSearch.getReasoningFullTextSearch(facetsRequestProps).then((response) => {
|
|
555
603
|
return response;
|
|
556
604
|
});
|
|
@@ -579,7 +627,7 @@ const FastSimonApi = (_a) => {
|
|
|
579
627
|
console.log("[Compare Mode] Making comparison IDs call...");
|
|
580
628
|
try {
|
|
581
629
|
// Get all IDs WITHOUT hybrid_search_settings
|
|
582
|
-
const comparisonResponse = yield FullTextSearch.getComparisonProductIds(Object.assign(Object.assign({}, props), { market_context: marketContext, variation_id: state.variation_id }));
|
|
630
|
+
const comparisonResponse = yield FullTextSearch.getComparisonProductIds(Object.assign(Object.assign({}, props), { market_context: marketContext, variation_id: state.variation_id, force_and: state.force_and }));
|
|
583
631
|
const hybridOffIds = (comparisonResponse.id_list || []).map(id => id.toString());
|
|
584
632
|
const hybridOnIds = (response.id_list || []).map(id => id.toString());
|
|
585
633
|
console.log("[Compare Mode] Hybrid ON IDs count:", hybridOnIds.length);
|
|
@@ -602,7 +650,8 @@ const FastSimonApi = (_a) => {
|
|
|
602
650
|
};
|
|
603
651
|
const onAutocompleteSearch = (props) => {
|
|
604
652
|
setIsLoading({ products: true, filters: true });
|
|
605
|
-
|
|
653
|
+
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* () {
|
|
606
655
|
response = getFormatedData(response);
|
|
607
656
|
mergeResults(response, false);
|
|
608
657
|
if (!customTitleChange) {
|
|
@@ -634,7 +683,7 @@ const FastSimonApi = (_a) => {
|
|
|
634
683
|
const shouldFetchAnalytics = currentForceAnalytics || (isAnalyticsEnabled && (currentCollection !== lastAnalyticsCollection || lastAnalyticsMode !== 'collection'));
|
|
635
684
|
const personalizationSegment = getPersonalizationSegment(userSegmentPreviewRef.current);
|
|
636
685
|
lastFetchedSegmentRef.current = userSegmentPreviewRef.current;
|
|
637
|
-
SmartCollections.getSmartCollections(Object.assign(Object.assign({}, props), { withAttributes: promoTiles || withProductAttributes, with_product_analytics: shouldFetchAnalytics, market_context: marketContext, variation_id: state.variation_id, ps: personalizationSegment }))
|
|
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 }))
|
|
638
687
|
.then((response) => __awaiter(void 0, void 0, void 0, function* () {
|
|
639
688
|
var _a;
|
|
640
689
|
// Mark analytics as fetched only if response contains analytics data with badges
|
|
@@ -652,6 +701,7 @@ const FastSimonApi = (_a) => {
|
|
|
652
701
|
listIdRequestProps.page = 1;
|
|
653
702
|
listIdRequestProps.market_context = marketContext;
|
|
654
703
|
listIdRequestProps.variation_id = state.variation_id;
|
|
704
|
+
listIdRequestProps.force_and = state.force_and;
|
|
655
705
|
listIdRequestProps.ps = personalizationSegment;
|
|
656
706
|
let listIdRes = yield SmartCollections.getSmartCollectionsProductsIds(listIdRequestProps).then((response) => {
|
|
657
707
|
return response;
|
|
@@ -664,6 +714,7 @@ const FastSimonApi = (_a) => {
|
|
|
664
714
|
facetsRequestProps.page = props.page;
|
|
665
715
|
facetsRequestProps.market_context = marketContext;
|
|
666
716
|
facetsRequestProps.variation_id = state.variation_id;
|
|
717
|
+
facetsRequestProps.force_and = state.force_and;
|
|
667
718
|
facetsRequestProps.ps = personalizationSegment;
|
|
668
719
|
let facetsRes = yield SmartCollections.getSmartCollections(facetsRequestProps).then((response) => {
|
|
669
720
|
return response;
|
|
@@ -753,9 +804,10 @@ const FastSimonApi = (_a) => {
|
|
|
753
804
|
autocomplete,
|
|
754
805
|
isAutocomplete,
|
|
755
806
|
variation_id: state.variation_id,
|
|
807
|
+
force_and: state.force_and,
|
|
756
808
|
comparisonData: state.comparisonData,
|
|
757
809
|
isComparing: state.isComparing
|
|
758
|
-
}), [narrow, results, page, query, sortBy, type, collectionID, isLoading, recommendations, singleProducts, isReady, autocomplete, isAutocomplete, state.variation_id, state.comparisonData, state.isComparing]);
|
|
810
|
+
}), [narrow, results, page, query, sortBy, type, collectionID, isLoading, recommendations, singleProducts, isReady, autocomplete, isAutocomplete, state.variation_id, state.force_and, state.comparisonData, state.isComparing]);
|
|
759
811
|
// Memoize theme to prevent unnecessary object creation
|
|
760
812
|
const mergedTheme = useMemo(() => (Object.assign(Object.assign({}, mainTheme), theme)), [theme]);
|
|
761
813
|
// @ts-ignore
|
|
@@ -773,7 +825,9 @@ const FastSimonApi = (_a) => {
|
|
|
773
825
|
setCustomSort,
|
|
774
826
|
setIsAutocomplete,
|
|
775
827
|
setVariationId,
|
|
776
|
-
|
|
828
|
+
setForceAnd,
|
|
829
|
+
setUserSegmentPreview,
|
|
830
|
+
updateSettingsAndRefetch
|
|
777
831
|
} }, { children: _jsx(FastState.Provider, Object.assign({ value: stateContextValue }, { children: _jsx(ThemeProvider, Object.assign({ theme: mergedTheme }, { children: children })) })) })));
|
|
778
832
|
};
|
|
779
833
|
// Memoize component to prevent unnecessary re-renders when parent updates
|