@constructor-io/constructorio-client-javascript 2.36.0 → 2.36.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.
@@ -1935,7 +1935,6 @@ var Tracker = /*#__PURE__*/function () {
1935
1935
  bodyParams.result_page = resultPage;
1936
1936
  }
1937
1937
 
1938
- bodyParams.action_class = 'result_load';
1939
1938
  var requestURL = "".concat(requestPath).concat(applyParamsAsString(queryParams, this.options));
1940
1939
  var requestMethod = 'POST';
1941
1940
  var requestBody = applyParams(bodyParams, _objectSpread(_objectSpread({}, this.options), {}, {
@@ -1959,6 +1958,7 @@ var Tracker = /*#__PURE__*/function () {
1959
1958
  * @param {string} parameters.quizSessionId - Quiz session identifier associated with this conversion event
1960
1959
  * @param {string} [parameters.itemId] - Product item unique identifier (Either itemId or itemName is required)
1961
1960
  * @param {string} [parameters.itemName] - Product item name
1961
+ * @param {string} [parameters.variationId] - Product variation unique identifier
1962
1962
  * @param {string} [parameters.section='Products'] - Index section
1963
1963
  * @param {number} [parameters.resultCount] - Total number of results
1964
1964
  * @param {number} [parameters.resultPage] - The page of the results
@@ -1977,6 +1977,7 @@ var Tracker = /*#__PURE__*/function () {
1977
1977
  * quizSessionId: '123',
1978
1978
  * itemId: '123',
1979
1979
  * itemName: 'espresso'
1980
+ * variationId: '733431',
1980
1981
  * },
1981
1982
  * );
1982
1983
  */
@@ -2021,7 +2022,8 @@ var Tracker = /*#__PURE__*/function () {
2021
2022
  _parameters$resultPos4 = parameters.resultPositionOnPage,
2022
2023
  resultPositionOnPage = _parameters$resultPos4 === void 0 ? result_position_on_page : _parameters$resultPos4,
2023
2024
  _parameters$section8 = parameters.section,
2024
- section = _parameters$section8 === void 0 ? 'Products' : _parameters$section8;
2025
+ section = _parameters$section8 === void 0 ? 'Products' : _parameters$section8,
2026
+ variationId = parameters.variationId;
2025
2027
  var queryParams = {};
2026
2028
  var bodyParams = {};
2027
2029
 
@@ -2061,6 +2063,14 @@ var Tracker = /*#__PURE__*/function () {
2061
2063
  bodyParams.item_name = itemName;
2062
2064
  }
2063
2065
 
2066
+ if (!helpers.isNil(variationId)) {
2067
+ if (typeof variationId !== 'string') {
2068
+ return new Error('"variationId" must be a string');
2069
+ }
2070
+
2071
+ bodyParams.variation_id = variationId;
2072
+ }
2073
+
2064
2074
  if (!helpers.isNil(section)) {
2065
2075
  if (typeof section !== 'string') {
2066
2076
  return new Error('"section" must be a string');
@@ -2109,7 +2119,6 @@ var Tracker = /*#__PURE__*/function () {
2109
2119
  bodyParams.result_position_on_page = resultPositionOnPage;
2110
2120
  }
2111
2121
 
2112
- bodyParams.action_class = 'result_click';
2113
2122
  var requestURL = "".concat(requestPath).concat(applyParamsAsString(queryParams, this.options));
2114
2123
  var requestMethod = 'POST';
2115
2124
  var requestBody = applyParams(bodyParams, _objectSpread(_objectSpread({}, this.options), {}, {
@@ -2281,7 +2290,6 @@ var Tracker = /*#__PURE__*/function () {
2281
2290
  bodyParams.display_name = displayName;
2282
2291
  }
2283
2292
 
2284
- bodyParams.action_class = 'conversion';
2285
2293
  var requestURL = "".concat(requestPath).concat(applyParamsAsString(queryParams, this.options));
2286
2294
  var requestMethod = 'POST';
2287
2295
  var requestBody = applyParams(bodyParams, _objectSpread(_objectSpread({}, this.options), {}, {
@@ -210,6 +210,7 @@ declare class Tracker {
210
210
  quizSessionId: string;
211
211
  itemId?: string;
212
212
  itemName?: string;
213
+ variationId?: string;
213
214
  section?: string;
214
215
  resultCount?: number;
215
216
  resultPage?: number;
@@ -0,0 +1,126 @@
1
+ import EventDispatcher from './event-dispatcher';
2
+
3
+ export interface ConstructorClientOptions {
4
+ apiKey: string;
5
+ version?: string;
6
+ serviceUrl?: string;
7
+ // session id is of type string in jsdocs but of type number in code usage
8
+ sessionId?: string;
9
+ clientId?: string;
10
+ userId?: string;
11
+ segments?: string[];
12
+ testCells?: Record<string, string>;
13
+ fetch?: any;
14
+ trackingSendDelay?: number;
15
+ sendTrackingEvents?: boolean;
16
+ sendReferrerWithTrackingEvents?: boolean;
17
+ eventDispatcher?: EventDispatcher;
18
+ beaconMode?: boolean;
19
+ networkParameters?: {
20
+ timeout: number;
21
+ };
22
+ }
23
+
24
+ export interface RequestFeature extends Record<string, any> {
25
+ query_items: boolean;
26
+ auto_generated_refined_query_rules: boolean;
27
+ manual_searchandizing: boolean;
28
+ personalization: boolean;
29
+ filter_items: boolean;
30
+ }
31
+
32
+ export interface RequestFeatureVariant extends Record<string, any> {
33
+ query_items: string;
34
+ auto_generated_refined_query_rules: string;
35
+ manual_searchandizing: string | null;
36
+ personalization: string;
37
+ filter_items: string;
38
+ }
39
+
40
+ export type ErrorData = {
41
+ message: string;
42
+ [key: string]: any;
43
+ };
44
+
45
+ export interface ResultSources extends Record<string, any> {
46
+ token_match: { count: number; [key: string]: any };
47
+ embeddings_match: { count: number; [key: string]: any };
48
+ }
49
+
50
+ export interface SortOption extends Record<string, any> {
51
+ sort_by: string;
52
+ display_name: string;
53
+ sort_order: string;
54
+ status: string;
55
+ }
56
+
57
+ export interface Feature extends Record<string, any> {
58
+ feature_name: string;
59
+ display_name: string;
60
+ enabled: boolean;
61
+ variant: {
62
+ name: string;
63
+ display_name: string;
64
+ [key: string]: any;
65
+ };
66
+ }
67
+
68
+ export interface FmtOption extends Record<string, any> {
69
+ groups_start: string;
70
+ groups_max_depth: number;
71
+ }
72
+
73
+ type Facet = RangeFacet | OptionFacet;
74
+
75
+ export interface BaseFacet extends Record<string, any> {
76
+ data: Record<string, any>;
77
+ status: Record<string, any>;
78
+ display_name: string;
79
+ name: string;
80
+ hidden: boolean;
81
+ }
82
+
83
+ export interface RangeFacet extends BaseFacet, Record<string, any> {
84
+ max: number;
85
+ min: number;
86
+ type: "range";
87
+ }
88
+
89
+ export interface OptionFacet extends BaseFacet, Record<string, any> {
90
+ options: FacetOption[];
91
+ type: "multiple" | "single" | "hierarchical";
92
+ }
93
+
94
+ export interface FacetOption extends Record<string, any> {
95
+ count: number;
96
+ display_name: string;
97
+ value: string;
98
+ options?: FacetOption[];
99
+ range?: ["-inf" | number, "inf" | number];
100
+ status: string;
101
+ }
102
+
103
+ export interface Group extends BaseGroup, Record<string, any> {
104
+ count: number;
105
+ data: Record<string, any>;
106
+ parents: BaseGroup[];
107
+ children: Group[];
108
+ }
109
+
110
+ export interface Collection extends Record<string, any> {
111
+ collection_id: string,
112
+ display_name: string,
113
+ data: Record<string, any>
114
+ }
115
+
116
+ export interface BaseGroup extends Record<string, any> {
117
+ display_name: string;
118
+ group_id: string;
119
+ }
120
+
121
+ export interface FmtOptions extends Record<string, any> {
122
+
123
+ }
124
+
125
+ export type Nullable<T> = T | null;
126
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-client-javascript",
3
- "version": "2.36.0",
3
+ "version": "2.36.1",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/constructorio.d.ts",