@constructor-io/constructorio-client-javascript 2.66.2 → 2.67.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.
@@ -17,6 +17,7 @@ var helpers = require('./utils/helpers');
17
17
  var _require = require('./version'),
18
18
  packageVersion = _require["default"];
19
19
  var Quizzes = require('./modules/quizzes');
20
+ var Agent = require('./modules/agent');
20
21
  var Assistant = require('./modules/assistant');
21
22
 
22
23
  // Compute package version string
@@ -41,7 +42,8 @@ var ConstructorIO = /*#__PURE__*/function () {
41
42
  * @param {string} parameters.apiKey - Constructor.io API key
42
43
  * @param {string} [parameters.serviceUrl='https://ac.cnstrc.com'] - API URL endpoint
43
44
  * @param {string} [parameters.quizzesServiceUrl='https://quizzes.cnstrc.com'] - Quizzes API URL endpoint
44
- * @param {string} [parameters.assistantServiceUrl='https://assistant.cnstrc.com'] - AI Assistant API URL endpoint
45
+ * @param {string} [parameters.agentServiceUrl='https://agent.cnstrc.com'] - AI Shopping Agent API URL endpoint
46
+ * @param {string} [parameters.assistantServiceUrl='https://assistant.cnstrc.com'] - AI Shopping Assistant API URL endpoint @deprecated This parameter is deprecated and will be removed in a future version. Use parameters.agentServiceUrl instead.
45
47
  * @param {array} [parameters.segments] - User segments
46
48
  * @param {object} [parameters.testCells] - User test cells
47
49
  * @param {string} [parameters.clientId] - Client ID, defaults to value supplied by 'constructorio-id' module
@@ -63,7 +65,8 @@ var ConstructorIO = /*#__PURE__*/function () {
63
65
  * @property {object} recommendations - Interface to {@link module:recommendations}
64
66
  * @property {object} tracker - Interface to {@link module:tracker}
65
67
  * @property {object} quizzes - Interface to {@link module:quizzes}
66
- * @property {object} assistant - Interface to {@link module:assistant}
68
+ * @property {object} agent - Interface to {@link module:agent}
69
+ * @property {object} assistant - Interface to {@link module:assistant} @deprecated This property is deprecated and will be removed in a future version. Use the agent property instead.
67
70
  * @returns {class}
68
71
  */
69
72
  function ConstructorIO() {
@@ -73,6 +76,7 @@ var ConstructorIO = /*#__PURE__*/function () {
73
76
  versionFromOptions = options.version,
74
77
  serviceUrl = options.serviceUrl,
75
78
  quizzesServiceUrl = options.quizzesServiceUrl,
79
+ agentServiceUrl = options.agentServiceUrl,
76
80
  assistantServiceUrl = options.assistantServiceUrl,
77
81
  segments = options.segments,
78
82
  testCells = options.testCells,
@@ -116,6 +120,7 @@ var ConstructorIO = /*#__PURE__*/function () {
116
120
  version: versionFromOptions || versionFromGlobal || computePackageVersion(),
117
121
  serviceUrl: helpers.addHTTPSToString(normalizedServiceUrl) || 'https://ac.cnstrc.com',
118
122
  quizzesServiceUrl: quizzesServiceUrl && quizzesServiceUrl.replace(/\/$/, '') || 'https://quizzes.cnstrc.com',
123
+ agentServiceUrl: agentServiceUrl && agentServiceUrl.replace(/\/$/, '') || 'https://agent.cnstrc.com',
119
124
  assistantServiceUrl: assistantServiceUrl && assistantServiceUrl.replace(/\/$/, '') || 'https://assistant.cnstrc.com',
120
125
  sessionId: sessionId || session_id,
121
126
  clientId: clientId || client_id,
@@ -139,6 +144,7 @@ var ConstructorIO = /*#__PURE__*/function () {
139
144
  this.recommendations = new Recommendations(this.options);
140
145
  this.tracker = new Tracker(this.options);
141
146
  this.quizzes = new Quizzes(this.options);
147
+ this.agent = new Agent(this.options);
142
148
  this.assistant = new Assistant(this.options);
143
149
 
144
150
  // Dispatch initialization event
@@ -0,0 +1,208 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
5
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
6
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
+ var _require = require('../utils/helpers'),
8
+ cleanParams = _require.cleanParams,
9
+ trimNonBreakingSpaces = _require.trimNonBreakingSpaces,
10
+ encodeURIComponentRFC3986 = _require.encodeURIComponentRFC3986,
11
+ stringify = _require.stringify;
12
+
13
+ // Create URL from supplied intent (term) and parameters
14
+ function createAgentUrl(intent, parameters, options) {
15
+ var apiKey = options.apiKey,
16
+ version = options.version,
17
+ sessionId = options.sessionId,
18
+ clientId = options.clientId,
19
+ userId = options.userId,
20
+ segments = options.segments,
21
+ testCells = options.testCells,
22
+ agentServiceUrl = options.agentServiceUrl,
23
+ assistantServiceUrl = options.assistantServiceUrl;
24
+ var queryParams = {
25
+ c: version
26
+ };
27
+ queryParams.key = apiKey;
28
+ queryParams.i = clientId;
29
+ queryParams.s = sessionId;
30
+ var serviceUrl = agentServiceUrl || assistantServiceUrl;
31
+
32
+ // Validate intent is provided
33
+ if (!intent || typeof intent !== 'string') {
34
+ throw new Error('intent is a required parameter of type string');
35
+ }
36
+
37
+ // Validate domain is provided
38
+ if (!parameters.domain || typeof parameters.domain !== 'string') {
39
+ throw new Error('parameters.domain is a required parameter of type string');
40
+ }
41
+
42
+ // Pull test cells from options
43
+ if (testCells) {
44
+ Object.keys(testCells).forEach(function (testCellKey) {
45
+ queryParams["ef-".concat(testCellKey)] = testCells[testCellKey];
46
+ });
47
+ }
48
+
49
+ // Pull user segments from options
50
+ if (segments && segments.length) {
51
+ queryParams.us = segments;
52
+ }
53
+
54
+ // Pull user id from options and ensure string
55
+ if (userId) {
56
+ queryParams.ui = String(userId);
57
+ }
58
+ if (parameters) {
59
+ var domain = parameters.domain,
60
+ numResultsPerPage = parameters.numResultsPerPage;
61
+
62
+ // Pull domain from parameters
63
+ if (domain) {
64
+ queryParams.domain = domain;
65
+ }
66
+
67
+ // Pull results number from parameters
68
+ if (numResultsPerPage) {
69
+ queryParams.num_results_per_page = numResultsPerPage;
70
+ }
71
+ }
72
+
73
+ // eslint-disable-next-line no-underscore-dangle
74
+ queryParams._dt = Date.now();
75
+ queryParams = cleanParams(queryParams);
76
+ var queryString = stringify(queryParams);
77
+ var cleanedQuery = intent.replace(/^\//, '|'); // For compatibility with backend API
78
+
79
+ return "".concat(serviceUrl, "/v1/intent/").concat(encodeURIComponentRFC3986(trimNonBreakingSpaces(cleanedQuery)), "?").concat(queryString);
80
+ }
81
+
82
+ // Add event listeners to custom SSE that pushes data to the stream
83
+ function setupEventListeners(eventSource, controller, eventTypes) {
84
+ var addListener = function addListener(type) {
85
+ eventSource.addEventListener(type, function (event) {
86
+ var data = JSON.parse(event.data);
87
+ controller.enqueue({
88
+ type: type,
89
+ data: data
90
+ }); // Enqueue data into the stream
91
+ });
92
+ };
93
+
94
+ // Set up listeners for all event types except END
95
+ Object.values(eventTypes).forEach(function (type) {
96
+ if (type !== eventTypes.END) {
97
+ addListener(type);
98
+ }
99
+ });
100
+
101
+ // Handle the END event separately to close the stream
102
+ eventSource.addEventListener(eventTypes.END, function () {
103
+ controller.close(); // Close the stream
104
+ eventSource.close(); // Close the EventSource connection
105
+ });
106
+
107
+ // Handle errors from the EventSource
108
+ // eslint-disable-next-line no-param-reassign
109
+ eventSource.onerror = function (error) {
110
+ controller.error(error); // Pass the error to the stream
111
+ eventSource.close(); // Close the EventSource connection
112
+ };
113
+ }
114
+
115
+ /**
116
+ * Interface to agent SSE.
117
+ * Replaces the previous Assistant module.
118
+ *
119
+ * @module agent
120
+ * @inner
121
+ * @returns {object}
122
+ */
123
+ var Agent = /*#__PURE__*/function () {
124
+ function Agent(options) {
125
+ (0, _classCallCheck2["default"])(this, Agent);
126
+ this.options = options || {};
127
+ }
128
+ (0, _createClass2["default"])(Agent, [{
129
+ key: "getAgentResultsStream",
130
+ value:
131
+ /**
132
+ * Retrieve agent results from EventStream
133
+ *
134
+ * @function getAgentResultsStream
135
+ * @description Retrieve a stream of agent results from Constructor.io API
136
+ * @param {string} intent - Intent to use to perform an intent based recommendations
137
+ * @param {object} [parameters] - Additional parameters to refine result set
138
+ * @param {string} [parameters.domain] - domain name e.g. swimming sports gear, groceries
139
+ * @param {number} [parameters.numResultsPerPage] - The total number of results to return
140
+ * @returns {ReadableStream} Returns a ReadableStream.
141
+ * @example
142
+ * const readableStream = constructorio.agent.getAgentResultsStream('I want to get shoes', {
143
+ * domain: "nike_sportswear",
144
+ * });
145
+ * const reader = readableStream.getReader();
146
+ * const { value, done } = await reader.read();
147
+ */
148
+ function getAgentResultsStream(query, parameters) {
149
+ var eventSource;
150
+ var readableStream;
151
+ try {
152
+ var requestUrl = createAgentUrl(query, parameters, this.options);
153
+
154
+ // Create an EventSource that connects to the Server Sent Events API
155
+ eventSource = new EventSource(requestUrl);
156
+
157
+ // Create a readable stream that data will be pushed into
158
+ readableStream = new ReadableStream({
159
+ // To be called on stream start
160
+ start: function start(controller) {
161
+ // Listen to events emitted from ASA Server Sent Events and push data to the ReadableStream
162
+ setupEventListeners(eventSource, controller, Agent.EventTypes);
163
+ },
164
+ // To be called on stream cancelling
165
+ cancel: function cancel() {
166
+ // Close the EventSource connection when the stream is prematurely canceled
167
+ eventSource.close();
168
+ }
169
+ });
170
+ } catch (e) {
171
+ if (readableStream) {
172
+ var _readableStream;
173
+ (_readableStream = readableStream) === null || _readableStream === void 0 ? void 0 : _readableStream.cancel();
174
+ } else {
175
+ var _eventSource;
176
+ // If the stream was not successfully created, close the EventSource directly
177
+ (_eventSource = eventSource) === null || _eventSource === void 0 ? void 0 : _eventSource.close();
178
+ }
179
+ throw new Error(e.message);
180
+ }
181
+ return readableStream;
182
+ }
183
+ }]);
184
+ return Agent;
185
+ }();
186
+ (0, _defineProperty2["default"])(Agent, "EventTypes", {
187
+ START: 'start',
188
+ // Denotes the start of the stream
189
+ GROUP: 'group',
190
+ // Represents a semantic grouping of search results, optionally having textual explanation
191
+ SEARCH_RESULT: 'search_result',
192
+ // Represents a set of results with metadata (used to show results with search refinements)
193
+ ARTICLE_REFERENCE: 'article_reference',
194
+ // Represents a set of content with metadata
195
+ RECIPE_INFO: 'recipe_info',
196
+ // Represents recipes' auxiliary information like cooking times & serving sizes
197
+ RECIPE_INSTRUCTIONS: 'recipe_instructions',
198
+ // Represents recipe instructions
199
+ SERVER_ERROR: 'server_error',
200
+ // Server Error event
201
+ IMAGE_META: 'image_meta',
202
+ // This event type is used for enhancing recommendations with media content such as images
203
+ END: 'end' // Represents the end of data stream
204
+ });
205
+
206
+ module.exports = Agent;
207
+ module.exports.createAgentUrl = createAgentUrl;
208
+ module.exports.setupEventListeners = setupEventListeners;
@@ -3,124 +3,38 @@
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
5
5
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
6
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
7
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
8
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
9
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
6
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
- var _require = require('../utils/helpers'),
8
- cleanParams = _require.cleanParams,
9
- trimNonBreakingSpaces = _require.trimNonBreakingSpaces,
10
- encodeURIComponentRFC3986 = _require.encodeURIComponentRFC3986,
11
- stringify = _require.stringify;
12
-
13
- // Create URL from supplied intent (term) and parameters
14
- function createAssistantUrl(intent, parameters, options) {
15
- var apiKey = options.apiKey,
16
- version = options.version,
17
- sessionId = options.sessionId,
18
- clientId = options.clientId,
19
- userId = options.userId,
20
- segments = options.segments,
21
- testCells = options.testCells,
22
- assistantServiceUrl = options.assistantServiceUrl;
23
- var queryParams = {
24
- c: version
25
- };
26
- queryParams.key = apiKey;
27
- queryParams.i = clientId;
28
- queryParams.s = sessionId;
29
-
30
- // Validate intent is provided
31
- if (!intent || typeof intent !== 'string') {
32
- throw new Error('intent is a required parameter of type string');
33
- }
34
-
35
- // Validate domain is provided
36
- if (!parameters.domain || typeof parameters.domain !== 'string') {
37
- throw new Error('parameters.domain is a required parameter of type string');
38
- }
39
-
40
- // Pull test cells from options
41
- if (testCells) {
42
- Object.keys(testCells).forEach(function (testCellKey) {
43
- queryParams["ef-".concat(testCellKey)] = testCells[testCellKey];
44
- });
45
- }
46
-
47
- // Pull user segments from options
48
- if (segments && segments.length) {
49
- queryParams.us = segments;
50
- }
51
-
52
- // Pull user id from options and ensure string
53
- if (userId) {
54
- queryParams.ui = String(userId);
55
- }
56
- if (parameters) {
57
- var domain = parameters.domain,
58
- numResultsPerPage = parameters.numResultsPerPage;
59
-
60
- // Pull domain from parameters
61
- if (domain) {
62
- queryParams.domain = domain;
63
- }
64
-
65
- // Pull results number from parameters
66
- if (numResultsPerPage) {
67
- queryParams.num_results_per_page = numResultsPerPage;
68
- }
69
- }
70
-
71
- // eslint-disable-next-line no-underscore-dangle
72
- queryParams._dt = Date.now();
73
- queryParams = cleanParams(queryParams);
74
- var queryString = stringify(queryParams);
75
- var cleanedQuery = intent.replace(/^\//, '|'); // For compatibility with backend API
76
-
77
- return "".concat(assistantServiceUrl, "/v1/intent/").concat(encodeURIComponentRFC3986(trimNonBreakingSpaces(cleanedQuery)), "?").concat(queryString);
78
- }
79
-
80
- // Add event listeners to custom SSE that pushes data to the stream
81
- function setupEventListeners(eventSource, controller, eventTypes) {
82
- var addListener = function addListener(type) {
83
- eventSource.addEventListener(type, function (event) {
84
- var data = JSON.parse(event.data);
85
- controller.enqueue({
86
- type: type,
87
- data: data
88
- }); // Enqueue data into the stream
89
- });
90
- };
91
-
92
- // Set up listeners for all event types except END
93
- Object.values(eventTypes).forEach(function (type) {
94
- if (type !== eventTypes.END) {
95
- addListener(type);
96
- }
97
- });
98
-
99
- // Handle the END event separately to close the stream
100
- eventSource.addEventListener(eventTypes.END, function () {
101
- controller.close(); // Close the stream
102
- eventSource.close(); // Close the EventSource connection
103
- });
104
-
105
- // Handle errors from the EventSource
106
- // eslint-disable-next-line no-param-reassign
107
- eventSource.onerror = function (error) {
108
- controller.error(error); // Pass the error to the stream
109
- eventSource.close(); // Close the EventSource connection
110
- };
111
- }
11
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; }
12
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
13
+ var Agent = require('./agent');
14
+ var _require = require('./agent'),
15
+ createAgentUrl = _require.createAgentUrl,
16
+ setupEventListeners = _require.setupEventListeners;
112
17
 
113
18
  /**
19
+ * @deprecated This module is deprecated and will be removed in a future version. Use the Agent module instead.
114
20
  * Interface to assistant SSE.
115
21
  *
116
22
  * @module assistant
117
23
  * @inner
118
24
  * @returns {object}
119
25
  */
120
- var Assistant = /*#__PURE__*/function () {
121
- function Assistant(options) {
26
+ var Assistant = /*#__PURE__*/function (_Agent) {
27
+ (0, _inherits2["default"])(Assistant, _Agent);
28
+ var _super = _createSuper(Assistant);
29
+ function Assistant() {
30
+ var _this;
122
31
  (0, _classCallCheck2["default"])(this, Assistant);
123
- this.options = options || {};
32
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
+ args[_key] = arguments[_key];
34
+ }
35
+ _this = _super.call.apply(_super, [this].concat(args));
36
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "EventTypes", Agent.EventTypes);
37
+ return _this;
124
38
  }
125
39
  (0, _createClass2["default"])(Assistant, [{
126
40
  key: "getAssistantResultsStream",
@@ -128,6 +42,7 @@ var Assistant = /*#__PURE__*/function () {
128
42
  /**
129
43
  * Retrieve assistant results from EventStream
130
44
  *
45
+ * @deprecated Use getAssistantResultsStream from the Agent module instead.
131
46
  * @function getAssistantResultsStream
132
47
  * @description Retrieve a stream of assistant results from Constructor.io API
133
48
  * @param {string} intent - Intent to use to perform an intent based recommendations
@@ -143,63 +58,11 @@ var Assistant = /*#__PURE__*/function () {
143
58
  * const { value, done } = await reader.read();
144
59
  */
145
60
  function getAssistantResultsStream(query, parameters) {
146
- var eventSource;
147
- var readableStream;
148
- try {
149
- var requestUrl = createAssistantUrl(query, parameters, this.options);
150
-
151
- // Create an EventSource that connects to the Server Sent Events API
152
- eventSource = new EventSource(requestUrl);
153
-
154
- // Create a readable stream that data will be pushed into
155
- readableStream = new ReadableStream({
156
- // To be called on stream start
157
- start: function start(controller) {
158
- // Listen to events emitted from ASA Server Sent Events and push data to the ReadableStream
159
- setupEventListeners(eventSource, controller, Assistant.EventTypes);
160
- },
161
- // To be called on stream cancelling
162
- cancel: function cancel() {
163
- // Close the EventSource connection when the stream is prematurely canceled
164
- eventSource.close();
165
- }
166
- });
167
- } catch (e) {
168
- if (readableStream) {
169
- var _readableStream;
170
- (_readableStream = readableStream) === null || _readableStream === void 0 ? void 0 : _readableStream.cancel();
171
- } else {
172
- var _eventSource;
173
- // If the stream was not successfully created, close the EventSource directly
174
- (_eventSource = eventSource) === null || _eventSource === void 0 ? void 0 : _eventSource.close();
175
- }
176
- throw new Error(e.message);
177
- }
178
- return readableStream;
61
+ return this.getAgentResultsStream(query, parameters);
179
62
  }
180
63
  }]);
181
64
  return Assistant;
182
- }();
183
- (0, _defineProperty2["default"])(Assistant, "EventTypes", {
184
- START: 'start',
185
- // Denotes the start of the stream
186
- GROUP: 'group',
187
- // Represents a semantic grouping of search results, optionally having textual explanation
188
- SEARCH_RESULT: 'search_result',
189
- // Represents a set of results with metadata (used to show results with search refinements)
190
- ARTICLE_REFERENCE: 'article_reference',
191
- // Represents a set of content with metadata
192
- RECIPE_INFO: 'recipe_info',
193
- // Represents recipes' auxiliary information like cooking times & serving sizes
194
- RECIPE_INSTRUCTIONS: 'recipe_instructions',
195
- // Represents recipe instructions
196
- SERVER_ERROR: 'server_error',
197
- // Server Error event
198
- IMAGE_META: 'image_meta',
199
- // This event type is used for enhancing recommendations with media content such as images
200
- END: 'end' // Represents the end of data stream
201
- });
202
-
65
+ }(Agent);
203
66
  module.exports = Assistant;
204
- module.exports.createAssistantUrl = createAssistantUrl;
67
+ module.exports.createAssistantUrl = createAgentUrl;
205
68
  module.exports.setupEventListeners = setupEventListeners;
@@ -993,7 +993,6 @@ var Tracker = /*#__PURE__*/function () {
993
993
  * itemName: 'Red T-Shirt',
994
994
  * variationId: 'KMH879-7632',
995
995
  * type: 'like',
996
- * resultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
997
996
  * section: 'Products',
998
997
  * },
999
998
  * );
@@ -1296,6 +1295,8 @@ var Tracker = /*#__PURE__*/function () {
1296
1295
  * @param {object} [parameters.analyticsTags] - Pass additional analytics data
1297
1296
  * @param {object} [networkParameters] - Parameters relevant to the network request
1298
1297
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
1298
+ * @param {string} [parameters.slCampaignId] - Pass campaign id of sponsored listing
1299
+ * @param {string} [parameters.slCampaignOwner] - Pass campaign owner of sponsored listing
1299
1300
  * @returns {(true|Error)}
1300
1301
  * @description User clicked an item that appeared within a list of recommended results
1301
1302
  * @example
@@ -1354,7 +1355,9 @@ var Tracker = /*#__PURE__*/function () {
1354
1355
  item_name = parameters.item_name,
1355
1356
  _parameters$itemName5 = parameters.itemName,
1356
1357
  itemName = _parameters$itemName5 === void 0 ? item_name : _parameters$itemName5,
1357
- analyticsTags = parameters.analyticsTags;
1358
+ analyticsTags = parameters.analyticsTags,
1359
+ slCampaignId = parameters.slCampaignId,
1360
+ slCampaignOwner = parameters.slCampaignOwner;
1358
1361
  if (variationId) {
1359
1362
  bodyParams.variation_id = variationId;
1360
1363
  }
@@ -1391,6 +1394,12 @@ var Tracker = /*#__PURE__*/function () {
1391
1394
  if (analyticsTags) {
1392
1395
  bodyParams.analytics_tags = analyticsTags;
1393
1396
  }
1397
+ if (slCampaignId) {
1398
+ bodyParams.sl_campaign_id = slCampaignId;
1399
+ }
1400
+ if (slCampaignOwner) {
1401
+ bodyParams.sl_campaign_owner = slCampaignOwner;
1402
+ }
1394
1403
  var requestURL = "".concat(requestPath).concat(applyParamsAsString({}, this.options));
1395
1404
  var requestMethod = 'POST';
1396
1405
  var requestBody = applyParams(bodyParams, _objectSpread(_objectSpread({}, this.options), {}, {
@@ -2276,25 +2285,25 @@ var Tracker = /*#__PURE__*/function () {
2276
2285
  /**
2277
2286
  * Send ASA request submitted event
2278
2287
  *
2279
- * @function trackAssistantSubmit
2288
+ * @function trackAgentSubmit
2280
2289
  * @param {object} parameters - Additional parameters to be sent with request
2281
2290
  * @param {string} parameters.intent - Intent of user request
2282
2291
  * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2283
2292
  * @param {object} [networkParameters] - Parameters relevant to the network request
2284
2293
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2285
2294
  * @returns {(true|Error)}
2286
- * @description User submitted an assistant search
2287
- * (pressing enter within assistant input element, or clicking assistant submit element)
2295
+ * @description User submitted an agent search
2296
+ * (pressing enter within agent input element, or clicking agent submit element)
2288
2297
  * @example
2289
- * constructorio.tracker.trackAssistantSubmit(
2298
+ * constructorio.tracker.trackAgentSubmit(
2290
2299
  * {
2291
2300
  * intent: 'show me a recipe for a cookie',
2292
2301
  * },
2293
2302
  * );
2294
2303
  */
2295
2304
  }, {
2296
- key: "trackAssistantSubmit",
2297
- value: function trackAssistantSubmit(parameters) {
2305
+ key: "trackAgentSubmit",
2306
+ value: function trackAgentSubmit(parameters) {
2298
2307
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2299
2308
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
2300
2309
  // Ensure parameters are provided (required)
@@ -2319,9 +2328,9 @@ var Tracker = /*#__PURE__*/function () {
2319
2328
  }
2320
2329
 
2321
2330
  /**
2322
- * Send assistant results page load started
2331
+ * Send agent results page load started
2323
2332
  *
2324
- * @function trackAssistantResultLoadStarted
2333
+ * @function trackAgentResultLoadStarted
2325
2334
  * @param {object} parameters - Additional parameters to be sent with request
2326
2335
  * @param {string} parameters.intent - Intent of user request
2327
2336
  * @param {string} [parameters.section] - The section name for the item Ex. "Products"
@@ -2329,9 +2338,9 @@ var Tracker = /*#__PURE__*/function () {
2329
2338
  * @param {object} [networkParameters] - Parameters relevant to the network request
2330
2339
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2331
2340
  * @returns {(true|Error)}
2332
- * @description Assistant results page load begun (but has not necessarily loaded completely)
2341
+ * @description Agent results page load begun (but has not necessarily loaded completely)
2333
2342
  * @example
2334
- * constructorio.tracker.trackAssistantResultLoadStarted(
2343
+ * constructorio.tracker.trackAgentResultLoadStarted(
2335
2344
  * {
2336
2345
  * intent: 'show me a recipe for a cookie',
2337
2346
  * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
@@ -2339,8 +2348,8 @@ var Tracker = /*#__PURE__*/function () {
2339
2348
  * );
2340
2349
  */
2341
2350
  }, {
2342
- key: "trackAssistantResultLoadStarted",
2343
- value: function trackAssistantResultLoadStarted(parameters) {
2351
+ key: "trackAgentResultLoadStarted",
2352
+ value: function trackAgentResultLoadStarted(parameters) {
2344
2353
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2345
2354
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
2346
2355
  // Ensure parameters are provided (required)
@@ -2367,9 +2376,9 @@ var Tracker = /*#__PURE__*/function () {
2367
2376
  }
2368
2377
 
2369
2378
  /**
2370
- * Send assistant results page load finished
2379
+ * Send agent results page load finished
2371
2380
  *
2372
- * @function trackAssistantResultLoadFinished
2381
+ * @function trackAgentResultLoadFinished
2373
2382
  * @param {object} parameters - Additional parameters to be sent with request
2374
2383
  * @param {string} parameters.intent - Intent of user request
2375
2384
  * @param {number} parameters.searchResultCount - Number of search results loaded
@@ -2378,9 +2387,9 @@ var Tracker = /*#__PURE__*/function () {
2378
2387
  * @param {object} [networkParameters] - Parameters relevant to the network request
2379
2388
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2380
2389
  * @returns {(true|Error)}
2381
- * @description Assistant results page load finished
2390
+ * @description Agent results page load finished
2382
2391
  * @example
2383
- * constructorio.tracker.trackAssistantResultLoadFinished(
2392
+ * constructorio.tracker.trackAgentResultLoadFinished(
2384
2393
  * {
2385
2394
  * intent: 'show me a recipe for a cookie',
2386
2395
  * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
@@ -2389,8 +2398,8 @@ var Tracker = /*#__PURE__*/function () {
2389
2398
  * );
2390
2399
  */
2391
2400
  }, {
2392
- key: "trackAssistantResultLoadFinished",
2393
- value: function trackAssistantResultLoadFinished(parameters) {
2401
+ key: "trackAgentResultLoadFinished",
2402
+ value: function trackAgentResultLoadFinished(parameters) {
2394
2403
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2395
2404
  // Ensure parameters are provided (required)
2396
2405
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
@@ -2419,9 +2428,9 @@ var Tracker = /*#__PURE__*/function () {
2419
2428
  }
2420
2429
 
2421
2430
  /**
2422
- * Send assistant result click event to API
2431
+ * Send agent result click event to API
2423
2432
  *
2424
- * @function trackAssistantResultClick
2433
+ * @function trackAgentResultClick
2425
2434
  * @param {object} parameters - Additional parameters to be sent with request
2426
2435
  * @param {string} parameters.intent - intent of the user
2427
2436
  * @param {string} parameters.searchResultId - result_id of the specific search result the clicked item belongs to
@@ -2433,9 +2442,9 @@ var Tracker = /*#__PURE__*/function () {
2433
2442
  * @param {object} [networkParameters] - Parameters relevant to the network request
2434
2443
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2435
2444
  * @returns {(true|Error)}
2436
- * @description User clicked a result that appeared within an assistant search result
2445
+ * @description User clicked a result that appeared within an agent search result
2437
2446
  * @example
2438
- * constructorio.tracker.trackAssistantResultClick(
2447
+ * constructorio.tracker.trackAgentResultClick(
2439
2448
  * {
2440
2449
  * variationId: 'KMH879-7632',
2441
2450
  * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
@@ -2446,8 +2455,8 @@ var Tracker = /*#__PURE__*/function () {
2446
2455
  * );
2447
2456
  */
2448
2457
  }, {
2449
- key: "trackAssistantResultClick",
2450
- value: function trackAssistantResultClick(parameters) {
2458
+ key: "trackAgentResultClick",
2459
+ value: function trackAgentResultClick(parameters) {
2451
2460
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2452
2461
  // Ensure parameters are provided (required)
2453
2462
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
@@ -2483,9 +2492,9 @@ var Tracker = /*#__PURE__*/function () {
2483
2492
  }
2484
2493
 
2485
2494
  /**
2486
- * Send assistant search result view event to API
2495
+ * Send agent search result view event to API
2487
2496
  *
2488
- * @function trackAssistantResultView
2497
+ * @function trackAgentResultView
2489
2498
  * @param {object} parameters - Additional parameters to be sent with request
2490
2499
  * @param {string} parameters.intent - intent of the user
2491
2500
  * @param {string} parameters.searchResultId - result_id of the specific search result the clicked item belongs to
@@ -2496,9 +2505,9 @@ var Tracker = /*#__PURE__*/function () {
2496
2505
  * @param {object} [networkParameters] - Parameters relevant to the network request
2497
2506
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2498
2507
  * @returns {(true|Error)}
2499
- * @description User viewed a search result within an assistant result
2508
+ * @description User viewed a search result within an agent result
2500
2509
  * @example
2501
- * constructorio.tracker.trackAssistantResultView(
2510
+ * constructorio.tracker.trackAgentResultView(
2502
2511
  * {
2503
2512
  * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2504
2513
  * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
@@ -2509,8 +2518,8 @@ var Tracker = /*#__PURE__*/function () {
2509
2518
  * );
2510
2519
  */
2511
2520
  }, {
2512
- key: "trackAssistantResultView",
2513
- value: function trackAssistantResultView(parameters) {
2521
+ key: "trackAgentResultView",
2522
+ value: function trackAgentResultView(parameters) {
2514
2523
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2515
2524
  // Ensure parameters are provided (required)
2516
2525
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
@@ -2548,19 +2557,19 @@ var Tracker = /*#__PURE__*/function () {
2548
2557
  /**
2549
2558
  * Send ASA search submitted event
2550
2559
  *
2551
- * @function trackAssistantSearchSubmit
2560
+ * @function trackAgentSearchSubmit
2552
2561
  * @param {object} parameters - Additional parameters to be sent with request
2553
2562
  * @param {string} parameters.intent - Intent of user request
2554
- * @param {string} parameters.searchTerm - Term of submitted assistant search event
2563
+ * @param {string} parameters.searchTerm - Term of submitted agent search event
2555
2564
  * @param {string} parameters.searchResultId - resultId of search result the clicked item belongs to
2556
2565
  * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2557
2566
  * @param {string} [parameters.intentResultId] - intentResultId from the ASA response
2558
2567
  * @param {object} [networkParameters] - Parameters relevant to the network request
2559
2568
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2560
2569
  * @returns {(true|Error)}
2561
- * @description User submitted an alternative assistant search result search term
2570
+ * @description User submitted an alternative agent search result search term
2562
2571
  * @example
2563
- * constructorio.tracker.trackAssistantSearchSubmit({
2572
+ * constructorio.tracker.trackAgentSearchSubmit({
2564
2573
  * {
2565
2574
  * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2566
2575
  * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
@@ -2570,8 +2579,8 @@ var Tracker = /*#__PURE__*/function () {
2570
2579
  * );
2571
2580
  */
2572
2581
  }, {
2573
- key: "trackAssistantSearchSubmit",
2574
- value: function trackAssistantSearchSubmit(parameters) {
2582
+ key: "trackAgentSearchSubmit",
2583
+ value: function trackAgentSearchSubmit(parameters) {
2575
2584
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2576
2585
  // Ensure parameters are provided (required)
2577
2586
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
@@ -2602,6 +2611,192 @@ var Tracker = /*#__PURE__*/function () {
2602
2611
  return new Error('parameters is a required parameter of type object');
2603
2612
  }
2604
2613
 
2614
+ /**
2615
+ * Send ASA request submitted event
2616
+ *
2617
+ * @deprecated This method will be removed in a future version. Use trackAgentSubmit instead.
2618
+ * @function trackAssistantSubmit
2619
+ * @param {object} parameters - Additional parameters to be sent with request
2620
+ * @param {string} parameters.intent - Intent of user request
2621
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2622
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2623
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2624
+ * @returns {(true|Error)}
2625
+ * @description User submitted an assistant search
2626
+ * (pressing enter within assistant input element, or clicking assistant submit element)
2627
+ * @example
2628
+ * constructorio.tracker.trackAssistantSubmit(
2629
+ * {
2630
+ * intent: 'show me a recipe for a cookie',
2631
+ * },
2632
+ * );
2633
+ */
2634
+ }, {
2635
+ key: "trackAssistantSubmit",
2636
+ value: function trackAssistantSubmit(parameters) {
2637
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2638
+ return this.trackAgentSubmit(parameters, networkParameters);
2639
+ }
2640
+
2641
+ /**
2642
+ * Send assistant results page load started
2643
+ *
2644
+ * @deprecated This method will be removed in a future version. Use trackAgentResultLoadStarted instead.
2645
+ * @function trackAssistantResultLoadStarted
2646
+ * @param {object} parameters - Additional parameters to be sent with request
2647
+ * @param {string} parameters.intent - Intent of user request
2648
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2649
+ * @param {string} [parameters.intentResultId] - The intent result id from the ASA response
2650
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2651
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2652
+ * @returns {(true|Error)}
2653
+ * @description Assistant results page load begun (but has not necessarily loaded completely)
2654
+ * @example
2655
+ * constructorio.tracker.trackAssistantResultLoadStarted(
2656
+ * {
2657
+ * intent: 'show me a recipe for a cookie',
2658
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2659
+ * },
2660
+ * );
2661
+ */
2662
+ }, {
2663
+ key: "trackAssistantResultLoadStarted",
2664
+ value: function trackAssistantResultLoadStarted(parameters) {
2665
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2666
+ return this.trackAgentResultLoadStarted(parameters, networkParameters);
2667
+ }
2668
+
2669
+ /**
2670
+ * Send assistant results page load finished
2671
+ *
2672
+ * @deprecated This method will be removed in a future version. Use trackAgentResultLoadFinished instead.
2673
+ * @function trackAssistantResultLoadFinished
2674
+ * @param {object} parameters - Additional parameters to be sent with request
2675
+ * @param {string} parameters.intent - Intent of user request
2676
+ * @param {number} parameters.searchResultCount - Number of search results loaded
2677
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2678
+ * @param {string} [parameters.intentResultId] - The intent result id from the ASA response
2679
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2680
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2681
+ * @returns {(true|Error)}
2682
+ * @description Assistant results page load finished
2683
+ * @example
2684
+ * constructorio.tracker.trackAssistantResultLoadFinished(
2685
+ * {
2686
+ * intent: 'show me a recipe for a cookie',
2687
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2688
+ * searchResultCount: 5,
2689
+ * },
2690
+ * );
2691
+ */
2692
+ }, {
2693
+ key: "trackAssistantResultLoadFinished",
2694
+ value: function trackAssistantResultLoadFinished(parameters) {
2695
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2696
+ return this.trackAgentResultLoadFinished(parameters, networkParameters);
2697
+ }
2698
+
2699
+ /**
2700
+ * Send assistant result click event to API
2701
+ *
2702
+ * @deprecated This method will be removed in a future version. Use trackAgentResultClick instead.
2703
+ * @function trackAssistantResultClick
2704
+ * @param {object} parameters - Additional parameters to be sent with request
2705
+ * @param {string} parameters.intent - intent of the user
2706
+ * @param {string} parameters.searchResultId - result_id of the specific search result the clicked item belongs to
2707
+ * @param {string} parameters.itemId - Product item unique identifier
2708
+ * @param {string} parameters.itemName - Product item name
2709
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2710
+ * @param {string} [parameters.variationId] - Product item variation unique identifier
2711
+ * @param {string} [parameters.intentResultId] - Browse result identifier (returned in response from Constructor)
2712
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2713
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2714
+ * @returns {(true|Error)}
2715
+ * @description User clicked a result that appeared within an assistant search result
2716
+ * @example
2717
+ * constructorio.tracker.trackAssistantResultClick(
2718
+ * {
2719
+ * variationId: 'KMH879-7632',
2720
+ * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2721
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2722
+ * intent: 'show me a recipe for a cookie',
2723
+ * itemId: 'KMH876',
2724
+ * },
2725
+ * );
2726
+ */
2727
+ }, {
2728
+ key: "trackAssistantResultClick",
2729
+ value: function trackAssistantResultClick(parameters) {
2730
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2731
+ return this.trackAgentResultClick(parameters, networkParameters);
2732
+ }
2733
+
2734
+ /**
2735
+ * Send assistant search result view event to API
2736
+ *
2737
+ * @deprecated This method will be removed in a future version. Use trackAgentResultView instead.
2738
+ * @function trackAssistantResultView
2739
+ * @param {object} parameters - Additional parameters to be sent with request
2740
+ * @param {string} parameters.intent - intent of the user
2741
+ * @param {string} parameters.searchResultId - result_id of the specific search result the clicked item belongs to
2742
+ * @param {number} parameters.numResultsViewed - Number of items viewed in this search result
2743
+ * @param {object[]} [parameters.items] - List of product item objects viewed
2744
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2745
+ * @param {string} [parameters.intentResultId] - Browse result identifier (returned in response from Constructor)
2746
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2747
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2748
+ * @returns {(true|Error)}
2749
+ * @description User viewed a search result within an assistant result
2750
+ * @example
2751
+ * constructorio.tracker.trackAssistantResultView(
2752
+ * {
2753
+ * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2754
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2755
+ * intent: 'show me a recipe for a cookie',
2756
+ * numResultsViewed: 5,
2757
+ * items: [{itemId: 'KMH876'}, {itemId: 'KMH140'}, {itemId: 'KMH437'}],
2758
+ * },
2759
+ * );
2760
+ */
2761
+ }, {
2762
+ key: "trackAssistantResultView",
2763
+ value: function trackAssistantResultView(parameters) {
2764
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2765
+ return this.trackAgentResultView(parameters, networkParameters);
2766
+ }
2767
+
2768
+ /**
2769
+ * Send ASA search submitted event
2770
+ *
2771
+ * @deprecated This method will be removed in a future version. Use trackAgentSearchSubmit instead.
2772
+ * @function trackAssistantSearchSubmit
2773
+ * @param {object} parameters - Additional parameters to be sent with request
2774
+ * @param {string} parameters.intent - Intent of user request
2775
+ * @param {string} parameters.searchTerm - Term of submitted assistant search event
2776
+ * @param {string} parameters.searchResultId - resultId of search result the clicked item belongs to
2777
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2778
+ * @param {string} [parameters.intentResultId] - intentResultId from the ASA response
2779
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2780
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2781
+ * @returns {(true|Error)}
2782
+ * @description User submitted an alternative assistant search result search term
2783
+ * @example
2784
+ * constructorio.tracker.trackAssistantSearchSubmit({
2785
+ * {
2786
+ * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2787
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2788
+ * intent: 'show me a recipe for a cookie',
2789
+ * searchTerm: 'flour',
2790
+ * },
2791
+ * );
2792
+ */
2793
+ }, {
2794
+ key: "trackAssistantSearchSubmit",
2795
+ value: function trackAssistantSearchSubmit(parameters) {
2796
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2797
+ return this.trackAgentSearchSubmit(parameters, networkParameters);
2798
+ }
2799
+
2605
2800
  /**
2606
2801
  * Send product insights agent view events
2607
2802
  *
@@ -0,0 +1,22 @@
1
+ import {
2
+ ConstructorClientOptions,
3
+ } from '.';
4
+
5
+ export default Agent;
6
+
7
+ export interface IAgentParameters {
8
+ domain: string;
9
+ numResultsPerPage?: number;
10
+ filters?: Record<string, any>;
11
+ }
12
+
13
+ declare class Agent {
14
+ constructor(options: ConstructorClientOptions);
15
+
16
+ options: ConstructorClientOptions;
17
+
18
+ getAgentResultsStream(
19
+ intent: string,
20
+ parameters?: IAgentParameters,
21
+ ): ReadableStream;
22
+ }
@@ -3,6 +3,7 @@ import Browse from './browse';
3
3
  import Autocomplete from './autocomplete';
4
4
  import Recommendations from './recommendations';
5
5
  import Quizzes from './quizzes';
6
+ import Agent from './agent';
6
7
  import Assistant from './assistant';
7
8
  import Tracker from './tracker';
8
9
  import { ConstructorClientOptions } from '.';
@@ -24,6 +25,8 @@ declare class ConstructorIO {
24
25
 
25
26
  quizzes: Quizzes;
26
27
 
28
+ agent: Agent;
29
+
27
30
  assistant: Assistant;
28
31
 
29
32
  tracker: Tracker;
@@ -32,5 +35,5 @@ declare class ConstructorIO {
32
35
  }
33
36
 
34
37
  declare namespace ConstructorIO {
35
- export { Search, Browse, Autocomplete, Recommendations, Quizzes, Tracker, Assistant };
38
+ export { Search, Browse, Autocomplete, Recommendations, Quizzes, Tracker, Agent, Assistant };
36
39
  }
@@ -47,7 +47,8 @@ export interface ConstructorClientOptions {
47
47
  version?: string;
48
48
  serviceUrl?: string;
49
49
  quizzesServiceUrl?: string;
50
- assistantServiceUrl?: string,
50
+ agentServiceUrl?: string;
51
+ assistantServiceUrl?: string;
51
52
  sessionId?: number;
52
53
  clientId?: string;
53
54
  userId?: string;
@@ -163,6 +163,8 @@ declare class Tracker {
163
163
  resultPositionOnPage?: number;
164
164
  numResultsPerPage?: number;
165
165
  analyticsTags?: Record<string, string>;
166
+ slCampaignId?: string;
167
+ slCampaignOwner?: string;
166
168
  },
167
169
  networkParameters?: NetworkParameters
168
170
  ): true | Error;
@@ -266,7 +268,7 @@ declare class Tracker {
266
268
  networkParameters?: NetworkParameters
267
269
  ): true | Error;
268
270
 
269
- trackAssistantSubmit(
271
+ trackAgentSubmit(
270
272
  parameters: {
271
273
  intent: string;
272
274
  section?: string;
@@ -274,7 +276,7 @@ declare class Tracker {
274
276
  networkParameters?: NetworkParameters
275
277
  ): true | Error;
276
278
 
277
- trackAssistantResultLoadStarted(
279
+ trackAgentResultLoadStarted(
278
280
  parameters: {
279
281
  intent: string;
280
282
  section?: string;
@@ -283,7 +285,7 @@ declare class Tracker {
283
285
  networkParameters?: NetworkParameters
284
286
  ): true | Error;
285
287
 
286
- trackAssistantResultLoadFinished(
288
+ trackAgentResultLoadFinished(
287
289
  parameters: {
288
290
  intent: string;
289
291
  searchResultCount: number;
@@ -293,7 +295,7 @@ declare class Tracker {
293
295
  networkParameters?: NetworkParameters
294
296
  ): true | Error;
295
297
 
296
- trackAssistantResultClick(
298
+ trackAgentResultClick(
297
299
  parameters: {
298
300
  intent: string;
299
301
  searchResultId: string;
@@ -306,7 +308,7 @@ declare class Tracker {
306
308
  networkParameters?: NetworkParameters
307
309
  ): true | Error;
308
310
 
309
- trackAssistantResultView(
311
+ trackAgentResultView(
310
312
  parameters: {
311
313
  intent: string;
312
314
  searchResultId: string;
@@ -318,7 +320,7 @@ declare class Tracker {
318
320
  networkParameters?: NetworkParameters
319
321
  ): true | Error;
320
322
 
321
- trackAssistantSearchSubmit(
323
+ trackAgentSearchSubmit(
322
324
  parameters: {
323
325
  intent: string;
324
326
  searchTerm: string;
@@ -331,71 +333,107 @@ declare class Tracker {
331
333
  networkParameters?: NetworkParameters
332
334
  ): true | Error;
333
335
 
334
- trackProductInsightsAgentViews(parameters: {
335
- questions: Question[];
336
- itemId: string;
337
- itemName: string;
338
- viewTimespans: TimeSpan[];
339
- variationId?: string;
340
- section?: string;
341
- }, networkParameters?: NetworkParameters): true | Error;
342
-
343
- trackProductInsightsAgentView(parameters: {
344
- questions: Question[];
345
- itemId: string;
346
- itemName: string;
347
- variationId?: string;
348
- section?: string;
349
- }, networkParameters?: NetworkParameters): true | Error;
350
-
351
- trackProductInsightsAgentOutOfView(parameters: {
352
- itemId: string;
353
- itemName: string;
354
- variationId?: string;
355
- section?: string;
356
- }, networkParameters?: NetworkParameters): true | Error;
357
-
358
- trackProductInsightsAgentFocus(parameters: {
359
- itemId: string;
360
- itemName: string;
361
- variationId?: string;
362
- section?: string;
363
- }, networkParameters?: NetworkParameters): true | Error;
364
-
365
- trackProductInsightsAgentQuestionClick(parameters: {
366
- itemId: string;
367
- itemName: string;
368
- question: string;
369
- variationId?: string;
370
- section?: string;
371
- }, networkParameters?: NetworkParameters): true | Error;
372
-
373
- trackProductInsightsAgentQuestionSubmit(parameters: {
374
- itemId: string;
375
- itemName: string;
376
- question: string;
377
- variationId?: string;
378
- section?: string;
379
- }, networkParameters?: NetworkParameters): true | Error;
380
-
381
- trackProductInsightsAgentAnswerView(parameters: {
382
- itemId: string;
383
- itemName: string;
384
- question: string;
385
- answerText: string;
386
- qnaResultId?: string;
387
- variationId?: string;
388
- section?: string;
389
- }, networkParameters?: NetworkParameters): true | Error;
390
-
391
- trackProductInsightsAgentAnswerFeedback(parameters: {
392
- itemId: string;
393
- itemName: string;
394
- feedbackLabel: string;
395
- qnaResultId?: string;
396
- variationId?: string;
397
- section?: string;
398
- }, networkParameters?: NetworkParameters): true | Error;
336
+ trackAssistantSubmit: typeof Tracker.prototype.trackAgentSubmit;
337
+
338
+ trackAssistantResultLoadStarted: typeof Tracker.prototype.trackAgentResultLoadStarted;
339
+
340
+ trackAssistantResultLoadFinished: typeof Tracker.prototype.trackAgentResultLoadFinished;
341
+
342
+ trackAssistantResultClick: typeof Tracker.prototype.trackAgentResultClick;
343
+
344
+ trackAssistantResultView: typeof Tracker.prototype.trackAgentResultView;
345
+
346
+ trackAssistantSearchSubmit: typeof Tracker.prototype.trackAgentSearchSubmit;
347
+
348
+ trackProductInsightsAgentViews(
349
+ parameters: {
350
+ questions: Question[];
351
+ itemId: string;
352
+ itemName: string;
353
+ viewTimespans: TimeSpan[];
354
+ variationId?: string;
355
+ section?: string;
356
+ },
357
+ networkParameters?: NetworkParameters
358
+ ): true | Error;
359
+
360
+ trackProductInsightsAgentView(
361
+ parameters: {
362
+ questions: Question[];
363
+ itemId: string;
364
+ itemName: string;
365
+ variationId?: string;
366
+ section?: string;
367
+ },
368
+ networkParameters?: NetworkParameters
369
+ ): true | Error;
370
+
371
+ trackProductInsightsAgentOutOfView(
372
+ parameters: {
373
+ itemId: string;
374
+ itemName: string;
375
+ variationId?: string;
376
+ section?: string;
377
+ },
378
+ networkParameters?: NetworkParameters
379
+ ): true | Error;
380
+
381
+ trackProductInsightsAgentFocus(
382
+ parameters: {
383
+ itemId: string;
384
+ itemName: string;
385
+ variationId?: string;
386
+ section?: string;
387
+ },
388
+ networkParameters?: NetworkParameters
389
+ ): true | Error;
390
+
391
+ trackProductInsightsAgentQuestionClick(
392
+ parameters: {
393
+ itemId: string;
394
+ itemName: string;
395
+ question: string;
396
+ variationId?: string;
397
+ section?: string;
398
+ },
399
+ networkParameters?: NetworkParameters
400
+ ): true | Error;
401
+
402
+ trackProductInsightsAgentQuestionSubmit(
403
+ parameters: {
404
+ itemId: string;
405
+ itemName: string;
406
+ question: string;
407
+ variationId?: string;
408
+ section?: string;
409
+ },
410
+ networkParameters?: NetworkParameters
411
+ ): true | Error;
412
+
413
+ trackProductInsightsAgentAnswerView(
414
+ parameters: {
415
+ itemId: string;
416
+ itemName: string;
417
+ question: string;
418
+ answerText: string;
419
+ qnaResultId?: string;
420
+ variationId?: string;
421
+ section?: string;
422
+ },
423
+ networkParameters?: NetworkParameters
424
+ ): true | Error;
425
+
426
+ trackProductInsightsAgentAnswerFeedback(
427
+ parameters: {
428
+ itemId: string;
429
+ itemName: string;
430
+ feedbackLabel: string;
431
+ qnaResultId?: string;
432
+ variationId?: string;
433
+ section?: string;
434
+ },
435
+ networkParameters?: NetworkParameters
436
+ ): true | Error;
399
437
 
400
438
  on(messageType: string, callback: Function): true | Error;
401
439
  }
package/lib/version.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
- var _default = '2.66.2';
7
+ var _default = '2.67.1';
8
8
  exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-client-javascript",
3
- "version": "2.66.2",
3
+ "version": "2.67.1",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/index.d.ts",