@coveo/quantic 3.30.0-pre.d5bddfb706 → 3.30.0-pre.d92b7ffd99

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 (21) 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/api-client-utils.d.ts +1 -1
  3. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/request.d.ts +2 -2
  4. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/recommendations/recommendations-request.d.ts +2 -2
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/search/query-suggest/query-suggest-request.d.ts +2 -2
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/stream-answer-api.d.ts +9 -5
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/case-assist/get-case-classifications/get-case-classifications-request.d.ts +2 -2
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/case-assist/get-document-suggestions/get-document-suggestions-request.d.ts +2 -2
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/get-interface/get-interface-config-request.d.ts +2 -2
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/query/query-request.d.ts +4 -4
  11. package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/user-actions/user-actions-request.d.ts +2 -2
  12. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions-loader.d.ts +9 -0
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +25 -0
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +1 -0
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-state.d.ts +9 -0
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/insight.index.d.ts +1 -0
  17. package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
  18. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +9 -9
  19. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +7 -7
  20. package/package.json +2 -2
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/stream-answer-actions.d.ts +0 -15
@@ -3,5 +3,5 @@ import type { BaseParam } from './platform-service-params.js';
3
3
  import type { AllSearchAPIResponse } from './search/search-api-client.js';
4
4
  import type { SearchAPIErrorWithStatusCode } from './search/search-api-error-response.js';
5
5
  import type { AuthenticationParam } from './search/search-api-params.js';
6
- export declare function pickNonBaseParams<Params extends BaseParam & AuthenticationParam>(req: Params): Omit<Params, "accessToken" | "url" | "organizationId" | "authentication">;
6
+ export declare function pickNonBaseParams<Params extends BaseParam & AuthenticationParam>(req: Params): Omit<Params, "accessToken" | "organizationId" | "url" | "authentication">;
7
7
  export declare const unwrapError: (payload: PlatformResponse<AllSearchAPIResponse>) => SearchAPIErrorWithStatusCode;
@@ -29,10 +29,10 @@ export declare const getRequestOptions: (req: FilterableCommerceAPIRequest, path
29
29
  sort: import("./sort.js").SortOption | undefined;
30
30
  };
31
31
  accessToken: string;
32
- method: import("../../platform-client.js").HttpMethods;
33
- contentType: import("../../platform-client.js").HTTPContentType;
34
32
  url: string;
33
+ method: import("../../platform-client.js").HttpMethods;
35
34
  origin: import("../../preprocess-request.js").PlatformClientOrigin;
35
+ contentType: import("../../platform-client.js").HTTPContentType;
36
36
  requestMetadata?: import("../../preprocess-request.js").RequestMetadata | undefined;
37
37
  };
38
38
  export declare const baseRequest: (req: BaseParam, path: CommerceApiMethod) => Pick<PlatformClientCallOptions, "accessToken" | "method" | "contentType" | "url" | "origin" | "requestMetadata">;
@@ -25,9 +25,9 @@ export declare const buildRecommendationsRequest: (req: CommerceRecommendationsR
25
25
  perPage: number | undefined;
26
26
  };
27
27
  accessToken: string;
28
- method: import("../../platform-client.js").HttpMethods;
29
- contentType: import("../../platform-client.js").HTTPContentType;
30
28
  url: string;
29
+ method: import("../../platform-client.js").HttpMethods;
31
30
  origin: import("../../preprocess-request.js").PlatformClientOrigin;
31
+ contentType: import("../../platform-client.js").HTTPContentType;
32
32
  requestMetadata?: import("../../preprocess-request.js").RequestMetadata | undefined;
33
33
  };
@@ -22,9 +22,9 @@ export declare const getQuerySuggestRequestOptions: (req: QuerySuggestRequest) =
22
22
  currency: string;
23
23
  };
24
24
  accessToken: string;
25
- method: import("../../../platform-client.js").HttpMethods;
26
- contentType: import("../../../platform-client.js").HTTPContentType;
27
25
  url: string;
26
+ method: import("../../../platform-client.js").HttpMethods;
28
27
  origin: import("../../../preprocess-request.js").PlatformClientOrigin;
