@constructor-io/constructorio-client-javascript 2.66.1 → 2.67.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.
@@ -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
  * );
@@ -2276,25 +2275,25 @@ var Tracker = /*#__PURE__*/function () {
2276
2275
  /**
2277
2276
  * Send ASA request submitted event
2278
2277
  *
2279
- * @function trackAssistantSubmit
2278
+ * @function trackAgentSubmit
2280
2279
  * @param {object} parameters - Additional parameters to be sent with request
2281
2280
  * @param {string} parameters.intent - Intent of user request
2282
2281
  * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2283
2282
  * @param {object} [networkParameters] - Parameters relevant to the network request
2284
2283
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2285
2284
  * @returns {(true|Error)}
2286
- * @description User submitted an assistant search
2287
- * (pressing enter within assistant input element, or clicking assistant submit element)
2285
+ * @description User submitted an agent search
2286
+ * (pressing enter within agent input element, or clicking agent submit element)
2288
2287
  * @example
2289
- * constructorio.tracker.trackAssistantSubmit(
2288
+ * constructorio.tracker.trackAgentSubmit(
2290
2289
  * {
2291
2290
  * intent: 'show me a recipe for a cookie',
2292
2291
  * },
2293
2292
  * );
2294
2293
  */
2295
2294
  }, {
2296
- key: "trackAssistantSubmit",
2297
- value: function trackAssistantSubmit(parameters) {
2295
+ key: "trackAgentSubmit",
2296
+ value: function trackAgentSubmit(parameters) {
2298
2297
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2299
2298
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
2300
2299
  // Ensure parameters are provided (required)
@@ -2319,9 +2318,9 @@ var Tracker = /*#__PURE__*/function () {
2319
2318
  }
2320
2319
 
2321
2320
  /**
2322
- * Send assistant results page load started
2321
+ * Send agent results page load started
2323
2322
  *
2324
- * @function trackAssistantResultLoadStarted
2323
+ * @function trackAgentResultLoadStarted
2325
2324
  * @param {object} parameters - Additional parameters to be sent with request
2326
2325
  * @param {string} parameters.intent - Intent of user request
2327
2326
  * @param {string} [parameters.section] - The section name for the item Ex. "Products"
@@ -2329,9 +2328,9 @@ var Tracker = /*#__PURE__*/function () {
2329
2328
  * @param {object} [networkParameters] - Parameters relevant to the network request
2330
2329
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2331
2330
  * @returns {(true|Error)}
2332
- * @description Assistant results page load begun (but has not necessarily loaded completely)
2331
+ * @description Agent results page load begun (but has not necessarily loaded completely)
2333
2332
  * @example
2334
- * constructorio.tracker.trackAssistantResultLoadStarted(
2333
+ * constructorio.tracker.trackAgentResultLoadStarted(
2335
2334
  * {
2336
2335
  * intent: 'show me a recipe for a cookie',
2337
2336
  * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
@@ -2339,8 +2338,8 @@ var Tracker = /*#__PURE__*/function () {
2339
2338
  * );
2340
2339
  */
2341
2340
  }, {
2342
- key: "trackAssistantResultLoadStarted",
2343
- value: function trackAssistantResultLoadStarted(parameters) {
2341
+ key: "trackAgentResultLoadStarted",
2342
+ value: function trackAgentResultLoadStarted(parameters) {
2344
2343
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2345
2344
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
2346
2345
  // Ensure parameters are provided (required)
@@ -2367,9 +2366,9 @@ var Tracker = /*#__PURE__*/function () {
2367
2366
  }
2368
2367
 
2369
2368
  /**
2370
- * Send assistant results page load finished
2369
+ * Send agent results page load finished
2371
2370
  *
2372
- * @function trackAssistantResultLoadFinished
2371
+ * @function trackAgentResultLoadFinished
2373
2372
  * @param {object} parameters - Additional parameters to be sent with request
2374
2373
  * @param {string} parameters.intent - Intent of user request
2375
2374
  * @param {number} parameters.searchResultCount - Number of search results loaded
@@ -2378,9 +2377,9 @@ var Tracker = /*#__PURE__*/function () {
2378
2377
  * @param {object} [networkParameters] - Parameters relevant to the network request
2379
2378
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2380
2379
  * @returns {(true|Error)}
2381
- * @description Assistant results page load finished
2380
+ * @description Agent results page load finished
2382
2381
  * @example
2383
- * constructorio.tracker.trackAssistantResultLoadFinished(
2382
+ * constructorio.tracker.trackAgentResultLoadFinished(
2384
2383
  * {
2385
2384
  * intent: 'show me a recipe for a cookie',
2386
2385
  * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
@@ -2389,8 +2388,8 @@ var Tracker = /*#__PURE__*/function () {
2389
2388
  * );
2390
2389
  */
2391
2390
  }, {
2392
- key: "trackAssistantResultLoadFinished",
2393
- value: function trackAssistantResultLoadFinished(parameters) {
2391
+ key: "trackAgentResultLoadFinished",
2392
+ value: function trackAgentResultLoadFinished(parameters) {
2394
2393
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2395
2394
  // Ensure parameters are provided (required)
2396
2395
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
@@ -2419,9 +2418,9 @@ var Tracker = /*#__PURE__*/function () {
2419
2418
  }
2420
2419
 
2421
2420
  /**
2422
- * Send assistant result click event to API
2421
+ * Send agent result click event to API
2423
2422
  *
2424
- * @function trackAssistantResultClick
2423
+ * @function trackAgentResultClick
2425
2424
  * @param {object} parameters - Additional parameters to be sent with request
2426
2425
  * @param {string} parameters.intent - intent of the user
2427
2426
  * @param {string} parameters.searchResultId - result_id of the specific search result the clicked item belongs to
@@ -2433,9 +2432,9 @@ var Tracker = /*#__PURE__*/function () {
2433
2432
  * @param {object} [networkParameters] - Parameters relevant to the network request
2434
2433
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2435
2434
  * @returns {(true|Error)}
2436
- * @description User clicked a result that appeared within an assistant search result
2435
+ * @description User clicked a result that appeared within an agent search result
2437
2436
  * @example
2438
- * constructorio.tracker.trackAssistantResultClick(
2437
+ * constructorio.tracker.trackAgentResultClick(
2439
2438
  * {
2440
2439
  * variationId: 'KMH879-7632',
2441
2440
  * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
@@ -2446,8 +2445,8 @@ var Tracker = /*#__PURE__*/function () {
2446
2445
  * );
2447
2446
  */
2448
2447
  }, {
2449
- key: "trackAssistantResultClick",
2450
- value: function trackAssistantResultClick(parameters) {
2448
+ key: "trackAgentResultClick",
2449
+ value: function trackAgentResultClick(parameters) {
2451
2450
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2452
2451
  // Ensure parameters are provided (required)
2453
2452
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
@@ -2483,9 +2482,9 @@ var Tracker = /*#__PURE__*/function () {
2483
2482
  }
2484
2483
 
2485
2484
  /**
2486
- * Send assistant search result view event to API
2485
+ * Send agent search result view event to API
2487
2486
  *
2488
- * @function trackAssistantResultView
2487
+ * @function trackAgentResultView
2489
2488
  * @param {object} parameters - Additional parameters to be sent with request
2490
2489
  * @param {string} parameters.intent - intent of the user
2491
2490
  * @param {string} parameters.searchResultId - result_id of the specific search result the clicked item belongs to
@@ -2496,9 +2495,9 @@ var Tracker = /*#__PURE__*/function () {
2496
2495
  * @param {object} [networkParameters] - Parameters relevant to the network request
2497
2496
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2498
2497
  * @returns {(true|Error)}
2499
- * @description User viewed a search result within an assistant result
2498
+ * @description User viewed a search result within an agent result
2500
2499
  * @example
2501
- * constructorio.tracker.trackAssistantResultView(
2500
+ * constructorio.tracker.trackAgentResultView(
2502
2501
  * {
2503
2502
  * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2504
2503
  * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
@@ -2509,8 +2508,8 @@ var Tracker = /*#__PURE__*/function () {
2509
2508
  * );
2510
2509
  */
2511
2510
  }, {
2512
- key: "trackAssistantResultView",
2513
- value: function trackAssistantResultView(parameters) {
2511
+ key: "trackAgentResultView",
2512
+ value: function trackAgentResultView(parameters) {
2514
2513
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2515
2514
  // Ensure parameters are provided (required)
2516
2515
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
@@ -2548,19 +2547,19 @@ var Tracker = /*#__PURE__*/function () {
2548
2547
  /**
2549
2548
  * Send ASA search submitted event
2550
2549
  *
2551
- * @function trackAssistantSearchSubmit
2550
+ * @function trackAgentSearchSubmit
2552
2551
  * @param {object} parameters - Additional parameters to be sent with request
2553
2552
  * @param {string} parameters.intent - Intent of user request
2554
- * @param {string} parameters.searchTerm - Term of submitted assistant search event
2553
+ * @param {string} parameters.searchTerm - Term of submitted agent search event
2555
2554
  * @param {string} parameters.searchResultId - resultId of search result the clicked item belongs to
2556
2555
  * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2557
2556
  * @param {string} [parameters.intentResultId] - intentResultId from the ASA response
2558
2557
  * @param {object} [networkParameters] - Parameters relevant to the network request
2559
2558
  * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2560
2559
  * @returns {(true|Error)}
2561
- * @description User submitted an alternative assistant search result search term
2560
+ * @description User submitted an alternative agent search result search term
2562
2561
  * @example
2563
- * constructorio.tracker.trackAssistantSearchSubmit({
2562
+ * constructorio.tracker.trackAgentSearchSubmit({
2564
2563
  * {
2565
2564
  * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2566
2565
  * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
@@ -2570,8 +2569,8 @@ var Tracker = /*#__PURE__*/function () {
2570
2569
  * );
2571
2570
  */
2572
2571
  }, {
2573
- key: "trackAssistantSearchSubmit",
2574
- value: function trackAssistantSearchSubmit(parameters) {
2572
+ key: "trackAgentSearchSubmit",
2573
+ value: function trackAgentSearchSubmit(parameters) {
2575
2574
  var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2576
2575
  // Ensure parameters are provided (required)
2577
2576
  if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
@@ -2602,6 +2601,192 @@ var Tracker = /*#__PURE__*/function () {
2602
2601
  return new Error('parameters is a required parameter of type object');
2603
2602
  }
2604
2603
 
2604
+ /**
2605
+ * Send ASA request submitted event
2606
+ *
2607
+ * @deprecated This method will be removed in a future version. Use trackAgentSubmit instead.
2608
+ * @function trackAssistantSubmit
2609
+ * @param {object} parameters - Additional parameters to be sent with request
2610
+ * @param {string} parameters.intent - Intent of user request
2611
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2612
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2613
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2614
+ * @returns {(true|Error)}
2615
+ * @description User submitted an assistant search
2616
+ * (pressing enter within assistant input element, or clicking assistant submit element)
2617
+ * @example
2618
+ * constructorio.tracker.trackAssistantSubmit(
2619
+ * {
2620
+ * intent: 'show me a recipe for a cookie',
2621
+ * },
2622
+ * );
2623
+ */
2624
+ }, {
2625
+ key: "trackAssistantSubmit",
2626
+ value: function trackAssistantSubmit(parameters) {
2627
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2628
+ return this.trackAgentSubmit(parameters, networkParameters);
2629
+ }
2630
+
2631
+ /**
2632
+ * Send assistant results page load started
2633
+ *
2634
+ * @deprecated This method will be removed in a future version. Use trackAgentResultLoadStarted instead.
2635
+ * @function trackAssistantResultLoadStarted
2636
+ * @param {object} parameters - Additional parameters to be sent with request
2637
+ * @param {string} parameters.intent - Intent of user request
2638
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2639
+ * @param {string} [parameters.intentResultId] - The intent result id from the ASA response
2640
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2641
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2642
+ * @returns {(true|Error)}
2643
+ * @description Assistant results page load begun (but has not necessarily loaded completely)
2644
+ * @example
2645
+ * constructorio.tracker.trackAssistantResultLoadStarted(
2646
+ * {
2647
+ * intent: 'show me a recipe for a cookie',
2648
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2649
+ * },
2650
+ * );
2651
+ */
2652
+ }, {
2653
+ key: "trackAssistantResultLoadStarted",
2654
+ value: function trackAssistantResultLoadStarted(parameters) {
2655
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2656
+ return this.trackAgentResultLoadStarted(parameters, networkParameters);
2657
+ }
2658
+
2659
+ /**
2660
+ * Send assistant results page load finished
2661
+ *
2662
+ * @deprecated This method will be removed in a future version. Use trackAgentResultLoadFinished instead.
2663
+ * @function trackAssistantResultLoadFinished
2664
+ * @param {object} parameters - Additional parameters to be sent with request
2665
+ * @param {string} parameters.intent - Intent of user request
2666
+ * @param {number} parameters.searchResultCount - Number of search results loaded
2667
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2668
+ * @param {string} [parameters.intentResultId] - The intent result id from the ASA response
2669
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2670
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2671
+ * @returns {(true|Error)}
2672
+ * @description Assistant results page load finished
2673
+ * @example
2674
+ * constructorio.tracker.trackAssistantResultLoadFinished(
2675
+ * {
2676
+ * intent: 'show me a recipe for a cookie',
2677
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2678
+ * searchResultCount: 5,
2679
+ * },
2680
+ * );
2681
+ */
2682
+ }, {
2683
+ key: "trackAssistantResultLoadFinished",
2684
+ value: function trackAssistantResultLoadFinished(parameters) {
2685
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2686
+ return this.trackAgentResultLoadFinished(parameters, networkParameters);
2687
+ }
2688
+
2689
+ /**
2690
+ * Send assistant result click event to API
2691
+ *
2692
+ * @deprecated This method will be removed in a future version. Use trackAgentResultClick instead.
2693
+ * @function trackAssistantResultClick
2694
+ * @param {object} parameters - Additional parameters to be sent with request
2695
+ * @param {string} parameters.intent - intent of the user
2696
+ * @param {string} parameters.searchResultId - result_id of the specific search result the clicked item belongs to
2697
+ * @param {string} parameters.itemId - Product item unique identifier
2698
+ * @param {string} parameters.itemName - Product item name
2699
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2700
+ * @param {string} [parameters.variationId] - Product item variation unique identifier
2701
+ * @param {string} [parameters.intentResultId] - Browse result identifier (returned in response from Constructor)
2702
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2703
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2704
+ * @returns {(true|Error)}
2705
+ * @description User clicked a result that appeared within an assistant search result
2706
+ * @example
2707
+ * constructorio.tracker.trackAssistantResultClick(
2708
+ * {
2709
+ * variationId: 'KMH879-7632',
2710
+ * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2711
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2712
+ * intent: 'show me a recipe for a cookie',
2713
+ * itemId: 'KMH876',
2714
+ * },
2715
+ * );
2716
+ */
2717
+ }, {
2718
+ key: "trackAssistantResultClick",
2719
+ value: function trackAssistantResultClick(parameters) {
2720
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2721
+ return this.trackAgentResultClick(parameters, networkParameters);
2722
+ }
2723
+
2724
+ /**
2725
+ * Send assistant search result view event to API
2726
+ *
2727
+ * @deprecated This method will be removed in a future version. Use trackAgentResultView instead.
2728
+ * @function trackAssistantResultView
2729
+ * @param {object} parameters - Additional parameters to be sent with request
2730
+ * @param {string} parameters.intent - intent of the user
2731
+ * @param {string} parameters.searchResultId - result_id of the specific search result the clicked item belongs to
2732
+ * @param {number} parameters.numResultsViewed - Number of items viewed in this search result
2733
+ * @param {object[]} [parameters.items] - List of product item objects viewed
2734
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2735
+ * @param {string} [parameters.intentResultId] - Browse result identifier (returned in response from Constructor)
2736
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2737
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2738
+ * @returns {(true|Error)}
2739
+ * @description User viewed a search result within an assistant result
2740
+ * @example
2741
+ * constructorio.tracker.trackAssistantResultView(
2742
+ * {
2743
+ * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2744
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2745
+ * intent: 'show me a recipe for a cookie',
2746
+ * numResultsViewed: 5,
2747
+ * items: [{itemId: 'KMH876'}, {itemId: 'KMH140'}, {itemId: 'KMH437'}],
2748
+ * },
2749
+ * );
2750
+ */
2751
+ }, {
2752
+ key: "trackAssistantResultView",
2753
+ value: function trackAssistantResultView(parameters) {
2754
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2755
+ return this.trackAgentResultView(parameters, networkParameters);
2756
+ }
2757
+
2758
+ /**
2759
+ * Send ASA search submitted event
2760
+ *
2761
+ * @deprecated This method will be removed in a future version. Use trackAgentSearchSubmit instead.
2762
+ * @function trackAssistantSearchSubmit
2763
+ * @param {object} parameters - Additional parameters to be sent with request
2764
+ * @param {string} parameters.intent - Intent of user request
2765
+ * @param {string} parameters.searchTerm - Term of submitted assistant search event
2766
+ * @param {string} parameters.searchResultId - resultId of search result the clicked item belongs to
2767
+ * @param {string} [parameters.section] - The section name for the item Ex. "Products"
2768
+ * @param {string} [parameters.intentResultId] - intentResultId from the ASA response
2769
+ * @param {object} [networkParameters] - Parameters relevant to the network request
2770
+ * @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
2771
+ * @returns {(true|Error)}
2772
+ * @description User submitted an alternative assistant search result search term
2773
+ * @example
2774
+ * constructorio.tracker.trackAssistantSearchSubmit({
2775
+ * {
2776
+ * searchResultId: '019927c2-f955-4020-8b8d-6b21b93cb5a2',
2777
+ * intentResultId: 'Zde93fd-f955-4020-8b8d-6b21b93cb5a2',
2778
+ * intent: 'show me a recipe for a cookie',
2779
+ * searchTerm: 'flour',
2780
+ * },
2781
+ * );
2782
+ */
2783
+ }, {
2784
+ key: "trackAssistantSearchSubmit",
2785
+ value: function trackAssistantSearchSubmit(parameters) {
2786
+ var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2787
+ return this.trackAgentSearchSubmit(parameters, networkParameters);
2788
+ }
2789
+
2605
2790
  /**
2606
2791
  * Send product insights agent view events
2607
2792
  *
@@ -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;
@@ -266,7 +266,7 @@ declare class Tracker {
266
266
  networkParameters?: NetworkParameters
267
267
  ): true | Error;
268
268
 
269
- trackAssistantSubmit(
269
+ trackAgentSubmit(
270
270
  parameters: {
271
271
  intent: string;
272
272
  section?: string;
@@ -274,7 +274,7 @@ declare class Tracker {
274
274
  networkParameters?: NetworkParameters
275
275
  ): true | Error;
276
276
 
277
- trackAssistantResultLoadStarted(
277
+ trackAgentResultLoadStarted(
278
278
  parameters: {
279
279
  intent: string;
280
280
  section?: string;
@@ -283,7 +283,7 @@ declare class Tracker {
283
283
  networkParameters?: NetworkParameters
284
284
  ): true | Error;
285
285
 
286
- trackAssistantResultLoadFinished(
286
+ trackAgentResultLoadFinished(
287
287
  parameters: {
288
288
  intent: string;
289
289
  searchResultCount: number;
@@ -293,7 +293,7 @@ declare class Tracker {
293
293
  networkParameters?: NetworkParameters
294
294
  ): true | Error;
295
295
 
296
- trackAssistantResultClick(
296
+ trackAgentResultClick(
297
297
  parameters: {
298
298
  intent: string;
299
299
  searchResultId: string;
@@ -306,7 +306,7 @@ declare class Tracker {
306
306
  networkParameters?: NetworkParameters
307
307
  ): true | Error;
308
308
 
309
- trackAssistantResultView(
309
+ trackAgentResultView(
310
310
  parameters: {
311
311
  intent: string;
312
312
  searchResultId: string;
@@ -318,7 +318,7 @@ declare class Tracker {
318
318
  networkParameters?: NetworkParameters
319
319
  ): true | Error;
320
320
 
321
- trackAssistantSearchSubmit(
321
+ trackAgentSearchSubmit(
322
322
  parameters: {
323
323
  intent: string;
324
324
  searchTerm: string;
@@ -331,71 +331,107 @@ declare class Tracker {
331
331
  networkParameters?: NetworkParameters
332
332
  ): true | Error;
333
333
 
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;
334
+ trackAssistantSubmit: typeof Tracker.prototype.trackAgentSubmit;
335
+
336
+ trackAssistantResultLoadStarted: typeof Tracker.prototype.trackAgentResultLoadStarted;
337
+
338
+ trackAssistantResultLoadFinished: typeof Tracker.prototype.trackAgentResultLoadFinished;
339
+
340
+ trackAssistantResultClick: typeof Tracker.prototype.trackAgentResultClick;
341
+
342
+ trackAssistantResultView: typeof Tracker.prototype.trackAgentResultView;
343
+
344
+ trackAssistantSearchSubmit: typeof Tracker.prototype.trackAgentSearchSubmit;
345
+
346
+ trackProductInsightsAgentViews(
347
+ parameters: {
348
+ questions: Question[];
349
+ itemId: string;
350
+ itemName: string;
351
+ viewTimespans: TimeSpan[];
352
+ variationId?: string;
353
+ section?: string;
354
+ },
355
+ networkParameters?: NetworkParameters
356
+ ): true | Error;
357
+
358
+ trackProductInsightsAgentView(
359
+ parameters: {
360
+ questions: Question[];
361
+ itemId: string;
362
+ itemName: string;
363
+ variationId?: string;
364
+ section?: string;
365
+ },
366
+ networkParameters?: NetworkParameters
367
+ ): true | Error;
368
+
369
+ trackProductInsightsAgentOutOfView(
370
+ parameters: {
371
+ itemId: string;
372
+ itemName: string;
373
+ variationId?: string;
374
+ section?: string;
375
+ },
376
+ networkParameters?: NetworkParameters
377
+ ): true | Error;
378
+
379
+ trackProductInsightsAgentFocus(
380
+ parameters: {
381
+ itemId: string;
382
+ itemName: string;
383
+ variationId?: string;
384
+ section?: string;
385
+ },
386
+ networkParameters?: NetworkParameters
387
+ ): true | Error;
388
+
389
+ trackProductInsightsAgentQuestionClick(
390
+ parameters: {
391
+ itemId: string;
392
+ itemName: string;
393
+ question: string;
394
+ variationId?: string;
395
+ section?: string;
396
+ },
397
+ networkParameters?: NetworkParameters
398
+ ): true | Error;
399
+
400
+ trackProductInsightsAgentQuestionSubmit(
401
+ parameters: {
402
+ itemId: string;
403
+ itemName: string;
404
+ question: string;
405
+ variationId?: string;
406
+ section?: string;
407
+ },
408
+ networkParameters?: NetworkParameters
409
+ ): true | Error;
410
+
411
+ trackProductInsightsAgentAnswerView(
412
+ parameters: {
413
+ itemId: string;
414
+ itemName: string;
415
+ question: string;
416
+ answerText: string;
417
+ qnaResultId?: string;
418
+ variationId?: string;
419
+ section?: string;
420
+ },
421
+ networkParameters?: NetworkParameters
422
+ ): true | Error;
423
+
424
+ trackProductInsightsAgentAnswerFeedback(
425
+ parameters: {
426
+ itemId: string;
427
+ itemName: string;
428
+ feedbackLabel: string;
429
+ qnaResultId?: string;
430
+ variationId?: string;
431
+ section?: string;
432
+ },
433
+ networkParameters?: NetworkParameters
434
+ ): true | Error;
399
435
 
400
436
  on(messageType: string, callback: Function): true | Error;
401
437
  }
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.1';
7
+ var _default = '2.67.0';
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.1",
3
+ "version": "2.67.0",
4
4
  "description": "Constructor.io JavaScript client",
5
5
  "main": "lib/constructorio.js",
6
6
  "types": "lib/types/index.d.ts",