@constructor-io/constructorio-client-javascript 2.27.7 → 2.27.10

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.
@@ -159,6 +159,69 @@ var Tracker = /*#__PURE__*/function () {
159
159
  this.requests.send();
160
160
  return true;
161
161
  }
162
+ /**
163
+ * Send item detail load event to API
164
+ *
165
+ * @function trackItemDetailLoad
166
+ * @param {object} parameters - Additional parameters to be sent with request
167
+ * @param {string} parameters.item_name - Product item name
168
+ * @param {string} parameters.item_id - Product item unique identifier
169
+ * @param {string} [parameters.variation_id] - Product item variation unique identifier
170
+ * @param {object} [networkParameters] - Parameters relevant to the network request
171
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
172
+ * @returns {(true|Error)}
173
+ * @description User loaded an item detail page
174
+ * @example
175
+ * constructorio.tracker.trackItemDetailLoad(
176
+ * {
177
+ * item_name: 'Red T-Shirt',
178
+ * item_id: 'KMH876',
179
+ * },
180
+ * );
181
+ */
182
+
183
+ }, {
184
+ key: "trackItemDetailLoad",
185
+ value: function trackItemDetailLoad(parameters) {
186
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
187
+
188
+ // Ensure parameters are provided (required)
189
+ if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
190
+ var url = "".concat(this.options.serviceUrl, "/behavior?");
191
+ var queryParams = {
192
+ action: 'item_detail_load'
193
+ };
194
+ var item_name = parameters.item_name,
195
+ name = parameters.name,
196
+ item_id = parameters.item_id,
197
+ customer_id = parameters.customer_id,
198
+ variation_id = parameters.variation_id; // Ensure support for both item_name and name as parameters
199
+
200
+ if (item_name) {
201
+ queryParams.name = item_name;
202
+ } else if (name) {
203
+ queryParams.name = name;
204
+ } // Ensure support for both item_id and customer_id as parameters
205
+
206
+
207
+ if (item_id) {
208
+ queryParams.customer_id = item_id;
209
+ } else if (customer_id) {
210
+ queryParams.customer_id = customer_id;
211
+ }
212
+
213
+ if (variation_id) {
214
+ queryParams.variation_id = variation_id;
215
+ }
216
+
217
+ this.requests.queue("".concat(url).concat(applyParamsAsString(queryParams, this.options)), undefined, undefined, networkParameters);
218
+ this.requests.send();
219
+ return true;
220
+ }
221
+
222
+ this.requests.send();
223
+ return new Error('parameters are required of type object');
224
+ }
162
225
  /**
163
226
  * Send autocomplete select event to API
164
227
  *
@@ -456,7 +519,7 @@ var Tracker = /*#__PURE__*/function () {
456
519
  * @param {boolean} [parameters.is_custom_type] - Specify if type is custom conversion type
457
520
  * @param {string} [parameters.display_name] - Display name for the custom conversion type
458
521
  * @param {string} [parameters.result_id] - Result identifier (returned in response from Constructor)
459
- * @param {string} [parameters.section] - Index section
522
+ * @param {string} [parameters.section="Products"] - Index section
460
523
  * @param {object} [networkParameters] - Parameters relevant to the network request
461
524
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
462
525
  * @returns {(true|Error)}
@@ -563,7 +626,7 @@ var Tracker = /*#__PURE__*/function () {
563
626
  * @param {object[]} parameters.items - List of product item objects
564
627
  * @param {number} parameters.revenue - The subtotal (not including taxes, shipping, etc.) of the entire order
565
628
  * @param {string} [parameters.order_id] - Unique order identifier
566
- * @param {string} [parameters.section] - Index section
629
+ * @param {string} [parameters.section="Products"] - Index section
567
630
  * @param {object} [networkParameters] - Parameters relevant to the network request
568
631
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
569
632
  * @returns {(true|Error)}
@@ -843,7 +906,7 @@ var Tracker = /*#__PURE__*/function () {
843
906
  * @param {number} [parameters.result_count] - Total number of results
844
907
  * @param {number} [parameters.result_page] - Page number of results
845
908
  * @param {string} [parameters.result_id] - Browse result identifier (returned in response from Constructor)
846
- * @param {string} [parameters.selected_filters] - Selected filters
909
+ * @param {object} [parameters.selected_filters] - Selected filters
847
910
  * @param {string} [parameters.sort_order] - Sort order ('ascending' or 'descending')
848
911
  * @param {string} [parameters.sort_by] - Sorting method
849
912
  * @param {object[]} [parameters.items] - List of product item objects
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-client-javascript",
3
- "version": "2.27.7",
3
+ "version": "2.27.10",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "scripts": {
@@ -61,7 +61,7 @@
61
61
  "sinon-chai": "^3.7.0"
62
62
  },
63
63
  "dependencies": {
64
- "@constructor-io/constructorio-id": "^2.4.9",
64
+ "@constructor-io/constructorio-id": "^2.4.10",
65
65
  "crc-32": "^1.2.0",
66
66
  "es6-promise": "^4.2.8",
67
67
  "events": "^3.0.0",