@cimulate/copilot-sdk 3.9.0 → 3.10.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 +16 -0
- package/dist/types/model/CopilotAPIEvent.d.ts +2 -1
- package/dist/types/model/CopilotEvent.d.ts +2 -1
- package/dist/types/model/RefinedBrowse.d.ts +16 -0
- package/dist/types/model/ReturnedFields.d.ts +1 -0
- package/dist/types/model/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/model/CopilotAPIEvent.ts +2 -0
- package/src/model/CopilotEvent.ts +2 -1
- package/src/model/RefinedBrowse.ts +17 -0
- package/src/model/ReturnedFields.ts +1 -0
- package/src/model/index.ts +1 -0
package/README.md
CHANGED
|
@@ -189,6 +189,22 @@ const client = new CimulateCopilot<SearchReturnedFields[]>({
|
|
|
189
189
|
});
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
+
### Defining Browse Returned Fields Types
|
|
193
|
+
```typescript
|
|
194
|
+
interface BrowseReturnedFields {
|
|
195
|
+
id: string,
|
|
196
|
+
title: string,
|
|
197
|
+
image_url: string,
|
|
198
|
+
price: number,
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
// Instantiate client object
|
|
203
|
+
const client = new CimulateCopilot<BrowseReturnedFields[]>({
|
|
204
|
+
apiKey: "your-api-key",
|
|
205
|
+
baseUrl: "https://cimulate.copilot.url",
|
|
206
|
+
});
|
|
207
|
+
|
|
192
208
|
### Handling Request Ack Failure
|
|
193
209
|
```typescript
|
|
194
210
|
import {
|
|
@@ -11,7 +11,8 @@ import { FollowUp } from "./FollowUp";
|
|
|
11
11
|
import { Inquiry } from "./Inquiry";
|
|
12
12
|
import { PartialInquiry } from "./PartialInquiry";
|
|
13
13
|
import { Progress } from "./Progress";
|
|
14
|
+
import { RefinedBrowse } from "./RefinedBrowse";
|
|
14
15
|
import { RefinedSearch } from "./RefinedSearch";
|
|
15
16
|
import { ReturnedFields } from "./ReturnedFields";
|
|
16
|
-
export type CopilotAPIEvent<TReturnedFields extends ReturnedFields = ReturnedFields> = ConnectAck | ConnectError | DisplayProducts<TReturnedFields> | Done | CopilotError | FollowUp | Inquiry | PartialInquiry | Progress | RefinedSearch<TReturnedFields>;
|
|
17
|
+
export type CopilotAPIEvent<TReturnedFields extends ReturnedFields = ReturnedFields> = ConnectAck | ConnectError | DisplayProducts<TReturnedFields> | Done | CopilotError | FollowUp | Inquiry | PartialInquiry | Progress | RefinedBrowse<TReturnedFields> | RefinedSearch<TReturnedFields>;
|
|
17
18
|
export type CopilotEventName = CopilotAPIEvent["name"];
|
|
@@ -6,6 +6,7 @@ import { Done } from './Done';
|
|
|
6
6
|
import { FollowUp } from './FollowUp';
|
|
7
7
|
import { Inquiry } from './Inquiry';
|
|
8
8
|
import { Progress } from './Progress';
|
|
9
|
+
import { RefinedBrowse } from './RefinedBrowse';
|
|
9
10
|
import { RefinedSearch } from './RefinedSearch';
|
|
10
11
|
import { ReturnedFields } from "./ReturnedFields";
|
|
11
12
|
interface CopilotEvent<TReturnedFields extends ReturnedFields = ReturnedFields> {
|
|
@@ -13,7 +14,7 @@ interface CopilotEvent<TReturnedFields extends ReturnedFields = ReturnedFields>
|
|
|
13
14
|
sessionId: string;
|
|
14
15
|
name: string;
|
|
15
16
|
eventSourceId: string;
|
|
16
|
-
data: ConnectAck | FollowUp | Inquiry | DisplayProducts<TReturnedFields> | RefinedSearch<TReturnedFields> | Progress | Done | CopilotError;
|
|
17
|
+
data: ConnectAck | FollowUp | Inquiry | DisplayProducts<TReturnedFields> | RefinedBrowse<TReturnedFields> | RefinedSearch<TReturnedFields> | Progress | Done | CopilotError;
|
|
17
18
|
createdAt: string;
|
|
18
19
|
metadata: CommonMetadata;
|
|
19
20
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BrowseParams } from './BrowseParams';
|
|
2
|
+
import { Facet } from './Facet';
|
|
3
|
+
import { ReturnedFields } from "./ReturnedFields";
|
|
4
|
+
interface RefinedBrowse<TReturnedFields extends ReturnedFields = ReturnedFields> {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
id: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
eventSourceId: string;
|
|
9
|
+
message: string;
|
|
10
|
+
name: 'refined_browse';
|
|
11
|
+
browseParams: BrowseParams;
|
|
12
|
+
hits?: TReturnedFields;
|
|
13
|
+
totalHits?: number;
|
|
14
|
+
facets?: Facet[];
|
|
15
|
+
}
|
|
16
|
+
export { RefinedBrowse };
|
|
@@ -37,6 +37,7 @@ export * from './ProductViewAck';
|
|
|
37
37
|
export * from './ProductViewSuggestion';
|
|
38
38
|
export * from './Progress';
|
|
39
39
|
export * from './ProgressToolKwargs';
|
|
40
|
+
export * from './RefinedBrowse';
|
|
40
41
|
export * from './RefinedSearch';
|
|
41
42
|
export * from './ReturnedFields';
|
|
42
43
|
export * from './SearchParams';
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import { FollowUp } from "./FollowUp";
|
|
|
11
11
|
import { Inquiry } from "./Inquiry";
|
|
12
12
|
import { PartialInquiry } from "./PartialInquiry";
|
|
13
13
|
import { Progress } from "./Progress";
|
|
14
|
+
import { RefinedBrowse } from "./RefinedBrowse";
|
|
14
15
|
import { RefinedSearch } from "./RefinedSearch";
|
|
15
16
|
import { ReturnedFields } from "./ReturnedFields";
|
|
16
17
|
|
|
@@ -26,6 +27,7 @@ export type CopilotAPIEvent<
|
|
|
26
27
|
| Inquiry
|
|
27
28
|
| PartialInquiry
|
|
28
29
|
| Progress
|
|
30
|
+
| RefinedBrowse<TReturnedFields>
|
|
29
31
|
| RefinedSearch<TReturnedFields>;
|
|
30
32
|
|
|
31
33
|
export type CopilotEventName = CopilotAPIEvent["name"];
|
|
@@ -6,6 +6,7 @@ import { Done } from './Done';
|
|
|
6
6
|
import { FollowUp } from './FollowUp';
|
|
7
7
|
import { Inquiry } from './Inquiry';
|
|
8
8
|
import { Progress } from './Progress';
|
|
9
|
+
import { RefinedBrowse } from './RefinedBrowse';
|
|
9
10
|
import { RefinedSearch } from './RefinedSearch';
|
|
10
11
|
import { ReturnedFields } from "./ReturnedFields";
|
|
11
12
|
|
|
@@ -14,7 +15,7 @@ interface CopilotEvent<TReturnedFields extends ReturnedFields = ReturnedFields>
|
|
|
14
15
|
sessionId: string;
|
|
15
16
|
name: string;
|
|
16
17
|
eventSourceId: string;
|
|
17
|
-
data: ConnectAck | FollowUp | Inquiry | DisplayProducts<TReturnedFields> | RefinedSearch<TReturnedFields> | Progress | Done | CopilotError;
|
|
18
|
+
data: ConnectAck | FollowUp | Inquiry | DisplayProducts<TReturnedFields> | RefinedBrowse<TReturnedFields> | RefinedSearch<TReturnedFields> | Progress | Done | CopilotError;
|
|
18
19
|
createdAt: string;
|
|
19
20
|
metadata: CommonMetadata;
|
|
20
21
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BrowseParams } from './BrowseParams';
|
|
2
|
+
import { Facet } from './Facet';
|
|
3
|
+
import { ReturnedFields } from "./ReturnedFields";
|
|
4
|
+
|
|
5
|
+
interface RefinedBrowse<TReturnedFields extends ReturnedFields = ReturnedFields> {
|
|
6
|
+
sessionId: string;
|
|
7
|
+
id: string;
|
|
8
|
+
createdAt: string;
|
|
9
|
+
eventSourceId: string;
|
|
10
|
+
message: string;
|
|
11
|
+
name: 'refined_browse';
|
|
12
|
+
browseParams: BrowseParams;
|
|
13
|
+
hits?: TReturnedFields;
|
|
14
|
+
totalHits?: number;
|
|
15
|
+
facets?: Facet[];
|
|
16
|
+
}
|
|
17
|
+
export { RefinedBrowse };
|
package/src/model/index.ts
CHANGED
|
@@ -37,6 +37,7 @@ export * from './ProductViewAck';
|
|
|
37
37
|
export * from './ProductViewSuggestion';
|
|
38
38
|
export * from './Progress';
|
|
39
39
|
export * from './ProgressToolKwargs';
|
|
40
|
+
export * from './RefinedBrowse';
|
|
40
41
|
export * from './RefinedSearch';
|
|
41
42
|
export * from './ReturnedFields';
|
|
42
43
|
export * from './SearchParams';
|