@constructor-io/constructorio-client-javascript 2.34.2 → 2.34.4
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/lib/modules/quizzes.js +4 -4
- package/lib/types/autocomplete.d.ts +46 -54
- package/lib/types/browse.d.ts +121 -113
- package/lib/types/constructorio.d.ts +23 -22
- package/lib/types/event-dispatcher.d.ts +15 -9
- package/lib/types/index.d.ts +182 -0
- package/lib/types/quizzes.d.ts +85 -0
- package/lib/types/recommendations.d.ts +54 -63
- package/lib/types/search.d.ts +87 -93
- package/lib/types/tracker.d.ts +172 -159
- package/package.json +5 -2
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Nullable } from './index.d';
|
|
2
|
+
import { ConstructorClientOptions, NetworkParameters } from '.';
|
|
3
|
+
|
|
4
|
+
export default Quizzes;
|
|
5
|
+
|
|
6
|
+
export interface QuizzesParameters {
|
|
7
|
+
section?: string;
|
|
8
|
+
answers?: any[];
|
|
9
|
+
versionId?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class Quizzes {
|
|
13
|
+
constructor(options: ConstructorClientOptions);
|
|
14
|
+
|
|
15
|
+
options: ConstructorClientOptions;
|
|
16
|
+
|
|
17
|
+
getQuizNextQuestion(
|
|
18
|
+
id: string,
|
|
19
|
+
parameters?: QuizzesParameters,
|
|
20
|
+
networkParameters?: NetworkParameters
|
|
21
|
+
): Promise<NextQuestionResponse>;
|
|
22
|
+
|
|
23
|
+
getQuizResults(
|
|
24
|
+
id: string,
|
|
25
|
+
parameters?: QuizzesParameters,
|
|
26
|
+
networkParameters?: NetworkParameters
|
|
27
|
+
): Promise<QuizResultsResponse>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* quizzes results returned from server */
|
|
31
|
+
export interface NextQuestionResponse extends Record<string, any> {
|
|
32
|
+
next_question: Question;
|
|
33
|
+
is_last_question?: boolean;
|
|
34
|
+
version_id?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface QuizResultsResponse extends Record<string, any> {
|
|
37
|
+
result: Partial<QuizResult>;
|
|
38
|
+
version_id?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type Question = SelectQuestion | OpenQuestion | CoverQuestion
|
|
42
|
+
|
|
43
|
+
export interface BaseQuestion extends Record<string, any> {
|
|
44
|
+
id: number;
|
|
45
|
+
title: string;
|
|
46
|
+
description: string;
|
|
47
|
+
cta_text: Nullable<string>;
|
|
48
|
+
images?: Nullable<QuestionImages>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface SelectQuestion extends BaseQuestion {
|
|
52
|
+
type: 'single' | 'multiple'
|
|
53
|
+
options: QuestionOption[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface OpenQuestion extends BaseQuestion {
|
|
57
|
+
type: 'open'
|
|
58
|
+
inputPlaceholder?: Nullable<string>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface CoverQuestion extends BaseQuestion {
|
|
62
|
+
type: 'cover'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface QuizResult extends Record<string, any> {
|
|
66
|
+
filter_expression: Record<string, any>;
|
|
67
|
+
results_url: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface QuestionOption extends Record<string, any> {
|
|
71
|
+
id: number;
|
|
72
|
+
value: string;
|
|
73
|
+
attribute: Nullable<{
|
|
74
|
+
name: string;
|
|
75
|
+
value: string;
|
|
76
|
+
}>;
|
|
77
|
+
images?: Nullable<QuestionImages>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface QuestionImages extends Record<string, any> {
|
|
81
|
+
primary_url?: Nullable<string>;
|
|
82
|
+
primary_alt?: Nullable<string>;
|
|
83
|
+
secondary_url?: Nullable<string>;
|
|
84
|
+
secondary_alt?: Nullable<string>;
|
|
85
|
+
}
|
|
@@ -1,77 +1,68 @@
|
|
|
1
|
-
import { ConstructorClientOptions,
|
|
2
|
-
import EventDispatcher from
|
|
1
|
+
import { ConstructorClientOptions, NetworkParameters } from '.';
|
|
2
|
+
import EventDispatcher from './event-dispatcher';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* Recommendations
|
|
7
|
-
*
|
|
8
|
-
*****************/
|
|
9
|
-
export = Recommendations;
|
|
4
|
+
export default Recommendations;
|
|
10
5
|
|
|
11
|
-
interface RecommendationsParameters {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
export interface RecommendationsParameters {
|
|
7
|
+
itemIds?: string | string[];
|
|
8
|
+
numResults?: number;
|
|
9
|
+
section?: string;
|
|
10
|
+
term?: string;
|
|
11
|
+
filters?: Record<string, any>;
|
|
12
|
+
variationsMap?: Record<string, any>;
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
declare class Recommendations {
|
|
21
|
-
|
|
22
|
-
options: ConstructorClientOptions;
|
|
23
|
-
eventDispatcher: EventDispatcher;
|
|
16
|
+
constructor(options: ConstructorClientOptions);
|
|
24
17
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
18
|
+
options: ConstructorClientOptions;
|
|
19
|
+
|
|
20
|
+
eventDispatcher: EventDispatcher;
|
|
21
|
+
|
|
22
|
+
getRecommendations(
|
|
23
|
+
podId: string,
|
|
24
|
+
parameters?: RecommendationsParameters,
|
|
25
|
+
networkParameters?: NetworkParameters
|
|
26
|
+
): Promise<RecommendationsResponse>;
|
|
32
27
|
}
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
request: Partial<Request>;
|
|
42
|
-
response: Partial<Response>;
|
|
43
|
-
result_id: string;
|
|
44
|
-
}
|
|
29
|
+
/** *********
|
|
30
|
+
* Recommendations results returned from server
|
|
31
|
+
********** */
|
|
32
|
+
export interface RecommendationsResponse extends Record<string, any> {
|
|
33
|
+
request: Partial<RecommendationsRequestType>;
|
|
34
|
+
response: Partial<RecommendationsResponseType>;
|
|
35
|
+
result_id: string;
|
|
45
36
|
}
|
|
46
37
|
|
|
47
|
-
interface
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
export interface RecommendationsRequestType extends Record<string, any> {
|
|
39
|
+
num_results: number;
|
|
40
|
+
item_id: string;
|
|
41
|
+
filters: {
|
|
42
|
+
group_id: string;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
pod_id: string;
|
|
55
46
|
}
|
|
56
47
|
|
|
57
|
-
interface
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
48
|
+
export interface RecommendationsResponseType extends Record<string, any> {
|
|
49
|
+
results: Partial<RecommendationsResultType>;
|
|
50
|
+
total_num_results: number;
|
|
51
|
+
pod: {
|
|
52
|
+
id: string;
|
|
53
|
+
display_name: string;
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
};
|
|
65
56
|
}
|
|
66
57
|
|
|
67
|
-
interface
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
58
|
+
export interface RecommendationsResultType extends Record<string, any> {
|
|
59
|
+
matched_terms: string[];
|
|
60
|
+
data: Record<string, any>;
|
|
61
|
+
value: string;
|
|
62
|
+
is_slotted: boolean;
|
|
63
|
+
labels: Record<string, any>;
|
|
64
|
+
strategy: {
|
|
65
|
+
id: string;
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
};
|
|
68
|
+
}
|
package/lib/types/search.d.ts
CHANGED
|
@@ -1,109 +1,103 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
ConstructorClientOptions,
|
|
3
|
+
Facet,
|
|
4
|
+
Feature,
|
|
5
|
+
FilterExpression,
|
|
6
|
+
FmtOption,
|
|
7
|
+
Group,
|
|
8
|
+
NetworkParameters,
|
|
9
|
+
RequestFeature,
|
|
10
|
+
RequestFeatureVariant,
|
|
11
|
+
ResultSources,
|
|
12
|
+
SortOption,
|
|
13
|
+
} from '.';
|
|
14
|
+
import EventDispatcher from './event-dispatcher';
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
* SEARCH
|
|
18
|
-
*
|
|
19
|
-
***********/
|
|
16
|
+
export default Search;
|
|
20
17
|
|
|
21
|
-
export
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
export interface SearchParameters {
|
|
19
|
+
page?: number;
|
|
20
|
+
offset?: number;
|
|
21
|
+
resultsPerPage?: number;
|
|
22
|
+
filters?: Record<string, any>;
|
|
23
|
+
sortBy?: string;
|
|
24
|
+
sortOrder?: string;
|
|
25
|
+
section?: string;
|
|
26
|
+
fmtOptions?: Record<string, any>;
|
|
27
|
+
preFilterExpression: FilterExpression;
|
|
28
|
+
hiddenFields?: string[];
|
|
29
|
+
hiddenFacets?: string[];
|
|
30
|
+
variationsMap?: Record<string, any>;
|
|
34
31
|
}
|
|
35
32
|
declare class Search {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
constructor(options: ConstructorClientOptions);
|
|
34
|
+
|
|
35
|
+
options: ConstructorClientOptions;
|
|
36
|
+
|
|
37
|
+
eventDispatcher: EventDispatcher;
|
|
38
|
+
|
|
39
|
+
getSearchResults(
|
|
40
|
+
query: string,
|
|
41
|
+
parameters?: SearchParameters,
|
|
42
|
+
networkParameters?: NetworkParameters
|
|
43
|
+
): Promise<SearchResponse>;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
facets: Partial<Facet>[];
|
|
56
|
-
groups: Partial<Group>[];
|
|
57
|
-
results: Partial<Result>[];
|
|
58
|
-
sort_options: Partial<SortOption>[];
|
|
59
|
-
refined_content: Record<string, any>[];
|
|
60
|
-
total_num_results: number;
|
|
61
|
-
features: Partial<Feature>[];
|
|
46
|
+
/** *********
|
|
47
|
+
* search results returned from server
|
|
48
|
+
********** */
|
|
49
|
+
export interface SearchResponse {
|
|
50
|
+
request: Partial<SearchRequestType>;
|
|
51
|
+
response: Partial<SearchResponseType | Redirect>;
|
|
52
|
+
result_id: string;
|
|
62
53
|
}
|
|
63
54
|
|
|
64
|
-
interface
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
features: Partial<RequestFeature>;
|
|
74
|
-
feature_variants: Partial<RequestFeatureVariant>;
|
|
75
|
-
searchandized_items: Record<string, any>;
|
|
55
|
+
export interface SearchResponseType extends Record<string, any> {
|
|
56
|
+
result_sources: Partial<ResultSources>;
|
|
57
|
+
facets: Partial<Facet>[];
|
|
58
|
+
groups: Partial<Group>[];
|
|
59
|
+
results: Partial<Result>[];
|
|
60
|
+
sort_options: Partial<SortOption>[];
|
|
61
|
+
refined_content: Record<string, any>[];
|
|
62
|
+
total_num_results: number;
|
|
63
|
+
features: Partial<Feature>[];
|
|
76
64
|
}
|
|
77
65
|
|
|
78
|
-
interface
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
66
|
+
export interface SearchRequestType extends Record<string, any> {
|
|
67
|
+
page: number;
|
|
68
|
+
num_results_per_page: number;
|
|
69
|
+
section: string;
|
|
70
|
+
blacklist_rules: boolean;
|
|
71
|
+
term: string;
|
|
72
|
+
fmt_options: Partial<FmtOption>;
|
|
73
|
+
sort_by: string;
|
|
74
|
+
sort_order: string;
|
|
75
|
+
features: Partial<RequestFeature>;
|
|
76
|
+
feature_variants: Partial<RequestFeatureVariant>;
|
|
77
|
+
searchandized_items: Record<string, any>;
|
|
88
78
|
}
|
|
89
79
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
80
|
+
export interface Result extends Record<string, any> {
|
|
81
|
+
matched_terms: string[];
|
|
82
|
+
data: {
|
|
83
|
+
id: string;
|
|
84
|
+
[key: string]: any;
|
|
85
|
+
};
|
|
86
|
+
value: string;
|
|
87
|
+
is_slotted: false;
|
|
88
|
+
labels: Record<string, any>;
|
|
89
|
+
variations: Record<string, any>[];
|
|
96
90
|
}
|
|
97
91
|
|
|
98
|
-
interface Redirect extends Record<string, any> {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
92
|
+
export interface Redirect extends Record<string, any> {
|
|
93
|
+
redirect: {
|
|
94
|
+
data: {
|
|
95
|
+
match_id: number;
|
|
96
|
+
rule_id: number;
|
|
97
|
+
url: string;
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
};
|
|
100
|
+
matched_terms: string[];
|
|
101
|
+
matched_user_segments: string[];
|
|
102
|
+
};
|
|
109
103
|
}
|