From 8506507ec881796df5a971d988e0b601f243d97f Mon Sep 17 00:00:00 2001 From: Felix Perron-Brault Date: Wed, 17 Jul 2024 10:49:01 -0400 Subject: [PATCH] remove triggersearch --- packages/atomic/src/components.d.ts | 20 ++++++++++++------- .../controllers/core/tab/headless-core-tab.ts | 3 +-- .../src/controllers/tab/headless-tab.test.ts | 2 +- .../src/controllers/tab/headless-tab.ts | 8 +++----- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/packages/atomic/src/components.d.ts b/packages/atomic/src/components.d.ts index 69b8bde8fdf..d88ba179ec3 100644 --- a/packages/atomic/src/components.d.ts +++ b/packages/atomic/src/components.d.ts @@ -5,6 +5,8 @@ * It contains typing information for all components that exist in this project. */ import { HTMLStencilElement, JSXBase } from "@stencil/core/internal"; +import { AutomaticFacet, CategoryFacetSortCriterion, DateFilterRange, DateRangeRequest, FacetResultsMustMatch, FacetSortCriterion, FoldedResult, GeneratedAnswer, GeneratedAnswerCitation, GeneratedAnswerStyle, InlineLink, InteractiveCitation, InteractiveResult, LogLevel as LogLevel1, PlatformEnvironment as PlatformEnvironment2, RangeFacetRangeAlgorithm, RangeFacetSortCriterion, Result, ResultTemplate, ResultTemplateCondition, SearchEngine, SearchStatus } from "@coveo/headless"; +import { CategoryFacet, CommerceEngine, DateFacet, InteractiveProduct, LogLevel, NumericFacet, PlatformEnvironment, Product, ProductListing, ProductListingSummaryState, ProductTemplate, ProductTemplateCondition, RegularFacet, Search, SearchSummaryState, Summary } from "@coveo/headless/commerce"; import { CommerceBindings as Bindings } from "./components/commerce/atomic-commerce-interface/atomic-commerce-interface"; import { Range } from "./components/commerce/facets/facet-number-input/atomic-commerce-facet-number-input"; import { i18n } from "i18next"; @@ -18,7 +20,7 @@ import { unknown as AnyBindings, i18nCompatibilityVersion as i18nCompatibilityVe import { AnyBindings as AnyBindings1 } from "./components/common/interface/bindings"; import { NumberInputType } from "./components/common/facets/facet-number-input/number-input-type"; import { NumericFilter, NumericFilterState, RelativeDateUnit } from "./components/common/types"; -import { InsightEngine, unknown as InsightFacetSortCriterion, unknown as InsightFoldedResult, unknown as InsightGeneratedAnswerStyle, unknown as InsightInteractiveResult, LogLevel as InsightLogLevel, unknown as InsightRangeFacetRangeAlgorithm, unknown as InsightRangeFacetSortCriterion, unknown as InsightResult, unknown as InsightResultTemplate, unknown as InsightResultTemplateCondition, unknown as PlatformEnvironmentInsight } from "./components/insight"; +import { InsightEngine, FacetSortCriterion as InsightFacetSortCriterion, FoldedResult as InsightFoldedResult, GeneratedAnswerStyle as InsightGeneratedAnswerStyle, InteractiveResult as InsightInteractiveResult, LogLevel as InsightLogLevel, RangeFacetRangeAlgorithm as InsightRangeFacetRangeAlgorithm, RangeFacetSortCriterion as InsightRangeFacetSortCriterion, Result as InsightResult, ResultTemplate as InsightResultTemplate, ResultTemplateCondition as InsightResultTemplateCondition, PlatformEnvironment as PlatformEnvironmentInsight } from "./components/insight"; import { i18nCompatibilityVersion } from "./components/common/interface/i18n"; import { InsightInitializationOptions } from "./components/insight/atomic-insight-interface/atomic-insight-interface"; import { AtomicInsightStore } from "./components/insight/atomic-insight-interface/store"; @@ -26,12 +28,15 @@ import { InsightResultActionClickedEvent } from "./components/insight/atomic-ins import { Section } from "./components/common/atomic-layout-section/sections"; import { AtomicCommonStore, AtomicCommonStoreData } from "./components/common/interface/store"; import { SelectChildProductEventArgs } from "./components/commerce/product-template-components/atomic-product-children/atomic-product-children"; +import { PlatformEnvironment as PlatformEnvironment1, RecommendationEngine } from "@coveo/headless/recommendation"; import { InteractiveResult as RecsInteractiveResult, LogLevel as RecsLogLevel, Result as RecsResult, ResultTemplate as RecsResultTemplate, ResultTemplateCondition as RecsResultTemplateCondition } from "./components/recommendations"; import { RecsInitializationOptions } from "./components/recommendations/atomic-recs-interface/atomic-recs-interface"; import { AtomicRecsStore } from "./components/recommendations/atomic-recs-interface/store"; import { Bindings as Bindings1 } from "./components/search/atomic-search-interface/atomic-search-interface"; import { AriaLabelGenerator as AriaLabelGenerator1 } from "./components/search/search-box-suggestions/atomic-search-box-instant-results/atomic-search-box-instant-results"; import { InitializationOptions } from "./components/search/atomic-search-interface/atomic-search-interface"; +export { AutomaticFacet, CategoryFacetSortCriterion, DateFilterRange, DateRangeRequest, FacetResultsMustMatch, FacetSortCriterion, FoldedResult, GeneratedAnswer, GeneratedAnswerCitation, GeneratedAnswerStyle, InlineLink, InteractiveCitation, InteractiveResult, LogLevel as LogLevel1, PlatformEnvironment as PlatformEnvironment2, RangeFacetRangeAlgorithm, RangeFacetSortCriterion, Result, ResultTemplate, ResultTemplateCondition, SearchEngine, SearchStatus } from "@coveo/headless"; +export { CategoryFacet, CommerceEngine, DateFacet, InteractiveProduct, LogLevel, NumericFacet, PlatformEnvironment, Product, ProductListing, ProductListingSummaryState, ProductTemplate, ProductTemplateCondition, RegularFacet, Search, SearchSummaryState, Summary } from "@coveo/headless/commerce"; export { CommerceBindings as Bindings } from "./components/commerce/atomic-commerce-interface/atomic-commerce-interface"; export { Range } from "./components/commerce/facets/facet-number-input/atomic-commerce-facet-number-input"; export { i18n } from "i18next"; @@ -45,7 +50,7 @@ export { unknown as AnyBindings, i18nCompatibilityVersion as i18nCompatibilityVe export { AnyBindings as AnyBindings1 } from "./components/common/interface/bindings"; export { NumberInputType } from "./components/common/facets/facet-number-input/number-input-type"; export { NumericFilter, NumericFilterState, RelativeDateUnit } from "./components/common/types"; -export { InsightEngine, unknown as InsightFacetSortCriterion, unknown as InsightFoldedResult, unknown as InsightGeneratedAnswerStyle, unknown as InsightInteractiveResult, LogLevel as InsightLogLevel, unknown as InsightRangeFacetRangeAlgorithm, unknown as InsightRangeFacetSortCriterion, unknown as InsightResult, unknown as InsightResultTemplate, unknown as InsightResultTemplateCondition, unknown as PlatformEnvironmentInsight } from "./components/insight"; +export { InsightEngine, FacetSortCriterion as InsightFacetSortCriterion, FoldedResult as InsightFoldedResult, GeneratedAnswerStyle as InsightGeneratedAnswerStyle, InteractiveResult as InsightInteractiveResult, LogLevel as InsightLogLevel, RangeFacetRangeAlgorithm as InsightRangeFacetRangeAlgorithm, RangeFacetSortCriterion as InsightRangeFacetSortCriterion, Result as InsightResult, ResultTemplate as InsightResultTemplate, ResultTemplateCondition as InsightResultTemplateCondition, PlatformEnvironment as PlatformEnvironmentInsight } from "./components/insight"; export { i18nCompatibilityVersion } from "./components/common/interface/i18n"; export { InsightInitializationOptions } from "./components/insight/atomic-insight-interface/atomic-insight-interface"; export { AtomicInsightStore } from "./components/insight/atomic-insight-interface/store"; @@ -53,6 +58,7 @@ export { InsightResultActionClickedEvent } from "./components/insight/atomic-ins export { Section } from "./components/common/atomic-layout-section/sections"; export { AtomicCommonStore, AtomicCommonStoreData } from "./components/common/interface/store"; export { SelectChildProductEventArgs } from "./components/commerce/product-template-components/atomic-product-children/atomic-product-children"; +export { PlatformEnvironment as PlatformEnvironment1, RecommendationEngine } from "@coveo/headless/recommendation"; export { InteractiveResult as RecsInteractiveResult, LogLevel as RecsLogLevel, Result as RecsResult, ResultTemplate as RecsResultTemplate, ResultTemplateCondition as RecsResultTemplateCondition } from "./components/recommendations"; export { RecsInitializationOptions } from "./components/recommendations/atomic-recs-interface/atomic-recs-interface"; export { AtomicRecsStore } from "./components/recommendations/atomic-recs-interface/store"; @@ -1181,7 +1187,7 @@ export namespace Components { * @param organizationId * @param env */ - "getOrganizationEndpoints": (organizationId: string, env?: PlatformEnvironmentInsight) => Promise; + "getOrganizationEndpoints": (organizationId: string, env?: PlatformEnvironmentInsight) => Promise<{ platform: string; analytics: string; search: string; admin: string; }>; /** * The service insight interface i18next instance. */ @@ -2193,7 +2199,7 @@ export namespace Components { * A list of non-default fields to include in the query results. Specify the property as an array using a JSON string representation: ```html ``` */ "fieldsToInclude": string[] | string; - "getOrganizationEndpoints": (organizationId: string, env?: PlatformEnvironment) => Promise<{ platform: string; analytics: string; search: string; admin: string; }>; + "getOrganizationEndpoints": (organizationId: string, env?: PlatformEnvironment1) => Promise<{ platform: string; analytics: string; search: string; admin: string; }>; /** * Fetches new recommendations. */ @@ -3007,7 +3013,7 @@ export namespace Components { * @param organizationId * @param env */ - "getOrganizationEndpoints": (organizationId: string, env?: PlatformEnvironment) => Promise<{ platform: string; analytics: string; search: string; admin: string; }>; + "getOrganizationEndpoints": (organizationId: string, env?: PlatformEnvironment2) => Promise<{ platform: string; analytics: string; search: string; admin: string; }>; /** * The search interface i18next instance. */ @@ -3039,7 +3045,7 @@ export namespace Components { /** * The severity level of the messages to log in the console. */ - "logLevel"?: LogLevel; + "logLevel"?: LogLevel1; /** * The search interface [query pipeline](https://docs.coveo.com/en/180/). If the search interface is initialized using [`initializeWithSearchEngine`](https://docs.coveo.com/en/atomic/latest/reference/components/atomic-search-interface/#initializewithsearchengine), the query pipeline should instead be configured in the target engine. */ @@ -8387,7 +8393,7 @@ declare namespace LocalJSX { /** * The severity level of the messages to log in the console. */ - "logLevel"?: LogLevel; + "logLevel"?: LogLevel1; /** * The search interface [query pipeline](https://docs.coveo.com/en/180/). If the search interface is initialized using [`initializeWithSearchEngine`](https://docs.coveo.com/en/atomic/latest/reference/components/atomic-search-interface/#initializewithsearchengine), the query pipeline should instead be configured in the target engine. */ diff --git a/packages/headless/src/controllers/core/tab/headless-core-tab.ts b/packages/headless/src/controllers/core/tab/headless-core-tab.ts index b70c6f19691..ff9988d848d 100644 --- a/packages/headless/src/controllers/core/tab/headless-core-tab.ts +++ b/packages/headless/src/controllers/core/tab/headless-core-tab.ts @@ -81,9 +81,8 @@ export interface TabProps { export interface Tab extends Controller { /** * Activates the tab. - * @param triggerSearch - Optional parameter indicating whether to trigger a search when the tab is activated. */ - select(triggerSearch?: boolean): void; + select(): void; /** * The state of the `Tab` controller. */ diff --git a/packages/headless/src/controllers/tab/headless-tab.test.ts b/packages/headless/src/controllers/tab/headless-tab.test.ts index a73d12d5879..356ad886af3 100644 --- a/packages/headless/src/controllers/tab/headless-tab.test.ts +++ b/packages/headless/src/controllers/tab/headless-tab.test.ts @@ -39,7 +39,7 @@ describe('Tab', () => { describe('#select', () => { it('dispatches #executeSearch', () => { - tab.select(true); + tab.select(); expect(executeSearch).toHaveBeenCalled(); }); }); diff --git a/packages/headless/src/controllers/tab/headless-tab.ts b/packages/headless/src/controllers/tab/headless-tab.ts index 077dc408343..b5fcae6de5c 100644 --- a/packages/headless/src/controllers/tab/headless-tab.ts +++ b/packages/headless/src/controllers/tab/headless-tab.ts @@ -40,11 +40,9 @@ export function buildTab(engine: SearchEngine, props: TabProps): Tab { return tab.state; }, - select(triggerSearch: boolean) { - tab.select(false); - if (triggerSearch) { - search(); - } + select() { + tab.select(); + search(); }, }; }