@constructor-io/constructorio-client-javascript 2.44.0 → 2.45.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.
@@ -44,7 +44,8 @@ function createRecommendationsUrl(podId, parameters, options) {
44
44
  term = parameters.term,
45
45
  filters = parameters.filters,
46
46
  variationsMap = parameters.variationsMap,
47
- hiddenFields = parameters.hiddenFields;
47
+ hiddenFields = parameters.hiddenFields,
48
+ preFilterExpression = parameters.preFilterExpression;
48
49
 
49
50
  // Pull num results number from parameters
50
51
  if (!helpers.isNil(numResults)) {
@@ -86,6 +87,11 @@ function createRecommendationsUrl(podId, parameters, options) {
86
87
  if (variationsMap) {
87
88
  queryParams.variations_map = JSON.stringify(variationsMap);
88
89
  }
90
+
91
+ // Pull pre_filter_expression from parameters
92
+ if (preFilterExpression) {
93
+ queryParams.pre_filter_expression = JSON.stringify(preFilterExpression);
94
+ }
89
95
  }
90
96
  queryParams = helpers.cleanParams(queryParams);
91
97
  var queryString = helpers.stringify(queryParams);
@@ -119,6 +125,7 @@ var Recommendations = /*#__PURE__*/function () {
119
125
  * @param {string} [parameters.term] - The term to use to refine results (strategy specific)
120
126
  * @param {object} [parameters.filters] - Key / value mapping of filters used to refine results
121
127
  * @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
128
+ * @param {object} [parameters.preFilterExpression] - Faceting expression to scope search results. Please refer to https://docs.constructor.io/rest_api/collections#add-items-dynamically
122
129
  * @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
123
130
  * @param {object} [networkParameters] - Parameters relevant to the network request
124
131
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
@@ -1054,7 +1054,11 @@ var Tracker = /*#__PURE__*/function () {
1054
1054
  *
1055
1055
  * @function trackPurchase
1056
1056
  * @param {object} parameters - Additional parameters to be sent with request
1057
- * @param {object[]} parameters.items - List of product item objects
1057
+ * @param {Array.<{itemId: string | undefined,
1058
+ * variationId: string | undefined,
1059
+ * itemName: string | undefined,
1060
+ * count: number | undefined,
1061
+ * price: number | undefined}>} parameters.items - List of product item objects
1058
1062
  * @param {number} parameters.revenue - The subtotal (excluding taxes, shipping, etc.) of the entire order
1059
1063
  * @param {string} [parameters.orderId] - Unique order identifier
1060
1064
  * @param {string} [parameters.section="Products"] - Index section
@@ -1066,7 +1070,7 @@ var Tracker = /*#__PURE__*/function () {
1066
1070
  * @example
1067
1071
  * constructorio.tracker.trackPurchase(
1068
1072
  * {
1069
- * items: [{ itemId: 'KMH876' }, { itemId: 'KMH140' }],
1073
+ * items: [{ itemId: 'KMH876', price: 1, count: 1}, { itemId: 'KMH140', price: 1, count: 1s }],
1070
1074
  * revenue: 12.00,
1071
1075
  * orderId: 'OUNXBG2HMA',
1072
1076
  * section: 'Products',
@@ -231,3 +231,8 @@ export interface ItemTracked {
231
231
  itemId?: string;
232
232
  variationId?: string;
233
233
  }
234
+
235
+ export interface ItemTrackedPurchase extends ItemTracked {
236
+ count?: number;
237
+ price?: number;
238
+ }
@@ -1,5 +1,5 @@
1
1
  import EventEmitter = require('events');
2
- import { ConstructorClientOptions, ItemTracked, NetworkParameters } from '.';
2
+ import { ConstructorClientOptions, ItemTracked, ItemTrackedPurchase, NetworkParameters } from '.';
3
3
  import RequestQueue = require('../utils/request-queue');
4
4
 
5
5
  export default Tracker;
@@ -114,7 +114,7 @@ declare class Tracker {
114
114
 
115
115
  trackPurchase(
116
116
  parameters: {
117
- items: ItemTracked & {quantity: number}[];
117
+ items: ItemTrackedPurchase[];
118
118
  revenue: number;
119
119
  orderId?: string;
120
120
  section?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-client-javascript",
3
- "version": "2.44.0",
3
+ "version": "2.45.0",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/index.d.ts",