@constructor-io/constructorio-node 4.2.1 → 4.3.1
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/package.json +12 -4
- package/src/.DS_Store +0 -0
- package/src/constructorio.js +2 -1
- package/src/modules/autocomplete.js +1 -2
- package/src/modules/browse.js +5 -6
- package/src/modules/catalog.js +62 -64
- package/src/modules/quizzes.js +7 -7
- package/src/modules/recommendations.js +2 -3
- package/src/modules/search.js +1 -2
- package/src/modules/tasks.js +2 -3
- package/src/modules/tracker.js +49 -13
- package/src/types/autocomplete.d.ts +56 -0
- package/src/types/browse.d.ts +140 -0
- package/src/types/catalog.d.ts +535 -0
- package/src/types/constructorio.d.ts +34 -0
- package/src/types/index.d.ts +277 -0
- package/src/types/quizzes.d.ts +73 -0
- package/src/types/recommendations.d.ts +64 -0
- package/src/types/search.d.ts +98 -0
- package/src/types/tasks.d.ts +70 -0
- package/src/types/tests/autocomplete.test-d.ts +59 -0
- package/src/types/tests/browse.test-d.ts +120 -0
- package/src/types/tests/catalog.test-d.ts +109 -0
- package/src/types/tests/quizzes.test-d.ts +82 -0
- package/src/types/tests/recommedations.test-d.ts +45 -0
- package/src/types/tests/search.test-d.ts +124 -0
- package/src/types/tests/tasks.test-d.ts +40 -0
- package/src/types/tracker.d.ts +203 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
export * from './autocomplete';
|
|
2
|
+
export * from './browse';
|
|
3
|
+
export * from './catalog';
|
|
4
|
+
export * from './quizzes';
|
|
5
|
+
export * from './recommendations';
|
|
6
|
+
export * from './search';
|
|
7
|
+
export * from './tasks';
|
|
8
|
+
export * from './tracker';
|
|
9
|
+
|
|
10
|
+
export interface NetworkParameters extends Record<string, any> {
|
|
11
|
+
timeout?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface ConstructorClientOptions {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
apiToken?: string;
|
|
17
|
+
securityToken?: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
serviceUrl?: string;
|
|
20
|
+
fetch?: () => any;
|
|
21
|
+
networkParameters?: NetworkParameters;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface UserParameters {
|
|
25
|
+
sessionId?: Number;
|
|
26
|
+
clientId?: Number;
|
|
27
|
+
userId?: string;
|
|
28
|
+
segments?: string;
|
|
29
|
+
testCells?: Record<string, any>;
|
|
30
|
+
userIp?: string;
|
|
31
|
+
userAgent?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface FmtOptions extends Record<string, any> {
|
|
35
|
+
show_hidden_facets: boolean;
|
|
36
|
+
show_protected_facets: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface RequestFeature extends Record<string, any> {
|
|
40
|
+
query_items: boolean;
|
|
41
|
+
auto_generated_refined_query_rules: boolean;
|
|
42
|
+
manual_searchandizing: boolean;
|
|
43
|
+
personalization: boolean;
|
|
44
|
+
filter_items: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface RequestFeatureVariant extends Record<string, any> {
|
|
48
|
+
query_items: string;
|
|
49
|
+
auto_generated_refined_query_rules: string;
|
|
50
|
+
manual_searchandizing: string | null;
|
|
51
|
+
personalization: string;
|
|
52
|
+
filter_items: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export type ErrorData = {
|
|
56
|
+
message: string;
|
|
57
|
+
[key: string]: any;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export interface ResultSources extends Record<string, any> {
|
|
61
|
+
token_match: { count: number; [key: string]: any };
|
|
62
|
+
embeddings_match: { count: number; [key: string]: any };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface SortOption extends Record<string, any> {
|
|
66
|
+
sort_by: string;
|
|
67
|
+
display_name: string;
|
|
68
|
+
sort_order: string;
|
|
69
|
+
status: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface Feature extends Record<string, any> {
|
|
73
|
+
feature_name: string;
|
|
74
|
+
display_name: string;
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
variant: {
|
|
77
|
+
name: string;
|
|
78
|
+
display_name: string;
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface FmtOption extends Record<string, any> {
|
|
84
|
+
groups_start: string;
|
|
85
|
+
groups_max_depth: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export type Facet = RangeFacet | OptionFacet;
|
|
89
|
+
|
|
90
|
+
export interface BaseFacet extends Record<string, any> {
|
|
91
|
+
data: Record<string, any>;
|
|
92
|
+
status: Record<string, any>;
|
|
93
|
+
display_name: string;
|
|
94
|
+
name: string;
|
|
95
|
+
hidden: boolean;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface RangeFacet extends BaseFacet, Record<string, any> {
|
|
99
|
+
max: number;
|
|
100
|
+
min: number;
|
|
101
|
+
type: 'range';
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface OptionFacet extends BaseFacet, Record<string, any> {
|
|
105
|
+
options: FacetOption[];
|
|
106
|
+
type: 'multiple' | 'single' | 'hierarchical';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface FacetOption extends Record<string, any> {
|
|
110
|
+
count: number;
|
|
111
|
+
display_name: string;
|
|
112
|
+
value: string;
|
|
113
|
+
options?: FacetOption[];
|
|
114
|
+
range?: ['-inf' | number, 'inf' | number];
|
|
115
|
+
status: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface Group extends BaseGroup, Record<string, any> {
|
|
119
|
+
count: number;
|
|
120
|
+
data: Record<string, any>;
|
|
121
|
+
parents: BaseGroup[];
|
|
122
|
+
children: Group[];
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface Collection extends Record<string, any> {
|
|
126
|
+
collection_id: string;
|
|
127
|
+
display_name: string;
|
|
128
|
+
data: Record<string, any>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface BaseGroup extends Record<string, any> {
|
|
132
|
+
display_name: string;
|
|
133
|
+
group_id: string;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type Nullable<T> = T | null;
|
|
137
|
+
|
|
138
|
+
export interface Item extends Record<string, any> {
|
|
139
|
+
id: string;
|
|
140
|
+
name?: string;
|
|
141
|
+
suggested_score?: number;
|
|
142
|
+
data?: ItemData;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface Variation extends Record<string, any> {
|
|
146
|
+
id: string;
|
|
147
|
+
item_id: string;
|
|
148
|
+
name?: string;
|
|
149
|
+
suggested_score?: number;
|
|
150
|
+
data?: ItemData;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface ItemData extends Record<string, any> {
|
|
154
|
+
keywords?: string[];
|
|
155
|
+
url?: string;
|
|
156
|
+
image_url?: string;
|
|
157
|
+
facets?: Record<string, any>;
|
|
158
|
+
group_ids?: string[];
|
|
159
|
+
description?: string;
|
|
160
|
+
active?: boolean;
|
|
161
|
+
deactivated?: boolean;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface ItemGroup extends Record<string, any> {
|
|
165
|
+
id: string;
|
|
166
|
+
name?: string;
|
|
167
|
+
data?: Nullable<Record<string, any>>;
|
|
168
|
+
children?: ItemGroup[];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface RedirectRuleMatchObject {
|
|
172
|
+
match_type: string;
|
|
173
|
+
pattern: string;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface RedirectRuleResponse extends Record<string, any> {
|
|
177
|
+
id: number;
|
|
178
|
+
end_time?: Nullable<string>;
|
|
179
|
+
last_updated?: Nullable<string>;
|
|
180
|
+
start_time?: Nullable<string>;
|
|
181
|
+
metadata?: Nullable<Record<string, any>>;
|
|
182
|
+
url?: string;
|
|
183
|
+
user_segments?: Nullable<string[]>;
|
|
184
|
+
matches: {
|
|
185
|
+
id: number;
|
|
186
|
+
match_type: 'EXACT' | 'UNORDERED' | 'PHRASE';
|
|
187
|
+
pattern: string;
|
|
188
|
+
[key: string]: any;
|
|
189
|
+
}[];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* 4 types of facets
|
|
193
|
+
- MultipleFacetConfiguration
|
|
194
|
+
- RangeSlidersFacetConfiguration
|
|
195
|
+
- RangeOptionsStaticFacetConfiguration
|
|
196
|
+
- RangeOptionsDynamicFacetConfiguration
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
export interface MultipleFacetConfiguration extends BaseFacetConfiguration {
|
|
200
|
+
type: 'multiple';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface RangeSlidersFacetConfiguration
|
|
204
|
+
extends RangeFacetConfiguration {
|
|
205
|
+
range_format: 'boundaries';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface RangeOptionsStaticFacetConfiguration
|
|
209
|
+
extends RangeOptionsFacetConfiguration {
|
|
210
|
+
range_type: 'static';
|
|
211
|
+
bucket_size?: number;
|
|
212
|
+
range_limits?: number[];
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface RangeOptionsDynamicFacetConfiguration
|
|
216
|
+
extends RangeOptionsFacetConfiguration {
|
|
217
|
+
range_type: 'dynamic';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface RangeOptionsFacetConfiguration
|
|
221
|
+
extends RangeFacetConfiguration {
|
|
222
|
+
range_format: 'options';
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface RangeFacetConfiguration extends BaseFacetConfiguration {
|
|
226
|
+
type: 'range';
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface BaseFacetConfiguration {
|
|
230
|
+
name: string;
|
|
231
|
+
display_name?: string;
|
|
232
|
+
sort_order?: 'relevance' | 'value' | 'num_matches';
|
|
233
|
+
sort_descending?: boolean;
|
|
234
|
+
range_inclusive?: Nullable<string>;
|
|
235
|
+
match_type?: 'any' | 'all' | 'none';
|
|
236
|
+
position?: Nullable<number>;
|
|
237
|
+
hidden?: boolean;
|
|
238
|
+
protected?: boolean;
|
|
239
|
+
data?: object;
|
|
240
|
+
section?: string;
|
|
241
|
+
options?: Record<string, any>[];
|
|
242
|
+
range_format: 'options' | 'boundaries' | null;
|
|
243
|
+
range_type: 'static' | 'dynamic' | null;
|
|
244
|
+
bucket_size?: number | null;
|
|
245
|
+
range_limits?: number[] | null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export type FacetConfiguration =
|
|
249
|
+
| MultipleFacetConfiguration
|
|
250
|
+
| RangeSlidersFacetConfiguration
|
|
251
|
+
| RangeOptionsStaticFacetConfiguration
|
|
252
|
+
| RangeOptionsDynamicFacetConfiguration;
|
|
253
|
+
|
|
254
|
+
export interface FacetOptionConfiguration {
|
|
255
|
+
value: string;
|
|
256
|
+
value_alias?: Nullable<string>;
|
|
257
|
+
display_name?: string;
|
|
258
|
+
position?: Nullable<number>;
|
|
259
|
+
hidden?: boolean;
|
|
260
|
+
data?: Nullable<Record<string, any>>;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface OneWaySynonymRelation extends Record<string, any> {
|
|
264
|
+
parent_phrase: string;
|
|
265
|
+
child_phrases: {
|
|
266
|
+
automatically_generated: boolean;
|
|
267
|
+
phrase: string;
|
|
268
|
+
created_at: string;
|
|
269
|
+
updated_at: string;
|
|
270
|
+
[key: string]: any;
|
|
271
|
+
}[];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface SynonymGroup extends Record<string, any> {
|
|
275
|
+
synonym_group_id: number;
|
|
276
|
+
synonyms: string[];
|
|
277
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { ConstructorClientOptions, NetworkParameters, UserParameters } from '.';
|
|
2
|
+
|
|
3
|
+
export default Quizzes;
|
|
4
|
+
|
|
5
|
+
export interface QuizzesParameters {
|
|
6
|
+
section?: string;
|
|
7
|
+
answers?: any[];
|
|
8
|
+
versionId?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class Quizzes {
|
|
12
|
+
constructor(options: ConstructorClientOptions);
|
|
13
|
+
|
|
14
|
+
options: ConstructorClientOptions;
|
|
15
|
+
|
|
16
|
+
getQuizNextQuestion(
|
|
17
|
+
id: string,
|
|
18
|
+
parameters?: QuizzesParameters,
|
|
19
|
+
userParameters?: UserParameters,
|
|
20
|
+
networkParameters?: NetworkParameters
|
|
21
|
+
): Promise<NextQuestionResponse>;
|
|
22
|
+
|
|
23
|
+
getQuizResults(
|
|
24
|
+
id: string,
|
|
25
|
+
parameters?: QuizzesParameters,
|
|
26
|
+
userParameters?: UserParameters,
|
|
27
|
+
networkParameters?: NetworkParameters
|
|
28
|
+
): Promise<QuizResultsResponse>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* quizzes results returned from server */
|
|
32
|
+
export interface NextQuestionResponse extends Record<string, any> {
|
|
33
|
+
next_question: Partial<NextQuestion>;
|
|
34
|
+
is_last_question?: boolean;
|
|
35
|
+
version_id?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface QuizResultsResponse extends Record<string, any> {
|
|
38
|
+
result: Partial<QuizResult>;
|
|
39
|
+
version_id?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface NextQuestion extends Record<string, any> {
|
|
43
|
+
id: number;
|
|
44
|
+
title: string;
|
|
45
|
+
description: string;
|
|
46
|
+
type: 'single' | 'multiple' | 'open' | 'cover';
|
|
47
|
+
cta_text: string;
|
|
48
|
+
images: Partial<QuestionImages>;
|
|
49
|
+
options: Partial<QuestionOption>[];
|
|
50
|
+
input_placeholder: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface QuizResult extends Record<string, any> {
|
|
54
|
+
filter_expression: Record<string, any>;
|
|
55
|
+
results_url: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface QuestionOption extends Record<string, any> {
|
|
59
|
+
id: number;
|
|
60
|
+
value: string;
|
|
61
|
+
attribute: {
|
|
62
|
+
name: string;
|
|
63
|
+
value: string;
|
|
64
|
+
};
|
|
65
|
+
images: Partial<QuestionImages>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface QuestionImages extends Record<string, any> {
|
|
69
|
+
primary_url: string;
|
|
70
|
+
primary_alt: string;
|
|
71
|
+
secondary_url: string;
|
|
72
|
+
secondary_alt: string;
|
|
73
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ConstructorClientOptions, NetworkParameters, UserParameters } from '.';
|
|
2
|
+
|
|
3
|
+
export default Recommendations;
|
|
4
|
+
|
|
5
|
+
interface RecommendationsParameters {
|
|
6
|
+
itemIds?: string | string[];
|
|
7
|
+
numResults?: number;
|
|
8
|
+
section?: string;
|
|
9
|
+
term?: string;
|
|
10
|
+
filters?: Record<string, any>;
|
|
11
|
+
variationsMap?: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare class Recommendations {
|
|
15
|
+
constructor(options: ConstructorClientOptions);
|
|
16
|
+
|
|
17
|
+
options: ConstructorClientOptions;
|
|
18
|
+
|
|
19
|
+
getRecommendations(
|
|
20
|
+
podId: string,
|
|
21
|
+
parameters?: RecommendationsParameters,
|
|
22
|
+
userParameters?: UserParameters,
|
|
23
|
+
networkParameters?: NetworkParameters
|
|
24
|
+
): Promise<RecommendationsResponse>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Recommendations results returned from server */
|
|
28
|
+
export interface RecommendationsResponse extends Record<string, any> {
|
|
29
|
+
request: Partial<RecommendationsRequestType>;
|
|
30
|
+
response: Partial<RecommendationsResponseType>;
|
|
31
|
+
result_id: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface RecommendationsRequestType extends Record<string, any> {
|
|
35
|
+
num_results: number;
|
|
36
|
+
item_id: string;
|
|
37
|
+
filters: {
|
|
38
|
+
group_id: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
};
|
|
41
|
+
pod_id: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RecommendationsResponseType extends Record<string, any> {
|
|
45
|
+
results: Partial<RecommendationsResultType>;
|
|
46
|
+
total_num_results: number;
|
|
47
|
+
pod: {
|
|
48
|
+
id: string;
|
|
49
|
+
display_name: string;
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface RecommendationsResultType extends Record<string, any> {
|
|
55
|
+
matched_terms: string[];
|
|
56
|
+
data: Record<string, any>;
|
|
57
|
+
value: string;
|
|
58
|
+
is_slotted: boolean;
|
|
59
|
+
labels: Record<string, any>;
|
|
60
|
+
strategy: {
|
|
61
|
+
id: string;
|
|
62
|
+
[key: string]: any;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConstructorClientOptions,
|
|
3
|
+
Facet,
|
|
4
|
+
Feature,
|
|
5
|
+
FmtOption,
|
|
6
|
+
Group,
|
|
7
|
+
NetworkParameters,
|
|
8
|
+
RequestFeature,
|
|
9
|
+
RequestFeatureVariant,
|
|
10
|
+
ResultSources,
|
|
11
|
+
SortOption,
|
|
12
|
+
UserParameters,
|
|
13
|
+
} from '.';
|
|
14
|
+
|
|
15
|
+
export default Search;
|
|
16
|
+
|
|
17
|
+
export interface SearchParameters {
|
|
18
|
+
page?: number;
|
|
19
|
+
resultsPerPage?: number;
|
|
20
|
+
filters?: Record<string, any>;
|
|
21
|
+
sortBy?: string;
|
|
22
|
+
sortOrder?: string;
|
|
23
|
+
section?: string;
|
|
24
|
+
fmtOptions?: Record<string, any>;
|
|
25
|
+
hiddenFields?: string[];
|
|
26
|
+
hiddenFacets?: string[];
|
|
27
|
+
variationsMap?: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
declare class Search {
|
|
31
|
+
constructor(options: ConstructorClientOptions);
|
|
32
|
+
|
|
33
|
+
options: ConstructorClientOptions;
|
|
34
|
+
|
|
35
|
+
getSearchResults(
|
|
36
|
+
query: string,
|
|
37
|
+
parameters?: SearchParameters,
|
|
38
|
+
userParameters?: UserParameters,
|
|
39
|
+
networkParameters?: NetworkParameters
|
|
40
|
+
): Promise<SearchResponse>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* search results returned from server */
|
|
44
|
+
export interface SearchResponse {
|
|
45
|
+
request: Partial<SearchRequestType>;
|
|
46
|
+
response: Partial<Response | Redirect>;
|
|
47
|
+
result_id: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface Response extends Record<string, any> {
|
|
51
|
+
result_sources: Partial<ResultSources>;
|
|
52
|
+
facets: Partial<Facet>[];
|
|
53
|
+
groups: Partial<Group>[];
|
|
54
|
+
results: Partial<SearchResultType>[];
|
|
55
|
+
sort_options: Partial<SortOption>[];
|
|
56
|
+
refined_content: Record<string, any>[];
|
|
57
|
+
total_num_results: number;
|
|
58
|
+
features: Partial<Feature>[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface SearchRequestType extends Record<string, any> {
|
|
62
|
+
page: number;
|
|
63
|
+
num_results_per_page: number;
|
|
64
|
+
section: string;
|
|
65
|
+
blacklist_rules: boolean;
|
|
66
|
+
term: string;
|
|
67
|
+
fmt_options: Partial<FmtOption>;
|
|
68
|
+
sort_by: string;
|
|
69
|
+
sort_order: string;
|
|
70
|
+
features: Partial<RequestFeature>;
|
|
71
|
+
feature_variants: Partial<RequestFeatureVariant>;
|
|
72
|
+
searchandized_items: Record<string, any>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface SearchResultType extends Record<string, any> {
|
|
76
|
+
matched_terms: string[];
|
|
77
|
+
data: {
|
|
78
|
+
id: string;
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
};
|
|
81
|
+
value: string;
|
|
82
|
+
is_slotted: false;
|
|
83
|
+
labels: Record<string, any>;
|
|
84
|
+
variations: Record<string, any>[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface Redirect extends Record<string, any> {
|
|
88
|
+
redirect: {
|
|
89
|
+
data: {
|
|
90
|
+
match_id: number;
|
|
91
|
+
rule_id: number;
|
|
92
|
+
url: string;
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
};
|
|
95
|
+
matched_terms: string[];
|
|
96
|
+
matched_user_segments: string[];
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ConstructorClientOptions, NetworkParameters } from '.';
|
|
2
|
+
|
|
3
|
+
export default Tasks;
|
|
4
|
+
|
|
5
|
+
export interface TasksParameters {
|
|
6
|
+
numResultsPerPage?: number;
|
|
7
|
+
page?: number;
|
|
8
|
+
startDate?: string;
|
|
9
|
+
endDate?: string;
|
|
10
|
+
status?: string;
|
|
11
|
+
type?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare class Tasks {
|
|
15
|
+
constructor(options: ConstructorClientOptions);
|
|
16
|
+
|
|
17
|
+
options: ConstructorClientOptions;
|
|
18
|
+
|
|
19
|
+
getAllTasks(
|
|
20
|
+
parameters?: TasksParameters,
|
|
21
|
+
networkParameters?: NetworkParameters
|
|
22
|
+
): Promise<TasksResponseType>;
|
|
23
|
+
|
|
24
|
+
getTask(
|
|
25
|
+
parameters?: {
|
|
26
|
+
id: string;
|
|
27
|
+
},
|
|
28
|
+
networkParameters?: NetworkParameters
|
|
29
|
+
): Promise<Task>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* tasks results returned from server */
|
|
33
|
+
export interface TasksResponseType {
|
|
34
|
+
total_count: number;
|
|
35
|
+
tasks: Partial<Task>[];
|
|
36
|
+
status_counts: {
|
|
37
|
+
QUEUED: number;
|
|
38
|
+
DONE: number;
|
|
39
|
+
IN_PROGRESS: number;
|
|
40
|
+
FAILED: number;
|
|
41
|
+
CANCELED: number;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type TaskStatus = 'QUEUED' | 'DONE' | 'FAILED' | 'IN_PROGRESS';
|
|
46
|
+
|
|
47
|
+
export interface Task extends Record<string, any> {
|
|
48
|
+
id: number;
|
|
49
|
+
type: 'ingestion' | 'user_data_request';
|
|
50
|
+
status: TaskStatus;
|
|
51
|
+
submission_time: string;
|
|
52
|
+
last_update: string;
|
|
53
|
+
filename: string;
|
|
54
|
+
protocol: 'ftp' | 'http' | null;
|
|
55
|
+
result?: {
|
|
56
|
+
changelog?: Partial<ChangeLog>;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ChangeLog extends Record<string, any> {
|
|
61
|
+
sections?: {
|
|
62
|
+
[key: string]: {
|
|
63
|
+
items_updated: number;
|
|
64
|
+
items_deleted: number;
|
|
65
|
+
variations_updated: number;
|
|
66
|
+
variations_deleted: number;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
index_built: boolean;
|
|
70
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { expectAssignable } from 'tsd';
|
|
2
|
+
import { AutocompleteResponse } from '../autocomplete';
|
|
3
|
+
|
|
4
|
+
expectAssignable<AutocompleteResponse>({
|
|
5
|
+
sections: {
|
|
6
|
+
Products: [
|
|
7
|
+
{
|
|
8
|
+
matched_terms: ['red'],
|
|
9
|
+
data: {
|
|
10
|
+
id: 'ABC',
|
|
11
|
+
url: 'https://example',
|
|
12
|
+
},
|
|
13
|
+
value: 'ABC',
|
|
14
|
+
is_slotted: false,
|
|
15
|
+
labels: {},
|
|
16
|
+
variations: [
|
|
17
|
+
{
|
|
18
|
+
data: {
|
|
19
|
+
url: 'https://example',
|
|
20
|
+
name: 'Orange, One Size / Fitment 6',
|
|
21
|
+
},
|
|
22
|
+
value: 'ABC',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
'Search Suggestions': [
|
|
28
|
+
{
|
|
29
|
+
matched_terms: ['red'],
|
|
30
|
+
data: {
|
|
31
|
+
id: 'ABC',
|
|
32
|
+
},
|
|
33
|
+
value: 'ABC',
|
|
34
|
+
is_slotted: false,
|
|
35
|
+
labels: {},
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
result_id: '5a7e6a84-5ded-4315-83b5-71f08c175a4a',
|
|
40
|
+
request: {
|
|
41
|
+
query: 'red',
|
|
42
|
+
term: 'red',
|
|
43
|
+
features: {
|
|
44
|
+
query_items: true,
|
|
45
|
+
auto_generated_refined_query_rules: true,
|
|
46
|
+
manual_searchandizing: true,
|
|
47
|
+
personalization: true,
|
|
48
|
+
filter_items: true,
|
|
49
|
+
},
|
|
50
|
+
feature_variants: {
|
|
51
|
+
query_items: 'query_items',
|
|
52
|
+
auto_generated_refined_query_rules: 'default_rules',
|
|
53
|
+
manual_searchandizing: null,
|
|
54
|
+
personalization: 'default_personalization',
|
|
55
|
+
filter_items: 'filter_items_w_and_purchases',
|
|
56
|
+
},
|
|
57
|
+
searchandized_items: {},
|
|
58
|
+
},
|
|
59
|
+
});
|