@constructor-io/constructorio-client-javascript 2.29.0 → 2.29.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/modules/tracker.js
CHANGED
|
@@ -187,34 +187,43 @@ var Tracker = /*#__PURE__*/function () {
|
|
|
187
187
|
|
|
188
188
|
// Ensure parameters are provided (required)
|
|
189
189
|
if (parameters && (0, _typeof2["default"])(parameters) === 'object' && !Array.isArray(parameters)) {
|
|
190
|
-
var
|
|
191
|
-
var queryParams = {
|
|
192
|
-
|
|
193
|
-
};
|
|
190
|
+
var requestUrlPath = "".concat(this.options.serviceUrl, "/v2/behavioral_action/item_detail_load?");
|
|
191
|
+
var queryParams = {};
|
|
192
|
+
var bodyParams = {};
|
|
194
193
|
var item_name = parameters.item_name,
|
|
195
194
|
name = parameters.name,
|
|
196
195
|
item_id = parameters.item_id,
|
|
197
196
|
customer_id = parameters.customer_id,
|
|
198
|
-
variation_id = parameters.variation_id
|
|
197
|
+
variation_id = parameters.variation_id,
|
|
198
|
+
url = parameters.url; // Ensure support for both item_name and name as parameters
|
|
199
199
|
|
|
200
200
|
if (item_name) {
|
|
201
|
-
|
|
201
|
+
bodyParams.item_name = item_name;
|
|
202
202
|
} else if (name) {
|
|
203
|
-
|
|
203
|
+
bodyParams.item_name = name;
|
|
204
204
|
} // Ensure support for both item_id and customer_id as parameters
|
|
205
205
|
|
|
206
206
|
|
|
207
207
|
if (item_id) {
|
|
208
|
-
|
|
208
|
+
bodyParams.item_id = item_id;
|
|
209
209
|
} else if (customer_id) {
|
|
210
|
-
|
|
210
|
+
bodyParams.item_id = customer_id;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
if (variation_id) {
|
|
214
|
-
|
|
214
|
+
bodyParams.variation_id = variation_id;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
if (url) {
|
|
218
|
+
bodyParams.url = url;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
var requestURL = "".concat(requestUrlPath).concat(applyParamsAsString(queryParams, this.options));
|
|
222
|
+
var requestMethod = 'POST';
|
|
223
|
+
var requestBody = applyParams(bodyParams, _objectSpread(_objectSpread({}, this.options), {}, {
|
|
224
|
+
requestMethod: requestMethod
|
|
225
|
+
}));
|
|
226
|
+
this.requests.queue(requestURL, requestMethod, requestBody, networkParameters);
|
|
218
227
|
this.requests.send();
|
|
219
228
|
return true;
|
|
220
229
|
}
|
|
@@ -439,6 +448,7 @@ var Tracker = /*#__PURE__*/function () {
|
|
|
439
448
|
* @param {string} parameters.item_id - Product item unique identifier
|
|
440
449
|
* @param {string} [parameters.variation_id] - Product item variation unique identifier
|
|
441
450
|
* @param {string} [parameters.result_id] - Search result identifier (returned in response from Constructor)
|
|
451
|
+
* @param {string} [parameters.item_is_convertible] - Whether or not an item is available for a conversion
|
|
442
452
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
443
453
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
444
454
|
* @returns {(true|Error)}
|
|
@@ -470,7 +480,8 @@ var Tracker = /*#__PURE__*/function () {
|
|
|
470
480
|
item_id = parameters.item_id,
|
|
471
481
|
customer_id = parameters.customer_id,
|
|
472
482
|
variation_id = parameters.variation_id,
|
|
473
|
-
result_id = parameters.result_id
|
|
483
|
+
result_id = parameters.result_id,
|
|
484
|
+
item_is_convertible = parameters.item_is_convertible; // Ensure support for both item_name and name as parameters
|
|
474
485
|
|
|
475
486
|
if (item_name) {
|
|
476
487
|
queryParams.name = item_name;
|
|
@@ -493,6 +504,10 @@ var Tracker = /*#__PURE__*/function () {
|
|
|
493
504
|
queryParams.result_id = result_id;
|
|
494
505
|
}
|
|
495
506
|
|
|
507
|
+
if (typeof item_is_convertible === 'boolean') {
|
|
508
|
+
queryParams.item_is_convertible = item_is_convertible;
|
|
509
|
+
}
|
|
510
|
+
|
|
496
511
|
this.requests.queue("".concat(url).concat(applyParamsAsString(queryParams, this.options)), undefined, undefined, networkParameters);
|
|
497
512
|
this.requests.send();
|
|
498
513
|
return true;
|
package/lib/utils/botlist.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/* eslint-disable no-useless-escape */
|
|
4
|
-
module.exports = ['Googlebot\/', 'Googlebot-Mobile', 'Googlebot-Image', 'Googlebot-News', 'Googlebot-Video', 'AdsBot-Google([^-]|$)', 'AdsBot-Google-Mobile', 'Feedfetcher-Google', 'Mediapartners-Google', 'Mediapartners
|
|
4
|
+
module.exports = ['Googlebot\/', 'Googlebot-Mobile', 'Googlebot-Image', 'Googlebot-News', 'Googlebot-Video', 'AdsBot-Google([^-]|$)', 'AdsBot-Google-Mobile', 'Feedfetcher-Google', 'Mediapartners-Google', 'Mediapartners \\(Googlebot\\)', 'APIs-Google', 'bingbot', 'Slurp', '[wW]get', 'curl', 'LinkedInBot', 'Python-urllib', 'python-requests', 'libwww', 'httpunit', 'nutch', 'Go-http-client', 'phpcrawl', 'msnbot', 'jyxobot', 'FAST-WebCrawler', 'FAST Enterprise Crawler', 'BIGLOTRON', 'Teoma', 'convera', 'seekbot', 'Gigabot', 'Gigablast', 'exabot', 'ia_archiver', 'GingerCrawler', 'webmon ', 'HTTrack', 'grub\\.org', 'UsineNouvelleCrawler', 'antibot', 'netresearchserver', 'speedy', 'fluffy', 'bibnum\\.bnf', 'findlink', 'msrbot', 'panscient', 'yacybot', 'AISearchBot', 'ips-agent', 'tagoobot', 'MJ12bot', 'woriobot', 'yanga', 'buzzbot', 'mlbot', 'YandexBot', 'yandex\\.com\/bots', 'purebot', 'Linguee Bot', 'CyberPatrol', 'voilabot', 'Baiduspider', 'citeseerxbot', 'spbot', 'twengabot', 'postrank', 'turnitinbot', 'scribdbot', 'page2rss', 'sitebot', 'linkdex', 'Adidxbot', 'blekkobot', 'ezooms', 'dotbot', 'Mail\\.RU_Bot', 'discobot', 'heritrix', 'findthatfile', 'europarchive\\.org', 'NerdByNature\\.Bot', 'sistrix crawler', 'Ahrefs(Bot|SiteAudit)', 'fuelbot', 'CrunchBot', 'centurybot9', 'IndeedBot', 'mappydata', 'woobot', 'ZoominfoBot', 'PrivacyAwareBot', 'Multiviewbot', 'SWIMGBot', 'Grobbot', 'eright', 'Apercite', 'semanticbot', 'Aboundex', 'domaincrawler', 'wbsearchbot', 'summify', 'CCBot', 'edisterbot', 'seznambot', 'ec2linkfinder', 'gslfbot', 'aiHitBot', 'intelium_bot', 'facebookexternalhit', 'Yeti', 'RetrevoPageAnalyzer', 'lb-spider', 'Sogou', 'lssbot', 'careerbot', 'wotbox', 'wocbot', 'ichiro', 'DuckDuckBot', 'lssrocketcrawler', 'drupact', 'webcompanycrawler', 'acoonbot', 'openindexspider', 'gnam gnam spider', 'web-archive-net\\.com\\.bot', 'backlinkcrawler', 'coccoc', 'integromedb', 'content crawler spider', 'toplistbot', 'it2media-domain-crawler', 'ip-web-crawler\\.com', 'siteexplorer\\.info', 'elisabot', 'proximic', 'changedetection', 'arabot', 'WeSEE:Search', 'niki-bot', 'CrystalSemanticsBot', 'rogerbot', '360Spider', 'psbot', 'InterfaxScanBot', 'CC Metadata Scaper', 'g00g1e\\.net', 'GrapeshotCrawler', 'urlappendbot', 'brainobot', 'fr-crawler', 'binlar', 'SimpleCrawler', 'Twitterbot', 'cXensebot', 'smtbot', 'bnf\\.fr_bot', 'A6-Indexer', 'ADmantX', 'Facebot', 'OrangeBot\/', 'memorybot', 'AdvBot', 'MegaIndex', 'SemanticScholarBot', 'ltx71', 'nerdybot', 'xovibot', 'BUbiNG', 'Qwantify', 'archive\\.org_bot', 'Applebot', 'TweetmemeBot', 'crawler4j', 'findxbot', 'S[eE][mM]rushBot', 'yoozBot', 'lipperhey', 'Y!J', 'Domain Re-Animator Bot', 'AddThis', 'Screaming Frog SEO Spider', 'MetaURI', 'Scrapy', 'Livelap[bB]ot', 'OpenHoseBot', 'CapsuleChecker', 'collection@infegy\\.com', 'IstellaBot', 'DeuSu\/', 'betaBot', 'Cliqzbot\/', 'MojeekBot\/', 'netEstate NE Crawler', 'SafeSearch microdata crawler', 'Gluten Free Crawler\/', 'Sonic', 'Sysomos', 'Trove', 'deadlinkchecker', 'Slack-ImgProxy', 'Embedly', 'RankActiveLinkBot', 'iskanie', 'SafeDNSBot', 'SkypeUriPreview', 'Veoozbot', 'Slackbot', 'redditbot', 'datagnionbot', 'Google-Adwords-Instant', 'adbeat_bot', 'WhatsApp', 'contxbot', 'pinterest', 'electricmonk', 'GarlikCrawler', 'BingPreview\/', 'vebidoobot', 'FemtosearchBot', 'Yahoo Link Preview', 'MetaJobBot', 'DomainStatsBot', 'mindUpBot', 'Daum\/', 'Jugendschutzprogramm-Crawler', 'Xenu Link Sleuth', 'Pcore-HTTP', 'moatbot', 'KosmioBot', 'pingdom', 'PhantomJS', 'Gowikibot', 'PiplBot', 'Discordbot', 'TelegramBot', 'Jetslide', 'newsharecounts', 'James BOT', 'Barkrowler', 'TinEye', 'SocialRankIOBot', 'trendictionbot', 'Ocarinabot', 'epicbot', 'Primalbot', 'DuckDuckGo-Favicons-Bot', 'GnowitNewsbot', 'Leikibot', 'LinkArchiver', 'YaK\/', 'PaperLiBot', 'Digg Deeper', 'dcrawl', 'Snacktory', 'AndersPinkBot', 'Fyrebot', 'EveryoneSocialBot', 'Mediatoolkitbot', 'Luminator-robots', 'ExtLinksBot', 'SurveyBot', 'NING\/', 'okhttp', 'Nuzzel', 'omgili', 'PocketParser', 'YisouSpider', 'um-LN', 'ToutiaoSpider', 'MuckRack', "Jamie's Spider", 'AHC\/', 'NetcraftSurveyAgent', 'Laserlikebot', 'Apache-HttpClient', 'AppEngine-Google', 'Jetty', 'Upflow', 'Thinklab', 'Traackr\\.com', 'Twurly', 'Mastodon', 'http_get', 'DnyzBot', 'botify', '007ac9 Crawler', 'BehloolBot', 'BrandVerity', 'check_http', 'BDCbot', 'ZumBot', 'EZID', 'ICC-Crawler', 'ArchiveBot', '^LCC ', 'filterdb\\.iss\\.net\/crawler', 'BLP_bbot', 'BomboraBot', 'Buck\/', 'Companybook-Crawler', 'Genieo', 'magpie-crawler', 'MeltwaterNews', 'Moreover', 'newspaper\/', 'ScoutJet', '(^| )sentry\/', 'StorygizeBot', 'UptimeRobot', 'OutclicksBot', 'seoscanners', 'Hatena', 'Google Web Preview', 'MauiBot', 'AlphaBot', 'SBL-BOT', 'IAS crawler', 'adscanner', 'Netvibes', 'acapbot', 'Baidu-YunGuanCe', 'bitlybot', 'blogmuraBot', 'Bot\\.AraTurka\\.com', 'bot-pge\\.chlooe\\.com', 'BoxcarBot', 'BTWebClient', 'ContextAd Bot', 'Digincore bot', 'Disqus', 'Feedly', 'Fetch\/', 'Fever', 'Flamingo_SearchEngine', 'FlipboardProxy', 'g2reader-bot', 'imrbot', 'K7MLWCBot', 'Kemvibot', 'Landau-Media-Spider', 'linkapediabot', 'vkShare', 'Siteimprove\\.com', 'BLEXBot\/', 'DareBoost', 'ZuperlistBot\/', 'Miniflux\/', 'Feedspotbot\/', 'Diffbot\/', 'SEOkicks', 'tracemyfile', 'Nimbostratus-Bot'];
|
|
@@ -7,7 +7,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
8
|
|
|
9
9
|
/* eslint-disable no-unneeded-ternary */
|
|
10
|
-
var helpers = require('
|
|
10
|
+
var helpers = require('./helpers');
|
|
11
11
|
|
|
12
12
|
var EventDispatcher = /*#__PURE__*/function () {
|
|
13
13
|
function EventDispatcher(options) {
|
package/lib/utils/helpers.js
CHANGED
|
@@ -140,12 +140,12 @@ var utils = {
|
|
|
140
140
|
applyNetworkTimeout: function applyNetworkTimeout() {
|
|
141
141
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
142
142
|
var networkParameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
143
|
-
var controller = arguments.length > 2 ? arguments[2] :
|
|
143
|
+
var controller = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
144
144
|
var optionsTimeout = options && options.networkParameters && options.networkParameters.timeout;
|
|
145
145
|
var networkParametersTimeout = networkParameters && networkParameters.timeout;
|
|
146
146
|
var timeout = optionsTimeout || networkParametersTimeout;
|
|
147
147
|
|
|
148
|
-
if (typeof timeout === 'number') {
|
|
148
|
+
if (typeof timeout === 'number' && controller) {
|
|
149
149
|
setTimeout(function () {
|
|
150
150
|
return controller.abort();
|
|
151
151
|
}, timeout);
|
|
@@ -7,7 +7,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
7
7
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
8
|
|
|
9
9
|
/* eslint-disable class-methods-use-this */
|
|
10
|
-
var store = require('
|
|
10
|
+
var store = require('./store');
|
|
11
11
|
|
|
12
12
|
var botList = require('./botlist');
|
|
13
13
|
|
|
@@ -11,11 +11,11 @@ var fetchPonyfill = require('fetch-ponyfill');
|
|
|
11
11
|
|
|
12
12
|
var Promise = require('es6-promise');
|
|
13
13
|
|
|
14
|
-
var store = require('
|
|
14
|
+
var store = require('./store');
|
|
15
15
|
|
|
16
|
-
var HumanityCheck = require('
|
|
16
|
+
var HumanityCheck = require('./humanity-check');
|
|
17
17
|
|
|
18
|
-
var helpers = require('
|
|
18
|
+
var helpers = require('./helpers');
|
|
19
19
|
|
|
20
20
|
var storageKey = '_constructorio_requests';
|
|
21
21
|
var requestTTL = 180000; // 3 minutes in milliseconds
|
|
@@ -47,7 +47,7 @@ var RequestQueue = /*#__PURE__*/function () {
|
|
|
47
47
|
key: "queue",
|
|
48
48
|
value: function queue(url) {
|
|
49
49
|
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GET';
|
|
50
|
-
var body = arguments.length > 2 ? arguments[2] :
|
|
50
|
+
var body = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
51
51
|
var networkParameters = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
52
52
|
|
|
53
53
|
if (this.sendTrackingEvents && !this.humanity.isBot()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructor-io/constructorio-client-javascript",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.4",
|
|
4
4
|
"description": "Constructor.io JavaScript client",
|
|
5
5
|
"main": "lib/constructorio.js",
|
|
6
6
|
"scripts": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"chai-as-promised": "^7.1.1",
|
|
45
45
|
"dotenv": "^8.6.0",
|
|
46
46
|
"esbuild": "^0.12.28",
|
|
47
|
-
"eslint": "^8.0
|
|
48
|
-
"eslint-config-airbnb-base": "^
|
|
47
|
+
"eslint": "^8.17.0",
|
|
48
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
49
49
|
"eslint-plugin-import": "^2.25.2",
|
|
50
50
|
"husky": "^7.0.4",
|
|
51
51
|
"jsdoc": "^3.6.7",
|