@coveo/quantic 3.22.2 → 3.23.0-pre.1c8addde3a

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 (33) hide show
  1. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +8 -8
  2. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo-analytics-utils.d.ts +1 -2
  3. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo.analytics/cookie.d.ts +5 -0
  4. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo.analytics/detector.d.ts +5 -0
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo.analytics/history-store.d.ts +41 -0
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/coveo.analytics/storage.d.ts +24 -0
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/insight-analytics.d.ts +1 -1
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/recommendations-analytics.d.ts +1 -1
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/search-analytics.d.ts +1 -1
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/stream-answer-api.d.ts +1 -0
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/tests/stream-answer-api-state-mock.d.ts +18 -0
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/api/preprocess-request.d.ts +1 -1
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/api/search/search-api-params.d.ts +2 -2
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/app/navigator-context-provider.d.ts +8 -0
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/app/ssr-engine/augment-preprocess-request.d.ts +9 -0
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/analytics-actions.d.ts +1 -1
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/analytics-utils.d.ts +2 -2
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/magic-cookie.d.ts +1 -0
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-selector.d.ts +26 -0
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-actions.d.ts +4 -1
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-actions.d.ts +4 -1
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-actions.d.ts +4 -1
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-actions.d.ts +4 -1
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-actions.d.ts +1 -1
  25. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-request.d.ts +1 -1
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +2 -2
  27. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-request.d.ts +1 -1
  28. package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-search-request.d.ts +1 -1
  29. package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
  30. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +9 -9
  31. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +7 -7
  32. package/force-app/main/default/staticresources/dompurify/purify.min.js +2 -2
  33. package/package.json +16 -16
@@ -1,9 +1,8 @@
1
- import { AnalyticsClientSendEventHook, IRuntimeEnvironment, history } from 'coveo.analytics';
1
+ import { AnalyticsClientSendEventHook, IRuntimeEnvironment } from 'coveo.analytics';
2
2
  import { Logger } from 'pino';
3
3
  import { PreprocessRequest } from '../preprocess-request.js';
4
4
  export declare const getVisitorID: (options: {
5
5
  runtimeEnvironment?: IRuntimeEnvironment;
6
6
  }) => Promise<string>;
7
- export declare const historyStore: history.HistoryStore;
8
7
  export declare const wrapPreprocessRequest: (logger: Logger, preprocessRequest?: PreprocessRequest) => ((request: import("../preprocess-request.js").PlatformRequestOptions, clientOrigin: import("../preprocess-request.js").PlatformClientOrigin, metadata?: import("../preprocess-request.js").RequestMetadata | undefined) => import("../preprocess-request.js").PlatformRequestOptions | Promise<import("../preprocess-request.js").PlatformRequestOptions>) | undefined;
9
8
  export declare const wrapAnalyticsClientSendEventHook: (logger: Logger, hook: AnalyticsClientSendEventHook) => (...args: Parameters<AnalyticsClientSendEventHook>) => any;
