@constructor-io/constructorio-client-javascript 2.28.0 → 2.29.3
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.
|
@@ -64,7 +64,8 @@ function createAutocompleteUrl(query, parameters, options) {
|
|
|
64
64
|
var numResults = parameters.numResults,
|
|
65
65
|
resultsPerSection = parameters.resultsPerSection,
|
|
66
66
|
filters = parameters.filters,
|
|
67
|
-
hiddenFields = parameters.hiddenFields
|
|
67
|
+
hiddenFields = parameters.hiddenFields,
|
|
68
|
+
variationsMap = parameters.variationsMap; // Pull results number from parameters
|
|
68
69
|
|
|
69
70
|
if (numResults) {
|
|
70
71
|
queryParams.num_results = numResults;
|
|
@@ -91,6 +92,11 @@ function createAutocompleteUrl(query, parameters, options) {
|
|
|
91
92
|
hidden_fields: hiddenFields
|
|
92
93
|
};
|
|
93
94
|
}
|
|
95
|
+
} // Pull variations map from parameters
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
if (variationsMap) {
|
|
99
|
+
queryParams.variations_map = JSON.stringify(variationsMap);
|
|
94
100
|
}
|
|
95
101
|
}
|
|
96
102
|
|
|
@@ -129,6 +135,7 @@ var Autocomplete = /*#__PURE__*/function () {
|
|
|
129
135
|
* @param {object} [parameters.filters] - Key / value mapping (dictionary) of filters used to refine results
|
|
130
136
|
* @param {object} [parameters.resultsPerSection] - Number of results to return (value) per section (key)
|
|
131
137
|
* @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
|
|
138
|
+
* @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
|
|
132
139
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
133
140
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
134
141
|
* @returns {Promise}
|
package/lib/modules/browse.js
CHANGED
|
@@ -66,7 +66,8 @@ function createQueryParams(parameters, options) {
|
|
|
66
66
|
section = parameters.section,
|
|
67
67
|
fmtOptions = parameters.fmtOptions,
|
|
68
68
|
hiddenFields = parameters.hiddenFields,
|
|
69
|
-
hiddenFacets = parameters.hiddenFacets
|
|
69
|
+
hiddenFacets = parameters.hiddenFacets,
|
|
70
|
+
variationsMap = parameters.variationsMap; // Pull page from parameters
|
|
70
71
|
|
|
71
72
|
if (!helpers.isNil(page)) {
|
|
72
73
|
queryParams.page = page;
|
|
@@ -121,6 +122,11 @@ function createQueryParams(parameters, options) {
|
|
|
121
122
|
hidden_facets: hiddenFacets
|
|
122
123
|
};
|
|
123
124
|
}
|
|
125
|
+
} // Pull variations map from parameters
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
if (variationsMap) {
|
|
129
|
+
queryParams.variations_map = JSON.stringify(variationsMap);
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
132
|
|
|
@@ -231,6 +237,7 @@ var Browse = /*#__PURE__*/function () {
|
|
|
231
237
|
* @param {object} [parameters.fmtOptions] - The format options used to refine result groups
|
|
232
238
|
* @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
|
|
233
239
|
* @param {string[]} [parameters.hiddenFacets] - Hidden facets to return
|
|
240
|
+
* @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
|
|
234
241
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
235
242
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
236
243
|
* @returns {Promise}
|
|
@@ -311,6 +318,7 @@ var Browse = /*#__PURE__*/function () {
|
|
|
311
318
|
* @param {object} [parameters.fmtOptions] - The format options used to refine result groups
|
|
312
319
|
* @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
|
|
313
320
|
* @param {string[]} [parameters.hiddenFacets] - Hidden facets to return
|
|
321
|
+
* @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
|
|
314
322
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
315
323
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
316
324
|
* @returns {Promise}
|
|
@@ -52,7 +52,8 @@ function createRecommendationsUrl(podId, parameters, options) {
|
|
|
52
52
|
itemIds = parameters.itemIds,
|
|
53
53
|
section = parameters.section,
|
|
54
54
|
term = parameters.term,
|
|
55
|
-
filters = parameters.filters
|
|
55
|
+
filters = parameters.filters,
|
|
56
|
+
variationsMap = parameters.variationsMap; // Pull num results number from parameters
|
|
56
57
|
|
|
57
58
|
if (!helpers.isNil(numResults)) {
|
|
58
59
|
queryParams.num_results = numResults;
|
|
@@ -76,6 +77,11 @@ function createRecommendationsUrl(podId, parameters, options) {
|
|
|
76
77
|
|
|
77
78
|
if (filters) {
|
|
78
79
|
queryParams.filters = filters;
|
|
80
|
+
} // Pull variations map from parameters
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
if (variationsMap) {
|
|
84
|
+
queryParams.variations_map = JSON.stringify(variationsMap);
|
|
79
85
|
}
|
|
80
86
|
}
|
|
81
87
|
|
|
@@ -112,6 +118,7 @@ var Recommendations = /*#__PURE__*/function () {
|
|
|
112
118
|
* @param {string} [parameters.section] - The section to return results from
|
|
113
119
|
* @param {string} [parameters.term] - The term to use to refine results (strategy specific)
|
|
114
120
|
* @param {object} [parameters.filters] - Key / value mapping of filters used to refine results (strategy specific)
|
|
121
|
+
* @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
|
|
115
122
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
116
123
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
117
124
|
* @returns {Promise}
|
package/lib/modules/search.js
CHANGED
|
@@ -66,7 +66,8 @@ function createSearchUrl(query, parameters, options) {
|
|
|
66
66
|
section = parameters.section,
|
|
67
67
|
fmtOptions = parameters.fmtOptions,
|
|
68
68
|
hiddenFields = parameters.hiddenFields,
|
|
69
|
-
hiddenFacets = parameters.hiddenFacets
|
|
69
|
+
hiddenFacets = parameters.hiddenFacets,
|
|
70
|
+
variationsMap = parameters.variationsMap; // Pull page from parameters
|
|
70
71
|
|
|
71
72
|
if (!helpers.isNil(page)) {
|
|
72
73
|
queryParams.page = page;
|
|
@@ -122,6 +123,11 @@ function createSearchUrl(query, parameters, options) {
|
|
|
122
123
|
hidden_facets: hiddenFacets
|
|
123
124
|
};
|
|
124
125
|
}
|
|
126
|
+
} // Pull variations map from parameters
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
if (variationsMap) {
|
|
130
|
+
queryParams.variations_map = JSON.stringify(variationsMap);
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
|
|
@@ -163,6 +169,7 @@ var Search = /*#__PURE__*/function () {
|
|
|
163
169
|
* @param {object} [parameters.fmtOptions] - The format options used to refine result groups
|
|
164
170
|
* @param {string[]} [parameters.hiddenFields] - Hidden metadata fields to return
|
|
165
171
|
* @param {string[]} [parameters.hiddenFacets] - Hidden facets to return
|
|
172
|
+
* @param {object} [parameters.variationsMap] - The variations map object to aggregate variations. Please refer to https://docs.constructor.io/rest_api/variations_mapping for details
|
|
166
173
|
* @param {object} [networkParameters] - Parameters relevant to the network request
|
|
167
174
|
* @param {number} [networkParameters.timeout] - Request timeout (in milliseconds)
|
|
168
175
|
* @returns {Promise}
|
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'];
|