@cimulate/copilot-sdk 1.1.1 → 1.2.0
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/README.md +15 -0
- package/dist/bundle.cimulate.copilot-sdk.099d19fa.umd.js +2 -0
- package/dist/bundle.cimulate.copilot-sdk.099d19fa.umd.js.map +1 -0
- package/dist/bundle.cimulate.copilot-sdk.5716b677.cjs.js +2 -0
- package/dist/bundle.cimulate.copilot-sdk.5716b677.cjs.js.map +1 -0
- package/dist/bundle.cimulate.copilot-sdk.64883fd2.esm.js +2 -0
- package/dist/bundle.cimulate.copilot-sdk.64883fd2.esm.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/types/copilot.d.ts +17 -17
- package/dist/types/model/Cancel.d.ts +1 -1
- package/dist/types/model/CommonEventFields.d.ts +1 -1
- package/dist/types/model/CommonFields.d.ts +3 -4
- package/dist/types/model/CommonMetadata.d.ts +7 -0
- package/dist/types/model/CommonRequiredFields.d.ts +2 -3
- package/dist/types/model/ConnectAck.d.ts +4 -4
- package/dist/types/model/ConnectAckMessageFields.d.ts +8 -0
- package/dist/types/model/CopilotEvent.d.ts +20 -0
- package/dist/types/model/CopilotSearch.d.ts +3 -3
- package/dist/types/model/CopilotSearchSuggestion.d.ts +7 -0
- package/dist/types/model/DisplayProducts.d.ts +7 -6
- package/dist/types/model/DisplayProductsMessageFields.d.ts +4 -2
- package/dist/types/model/Done.d.ts +4 -4
- package/dist/types/model/DoneMessageFields.d.ts +4 -0
- package/dist/types/model/Error.d.ts +5 -5
- package/dist/types/model/ErrorMessageFields.d.ts +2 -1
- package/dist/types/model/EventAck.d.ts +14 -8
- package/dist/types/model/EventAckMessageFields.d.ts +10 -0
- package/dist/types/model/EventAckNames.d.ts +6 -0
- package/dist/types/model/FacetValue.d.ts +1 -1
- package/dist/types/model/FacetedNavigation.d.ts +2 -2
- package/dist/types/model/FacetedNavigationSuggestion.d.ts +7 -0
- package/dist/types/model/FollowUp.d.ts +7 -6
- package/dist/types/model/FollowUpMessageFields.d.ts +7 -0
- package/dist/types/model/Inquiry.d.ts +4 -4
- package/dist/types/model/InquiryMessageFields.d.ts +4 -0
- package/dist/types/model/PartialInquiry.d.ts +5 -5
- package/dist/types/model/PartialInquiryMessageFields.d.ts +2 -1
- package/dist/types/model/RefinedSearch.d.ts +10 -9
- package/dist/types/model/RefinedSearchMessageFields.d.ts +7 -5
- package/dist/types/model/ReturnedFields.d.ts +2 -0
- package/dist/types/model/Root.d.ts +34 -26
- package/dist/types/model/SearchParams.d.ts +5 -0
- package/dist/types/model/SessionData.d.ts +5 -4
- package/dist/types/model/SessionEventStatusReply.d.ts +1 -2
- package/dist/types/model/SessionInformation.d.ts +7 -7
- package/dist/types/model/WorkflowMetadata.d.ts +5 -0
- package/dist/types/model/index.d.ts +14 -8
- package/package.json +6 -4
- package/rollup.config.js +1 -1
- package/src/copilot.ts +49 -25
- package/src/model/Cancel.ts +1 -1
- package/src/model/CommonEventFields.ts +1 -1
- package/src/model/CommonFields.ts +3 -4
- package/src/model/CommonMetadata.ts +7 -0
- package/src/model/CommonRequiredFields.ts +2 -3
- package/src/model/ConnectAck.ts +4 -4
- package/src/model/ConnectAckMessageFields.ts +8 -0
- package/src/model/CopilotEvent.ts +20 -0
- package/src/model/CopilotSearch.ts +3 -3
- package/src/model/CopilotSearchSuggestion.ts +7 -0
- package/src/model/DisplayProducts.ts +7 -7
- package/src/model/DisplayProductsMessageFields.ts +4 -3
- package/src/model/Done.ts +4 -4
- package/src/model/DoneMessageFields.ts +5 -0
- package/src/model/Error.ts +5 -5
- package/src/model/ErrorMessageFields.ts +2 -1
- package/src/model/EventAck.ts +16 -8
- package/src/model/EventAckMessageFields.ts +10 -0
- package/src/model/EventAckNames.ts +7 -0
- package/src/model/FacetValue.ts +1 -1
- package/src/model/FacetedNavigation.ts +2 -2
- package/src/model/FacetedNavigationSuggestion.ts +7 -0
- package/src/model/FollowUp.ts +7 -6
- package/src/model/FollowUpMessageFields.ts +7 -0
- package/src/model/Inquiry.ts +4 -4
- package/src/model/InquiryMessageFields.ts +5 -0
- package/src/model/PartialInquiry.ts +5 -5
- package/src/model/PartialInquiryMessageFields.ts +2 -1
- package/src/model/RefinedSearch.ts +10 -9
- package/src/model/RefinedSearchMessageFields.ts +7 -5
- package/src/model/ReturnedFields.ts +4 -0
- package/src/model/Root.ts +34 -26
- package/src/model/SearchParams.ts +6 -0
- package/src/model/SessionData.ts +5 -4
- package/src/model/SessionEventStatusReply.ts +1 -2
- package/src/model/SessionInformation.ts +7 -7
- package/src/model/WorkflowMetadata.ts +6 -0
- package/src/model/index.ts +14 -8
- package/tsconfig.json +2 -1
- package/dist/bundle.cimulate.copilot-sdk.65f7195a.esm.js +0 -2
- package/dist/bundle.cimulate.copilot-sdk.65f7195a.esm.js.map +0 -1
- package/dist/bundle.cimulate.copilot-sdk.a2e829d8.cjs.js +0 -2
- package/dist/bundle.cimulate.copilot-sdk.a2e829d8.cjs.js.map +0 -1
- package/dist/bundle.cimulate.copilot-sdk.c68ae11d.umd.js +0 -2
- package/dist/bundle.cimulate.copilot-sdk.c68ae11d.umd.js.map +0 -1
- package/dist/types/model/ConnectionAcknowledgmentMessageFields.d.ts +0 -7
- package/dist/types/model/EventAcknowledgmentMessageFields.d.ts +0 -6
- package/dist/types/model/FollowMinusUpMessageFields.d.ts +0 -5
- package/dist/types/model/ReservedEvent.d.ts +0 -10
- package/dist/types/model/SearchParameters.d.ts +0 -5
- package/dist/types/model/SessionEventInformationReply.d.ts +0 -5
- package/dist/types/model/Suggestion.d.ts +0 -6
- package/src/model/ConnectionAcknowledgmentMessageFields.ts +0 -7
- package/src/model/EventAcknowledgmentMessageFields.ts +0 -6
- package/src/model/FollowMinusUpMessageFields.ts +0 -5
- package/src/model/ReservedEvent.ts +0 -11
- package/src/model/SearchParameters.ts +0 -6
- package/src/model/SessionEventInformationReply.ts +0 -6
- package/src/model/Suggestion.ts +0 -7
package/src/copilot.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import io, { ManagerOptions, Socket, SocketOptions } from "socket.io-client";
|
|
2
|
-
import { merge } from "ts-deepmerge";
|
|
3
2
|
|
|
4
|
-
import type
|
|
3
|
+
import type {
|
|
4
|
+
ConnectAck,
|
|
5
|
+
DisplayProducts,
|
|
6
|
+
Done,
|
|
7
|
+
Error,
|
|
8
|
+
EventAck,
|
|
9
|
+
EventAckNames,
|
|
10
|
+
FollowUp,
|
|
11
|
+
Inquiry,
|
|
12
|
+
PartialInquiry,
|
|
13
|
+
RefinedSearch,
|
|
14
|
+
ReturnedFields,
|
|
15
|
+
SessionInformation,
|
|
16
|
+
} from "./model";
|
|
17
|
+
import deepmerge from "deepmerge";
|
|
5
18
|
|
|
6
19
|
type SocketIOOptions = Partial<ManagerOptions & SocketOptions>;
|
|
7
20
|
|
|
@@ -27,7 +40,9 @@ const socketDefaults: SocketIOOptions = {
|
|
|
27
40
|
timeout: 10000,
|
|
28
41
|
};
|
|
29
42
|
|
|
30
|
-
class CimulateCopilot
|
|
43
|
+
export default class CimulateCopilot<
|
|
44
|
+
T extends ReturnedFields = ReturnedFields
|
|
45
|
+
> {
|
|
31
46
|
private socket: Socket;
|
|
32
47
|
|
|
33
48
|
constructor({
|
|
@@ -38,9 +53,10 @@ class CimulateCopilot {
|
|
|
38
53
|
}: CimulateCopilotOptions) {
|
|
39
54
|
const socketioEndpoint = `${baseUrl}${namespace}`;
|
|
40
55
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
const options: SocketIOOptions[] = [
|
|
57
|
+
socketDefaults,
|
|
58
|
+
socketOptions,
|
|
59
|
+
{
|
|
44
60
|
withCredentials: true, // enables cookies
|
|
45
61
|
transportOptions: {
|
|
46
62
|
polling: {
|
|
@@ -49,8 +65,10 @@ class CimulateCopilot {
|
|
|
49
65
|
},
|
|
50
66
|
},
|
|
51
67
|
},
|
|
52
|
-
}
|
|
53
|
-
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
this.socket = io(socketioEndpoint, deepmerge.all(options));
|
|
54
72
|
}
|
|
55
73
|
|
|
56
74
|
connect() {
|
|
@@ -58,8 +76,11 @@ class CimulateCopilot {
|
|
|
58
76
|
}
|
|
59
77
|
|
|
60
78
|
search(
|
|
61
|
-
{
|
|
62
|
-
|
|
79
|
+
{
|
|
80
|
+
userPrompt,
|
|
81
|
+
searchParams,
|
|
82
|
+
}: { userPrompt?: string; searchParams: SearchParams },
|
|
83
|
+
callback?: (searchAck: EventAck<EventAckNames.COPILOT_SEARCH_ACK>) => void
|
|
63
84
|
) {
|
|
64
85
|
const payload = {
|
|
65
86
|
user_prompt: userPrompt,
|
|
@@ -74,7 +95,9 @@ class CimulateCopilot {
|
|
|
74
95
|
|
|
75
96
|
facetedNavigation(
|
|
76
97
|
{ searchParams }: { searchParams: SearchParams },
|
|
77
|
-
callback?: (
|
|
98
|
+
callback?: (
|
|
99
|
+
facetedNavigationAck: EventAck<EventAckNames.FACETED_NAVIGATION_ACK>
|
|
100
|
+
) => void
|
|
78
101
|
) {
|
|
79
102
|
const payload = {
|
|
80
103
|
search_params: searchParams,
|
|
@@ -88,7 +111,7 @@ class CimulateCopilot {
|
|
|
88
111
|
|
|
89
112
|
cancelRequest(
|
|
90
113
|
{ eventId, reason }: { eventId: string; reason: string },
|
|
91
|
-
callback?: (cancelAck:
|
|
114
|
+
callback?: (cancelAck: EventAck<EventAckNames.CANCEL_ACK>) => void
|
|
92
115
|
) {
|
|
93
116
|
const payload = {
|
|
94
117
|
event_id: eventId,
|
|
@@ -101,43 +124,47 @@ class CimulateCopilot {
|
|
|
101
124
|
this.socket.emit("cancel", payload);
|
|
102
125
|
}
|
|
103
126
|
|
|
104
|
-
|
|
127
|
+
requestSessionInformation(
|
|
128
|
+
callback: (sessionInformation: SessionInformation<T>) => void
|
|
129
|
+
) {
|
|
105
130
|
this.socket.emit("session_info", callback);
|
|
106
131
|
}
|
|
107
132
|
|
|
108
|
-
onConnectAck(callback: (connectAck:
|
|
133
|
+
onConnectAck(callback: (connectAck: ConnectAck) => void) {
|
|
109
134
|
this.socket.on("connect_ack", callback);
|
|
110
135
|
}
|
|
111
136
|
|
|
112
|
-
onSearchAck(
|
|
137
|
+
onSearchAck(
|
|
138
|
+
callback: (searchAck: EventAck<EventAckNames.COPILOT_SEARCH_ACK>) => void
|
|
139
|
+
) {
|
|
113
140
|
this.socket.on("search_ack", callback);
|
|
114
141
|
}
|
|
115
142
|
|
|
116
|
-
onRefinedSearch(callback: (refinedSearch:
|
|
143
|
+
onRefinedSearch(callback: (refinedSearch: RefinedSearch<T>) => void) {
|
|
117
144
|
this.socket.on("refined_search", callback);
|
|
118
145
|
}
|
|
119
146
|
|
|
120
|
-
onFollowUp(callback: (followUp:
|
|
147
|
+
onFollowUp(callback: (followUp: FollowUp) => void) {
|
|
121
148
|
this.socket.on("follow_up", callback);
|
|
122
149
|
}
|
|
123
150
|
|
|
124
|
-
onInquiry(callback: (inquiry:
|
|
151
|
+
onInquiry(callback: (inquiry: Inquiry) => void) {
|
|
125
152
|
this.socket.on("inquiry", callback);
|
|
126
153
|
}
|
|
127
154
|
|
|
128
|
-
onPartialInquiry(callback: (partialInquiry:
|
|
155
|
+
onPartialInquiry(callback: (partialInquiry: PartialInquiry) => void) {
|
|
129
156
|
this.socket.on("partial_inquiry", callback);
|
|
130
157
|
}
|
|
131
158
|
|
|
132
|
-
onDisplayProducts(callback: (displayProducts:
|
|
159
|
+
onDisplayProducts(callback: (displayProducts: DisplayProducts<T>) => void) {
|
|
133
160
|
this.socket.on("display_products", callback);
|
|
134
161
|
}
|
|
135
162
|
|
|
136
|
-
onDone(callback: (done:
|
|
163
|
+
onDone(callback: (done: Done) => void) {
|
|
137
164
|
this.socket.on("done", callback);
|
|
138
165
|
}
|
|
139
166
|
|
|
140
|
-
onError(callback: (error:
|
|
167
|
+
onError(callback: (error: Error) => void) {
|
|
141
168
|
this.socket.on("error", callback);
|
|
142
169
|
}
|
|
143
170
|
|
|
@@ -148,7 +175,4 @@ class CimulateCopilot {
|
|
|
148
175
|
onDisconnect(callback: (reason: string) => void) {
|
|
149
176
|
this.socket.on("disconnect", callback);
|
|
150
177
|
}
|
|
151
|
-
|
|
152
178
|
}
|
|
153
|
-
|
|
154
|
-
export default CimulateCopilot;
|
package/src/model/Cancel.ts
CHANGED
package/src/model/ConnectAck.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {ConnectAckMetadata} from './ConnectAckMetadata';
|
|
2
2
|
interface ConnectAck {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
eventName: string;
|
|
3
|
+
session_id: string;
|
|
4
|
+
event_id: string;
|
|
6
5
|
timestamp: string;
|
|
7
|
-
|
|
6
|
+
status: number;
|
|
8
7
|
message: string;
|
|
9
8
|
metadata: ConnectAckMetadata;
|
|
9
|
+
event_name: 'connect_ack';
|
|
10
10
|
}
|
|
11
11
|
export { ConnectAck };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {ConnectAck} from './ConnectAck';
|
|
2
|
+
import {EventAck} from './EventAck';
|
|
3
|
+
import {FollowUp} from './FollowUp';
|
|
4
|
+
import {Inquiry} from './Inquiry';
|
|
5
|
+
import {DisplayProducts} from './DisplayProducts';
|
|
6
|
+
import {RefinedSearch} from './RefinedSearch';
|
|
7
|
+
import {Done} from './Done';
|
|
8
|
+
import {Error} from './Error';
|
|
9
|
+
import {CommonMetadata} from './CommonMetadata';
|
|
10
|
+
import type { ReturnedFields } from './ReturnedFields';
|
|
11
|
+
interface CopilotEvent<T extends object = ReturnedFields> {
|
|
12
|
+
id: string;
|
|
13
|
+
session_id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
event_source_id: string;
|
|
16
|
+
data: ConnectAck | EventAck | FollowUp | Inquiry | DisplayProducts<T> | RefinedSearch<T> | Done | Error;
|
|
17
|
+
created_at: string;
|
|
18
|
+
metadata: CommonMetadata;
|
|
19
|
+
}
|
|
20
|
+
export { CopilotEvent };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {SearchParams} from './SearchParams';
|
|
2
2
|
interface CopilotSearch {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
search_params: SearchParams;
|
|
4
|
+
user_prompt?: string;
|
|
5
5
|
}
|
|
6
6
|
export { CopilotSearch };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
interface DisplayProducts {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
eventName: string;
|
|
1
|
+
import type {ReturnedFields} from './ReturnedFields';
|
|
2
|
+
interface DisplayProducts<T extends object = ReturnedFields> {
|
|
3
|
+
session_id: string;
|
|
4
|
+
event_id: string;
|
|
6
5
|
timestamp: string;
|
|
7
|
-
|
|
6
|
+
event_source_id: string;
|
|
8
7
|
message: string;
|
|
9
|
-
|
|
8
|
+
event_name: 'display_products';
|
|
9
|
+
products: T[];
|
|
10
10
|
}
|
|
11
11
|
export { DisplayProducts };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
interface DisplayProductsMessageFields {
|
|
3
|
-
|
|
1
|
+
import type {ReturnedFields} from './ReturnedFields';
|
|
2
|
+
interface DisplayProductsMessageFields<T extends object = ReturnedFields> {
|
|
3
|
+
event_name: 'display_products';
|
|
4
|
+
products: T[];
|
|
4
5
|
}
|
|
5
6
|
export { DisplayProductsMessageFields };
|
package/src/model/Done.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
interface Done {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
eventName: string;
|
|
3
|
+
session_id: string;
|
|
4
|
+
event_id: string;
|
|
6
5
|
timestamp: string;
|
|
7
|
-
|
|
6
|
+
event_source_id: string;
|
|
8
7
|
message: string;
|
|
8
|
+
event_name: 'done';
|
|
9
9
|
}
|
|
10
10
|
export { Done };
|
package/src/model/Error.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
interface Error {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
eventName: string;
|
|
3
|
+
session_id: string;
|
|
4
|
+
event_id: string;
|
|
6
5
|
timestamp: string;
|
|
7
|
-
|
|
6
|
+
event_source_id: string;
|
|
8
7
|
message: string;
|
|
9
|
-
|
|
8
|
+
status: number;
|
|
10
9
|
error: string;
|
|
10
|
+
event_name: 'error';
|
|
11
11
|
}
|
|
12
12
|
export { Error };
|
package/src/model/EventAck.ts
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import {CopilotSearch} from './CopilotSearch';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import {FacetedNavigation} from './FacetedNavigation';
|
|
3
|
+
import {Cancel} from './Cancel';
|
|
4
|
+
import {EventAckNames} from './EventAckNames';
|
|
5
|
+
|
|
6
|
+
type EventRequestMap = {
|
|
7
|
+
copilot_search_ack: CopilotSearch;
|
|
8
|
+
faceted_navigation_ack: FacetedNavigation;
|
|
9
|
+
cancel_ack: Cancel;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface EventAck<T extends EventAckNames = EventAckNames> {
|
|
13
|
+
session_id: string;
|
|
14
|
+
event_id: string;
|
|
6
15
|
timestamp: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
request: CopilotSearch;
|
|
16
|
+
status: string;
|
|
17
|
+
request: EventRequestMap[T];
|
|
18
|
+
event_name: T;
|
|
11
19
|
}
|
|
12
20
|
export { EventAck };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {CopilotSearch} from './CopilotSearch';
|
|
2
|
+
import {FacetedNavigation} from './FacetedNavigation';
|
|
3
|
+
import {Cancel} from './Cancel';
|
|
4
|
+
import {EventAckNames} from './EventAckNames';
|
|
5
|
+
interface EventAckMessageFields {
|
|
6
|
+
status: string;
|
|
7
|
+
request: CopilotSearch | FacetedNavigation | Cancel;
|
|
8
|
+
event_name: EventAckNames;
|
|
9
|
+
}
|
|
10
|
+
export { EventAckMessageFields };
|
package/src/model/FacetValue.ts
CHANGED
package/src/model/FollowUp.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {CopilotSearchSuggestion} from './CopilotSearchSuggestion';
|
|
2
|
+
import {FacetedNavigationSuggestion} from './FacetedNavigationSuggestion';
|
|
2
3
|
interface FollowUp {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
eventName: string;
|
|
4
|
+
session_id: string;
|
|
5
|
+
event_id: string;
|
|
6
6
|
timestamp: string;
|
|
7
|
-
|
|
7
|
+
event_source_id: string;
|
|
8
8
|
message: string;
|
|
9
|
-
suggestions:
|
|
9
|
+
suggestions: (CopilotSearchSuggestion | FacetedNavigationSuggestion)[];
|
|
10
|
+
event_name: 'follow_up';
|
|
10
11
|
}
|
|
11
12
|
export { FollowUp };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {CopilotSearchSuggestion} from './CopilotSearchSuggestion';
|
|
2
|
+
import {FacetedNavigationSuggestion} from './FacetedNavigationSuggestion';
|
|
3
|
+
interface FollowUpMessageFields {
|
|
4
|
+
suggestions: (CopilotSearchSuggestion | FacetedNavigationSuggestion)[];
|
|
5
|
+
event_name: 'follow_up';
|
|
6
|
+
}
|
|
7
|
+
export { FollowUpMessageFields };
|
package/src/model/Inquiry.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
interface Inquiry {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
eventName: string;
|
|
3
|
+
session_id: string;
|
|
4
|
+
event_id: string;
|
|
6
5
|
timestamp: string;
|
|
7
|
-
|
|
6
|
+
event_source_id: string;
|
|
8
7
|
message: string;
|
|
8
|
+
event_name: 'inquiry';
|
|
9
9
|
}
|
|
10
10
|
export { Inquiry };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
interface PartialInquiry {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
eventName: string;
|
|
3
|
+
session_id: string;
|
|
4
|
+
event_id: string;
|
|
6
5
|
timestamp: string;
|
|
7
|
-
|
|
6
|
+
event_source_id: string;
|
|
8
7
|
message: string;
|
|
9
|
-
|
|
8
|
+
inquiry_event_id: string;
|
|
10
9
|
index: number;
|
|
10
|
+
event_name: 'partial_inquiry';
|
|
11
11
|
}
|
|
12
12
|
export { PartialInquiry };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {SearchParams} from './SearchParams';
|
|
2
2
|
import {Facet} from './Facet';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import type {ReturnedFields} from './ReturnedFields';
|
|
4
|
+
interface RefinedSearch<T extends object = ReturnedFields> {
|
|
5
|
+
session_id: string;
|
|
6
|
+
event_id: string;
|
|
7
7
|
timestamp: string;
|
|
8
|
-
|
|
8
|
+
event_source_id: string;
|
|
9
9
|
message: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
event_name: 'refined_search';
|
|
11
|
+
search_params: SearchParams;
|
|
12
|
+
hits?: T[];
|
|
13
|
+
total_hits?: number;
|
|
13
14
|
facets?: Facet[];
|
|
14
15
|
}
|
|
15
16
|
export { RefinedSearch };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {SearchParams} from './SearchParams';
|
|
2
2
|
import {Facet} from './Facet';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import type {ReturnedFields} from './ReturnedFields';
|
|
4
|
+
interface RefinedSearchMessageFields<T extends object = ReturnedFields> {
|
|
5
|
+
event_name: 'refined_search';
|
|
6
|
+
search_params: SearchParams;
|
|
7
|
+
hits?: T[];
|
|
8
|
+
total_hits?: number;
|
|
7
9
|
facets?: Facet[];
|
|
8
10
|
}
|
|
9
11
|
export { RefinedSearchMessageFields };
|
package/src/model/Root.ts
CHANGED
|
@@ -1,54 +1,62 @@
|
|
|
1
1
|
import {CommonRequiredFields} from './CommonRequiredFields';
|
|
2
2
|
import {CommonFields} from './CommonFields';
|
|
3
|
+
import {CommonMetadata} from './CommonMetadata';
|
|
3
4
|
import {ConnectAckMetadata} from './ConnectAckMetadata';
|
|
4
5
|
import {ConnectAck} from './ConnectAck';
|
|
5
|
-
import {
|
|
6
|
+
import {SearchParams} from './SearchParams';
|
|
6
7
|
import {FacetValue} from './FacetValue';
|
|
7
8
|
import {Facet} from './Facet';
|
|
8
9
|
import {CopilotSearch} from './CopilotSearch';
|
|
9
10
|
import {FacetedNavigation} from './FacetedNavigation';
|
|
11
|
+
import {EventAckNames} from './EventAckNames';
|
|
10
12
|
import {EventAck} from './EventAck';
|
|
11
13
|
import {RefinedSearch} from './RefinedSearch';
|
|
12
14
|
import {DisplayProducts} from './DisplayProducts';
|
|
13
|
-
import {
|
|
15
|
+
import {CopilotSearchSuggestion} from './CopilotSearchSuggestion';
|
|
16
|
+
import {FacetedNavigationSuggestion} from './FacetedNavigationSuggestion';
|
|
14
17
|
import {FollowUp} from './FollowUp';
|
|
15
18
|
import {PartialInquiry} from './PartialInquiry';
|
|
16
19
|
import {Inquiry} from './Inquiry';
|
|
17
20
|
import {Done} from './Done';
|
|
18
21
|
import {Error} from './Error';
|
|
19
|
-
import {
|
|
22
|
+
import {CopilotEvent} from './CopilotEvent';
|
|
20
23
|
import {SessionData} from './SessionData';
|
|
21
24
|
import {SessionInformation} from './SessionInformation';
|
|
22
|
-
import {SessionEventInformationReply} from './SessionEventInformationReply';
|
|
23
25
|
import {SessionEventStatusReply} from './SessionEventStatusReply';
|
|
24
26
|
import {Cancel} from './Cancel';
|
|
27
|
+
import type {ReturnedFields} from './ReturnedFields';
|
|
25
28
|
interface Root {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
common_fields?: CommonRequiredFields;
|
|
30
|
+
common_event_fields?: CommonFields;
|
|
31
|
+
common_metadata?: CommonMetadata;
|
|
32
|
+
connect_ack_metadata?: ConnectAckMetadata;
|
|
33
|
+
connect_ack?: ConnectAck;
|
|
34
|
+
search_params?: SearchParams;
|
|
35
|
+
facet_value?: FacetValue;
|
|
32
36
|
facets?: Facet[];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
copilot_search?: CopilotSearch;
|
|
38
|
+
faceted_navigation?: FacetedNavigation;
|
|
39
|
+
event_ack_names?: EventAckNames;
|
|
40
|
+
event_ack?: EventAck;
|
|
41
|
+
refined_search?: RefinedSearch;
|
|
42
|
+
display_products?: DisplayProducts;
|
|
43
|
+
copilot_search_suggestion?: CopilotSearchSuggestion;
|
|
44
|
+
faceted_navigation_suggestion?: FacetedNavigationSuggestion;
|
|
45
|
+
suggestions?: (CopilotSearchSuggestion | FacetedNavigationSuggestion)[];
|
|
46
|
+
follow_up?: FollowUp;
|
|
47
|
+
partial_inquiry?: PartialInquiry;
|
|
41
48
|
inquiry?: Inquiry;
|
|
42
49
|
done?: Done;
|
|
43
50
|
error?: Error;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
event?: CopilotEvent;
|
|
52
|
+
session_data?: SessionData;
|
|
53
|
+
session_info_reply?: SessionInformation;
|
|
54
|
+
session_events_reply?: CopilotEvent[];
|
|
55
|
+
session_event_info?: string;
|
|
56
|
+
session_event_info_reply?: ConnectAck | EventAck | FollowUp | Inquiry | DisplayProducts | RefinedSearch | Done | Error;
|
|
57
|
+
session_event_status?: string;
|
|
58
|
+
session_event_status_reply?: SessionEventStatusReply;
|
|
52
59
|
cancel?: Cancel;
|
|
60
|
+
return_fields?: ReturnedFields;
|
|
53
61
|
}
|
|
54
62
|
export { Root };
|