@@ -0,0 +1,5 @@
1
+ export declare class Cookie {
2
+ static set(name: string, value: string, expire?: number): void;
3
+ static get(name: string): string | null;
4
+ static erase(name: string): void;
5
+ }
@@ -0,0 +1,5 @@
1
+ export declare function hasNavigator(): boolean;
2
+ export declare function hasDocument(): boolean;
3
+ export declare function hasLocalStorage(): boolean;
4
+ export declare function hasSessionStorage(): boolean;
5
+ export declare function hasCookieStorage(): boolean;
@@ -0,0 +1,41 @@
1
+ import { WebStorage } from './storage.js';
2
+ export declare const STORE_KEY: string;
3
+ export declare const MAX_NUMBER_OF_HISTORY_ELEMENTS: number;
4
+ export declare const MIN_THRESHOLD_FOR_DUPLICATE_VALUE: number;
5
+ export declare const MAX_VALUE_SIZE = 75;
6
+ export declare class HistoryStore {
7
+ private static instance;
8
+ static getInstance(store?: WebStorage): HistoryStore;
9
+ private store;
10
+ private constructor();
11
+ /**
12
+ * @deprecated Synchronous method is deprecated, use addElementAsync instead. This method will NOT work with react-native.
13
+ */
14
+ addElement(elem: HistoryElement): void;
15
+ addElementAsync(elem: HistoryElement): Promise<void>;
16
+ /**
17
+ * @deprecated Synchronous method is deprecated, use getHistoryAsync instead. This method will NOT work with react-native.
18
+ */
19
+ getHistory(): HistoryElement[];
20
+ getHistoryAsync(): Promise<HistoryElement[]>;
21
+ private getHistoryWithInternalTime;
22
+ private getHistoryWithInternalTimeAsync;
23
+ setHistory(history: HistoryElement[]): void;
24
+ clear(): void;
25
+ getMostRecentElement(): HistoryElement | null;
26
+ private cropQueryElement;
27
+ private isValidEntry;
28
+ private stripInternalTime;
29
+ private stripEmptyQuery;
30
+ private stripEmptyQueries;
31
+ }
32
+ export interface HistoryElement {
33
+ name: string;
34
+ value?: string;
35
+ time: string;
36
+ internalTime?: number;
37
+ }
38
+ export interface HistoryViewElement extends HistoryElement {
39
+ title?: string;
40
+ }
41
+ export default HistoryStore;
@@ -0,0 +1,24 @@
1
+ export declare const preferredStorage: WebStorage | null;
2
+ export interface WebStorage {
3
+ getItem(key: string): string | null | Promise<string | null>;
4
+ removeItem(key: string): void;
5
+ setItem(key: string, data: string): void | Promise<void>;
6
+ }
7
+ export declare function getAvailableStorage(): WebStorage;
8
+ export declare class CookieStorage implements WebStorage {
9
+ static prefix: string;
10
+ getItem(key: string): string | null;
11
+ removeItem(key: string): void;
12
+ setItem(key: string, data: string, expire?: number): void;
13
+ }
14
+ export declare class CookieAndLocalStorage implements WebStorage {
15
+ private cookieStorage;
16
+ getItem(key: string): string | null;
17
+ removeItem(key: string): void;
18
+ setItem(key: string, data: string): void;
19
+ }
20
+ export declare class NullStorage implements WebStorage {
21
+ getItem(_key: string): string | null;
22
+ removeItem(_key: string): void;
23
+ setItem(_key: string, _data: string): void;
24
+ }
@@ -1,5 +1,5 @@
1
1
  import { AnalyticsClientSendEventHook, InsightClientProvider, CoveoInsightClient } from 'coveo.analytics';
2
- import { SearchEventRequest } from 'coveo.analytics/dist/definitions/events.js';
2
+ import type { SearchEventRequest } from 'coveo.analytics/dist/definitions/events.js';
3
3
  import { Logger } from 'pino';
4
4
  import { SectionNeededForFacetMetadata } from '../../features/facets/facet-set/facet-set-analytics-actions-utils.js';
5
5
  import { InsightAppState } from '../../state/insight-app-state.js';
@@ -1,5 +1,5 @@
1
1
  import { SearchPageClientProvider } from 'coveo.analytics';
2
- import { SearchEventRequest } from 'coveo.analytics/dist/definitions/events.js';
2
+ import type { SearchEventRequest } from 'coveo.analytics/dist/definitions/events.js';
3
3
  import { ConfigurationSection, ContextSection, PipelineSection, RecommendationSection, SearchHubSection } from '../../state/state-sections.js';
4
4
  import { BaseAnalyticsProvider } from './base-analytics.js';
5
5
  export type StateNeededByRecommendationAnalyticsProvider = ConfigurationSection & Partial<SearchHubSection & PipelineSection & ContextSection & RecommendationSection>;
@@ -1,5 +1,5 @@
1
1
  import { CoveoSearchPageClient, SearchPageClientProvider, AnalyticsClientSendEventHook } from 'coveo.analytics';
2
- import { SearchEventRequest } from 'coveo.analytics/dist/definitions/events.js';
2
+ import type { SearchEventRequest } from 'coveo.analytics/dist/definitions/events.js';
3
3
  import { Logger } from 'pino';
4
4
  import { FacetSortCriterion } from '../../features/facets/facet-set/interfaces/request.js';
5
5
  import { DateFacetValue } from '../../features/facets/range-facets/date-facet-set/interfaces/response.js';
@@ -97,6 +97,7 @@ export declare const constructAnswerQueryParams: (state: StateNeededByAnswerAPI,
97
97
  citationsFieldToInclude: string[];
98
98
  };
99
99
  };
100
+ context?: import("../../ssr.index.js").ContextPayload | undefined;
100
101
  lq?: string | undefined;
101
102
  dq?: string | undefined;
102
103
  cq?: string | undefined;
