@constructor-io/constructorio-node 4.5.6 → 4.6.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 +2 -2
- package/src/modules/quizzes.js +28 -21
- package/src/types/catalog.d.ts +275 -231
- package/src/types/index.d.ts +1 -1
- package/src/types/quizzes.d.ts +96 -23
- package/src/types/tests/quizzes.test-d.ts +205 -13
- package/src/types/tracker.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructor-io/constructorio-node",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"description": "Constructor.io Node.js client",
|
|
5
5
|
"main": "src/constructorio.js",
|
|
6
6
|
"types": "src/types/constructorio.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"verify-node-version": "chmod +x ./scripts/verify-node-version.sh && ./scripts/verify-node-version.sh",
|
|
9
9
|
"version": "npm run verify-node-version && npm run docs && git add ./docs/*",
|
|
10
|
-
"check-
|
|
10
|
+
"check-license": "license-checker --production --onlyAllow 'Apache-2.0;BSD-3-Clause;MIT;0BSD;BSD-2-Clause'",
|
|
11
11
|
"lint": "eslint 'src/**/*.js' 'spec/**/*.js' 'src/**/*.d.ts'",
|
|
12
12
|
"test:parallel": "mkdir -p test && cp -rf src/* test && mocha --parallel ./spec/*",
|
|
13
13
|
"test": "mkdir -p test && cp -rf src/* test && mocha ./spec/*",
|
package/src/modules/quizzes.js
CHANGED
|
@@ -38,21 +38,26 @@ function createQuizUrl(quizId, parameters, userParameters, options, path) {
|
|
|
38
38
|
throw new Error('quizId is a required parameter of type string');
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (path === '
|
|
41
|
+
if (path === 'results' && (typeof parameters.answers !== 'object' || !Array.isArray(parameters.answers) || parameters.answers.length === 0)) {
|
|
42
42
|
throw new Error('answers is a required parameter of type array');
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (parameters) {
|
|
46
|
-
const { section, answers,
|
|
46
|
+
const { section, answers, quizVersionId, quizSessionId } = parameters;
|
|
47
47
|
|
|
48
48
|
// Pull section from parameters
|
|
49
49
|
if (section) {
|
|
50
50
|
queryParams.section = section;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
// Pull
|
|
54
|
-
if (
|
|
55
|
-
queryParams.
|
|
53
|
+
// Pull quiz_version_id from parameters
|
|
54
|
+
if (quizVersionId) {
|
|
55
|
+
queryParams.quiz_version_id = quizVersionId;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Pull quiz_session_id from parameters
|
|
59
|
+
if (quizSessionId) {
|
|
60
|
+
queryParams.quiz_session_id = quizSessionId;
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
// Pull answers from parameters and transform
|
|
@@ -88,11 +93,12 @@ class Quizzes {
|
|
|
88
93
|
*
|
|
89
94
|
* @function getQuizNextQuestion
|
|
90
95
|
* @description Retrieve quiz question from Constructor.io API
|
|
91
|
-
* @param {string}
|
|
92
|
-
* @param {string}
|
|
96
|
+
* @param {string} quizId - The identifier of the quiz
|
|
97
|
+
* @param {string} parameters - Additional parameters to refine result set
|
|
98
|
+
* @param {array} parameters.answers - An array for answers in the format [[1,2],[1]]
|
|
93
99
|
* @param {string} [parameters.section] - Product catalog section
|
|
94
|
-
* @param {
|
|
95
|
-
* @param {string} [parameters.
|
|
100
|
+
* @param {string} [parameters.quizVersionId] - Version identifier for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found [here]{@link https://docs.constructor.io/rest_api/quiz/using_quizzes/#quiz-versioning}
|
|
101
|
+
* @param {string} [parameters.quizSessionId] - Session identifier for the quiz. Session ID will be returned with the first request and it should be passed with subsequent requests. More information can be found [here]{@link https://docs.constructor.io/rest_api/quiz/using_quizzes/#quiz-sessions}
|
|
96
102
|
* @param {object} [userParameters] - Parameters relevant to the user request
|
|
97
103
|
* @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
|
|
98
104
|
* @param {number} [userParameters.clientId] - Client ID, utilized to personalize results
|
|
@@ -108,10 +114,10 @@ class Quizzes {
|
|
|
108
114
|
* constructorio.quizzes.getQuizNextQuestion('quizId', {
|
|
109
115
|
* answers: [[1,2],[1]],
|
|
110
116
|
* section: '123',
|
|
111
|
-
*
|
|
117
|
+
* quizVersionId: '123'
|
|
112
118
|
* });
|
|
113
119
|
*/
|
|
114
|
-
getQuizNextQuestion(
|
|
120
|
+
getQuizNextQuestion(quizId, parameters, userParameters = {}, networkParameters = {}) {
|
|
115
121
|
const headers = {};
|
|
116
122
|
let requestUrl;
|
|
117
123
|
const { fetch } = this.options;
|
|
@@ -119,7 +125,7 @@ class Quizzes {
|
|
|
119
125
|
const { signal } = controller;
|
|
120
126
|
|
|
121
127
|
try {
|
|
122
|
-
requestUrl = createQuizUrl(
|
|
128
|
+
requestUrl = createQuizUrl(quizId, parameters, userParameters, this.options, 'next');
|
|
123
129
|
} catch (e) {
|
|
124
130
|
return Promise.reject(e);
|
|
125
131
|
}
|
|
@@ -151,7 +157,7 @@ class Quizzes {
|
|
|
151
157
|
return helpers.throwHttpErrorFromResponse(new Error(), response);
|
|
152
158
|
})
|
|
153
159
|
.then((json) => {
|
|
154
|
-
if (json.
|
|
160
|
+
if (json.quiz_version_id) {
|
|
155
161
|
return json;
|
|
156
162
|
}
|
|
157
163
|
|
|
@@ -164,11 +170,12 @@ class Quizzes {
|
|
|
164
170
|
*
|
|
165
171
|
* @function getQuizResults
|
|
166
172
|
* @description Retrieve quiz recommendation and filter expression from Constructor.io API
|
|
167
|
-
* @param {string}
|
|
168
|
-
* @param {string}
|
|
173
|
+
* @param {string} quizId - The identifier of the quiz
|
|
174
|
+
* @param {string} parameters - Additional parameters to refine result set
|
|
175
|
+
* @param {array} parameters.answers - An array of answers in the format [[1,2],[1]]
|
|
169
176
|
* @param {string} [parameters.section] - Product catalog section
|
|
170
|
-
* @param {
|
|
171
|
-
* @param {string} [parameters.
|
|
177
|
+
* @param {string} [parameters.quizVersionId] - Version identifier for the quiz. Version ID will be returned with the first request and it should be passed with subsequent requests. More information can be found [here]{@link https://docs.constructor.io/rest_api/quiz/using_quizzes/#quiz-versioning}
|
|
178
|
+
* @param {string} [parameters.quizSessionId] - Session identifier for the quiz. Session ID will be returned with the first request and it should be passed with subsequent requests. More information can be found [here]{@link https://docs.constructor.io/rest_api/quiz/using_quizzes/#quiz-sessions}
|
|
172
179
|
* @param {object} [userParameters] - Parameters relevant to the user request
|
|
173
180
|
* @param {number} [userParameters.sessionId] - Session ID, utilized to personalize results
|
|
174
181
|
* @param {number} [userParameters.clientId] - Client ID, utilized to personalize results
|
|
@@ -185,10 +192,10 @@ class Quizzes {
|
|
|
185
192
|
* constructorio.quizzes.getQuizResults('quizId', {
|
|
186
193
|
* answers: [[1,2],[1]],
|
|
187
194
|
* section: '123',
|
|
188
|
-
*
|
|
195
|
+
* quizVersionId: '123'
|
|
189
196
|
* });
|
|
190
197
|
*/
|
|
191
|
-
getQuizResults(
|
|
198
|
+
getQuizResults(quizId, parameters, userParameters = {}, networkParameters = {}) {
|
|
192
199
|
let requestUrl;
|
|
193
200
|
const headers = {};
|
|
194
201
|
const { fetch } = this.options;
|
|
@@ -196,7 +203,7 @@ class Quizzes {
|
|
|
196
203
|
const { signal } = controller;
|
|
197
204
|
|
|
198
205
|
try {
|
|
199
|
-
requestUrl = createQuizUrl(
|
|
206
|
+
requestUrl = createQuizUrl(quizId, parameters, userParameters, this.options, 'results');
|
|
200
207
|
} catch (e) {
|
|
201
208
|
return Promise.reject(e);
|
|
202
209
|
}
|
|
@@ -228,7 +235,7 @@ class Quizzes {
|
|
|
228
235
|
return helpers.throwHttpErrorFromResponse(new Error(), response);
|
|
229
236
|
})
|
|
230
237
|
.then((json) => {
|
|
231
|
-
if (json.
|
|
238
|
+
if (json.quiz_version_id) {
|
|
232
239
|
return json;
|
|
233
240
|
}
|
|
234
241
|
|
package/src/types/catalog.d.ts
CHANGED
|
@@ -14,90 +14,278 @@ import {
|
|
|
14
14
|
|
|
15
15
|
export default Catalog;
|
|
16
16
|
|
|
17
|
+
export interface CreateOrReplaceItemsParameters {
|
|
18
|
+
items: Item[];
|
|
19
|
+
force?: boolean;
|
|
20
|
+
notificationEmail?: string;
|
|
21
|
+
section?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface UpdateItemsParameters extends CreateOrReplaceItemsParameters {}
|
|
25
|
+
|
|
26
|
+
export interface DeleteItemsParameters {
|
|
27
|
+
items: Pick<Item, 'id'>[];
|
|
28
|
+
section?: string;
|
|
29
|
+
notificationEmail?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RetrieveItemsParameters {
|
|
33
|
+
ids?: string[];
|
|
34
|
+
section?: string;
|
|
35
|
+
numResultsPerPage?: number;
|
|
36
|
+
page?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface CreateOrReplaceVariationsParameters {
|
|
40
|
+
variations: Variation[];
|
|
41
|
+
force?: boolean;
|
|
42
|
+
notificationEmail?: string;
|
|
43
|
+
section?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface UpdateVariationsParameters
|
|
47
|
+
extends CreateOrReplaceVariationsParameters {}
|
|
48
|
+
|
|
49
|
+
export interface DeleteVariationsParameters {
|
|
50
|
+
variations: Pick<Variation, 'id'>[];
|
|
51
|
+
force?: boolean;
|
|
52
|
+
notificationEmail?: string;
|
|
53
|
+
section?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface RetrieveVariationsParameters {
|
|
57
|
+
section?: string;
|
|
58
|
+
ids?: string[];
|
|
59
|
+
itemId?: string;
|
|
60
|
+
numResultsPerPage?: number;
|
|
61
|
+
page?: number;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface AddItemGroupParameters {
|
|
65
|
+
id: string;
|
|
66
|
+
name: string;
|
|
67
|
+
parent_id?: string;
|
|
68
|
+
data?: Record<string, any>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface AddItemGroupsParameters {
|
|
72
|
+
item_groups: ItemGroup[];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface GetItemGroupParameters {
|
|
76
|
+
id: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface AddOrUpdateItemGroupsParameters
|
|
80
|
+
extends AddItemGroupsParameters {}
|
|
81
|
+
|
|
82
|
+
export interface AddOneWaySynonymParameters {
|
|
83
|
+
phrase: string;
|
|
84
|
+
child_phrases: string[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface ModifyOneWaySynonymParameters
|
|
88
|
+
extends AddOneWaySynonymParameters {}
|
|
89
|
+
|
|
90
|
+
export interface GetOneWaySynonymParameters {
|
|
91
|
+
phrase: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface GetOneWaySynonymsParameters {
|
|
95
|
+
num_results_per_page?: number;
|
|
96
|
+
page?: number;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface RemoveOneWaySynonymParameters {
|
|
100
|
+
phrase: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface AddSynonymGroupParameters {
|
|
104
|
+
synonyms: string[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface ModifySynonymGroupParameters {
|
|
108
|
+
id: number;
|
|
109
|
+
synonyms: string[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface GetSynonymGroupParameters {
|
|
113
|
+
id: number;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface GetSynonymGroupsParameters {
|
|
117
|
+
phrase?: string;
|
|
118
|
+
num_results_per_page?: number;
|
|
119
|
+
page?: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface RemoveSynonymGroupParameters {
|
|
123
|
+
id: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface AddRedirectRuleParameters {
|
|
127
|
+
url: string;
|
|
128
|
+
matches: RedirectRuleMatchObject[];
|
|
129
|
+
start_time?: string;
|
|
130
|
+
end_time?: string;
|
|
131
|
+
user_segments?: string[];
|
|
132
|
+
metadata?: Record<string, any>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface UpdateRedirectRuleParameters
|
|
136
|
+
extends AddRedirectRuleParameters {
|
|
137
|
+
id: string;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface ModifyRedirectRuleParameters
|
|
141
|
+
extends AddRedirectRuleParameters {
|
|
142
|
+
id: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface GetRedirectRuleParameters {
|
|
146
|
+
id: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface GetRedirectRulesParameters {
|
|
150
|
+
num_results_per_page?: number;
|
|
151
|
+
page?: number;
|
|
152
|
+
query?: string;
|
|
153
|
+
status?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface RemoveRedirectRuleParameters {
|
|
157
|
+
id: string;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ReplaceCatalogParameters {
|
|
161
|
+
section: string;
|
|
162
|
+
notification_email?: string;
|
|
163
|
+
force?: boolean;
|
|
164
|
+
items?: File;
|
|
165
|
+
variations?: File;
|
|
166
|
+
item_groups?: File;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface UpdateCatalogParameters extends ReplaceCatalogParameters {}
|
|
170
|
+
|
|
171
|
+
export interface PatchCatalogParameters {
|
|
172
|
+
section: string;
|
|
173
|
+
notification_email?: string;
|
|
174
|
+
force?: boolean;
|
|
175
|
+
onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
|
|
176
|
+
items?: File;
|
|
177
|
+
variations?: File;
|
|
178
|
+
item_groups?: File;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface ReplaceCatalogUsingTarArchiveParameters {
|
|
182
|
+
section: string;
|
|
183
|
+
notification_email?: string;
|
|
184
|
+
force?: boolean;
|
|
185
|
+
tarArchive?: File;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface UpdateCatalogUsingTarArchiveParameters
|
|
189
|
+
extends ReplaceCatalogUsingTarArchiveParameters {}
|
|
190
|
+
|
|
191
|
+
export interface PatchCatalogUsingTarArchiveParameters
|
|
192
|
+
extends ReplaceCatalogUsingTarArchiveParameters {}
|
|
193
|
+
|
|
194
|
+
export interface GetFacetConfigurationsParameters {
|
|
195
|
+
page?: number;
|
|
196
|
+
num_results_per_page?: number;
|
|
197
|
+
section?: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface GetFacetConfigurationParameters {
|
|
201
|
+
name?: string;
|
|
202
|
+
section?: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface ModifyFacetConfigurationsParameters {
|
|
206
|
+
facetConfigurations: FacetConfiguration[];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export interface RemoveFacetConfigurationParameters {
|
|
210
|
+
name: string;
|
|
211
|
+
section?: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export type AddFacetOptionConfigurationParameters = FacetOptionConfiguration & {
|
|
215
|
+
facetGroupName: string;
|
|
216
|
+
section?: string;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export interface AddOrModifyFacetOptionConfigurationsParameters {
|
|
220
|
+
facetGroupName: string;
|
|
221
|
+
facetOptionConfigurations: FacetOptionConfiguration[];
|
|
222
|
+
section?: string;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface GetFacetOptionConfigurationsParameters {
|
|
226
|
+
facetGroupName: string;
|
|
227
|
+
page?: number;
|
|
228
|
+
num_results_per_page?: number;
|
|
229
|
+
section?: string;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface GetFacetOptionConfigurationParameters {
|
|
233
|
+
facetGroupName: string;
|
|
234
|
+
value: string;
|
|
235
|
+
section?: string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export type ReplaceFacetOptionConfigurationParameters = {
|
|
239
|
+
facetGroupName: string;
|
|
240
|
+
section?: string;
|
|
241
|
+
} & FacetOptionConfiguration;
|
|
242
|
+
|
|
243
|
+
export type ModifyFacetOptionConfigurationParameters = ReplaceFacetOptionConfigurationParameters
|
|
244
|
+
|
|
245
|
+
export interface RemoveFacetOptionConfiguration extends GetFacetOptionConfigurationParameters {}
|
|
246
|
+
|
|
17
247
|
declare class Catalog {
|
|
18
248
|
constructor(options: ConstructorClientOptions);
|
|
19
249
|
|
|
20
250
|
options: ConstructorClientOptions;
|
|
21
251
|
|
|
22
252
|
createOrReplaceItems(
|
|
23
|
-
parameters:
|
|
24
|
-
items: Item[];
|
|
25
|
-
force?: boolean;
|
|
26
|
-
notificationEmail?: string;
|
|
27
|
-
section?: string;
|
|
28
|
-
},
|
|
253
|
+
parameters: CreateOrReplaceItemsParameters,
|
|
29
254
|
networkParameters?: NetworkParameters
|
|
30
255
|
): Promise<void>;
|
|
31
256
|
|
|
32
257
|
updateItems(
|
|
33
|
-
parameters:
|
|
34
|
-
items: Item[];
|
|
35
|
-
force?: boolean;
|
|
36
|
-
notificationEmail?: string;
|
|
37
|
-
section?: string;
|
|
38
|
-
onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
|
|
39
|
-
},
|
|
258
|
+
parameters: UpdateItemsParameters,
|
|
40
259
|
networkParameters?: NetworkParameters
|
|
41
260
|
): Promise<void>;
|
|
42
261
|
|
|
43
262
|
deleteItems(
|
|
44
|
-
parameters:
|
|
45
|
-
items: Pick<Item, 'id'>[];
|
|
46
|
-
section?: string;
|
|
47
|
-
notificationEmail?: string;
|
|
48
|
-
},
|
|
263
|
+
parameters: DeleteItemsParameters,
|
|
49
264
|
networkParameters?: NetworkParameters
|
|
50
265
|
): Promise<void>;
|
|
51
266
|
|
|
52
267
|
retrieveItems(
|
|
53
|
-
parameters:
|
|
54
|
-
ids?: string[];
|
|
55
|
-
section?: string;
|
|
56
|
-
numResultsPerPage?: number;
|
|
57
|
-
page?: number;
|
|
58
|
-
},
|
|
268
|
+
parameters: RetrieveItemsParameters,
|
|
59
269
|
networkParameters?: NetworkParameters
|
|
60
270
|
): Promise<{ items: Item[]; total_count: number; [key: string]: any }>;
|
|
61
271
|
|
|
62
272
|
createOrReplaceVariations(
|
|
63
|
-
parameters:
|
|
64
|
-
variations: Variation[];
|
|
65
|
-
force?: boolean;
|
|
66
|
-
notificationEmail?: string;
|
|
67
|
-
section?: string;
|
|
68
|
-
},
|
|
273
|
+
parameters: CreateOrReplaceVariationsParameters,
|
|
69
274
|
networkParameters?: NetworkParameters
|
|
70
275
|
): Promise<void>;
|
|
71
276
|
|
|
72
277
|
updateVariations(
|
|
73
|
-
parameters:
|
|
74
|
-
variations: Variation[];
|
|
75
|
-
force?: boolean;
|
|
76
|
-
notificationEmail?: string;
|
|
77
|
-
section?: string;
|
|
78
|
-
onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
|
|
79
|
-
},
|
|
278
|
+
parameters: UpdateVariationsParameters,
|
|
80
279
|
networkParameters?: NetworkParameters
|
|
81
280
|
): Promise<void>;
|
|
82
281
|
|
|
83
282
|
deleteVariations(
|
|
84
|
-
parameters:
|
|
85
|
-
variations: Pick<Variation, 'id'>[];
|
|
86
|
-
force?: boolean;
|
|
87
|
-
notificationEmail?: string;
|
|
88
|
-
section?: string;
|
|
89
|
-
},
|
|
283
|
+
parameters: DeleteVariationsParameters,
|
|
90
284
|
networkParameters?: NetworkParameters
|
|
91
285
|
): Promise<void>;
|
|
92
286
|
|
|
93
287
|
retrieveVariations(
|
|
94
|
-
parameters:
|
|
95
|
-
section?: string;
|
|
96
|
-
ids?: string[];
|
|
97
|
-
itemId?: string;
|
|
98
|
-
numResultsPerPage?: number;
|
|
99
|
-
page?: number;
|
|
100
|
-
},
|
|
288
|
+
parameters: RetrieveVariationsParameters,
|
|
101
289
|
networkParameters?: NetworkParameters
|
|
102
290
|
): Promise<{
|
|
103
291
|
variations: Variation[];
|
|
@@ -106,26 +294,17 @@ declare class Catalog {
|
|
|
106
294
|
}>;
|
|
107
295
|
|
|
108
296
|
addItemGroup(
|
|
109
|
-
parameters:
|
|
110
|
-
id: string;
|
|
111
|
-
name: string;
|
|
112
|
-
parent_id?: string;
|
|
113
|
-
data?: Record<string, any>;
|
|
114
|
-
},
|
|
297
|
+
parameters: AddItemGroupParameters,
|
|
115
298
|
networkParameters?: NetworkParameters
|
|
116
299
|
): Promise<void>;
|
|
117
300
|
|
|
118
301
|
addItemGroups(
|
|
119
|
-
parameters:
|
|
120
|
-
item_groups: ItemGroup[];
|
|
121
|
-
},
|
|
302
|
+
parameters: AddItemGroupsParameters,
|
|
122
303
|
networkParameters?: NetworkParameters
|
|
123
304
|
): Promise<void>;
|
|
124
305
|
|
|
125
306
|
getItemGroup(
|
|
126
|
-
parameters:
|
|
127
|
-
id: string;
|
|
128
|
-
},
|
|
307
|
+
parameters: GetItemGroupParameters,
|
|
129
308
|
networkParameters?: NetworkParameters
|
|
130
309
|
): Promise<{
|
|
131
310
|
item_groups: ItemGroup[];
|
|
@@ -140,9 +319,7 @@ declare class Catalog {
|
|
|
140
319
|
}>;
|
|
141
320
|
|
|
142
321
|
addOrUpdateItemGroups(
|
|
143
|
-
parameters:
|
|
144
|
-
item_groups: ItemGroup[];
|
|
145
|
-
},
|
|
322
|
+
parameters: AddOrUpdateItemGroupsParameters,
|
|
146
323
|
networkParameters?: NetworkParameters
|
|
147
324
|
): Promise<{
|
|
148
325
|
item_groups: {
|
|
@@ -171,35 +348,24 @@ declare class Catalog {
|
|
|
171
348
|
): Promise<{ message: string }>;
|
|
172
349
|
|
|
173
350
|
addOneWaySynonym(
|
|
174
|
-
parameters:
|
|
175
|
-
phrase: string;
|
|
176
|
-
child_phrases: string[];
|
|
177
|
-
},
|
|
351
|
+
parameters: AddOneWaySynonymParameters,
|
|
178
352
|
networkParameters?: NetworkParameters
|
|
179
353
|
): Promise<void>;
|
|
180
354
|
|
|
181
355
|
modifyOneWaySynonym(
|
|
182
|
-
parameters:
|
|
183
|
-
phrase: string;
|
|
184
|
-
child_phrases: string[];
|
|
185
|
-
},
|
|
356
|
+
parameters: ModifyOneWaySynonymParameters,
|
|
186
357
|
networkParameters?: NetworkParameters
|
|
187
358
|
): Promise<void>;
|
|
188
359
|
|
|
189
360
|
getOneWaySynonym(
|
|
190
|
-
parameters:
|
|
191
|
-
phrase: string;
|
|
192
|
-
},
|
|
361
|
+
parameters: GetOneWaySynonymParameters,
|
|
193
362
|
networkParameters?: NetworkParameters
|
|
194
363
|
): Promise<{
|
|
195
364
|
one_way_synonym_relations: OneWaySynonymRelation[];
|
|
196
365
|
}>;
|
|
197
366
|
|
|
198
367
|
getOneWaySynonyms(
|
|
199
|
-
parameters?:
|
|
200
|
-
num_results_per_page?: number;
|
|
201
|
-
page?: number;
|
|
202
|
-
},
|
|
368
|
+
parameters?: GetOneWaySynonymsParameters,
|
|
203
369
|
networkParameters?: NetworkParameters
|
|
204
370
|
): Promise<{
|
|
205
371
|
one_way_synonym_relations: OneWaySynonymRelation[];
|
|
@@ -207,33 +373,24 @@ declare class Catalog {
|
|
|
207
373
|
}>;
|
|
208
374
|
|
|
209
375
|
removeOneWaySynonym(
|
|
210
|
-
parameters:
|
|
211
|
-
phrase: string;
|
|
212
|
-
},
|
|
376
|
+
parameters: RemoveOneWaySynonymParameters,
|
|
213
377
|
networkParameters?: NetworkParameters
|
|
214
378
|
): Promise<void>;
|
|
215
379
|
|
|
216
380
|
removeOneWaySynonyms(networkParameters?: NetworkParameters): Promise<void>;
|
|
217
381
|
|
|
218
382
|
addSynonymGroup(
|
|
219
|
-
parameters:
|
|
220
|
-
synonyms: string[];
|
|
221
|
-
},
|
|
383
|
+
parameters: AddSynonymGroupParameters,
|
|
222
384
|
networkParameters?: NetworkParameters
|
|
223
385
|
): Promise<{ group_id: number; [key: string]: any }>;
|
|
224
386
|
|
|
225
387
|
modifySynonymGroup(
|
|
226
|
-
parameters:
|
|
227
|
-
id: number;
|
|
228
|
-
synonyms: string[];
|
|
229
|
-
},
|
|
388
|
+
parameters: ModifySynonymGroupParameters,
|
|
230
389
|
networkParameters?: NetworkParameters
|
|
231
390
|
): Promise<void>;
|
|
232
391
|
|
|
233
392
|
getSynonymGroup(
|
|
234
|
-
parameters:
|
|
235
|
-
id: number;
|
|
236
|
-
},
|
|
393
|
+
parameters: GetSynonymGroupParameters,
|
|
237
394
|
networkParameters?: NetworkParameters
|
|
238
395
|
): Promise<{
|
|
239
396
|
synonym_groups: SynonymGroup[];
|
|
@@ -242,11 +399,7 @@ declare class Catalog {
|
|
|
242
399
|
}>;
|
|
243
400
|
|
|
244
401
|
getSynonymGroups(
|
|
245
|
-
parameters?:
|
|
246
|
-
phrase?: string;
|
|
247
|
-
num_results_per_page?: number;
|
|
248
|
-
page?: number;
|
|
249
|
-
},
|
|
402
|
+
parameters?: GetSynonymGroupsParameters,
|
|
250
403
|
networkParameters?: NetworkParameters
|
|
251
404
|
): Promise<{
|
|
252
405
|
synonym_groups: SynonymGroup[];
|
|
@@ -255,66 +408,34 @@ declare class Catalog {
|
|
|
255
408
|
}>;
|
|
256
409
|
|
|
257
410
|
removeSynonymGroup(
|
|
258
|
-
parameters:
|
|
259
|
-
id: number;
|
|
260
|
-
},
|
|
411
|
+
parameters:RemoveSynonymGroupParameters,
|
|
261
412
|
networkParameters?: NetworkParameters
|
|
262
413
|
): Promise<void>;
|
|
263
414
|
|
|
264
415
|
removeSynonymGroups(networkParameters?: NetworkParameters): Promise<void>;
|
|
265
416
|
|
|
266
417
|
addRedirectRule(
|
|
267
|
-
parameters:
|
|
268
|
-
url: string;
|
|
269
|
-
matches: RedirectRuleMatchObject[];
|
|
270
|
-
start_time?: string;
|
|
271
|
-
end_time?: string;
|
|
272
|
-
user_segments?: string[];
|
|
273
|
-
metadata?: Record<string, any>;
|
|
274
|
-
},
|
|
418
|
+
parameters: AddRedirectRuleParameters,
|
|
275
419
|
networkParameters?: NetworkParameters
|
|
276
420
|
): Promise<RedirectRuleResponse>;
|
|
277
421
|
|
|
278
422
|
updateRedirectRule(
|
|
279
|
-
parameters:
|
|
280
|
-
id: string;
|
|
281
|
-
url: string;
|
|
282
|
-
matches: RedirectRuleMatchObject[];
|
|
283
|
-
start_time?: string;
|
|
284
|
-
end_time?: string;
|
|
285
|
-
user_segments?: string[];
|
|
286
|
-
metadata?: Record<string, any>;
|
|
287
|
-
},
|
|
423
|
+
parameters: UpdateRedirectRuleParameters,
|
|
288
424
|
networkParameters?: NetworkParameters
|
|
289
425
|
): Promise<RedirectRuleResponse>;
|
|
290
426
|
|
|
291
427
|
modifyRedirectRule(
|
|
292
|
-
parameters:
|
|
293
|
-
id: string;
|
|
294
|
-
url: string;
|
|
295
|
-
matches: RedirectRuleMatchObject[];
|
|
296
|
-
start_time?: string;
|
|
297
|
-
end_time?: string;
|
|
298
|
-
user_segments?: string[];
|
|
299
|
-
metadata?: Record<string, any>;
|
|
300
|
-
},
|
|
428
|
+
parameters: ModifyRedirectRuleParameters,
|
|
301
429
|
networkParameters?: NetworkParameters
|
|
302
430
|
): Promise<RedirectRuleResponse>;
|
|
303
431
|
|
|
304
432
|
getRedirectRule(
|
|
305
|
-
parameters:
|
|
306
|
-
id: string;
|
|
307
|
-
},
|
|
433
|
+
parameters: GetRedirectRuleParameters,
|
|
308
434
|
networkParameters?: NetworkParameters
|
|
309
435
|
): Promise<RedirectRuleResponse>;
|
|
310
436
|
|
|
311
437
|
getRedirectRules(
|
|
312
|
-
parameters?:
|
|
313
|
-
num_results_per_page?: number;
|
|
314
|
-
page?: number;
|
|
315
|
-
query?: string;
|
|
316
|
-
status?: string;
|
|
317
|
-
},
|
|
438
|
+
parameters?: GetRedirectRulesParameters,
|
|
318
439
|
networkParameters?: NetworkParameters
|
|
319
440
|
): Promise<{
|
|
320
441
|
redirect_rules: RedirectRuleResponse[];
|
|
@@ -323,21 +444,12 @@ declare class Catalog {
|
|
|
323
444
|
}>;
|
|
324
445
|
|
|
325
446
|
removeRedirectRule(
|
|
326
|
-
parameters:
|
|
327
|
-
id: string;
|
|
328
|
-
},
|
|
447
|
+
parameters: RemoveRedirectRuleParameters,
|
|
329
448
|
networkParameters?: NetworkParameters
|
|
330
449
|
): Promise<RedirectRuleResponse>;
|
|
331
450
|
|
|
332
451
|
replaceCatalog(
|
|
333
|
-
parameters:
|
|
334
|
-
section: string;
|
|
335
|
-
notification_email?: string;
|
|
336
|
-
force?: boolean;
|
|
337
|
-
items?: File;
|
|
338
|
-
variations?: File;
|
|
339
|
-
item_groups?: File;
|
|
340
|
-
},
|
|
452
|
+
parameters: ReplaceCatalogParameters,
|
|
341
453
|
networkParameters?: NetworkParameters
|
|
342
454
|
): Promise<{
|
|
343
455
|
task_id: string;
|
|
@@ -346,14 +458,7 @@ declare class Catalog {
|
|
|
346
458
|
}>;
|
|
347
459
|
|
|
348
460
|
updateCatalog(
|
|
349
|
-
parameters:
|
|
350
|
-
section: string;
|
|
351
|
-
notification_email?: string;
|
|
352
|
-
force?: boolean;
|
|
353
|
-
items?: File;
|
|
354
|
-
variations?: File;
|
|
355
|
-
item_groups?: File;
|
|
356
|
-
},
|
|
461
|
+
parameters: UpdateCatalogParameters,
|
|
357
462
|
networkParameters?: NetworkParameters
|
|
358
463
|
): Promise<{
|
|
359
464
|
task_id: string;
|
|
@@ -362,15 +467,7 @@ declare class Catalog {
|
|
|
362
467
|
}>;
|
|
363
468
|
|
|
364
469
|
patchCatalog(
|
|
365
|
-
parameters:
|
|
366
|
-
section: string;
|
|
367
|
-
notification_email?: string;
|
|
368
|
-
force?: boolean;
|
|
369
|
-
onMissing?: 'IGNORE' | 'CREATE' | 'FAIL';
|
|
370
|
-
items?: File;
|
|
371
|
-
variations?: File;
|
|
372
|
-
item_groups?: File;
|
|
373
|
-
},
|
|
470
|
+
parameters: PatchCatalogParameters,
|
|
374
471
|
networkParameters?: NetworkParameters
|
|
375
472
|
): Promise<{
|
|
376
473
|
task_id: string;
|
|
@@ -379,12 +476,7 @@ declare class Catalog {
|
|
|
379
476
|
}>;
|
|
380
477
|
|
|
381
478
|
replaceCatalogUsingTarArchive(
|
|
382
|
-
parameters:
|
|
383
|
-
section: string;
|
|
384
|
-
notification_email?: string;
|
|
385
|
-
force?: boolean;
|
|
386
|
-
tarArchive?: File;
|
|
387
|
-
},
|
|
479
|
+
parameters: ReplaceCatalogUsingTarArchiveParameters,
|
|
388
480
|
networkParameters?: NetworkParameters
|
|
389
481
|
): Promise<{
|
|
390
482
|
task_id: string;
|
|
@@ -393,12 +485,7 @@ declare class Catalog {
|
|
|
393
485
|
}>;
|
|
394
486
|
|
|
395
487
|
updateCatalogUsingTarArchive(
|
|
396
|
-
parameters:
|
|
397
|
-
section: string;
|
|
398
|
-
notification_email?: string;
|
|
399
|
-
force?: boolean;
|
|
400
|
-
tarArchive?: File;
|
|
401
|
-
},
|
|
488
|
+
parameters: UpdateCatalogUsingTarArchiveParameters,
|
|
402
489
|
networkParameters?: NetworkParameters
|
|
403
490
|
): Promise<{
|
|
404
491
|
task_id: string;
|
|
@@ -407,12 +494,7 @@ declare class Catalog {
|
|
|
407
494
|
}>;
|
|
408
495
|
|
|
409
496
|
patchCatalogUsingTarArchive(
|
|
410
|
-
parameters:
|
|
411
|
-
section: string;
|
|
412
|
-
notification_email?: string;
|
|
413
|
-
force?: boolean;
|
|
414
|
-
tarArchive?: File;
|
|
415
|
-
},
|
|
497
|
+
parameters: PatchCatalogUsingTarArchiveParameters,
|
|
416
498
|
networkParameters?: NetworkParameters
|
|
417
499
|
): Promise<{
|
|
418
500
|
task_id: string;
|
|
@@ -426,11 +508,7 @@ declare class Catalog {
|
|
|
426
508
|
): Promise<FacetConfiguration>;
|
|
427
509
|
|
|
428
510
|
getFacetConfigurations(
|
|
429
|
-
parameters:
|
|
430
|
-
page?: number;
|
|
431
|
-
num_results_per_page?: number;
|
|
432
|
-
section?: string;
|
|
433
|
-
},
|
|
511
|
+
parameters: GetFacetConfigurationsParameters,
|
|
434
512
|
networkParameters?: NetworkParameters
|
|
435
513
|
): Promise<{
|
|
436
514
|
facets: FacetConfiguration[];
|
|
@@ -439,17 +517,12 @@ declare class Catalog {
|
|
|
439
517
|
}>;
|
|
440
518
|
|
|
441
519
|
getFacetConfiguration(
|
|
442
|
-
parameters:
|
|
443
|
-
name?: string;
|
|
444
|
-
section?: string;
|
|
445
|
-
},
|
|
520
|
+
parameters: GetFacetConfigurationParameters,
|
|
446
521
|
networkParameters?: NetworkParameters
|
|
447
522
|
): Promise<FacetConfiguration>;
|
|
448
523
|
|
|
449
524
|
modifyFacetConfigurations(
|
|
450
|
-
parameters?:
|
|
451
|
-
facetConfigurations: FacetConfiguration[];
|
|
452
|
-
},
|
|
525
|
+
parameters?: ModifyFacetConfigurationsParameters,
|
|
453
526
|
networkParameters?: NetworkParameters
|
|
454
527
|
): Promise<FacetConfiguration[]>;
|
|
455
528
|
|
|
@@ -464,37 +537,22 @@ declare class Catalog {
|
|
|
464
537
|
): Promise<FacetConfiguration>;
|
|
465
538
|
|
|
466
539
|
removeFacetConfiguration(
|
|
467
|
-
parameters?:
|
|
468
|
-
name: string;
|
|
469
|
-
section?: string;
|
|
470
|
-
},
|
|
540
|
+
parameters?: RemoveFacetConfigurationParameters,
|
|
471
541
|
networkParameters?: NetworkParameters
|
|
472
542
|
): Promise<FacetConfiguration>;
|
|
473
543
|
|
|
474
544
|
addFacetOptionConfiguration(
|
|
475
|
-
parameters:
|
|
476
|
-
facetGroupName: string;
|
|
477
|
-
section?: string;
|
|
478
|
-
},
|
|
545
|
+
parameters: AddFacetOptionConfigurationParameters,
|
|
479
546
|
networkParameters?: NetworkParameters
|
|
480
547
|
): Promise<FacetOptionConfiguration>;
|
|
481
548
|
|
|
482
549
|
addOrModifyFacetOptionConfigurations(
|
|
483
|
-
parameters:
|
|
484
|
-
facetGroupName: string;
|
|
485
|
-
facetOptionConfigurations: FacetOptionConfiguration[];
|
|
486
|
-
section?: string;
|
|
487
|
-
},
|
|
550
|
+
parameters: AddOrModifyFacetOptionConfigurationsParameters,
|
|
488
551
|
networkParameters?: NetworkParameters
|
|
489
552
|
): Promise<FacetOptionConfiguration[]>;
|
|
490
553
|
|
|
491
554
|
getFacetOptionConfigurations(
|
|
492
|
-
parameters:
|
|
493
|
-
facetGroupName: string;
|
|
494
|
-
page?: number;
|
|
495
|
-
num_results_per_page?: number;
|
|
496
|
-
section?: string;
|
|
497
|
-
},
|
|
555
|
+
parameters: GetFacetOptionConfigurationsParameters,
|
|
498
556
|
networkParameters?: NetworkParameters
|
|
499
557
|
): Promise<{
|
|
500
558
|
facet_options: FacetOptionConfiguration[];
|
|
@@ -503,36 +561,22 @@ declare class Catalog {
|
|
|
503
561
|
}>;
|
|
504
562
|
|
|
505
563
|
getFacetOptionConfiguration(
|
|
506
|
-
parameters:
|
|
507
|
-
facetGroupName: string;
|
|
508
|
-
value: string;
|
|
509
|
-
section?: string;
|
|
510
|
-
},
|
|
564
|
+
parameters: GetFacetOptionConfigurationParameters,
|
|
511
565
|
networkParameters?: NetworkParameters
|
|
512
566
|
): Promise<FacetOptionConfiguration>;
|
|
513
567
|
|
|
514
568
|
replaceFacetOptionConfiguration(
|
|
515
|
-
parameters:
|
|
516
|
-
facetGroupName: string;
|
|
517
|
-
section?: string;
|
|
518
|
-
} & FacetOptionConfiguration,
|
|
569
|
+
parameters: ReplaceFacetOptionConfigurationParameters,
|
|
519
570
|
networkParameters?: NetworkParameters
|
|
520
571
|
): Promise<FacetOptionConfiguration>;
|
|
521
572
|
|
|
522
573
|
modifyFacetOptionConfiguration(
|
|
523
|
-
parameters?:
|
|
524
|
-
facetGroupName: string;
|
|
525
|
-
section?: string;
|
|
526
|
-
} & FacetOptionConfiguration,
|
|
574
|
+
parameters?: ModifyFacetOptionConfigurationParameters,
|
|
527
575
|
networkParameters?: NetworkParameters
|
|
528
576
|
): Promise<FacetOptionConfiguration>;
|
|
529
577
|
|
|
530
578
|
removeFacetOptionConfiguration(
|
|
531
|
-
parameters:
|
|
532
|
-
facetGroupName: string;
|
|
533
|
-
value: string;
|
|
534
|
-
section?: string;
|
|
535
|
-
},
|
|
579
|
+
parameters: RemoveFacetOptionConfiguration,
|
|
536
580
|
networkParameters?: NetworkParameters
|
|
537
581
|
): Promise<FacetOptionConfiguration>;
|
|
538
582
|
}
|
package/src/types/index.d.ts
CHANGED
package/src/types/quizzes.d.ts
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nullable, UserParameters } from './index.d';
|
|
2
|
+
import {
|
|
3
|
+
ConstructorClientOptions,
|
|
4
|
+
Facet,
|
|
5
|
+
Feature,
|
|
6
|
+
Group,
|
|
7
|
+
NetworkParameters,
|
|
8
|
+
RequestFeature,
|
|
9
|
+
RequestFeatureVariant,
|
|
10
|
+
SortOption,
|
|
11
|
+
FilterExpression,
|
|
12
|
+
ResultSources,
|
|
13
|
+
} from '.';
|
|
2
14
|
|
|
3
15
|
export default Quizzes;
|
|
4
16
|
|
|
5
17
|
export interface QuizzesParameters {
|
|
18
|
+
answers: any[];
|
|
6
19
|
section?: string;
|
|
7
|
-
|
|
8
|
-
|
|
20
|
+
quizVersionId?: string;
|
|
21
|
+
quizSessionId?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface QuizzesResultsParameters extends QuizzesParameters {
|
|
25
|
+
answers: any[];
|
|
26
|
+
page?: number;
|
|
27
|
+
resultsPerPage?: number;
|
|
28
|
+
filters?: Record<string, any>;
|
|
9
29
|
}
|
|
10
30
|
|
|
11
31
|
declare class Quizzes {
|
|
@@ -14,15 +34,15 @@ declare class Quizzes {
|
|
|
14
34
|
options: ConstructorClientOptions;
|
|
15
35
|
|
|
16
36
|
getQuizNextQuestion(
|
|
17
|
-
|
|
37
|
+
quizId: string,
|
|
18
38
|
parameters?: QuizzesParameters,
|
|
19
39
|
userParameters?: UserParameters,
|
|
20
40
|
networkParameters?: NetworkParameters
|
|
21
41
|
): Promise<NextQuestionResponse>;
|
|
22
42
|
|
|
23
43
|
getQuizResults(
|
|
24
|
-
|
|
25
|
-
parameters?:
|
|
44
|
+
quizId: string,
|
|
45
|
+
parameters?: QuizzesResultsParameters,
|
|
26
46
|
userParameters?: UserParameters,
|
|
27
47
|
networkParameters?: NetworkParameters
|
|
28
48
|
): Promise<QuizResultsResponse>;
|
|
@@ -30,24 +50,77 @@ declare class Quizzes {
|
|
|
30
50
|
|
|
31
51
|
/* quizzes results returned from server */
|
|
32
52
|
export interface NextQuestionResponse extends Record<string, any> {
|
|
33
|
-
next_question:
|
|
53
|
+
next_question: Question;
|
|
34
54
|
is_last_question?: boolean;
|
|
35
|
-
|
|
55
|
+
quiz_version_id: string;
|
|
56
|
+
quiz_id: string;
|
|
57
|
+
quiz_session_id: string;
|
|
36
58
|
}
|
|
59
|
+
|
|
37
60
|
export interface QuizResultsResponse extends Record<string, any> {
|
|
38
|
-
|
|
39
|
-
|
|
61
|
+
request?: {
|
|
62
|
+
filters?: Record<string, any>;
|
|
63
|
+
fmt_options: Record<string, any>;
|
|
64
|
+
num_results_per_page: number;
|
|
65
|
+
page: number;
|
|
66
|
+
section: string;
|
|
67
|
+
sort_by: string;
|
|
68
|
+
sort_order: string;
|
|
69
|
+
features: Partial<RequestFeature>;
|
|
70
|
+
feature_variants: Partial<RequestFeatureVariant>;
|
|
71
|
+
collection_filter_expression: FilterExpression;
|
|
72
|
+
term: string;
|
|
73
|
+
};
|
|
74
|
+
response?: {
|
|
75
|
+
result_sources: Partial<ResultSources>;
|
|
76
|
+
facets: Partial<Facet>[];
|
|
77
|
+
groups: Partial<Group>[];
|
|
78
|
+
results: Partial<QuizResultData>[];
|
|
79
|
+
sort_options: Partial<SortOption>[];
|
|
80
|
+
refined_content: Record<string, any>[];
|
|
81
|
+
total_num_results: number;
|
|
82
|
+
features: Partial<Feature>[];
|
|
83
|
+
};
|
|
84
|
+
result_id?: string;
|
|
85
|
+
quiz_version_id: string;
|
|
86
|
+
quiz_session_id: string;
|
|
87
|
+
quiz_id: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface QuizResultData extends Record<string, any> {
|
|
91
|
+
matched_terms: string[];
|
|
92
|
+
data: {
|
|
93
|
+
id: string;
|
|
94
|
+
[key: string]: any;
|
|
95
|
+
};
|
|
96
|
+
value: string;
|
|
97
|
+
is_slotted: false;
|
|
98
|
+
labels: Record<string, any>;
|
|
99
|
+
variations: Record<string, any>[];
|
|
40
100
|
}
|
|
41
101
|
|
|
42
|
-
export
|
|
102
|
+
export type Question = SelectQuestion | OpenQuestion | CoverQuestion
|
|
103
|
+
|
|
104
|
+
export interface BaseQuestion extends Record<string, any> {
|
|
43
105
|
id: number;
|
|
44
106
|
title: string;
|
|
45
107
|
description: string;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
108
|
+
cta_text: Nullable<string>;
|
|
109
|
+
images?: Nullable<QuestionImages>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface SelectQuestion extends BaseQuestion {
|
|
113
|
+
type: 'single' | 'multiple'
|
|
114
|
+
options: QuestionOption[];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface OpenQuestion extends BaseQuestion {
|
|
118
|
+
type: 'open'
|
|
119
|
+
inputPlaceholder?: Nullable<string>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface CoverQuestion extends BaseQuestion {
|
|
123
|
+
type: 'cover'
|
|
51
124
|
}
|
|
52
125
|
|
|
53
126
|
export interface QuizResult extends Record<string, any> {
|
|
@@ -58,16 +131,16 @@ export interface QuizResult extends Record<string, any> {
|
|
|
58
131
|
export interface QuestionOption extends Record<string, any> {
|
|
59
132
|
id: number;
|
|
60
133
|
value: string;
|
|
61
|
-
attribute: {
|
|
134
|
+
attribute: Nullable<{
|
|
62
135
|
name: string;
|
|
63
136
|
value: string;
|
|
64
|
-
}
|
|
65
|
-
images
|
|
137
|
+
}>;
|
|
138
|
+
images?: Nullable<QuestionImages>;
|
|
66
139
|
}
|
|
67
140
|
|
|
68
141
|
export interface QuestionImages extends Record<string, any> {
|
|
69
|
-
primary_url
|
|
70
|
-
primary_alt
|
|
71
|
-
secondary_url
|
|
72
|
-
secondary_alt
|
|
142
|
+
primary_url?: Nullable<string>;
|
|
143
|
+
primary_alt?: Nullable<string>;
|
|
144
|
+
secondary_url?: Nullable<string>;
|
|
145
|
+
secondary_alt?: Nullable<string>;
|
|
73
146
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @cspell/spellchecker */
|
|
1
2
|
import { expectAssignable } from 'tsd';
|
|
2
3
|
import { QuizResultsResponse, NextQuestionResponse } from '..';
|
|
3
4
|
|
|
@@ -34,7 +35,9 @@ expectAssignable<NextQuestionResponse>(
|
|
|
34
35
|
},
|
|
35
36
|
],
|
|
36
37
|
},
|
|
37
|
-
|
|
38
|
+
quiz_version_id: '6bfaa6d5-7272-466b-acd9-4bcf322a2f1e',
|
|
39
|
+
quiz_id: 'test-quiz',
|
|
40
|
+
quiz_session_id: '132feaa5-9968-4c5d-8605-d128747188d6',
|
|
38
41
|
is_last_question: false,
|
|
39
42
|
},
|
|
40
43
|
);
|
|
@@ -54,29 +57,218 @@ expectAssignable<NextQuestionResponse>({
|
|
|
54
57
|
},
|
|
55
58
|
input_placeholder: 'Sample input placeholder',
|
|
56
59
|
},
|
|
57
|
-
|
|
60
|
+
quiz_version_id: '6bfaa6d5-7272-466b-acd9-4bcf322a2f1e',
|
|
61
|
+
quiz_id: 'test-quiz',
|
|
62
|
+
quiz_session_id: '132feaa5-9968-4c5d-8605-d128747188d6',
|
|
58
63
|
is_last_question: false,
|
|
59
64
|
});
|
|
60
65
|
|
|
61
66
|
expectAssignable<QuizResultsResponse>({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
request: {
|
|
68
|
+
page: 1,
|
|
69
|
+
num_results_per_page: 20,
|
|
70
|
+
collection_filter_expression: {
|
|
71
|
+
or: [
|
|
66
72
|
{
|
|
67
|
-
|
|
68
|
-
{ name: 'group_id', value: '
|
|
69
|
-
{ name: '
|
|
73
|
+
and: [
|
|
74
|
+
{ name: 'group_id', value: 'BrandX' },
|
|
75
|
+
{ name: 'Color', value: 'Blue' },
|
|
70
76
|
],
|
|
71
77
|
},
|
|
72
78
|
{
|
|
73
|
-
|
|
74
|
-
{ name: '
|
|
79
|
+
and: [
|
|
80
|
+
{ name: 'group_id', value: 'BrandX' },
|
|
81
|
+
{ name: 'Color', value: 'red' },
|
|
75
82
|
],
|
|
76
83
|
},
|
|
77
84
|
],
|
|
78
85
|
},
|
|
79
|
-
|
|
86
|
+
term: '',
|
|
87
|
+
fmt_options: {
|
|
88
|
+
groups_start: 'current',
|
|
89
|
+
groups_max_depth: 1,
|
|
90
|
+
show_hidden_facets: false,
|
|
91
|
+
show_hidden_fields: false,
|
|
92
|
+
show_protected_facets: false,
|
|
93
|
+
},
|
|
94
|
+
sort_by: 'relevance',
|
|
95
|
+
sort_order: 'descending',
|
|
96
|
+
section: 'Products',
|
|
97
|
+
features: {
|
|
98
|
+
query_items: true,
|
|
99
|
+
a_a_test: false,
|
|
100
|
+
auto_generated_refined_query_rules: true,
|
|
101
|
+
manual_searchandizing: true,
|
|
102
|
+
personalization: true,
|
|
103
|
+
filter_items: true,
|
|
104
|
+
use_reranker_service_for_search: false,
|
|
105
|
+
use_reranker_service_for_browse: false,
|
|
106
|
+
use_reranker_service_for_all: false,
|
|
107
|
+
custom_autosuggest_ui: false,
|
|
108
|
+
},
|
|
109
|
+
feature_variants: {
|
|
110
|
+
query_items: 'query_items_ctr_and_l2r',
|
|
111
|
+
a_a_test: null,
|
|
112
|
+
auto_generated_refined_query_rules: 'default_rules',
|
|
113
|
+
manual_searchandizing: null,
|
|
114
|
+
personalization: 'default_personalization',
|
|
115
|
+
filter_items: 'filter_items_w_acts_and_purchases',
|
|
116
|
+
use_reranker_service_for_search: null,
|
|
117
|
+
use_reranker_service_for_browse: null,
|
|
118
|
+
use_reranker_service_for_all: null,
|
|
119
|
+
custom_autosuggest_ui: null,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
response: {
|
|
123
|
+
result_sources: { token_match: { count: 1 }, embeddings_match: { count: 0 } },
|
|
124
|
+
facets: [
|
|
125
|
+
{
|
|
126
|
+
display_name: 'Color',
|
|
127
|
+
name: 'Color',
|
|
128
|
+
type: 'multiple',
|
|
129
|
+
options: [
|
|
130
|
+
{
|
|
131
|
+
status: '',
|
|
132
|
+
count: 1,
|
|
133
|
+
display_name: 'red',
|
|
134
|
+
value: 'red',
|
|
135
|
+
data: {},
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
hidden: false,
|
|
139
|
+
data: {},
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
groups: [
|
|
143
|
+
{
|
|
144
|
+
group_id: 'All',
|
|
145
|
+
display_name: 'All',
|
|
146
|
+
count: 1,
|
|
147
|
+
data: {},
|
|
148
|
+
children: [
|
|
149
|
+
{
|
|
150
|
+
group_id: 'Brands',
|
|
151
|
+
display_name: 'Brands',
|
|
152
|
+
count: 1,
|
|
153
|
+
data: {},
|
|
154
|
+
children: [],
|
|
155
|
+
parents: [{ display_name: 'All', group_id: 'All' }],
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
parents: [],
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
results: [
|
|
162
|
+
{
|
|
163
|
+
matched_terms: [],
|
|
164
|
+
data: {
|
|
165
|
+
id: '10005',
|
|
166
|
+
url: 'https://test.com/p/10005',
|
|
167
|
+
facets: [
|
|
168
|
+
{ name: 'Brand', values: ['XYZ'] },
|
|
169
|
+
{ name: 'Color', values: ['red'] },
|
|
170
|
+
],
|
|
171
|
+
deactivated: false,
|
|
172
|
+
groups: [
|
|
173
|
+
{
|
|
174
|
+
group_id: 'BrandXY',
|
|
175
|
+
display_name: 'BrandXY',
|
|
176
|
+
path: '/All/Brands/BrandX',
|
|
177
|
+
path_list: [
|
|
178
|
+
{ id: 'All', display_name: 'All' },
|
|
179
|
+
{ id: 'Brands', display_name: 'Brands' },
|
|
180
|
+
{ id: 'BrandX', display_name: 'BrandX' },
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
value: 'Item5',
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
sort_options: [
|
|
189
|
+
{
|
|
190
|
+
sort_by: 'Collection',
|
|
191
|
+
display_name: 'ASC',
|
|
192
|
+
sort_order: 'ascending',
|
|
193
|
+
status: '',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
sort_by: 'relevance',
|
|
197
|
+
display_name: 'DESC',
|
|
198
|
+
sort_order: 'descending',
|
|
199
|
+
status: 'selected',
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
refined_content: [],
|
|
203
|
+
total_num_results: 1,
|
|
204
|
+
features: [
|
|
205
|
+
{
|
|
206
|
+
feature_name: 'a_a_test',
|
|
207
|
+
display_name: 'a_a_test',
|
|
208
|
+
enabled: false,
|
|
209
|
+
variant: null,
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
feature_name: 'auto_generated_refined_query_rules',
|
|
213
|
+
display_name: 'Affinity Engine',
|
|
214
|
+
enabled: true,
|
|
215
|
+
variant: { name: 'default_rules', display_name: 'Default weights' },
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
feature_name: 'custom_autosuggest_ui',
|
|
219
|
+
display_name: 'custom_autosuggest_ui',
|
|
220
|
+
enabled: false,
|
|
221
|
+
variant: null,
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
feature_name: 'filter_items',
|
|
225
|
+
display_name: 'Filter-item boosts',
|
|
226
|
+
enabled: true,
|
|
227
|
+
variant: { name: 'filter_items_w_atcs_and_purchases', display_name: '' },
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
feature_name: 'manual_searchandizing',
|
|
231
|
+
display_name: 'Searchandizing',
|
|
232
|
+
enabled: true,
|
|
233
|
+
variant: null,
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
feature_name: 'personalization',
|
|
237
|
+
display_name: 'Personalization',
|
|
238
|
+
enabled: true,
|
|
239
|
+
variant: {
|
|
240
|
+
name: 'default_personalization',
|
|
241
|
+
display_name: 'Default Personalization',
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
feature_name: 'query_items',
|
|
246
|
+
display_name: 'Learn To Rank',
|
|
247
|
+
enabled: true,
|
|
248
|
+
variant: { name: 'query_items_ctr_and_l2r', display_name: 'CTR & LTR' },
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
feature_name: 'use_rerender_service_for_all',
|
|
252
|
+
display_name: 'Use rerender service to rerun search and browse results',
|
|
253
|
+
enabled: false,
|
|
254
|
+
variant: null,
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
feature_name: 'use_rerender_service_for_browse',
|
|
258
|
+
display_name: 'use_rerender_service_for_browse',
|
|
259
|
+
enabled: false,
|
|
260
|
+
variant: null,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
feature_name: 'use_rerender_service_for_search',
|
|
264
|
+
display_name: 'Use rerender service to reran search results',
|
|
265
|
+
enabled: false,
|
|
266
|
+
variant: null,
|
|
267
|
+
},
|
|
268
|
+
],
|
|
80
269
|
},
|
|
81
|
-
|
|
270
|
+
result_id: '4aeb42f7-d104-44bf-8f60-e674a633bf28',
|
|
271
|
+
quiz_id: 'test-quiz',
|
|
272
|
+
quiz_version_id: '6bfcb6d3-7272-466b-acd9-4bcf322f2f1e',
|
|
273
|
+
quiz_session_id: '163fefe3-2968-4c5d-8605-d128747188d6',
|
|
82
274
|
});
|