@cimulate/copilot-sdk 2.2.1 → 3.1.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/dist/bundle.cimulate.copilot-sdk.0e06e483.cjs.js +2 -0
- package/dist/{bundle.cimulate.copilot-sdk.1f1847ab.cjs.js.map → bundle.cimulate.copilot-sdk.0e06e483.cjs.js.map} +1 -1
- package/dist/bundle.cimulate.copilot-sdk.1564b7e1.esm.js +2 -0
- package/dist/{bundle.cimulate.copilot-sdk.437a3f0b.esm.js.map → bundle.cimulate.copilot-sdk.1564b7e1.esm.js.map} +1 -1
- package/dist/bundle.cimulate.copilot-sdk.7893ae5e.umd.js +2 -0
- package/dist/{bundle.cimulate.copilot-sdk.429ff346.umd.js.map → bundle.cimulate.copilot-sdk.7893ae5e.umd.js.map} +1 -1
- 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 +18 -9
- package/dist/types/model/CancelAck.d.ts +3 -3
- package/dist/types/model/CommonFields.d.ts +2 -2
- package/dist/types/model/CommonRequiredFields.d.ts +2 -2
- package/dist/types/model/ConnectAck.d.ts +3 -3
- package/dist/types/model/CopilotAPIEvent.d.ts +1 -1
- package/dist/types/model/CopilotSearchAck.d.ts +3 -3
- package/dist/types/model/DisplayProducts.d.ts +3 -3
- package/dist/types/model/Done.d.ts +3 -3
- package/dist/types/model/Error.d.ts +3 -3
- package/dist/types/model/FacetedNavigationAck.d.ts +3 -3
- package/dist/types/model/FollowUp.d.ts +3 -3
- package/dist/types/model/Inquiry.d.ts +4 -3
- package/dist/types/model/OperationAck.d.ts +3 -3
- package/dist/types/model/PartialInquiry.d.ts +4 -4
- package/dist/types/model/RefinedSearch.d.ts +3 -3
- package/dist/types/model/SessionData.d.ts +1 -4
- package/dist/types/model/SessionInformation.d.ts +7 -5
- package/examples/callbacks.ts +5 -2
- package/examples/generator.ts +3 -1
- package/package.json +1 -1
- package/src/copilot.ts +116 -26
- package/src/model/CancelAck.ts +3 -3
- package/src/model/CommonFields.ts +2 -2
- package/src/model/CommonRequiredFields.ts +2 -2
- package/src/model/ConnectAck.ts +3 -3
- package/src/model/CopilotAPIEvent.ts +1 -1
- package/src/model/CopilotSearchAck.ts +3 -3
- package/src/model/DisplayProducts.ts +3 -3
- package/src/model/Done.ts +3 -3
- package/src/model/Error.ts +3 -3
- package/src/model/FacetedNavigationAck.ts +3 -3
- package/src/model/FollowUp.ts +3 -3
- package/src/model/Inquiry.ts +4 -3
- package/src/model/OperationAck.ts +3 -3
- package/src/model/PartialInquiry.ts +4 -4
- package/src/model/RefinedSearch.ts +3 -3
- package/src/model/SessionData.ts +1 -4
- package/src/model/SessionInformation.ts +7 -6
- package/dist/bundle.cimulate.copilot-sdk.1f1847ab.cjs.js +0 -2
- package/dist/bundle.cimulate.copilot-sdk.429ff346.umd.js +0 -2
- package/dist/bundle.cimulate.copilot-sdk.437a3f0b.esm.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ReturnedFields } from "./ReturnedFields";
|
|
2
2
|
interface DisplayProducts<TReturnedFields extends ReturnedFields = ReturnedFields> {
|
|
3
3
|
sessionId: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
id: string;
|
|
5
|
+
createdAt: string;
|
|
6
6
|
eventSourceId: string;
|
|
7
7
|
message: string;
|
|
8
|
-
|
|
8
|
+
name: 'display_products';
|
|
9
9
|
products: TReturnedFields;
|
|
10
10
|
}
|
|
11
11
|
export { DisplayProducts };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
interface Error {
|
|
2
2
|
sessionId: string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
id: string;
|
|
4
|
+
createdAt: string;
|
|
5
5
|
eventSourceId: string;
|
|
6
6
|
message: string;
|
|
7
7
|
status: number;
|
|
8
8
|
error: string;
|
|
9
|
-
|
|
9
|
+
name: 'error';
|
|
10
10
|
}
|
|
11
11
|
export { Error };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FacetedNavigation } from './FacetedNavigation';
|
|
2
2
|
interface FacetedNavigationAck {
|
|
3
|
-
|
|
3
|
+
name: 'faceted_navigation';
|
|
4
4
|
request: FacetedNavigation;
|
|
5
5
|
sessionId: string;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
8
|
status: string;
|
|
9
9
|
}
|
|
10
10
|
export { FacetedNavigationAck };
|
|
@@ -2,11 +2,11 @@ import { CopilotSearchSuggestion } from './CopilotSearchSuggestion';
|
|
|
2
2
|
import { FacetedNavigationSuggestion } from './FacetedNavigationSuggestion';
|
|
3
3
|
interface FollowUp {
|
|
4
4
|
sessionId: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
id: string;
|
|
6
|
+
createdAt: string;
|
|
7
7
|
eventSourceId: string;
|
|
8
8
|
message: string;
|
|
9
9
|
suggestions: (CopilotSearchSuggestion | FacetedNavigationSuggestion)[];
|
|
10
|
-
|
|
10
|
+
name: 'follow_up';
|
|
11
11
|
}
|
|
12
12
|
export { FollowUp };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
interface PartialInquiry {
|
|
2
2
|
sessionId: string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
id: string;
|
|
4
|
+
createdAt: string;
|
|
5
5
|
eventSourceId: string;
|
|
6
6
|
message: string;
|
|
7
|
-
|
|
7
|
+
inquiryLinkId: string;
|
|
8
8
|
index: number;
|
|
9
|
-
|
|
9
|
+
name: 'partial_inquiry';
|
|
10
10
|
}
|
|
11
11
|
export { PartialInquiry };
|
|
@@ -3,11 +3,11 @@ import { ReturnedFields } from "./ReturnedFields";
|
|
|
3
3
|
import { SearchParams } from './SearchParams';
|
|
4
4
|
interface RefinedSearch<TReturnedFields extends ReturnedFields = ReturnedFields> {
|
|
5
5
|
sessionId: string;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
8
|
eventSourceId: string;
|
|
9
9
|
message: string;
|
|
10
|
-
|
|
10
|
+
name: 'refined_search';
|
|
11
11
|
searchParams: SearchParams;
|
|
12
12
|
hits?: TReturnedFields;
|
|
13
13
|
totalHits?: number;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { ReturnedFields } from "./ReturnedFields";
|
|
3
|
-
interface SessionData<TReturnedFields extends ReturnedFields = ReturnedFields> {
|
|
4
|
-
events?: Record<string, CopilotEvent<TReturnedFields>>;
|
|
1
|
+
interface SessionData {
|
|
5
2
|
eventSourceMap?: Record<string, string[]>;
|
|
6
3
|
}
|
|
7
4
|
export { SessionData };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommonMetadata } from './CommonMetadata';
|
|
2
2
|
import { SessionData } from './SessionData';
|
|
3
|
-
interface SessionInformation
|
|
4
|
-
|
|
3
|
+
interface SessionInformation {
|
|
4
|
+
id?: string;
|
|
5
5
|
createdAt?: string;
|
|
6
|
-
|
|
6
|
+
lastUpdatedAt?: string;
|
|
7
7
|
status?: string;
|
|
8
|
-
|
|
8
|
+
ttlInMinutes?: number;
|
|
9
|
+
data?: SessionData;
|
|
10
|
+
metadata?: CommonMetadata;
|
|
9
11
|
}
|
|
10
12
|
export { SessionInformation };
|
package/examples/callbacks.ts
CHANGED
|
@@ -15,17 +15,20 @@ async function main() {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
const followUp = copilot.on("follow_up", function followup(event) {
|
|
18
|
-
if (event.eventSourceId == search.result.
|
|
18
|
+
if (event.eventSourceId == search.result.id) {
|
|
19
19
|
event.suggestions.forEach((s) => console.log(s.displayText));
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
copilot.on("done", function done(event) {
|
|
24
|
-
if (event.eventSourceId == search.result.
|
|
24
|
+
if (event.eventSourceId == search.result.id) {
|
|
25
25
|
copilot.off("follow_up", followUp);
|
|
26
26
|
copilot.off("done", done);
|
|
27
|
+
console.log("De-registered event listeners!");
|
|
27
28
|
}
|
|
28
29
|
});
|
|
30
|
+
|
|
31
|
+
copilot.disconnect();
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
main();
|
package/examples/generator.ts
CHANGED
|
@@ -13,7 +13,7 @@ async function main() {
|
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
for await (const event of search.events) {
|
|
16
|
-
switch (event.
|
|
16
|
+
switch (event.name) {
|
|
17
17
|
case "follow_up":
|
|
18
18
|
event.suggestions.forEach((event) => console.log(event.displayText));
|
|
19
19
|
break;
|
|
@@ -21,6 +21,8 @@ async function main() {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
console.log("No more events!");
|
|
24
|
+
|
|
25
|
+
copilot.disconnect();
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
main();
|
package/package.json
CHANGED
package/src/copilot.ts
CHANGED
|
@@ -49,6 +49,10 @@ export default class CimulateCopilot<
|
|
|
49
49
|
> {
|
|
50
50
|
private socket: Socket;
|
|
51
51
|
private sessionIdKey: string = "x-cimulate-copilot-session-id";
|
|
52
|
+
private reconnectAttempts = 0;
|
|
53
|
+
private maxReconnectAttempts = 5;
|
|
54
|
+
private maxReconnectDelay = 30000;
|
|
55
|
+
private reconnectTimeout?: ReturnType<typeof setTimeout>;
|
|
52
56
|
|
|
53
57
|
constructor({
|
|
54
58
|
apiKey,
|
|
@@ -87,25 +91,104 @@ export default class CimulateCopilot<
|
|
|
87
91
|
this.socket = io(socketioEndpoint, deepmerge.all(options));
|
|
88
92
|
}
|
|
89
93
|
|
|
94
|
+
private readonly handleConnectAck = (event: ConnectAck) => {
|
|
95
|
+
console.log("[Copilot SDK] Connect Ack:", event);
|
|
96
|
+
this.socket.auth = {
|
|
97
|
+
[this.sessionIdKey]: event.sessionId,
|
|
98
|
+
};
|
|
99
|
+
this.reconnectAttempts = 0;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
private readonly handleDisconnect = (reason: Socket.DisconnectReason) => {
|
|
103
|
+
console.warn(`[Copilot SDK] Disconnected: ${reason}`);
|
|
104
|
+
if (reason !== "io client disconnect") {
|
|
105
|
+
console.log(`[Copilot SDK] Disconnected due to ${reason}. Attempting reconnect...`);
|
|
106
|
+
this.retryConnect();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
private readonly handleConnectError = (err: Error) => {
|
|
111
|
+
console.error(`[Copilot SDK] Connect error: ${err.message}`);
|
|
112
|
+
|
|
113
|
+
if (err.message === "Invalid API Key") {
|
|
114
|
+
this.disconnect();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Trigger reconnect logic with backoff
|
|
118
|
+
if (!this.socket.connected && !this.socket.active) {
|
|
119
|
+
console.log(`[Copilot SDK] Retrying connect attempt...`);
|
|
120
|
+
this.retryConnect();
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
private readonly offInternalHandlers = () => {
|
|
125
|
+
this.socket.off("connect_ack", this.handleConnectAck);
|
|
126
|
+
this.socket.off("disconnect", this.handleDisconnect);
|
|
127
|
+
this.socket.off("connect_error", this.handleConnectError);
|
|
128
|
+
}
|
|
129
|
+
|
|
90
130
|
connect() {
|
|
91
131
|
|
|
132
|
+
if (this.reconnectTimeout) {
|
|
133
|
+
clearTimeout(this.reconnectTimeout);
|
|
134
|
+
this.reconnectTimeout = undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Clear old handlers to avoid duplicates
|
|
138
|
+
this.offInternalHandlers();
|
|
139
|
+
|
|
140
|
+
// Add fresh handlers
|
|
141
|
+
this.on("connect_ack", this.handleConnectAck);
|
|
142
|
+
this.socket.on("disconnect", this.handleDisconnect);
|
|
143
|
+
this.socket.on("connect_error", this.handleConnectError);
|
|
144
|
+
|
|
145
|
+
// Clear old auth state
|
|
92
146
|
if (this.socket.auth && this.sessionIdKey in this.socket.auth) {
|
|
93
147
|
this.socket.auth = {};
|
|
94
148
|
}
|
|
95
|
-
|
|
149
|
+
|
|
96
150
|
this.socket.connect();
|
|
151
|
+
}
|
|
97
152
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
153
|
+
private retryConnect() {
|
|
154
|
+
// Don't retry connect if connected or currently trying to connect
|
|
155
|
+
if (this.socket.connected || this.socket.active || this.reconnectAttempts >= this.maxReconnectAttempts) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (this.reconnectTimeout) {
|
|
160
|
+
clearTimeout(this.reconnectTimeout);
|
|
161
|
+
this.reconnectTimeout = undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (this.reconnectAttempts < this.maxReconnectAttempts) {
|
|
165
|
+
const delay = Math.min(1000 * 2 ** this.reconnectAttempts, this.maxReconnectDelay);
|
|
166
|
+
console.info(`[Copilot SDK] Retry #${this.reconnectAttempts + 1} in ${delay}ms...`);
|
|
167
|
+
|
|
168
|
+
this.reconnectTimeout = setTimeout(() => {
|
|
169
|
+
if (!this.socket.connected && !this.socket.active) {
|
|
170
|
+
this.reconnectAttempts++;
|
|
171
|
+
this.reconnect();
|
|
172
|
+
}
|
|
173
|
+
}, delay);
|
|
174
|
+
} else {
|
|
175
|
+
console.error("[Copilot SDK] Max reconnect attempts reached.");
|
|
176
|
+
}
|
|
103
177
|
}
|
|
104
178
|
|
|
105
179
|
reconnect() {
|
|
106
|
-
if
|
|
107
|
-
|
|
180
|
+
// Don't reconnect if connected or currently trying to connect
|
|
181
|
+
if (this.socket.connected || this.socket.active || this.reconnectAttempts >= this.maxReconnectAttempts) {
|
|
182
|
+
return;
|
|
108
183
|
}
|
|
184
|
+
|
|
185
|
+
// Clear any existing scheduled reconnect to debounce
|
|
186
|
+
if (this.reconnectTimeout) {
|
|
187
|
+
clearTimeout(this.reconnectTimeout);
|
|
188
|
+
this.reconnectTimeout = undefined;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
this.socket.connect();
|
|
109
192
|
}
|
|
110
193
|
|
|
111
194
|
async search(
|
|
@@ -161,48 +244,55 @@ export default class CimulateCopilot<
|
|
|
161
244
|
}
|
|
162
245
|
|
|
163
246
|
async requestSessionInformation(): Promise<
|
|
164
|
-
CopilotResult<T, SessionInformation
|
|
247
|
+
CopilotResult<T, SessionInformation>
|
|
165
248
|
>;
|
|
166
249
|
async requestSessionInformation(
|
|
167
|
-
callback?: (sessionInformation: SessionInformation
|
|
250
|
+
callback?: (sessionInformation: SessionInformation) => void
|
|
168
251
|
): Promise<void>;
|
|
169
252
|
async requestSessionInformation(
|
|
170
|
-
callback?: (sessionInformation: SessionInformation
|
|
171
|
-
): Promise<CopilotResult<T, SessionInformation
|
|
253
|
+
callback?: (sessionInformation: SessionInformation) => void
|
|
254
|
+
): Promise<CopilotResult<T, SessionInformation> | void> {
|
|
172
255
|
return new Promise((resolve) => {
|
|
173
|
-
this.socket.emit("session_info", (response: SessionInformation
|
|
256
|
+
this.socket.emit("session_info", (response: SessionInformation) => {
|
|
174
257
|
if (callback) callback(response);
|
|
175
258
|
// TODO - error handling
|
|
176
|
-
resolve(response as CopilotResult<T, SessionInformation
|
|
259
|
+
resolve(response as CopilotResult<T, SessionInformation>);
|
|
177
260
|
});
|
|
178
261
|
});
|
|
179
262
|
}
|
|
180
263
|
|
|
181
264
|
on<E extends CopilotEventName>(
|
|
182
|
-
|
|
183
|
-
handler: (event: Extract<CopilotAPIEvent<T>, {
|
|
265
|
+
name: E,
|
|
266
|
+
handler: (event: Extract<CopilotAPIEvent<T>, { name: E }>) => void
|
|
184
267
|
) {
|
|
185
|
-
this.socket.on<CopilotEventName>(
|
|
268
|
+
this.socket.on<CopilotEventName>(name, handler);
|
|
186
269
|
return handler;
|
|
187
270
|
}
|
|
188
271
|
|
|
189
272
|
once<E extends CopilotEventName>(
|
|
190
|
-
|
|
191
|
-
handler: (event: Extract<CopilotAPIEvent<T>, {
|
|
273
|
+
name: E,
|
|
274
|
+
handler: (event: Extract<CopilotAPIEvent<T>, { name: E }>) => void
|
|
192
275
|
) {
|
|
193
|
-
this.socket.once<CopilotEventName>(
|
|
276
|
+
this.socket.once<CopilotEventName>(name, handler);
|
|
194
277
|
}
|
|
195
278
|
|
|
196
279
|
off<E extends CopilotEventName>(
|
|
197
|
-
|
|
198
|
-
handler?: (event: Extract<CopilotAPIEvent<T>, {
|
|
280
|
+
name?: E,
|
|
281
|
+
handler?: (event: Extract<CopilotAPIEvent<T>, { name: E }>) => void
|
|
199
282
|
) {
|
|
200
|
-
this.socket.off(
|
|
283
|
+
this.socket.off(name, handler as any);
|
|
201
284
|
}
|
|
202
285
|
|
|
203
286
|
disconnect() {
|
|
287
|
+
|
|
288
|
+
if (this.reconnectTimeout) {
|
|
289
|
+
clearTimeout(this.reconnectTimeout);
|
|
290
|
+
this.reconnectTimeout = undefined;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
this.offInternalHandlers();
|
|
204
294
|
this.socket.disconnect();
|
|
205
|
-
}
|
|
295
|
+
}
|
|
206
296
|
|
|
207
297
|
onDisconnect(handler: (reason: string) => void) {
|
|
208
298
|
this.socket.on("disconnect", handler);
|
|
@@ -225,7 +315,7 @@ export default class CimulateCopilot<
|
|
|
225
315
|
event: string,
|
|
226
316
|
payload: Exclude<CopilotAPIEvent<T>, ConnectAck>
|
|
227
317
|
) => {
|
|
228
|
-
if (payload.
|
|
318
|
+
if (payload.name == "done") cancel();
|
|
229
319
|
if (payload.eventSourceId == eventSourceId) emit(payload);
|
|
230
320
|
};
|
|
231
321
|
|
|
@@ -239,7 +329,7 @@ export default class CimulateCopilot<
|
|
|
239
329
|
const result: A = await new Promise((resolve) =>
|
|
240
330
|
// TODO - error handling
|
|
241
331
|
this.socket.emit(operation, payload, (ack: A) => {
|
|
242
|
-
eventSourceId = ack?.
|
|
332
|
+
eventSourceId = ack?.id;
|
|
243
333
|
resolve(ack);
|
|
244
334
|
})
|
|
245
335
|
);
|
package/src/model/CancelAck.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Cancel } from './Cancel';
|
|
2
2
|
interface CancelAck {
|
|
3
|
-
|
|
3
|
+
name: 'cancel';
|
|
4
4
|
request: Cancel;
|
|
5
5
|
sessionId: string;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
8
|
status: string;
|
|
9
9
|
}
|
|
10
10
|
export { CancelAck };
|
package/src/model/ConnectAck.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ConnectAckMetadata } from './ConnectAckMetadata';
|
|
2
2
|
interface ConnectAck {
|
|
3
3
|
sessionId: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
id: string;
|
|
5
|
+
createdAt: string;
|
|
6
6
|
status: number;
|
|
7
7
|
message: string;
|
|
8
8
|
metadata: ConnectAckMetadata;
|
|
9
|
-
|
|
9
|
+
name: 'connect_ack';
|
|
10
10
|
}
|
|
11
11
|
export { ConnectAck };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CopilotSearch } from './CopilotSearch';
|
|
2
2
|
interface CopilotSearchAck {
|
|
3
|
-
|
|
3
|
+
name: 'copilot_search';
|
|
4
4
|
request: CopilotSearch;
|
|
5
5
|
sessionId: string;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
8
|
status: string;
|
|
9
9
|
}
|
|
10
10
|
export { CopilotSearchAck };
|
|
@@ -2,11 +2,11 @@ import { ReturnedFields } from "./ReturnedFields";
|
|
|
2
2
|
|
|
3
3
|
interface DisplayProducts<TReturnedFields extends ReturnedFields = ReturnedFields> {
|
|
4
4
|
sessionId: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
id: string;
|
|
6
|
+
createdAt: string;
|
|
7
7
|
eventSourceId: string;
|
|
8
8
|
message: string;
|
|
9
|
-
|
|
9
|
+
name: 'display_products';
|
|
10
10
|
products: TReturnedFields;
|
|
11
11
|
}
|
|
12
12
|
export { DisplayProducts };
|
package/src/model/Done.ts
CHANGED
package/src/model/Error.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
interface Error {
|
|
3
3
|
sessionId: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
id: string;
|
|
5
|
+
createdAt: string;
|
|
6
6
|
eventSourceId: string;
|
|
7
7
|
message: string;
|
|
8
8
|
status: number;
|
|
9
9
|
error: string;
|
|
10
|
-
|
|
10
|
+
name: 'error';
|
|
11
11
|
}
|
|
12
12
|
export { Error };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FacetedNavigation } from './FacetedNavigation';
|
|
2
2
|
interface FacetedNavigationAck {
|
|
3
|
-
|
|
3
|
+
name: 'faceted_navigation';
|
|
4
4
|
request: FacetedNavigation;
|
|
5
5
|
sessionId: string;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
8
|
status: string;
|
|
9
9
|
}
|
|
10
10
|
export { FacetedNavigationAck };
|
package/src/model/FollowUp.ts
CHANGED
|
@@ -2,11 +2,11 @@ import { CopilotSearchSuggestion } from './CopilotSearchSuggestion';
|
|
|
2
2
|
import { FacetedNavigationSuggestion } from './FacetedNavigationSuggestion';
|
|
3
3
|
interface FollowUp {
|
|
4
4
|
sessionId: string;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
id: string;
|
|
6
|
+
createdAt: string;
|
|
7
7
|
eventSourceId: string;
|
|
8
8
|
message: string;
|
|
9
9
|
suggestions: (CopilotSearchSuggestion | FacetedNavigationSuggestion)[];
|
|
10
|
-
|
|
10
|
+
name: 'follow_up';
|
|
11
11
|
}
|
|
12
12
|
export { FollowUp };
|
package/src/model/Inquiry.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
interface Inquiry {
|
|
3
3
|
sessionId: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
id: string;
|
|
5
|
+
createdAt: string;
|
|
6
6
|
eventSourceId: string;
|
|
7
7
|
message: string;
|
|
8
|
-
|
|
8
|
+
name: 'inquiry';
|
|
9
|
+
inquiryLinkId: string;
|
|
9
10
|
}
|
|
10
11
|
export { Inquiry };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
interface PartialInquiry {
|
|
3
3
|
sessionId: string;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
id: string;
|
|
5
|
+
createdAt: string;
|
|
6
6
|
eventSourceId: string;
|
|
7
7
|
message: string;
|
|
8
|
-
|
|
8
|
+
inquiryLinkId: string;
|
|
9
9
|
index: number;
|
|
10
|
-
|
|
10
|
+
name: 'partial_inquiry';
|
|
11
11
|
}
|
|
12
12
|
export { PartialInquiry };
|
|
@@ -4,11 +4,11 @@ import { SearchParams } from './SearchParams';
|
|
|
4
4
|
|
|
5
5
|
interface RefinedSearch<TReturnedFields extends ReturnedFields = ReturnedFields> {
|
|
6
6
|
sessionId: string;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
id: string;
|
|
8
|
+
createdAt: string;
|
|
9
9
|
eventSourceId: string;
|
|
10
10
|
message: string;
|
|
11
|
-
|
|
11
|
+
name: 'refined_search';
|
|
12
12
|
searchParams: SearchParams;
|
|
13
13
|
hits?: TReturnedFields;
|
|
14
14
|
totalHits?: number;
|
package/src/model/SessionData.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { CopilotEvent } from './CopilotEvent';
|
|
2
|
-
import { ReturnedFields } from "./ReturnedFields";
|
|
3
1
|
|
|
4
|
-
interface SessionData
|
|
5
|
-
events?: Record<string, CopilotEvent<TReturnedFields>>;
|
|
2
|
+
interface SessionData {
|
|
6
3
|
eventSourceMap?: Record<string, string[]>;
|
|
7
4
|
}
|
|
8
5
|
export { SessionData };
|