@constructor-io/constructorio-node 4.3.0 → 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.
@@ -0,0 +1,120 @@
1
+ import { expectAssignable } from 'tsd';
2
+ import { GetBrowseResultsResponse } from '../browse';
3
+
4
+ expectAssignable<GetBrowseResultsResponse>({
5
+ response: {
6
+ result_sources: {
7
+ token_match: {
8
+ count: 19,
9
+ },
10
+ embeddings_match: {
11
+ count: 0,
12
+ },
13
+ },
14
+ facets: [
15
+ {
16
+ display_name: 'pet',
17
+ name: 'pet',
18
+ type: 'multiple',
19
+ options: [
20
+ {
21
+ status: 'selected',
22
+ count: 12,
23
+ display_name: 'dog',
24
+ value: 'dog',
25
+ data: {},
26
+ },
27
+ ],
28
+ hidden: false,
29
+ data: {},
30
+ },
31
+ ],
32
+ results: [
33
+ {
34
+ matched_terms: [],
35
+ data: {
36
+ id: '123',
37
+ url: 'https://example',
38
+ brand: 'Bravecto',
39
+ price: 21.99,
40
+ item_name: 'Name',
41
+ image_url: 'https://example',
42
+ published: true,
43
+ variation_id: '123',
44
+ },
45
+ value: 'Name',
46
+ is_slotted: false,
47
+ labels: {},
48
+ variations: [
49
+ {
50
+ data: {
51
+ brand_slug: '123',
52
+ variation_id: '123',
53
+ },
54
+ value: '123',
55
+ },
56
+ ],
57
+ },
58
+ ],
59
+ sort_options: [
60
+ {
61
+ sort_by: 'item_name',
62
+ display_name: 'A - Z',
63
+ sort_order: 'descending',
64
+ status: '',
65
+ },
66
+ ],
67
+ refined_content: [],
68
+ total_num_results: 19,
69
+ features: [
70
+ {
71
+ feature_name: 'auto_generated_refined_query_rules',
72
+ display_name: 'Affinity Engine',
73
+ enabled: true,
74
+ variant: {
75
+ name: 'default_rules',
76
+ display_name: 'Default weights',
77
+ },
78
+ },
79
+ ],
80
+ },
81
+ result_id: 'e5941e13-f4ca-4efb-9326-893fd49b4e71',
82
+ request: {
83
+ page: 1,
84
+ num_results_per_page: 24,
85
+ filters: {
86
+ pet: ['dog', 'dog_&_cat'],
87
+ type: ['flea_&_tick'],
88
+ },
89
+ sort_by: 'relevance',
90
+ sort_order: 'descending',
91
+ browse_filter_name: 'group_id',
92
+ browse_filter_value: '123',
93
+ term: '',
94
+ fmt_options: {
95
+ groups_start: 'current',
96
+ groups_max_depth: 1,
97
+ },
98
+ section: 'Products',
99
+ features: {
100
+ query_items: true,
101
+ auto_generated_refined_query_rules: true,
102
+ manual_searchandizing: true,
103
+ personalization: true,
104
+ filter_items: true,
105
+ },
106
+ feature_variants: {
107
+ query_items: 'query_items_ctr_and_l2r',
108
+ auto_generated_refined_query_rules: 'default_rules',
109
+ manual_searchandizing: null,
110
+ personalization: 'default_personalization',
111
+ filter_items: 'filter_items_w_and_purchases',
112
+ },
113
+ filter_match_types: {
114
+ pet: 'any',
115
+ type: 'any',
116
+ },
117
+ searchandized_items: {},
118
+ },
119
+ ad_based: true,
120
+ });
@@ -0,0 +1,109 @@
1
+ import { expectAssignable } from 'tsd';
2
+ import {
3
+ FacetConfiguration,
4
+ FacetOptionConfiguration,
5
+ Item,
6
+ ItemGroup,
7
+ OneWaySynonymRelation,
8
+ RedirectRuleResponse,
9
+ Variation,
10
+ } from '..';
11
+
12
+ expectAssignable<Item>({
13
+ id: 'itemId',
14
+ name: 'Blue Shirt',
15
+ suggested_score: -1,
16
+ data: {
17
+ url: 'https://example.o',
18
+ facets: {
19
+ brand: ['Etch'],
20
+ },
21
+ group_ids: ['AP01', 'W676714', 'W678024'],
22
+ deactivated: false,
23
+ description: 'description',
24
+ topLevelCategory: 'Clearance',
25
+ },
26
+ });
27
+
28
+ expectAssignable<Variation>({
29
+ item_id: '728131de-e50a-4c95-adc3-9b8a37a426fb',
30
+ id: '01e17a49-8984-4bee-b137-a0b4e7f84d00',
31
+ name: 'product-01e17a49-8984-4bee-b137-a0b4e7f84d00',
32
+ suggested_score: -1,
33
+ data: {
34
+ url: 'https://constructor.io/products/',
35
+ brand: 'abc',
36
+ facets: {
37
+ color: ['blue'],
38
+ },
39
+ image_url: 'https://constructor.io/products/',
40
+ deactivated: false,
41
+ complexMetadataField: {
42
+ key1: 'val1',
43
+ key2: 'val2',
44
+ },
45
+ },
46
+ });
47
+
48
+ expectAssignable<ItemGroup>({
49
+ name: 'Group 433b2ba0-098e-447f-b772-8add363216eb',
50
+ id: 'group-433b2ba0-098e-447f-b772-8add363216eb',
51
+ data: null,
52
+ children: [],
53
+ });
54
+
55
+ expectAssignable<OneWaySynonymRelation>({
56
+ parent_phrase: 'phrase-1ac335a9-9cf4-4f21-b572-2a2aef27a192',
57
+ child_phrases: [
58
+ {
59
+ automatically_generated: false,
60
+ phrase: 'phrase-cddace02-02b4-462f-b8ed-cea41a18a8da',
61
+ created_at: '2022-12-12T13:58:44',
62
+ updated_at: '2022-12-12T13:58:44',
63
+ },
64
+ ],
65
+ });
66
+
67
+ expectAssignable<RedirectRuleResponse>({
68
+ id: 42492,
69
+ start_time: null,
70
+ end_time: null,
71
+ url: 'http://www.461c999c-365a-4925-89a2-2848b11cba2f.com',
72
+ user_segments: null,
73
+ metadata: null,
74
+ last_updated: '2022-12-14T22:44:32',
75
+ matches: [
76
+ {
77
+ id: 146617,
78
+ pattern: '461c999c-365a-4925-89a2-2848b11cba2f',
79
+ match_type: 'EXACT',
80
+ },
81
+ ],
82
+ });
83
+
84
+ expectAssignable<FacetConfiguration>({
85
+ name: 'facet-f664731d-9d84-4e82-bd2b-8528bb12d670',
86
+ display_name: 'Facet f664731d-9d84-4e82-bd2b-8528bb12d670',
87
+ sort_order: 'relevance',
88
+ sort_descending: true,
89
+ type: 'multiple',
90
+ range_type: null,
91
+ range_format: null,
92
+ range_inclusive: null,
93
+ bucket_size: null,
94
+ range_limits: null,
95
+ match_type: 'any',
96
+ position: null,
97
+ hidden: false,
98
+ protected: false,
99
+ data: {},
100
+ });
101
+
102
+ expectAssignable<FacetOptionConfiguration>({
103
+ value: 'facet-option-9c8e604b-b780-4264-9be2-c587fdcd8c33',
104
+ value_alias: null,
105
+ display_name: 'Facet Option 9c8e604b-b780-4264-9be2-c587fdcd8c33',
106
+ position: null,
107
+ data: null,
108
+ hidden: false,
109
+ });
@@ -0,0 +1,82 @@
1
+ import { expectAssignable } from 'tsd';
2
+ import { QuizResultsResponse, NextQuestionResponse } from '..';
3
+
4
+ expectAssignable<NextQuestionResponse>(
5
+ {
6
+ next_question: {
7
+ id: 2,
8
+ title: 'What do you want to ask',
9
+ description: 'Sample description',
10
+ type: 'multiple',
11
+ cta_text: 'Next',
12
+ images: {
13
+ primary_url: 'https://example.com/image',
14
+ primary_alt: 'Example image',
15
+ secondary_url: 'https://example.com/image',
16
+ secondary_alt: 'Example image',
17
+ },
18
+ options: [
19
+ {
20
+ id: 1,
21
+ value: 'Who',
22
+ attribute: {
23
+ name: 'group_id',
24
+ value: 'test-value',
25
+ },
26
+ },
27
+ {
28
+ id: 2,
29
+ value: 'What',
30
+ attribute: {
31
+ name: 'group_id',
32
+ value: 'test-value',
33
+ },
34
+ },
35
+ ],
36
+ },
37
+ version_id: '11db5ac7-67e1-4000-9000-414d8425cab3',
38
+ is_last_question: false,
39
+ },
40
+ );
41
+
42
+ expectAssignable<NextQuestionResponse>({
43
+ next_question: {
44
+ id: 1,
45
+ title: 'Sample open text question',
46
+ description: 'Sample description',
47
+ type: 'open',
48
+ cta_text: 'Next',
49
+ images: {
50
+ primary_url: 'https://example.com/image',
51
+ primary_alt: 'Example image',
52
+ secondary_url: 'https://example.com/image',
53
+ secondary_alt: 'Example image',
54
+ },
55
+ input_placeholder: 'Sample input placeholder',
56
+ },
57
+ version_id: '11db5ac7-67e1-4000-9000-414d8425cab3',
58
+ is_last_question: false,
59
+ });
60
+
61
+ expectAssignable<QuizResultsResponse>({
62
+ result: {
63
+ filter_expression: {
64
+ and: [
65
+ { name: 'group_id', value: 'W123456' },
66
+ {
67
+ or: [
68
+ { name: 'group_id', value: 'W95680' },
69
+ { name: 'group_id', value: 'W1338473' },
70
+ ],
71
+ },
72
+ {
73
+ or: [
74
+ { name: 'color', value: 'Blue' },
75
+ ],
76
+ },
77
+ ],
78
+ },
79
+ results_url: 'https://ac.cnstrc.com/browse/items?key=xaUaZEQHQWnrNZbq&num_results_per_page=10&collection_filter_expression=%3D%7B%22and%22%3A%5B%7B%22name%22%3A%22group_id%22%2C%22value%22%3A%22W123456%22%7D%2C%7B%22or%22%3A%5B%7B%22name%22%3A%22color%22%2C%22value%22%3A%22Purple%22%7D%2C%7B%22name%22%3A%22color%22%2C%22value%22%3A%22Black%22%7D%2C%7B%22name%22%3A%22color%22%2C%22value%22%3A%22Blue%22%7D%5D%7D%5D%7D',
80
+ },
81
+ version_id: '11db5ac7-67e1-4000-9000-414d8425cab3',
82
+ });
@@ -0,0 +1,45 @@
1
+ import { expectAssignable } from 'tsd';
2
+ import { RecommendationsResponse } from '../recommendations.d';
3
+
4
+ expectAssignable<RecommendationsResponse>({
5
+ request: {
6
+ num_results: 4,
7
+ item_id: '',
8
+ filters: {
9
+ group_id: '87552491555',
10
+ },
11
+ pod_id: 'collection_page_1',
12
+ },
13
+ response: {
14
+ results: [
15
+ {
16
+ matched_terms: [],
17
+ data: {
18
+ id: '123',
19
+ url: 'https://example',
20
+ group_ids: ['123', '1234'],
21
+ ListPrice: 30,
22
+ image_url: 'https://example',
23
+ facets: [
24
+ {
25
+ name: 'IsBestSeller',
26
+ values: ['False'],
27
+ },
28
+ ],
29
+ },
30
+ value: 'ABC',
31
+ is_slotted: false,
32
+ labels: {},
33
+ strategy: {
34
+ id: 'filtered_items',
35
+ },
36
+ },
37
+ ],
38
+ total_num_results: 12,
39
+ pod: {
40
+ id: 'collection_page_1',
41
+ display_name: 'Highly Rated Products',
42
+ },
43
+ },
44
+ result_id: '618c2aa1-b851-451f-b228-61d02bf7e3c5',
45
+ });
@@ -0,0 +1,124 @@
1
+ import { expectAssignable } from 'tsd';
2
+ import { SearchResponse } from '../search';
3
+
4
+ expectAssignable<SearchResponse>({
5
+ response: {
6
+ result_sources: {
7
+ token_match: {
8
+ count: 122,
9
+ },
10
+ embeddings_match: {
11
+ count: 0,
12
+ },
13
+ },
14
+ facets: [
15
+ {
16
+ display_name: 'price',
17
+ name: 'price',
18
+ data: {},
19
+ type: 'range',
20
+ hidden: false,
21
+ status: {},
22
+ min: 0.99,
23
+ max: 4799.99,
24
+ },
25
+ ],
26
+ groups: [
27
+ {
28
+ group_id: 'All',
29
+ display_name: 'All',
30
+ count: 454,
31
+ data: {},
32
+ children: [
33
+ {
34
+ group_id: '123',
35
+ display_name: '123',
36
+ count: 62,
37
+ data: {},
38
+ children: [],
39
+ parents: [
40
+ {
41
+ display_name: 'All',
42
+ group_id: 'All',
43
+ },
44
+ ],
45
+ },
46
+ ],
47
+ parents: [],
48
+ },
49
+ ],
50
+ results: [
51
+ {
52
+ matched_terms: ['red'],
53
+ data: {
54
+ id: '123',
55
+ url: 'https://example',
56
+ keywords: ['Red Rock'],
57
+ image_url: 'https://example',
58
+ group_ids: ['123', '1234'],
59
+ },
60
+ value: '123',
61
+ is_slotted: false,
62
+ labels: {},
63
+ variations: [
64
+ {
65
+ data: {
66
+ variation_id: '123',
67
+ },
68
+ value: '123',
69
+ },
70
+ ],
71
+ },
72
+ ],
73
+ sort_options: [
74
+ {
75
+ sort_by: 'relevance',
76
+ display_name: 'Relevance',
77
+ sort_order: 'descending',
78
+ status: 'selected',
79
+ },
80
+ ],
81
+ refined_content: [],
82
+ total_num_results: 454,
83
+ features: [
84
+ {
85
+ feature_name: 'auto_generated_refined_query_rules',
86
+ display_name: 'Affinity Engine',
87
+ enabled: true,
88
+ variant: {
89
+ name: 'default_rules',
90
+ display_name: 'Default weights',
91
+ },
92
+ },
93
+ ],
94
+ },
95
+ result_id: 'dda3208c-0f0c-412e-92d9-7abf1d21e228',
96
+ request: {
97
+ page: 1,
98
+ num_results_per_page: 50,
99
+ section: 'Products',
100
+ blacklist_rules: true,
101
+ term: 'red',
102
+ fmt_options: {
103
+ groups_start: 'current',
104
+ groups_max_depth: 1,
105
+ },
106
+ sort_by: 'relevance',
107
+ sort_order: 'descending',
108
+ features: {
109
+ query_items: true,
110
+ auto_generated_refined_query_rules: true,
111
+ manual_searchandizing: true,
112
+ personalization: true,
113
+ filter_items: true,
114
+ },
115
+ feature_variants: {
116
+ query_items: 'query_items_ctr_l2r_ctr_ss',
117
+ auto_generated_refined_query_rules: 'default_rules',
118
+ manual_searchandizing: null,
119
+ personalization: 'default_personalization',
120
+ filter_items: 'filter_items_w_and_purchases',
121
+ },
122
+ searchandized_items: {},
123
+ },
124
+ });
@@ -0,0 +1,40 @@
1
+ import { expectAssignable } from 'tsd';
2
+ import { Task, TasksResponseType } from '../tasks';
3
+
4
+ expectAssignable<TasksResponseType>({
5
+ tasks: [
6
+ {
7
+ id: 42386186,
8
+ status: 'IN_PROGRESS',
9
+ submission_time: '2022-12-14T23:16:22Z',
10
+ last_update: '2022-12-14T23:16:23Z',
11
+ start_time: '2022-12-14T23:16:23Z',
12
+ filename: 'key_fuErI2yBJPxKT0uF_Products_sync_2022-12-14-23-16-22.tar',
13
+ type: 'ingestion',
14
+ protocol: 'http',
15
+ bucket_name: 'constructor-io',
16
+ object_key: 'ingestion/catalogs/prod/companies/1812/key_fuErI2yBJPxKT0uF_Products_sync_2022-12-14-23-16-22.tar',
17
+ },
18
+ ],
19
+ total_count: 40,
20
+ status_counts: {
21
+ QUEUED: 0,
22
+ IN_PROGRESS: 0,
23
+ DONE: 38,
24
+ FAILED: 2,
25
+ CANCELED: 0,
26
+ },
27
+ });
28
+
29
+ expectAssignable<Task>({
30
+ id: 42386186,
31
+ status: 'IN_PROGRESS',
32
+ submission_time: '2022-12-14T23:16:22Z',
33
+ last_update: '2022-12-14T23:16:23Z',
34
+ start_time: '2022-12-14T23:16:23Z',
35
+ filename: 'key_fuErI2yBJPxKT0uF_Products_sync_2022-12-14-23-16-22.tar',
36
+ type: 'ingestion',
37
+ protocol: 'http',
38
+ bucket_name: 'constructor-io',
39
+ object_key: 'ingestion/catalogs/prod/companies/1812/key_fuErI2yBJPxKT0uF_Products_sync_2022-12-14-23-16-22.tar',
40
+ });