@constructor-io/constructorio-client-javascript 2.72.2 → 2.73.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/lib/types/browse.d.ts +37 -23
- package/lib/types/index.d.ts +26 -10
- package/lib/types/recommendations.d.ts +1 -1
- package/lib/types/search.d.ts +13 -21
- package/lib/version.js +1 -1
- package/package.json +1 -1
package/lib/types/browse.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BrowseFacet,
|
|
2
3
|
Collection,
|
|
3
4
|
ConstructorClientOptions,
|
|
4
5
|
Facet,
|
|
@@ -31,7 +32,7 @@ export interface IBrowseParameters {
|
|
|
31
32
|
hiddenFacets?: string[];
|
|
32
33
|
variationsMap?: VariationsMap;
|
|
33
34
|
qsParam?: Record<string, any>;
|
|
34
|
-
filterMatchTypes?: Record<string, 'all'| 'any' | 'none'
|
|
35
|
+
filterMatchTypes?: Record<string, 'all' | 'any' | 'none'>;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
declare class Browse {
|
|
@@ -77,40 +78,52 @@ declare class Browse {
|
|
|
77
78
|
/** *********
|
|
78
79
|
* Browse results returned from server
|
|
79
80
|
********** */
|
|
80
|
-
export interface BrowseResponse<ResponseType
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
export interface BrowseResponse<ResponseType, OmittedRequestFields extends keyof BrowseRequestType>
|
|
82
|
+
extends Record<string, any> {
|
|
83
|
+
|
|
84
|
+
request: Omit<BrowseRequestType, OmittedRequestFields>;
|
|
85
|
+
response: ResponseType;
|
|
86
|
+
result_id: string;
|
|
84
87
|
ad_based?: boolean;
|
|
85
88
|
}
|
|
86
89
|
|
|
87
90
|
export type GetBrowseResultsResponse =
|
|
88
|
-
BrowseResponse<GetBrowseResultsResponseData>;
|
|
91
|
+
BrowseResponse<GetBrowseResultsResponseData, 'facet_name'>;
|
|
89
92
|
export type GetBrowseResultsForItemIdsResponse =
|
|
90
|
-
BrowseResponse<GetBrowseResultsResponseData>;
|
|
93
|
+
BrowseResponse<GetBrowseResultsResponseData, 'facet_name'>;
|
|
91
94
|
export type GetBrowseGroupsResponse = BrowseResponse<
|
|
92
95
|
Pick<
|
|
93
96
|
GetBrowseResultsResponseData,
|
|
94
97
|
'result_sources' | 'groups' | 'refined_content'
|
|
95
|
-
|
|
98
|
+
>,
|
|
99
|
+
'browse_filter_name' | 'browse_filter_value' | 'searchandized_items' | 'facet_name'
|
|
96
100
|
>;
|
|
97
101
|
export type GetBrowseFacetsResponse = BrowseResponse<
|
|
98
|
-
|
|
102
|
+
GetBrowseFacetsResultsResponseData,
|
|
103
|
+
'browse_filter_name' | 'browse_filter_value' | 'searchandized_items' | 'facet_name'
|
|
99
104
|
>;
|
|
100
105
|
export type GetBrowseFacetOptionsResponse = BrowseResponse<
|
|
101
|
-
Pick<GetBrowseResultsResponseData, 'facets'
|
|
106
|
+
Pick<GetBrowseResultsResponseData, 'facets' | 'total_num_results'>,
|
|
107
|
+
'browse_filter_name' | 'browse_filter_value' | 'searchandized_items'
|
|
102
108
|
>;
|
|
103
109
|
|
|
104
110
|
export interface GetBrowseResultsResponseData extends Record<string, any> {
|
|
105
|
-
result_sources:
|
|
106
|
-
facets:
|
|
107
|
-
groups:
|
|
108
|
-
results:
|
|
109
|
-
sort_options:
|
|
111
|
+
result_sources: ResultSources;
|
|
112
|
+
facets: Facet[];
|
|
113
|
+
groups: Group[];
|
|
114
|
+
results: BrowseResultData[];
|
|
115
|
+
sort_options: SortOption[];
|
|
110
116
|
refined_content: Record<string, any>[];
|
|
111
117
|
total_num_results: number;
|
|
112
|
-
features:
|
|
113
|
-
collection
|
|
118
|
+
features: Feature[];
|
|
119
|
+
collection?: Partial<Collection>;
|
|
120
|
+
related_searches?: Record<string, any>[];
|
|
121
|
+
related_browse_pages?: Record<string, any>[];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface GetBrowseFacetsResultsResponseData extends Record<string, any> {
|
|
125
|
+
facets: BrowseFacet[];
|
|
126
|
+
total_num_results: number;
|
|
114
127
|
}
|
|
115
128
|
|
|
116
129
|
export interface BrowseResultData extends Record<string, any> {
|
|
@@ -122,23 +135,24 @@ export interface BrowseResultData extends Record<string, any> {
|
|
|
122
135
|
value: string;
|
|
123
136
|
is_slotted: false;
|
|
124
137
|
labels: Record<string, any>;
|
|
125
|
-
variations
|
|
126
|
-
variations_map
|
|
138
|
+
variations?: Record<string, any>[];
|
|
139
|
+
variations_map?: Record<string, any> | Record<string, any>[];
|
|
127
140
|
}
|
|
128
141
|
|
|
129
142
|
export interface BrowseRequestType extends Record<string, any> {
|
|
130
143
|
browse_filter_name: string;
|
|
131
144
|
browse_filter_value: string;
|
|
132
|
-
filter_match_types
|
|
133
|
-
filters
|
|
134
|
-
fmt_options:
|
|
145
|
+
filter_match_types?: Record<string, any>;
|
|
146
|
+
filters?: Record<string, any>;
|
|
147
|
+
fmt_options: FmtOptions;
|
|
148
|
+
facet_name: string;
|
|
135
149
|
num_results_per_page: number;
|
|
136
150
|
page: number;
|
|
137
151
|
section: string;
|
|
138
152
|
sort_by: string;
|
|
139
153
|
sort_order: string;
|
|
140
154
|
term: string;
|
|
141
|
-
query
|
|
155
|
+
query?: string;
|
|
142
156
|
features: Partial<RequestFeature>;
|
|
143
157
|
feature_variants: Partial<RequestFeatureVariant>;
|
|
144
158
|
searchandized_items: Record<string, any>;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ export interface SortOption extends Record<string, any> {
|
|
|
97
97
|
display_name: string;
|
|
98
98
|
sort_order: string;
|
|
99
99
|
status: string;
|
|
100
|
+
hidden: boolean;
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
export interface Feature extends Record<string, any> {
|
|
@@ -110,44 +111,59 @@ export interface Feature extends Record<string, any> {
|
|
|
110
111
|
} | null;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
|
-
export type Facet = RangeFacet | OptionFacet;
|
|
114
|
+
export type Facet = RangeFacet | OptionFacet | HierarchicalOptionFacet;
|
|
115
|
+
|
|
116
|
+
export type BrowseFacet = Pick<Facet, keyof BaseFacet | 'type'>;
|
|
114
117
|
|
|
115
118
|
export interface BaseFacet extends Record<string, any> {
|
|
116
119
|
data: Record<string, any>;
|
|
117
|
-
status: Record<string, any>;
|
|
118
120
|
display_name: string;
|
|
119
121
|
name: string;
|
|
120
122
|
hidden: boolean;
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
export interface RangeFacet extends BaseFacet, Record<string, any> {
|
|
124
|
-
max:
|
|
125
|
-
|
|
126
|
+
status?: { min: RangeMin, max: RangeMax };
|
|
127
|
+
max: RangeMax;
|
|
128
|
+
min: RangeMin;
|
|
126
129
|
type: 'range';
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
export interface OptionFacet extends BaseFacet, Record<string, any> {
|
|
130
133
|
options: FacetOption[];
|
|
131
|
-
type: 'multiple' | 'single'
|
|
134
|
+
type: 'multiple' | 'single';
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface HierarchicalOptionFacet extends BaseFacet, Record<string, any> {
|
|
138
|
+
options: HierarchicalFacetOption[];
|
|
139
|
+
type: 'hierarchical';
|
|
132
140
|
}
|
|
133
141
|
|
|
134
142
|
export interface FacetOption extends Record<string, any> {
|
|
135
143
|
count: number;
|
|
136
144
|
display_name: string;
|
|
137
145
|
value: string;
|
|
138
|
-
|
|
139
|
-
range?: ['-inf' | number, 'inf' | number];
|
|
146
|
+
range?: [RangeMin, RangeMax];
|
|
140
147
|
status: string;
|
|
148
|
+
data: Record<string, any>;
|
|
141
149
|
}
|
|
142
150
|
|
|
151
|
+
export interface HierarchicalFacetOption extends FacetOption {
|
|
152
|
+
options?: HierarchicalFacetOption[];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export type RangeMin = '-inf' | number;
|
|
156
|
+
export type RangeMax = '+inf' | 'inf' | number
|
|
157
|
+
|
|
143
158
|
export interface Group extends BaseGroup, Record<string, any> {
|
|
144
|
-
count
|
|
159
|
+
count: number;
|
|
145
160
|
data?: Record<string, any>;
|
|
146
|
-
parents
|
|
147
|
-
children
|
|
161
|
+
parents: BaseGroup[];
|
|
162
|
+
children: Group[];
|
|
148
163
|
}
|
|
149
164
|
|
|
150
165
|
export interface Collection extends Record<string, any> {
|
|
166
|
+
// documentation says this field is called `id`
|
|
151
167
|
collection_id: string;
|
|
152
168
|
display_name: string;
|
|
153
169
|
data: Record<string, any>;
|
|
@@ -40,7 +40,7 @@ export interface RecommendationsResponse extends Record<string, any> {
|
|
|
40
40
|
|
|
41
41
|
export interface RecommendationsRequestType extends Record<string, any> {
|
|
42
42
|
num_results: number;
|
|
43
|
-
item_id: string;
|
|
43
|
+
item_id: string | string[];
|
|
44
44
|
filters: {
|
|
45
45
|
group_id: string;
|
|
46
46
|
[key: string]: any;
|
package/lib/types/search.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
BrowseResultData,
|
|
2
3
|
ConstructorClientOptions,
|
|
3
4
|
Facet,
|
|
4
5
|
Feature,
|
|
@@ -56,27 +57,29 @@ declare class Search {
|
|
|
56
57
|
* search results returned from server
|
|
57
58
|
********** */
|
|
58
59
|
export interface SearchResponse {
|
|
59
|
-
request:
|
|
60
|
-
response:
|
|
60
|
+
request: SearchRequestType;
|
|
61
|
+
response: SearchResponseType | Redirect;
|
|
61
62
|
result_id: string;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
export interface SearchResponseType extends Record<string, any> {
|
|
65
|
-
result_sources:
|
|
66
|
-
facets:
|
|
67
|
-
groups:
|
|
68
|
-
results:
|
|
69
|
-
sort_options:
|
|
66
|
+
result_sources: ResultSources;
|
|
67
|
+
facets: Facet[];
|
|
68
|
+
groups: Group[];
|
|
69
|
+
results: Result[];
|
|
70
|
+
sort_options: SortOption[];
|
|
70
71
|
refined_content: Record<string, any>[];
|
|
71
72
|
total_num_results: number;
|
|
72
|
-
features:
|
|
73
|
+
features: Feature[];
|
|
74
|
+
related_searches?: Record<string, any>[];
|
|
75
|
+
related_browse_pages?: Record<string, any>[];
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
export interface SearchRequestType extends Record<string, any> {
|
|
76
79
|
page: number;
|
|
77
80
|
num_results_per_page: number;
|
|
78
81
|
section: string;
|
|
79
|
-
blacklist_rules
|
|
82
|
+
blacklist_rules?: boolean;
|
|
80
83
|
term: string;
|
|
81
84
|
fmt_options: FmtOptions;
|
|
82
85
|
sort_by: string;
|
|
@@ -89,18 +92,7 @@ export interface SearchRequestType extends Record<string, any> {
|
|
|
89
92
|
pre_filter_expression?: FilterExpression;
|
|
90
93
|
}
|
|
91
94
|
|
|
92
|
-
export
|
|
93
|
-
matched_terms: string[];
|
|
94
|
-
data: {
|
|
95
|
-
id: string;
|
|
96
|
-
[key: string]: any;
|
|
97
|
-
};
|
|
98
|
-
value: string;
|
|
99
|
-
is_slotted: false;
|
|
100
|
-
labels: Record<string, any>;
|
|
101
|
-
variations: Record<string, any>[];
|
|
102
|
-
variations_map: Record<string, any> | Record<string, any>[];
|
|
103
|
-
}
|
|
95
|
+
export type Result = BrowseResultData;
|
|
104
96
|
|
|
105
97
|
export interface Redirect extends Record<string, any> {
|
|
106
98
|
redirect: {
|
package/lib/version.js
CHANGED