@constructor-io/constructorio-client-javascript 2.29.0 → 2.29.2
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/tracker.js +27 -12
- package/package.json +1 -1
package/lib/modules/tracker.js
CHANGED
|
@@ -187,34 +187,43 @@ var Tracker = /*#__PURE__*/function () {
|
|
|
187
187
|
|
|
188
188
|
// Ensure parameters are provided (required)
|
|
189
189
|
if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
|
|
190
|
-
var
|
|
191
|
-
var queryParams = {
|
|
192
|
-
|
|
193
|
-
};
|
|
190
|
+
var requestUrlPath = "".concat(this.options.serviceUrl, "/v2/behavioral_action/item_detail_load?");
|
|
191
|
+
var queryParams = {};
|
|
192
|
+
var bodyParams = {};
|
|
194
193
|
var item_name = parameters.item_name,
|
|
195
194
|
name = parameters.name,
|
|
196
195
|
item_id = parameters.item_id,
|
|
197
196
|
customer_id = parameters.customer_id,
|
|
198
|
-
variation_id = parameters.variation_id
|
|
197
|
+
variation_id = parameters.variation_id,
|
|
198
|
+
url = parameters.url; // Ensure support for both item_name and name as parameters
|
|
199
199
|
|
|
200
200
|
if (item_name) {
|
|
201
|
-
|
|
201
|
+
bodyParams.item_name = item_name;
|
|
202
202
|
} else if (name) {
|
|
203
|
-
|
|
203
|
+
bodyParams.item_name = name;
|
|
204
204
|
} // Ensure support for both item_id and customer_id as parameters
|
|
205
205
|
|
|
206
206
|
|
|
207
207
|
if (item_id) {
|
|
208
|
-
|
|
208
|
+
bodyParams.item_id = item_id;
|
|
209
209
|
} else if (customer_id) {
|
|
210
|
-
|
|
210
|
+
bodyParams.item_id = customer_id;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
if (variation_id) {
|
|
214
|
-
|
|
214
|
+
bodyParams.variation_id = variation_id;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
if (url) {
|
|
218
|
+
bodyParams.url = url;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
var requestURL = "".concat(requestUrlPath).concat(applyParamsAsString(queryParams, this.options));
|
|
222
|
+
var requestMethod = 'POST';
|
|
223
|
+
var requestBody = applyParams(bodyParams, _objectSpread(_objectSpread({}, this.options), {}, {
|
|
224
|
+
requestMethod: requestMethod
|
|
225
|
+
}));
|
|
226
|
+
this.requests.queue(requestURL, requestMethod, requestBody, networkParameters);
|
|
218
227
|
this.requests.send();
|
|
219
228
|
return true;
|
|
220
229
|
}
|
|
@@ -439,6 +448,7 @@ var Tracker = /*#__PURE__*/function () {
|
|
|
439
448
|
* @param {string} parameters.item_id - Product item unique identifier
|
|
440
449
|
* @param {string} [parameters.variation_id] - Product item variation unique identifier
|
|
441
450
|
* @param {string} [parameters.result_id] - Search result identifier (returned in response from Constructor)
|
|
451
|
+
* @param {string} [parameters.item_is_convertible] - Whether or not an item is available for a conversion
|
|
442
452
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
443
453
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
444
454
|
* @returns {(true|Error)}
|
|
@@ -470,7 +480,8 @@ var Tracker = /*#__PURE__*/function () {
|
|
|
470
480
|
item_id = parameters.item_id,
|
|
471
481
|
customer_id = parameters.customer_id,
|
|
472
482
|
variation_id = parameters.variation_id,
|
|
473
|
-
result_id = parameters.result_id
|
|
483
|
+
result_id = parameters.result_id,
|
|
484
|
+
item_is_convertible = parameters.item_is_convertible; // Ensure support for both item_name and name as parameters
|
|
474
485
|
|
|
475
486
|
if (item_name) {
|
|
476
487
|
queryParams.name = item_name;
|
|
@@ -493,6 +504,10 @@ var Tracker = /*#__PURE__*/function () {
|
|
|
493
504
|
queryParams.result_id = result_id;
|
|
494
505
|
}
|
|
495
506
|
|
|
507
|
+
if (typeof item_is_convertible === 'boolean') {
|
|
508
|
+
queryParams.item_is_convertible = item_is_convertible;
|
|
509
|
+
}
|
|
510
|
+
|
|
496
511
|
this.requests.queue("".concat(url).concat(applyParamsAsString(queryParams, this.options)), undefined, undefined, networkParameters);
|
|
497
512
|
this.requests.send();
|
|
498
513
|
return true;
|