@cimulate/copilot-widget 0.15.0 → 0.16.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/cimulate-copilot-widget.d.ts +116 -28
- package/dist/cimulate-copilot-widget.es.js +9362 -8987
- package/dist/cimulate-copilot-widget.umd.js +39 -39
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ConnectAck } from '@cimulate/copilot-sdk';
|
|
2
|
+
import { CopilotBrowseAck } from '@cimulate/copilot-sdk';
|
|
2
3
|
import { CopilotBrowseSuggestion } from '@cimulate/copilot-sdk';
|
|
3
4
|
import { CopilotError } from '@cimulate/copilot-sdk';
|
|
4
5
|
import { CopilotEvent } from '@cimulate/copilot-sdk';
|
|
@@ -7,29 +8,55 @@ import { CopilotSearchSuggestion } from '@cimulate/copilot-sdk';
|
|
|
7
8
|
import { DialogPosition } from './models';
|
|
8
9
|
import { DisplayProducts } from '@cimulate/copilot-sdk';
|
|
9
10
|
import { FacetedNavigationSuggestion } from '@cimulate/copilot-sdk';
|
|
10
|
-
import { FacetFilters } from './models';
|
|
11
11
|
import { FollowUp } from '@cimulate/copilot-sdk';
|
|
12
12
|
import { Inquiry } from '@cimulate/copilot-sdk';
|
|
13
13
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
14
14
|
import { PartialInquiry } from '@cimulate/copilot-sdk';
|
|
15
|
+
import { ProductView } from '@cimulate/copilot-sdk';
|
|
16
|
+
import { ProductViewAck } from '@cimulate/copilot-sdk';
|
|
15
17
|
import { ProductViewSuggestion } from '@cimulate/copilot-sdk';
|
|
16
18
|
import { Progress } from '@cimulate/copilot-sdk';
|
|
17
19
|
import { ReactNode } from 'react';
|
|
18
20
|
import { RefinedSearch } from '@cimulate/copilot-sdk';
|
|
19
21
|
import { SearchParams } from '@cimulate/copilot-sdk';
|
|
20
|
-
import { SearchPayload as SearchPayload_2 } from './models';
|
|
21
22
|
import { SocketSdkContextType } from './SocketSdkContext';
|
|
22
23
|
|
|
23
24
|
declare type AllCopilotEvents = {
|
|
24
25
|
isUserAction?: boolean;
|
|
25
|
-
|
|
26
|
+
isInitial?: boolean;
|
|
26
27
|
message: string;
|
|
27
28
|
request?: CopilotSearch;
|
|
28
29
|
searchParams?: SearchParams;
|
|
29
30
|
suggestions?: Suggestion[];
|
|
31
|
+
eventSourceId?: string;
|
|
30
32
|
toolName?: string;
|
|
31
33
|
thought?: string;
|
|
32
|
-
} & (CopilotEvent | Inquiry | DisplayProducts | FollowUp | PartialInquiry | RefinedSearch | Progress | CopilotError);
|
|
34
|
+
} & (CopilotEvent | Inquiry | DisplayProducts | FollowUp | PartialInquiry | RefinedSearch | CopilotBrowseAck | Progress | ProductViewAck | CopilotError);
|
|
35
|
+
|
|
36
|
+
declare namespace browse {
|
|
37
|
+
export {
|
|
38
|
+
setBrowseContext,
|
|
39
|
+
updateBrowseCategoryId,
|
|
40
|
+
updateFacetFilters_2 as updateFacetFilters,
|
|
41
|
+
updateFacetFilter_2 as updateFacetFilter,
|
|
42
|
+
updateRangeFilters_2 as updateRangeFilters,
|
|
43
|
+
updateRangeFilter_2 as updateRangeFilter,
|
|
44
|
+
updateCatalogSegment_2 as updateCatalogSegment,
|
|
45
|
+
updatePricebooks_2 as updatePricebooks
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare interface BrowsePayload {
|
|
50
|
+
userPrompt?: string;
|
|
51
|
+
browseParams: Omit<BrowseState, "page" | "pageSize" | "includeFacets"> & {
|
|
52
|
+
catalogSegment?: string;
|
|
53
|
+
pricebooks?: string[];
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare interface BrowseState extends CommonParams {
|
|
58
|
+
categoryId: string;
|
|
59
|
+
}
|
|
33
60
|
|
|
34
61
|
declare type CimCopilotSdkConfig = {
|
|
35
62
|
apiKey?: string;
|
|
@@ -37,6 +64,16 @@ declare type CimCopilotSdkConfig = {
|
|
|
37
64
|
baseUrl?: string;
|
|
38
65
|
};
|
|
39
66
|
|
|
67
|
+
declare interface CommonParams {
|
|
68
|
+
page?: number | null;
|
|
69
|
+
pageSize?: number | null;
|
|
70
|
+
includeFacets?: boolean;
|
|
71
|
+
facetFilters?: FacetFilters;
|
|
72
|
+
rangeFilters?: RangeFilters;
|
|
73
|
+
catalogSegment?: string | null;
|
|
74
|
+
pricebooks?: string[] | null;
|
|
75
|
+
}
|
|
76
|
+
|
|
40
77
|
export declare type ComponentType = "chat" | "dialog" | "modal";
|
|
41
78
|
|
|
42
79
|
/**
|
|
@@ -80,21 +117,12 @@ export declare interface CopilotWidgetProps extends CimCopilotSdkConfig {
|
|
|
80
117
|
}
|
|
81
118
|
|
|
82
119
|
export declare const eventHandlers: {
|
|
83
|
-
search:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
field: string;
|
|
90
|
-
value: [number, number];
|
|
91
|
-
}) => void;
|
|
92
|
-
updateRangeFilters: (rangeFilters: {
|
|
93
|
-
field: string;
|
|
94
|
-
min: number;
|
|
95
|
-
max: number;
|
|
96
|
-
}[]) => void;
|
|
97
|
-
updateCatalogSegment: (segment: string | null) => void;
|
|
120
|
+
search: typeof search;
|
|
121
|
+
browse: typeof browse;
|
|
122
|
+
pdp: {
|
|
123
|
+
setPdpContext: (context: ProductView) => void;
|
|
124
|
+
updatePdpProductId: (pid: string) => void;
|
|
125
|
+
updatePdpLink: (link: string) => void;
|
|
98
126
|
};
|
|
99
127
|
components: {
|
|
100
128
|
toggleWidgetOpen: (isOpen?: boolean) => void;
|
|
@@ -104,7 +132,7 @@ export declare const eventHandlers: {
|
|
|
104
132
|
};
|
|
105
133
|
};
|
|
106
134
|
|
|
107
|
-
declare type
|
|
135
|
+
declare type FacetFilters = Record<string, string[]>;
|
|
108
136
|
|
|
109
137
|
export declare const injectCopilotWidget: ({ timeout, elementId, ...props }: CopilotWidgetProps & {
|
|
110
138
|
timeout?: number;
|
|
@@ -117,6 +145,19 @@ declare type RangeFilters = Array<{
|
|
|
117
145
|
max: number;
|
|
118
146
|
}>;
|
|
119
147
|
|
|
148
|
+
declare namespace search {
|
|
149
|
+
export {
|
|
150
|
+
setSearchContext,
|
|
151
|
+
updateSearchQuery,
|
|
152
|
+
updateFacetFilters,
|
|
153
|
+
updateFacetFilter,
|
|
154
|
+
updateRangeFilters,
|
|
155
|
+
updateRangeFilter,
|
|
156
|
+
updateCatalogSegment,
|
|
157
|
+
updatePricebooks
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
120
161
|
export declare interface SearchPayload {
|
|
121
162
|
userPrompt?: string;
|
|
122
163
|
searchParams: Omit<SearchState, "page" | "pageSize" | "includeFacets"> & {
|
|
@@ -125,17 +166,22 @@ export declare interface SearchPayload {
|
|
|
125
166
|
};
|
|
126
167
|
}
|
|
127
168
|
|
|
128
|
-
declare interface SearchState {
|
|
169
|
+
declare interface SearchState extends CommonParams {
|
|
129
170
|
query: string;
|
|
130
|
-
page?: number | null;
|
|
131
|
-
pageSize?: number | null;
|
|
132
|
-
includeFacets?: boolean;
|
|
133
|
-
facetFilters?: FacetFilters_2;
|
|
134
|
-
rangeFilters?: RangeFilters;
|
|
135
|
-
catalogSegment?: string | null;
|
|
136
|
-
pricebooks?: string[] | null;
|
|
137
171
|
}
|
|
138
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Performs a bulk update of user's browse context. This will override
|
|
175
|
+
* all existing browse parameters.
|
|
176
|
+
*/
|
|
177
|
+
declare const setBrowseContext: (context: BrowsePayload["browseParams"]) => void;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Performs a bulk update of user's search context. This will override
|
|
181
|
+
* all existing search parameters.
|
|
182
|
+
*/
|
|
183
|
+
declare const setSearchContext: (context: SearchPayload["searchParams"]) => void;
|
|
184
|
+
|
|
139
185
|
declare type Suggestion = CopilotSearchSuggestion | FacetedNavigationSuggestion | ProductViewSuggestion | CopilotBrowseSuggestion;
|
|
140
186
|
|
|
141
187
|
declare interface ThemeConfig {
|
|
@@ -147,6 +193,48 @@ declare interface ThemeConfig {
|
|
|
147
193
|
borderColor?: string;
|
|
148
194
|
}
|
|
149
195
|
|
|
196
|
+
declare const updateBrowseCategoryId: (categoryId: string) => void;
|
|
197
|
+
|
|
198
|
+
declare const updateCatalogSegment: (segment: string | null) => void;
|
|
199
|
+
|
|
200
|
+
declare const updateCatalogSegment_2: (segment: string | null) => void;
|
|
201
|
+
|
|
202
|
+
declare const updateFacetFilter: (field: string, value: string) => void;
|
|
203
|
+
|
|
204
|
+
declare const updateFacetFilter_2: (field: string, value: string) => void;
|
|
205
|
+
|
|
206
|
+
declare const updateFacetFilters: (facetFilters: FacetFilters) => void;
|
|
207
|
+
|
|
208
|
+
declare const updateFacetFilters_2: (facetFilters: FacetFilters) => void;
|
|
209
|
+
|
|
210
|
+
declare const updatePricebooks: (pricebooks: string[] | null) => void;
|
|
211
|
+
|
|
212
|
+
declare const updatePricebooks_2: (pricebooks: string[] | null) => void;
|
|
213
|
+
|
|
214
|
+
declare const updateRangeFilter: ({ field, value }: {
|
|
215
|
+
field: string;
|
|
216
|
+
value: [number, number];
|
|
217
|
+
}) => void;
|
|
218
|
+
|
|
219
|
+
declare const updateRangeFilter_2: ({ field, value }: {
|
|
220
|
+
field: string;
|
|
221
|
+
value: [number, number];
|
|
222
|
+
}) => void;
|
|
223
|
+
|
|
224
|
+
declare const updateRangeFilters: (rangeFilters: {
|
|
225
|
+
field: string;
|
|
226
|
+
min: number;
|
|
227
|
+
max: number;
|
|
228
|
+
}[]) => void;
|
|
229
|
+
|
|
230
|
+
declare const updateRangeFilters_2: (rangeFilters: {
|
|
231
|
+
field: string;
|
|
232
|
+
min: number;
|
|
233
|
+
max: number;
|
|
234
|
+
}[]) => void;
|
|
235
|
+
|
|
236
|
+
declare const updateSearchQuery: (query: string) => void;
|
|
237
|
+
|
|
150
238
|
export declare const useCopilot: () => SocketSdkContextType;
|
|
151
239
|
|
|
152
240
|
/**
|