28
+ contentType: import("../../../platform-client.js").HTTPContentType;
29
29
  requestMetadata?: import("../../../preprocess-request.js").RequestMetadata | undefined;
30
30
  };
@@ -14,6 +14,7 @@ export declare const selectAnswerTriggerParams: ((state: any, ...params: any[])
14
14
  cannotAnswer: any;
15
15
  analyticsMode: any;
16
16
  actionCause: any;
17
+ readyToGenerateAnswer: any;
17
18
  }) & {
18
19
  clearCache: () => void;
19
20
  resultsCount: () => number;
@@ -25,6 +26,7 @@ export declare const selectAnswerTriggerParams: ((state: any, ...params: any[])
25
26
  cannotAnswer: any;
26
27
  analyticsMode: any;
27
28
  actionCause: any;
29
+ readyToGenerateAnswer: any;
28
30
  };
29
31
  memoizedResultFunc: ((...resultFuncArgs: readonly any[]) => {
30
32
  q: any;
@@ -32,6 +34,7 @@ export declare const selectAnswerTriggerParams: ((state: any, ...params: any[])
32
34
  cannotAnswer: any;
33
35
  analyticsMode: any;
34
36
  actionCause: any;
37
+ readyToGenerateAnswer: any;
35
38
  }) & {
36
39
  clearCache: () => void;
37
40
  resultsCount: () => number;
@@ -43,6 +46,7 @@ export declare const selectAnswerTriggerParams: ((state: any, ...params: any[])
43
46
  cannotAnswer: any;
44
47
  analyticsMode: any;
45
48
  actionCause: any;
49
+ readyToGenerateAnswer: any;
46
50
  };
47
51
  dependencies: import("reselect").SelectorArray<any>;
48
52
  recomputations: () => number;
@@ -75,7 +79,7 @@ export declare const constructAnswerQueryParams: (state: StreamAnswerAPIState, u
75
79
  queryCorrection?: {
76
80
  enabled: boolean;
77
81
  options: {
78
- automaticallyCorrect: "never" | "whenNoResults";
82
+ automaticallyCorrect: "whenNoResults" | "never";
79
83
  };
80
84
  } | undefined;
81
85
  enableDidYouMean?: boolean | undefined;
@@ -116,9 +120,9 @@ export declare const selectAnswer: (state: StreamAnswerAPIState, navigatorContex
116
120
  }) | ({
117
121
  status: import("@reduxjs/toolkit/query").QueryStatus.fulfilled;
118
122
  error: undefined;
119
- requestId: string;
120
- originalArgs: Partial<SearchRequest>;
121
123
  endpointName: string;
124
+ originalArgs: Partial<SearchRequest>;
125
+ requestId: string;
122
126
  startedTimeStamp: number;
123
127
  data: GeneratedAnswerStream;
124
128
  fulfilledTimeStamp: number;
@@ -145,11 +149,11 @@ export declare const selectAnswer: (state: StreamAnswerAPIState, navigatorContex
145
149
  isError: false;
146
150
  }) | ({
147
151
  status: import("@reduxjs/toolkit/query").QueryStatus.rejected;
148
- requestId: string;
149
152
  data?: GeneratedAnswerStream | undefined;
153
+ endpointName: string;
150
154
  fulfilledTimeStamp?: number | undefined;
151
155
  originalArgs: Partial<SearchRequest>;
152
- endpointName: string;
156
+ requestId: string;
153
157
  startedTimeStamp: number;
154
158
  error: import("@reduxjs/toolkit").SerializedError | import("@reduxjs/toolkit/query").FetchBaseQueryError;
155
159
  } & {
@@ -12,8 +12,8 @@ export declare const buildGetCaseClassificationsRequest: (req: GetCaseClassifica
12
12
  };
13
13
  };
14
14
  accessToken: string;
15
- method: import("../../../platform-client.js").HttpMethods;
16
- contentType: import("../../../platform-client.js").HTTPContentType;
17
15
  url: string;
16
+ method: import("../../../platform-client.js").HttpMethods;
18
17
  origin: import("../../../preprocess-request.js").PlatformClientOrigin;
18
+ contentType: import("../../../platform-client.js").HTTPContentType;
19
19
  };
@@ -29,8 +29,8 @@ export declare const buildGetDocumentSuggestionsRequest: (req: GetDocumentSugges
29
29
  } | undefined;
30
30
  };
31
31
  accessToken: string;
32
- method: import("../../../platform-client.js").HttpMethods;
33
- contentType: import("../../../platform-client.js").HTTPContentType;
34
32
  url: string;
33
+ method: import("../../../platform-client.js").HttpMethods;
35
34
  origin: import("../../../preprocess-request.js").PlatformClientOrigin;
35
+ contentType: import("../../../platform-client.js").HTTPContentType;
36
36
  };
@@ -4,8 +4,8 @@ export type GetInsightInterfaceConfigRequest = BaseParam & InsightIdParam;
4
4
  export declare const buildGetInsightInterfaceConfigRequest: (req: GetInsightInterfaceConfigRequest) => {
5
5
  requestParams: {};
6
6
  accessToken: string;
7
- method: import("../../../platform-client.js").HttpMethods;
8
- contentType: import("../../../platform-client.js").HTTPContentType;
9
7
  url: string;
8
+ method: import("../../../platform-client.js").HttpMethods;
10
9
  origin: import("../../../preprocess-request.js").PlatformClientOrigin;
10
+ contentType: import("../../../platform-client.js").HTTPContentType;
11
11
  };
@@ -9,17 +9,17 @@ interface CaseContextParam {
9
9
  export declare const buildInsightQueryRequest: (req: InsightQueryRequest) => {
10
10
  requestParams: {};
11
11
  accessToken: string;
12
- method: import("../../../platform-client.js").HttpMethods;
13
- contentType: import("../../../platform-client.js").HTTPContentType;
14
12
  url: string;
13
+ method: import("../../../platform-client.js").HttpMethods;
15
14
  origin: import("../../../preprocess-request.js").PlatformClientOrigin;
15
+ contentType: import("../../../platform-client.js").HTTPContentType;
16
16
  };
17
17
  export declare const buildInsightQuerySuggestRequest: (req: InsightQuerySuggestRequest) => {
18
18
  requestParams: {};
19
19
  accessToken: string;
20
- method: import("../../../platform-client.js").HttpMethods;
21
- contentType: import("../../../platform-client.js").HTTPContentType;
22
20
  url: string;
21
+ method: import("../../../platform-client.js").HttpMethods;
23
22
  origin: import("../../../preprocess-request.js").PlatformClientOrigin;
23
+ contentType: import("../../../platform-client.js").HTTPContentType;
24
24
  };
25
25
  export {};
@@ -11,9 +11,9 @@ export declare const buildInsightUserActionsRequest: (req: InsightUserActionsReq
11
11
  objectId: string;
12
12
  };
13
13
  accessToken: string;
14
- method: import("../../../platform-client.js").HttpMethods;
15
- contentType: import("../../../platform-client.js").HTTPContentType;
16
14
  url: string;
15
+ method: import("../../../platform-client.js").HttpMethods;
17
16
  origin: import("../../../preprocess-request.js").PlatformClientOrigin;
17
+ contentType: import("../../../platform-client.js").HTTPContentType;
18
18
  };
19
19
  export {};
@@ -7,6 +7,15 @@ import type { CoreEngine } from '../../app/engine.js';
7
7
  * @category GeneratedAnswer
8
8
  */
9
9
  export interface GeneratedAnswerActionCreators {
10
+ /**
11
+ * Generates a new answer using the Answer API.
12
+ *
13
+ * This action requires an answer configuration ID to be set in the engine configuration.
14
+ * When present, it will use the Answer API service for enhanced answer generation.
15
+ *
16
+ * @returns A dispatchable action.
17
+ */
18
+ generateAnswer(): void;
10
19
  /**
11
20
  * Resets the generated answer state to a clean slate.
12
21
  *
@@ -1,4 +1,6 @@
1
1
  import type { GeneratedAnswerCitationsPayload, GeneratedAnswerMessagePayload } from '../../api/generated-answer/generated-answer-event-payload.js';
2
+ import type { StreamAnswerAPIState } from '../../api/knowledge/stream-answer-api-state.js';
3
+ import type { SearchThunkExtraArguments } from '../../app/search-thunk-extra-arguments.js';
2
4
  import type { ConfigurationSection, DebugSection, GeneratedAnswerSection, SearchSection } from '../../state/state-sections.js';
3
5
  import { type GeneratedResponseFormat } from './generated-response-format.js';
4
6
  type StateNeededByGeneratedAnswerStream = ConfigurationSection & SearchSection & GeneratedAnswerSection & DebugSection;
@@ -45,4 +47,27 @@ export declare const streamAnswer: import("@reduxjs/toolkit").AsyncThunk<void, S
45
47
  fulfilledMeta?: unknown;
46
48
  rejectedMeta?: unknown;
47
49
  }>;
50
+ /**
51
+ * Thunk to handle the sequence of actions required to generate a new answer
52
+ * after a search request.
53
+ *
54
+ * ⚠️ This action only works when an **answer configuration ID** is present
55
+ * in the engine configuration. In that case, the **Answer API** will be used
56
+ * instead of the regular search pipeline.
57
+ *
58
+ * Flow:
59
+ * 1. Reset any existing answer state.
60
+ * 2. Fetch a new answer from the Answer API using the provided configuration.
61
+ * 3. Update the search action metadata.
62
+ */
63
+ export declare const generateAnswer: import("@reduxjs/toolkit").AsyncThunk<void, void, {
64
+ state: StreamAnswerAPIState;
65
+ extra: SearchThunkExtraArguments;
66
+ dispatch?: import("redux-thunk").ThunkDispatch<unknown, unknown, import("redux").UnknownAction> | undefined;
67
+ rejectValue?: unknown;
68
+ serializedErrorType?: unknown;
69
+ pendingMeta?: unknown;
70
+ fulfilledMeta?: unknown;
71
+ rejectedMeta?: unknown;
72
+ }>;
48
73
  export {};
@@ -41,6 +41,7 @@ export interface TransitiveSearchAction {
41
41
  next?: SearchAction;
42
42
  }
43
43
  export declare const updateSearchAction: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<SearchAction | undefined, string>;
44
+ export declare const setReadyToGenerateAnswerAction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>;
44
45
  export declare const executeSearch: import("@reduxjs/toolkit").AsyncThunk<ExecuteSearchThunkReturn, TransitiveSearchAction, {
45
46
  rejectValue: import("../../api/search/search-api-error-response.js").SearchAPIErrorWithStatusCode;
46
47
  state: StateNeededByExecuteSearch;
@@ -52,6 +52,15 @@ export interface SearchState {
52
52
  * The action that triggered the search request.
53
53
  */
54
54
  searchAction: SearchAction | undefined;
55
+ /**
56
+ * Signals that a generated answer can be triggered for the current search.
57
+ *
58
+ * - Set to `true` at the start of `executeSearch`, after the action cause is set,
59
+ * and reset to `false` when the search completes.
60
+ * - Allows subscribers (e.g., generated answer controller) to know when
61
+ * it’s appropriate to dispatch a `generateAnswer`.
62
+ */
63
+ readyToGenerateAnswer: boolean;
55
64
  }
56
65
  export declare function emptyQuestionAnswer(): {
57
66
  answerSnippet: string;
@@ -104,6 +104,7 @@ export type { NumericFacetValue } from './features/facets/range-facets/numeric-f
104
104
  export * from './features/facets/range-facets/numeric-facet-set/numeric-facet-actions-loader.js';
105
105
  export * from './features/fields/fields-actions-loader.js';
106
106
  export * from './features/folding/insight-folding-actions-loader.js';
107
+ export * from './features/generated-answer/generated-answer-actions-loader.js';
107
108
  export * from './features/insight-interface/insight-interface-actions-loader.js';
108
109
  export type { InsightInterfaceState } from './features/insight-interface/insight-interface-state.js';
109
110
  export * from './features/insight-search/insight-query-set-actions-loader.js';