@@ -66,6 +66,9 @@ export declare const expectedStreamAnswerAPIParam: {
66
66
  cq: string;
67
67
  dq: string;
68
68
  lq: string;
69
+ context: {
70
+ testKey: string;
71
+ };
69
72
  pipelineRuleParameters: {
70
73
  mlGenerativeQuestionAnswering: {
71
74
  responseFormat: {
@@ -186,6 +189,9 @@ export declare const expectedStreamAnswerAPIParamWithATabWithAnExpression: {
186
189
  aq: string;
187
190
  dq: string;
188
191
  lq: string;
192
+ context: {
193
+ testKey: string;
194
+ };
189
195
  pipelineRuleParameters: {
190
196
  mlGenerativeQuestionAnswering: {
191
197
  responseFormat: {
@@ -305,6 +311,9 @@ export declare const expectedStreamAnswerAPIParamWithoutAnyTab: {
305
311
  cq: string;
306
312
  dq: string;
307
313
  lq: string;
314
+ context: {
315
+ testKey: string;
316
+ };
308
317
  pipelineRuleParameters: {
309
318
  mlGenerativeQuestionAnswering: {
310
319
  responseFormat: {
@@ -423,6 +432,9 @@ export declare const expectedStreamAnswerAPIParamWithStaticFiltersSelected: {
423
432
  aq: string;
424
433
  dq: string;
425
434
  lq: string;
435
+ context: {
436
+ testKey: string;
437
+ };
426
438
  pipelineRuleParameters: {
427
439
  mlGenerativeQuestionAnswering: {
428
440
  responseFormat: {
@@ -542,6 +554,9 @@ export declare const expectedStreamAnswerAPIParamWithStaticFiltersAndTabExpressi
542
554
  aq: string;
543
555
  dq: string;
544
556
  lq: string;
557
+ context: {
558
+ testKey: string;
559
+ };
545
560
  pipelineRuleParameters: {
546
561
  mlGenerativeQuestionAnswering: {
547
562
  responseFormat: {
@@ -661,6 +676,9 @@ export declare const expectedStreamAnswerAPIParamWithStaticFiltersAndTabExpressi
661
676
  aq: string;
662
677
  dq: string;
663
678
  lq: string;
679
+ context: {
680
+ testKey: string;
681
+ };
664
682
  pipelineRuleParameters: {
665
683
  mlGenerativeQuestionAnswering: {
666
684
  responseFormat: {
@@ -1,4 +1,4 @@
1
- import { AnalyticsClientOrigin } from 'coveo.analytics/dist/definitions/client/analyticsRequestClient.js';
1
+ import type { AnalyticsClientOrigin } from 'coveo.analytics/dist/definitions/client/analyticsRequestClient.js';
2
2
  import { CommerceApiMethod } from './commerce/commerce-metadata.js';
3
3
  import { SearchApiMethod, SearchOrigin } from './search/search-metadata.js';
4
4
  export interface PlatformRequestOptions extends RequestInit {
@@ -1,8 +1,8 @@
1
- import { history } from 'coveo.analytics';
2
1
  import { FacetOptions } from '../../features/facet-options/facet-options.js';
3
2
  import { AutomaticFacetRequest } from '../../features/facets/automatic-facet-set/interfaces/request.js';
4
3
  import { AnyFacetRequest } from '../../features/facets/generic/interfaces/generic-facet-request.js';
5
4
  import { GeneratedContentFormat } from '../../features/generated-answer/generated-response-format.js';
5
+ import { HistoryElement } from '../analytics/coveo.analytics/history-store.js';
6
6
  import { HTTPContentType, HttpMethods, PlatformClientCallOptions } from '../platform-client.js';
7
7
  import { BaseParam } from '../platform-service-params.js';
8
8
  export interface QueryParam {
@@ -79,7 +79,7 @@ export interface MaximumAgeParam {
79
79
  maximumAge: number;
80
80
  }
81
81
  export interface ActionsHistoryParam {
82
- actionsHistory?: history.HistoryElement[];
82
+ actionsHistory?: HistoryElement[];
83
83
  }
84
84
  export interface TimezoneParam {
85
85
  timezone: string;
@@ -2,6 +2,14 @@
2
2
  * The `NavigatorContext` interface represents the context of the browser client.
3
3
  */
4
4
  export interface NavigatorContext {
5
+ /**
6
+ * The`X-Forwarded-For` header.
7
+ * This header is used to identify the originating IP address of a client.
8
+ * See [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)
9
+ *
10
+ * **Note:** This property is only relevant for Server-Side Rendering (SSR) use cases.
11
+ */
12
+ forwardedFor?: string;
5
13
  /**
6
14
  * The URL of the page that referred the user to the current page.
7
15
  * See [Referer](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer)
@@ -0,0 +1,9 @@
1
+ import { PlatformClientOrigin, PlatformRequestOptions, PreprocessRequest, RequestMetadata } from '../../api/preprocess-request.js';
2
+ import { LoggerOptions } from '../logger.js';
3
+ import { NavigatorContextProvider } from '../navigator-context-provider.js';
4
+ export interface AugmentPreprocessRequestOptions {
5
+ preprocessRequest?: PreprocessRequest;
6
+ navigatorContextProvider?: NavigatorContextProvider;
7
+ loggerOptions?: LoggerOptions;
8
+ }
9
+ export declare function augmentPreprocessRequestWithForwardedFor(options: AugmentPreprocessRequestOptions): (request: PlatformRequestOptions, clientOrigin: PlatformClientOrigin, metadata?: RequestMetadata) => Promise<PlatformRequestOptions>;
@@ -1,4 +1,4 @@
1
- import { SearchPageEvents as LegacySearchPageEvents } from 'coveo.analytics/dist/definitions/searchPage/searchPageEvents.js';
1
+ import type { SearchPageEvents as LegacySearchPageEvents } from 'coveo.analytics/dist/definitions/searchPage/searchPageEvents.js';
2
2
  import { Result } from '../../api/search/search/result.js';
3
3
  import { OmniboxSuggestionMetadata } from '../query-suggest/query-suggest-analytics-actions.js';
4
4
  import { SearchAction } from '../search/search-actions.js';
@@ -2,8 +2,8 @@ import { RecordValue, StringValue } from '@coveo/bueno';
2
2
  import { ItemMetaData } from '@coveo/relay-event-types';
3
3
  import { AsyncThunk } from '@reduxjs/toolkit';
4
4
  import type { CoveoSearchPageClient, SearchPageClientProvider, CaseAssistClient, CoveoInsightClient, EventBuilder, EventDescription, AnalyticsClientSendEventHook } from 'coveo.analytics';
5
- import { SearchEventResponse } from 'coveo.analytics/dist/definitions/events.js';
6
- import { PartialDocumentInformation, DocumentIdentifier } from 'coveo.analytics/dist/definitions/searchPage/searchPageEvents.js';
5
+ import type { SearchEventResponse } from 'coveo.analytics/dist/definitions/events.js';
6
+ import type { PartialDocumentInformation, DocumentIdentifier } from 'coveo.analytics/dist/definitions/searchPage/searchPageEvents.js';
7
7
  import { Logger } from 'pino';
8
8
  import { CaseAssistAnalyticsProvider, StateNeededByCaseAssistAnalytics } from '../../api/analytics/case-assist-analytics.js';
9
9
  import { InsightAnalyticsProvider, StateNeededByInsightAnalyticsProvider } from '../../api/analytics/insight-analytics.js';
@@ -0,0 +1 @@
1
+ export default function getMagicCookie(): string | false | null;
@@ -0,0 +1,26 @@
1
+ import { ContextState } from './context-state.js';
2
+ export declare const selectContext: ((state: {
3
+ context?: ContextState;
4
+ }) => ContextState | undefined) & {
5
+ clearCache: () => void;
6
+ resultsCount: () => number;
7
+ resetResultsCount: () => void;
8
+ } & {
9
+ resultFunc: (resultFuncArgs_0: ContextState | undefined) => ContextState | undefined;
10
+ memoizedResultFunc: ((resultFuncArgs_0: ContextState | undefined) => ContextState | undefined) & {
11
+ clearCache: () => void;
12
+ resultsCount: () => number;
13
+ resetResultsCount: () => void;
14
+ };
15
+ lastResult: () => ContextState | undefined;
16
+ dependencies: [(state: {
17
+ context?: ContextState;
18
+ }) => ContextState | undefined];
19
+ recomputations: () => number;
20
+ resetRecomputations: () => void;
21
+ dependencyRecomputations: () => number;
22
+ resetDependencyRecomputations: () => void;
23
+ } & {
24
+ argsMemoize: typeof import("reselect").weakMapMemoize;
25
+ memoize: typeof import("reselect").weakMapMemoize;
26
+ };
@@ -17,7 +17,10 @@ export interface RegisterCategoryFacetActionCreatorPayload {
17
17
  excluded?: string[];
18
18
  };
19
19
  /**
20
- * The currently active tab.
20
+ * @deprecated - This field is unused and should not be relied on.
21
+ * If you need the currently active tab, use the TabManager instead.
22
+ *
23
+ * This property will be removed in version 4.0.
21
24
  */
22
25
  activeTab?: string;
23
26
  /**
@@ -18,7 +18,10 @@ export interface RegisterFacetActionCreatorPayload {
18
18
  excluded?: string[];
19
19
  };
20
20
  /**
21
- * The currently active tab.
21
+ * @deprecated - This field is unused and should not be relied on.
22
+ * If you need the currently active tab, use the TabManager instead.
23
+ *
24
+ * This property will be removed in version 4.0.
22
25
  */
23
26
  activeTab?: string;
24
27
  /**
@@ -18,7 +18,10 @@ export interface RegisterDateFacetActionCreatorPayload {
18
18
  excluded?: string[];
19
19
  };
20
20
  /**
21
- * The currently active tab.
21
+ * @deprecated - This field is unused and should not be relied on.
22
+ * If you need the currently active tab, use the TabManager instead.
23
+ *
24
+ * This property will be removed in version 4.0.
22
25
  */
23
26
  activeTab?: string;
24
27
  /**
@@ -18,7 +18,10 @@ export interface RegisterNumericFacetActionCreatorPayload {
18
18
  excluded?: string[];
19
19
  };
20
20
  /**
21
- * The currently active tab.
21
+ * @deprecated - This field is unused and should not be relied on.
22
+ * If you need the currently active tab, use the TabManager instead.
23
+ *
24
+ * This property will be removed in version 4.0.
22
25
  */
23
26
  activeTab?: string;
24
27
  /**
@@ -139,7 +139,7 @@ export declare const buildInstantResultSearchRequest: (state: StateNeededByExecu
139
139
  source?: string[];
140
140
  };
141
141
  excerptLength?: number;
142
- actionsHistory?: import("coveo.analytics/dist/definitions/history.js").HistoryElement[];
142
+ actionsHistory?: import("../../../api/analytics/coveo.analytics/history-store.js").HistoryElement[];
143
143
  authentication?: string;
144
144
  generateAutomaticFacets?: {
145
145
  desiredCount: number;
@@ -61,7 +61,7 @@ export declare const buildSearchRequest: (state: StateNeededBySearchRequest, eve
61
61
  source?: string[];
62
62
  };
63
63
  excerptLength?: number;
64
- actionsHistory?: import("coveo.analytics/dist/definitions/history.js").HistoryElement[];
64
+ actionsHistory?: import("../../../api/analytics/coveo.analytics/history-store.js").HistoryElement[];
65
65
  authentication?: string;
66
66
  }>>;
67
67
  export {};
@@ -1,4 +1,4 @@
1
- import { EventDescription } from 'coveo.analytics';
1
+ import type { EventDescription } from 'coveo.analytics';
2
2
  import { SearchResponseSuccess } from '../../api/search/search/search-response.js';
3
3
  import { NavigatorContext } from '../../app/navigator-context-provider.js';
4
4
  import { InstantResultSection } from '../../state/state-sections.js';
@@ -146,7 +146,7 @@ export declare const buildInstantResultSearchRequest: (state: StateNeededByExecu
146
146
  source?: string[];
147
147
  };
148
148
  excerptLength?: number;
149
- actionsHistory?: import("coveo.analytics/dist/definitions/history.js").HistoryElement[];
149
+ actionsHistory?: import("../../api/analytics/coveo.analytics/history-store.js").HistoryElement[];
150
150
  authentication?: string;
151
151
  generateAutomaticFacets?: {
152
152
  desiredCount: number;
@@ -62,7 +62,7 @@ export declare const buildSearchRequest: (state: StateNeededBySearchRequest, nav
62
62
  source?: string[];
63
63
  };
64
64
  excerptLength?: number;
65
- actionsHistory?: import("coveo.analytics/dist/definitions/history.js").HistoryElement[];
65
+ actionsHistory?: import("../../api/analytics/coveo.analytics/history-store.js").HistoryElement[];
66
66
  authentication?: string;
67
67
  }>>;
68
68
  export {};
@@ -51,7 +51,7 @@ export declare function buildMockSearchRequest(config?: Partial<SearchRequest>):
51
51
  source?: string[];
52
52
  };
53
53
  excerptLength?: number;
54
- actionsHistory?: import("coveo.analytics/dist/definitions/history.js").HistoryElement[];
54
+ actionsHistory?: import("../api/analytics/coveo.analytics/history-store.js").HistoryElement[];
55
55
  authentication?: string;
56
56
  generateAutomaticFacets?: {
57
57
  desiredCount: number;