instantsearch.js 4.68.0 → 4.69.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.
- package/cjs/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.js +93 -0
- package/cjs/connectors/index.js +28 -0
- package/cjs/connectors/looking-similar/connectLookingSimilar.js +94 -0
- package/cjs/connectors/related-products/connectRelatedProducts.js +94 -0
- package/cjs/connectors/trending-items/connectTrendingItems.js +90 -0
- package/cjs/lib/InstantSearch.js +9 -1
- package/cjs/lib/utils/addWidgetId.js +13 -0
- package/cjs/lib/utils/render-args.js +3 -3
- package/cjs/lib/version.js +1 -1
- package/cjs/widgets/frequently-bought-together/frequently-bought-together.js +120 -0
- package/cjs/widgets/index/index.js +82 -20
- package/cjs/widgets/index.js +28 -0
- package/cjs/widgets/looking-similar/looking-similar.js +122 -0
- package/cjs/widgets/related-products/related-products.js +122 -0
- package/cjs/widgets/trending-items/trending-items.js +126 -0
- package/dist/instantsearch.development.d.ts +403 -10
- package/dist/instantsearch.development.js +1679 -274
- package/dist/instantsearch.development.js.map +1 -1
- package/dist/instantsearch.production.d.ts +403 -10
- package/dist/instantsearch.production.min.d.ts +403 -10
- package/dist/instantsearch.production.min.js +2 -2
- package/dist/instantsearch.production.min.js.map +1 -1
- package/es/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.d.ts +45 -0
- package/es/connectors/frequently-bought-together/connectFrequentlyBoughtTogether.js +86 -0
- package/es/connectors/index.d.ts +4 -0
- package/es/connectors/index.js +5 -1
- package/es/connectors/looking-similar/connectLookingSimilar.d.ts +49 -0
- package/es/connectors/looking-similar/connectLookingSimilar.js +87 -0
- package/es/connectors/related-products/connectRelatedProducts.d.ts +49 -0
- package/es/connectors/related-products/connectRelatedProducts.js +87 -0
- package/es/connectors/trending-items/connectTrendingItems.d.ts +57 -0
- package/es/connectors/trending-items/connectTrendingItems.js +83 -0
- package/es/lib/InstantSearch.d.ts +2 -0
- package/es/lib/InstantSearch.js +9 -1
- package/es/lib/templating/renderTemplate.d.ts +1 -1
- package/es/lib/utils/addWidgetId.d.ts +2 -0
- package/es/lib/utils/addWidgetId.js +7 -0
- package/es/lib/utils/render-args.d.ts +3 -3
- package/es/lib/utils/render-args.js +3 -3
- package/es/lib/version.d.ts +1 -1
- package/es/lib/version.js +1 -1
- package/es/types/templates.d.ts +1 -1
- package/es/types/widget.d.ts +16 -9
- package/es/widgets/frequently-bought-together/frequently-bought-together.d.ts +41 -0
- package/es/widgets/frequently-bought-together/frequently-bought-together.js +112 -0
- package/es/widgets/index/index.d.ts +2 -1
- package/es/widgets/index/index.js +82 -20
- package/es/widgets/index.d.ts +4 -0
- package/es/widgets/index.js +5 -1
- package/es/widgets/looking-similar/looking-similar.d.ts +41 -0
- package/es/widgets/looking-similar/looking-similar.js +114 -0
- package/es/widgets/related-products/related-products.d.ts +41 -0
- package/es/widgets/related-products/related-products.js +114 -0
- package/es/widgets/trending-items/trending-items.d.ts +41 -0
- package/es/widgets/trending-items/trending-items.js +118 -0
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! InstantSearch.js 4.
|
|
1
|
+
/*! InstantSearch.js 4.69.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
@@ -1743,8 +1743,8 @@
|
|
|
1743
1743
|
error: instantSearchInstance.error
|
|
1744
1744
|
};
|
|
1745
1745
|
}
|
|
1746
|
-
function createRenderArgs(instantSearchInstance, parent) {
|
|
1747
|
-
var results = parent.
|
|
1746
|
+
function createRenderArgs(instantSearchInstance, parent, widget) {
|
|
1747
|
+
var results = parent.getResultsForWidget(widget);
|
|
1748
1748
|
var helper = parent.getHelper();
|
|
1749
1749
|
return {
|
|
1750
1750
|
helper: helper,
|
|
@@ -1752,7 +1752,7 @@
|
|
|
1752
1752
|
instantSearchInstance: instantSearchInstance,
|
|
1753
1753
|
results: results,
|
|
1754
1754
|
scopedResults: parent.getScopedResults(),
|
|
1755
|
-
state: results ? results._state : helper.state,
|
|
1755
|
+
state: results && '_state' in results ? results._state : helper.state,
|
|
1756
1756
|
renderState: instantSearchInstance.renderState,
|
|
1757
1757
|
templatesConfig: instantSearchInstance.templatesConfig,
|
|
1758
1758
|
createURL: parent.createURL,
|
|
@@ -4528,6 +4528,86 @@
|
|
|
4528
4528
|
}
|
|
4529
4529
|
|
|
4530
4530
|
var withUsage$d = createDocumentationMessageGenerator({
|
|
4531
|
+
name: 'related-products',
|
|
4532
|
+
connector: true
|
|
4533
|
+
});
|
|
4534
|
+
var connectRelatedProducts = function connectRelatedProducts(renderFn) {
|
|
4535
|
+
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
4536
|
+
checkRendering(renderFn, withUsage$d());
|
|
4537
|
+
return function relatedProducts(widgetParams) {
|
|
4538
|
+
var _ref = widgetParams || {},
|
|
4539
|
+
_ref$escapeHTML = _ref.escapeHTML,
|
|
4540
|
+
escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML,
|
|
4541
|
+
objectIDs = _ref.objectIDs,
|
|
4542
|
+
limit = _ref.limit,
|
|
4543
|
+
threshold = _ref.threshold,
|
|
4544
|
+
fallbackParameters = _ref.fallbackParameters,
|
|
4545
|
+
queryParameters = _ref.queryParameters,
|
|
4546
|
+
_ref$transformItems = _ref.transformItems,
|
|
4547
|
+
transformItems = _ref$transformItems === void 0 ? function (items) {
|
|
4548
|
+
return items;
|
|
4549
|
+
} : _ref$transformItems;
|
|
4550
|
+
if (!objectIDs || objectIDs.length === 0) {
|
|
4551
|
+
throw new Error(withUsage$d('The `objectIDs` option is required.'));
|
|
4552
|
+
}
|
|
4553
|
+
return {
|
|
4554
|
+
dependsOn: 'recommend',
|
|
4555
|
+
$$type: 'ais.relatedProducts',
|
|
4556
|
+
init: function init(initOptions) {
|
|
4557
|
+
renderFn(_objectSpread2(_objectSpread2({}, this.getWidgetRenderState(initOptions)), {}, {
|
|
4558
|
+
instantSearchInstance: initOptions.instantSearchInstance
|
|
4559
|
+
}), true);
|
|
4560
|
+
},
|
|
4561
|
+
render: function render(renderOptions) {
|
|
4562
|
+
var renderState = this.getWidgetRenderState(renderOptions);
|
|
4563
|
+
renderFn(_objectSpread2(_objectSpread2({}, renderState), {}, {
|
|
4564
|
+
instantSearchInstance: renderOptions.instantSearchInstance
|
|
4565
|
+
}), false);
|
|
4566
|
+
},
|
|
4567
|
+
getRenderState: function getRenderState(renderState) {
|
|
4568
|
+
return renderState;
|
|
4569
|
+
},
|
|
4570
|
+
getWidgetRenderState: function getWidgetRenderState(_ref2) {
|
|
4571
|
+
var results = _ref2.results;
|
|
4572
|
+
if (results === null || results === undefined) {
|
|
4573
|
+
return {
|
|
4574
|
+
items: [],
|
|
4575
|
+
widgetParams: widgetParams
|
|
4576
|
+
};
|
|
4577
|
+
}
|
|
4578
|
+
if (escapeHTML && results.hits.length > 0) {
|
|
4579
|
+
results.hits = escapeHits(results.hits);
|
|
4580
|
+
}
|
|
4581
|
+
return {
|
|
4582
|
+
items: transformItems(results.hits, {
|
|
4583
|
+
results: results
|
|
4584
|
+
}),
|
|
4585
|
+
widgetParams: widgetParams
|
|
4586
|
+
};
|
|
4587
|
+
},
|
|
4588
|
+
dispose: function dispose(_ref3) {
|
|
4589
|
+
var recommendState = _ref3.recommendState;
|
|
4590
|
+
unmountFn();
|
|
4591
|
+
return recommendState.removeParams(this.$$id);
|
|
4592
|
+
},
|
|
4593
|
+
getWidgetParameters: function getWidgetParameters(state) {
|
|
4594
|
+
var _this = this;
|
|
4595
|
+
return objectIDs.reduce(function (acc, objectID) {
|
|
4596
|
+
return acc.addRelatedProducts({
|
|
4597
|
+
objectID: objectID,
|
|
4598
|
+
maxRecommendations: limit,
|
|
4599
|
+
threshold: threshold,
|
|
4600
|
+
fallbackParameters: _objectSpread2(_objectSpread2({}, fallbackParameters), escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
4601
|
+
queryParameters: _objectSpread2(_objectSpread2({}, queryParameters), escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
4602
|
+
$$id: _this.$$id
|
|
4603
|
+
});
|
|
4604
|
+
}, state.removeParams(this.$$id));
|
|
4605
|
+
}
|
|
4606
|
+
};
|
|
4607
|
+
};
|
|
4608
|
+
};
|
|
4609
|
+
|
|
4610
|
+
var withUsage$e = createDocumentationMessageGenerator({
|
|
4531
4611
|
name: 'search-box',
|
|
4532
4612
|
connector: true
|
|
4533
4613
|
});
|
|
@@ -4553,7 +4633,7 @@
|
|
|
4553
4633
|
*/
|
|
4554
4634
|
var connectSearchBox = function connectSearchBox(renderFn) {
|
|
4555
4635
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
4556
|
-
checkRendering(renderFn, withUsage$
|
|
4636
|
+
checkRendering(renderFn, withUsage$e());
|
|
4557
4637
|
return function (widgetParams) {
|
|
4558
4638
|
var _ref = widgetParams || {},
|
|
4559
4639
|
_ref$queryHook = _ref.queryHook,
|
|
@@ -4624,7 +4704,7 @@
|
|
|
4624
4704
|
};
|
|
4625
4705
|
};
|
|
4626
4706
|
|
|
4627
|
-
var withUsage$
|
|
4707
|
+
var withUsage$f = createDocumentationMessageGenerator({
|
|
4628
4708
|
name: 'sort-by',
|
|
4629
4709
|
connector: true
|
|
4630
4710
|
});
|
|
@@ -4637,7 +4717,7 @@
|
|
|
4637
4717
|
|
|
4638
4718
|
var connectSortBy = function connectSortBy(renderFn) {
|
|
4639
4719
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
4640
|
-
checkRendering(renderFn, withUsage$
|
|
4720
|
+
checkRendering(renderFn, withUsage$f());
|
|
4641
4721
|
var connectorState = {};
|
|
4642
4722
|
return function (widgetParams) {
|
|
4643
4723
|
var _ref = widgetParams || {},
|
|
@@ -4647,7 +4727,7 @@
|
|
|
4647
4727
|
return x;
|
|
4648
4728
|
} : _ref$transformItems;
|
|
4649
4729
|
if (!Array.isArray(items)) {
|
|
4650
|
-
throw new Error(withUsage$
|
|
4730
|
+
throw new Error(withUsage$f('The `items` option expects an array of objects.'));
|
|
4651
4731
|
}
|
|
4652
4732
|
return {
|
|
4653
4733
|
$$type: 'ais.sortBy',
|
|
@@ -4719,7 +4799,7 @@
|
|
|
4719
4799
|
};
|
|
4720
4800
|
};
|
|
4721
4801
|
|
|
4722
|
-
var withUsage$
|
|
4802
|
+
var withUsage$g = createDocumentationMessageGenerator({
|
|
4723
4803
|
name: 'rating-menu',
|
|
4724
4804
|
connector: true
|
|
4725
4805
|
});
|
|
@@ -4776,7 +4856,7 @@
|
|
|
4776
4856
|
*/
|
|
4777
4857
|
var connectRatingMenu = function connectRatingMenu(renderFn) {
|
|
4778
4858
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
4779
|
-
checkRendering(renderFn, withUsage$
|
|
4859
|
+
checkRendering(renderFn, withUsage$g());
|
|
4780
4860
|
return function (widgetParams) {
|
|
4781
4861
|
var _ref2 = widgetParams || {},
|
|
4782
4862
|
attribute = _ref2.attribute,
|
|
@@ -4784,7 +4864,7 @@
|
|
|
4784
4864
|
max = _ref2$max === void 0 ? 5 : _ref2$max;
|
|
4785
4865
|
var sendEvent;
|
|
4786
4866
|
if (!attribute) {
|
|
4787
|
-
throw new Error(withUsage$
|
|
4867
|
+
throw new Error(withUsage$g('The `attribute` option is required.'));
|
|
4788
4868
|
}
|
|
4789
4869
|
var _getRefinedStar = function getRefinedStar(state) {
|
|
4790
4870
|
var _values$;
|
|
@@ -4991,7 +5071,7 @@
|
|
|
4991
5071
|
return indexUiState;
|
|
4992
5072
|
}
|
|
4993
5073
|
|
|
4994
|
-
var withUsage$
|
|
5074
|
+
var withUsage$h = createDocumentationMessageGenerator({
|
|
4995
5075
|
name: 'stats',
|
|
4996
5076
|
connector: true
|
|
4997
5077
|
});
|
|
@@ -5003,7 +5083,7 @@
|
|
|
5003
5083
|
|
|
5004
5084
|
var connectStats = function connectStats(renderFn) {
|
|
5005
5085
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
5006
|
-
checkRendering(renderFn, withUsage$
|
|
5086
|
+
checkRendering(renderFn, withUsage$h());
|
|
5007
5087
|
return function (widgetParams) {
|
|
5008
5088
|
return {
|
|
5009
5089
|
$$type: 'ais.stats',
|
|
@@ -5059,7 +5139,7 @@
|
|
|
5059
5139
|
};
|
|
5060
5140
|
};
|
|
5061
5141
|
|
|
5062
|
-
var withUsage$
|
|
5142
|
+
var withUsage$i = createDocumentationMessageGenerator({
|
|
5063
5143
|
name: 'toggle-refinement',
|
|
5064
5144
|
connector: true
|
|
5065
5145
|
});
|
|
@@ -5119,7 +5199,7 @@
|
|
|
5119
5199
|
*/
|
|
5120
5200
|
var connectToggleRefinement = function connectToggleRefinement(renderFn) {
|
|
5121
5201
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
5122
|
-
checkRendering(renderFn, withUsage$
|
|
5202
|
+
checkRendering(renderFn, withUsage$i());
|
|
5123
5203
|
return function (widgetParams) {
|
|
5124
5204
|
var _ref2 = widgetParams || {},
|
|
5125
5205
|
attribute = _ref2.attribute,
|
|
@@ -5127,7 +5207,7 @@
|
|
|
5127
5207
|
userOn = _ref2$on === void 0 ? true : _ref2$on,
|
|
5128
5208
|
userOff = _ref2.off;
|
|
5129
5209
|
if (!attribute) {
|
|
5130
|
-
throw new Error(withUsage$
|
|
5210
|
+
throw new Error(withUsage$i('The `attribute` option is required.'));
|
|
5131
5211
|
}
|
|
5132
5212
|
var hasAnOffValue = userOff !== undefined;
|
|
5133
5213
|
// even though facet values can be numbers and boolean,
|
|
@@ -5355,13 +5435,89 @@
|
|
|
5355
5435
|
};
|
|
5356
5436
|
};
|
|
5357
5437
|
|
|
5358
|
-
var withUsage$
|
|
5438
|
+
var withUsage$j = createDocumentationMessageGenerator({
|
|
5439
|
+
name: 'trending-items',
|
|
5440
|
+
connector: true
|
|
5441
|
+
});
|
|
5442
|
+
var connectTrendingItems = function connectTrendingItems(renderFn) {
|
|
5443
|
+
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
5444
|
+
checkRendering(renderFn, withUsage$j());
|
|
5445
|
+
return function trendingItems(widgetParams) {
|
|
5446
|
+
var _ref = widgetParams || {},
|
|
5447
|
+
facetName = _ref.facetName,
|
|
5448
|
+
facetValue = _ref.facetValue,
|
|
5449
|
+
limit = _ref.limit,
|
|
5450
|
+
threshold = _ref.threshold,
|
|
5451
|
+
fallbackParameters = _ref.fallbackParameters,
|
|
5452
|
+
queryParameters = _ref.queryParameters,
|
|
5453
|
+
_ref$escapeHTML = _ref.escapeHTML,
|
|
5454
|
+
escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML,
|
|
5455
|
+
_ref$transformItems = _ref.transformItems,
|
|
5456
|
+
transformItems = _ref$transformItems === void 0 ? function (items) {
|
|
5457
|
+
return items;
|
|
5458
|
+
} : _ref$transformItems;
|
|
5459
|
+
return {
|
|
5460
|
+
dependsOn: 'recommend',
|
|
5461
|
+
$$type: 'ais.trendingItems',
|
|
5462
|
+
init: function init(initOptions) {
|
|
5463
|
+
renderFn(_objectSpread2(_objectSpread2({}, this.getWidgetRenderState(initOptions)), {}, {
|
|
5464
|
+
instantSearchInstance: initOptions.instantSearchInstance
|
|
5465
|
+
}), true);
|
|
5466
|
+
},
|
|
5467
|
+
render: function render(renderOptions) {
|
|
5468
|
+
var renderState = this.getWidgetRenderState(renderOptions);
|
|
5469
|
+
renderFn(_objectSpread2(_objectSpread2({}, renderState), {}, {
|
|
5470
|
+
instantSearchInstance: renderOptions.instantSearchInstance
|
|
5471
|
+
}), false);
|
|
5472
|
+
},
|
|
5473
|
+
getRenderState: function getRenderState(renderState) {
|
|
5474
|
+
return renderState;
|
|
5475
|
+
},
|
|
5476
|
+
getWidgetRenderState: function getWidgetRenderState(_ref2) {
|
|
5477
|
+
var results = _ref2.results;
|
|
5478
|
+
if (results === null || results === undefined) {
|
|
5479
|
+
return {
|
|
5480
|
+
items: [],
|
|
5481
|
+
widgetParams: widgetParams
|
|
5482
|
+
};
|
|
5483
|
+
}
|
|
5484
|
+
if (escapeHTML && results.hits.length > 0) {
|
|
5485
|
+
results.hits = escapeHits(results.hits);
|
|
5486
|
+
}
|
|
5487
|
+
return {
|
|
5488
|
+
items: transformItems(results.hits, {
|
|
5489
|
+
results: results
|
|
5490
|
+
}),
|
|
5491
|
+
widgetParams: widgetParams
|
|
5492
|
+
};
|
|
5493
|
+
},
|
|
5494
|
+
dispose: function dispose(_ref3) {
|
|
5495
|
+
var recommendState = _ref3.recommendState;
|
|
5496
|
+
unmountFn();
|
|
5497
|
+
return recommendState.removeParams(this.$$id);
|
|
5498
|
+
},
|
|
5499
|
+
getWidgetParameters: function getWidgetParameters(state) {
|
|
5500
|
+
return state.removeParams(this.$$id).addTrendingItems({
|
|
5501
|
+
facetName: facetName,
|
|
5502
|
+
facetValue: facetValue,
|
|
5503
|
+
maxRecommendations: limit,
|
|
5504
|
+
threshold: threshold,
|
|
5505
|
+
fallbackParameters: _objectSpread2(_objectSpread2({}, fallbackParameters), escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
5506
|
+
queryParameters: _objectSpread2(_objectSpread2({}, queryParameters), escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
5507
|
+
$$id: this.$$id
|
|
5508
|
+
});
|
|
5509
|
+
}
|
|
5510
|
+
};
|
|
5511
|
+
};
|
|
5512
|
+
};
|
|
5513
|
+
|
|
5514
|
+
var withUsage$k = createDocumentationMessageGenerator({
|
|
5359
5515
|
name: 'breadcrumb',
|
|
5360
5516
|
connector: true
|
|
5361
5517
|
});
|
|
5362
5518
|
var connectBreadcrumb = function connectBreadcrumb(renderFn) {
|
|
5363
5519
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
5364
|
-
checkRendering(renderFn, withUsage$
|
|
5520
|
+
checkRendering(renderFn, withUsage$k());
|
|
5365
5521
|
var connectorState = {};
|
|
5366
5522
|
return function (widgetParams) {
|
|
5367
5523
|
var _ref = widgetParams || {},
|
|
@@ -5375,7 +5531,7 @@
|
|
|
5375
5531
|
return items;
|
|
5376
5532
|
} : _ref$transformItems;
|
|
5377
5533
|
if (!attributes || !Array.isArray(attributes) || attributes.length === 0) {
|
|
5378
|
-
throw new Error(withUsage$
|
|
5534
|
+
throw new Error(withUsage$k('The `attributes` option expects an array of strings.'));
|
|
5379
5535
|
}
|
|
5380
5536
|
var _attributes = _slicedToArray(attributes, 1),
|
|
5381
5537
|
hierarchicalFacetName = _attributes[0];
|
|
@@ -5525,7 +5681,7 @@
|
|
|
5525
5681
|
return indexUiState;
|
|
5526
5682
|
}
|
|
5527
5683
|
|
|
5528
|
-
var withUsage$
|
|
5684
|
+
var withUsage$l = createDocumentationMessageGenerator({
|
|
5529
5685
|
name: 'geo-search',
|
|
5530
5686
|
connector: true
|
|
5531
5687
|
});
|
|
@@ -5551,7 +5707,7 @@
|
|
|
5551
5707
|
*/
|
|
5552
5708
|
var connectGeoSearch = function connectGeoSearch(renderFn) {
|
|
5553
5709
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
5554
|
-
checkRendering(renderFn, withUsage$
|
|
5710
|
+
checkRendering(renderFn, withUsage$l());
|
|
5555
5711
|
return function (widgetParams) {
|
|
5556
5712
|
var _ref = widgetParams || {},
|
|
5557
5713
|
_ref$enableRefineOnMa = _ref.enableRefineOnMapMove,
|
|
@@ -5723,7 +5879,7 @@
|
|
|
5723
5879
|
};
|
|
5724
5880
|
};
|
|
5725
5881
|
|
|
5726
|
-
var withUsage$
|
|
5882
|
+
var withUsage$m = createDocumentationMessageGenerator({
|
|
5727
5883
|
name: 'powered-by',
|
|
5728
5884
|
connector: true
|
|
5729
5885
|
});
|
|
@@ -5733,7 +5889,7 @@
|
|
|
5733
5889
|
*/
|
|
5734
5890
|
var connectPoweredBy = function connectPoweredBy(renderFn) {
|
|
5735
5891
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
5736
|
-
checkRendering(renderFn, withUsage$
|
|
5892
|
+
checkRendering(renderFn, withUsage$m());
|
|
5737
5893
|
var defaultUrl = 'https://www.algolia.com/?' + 'utm_source=instantsearch.js&' + 'utm_medium=website&' + "utm_content=".concat(safelyRunOnBrowser(function (_ref) {
|
|
5738
5894
|
var _window$location;
|
|
5739
5895
|
var window = _ref.window;
|
|
@@ -6297,15 +6453,8 @@
|
|
|
6297
6453
|
|
|
6298
6454
|
addParams: function (params) {
|
|
6299
6455
|
var newParams = this.params.slice();
|
|
6300
|
-
var existingParamsIndex = this.params.findIndex(function (currentParams) {
|
|
6301
|
-
return currentParams.$$id === params.$$id;
|
|
6302
|
-
});
|
|
6303
6456
|
|
|
6304
|
-
|
|
6305
|
-
newParams.splice(existingParamsIndex, 1, params);
|
|
6306
|
-
} else {
|
|
6307
|
-
newParams.push(params);
|
|
6308
|
-
}
|
|
6457
|
+
newParams.push(params);
|
|
6309
6458
|
|
|
6310
6459
|
return new RecommendParameters({ params: newParams });
|
|
6311
6460
|
},
|
|
@@ -6348,18 +6497,49 @@
|
|
|
6348
6497
|
);
|
|
6349
6498
|
},
|
|
6350
6499
|
|
|
6351
|
-
_buildQueries: function (indexName) {
|
|
6352
|
-
return this.params
|
|
6353
|
-
|
|
6354
|
-
|
|
6500
|
+
_buildQueries: function (indexName, cache) {
|
|
6501
|
+
return this.params
|
|
6502
|
+
.filter(function (params) {
|
|
6503
|
+
return cache[params.$$id] === undefined;
|
|
6504
|
+
})
|
|
6505
|
+
.map(function (params) {
|
|
6506
|
+
var query = Object.assign({}, params, { indexName: indexName });
|
|
6507
|
+
delete query.$$id;
|
|
6355
6508
|
|
|
6356
|
-
|
|
6357
|
-
|
|
6509
|
+
return query;
|
|
6510
|
+
});
|
|
6358
6511
|
},
|
|
6359
6512
|
};
|
|
6360
6513
|
|
|
6361
6514
|
var RecommendParameters_1 = RecommendParameters;
|
|
6362
6515
|
|
|
6516
|
+
/**
|
|
6517
|
+
* Constructor for SearchResults
|
|
6518
|
+
* @class
|
|
6519
|
+
* @classdesc SearchResults contains the results of a query to Algolia using the
|
|
6520
|
+
* {@link AlgoliaSearchHelper}.
|
|
6521
|
+
* @param {RecommendParameters} state state that led to the response
|
|
6522
|
+
* @param {Record<string,RecommendResultItem>} results the results from algolia client
|
|
6523
|
+
**/
|
|
6524
|
+
function RecommendResults(state, results) {
|
|
6525
|
+
this._state = state;
|
|
6526
|
+
this._rawResults = results;
|
|
6527
|
+
|
|
6528
|
+
// eslint-disable-next-line consistent-this
|
|
6529
|
+
var self = this;
|
|
6530
|
+
|
|
6531
|
+
state.params.forEach(function (param) {
|
|
6532
|
+
var id = param.$$id;
|
|
6533
|
+
self[id] = results[id];
|
|
6534
|
+
});
|
|
6535
|
+
}
|
|
6536
|
+
|
|
6537
|
+
RecommendResults.prototype = {
|
|
6538
|
+
constructor: RecommendResults,
|
|
6539
|
+
};
|
|
6540
|
+
|
|
6541
|
+
var RecommendResults_1 = RecommendResults;
|
|
6542
|
+
|
|
6363
6543
|
function sortObject(obj) {
|
|
6364
6544
|
return Object.keys(obj)
|
|
6365
6545
|
.sort()
|
|
@@ -10207,7 +10387,66 @@
|
|
|
10207
10387
|
|
|
10208
10388
|
var SearchResults_1 = SearchResults;
|
|
10209
10389
|
|
|
10210
|
-
|
|
10390
|
+
// @MAJOR: remove this function and use Array.prototype.flat
|
|
10391
|
+
var flat = function flat(arr) {
|
|
10392
|
+
return arr.reduce(function (acc, val) {
|
|
10393
|
+
return acc.concat(val);
|
|
10394
|
+
}, []);
|
|
10395
|
+
};
|
|
10396
|
+
|
|
10397
|
+
function getAverageIndices(indexTracker, nrOfObjs) {
|
|
10398
|
+
var avgIndices = [];
|
|
10399
|
+
|
|
10400
|
+
Object.keys(indexTracker).forEach(function (key) {
|
|
10401
|
+
if (indexTracker[key].count < 2) {
|
|
10402
|
+
indexTracker[key].indexSum += 100;
|
|
10403
|
+
}
|
|
10404
|
+
avgIndices.push({
|
|
10405
|
+
objectID: key,
|
|
10406
|
+
avgOfIndices: indexTracker[key].indexSum / nrOfObjs,
|
|
10407
|
+
});
|
|
10408
|
+
});
|
|
10409
|
+
|
|
10410
|
+
return avgIndices.sort(function (a, b) {
|
|
10411
|
+
return a.avgOfIndices > b.avgOfIndices ? 1 : -1;
|
|
10412
|
+
});
|
|
10413
|
+
}
|
|
10414
|
+
|
|
10415
|
+
function sortAndMergeRecommendations(results) {
|
|
10416
|
+
var indexTracker = {};
|
|
10417
|
+
|
|
10418
|
+
results.forEach(function (hits) {
|
|
10419
|
+
hits.forEach(function (hit, index) {
|
|
10420
|
+
if (!indexTracker[hit.objectID]) {
|
|
10421
|
+
indexTracker[hit.objectID] = { indexSum: index, count: 1 };
|
|
10422
|
+
} else {
|
|
10423
|
+
indexTracker[hit.objectID] = {
|
|
10424
|
+
indexSum: indexTracker[hit.objectID].indexSum + index,
|
|
10425
|
+
count: indexTracker[hit.objectID].count + 1,
|
|
10426
|
+
};
|
|
10427
|
+
}
|
|
10428
|
+
});
|
|
10429
|
+
});
|
|
10430
|
+
|
|
10431
|
+
var sortedAverageIndices = getAverageIndices(indexTracker, results.length);
|
|
10432
|
+
|
|
10433
|
+
var finalOrder = sortedAverageIndices.reduce(function (
|
|
10434
|
+
orderedHits,
|
|
10435
|
+
avgIndexRef
|
|
10436
|
+
) {
|
|
10437
|
+
var result = find$1(flat(results), function (hit) {
|
|
10438
|
+
return hit.objectID === avgIndexRef.objectID;
|
|
10439
|
+
});
|
|
10440
|
+
return result ? orderedHits.concat(result) : orderedHits;
|
|
10441
|
+
},
|
|
10442
|
+
[]);
|
|
10443
|
+
|
|
10444
|
+
return finalOrder;
|
|
10445
|
+
}
|
|
10446
|
+
|
|
10447
|
+
var sortAndMergeRecommendations_1 = sortAndMergeRecommendations;
|
|
10448
|
+
|
|
10449
|
+
var version = '3.20.0';
|
|
10211
10450
|
|
|
10212
10451
|
var escapeFacetValue$4 = escapeFacetValue_1.escapeFacetValue;
|
|
10213
10452
|
|
|
@@ -10220,6 +10459,8 @@
|
|
|
10220
10459
|
|
|
10221
10460
|
|
|
10222
10461
|
|
|
10462
|
+
|
|
10463
|
+
|
|
10223
10464
|
/**
|
|
10224
10465
|
* Event triggered when a parameter is set or updated
|
|
10225
10466
|
* @event AlgoliaSearchHelper#event:change
|
|
@@ -10346,6 +10587,7 @@
|
|
|
10346
10587
|
this._currentNbQueries = 0;
|
|
10347
10588
|
this._currentNbRecommendQueries = 0;
|
|
10348
10589
|
this._searchResultsOptions = searchResultsOptions;
|
|
10590
|
+
this.recommendCache = {};
|
|
10349
10591
|
}
|
|
10350
10592
|
|
|
10351
10593
|
inherits_1(AlgoliaSearchHelper, events);
|
|
@@ -11134,7 +11376,7 @@
|
|
|
11134
11376
|
/**
|
|
11135
11377
|
* Removes a "frequently bought together" recommendation query.
|
|
11136
11378
|
*
|
|
11137
|
-
* @param {
|
|
11379
|
+
* @param {number} id identifier of the recommendation widget
|
|
11138
11380
|
* @returns {AlgoliaSearchHelper} Method is chainable, it returns itself
|
|
11139
11381
|
* @fires change
|
|
11140
11382
|
* @chainable
|
|
@@ -11150,7 +11392,7 @@
|
|
|
11150
11392
|
/**
|
|
11151
11393
|
* Removes a "related products" recommendation query.
|
|
11152
11394
|
*
|
|
11153
|
-
* @param {
|
|
11395
|
+
* @param {number} id identifier of the recommendation widget
|
|
11154
11396
|
* @returns {AlgoliaSearchHelper} Method is chainable, it returns itself
|
|
11155
11397
|
* @fires change
|
|
11156
11398
|
* @chainable
|
|
@@ -11166,7 +11408,7 @@
|
|
|
11166
11408
|
/**
|
|
11167
11409
|
* Removes a "trending items" recommendation query.
|
|
11168
11410
|
*
|
|
11169
|
-
* @param {
|
|
11411
|
+
* @param {number} id identifier of the recommendation widget
|
|
11170
11412
|
* @returns {AlgoliaSearchHelper} Method is chainable, it returns itself
|
|
11171
11413
|
* @fires change
|
|
11172
11414
|
* @chainable
|
|
@@ -11182,7 +11424,7 @@
|
|
|
11182
11424
|
/**
|
|
11183
11425
|
* Removes a "trending facets" recommendation query.
|
|
11184
11426
|
*
|
|
11185
|
-
* @param {
|
|
11427
|
+
* @param {number} id identifier of the recommendation widget
|
|
11186
11428
|
* @returns {AlgoliaSearchHelper} Method is chainable, it returns itself
|
|
11187
11429
|
* @fires change
|
|
11188
11430
|
* @chainable
|
|
@@ -11198,7 +11440,7 @@
|
|
|
11198
11440
|
/**
|
|
11199
11441
|
* Removes a "looking similar" recommendation query.
|
|
11200
11442
|
*
|
|
11201
|
-
* @param {
|
|
11443
|
+
* @param {number} id identifier of the recommendation widget
|
|
11202
11444
|
* @returns {AlgoliaSearchHelper} Method is chainable, it returns itself
|
|
11203
11445
|
* @fires change
|
|
11204
11446
|
* @chainable
|
|
@@ -11783,6 +12025,9 @@
|
|
|
11783
12025
|
var recommendState = this.recommendState;
|
|
11784
12026
|
var index = this.getIndex();
|
|
11785
12027
|
var states = [{ state: recommendState, index: index, helper: this }];
|
|
12028
|
+
var ids = recommendState.params.map(function (param) {
|
|
12029
|
+
return param.$$id;
|
|
12030
|
+
});
|
|
11786
12031
|
|
|
11787
12032
|
this.emit('fetch', {
|
|
11788
12033
|
recommend: {
|
|
@@ -11791,6 +12036,8 @@
|
|
|
11791
12036
|
},
|
|
11792
12037
|
});
|
|
11793
12038
|
|
|
12039
|
+
var cache = this.recommendCache;
|
|
12040
|
+
|
|
11794
12041
|
var derivedQueries = this.derivedHelpers.map(function (derivedHelper) {
|
|
11795
12042
|
var derivedIndex = derivedHelper.getModifiedState(searchState).index;
|
|
11796
12043
|
if (!derivedIndex) {
|
|
@@ -11809,6 +12056,13 @@
|
|
|
11809
12056
|
helper: derivedHelper,
|
|
11810
12057
|
});
|
|
11811
12058
|
|
|
12059
|
+
ids = Array.prototype.concat.apply(
|
|
12060
|
+
ids,
|
|
12061
|
+
derivedState.params.map(function (param) {
|
|
12062
|
+
return param.$$id;
|
|
12063
|
+
})
|
|
12064
|
+
);
|
|
12065
|
+
|
|
11812
12066
|
derivedHelper.emit('fetch', {
|
|
11813
12067
|
recommend: {
|
|
11814
12068
|
state: derivedState,
|
|
@@ -11816,11 +12070,11 @@
|
|
|
11816
12070
|
},
|
|
11817
12071
|
});
|
|
11818
12072
|
|
|
11819
|
-
return derivedState._buildQueries(derivedIndex);
|
|
12073
|
+
return derivedState._buildQueries(derivedIndex, cache);
|
|
11820
12074
|
});
|
|
11821
12075
|
|
|
11822
12076
|
var queries = Array.prototype.concat.apply(
|
|
11823
|
-
this.recommendState._buildQueries(index),
|
|
12077
|
+
this.recommendState._buildQueries(index, cache),
|
|
11824
12078
|
derivedQueries
|
|
11825
12079
|
);
|
|
11826
12080
|
|
|
@@ -11834,7 +12088,7 @@
|
|
|
11834
12088
|
) {
|
|
11835
12089
|
// eslint-disable-next-line no-console
|
|
11836
12090
|
console.warn(
|
|
11837
|
-
'Please update algoliasearch/lite to the latest version in order to use
|
|
12091
|
+
'Please update algoliasearch/lite to the latest version in order to use recommend widgets.'
|
|
11838
12092
|
);
|
|
11839
12093
|
return;
|
|
11840
12094
|
}
|
|
@@ -11845,7 +12099,7 @@
|
|
|
11845
12099
|
try {
|
|
11846
12100
|
this.client
|
|
11847
12101
|
.getRecommendations(queries)
|
|
11848
|
-
.then(this._dispatchRecommendResponse.bind(this, queryId, states))
|
|
12102
|
+
.then(this._dispatchRecommendResponse.bind(this, queryId, states, ids))
|
|
11849
12103
|
.catch(this._dispatchRecommendError.bind(this, queryId));
|
|
11850
12104
|
} catch (error) {
|
|
11851
12105
|
// If we reach this part, we're in an internal error state
|
|
@@ -11919,6 +12173,7 @@
|
|
|
11919
12173
|
AlgoliaSearchHelper.prototype._dispatchRecommendResponse = function (
|
|
11920
12174
|
queryId,
|
|
11921
12175
|
states,
|
|
12176
|
+
ids,
|
|
11922
12177
|
content
|
|
11923
12178
|
) {
|
|
11924
12179
|
// @TODO remove the number of outdated queries discarded instead of just one
|
|
@@ -11934,7 +12189,39 @@
|
|
|
11934
12189
|
|
|
11935
12190
|
if (this._currentNbRecommendQueries === 0) this.emit('recommendQueueEmpty');
|
|
11936
12191
|
|
|
11937
|
-
var
|
|
12192
|
+
var cache = this.recommendCache;
|
|
12193
|
+
|
|
12194
|
+
var idsMap = {};
|
|
12195
|
+
ids
|
|
12196
|
+
.filter(function (id) {
|
|
12197
|
+
return cache[id] === undefined;
|
|
12198
|
+
})
|
|
12199
|
+
.forEach(function (id, index) {
|
|
12200
|
+
if (!idsMap[id]) idsMap[id] = [];
|
|
12201
|
+
|
|
12202
|
+
idsMap[id].push(index);
|
|
12203
|
+
});
|
|
12204
|
+
|
|
12205
|
+
Object.keys(idsMap).forEach(function (id) {
|
|
12206
|
+
var indices = idsMap[id];
|
|
12207
|
+
var firstResult = content.results[indices[0]];
|
|
12208
|
+
if (indices.length === 1) {
|
|
12209
|
+
cache[id] = firstResult;
|
|
12210
|
+
return;
|
|
12211
|
+
}
|
|
12212
|
+
cache[id] = Object.assign({}, firstResult, {
|
|
12213
|
+
hits: sortAndMergeRecommendations_1(
|
|
12214
|
+
indices.map(function (idx) {
|
|
12215
|
+
return content.results[idx].hits;
|
|
12216
|
+
})
|
|
12217
|
+
),
|
|
12218
|
+
});
|
|
12219
|
+
});
|
|
12220
|
+
|
|
12221
|
+
var results = {};
|
|
12222
|
+
ids.forEach(function (id) {
|
|
12223
|
+
results[id] = cache[id];
|
|
12224
|
+
});
|
|
11938
12225
|
|
|
11939
12226
|
states.forEach(function (s) {
|
|
11940
12227
|
var state = s.state;
|
|
@@ -11950,7 +12237,7 @@
|
|
|
11950
12237
|
return;
|
|
11951
12238
|
}
|
|
11952
12239
|
|
|
11953
|
-
helper.lastRecommendResults = results;
|
|
12240
|
+
helper.lastRecommendResults = new RecommendResults_1(state, results);
|
|
11954
12241
|
|
|
11955
12242
|
// eslint-disable-next-line no-warning-comments
|
|
11956
12243
|
// TODO: emit "result" event when events for Recommend are implemented
|
|
@@ -12242,7 +12529,7 @@
|
|
|
12242
12529
|
* Refine the given search parameters.
|
|
12243
12530
|
*/
|
|
12244
12531
|
|
|
12245
|
-
var withUsage$
|
|
12532
|
+
var withUsage$n = createDocumentationMessageGenerator({
|
|
12246
12533
|
name: 'configure',
|
|
12247
12534
|
connector: true
|
|
12248
12535
|
});
|
|
@@ -12259,7 +12546,7 @@
|
|
|
12259
12546
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
12260
12547
|
return function (widgetParams) {
|
|
12261
12548
|
if (!widgetParams || !isPlainObject(widgetParams.searchParameters)) {
|
|
12262
|
-
throw new Error(withUsage$
|
|
12549
|
+
throw new Error(withUsage$n('The `searchParameters` option expects an object.'));
|
|
12263
12550
|
}
|
|
12264
12551
|
var connectorState = {};
|
|
12265
12552
|
function refine(helper) {
|
|
@@ -12328,7 +12615,7 @@
|
|
|
12328
12615
|
};
|
|
12329
12616
|
};
|
|
12330
12617
|
|
|
12331
|
-
var withUsage$
|
|
12618
|
+
var withUsage$o = createDocumentationMessageGenerator({
|
|
12332
12619
|
name: 'configure-related-items',
|
|
12333
12620
|
connector: true
|
|
12334
12621
|
});
|
|
@@ -12348,10 +12635,10 @@
|
|
|
12348
12635
|
return x;
|
|
12349
12636
|
} : _ref2$transformSearch;
|
|
12350
12637
|
if (!hit) {
|
|
12351
|
-
throw new Error(withUsage$
|
|
12638
|
+
throw new Error(withUsage$o('The `hit` option is required.'));
|
|
12352
12639
|
}
|
|
12353
12640
|
if (!matchingPatterns) {
|
|
12354
|
-
throw new Error(withUsage$
|
|
12641
|
+
throw new Error(withUsage$o('The `matchingPatterns` option is required.'));
|
|
12355
12642
|
}
|
|
12356
12643
|
var optionalFilters = Object.keys(matchingPatterns).reduce(function (acc, attributeName) {
|
|
12357
12644
|
var attribute = matchingPatterns[attributeName];
|
|
@@ -12390,13 +12677,13 @@
|
|
|
12390
12677
|
};
|
|
12391
12678
|
};
|
|
12392
12679
|
|
|
12393
|
-
var withUsage$
|
|
12680
|
+
var withUsage$p = createDocumentationMessageGenerator({
|
|
12394
12681
|
name: 'autocomplete',
|
|
12395
12682
|
connector: true
|
|
12396
12683
|
});
|
|
12397
12684
|
var connectAutocomplete = function connectAutocomplete(renderFn) {
|
|
12398
12685
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
12399
|
-
checkRendering(renderFn, withUsage$
|
|
12686
|
+
checkRendering(renderFn, withUsage$p());
|
|
12400
12687
|
return function (widgetParams) {
|
|
12401
12688
|
var _ref = widgetParams || {},
|
|
12402
12689
|
_ref$escapeHTML = _ref.escapeHTML,
|
|
@@ -12503,7 +12790,7 @@
|
|
|
12503
12790
|
};
|
|
12504
12791
|
};
|
|
12505
12792
|
|
|
12506
|
-
var withUsage$
|
|
12793
|
+
var withUsage$q = createDocumentationMessageGenerator({
|
|
12507
12794
|
name: 'query-rules',
|
|
12508
12795
|
connector: true
|
|
12509
12796
|
});
|
|
@@ -12561,7 +12848,7 @@
|
|
|
12561
12848
|
}
|
|
12562
12849
|
var connectQueryRules = function connectQueryRules(_render) {
|
|
12563
12850
|
var unmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
12564
|
-
checkRendering(_render, withUsage$
|
|
12851
|
+
checkRendering(_render, withUsage$q());
|
|
12565
12852
|
return function (widgetParams) {
|
|
12566
12853
|
var _ref2 = widgetParams || {},
|
|
12567
12854
|
_ref2$trackedFilters = _ref2.trackedFilters,
|
|
@@ -12576,7 +12863,7 @@
|
|
|
12576
12863
|
} : _ref2$transformItems;
|
|
12577
12864
|
Object.keys(trackedFilters).forEach(function (facetName) {
|
|
12578
12865
|
if (typeof trackedFilters[facetName] !== 'function') {
|
|
12579
|
-
throw new Error(withUsage$
|
|
12866
|
+
throw new Error(withUsage$q("'The \"".concat(facetName, "\" filter value in the `trackedFilters` option expects a function.")));
|
|
12580
12867
|
}
|
|
12581
12868
|
});
|
|
12582
12869
|
var hasTrackedFilters = Object.keys(trackedFilters).length > 0;
|
|
@@ -12769,13 +13056,13 @@
|
|
|
12769
13056
|
};
|
|
12770
13057
|
};
|
|
12771
13058
|
|
|
12772
|
-
var withUsage$
|
|
13059
|
+
var withUsage$r = createDocumentationMessageGenerator({
|
|
12773
13060
|
name: 'voice-search',
|
|
12774
13061
|
connector: true
|
|
12775
13062
|
});
|
|
12776
13063
|
var connectVoiceSearch = function connectVoiceSearch(renderFn) {
|
|
12777
13064
|
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
12778
|
-
checkRendering(renderFn, withUsage$
|
|
13065
|
+
checkRendering(renderFn, withUsage$r());
|
|
12779
13066
|
return function (widgetParams) {
|
|
12780
13067
|
var _widgetParams$searchA = widgetParams.searchAsYouSpeak,
|
|
12781
13068
|
searchAsYouSpeak = _widgetParams$searchA === void 0 ? false : _widgetParams$searchA,
|
|
@@ -12967,53 +13254,216 @@
|
|
|
12967
13254
|
};
|
|
12968
13255
|
};
|
|
12969
13256
|
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
/** @deprecated use connectDynamicWidgets */
|
|
12974
|
-
var EXPERIMENTAL_connectDynamicWidgets = deprecate(connectDynamicWidgets, 'use connectDynamicWidgets');
|
|
12975
|
-
|
|
12976
|
-
var connectors = /*#__PURE__*/Object.freeze({
|
|
12977
|
-
__proto__: null,
|
|
12978
|
-
EXPERIMENTAL_connectAnswers: EXPERIMENTAL_connectAnswers,
|
|
12979
|
-
EXPERIMENTAL_connectDynamicWidgets: EXPERIMENTAL_connectDynamicWidgets,
|
|
12980
|
-
connectDynamicWidgets: connectDynamicWidgets,
|
|
12981
|
-
connectClearRefinements: connectClearRefinements,
|
|
12982
|
-
connectCurrentRefinements: connectCurrentRefinements,
|
|
12983
|
-
connectHierarchicalMenu: connectHierarchicalMenu,
|
|
12984
|
-
connectHits: connectHits,
|
|
12985
|
-
connectHitsWithInsights: connectHitsWithInsights,
|
|
12986
|
-
connectHitsPerPage: connectHitsPerPage,
|
|
12987
|
-
connectInfiniteHits: connectInfiniteHits,
|
|
12988
|
-
connectInfiniteHitsWithInsights: connectInfiniteHitsWithInsights,
|
|
12989
|
-
connectMenu: connectMenu,
|
|
12990
|
-
connectNumericMenu: connectNumericMenu,
|
|
12991
|
-
connectPagination: connectPagination,
|
|
12992
|
-
connectRange: connectRange,
|
|
12993
|
-
connectRefinementList: connectRefinementList,
|
|
12994
|
-
connectSearchBox: connectSearchBox,
|
|
12995
|
-
connectSortBy: connectSortBy,
|
|
12996
|
-
connectRatingMenu: connectRatingMenu,
|
|
12997
|
-
connectStats: connectStats,
|
|
12998
|
-
connectToggleRefinement: connectToggleRefinement,
|
|
12999
|
-
connectBreadcrumb: connectBreadcrumb,
|
|
13000
|
-
connectGeoSearch: connectGeoSearch,
|
|
13001
|
-
connectPoweredBy: connectPoweredBy,
|
|
13002
|
-
connectConfigure: connectConfigure,
|
|
13003
|
-
EXPERIMENTAL_connectConfigureRelatedItems: connectConfigureRelatedItems,
|
|
13004
|
-
connectAutocomplete: connectAutocomplete,
|
|
13005
|
-
connectQueryRules: connectQueryRules,
|
|
13006
|
-
connectVoiceSearch: connectVoiceSearch,
|
|
13007
|
-
connectRelevantSort: connectRelevantSort
|
|
13257
|
+
var withUsage$s = createDocumentationMessageGenerator({
|
|
13258
|
+
name: 'frequently-bought-together',
|
|
13259
|
+
connector: true
|
|
13008
13260
|
});
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
return function () {
|
|
13013
|
-
var _ref =
|
|
13014
|
-
|
|
13015
|
-
|
|
13016
|
-
|
|
13261
|
+
var connectFrequentlyBoughtTogether = function connectFrequentlyBoughtTogether(renderFn) {
|
|
13262
|
+
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
13263
|
+
checkRendering(renderFn, withUsage$s());
|
|
13264
|
+
return function (widgetParams) {
|
|
13265
|
+
var _ref = widgetParams || {},
|
|
13266
|
+
_ref$escapeHTML = _ref.escapeHTML,
|
|
13267
|
+
escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML,
|
|
13268
|
+
_ref$transformItems = _ref.transformItems,
|
|
13269
|
+
transformItems = _ref$transformItems === void 0 ? function (items) {
|
|
13270
|
+
return items;
|
|
13271
|
+
} : _ref$transformItems,
|
|
13272
|
+
objectIDs = _ref.objectIDs,
|
|
13273
|
+
limit = _ref.limit,
|
|
13274
|
+
threshold = _ref.threshold,
|
|
13275
|
+
queryParameters = _ref.queryParameters;
|
|
13276
|
+
if (!objectIDs || objectIDs.length === 0) {
|
|
13277
|
+
throw new Error(withUsage$s('The `objectIDs` option is required.'));
|
|
13278
|
+
}
|
|
13279
|
+
return {
|
|
13280
|
+
dependsOn: 'recommend',
|
|
13281
|
+
$$type: 'ais.frequentlyBoughtTogether',
|
|
13282
|
+
init: function init(initOptions) {
|
|
13283
|
+
renderFn(_objectSpread2(_objectSpread2({}, this.getWidgetRenderState(initOptions)), {}, {
|
|
13284
|
+
instantSearchInstance: initOptions.instantSearchInstance
|
|
13285
|
+
}), true);
|
|
13286
|
+
},
|
|
13287
|
+
render: function render(renderOptions) {
|
|
13288
|
+
var renderState = this.getWidgetRenderState(renderOptions);
|
|
13289
|
+
renderFn(_objectSpread2(_objectSpread2({}, renderState), {}, {
|
|
13290
|
+
instantSearchInstance: renderOptions.instantSearchInstance
|
|
13291
|
+
}), false);
|
|
13292
|
+
},
|
|
13293
|
+
getRenderState: function getRenderState(renderState) {
|
|
13294
|
+
return renderState;
|
|
13295
|
+
},
|
|
13296
|
+
getWidgetRenderState: function getWidgetRenderState(_ref2) {
|
|
13297
|
+
var results = _ref2.results;
|
|
13298
|
+
if (results === null || results === undefined) {
|
|
13299
|
+
return {
|
|
13300
|
+
items: [],
|
|
13301
|
+
widgetParams: widgetParams
|
|
13302
|
+
};
|
|
13303
|
+
}
|
|
13304
|
+
if (escapeHTML && results.hits.length > 0) {
|
|
13305
|
+
results.hits = escapeHits(results.hits);
|
|
13306
|
+
}
|
|
13307
|
+
var transformedItems = transformItems(results.hits, {
|
|
13308
|
+
results: results
|
|
13309
|
+
});
|
|
13310
|
+
return {
|
|
13311
|
+
items: transformedItems,
|
|
13312
|
+
widgetParams: widgetParams
|
|
13313
|
+
};
|
|
13314
|
+
},
|
|
13315
|
+
dispose: function dispose(_ref3) {
|
|
13316
|
+
var recommendState = _ref3.recommendState;
|
|
13317
|
+
unmountFn();
|
|
13318
|
+
return recommendState.removeParams(this.$$id);
|
|
13319
|
+
},
|
|
13320
|
+
getWidgetParameters: function getWidgetParameters(state) {
|
|
13321
|
+
var _this = this;
|
|
13322
|
+
return objectIDs.reduce(function (acc, objectID) {
|
|
13323
|
+
return acc.addFrequentlyBoughtTogether({
|
|
13324
|
+
objectID: objectID,
|
|
13325
|
+
threshold: threshold,
|
|
13326
|
+
maxRecommendations: limit,
|
|
13327
|
+
queryParameters: _objectSpread2(_objectSpread2({}, queryParameters), escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
13328
|
+
$$id: _this.$$id
|
|
13329
|
+
});
|
|
13330
|
+
}, state.removeParams(this.$$id));
|
|
13331
|
+
}
|
|
13332
|
+
};
|
|
13333
|
+
};
|
|
13334
|
+
};
|
|
13335
|
+
|
|
13336
|
+
var withUsage$t = createDocumentationMessageGenerator({
|
|
13337
|
+
name: 'looking-similar',
|
|
13338
|
+
connector: true
|
|
13339
|
+
});
|
|
13340
|
+
var connectLookingSimilar = function connectLookingSimilar(renderFn) {
|
|
13341
|
+
var unmountFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
|
|
13342
|
+
checkRendering(renderFn, withUsage$t());
|
|
13343
|
+
return function LookingSimilar(widgetParams) {
|
|
13344
|
+
var _ref = widgetParams || {},
|
|
13345
|
+
_ref$escapeHTML = _ref.escapeHTML,
|
|
13346
|
+
escapeHTML = _ref$escapeHTML === void 0 ? true : _ref$escapeHTML,
|
|
13347
|
+
objectIDs = _ref.objectIDs,
|
|
13348
|
+
limit = _ref.limit,
|
|
13349
|
+
threshold = _ref.threshold,
|
|
13350
|
+
fallbackParameters = _ref.fallbackParameters,
|
|
13351
|
+
queryParameters = _ref.queryParameters,
|
|
13352
|
+
_ref$transformItems = _ref.transformItems,
|
|
13353
|
+
transformItems = _ref$transformItems === void 0 ? function (items) {
|
|
13354
|
+
return items;
|
|
13355
|
+
} : _ref$transformItems;
|
|
13356
|
+
if (!objectIDs || objectIDs.length === 0) {
|
|
13357
|
+
throw new Error(withUsage$t('The `objectIDs` option is required.'));
|
|
13358
|
+
}
|
|
13359
|
+
return {
|
|
13360
|
+
dependsOn: 'recommend',
|
|
13361
|
+
$$type: 'ais.lookingSimilar',
|
|
13362
|
+
init: function init(initOptions) {
|
|
13363
|
+
renderFn(_objectSpread2(_objectSpread2({}, this.getWidgetRenderState(initOptions)), {}, {
|
|
13364
|
+
instantSearchInstance: initOptions.instantSearchInstance
|
|
13365
|
+
}), true);
|
|
13366
|
+
},
|
|
13367
|
+
render: function render(renderOptions) {
|
|
13368
|
+
var renderState = this.getWidgetRenderState(renderOptions);
|
|
13369
|
+
renderFn(_objectSpread2(_objectSpread2({}, renderState), {}, {
|
|
13370
|
+
instantSearchInstance: renderOptions.instantSearchInstance
|
|
13371
|
+
}), false);
|
|
13372
|
+
},
|
|
13373
|
+
getRenderState: function getRenderState(renderState) {
|
|
13374
|
+
return renderState;
|
|
13375
|
+
},
|
|
13376
|
+
getWidgetRenderState: function getWidgetRenderState(_ref2) {
|
|
13377
|
+
var results = _ref2.results;
|
|
13378
|
+
if (results === null || results === undefined) {
|
|
13379
|
+
return {
|
|
13380
|
+
items: [],
|
|
13381
|
+
widgetParams: widgetParams
|
|
13382
|
+
};
|
|
13383
|
+
}
|
|
13384
|
+
if (escapeHTML && results.hits.length > 0) {
|
|
13385
|
+
results.hits = escapeHits(results.hits);
|
|
13386
|
+
}
|
|
13387
|
+
return {
|
|
13388
|
+
items: transformItems(results.hits, {
|
|
13389
|
+
results: results
|
|
13390
|
+
}),
|
|
13391
|
+
widgetParams: widgetParams
|
|
13392
|
+
};
|
|
13393
|
+
},
|
|
13394
|
+
dispose: function dispose(_ref3) {
|
|
13395
|
+
var recommendState = _ref3.recommendState;
|
|
13396
|
+
unmountFn();
|
|
13397
|
+
return recommendState.removeParams(this.$$id);
|
|
13398
|
+
},
|
|
13399
|
+
getWidgetParameters: function getWidgetParameters(state) {
|
|
13400
|
+
var _this = this;
|
|
13401
|
+
return objectIDs.reduce(function (acc, objectID) {
|
|
13402
|
+
return acc.addLookingSimilar({
|
|
13403
|
+
objectID: objectID,
|
|
13404
|
+
maxRecommendations: limit,
|
|
13405
|
+
threshold: threshold,
|
|
13406
|
+
fallbackParameters: _objectSpread2(_objectSpread2({}, fallbackParameters), escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
13407
|
+
queryParameters: _objectSpread2(_objectSpread2({}, queryParameters), escapeHTML ? TAG_PLACEHOLDER : {}),
|
|
13408
|
+
$$id: _this.$$id
|
|
13409
|
+
});
|
|
13410
|
+
}, state.removeParams(this.$$id));
|
|
13411
|
+
}
|
|
13412
|
+
};
|
|
13413
|
+
};
|
|
13414
|
+
};
|
|
13415
|
+
|
|
13416
|
+
/** @deprecated answers is no longer supported */
|
|
13417
|
+
var EXPERIMENTAL_connectAnswers = deprecate(connectAnswers, 'answers is no longer supported');
|
|
13418
|
+
|
|
13419
|
+
/** @deprecated use connectDynamicWidgets */
|
|
13420
|
+
var EXPERIMENTAL_connectDynamicWidgets = deprecate(connectDynamicWidgets, 'use connectDynamicWidgets');
|
|
13421
|
+
|
|
13422
|
+
var connectors = /*#__PURE__*/Object.freeze({
|
|
13423
|
+
__proto__: null,
|
|
13424
|
+
EXPERIMENTAL_connectAnswers: EXPERIMENTAL_connectAnswers,
|
|
13425
|
+
EXPERIMENTAL_connectDynamicWidgets: EXPERIMENTAL_connectDynamicWidgets,
|
|
13426
|
+
connectDynamicWidgets: connectDynamicWidgets,
|
|
13427
|
+
connectClearRefinements: connectClearRefinements,
|
|
13428
|
+
connectCurrentRefinements: connectCurrentRefinements,
|
|
13429
|
+
connectHierarchicalMenu: connectHierarchicalMenu,
|
|
13430
|
+
connectHits: connectHits,
|
|
13431
|
+
connectHitsWithInsights: connectHitsWithInsights,
|
|
13432
|
+
connectHitsPerPage: connectHitsPerPage,
|
|
13433
|
+
connectInfiniteHits: connectInfiniteHits,
|
|
13434
|
+
connectInfiniteHitsWithInsights: connectInfiniteHitsWithInsights,
|
|
13435
|
+
connectMenu: connectMenu,
|
|
13436
|
+
connectNumericMenu: connectNumericMenu,
|
|
13437
|
+
connectPagination: connectPagination,
|
|
13438
|
+
connectRange: connectRange,
|
|
13439
|
+
connectRefinementList: connectRefinementList,
|
|
13440
|
+
connectRelatedProducts: connectRelatedProducts,
|
|
13441
|
+
connectSearchBox: connectSearchBox,
|
|
13442
|
+
connectSortBy: connectSortBy,
|
|
13443
|
+
connectRatingMenu: connectRatingMenu,
|
|
13444
|
+
connectStats: connectStats,
|
|
13445
|
+
connectToggleRefinement: connectToggleRefinement,
|
|
13446
|
+
connectTrendingItems: connectTrendingItems,
|
|
13447
|
+
connectBreadcrumb: connectBreadcrumb,
|
|
13448
|
+
connectGeoSearch: connectGeoSearch,
|
|
13449
|
+
connectPoweredBy: connectPoweredBy,
|
|
13450
|
+
connectConfigure: connectConfigure,
|
|
13451
|
+
EXPERIMENTAL_connectConfigureRelatedItems: connectConfigureRelatedItems,
|
|
13452
|
+
connectAutocomplete: connectAutocomplete,
|
|
13453
|
+
connectQueryRules: connectQueryRules,
|
|
13454
|
+
connectVoiceSearch: connectVoiceSearch,
|
|
13455
|
+
connectRelevantSort: connectRelevantSort,
|
|
13456
|
+
connectFrequentlyBoughtTogether: connectFrequentlyBoughtTogether,
|
|
13457
|
+
connectLookingSimilar: connectLookingSimilar
|
|
13458
|
+
});
|
|
13459
|
+
|
|
13460
|
+
var NAMESPACE = 'ais';
|
|
13461
|
+
var component = function component(componentName) {
|
|
13462
|
+
return function () {
|
|
13463
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
13464
|
+
descendantName = _ref.descendantName,
|
|
13465
|
+
modifierName = _ref.modifierName;
|
|
13466
|
+
var descendent = descendantName ? "-".concat(descendantName) : '';
|
|
13017
13467
|
var modifier = modifierName ? "--".concat(modifierName) : '';
|
|
13018
13468
|
return "".concat(NAMESPACE, "-").concat(componentName).concat(descendent).concat(modifier);
|
|
13019
13469
|
};
|
|
@@ -14817,9 +15267,17 @@
|
|
|
14817
15267
|
};
|
|
14818
15268
|
};
|
|
14819
15269
|
|
|
15270
|
+
var id = 0;
|
|
15271
|
+
function addWidgetId(widget) {
|
|
15272
|
+
if (widget.dependsOn !== 'recommend') {
|
|
15273
|
+
return;
|
|
15274
|
+
}
|
|
15275
|
+
widget.$$id = id++;
|
|
15276
|
+
}
|
|
15277
|
+
|
|
14820
15278
|
var _excluded$7 = ["initialSearchParameters"],
|
|
14821
15279
|
_excluded2$2 = ["initialRecommendParameters"];
|
|
14822
|
-
var withUsage$
|
|
15280
|
+
var withUsage$u = createDocumentationMessageGenerator({
|
|
14823
15281
|
name: 'index-widget'
|
|
14824
15282
|
});
|
|
14825
15283
|
/**
|
|
@@ -14914,7 +15372,7 @@
|
|
|
14914
15372
|
}
|
|
14915
15373
|
var index = function index(widgetParams) {
|
|
14916
15374
|
if (widgetParams === undefined || widgetParams.indexName === undefined) {
|
|
14917
|
-
throw new Error(withUsage$
|
|
15375
|
+
throw new Error(withUsage$u('The `indexName` option is required.'));
|
|
14918
15376
|
}
|
|
14919
15377
|
var indexName = widgetParams.indexName,
|
|
14920
15378
|
_widgetParams$indexId = widgetParams.indexId,
|
|
@@ -14926,6 +15384,8 @@
|
|
|
14926
15384
|
var helper = null;
|
|
14927
15385
|
var derivedHelper = null;
|
|
14928
15386
|
var lastValidSearchParameters = null;
|
|
15387
|
+
var hasRecommendWidget = false;
|
|
15388
|
+
var hasSearchWidget = false;
|
|
14929
15389
|
return {
|
|
14930
15390
|
$$type: 'ais.index',
|
|
14931
15391
|
$$widgetType: 'ais.index',
|
|
@@ -14950,6 +15410,16 @@
|
|
|
14950
15410
|
derivedHelper.lastResults._state = helper.state;
|
|
14951
15411
|
return derivedHelper.lastResults;
|
|
14952
15412
|
},
|
|
15413
|
+
getResultsForWidget: function getResultsForWidget(widget) {
|
|
15414
|
+
var _helper;
|
|
15415
|
+
if (widget.dependsOn !== 'recommend' || isIndexWidget(widget) || widget.$$id === undefined) {
|
|
15416
|
+
return this.getResults();
|
|
15417
|
+
}
|
|
15418
|
+
if (!((_helper = helper) !== null && _helper !== void 0 && _helper.lastRecommendResults)) {
|
|
15419
|
+
return null;
|
|
15420
|
+
}
|
|
15421
|
+
return helper.lastRecommendResults[widget.$$id];
|
|
15422
|
+
},
|
|
14953
15423
|
getPreviousState: function getPreviousState() {
|
|
14954
15424
|
return lastValidSearchParameters;
|
|
14955
15425
|
},
|
|
@@ -14987,13 +15457,28 @@
|
|
|
14987
15457
|
addWidgets: function addWidgets(widgets) {
|
|
14988
15458
|
var _this = this;
|
|
14989
15459
|
if (!Array.isArray(widgets)) {
|
|
14990
|
-
throw new Error(withUsage$
|
|
15460
|
+
throw new Error(withUsage$u('The `addWidgets` method expects an array of widgets.'));
|
|
14991
15461
|
}
|
|
14992
15462
|
if (widgets.some(function (widget) {
|
|
14993
15463
|
return typeof widget.init !== 'function' && typeof widget.render !== 'function';
|
|
14994
15464
|
})) {
|
|
14995
|
-
throw new Error(withUsage$
|
|
15465
|
+
throw new Error(withUsage$u('The widget definition expects a `render` and/or an `init` method.'));
|
|
14996
15466
|
}
|
|
15467
|
+
widgets.forEach(function (widget) {
|
|
15468
|
+
if (isIndexWidget(widget)) {
|
|
15469
|
+
return;
|
|
15470
|
+
}
|
|
15471
|
+
if (localInstantSearchInstance && widget.dependsOn === 'recommend') {
|
|
15472
|
+
localInstantSearchInstance._hasRecommendWidget = true;
|
|
15473
|
+
} else if (localInstantSearchInstance) {
|
|
15474
|
+
localInstantSearchInstance._hasSearchWidget = true;
|
|
15475
|
+
} else if (widget.dependsOn === 'recommend') {
|
|
15476
|
+
hasRecommendWidget = true;
|
|
15477
|
+
} else {
|
|
15478
|
+
hasSearchWidget = true;
|
|
15479
|
+
}
|
|
15480
|
+
addWidgetId(widget);
|
|
15481
|
+
});
|
|
14997
15482
|
localWidgets = localWidgets.concat(widgets);
|
|
14998
15483
|
if (localInstantSearchInstance && Boolean(widgets.length)) {
|
|
14999
15484
|
privateHelperSetState(helper, {
|
|
@@ -15033,26 +15518,51 @@
|
|
|
15033
15518
|
removeWidgets: function removeWidgets(widgets) {
|
|
15034
15519
|
var _this2 = this;
|
|
15035
15520
|
if (!Array.isArray(widgets)) {
|
|
15036
|
-
throw new Error(withUsage$
|
|
15521
|
+
throw new Error(withUsage$u('The `removeWidgets` method expects an array of widgets.'));
|
|
15037
15522
|
}
|
|
15038
15523
|
if (widgets.some(function (widget) {
|
|
15039
15524
|
return typeof widget.dispose !== 'function';
|
|
15040
15525
|
})) {
|
|
15041
|
-
throw new Error(withUsage$
|
|
15526
|
+
throw new Error(withUsage$u('The widget definition expects a `dispose` method.'));
|
|
15042
15527
|
}
|
|
15043
15528
|
localWidgets = localWidgets.filter(function (widget) {
|
|
15044
15529
|
return widgets.indexOf(widget) === -1;
|
|
15045
15530
|
});
|
|
15531
|
+
localWidgets.forEach(function (widget) {
|
|
15532
|
+
if (isIndexWidget(widget)) {
|
|
15533
|
+
return;
|
|
15534
|
+
}
|
|
15535
|
+
if (localInstantSearchInstance && widget.dependsOn === 'recommend') {
|
|
15536
|
+
localInstantSearchInstance._hasRecommendWidget = true;
|
|
15537
|
+
} else if (localInstantSearchInstance) {
|
|
15538
|
+
localInstantSearchInstance._hasSearchWidget = true;
|
|
15539
|
+
} else if (widget.dependsOn === 'recommend') {
|
|
15540
|
+
hasRecommendWidget = true;
|
|
15541
|
+
} else {
|
|
15542
|
+
hasSearchWidget = true;
|
|
15543
|
+
}
|
|
15544
|
+
});
|
|
15046
15545
|
if (localInstantSearchInstance && Boolean(widgets.length)) {
|
|
15047
|
-
var
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
|
|
15052
|
-
|
|
15053
|
-
|
|
15054
|
-
|
|
15055
|
-
|
|
15546
|
+
var _widgets$reduce = widgets.reduce(function (states, widget) {
|
|
15547
|
+
// the `dispose` method exists at this point we already assert it
|
|
15548
|
+
var next = widget.dispose({
|
|
15549
|
+
helper: helper,
|
|
15550
|
+
state: states.cleanedSearchState,
|
|
15551
|
+
recommendState: states.cleanedRecommendState,
|
|
15552
|
+
parent: _this2
|
|
15553
|
+
});
|
|
15554
|
+
if (next instanceof algoliasearchHelper_1.RecommendParameters) {
|
|
15555
|
+
states.cleanedRecommendState = next;
|
|
15556
|
+
} else if (next) {
|
|
15557
|
+
states.cleanedSearchState = next;
|
|
15558
|
+
}
|
|
15559
|
+
return states;
|
|
15560
|
+
}, {
|
|
15561
|
+
cleanedSearchState: helper.state,
|
|
15562
|
+
cleanedRecommendState: helper.recommendState
|
|
15563
|
+
}),
|
|
15564
|
+
cleanedSearchState = _widgets$reduce.cleanedSearchState,
|
|
15565
|
+
cleanedRecommendState = _widgets$reduce.cleanedRecommendState;
|
|
15056
15566
|
var newState = localInstantSearchInstance.future.preserveSharedStateOnUnmount ? getLocalWidgetsSearchParameters(localWidgets, {
|
|
15057
15567
|
uiState: localUiState,
|
|
15058
15568
|
initialSearchParameters: new algoliasearchHelper_1.SearchParameters({
|
|
@@ -15060,16 +15570,17 @@
|
|
|
15060
15570
|
})
|
|
15061
15571
|
}) : getLocalWidgetsSearchParameters(localWidgets, {
|
|
15062
15572
|
uiState: getLocalWidgetsUiState(localWidgets, {
|
|
15063
|
-
searchParameters:
|
|
15573
|
+
searchParameters: cleanedSearchState,
|
|
15064
15574
|
helper: helper
|
|
15065
15575
|
}),
|
|
15066
|
-
initialSearchParameters:
|
|
15576
|
+
initialSearchParameters: cleanedSearchState
|
|
15067
15577
|
});
|
|
15068
15578
|
localUiState = getLocalWidgetsUiState(localWidgets, {
|
|
15069
15579
|
searchParameters: newState,
|
|
15070
15580
|
helper: helper
|
|
15071
15581
|
});
|
|
15072
15582
|
helper.setState(newState);
|
|
15583
|
+
helper.recommendState = cleanedRecommendState;
|
|
15073
15584
|
if (localWidgets.length) {
|
|
15074
15585
|
localInstantSearchInstance.scheduleSearch();
|
|
15075
15586
|
}
|
|
@@ -15255,9 +15766,16 @@
|
|
|
15255
15766
|
// schedule a render that will render the results injected on the helper.
|
|
15256
15767
|
instantSearchInstance.scheduleRender();
|
|
15257
15768
|
}
|
|
15769
|
+
if (hasRecommendWidget) {
|
|
15770
|
+
instantSearchInstance._hasRecommendWidget = true;
|
|
15771
|
+
}
|
|
15772
|
+
if (hasSearchWidget) {
|
|
15773
|
+
instantSearchInstance._hasSearchWidget = true;
|
|
15774
|
+
}
|
|
15258
15775
|
},
|
|
15259
15776
|
render: function render(_ref6) {
|
|
15260
|
-
var
|
|
15777
|
+
var _derivedHelper2,
|
|
15778
|
+
_this4 = this;
|
|
15261
15779
|
var instantSearchInstance = _ref6.instantSearchInstance;
|
|
15262
15780
|
// we can't attach a listener to the error event of search, as the error
|
|
15263
15781
|
// then would no longer be thrown for global handlers.
|
|
@@ -15267,7 +15785,7 @@
|
|
|
15267
15785
|
|
|
15268
15786
|
// We only render index widgets if there are no results.
|
|
15269
15787
|
// This makes sure `render` is never called with `results` being `null`.
|
|
15270
|
-
var widgetsToRender = this.getResults() ? localWidgets : localWidgets.filter(isIndexWidget);
|
|
15788
|
+
var widgetsToRender = this.getResults() || (_derivedHelper2 = derivedHelper) !== null && _derivedHelper2 !== void 0 && _derivedHelper2.lastRecommendResults ? localWidgets : localWidgets.filter(isIndexWidget);
|
|
15271
15789
|
widgetsToRender = widgetsToRender.filter(function (widget) {
|
|
15272
15790
|
if (!widget.shouldRender) {
|
|
15273
15791
|
return true;
|
|
@@ -15278,7 +15796,7 @@
|
|
|
15278
15796
|
});
|
|
15279
15797
|
widgetsToRender.forEach(function (widget) {
|
|
15280
15798
|
if (widget.getRenderState) {
|
|
15281
|
-
var renderState = widget.getRenderState(instantSearchInstance.renderState[_this4.getIndexId()] || {}, createRenderArgs(instantSearchInstance, _this4));
|
|
15799
|
+
var renderState = widget.getRenderState(instantSearchInstance.renderState[_this4.getIndexId()] || {}, createRenderArgs(instantSearchInstance, _this4, widget));
|
|
15282
15800
|
storeRenderState({
|
|
15283
15801
|
renderState: renderState,
|
|
15284
15802
|
instantSearchInstance: instantSearchInstance,
|
|
@@ -15295,16 +15813,16 @@
|
|
|
15295
15813
|
// not have results yet.
|
|
15296
15814
|
|
|
15297
15815
|
if (widget.render) {
|
|
15298
|
-
widget.render(createRenderArgs(instantSearchInstance, _this4));
|
|
15816
|
+
widget.render(createRenderArgs(instantSearchInstance, _this4, widget));
|
|
15299
15817
|
}
|
|
15300
15818
|
});
|
|
15301
15819
|
},
|
|
15302
15820
|
dispose: function dispose() {
|
|
15303
15821
|
var _this5 = this,
|
|
15304
|
-
|
|
15305
|
-
|
|
15822
|
+
_helper2,
|
|
15823
|
+
_derivedHelper3;
|
|
15306
15824
|
localWidgets.forEach(function (widget) {
|
|
15307
|
-
if (widget.dispose) {
|
|
15825
|
+
if (widget.dispose && helper) {
|
|
15308
15826
|
// The dispose function is always called once the instance is started
|
|
15309
15827
|
// (it's an effect of `removeWidgets`). The index is initialized and
|
|
15310
15828
|
// the Helper is available. We don't care about the return value of
|
|
@@ -15314,15 +15832,16 @@
|
|
|
15314
15832
|
widget.dispose({
|
|
15315
15833
|
helper: helper,
|
|
15316
15834
|
state: helper.state,
|
|
15835
|
+
recommendState: helper.recommendState,
|
|
15317
15836
|
parent: _this5
|
|
15318
15837
|
});
|
|
15319
15838
|
}
|
|
15320
15839
|
});
|
|
15321
15840
|
localInstantSearchInstance = null;
|
|
15322
15841
|
localParent = null;
|
|
15323
|
-
(
|
|
15842
|
+
(_helper2 = helper) === null || _helper2 === void 0 ? void 0 : _helper2.removeAllListeners();
|
|
15324
15843
|
helper = null;
|
|
15325
|
-
(
|
|
15844
|
+
(_derivedHelper3 = derivedHelper) === null || _derivedHelper3 === void 0 ? void 0 : _derivedHelper3.detach();
|
|
15326
15845
|
derivedHelper = null;
|
|
15327
15846
|
},
|
|
15328
15847
|
getWidgetUiState: function getWidgetUiState(uiState) {
|
|
@@ -15428,9 +15947,9 @@
|
|
|
15428
15947
|
};
|
|
15429
15948
|
}
|
|
15430
15949
|
|
|
15431
|
-
var version$1 = '4.
|
|
15950
|
+
var version$1 = '4.69.0';
|
|
15432
15951
|
|
|
15433
|
-
var withUsage$
|
|
15952
|
+
var withUsage$v = createDocumentationMessageGenerator({
|
|
15434
15953
|
name: 'instantsearch'
|
|
15435
15954
|
});
|
|
15436
15955
|
function defaultCreateURL() {
|
|
@@ -15481,6 +16000,8 @@
|
|
|
15481
16000
|
_defineProperty(_assertThisInitialized(_this), "_createURL", void 0);
|
|
15482
16001
|
_defineProperty(_assertThisInitialized(_this), "_searchFunction", void 0);
|
|
15483
16002
|
_defineProperty(_assertThisInitialized(_this), "_mainHelperSearch", void 0);
|
|
16003
|
+
_defineProperty(_assertThisInitialized(_this), "_hasSearchWidget", false);
|
|
16004
|
+
_defineProperty(_assertThisInitialized(_this), "_hasRecommendWidget", false);
|
|
15484
16005
|
_defineProperty(_assertThisInitialized(_this), "_insights", void 0);
|
|
15485
16006
|
_defineProperty(_assertThisInitialized(_this), "middleware", []);
|
|
15486
16007
|
_defineProperty(_assertThisInitialized(_this), "sendEventToInsights", void 0);
|
|
@@ -15545,7 +16066,7 @@
|
|
|
15545
16066
|
_options$future = options.future,
|
|
15546
16067
|
future = _options$future === void 0 ? _objectSpread2(_objectSpread2({}, INSTANTSEARCH_FUTURE_DEFAULTS), options.future || {}) : _options$future;
|
|
15547
16068
|
if (searchClient === null) {
|
|
15548
|
-
throw new Error(withUsage$
|
|
16069
|
+
throw new Error(withUsage$v('The `searchClient` option is required.'));
|
|
15549
16070
|
}
|
|
15550
16071
|
if (typeof searchClient.search !== 'function') {
|
|
15551
16072
|
throw new Error("The `searchClient` must implement a `search` method.\n\nSee: https://www.algolia.com/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js/");
|
|
@@ -15555,7 +16076,7 @@
|
|
|
15555
16076
|
}
|
|
15556
16077
|
_warning(insightsClient === null, "`insightsClient` property has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `insights` middleware.\n\nFor more information, visit https://www.algolia.com/doc/guides/getting-insights-and-analytics/search-analytics/click-through-and-conversions/how-to/send-click-and-conversion-events-with-instantsearch/js/") ;
|
|
15557
16078
|
if (insightsClient && typeof insightsClient !== 'function') {
|
|
15558
|
-
throw new Error(withUsage$
|
|
16079
|
+
throw new Error(withUsage$v('The `insightsClient` option should be a function.'));
|
|
15559
16080
|
}
|
|
15560
16081
|
_warning(!options.searchParameters, "The `searchParameters` option is deprecated and will not be supported in InstantSearch.js 4.x.\n\nYou can replace it with the `configure` widget:\n\n```\nsearch.addWidgets([\n configure(".concat(JSON.stringify(options.searchParameters, null, 2), ")\n]);\n```\n\nSee ").concat(createDocumentationLink({
|
|
15561
16082
|
name: 'configure'
|
|
@@ -15716,12 +16237,12 @@
|
|
|
15716
16237
|
key: "addWidgets",
|
|
15717
16238
|
value: function addWidgets(widgets) {
|
|
15718
16239
|
if (!Array.isArray(widgets)) {
|
|
15719
|
-
throw new Error(withUsage$
|
|
16240
|
+
throw new Error(withUsage$v('The `addWidgets` method expects an array of widgets. Please use `addWidget`.'));
|
|
15720
16241
|
}
|
|
15721
16242
|
if (widgets.some(function (widget) {
|
|
15722
16243
|
return typeof widget.init !== 'function' && typeof widget.render !== 'function';
|
|
15723
16244
|
})) {
|
|
15724
|
-
throw new Error(withUsage$
|
|
16245
|
+
throw new Error(withUsage$v('The widget definition expects a `render` and/or an `init` method.'));
|
|
15725
16246
|
}
|
|
15726
16247
|
this.mainIndex.addWidgets(widgets);
|
|
15727
16248
|
return this;
|
|
@@ -15751,12 +16272,12 @@
|
|
|
15751
16272
|
key: "removeWidgets",
|
|
15752
16273
|
value: function removeWidgets(widgets) {
|
|
15753
16274
|
if (!Array.isArray(widgets)) {
|
|
15754
|
-
throw new Error(withUsage$
|
|
16275
|
+
throw new Error(withUsage$v('The `removeWidgets` method expects an array of widgets. Please use `removeWidget`.'));
|
|
15755
16276
|
}
|
|
15756
16277
|
if (widgets.some(function (widget) {
|
|
15757
16278
|
return typeof widget.dispose !== 'function';
|
|
15758
16279
|
})) {
|
|
15759
|
-
throw new Error(withUsage$
|
|
16280
|
+
throw new Error(withUsage$v('The widget definition expects a `dispose` method.'));
|
|
15760
16281
|
}
|
|
15761
16282
|
this.mainIndex.removeWidgets(widgets);
|
|
15762
16283
|
return this;
|
|
@@ -15771,7 +16292,7 @@
|
|
|
15771
16292
|
value: function start() {
|
|
15772
16293
|
var _this3 = this;
|
|
15773
16294
|
if (this.started) {
|
|
15774
|
-
throw new Error(withUsage$
|
|
16295
|
+
throw new Error(withUsage$v('The `start` method has already been called once.'));
|
|
15775
16296
|
}
|
|
15776
16297
|
|
|
15777
16298
|
// This Helper is used for the queries, we don't care about its state. The
|
|
@@ -15791,7 +16312,13 @@
|
|
|
15791
16312
|
// under the hood, we have a different implementation. It should be
|
|
15792
16313
|
// completely transparent for the rest of the codebase. Only this module
|
|
15793
16314
|
// is impacted.
|
|
15794
|
-
|
|
16315
|
+
if (_this3._hasSearchWidget) {
|
|
16316
|
+
mainHelper.searchOnlyWithDerivedHelpers();
|
|
16317
|
+
}
|
|
16318
|
+
if (_this3._hasRecommendWidget) {
|
|
16319
|
+
mainHelper.recommend();
|
|
16320
|
+
}
|
|
16321
|
+
return mainHelper;
|
|
15795
16322
|
};
|
|
15796
16323
|
if (this._searchFunction) {
|
|
15797
16324
|
// this client isn't used to actually search, but required for the helper
|
|
@@ -15968,7 +16495,7 @@
|
|
|
15968
16495
|
var _this5 = this;
|
|
15969
16496
|
var callOnStateChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
15970
16497
|
if (!this.mainHelper) {
|
|
15971
|
-
throw new Error(withUsage$
|
|
16498
|
+
throw new Error(withUsage$v('The `start` method needs to be called before `setUiState`.'));
|
|
15972
16499
|
}
|
|
15973
16500
|
|
|
15974
16501
|
// We refresh the index UI state to update the local UI state that the
|
|
@@ -16004,7 +16531,7 @@
|
|
|
16004
16531
|
value: function createURL() {
|
|
16005
16532
|
var nextState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16006
16533
|
if (!this.started) {
|
|
16007
|
-
throw new Error(withUsage$
|
|
16534
|
+
throw new Error(withUsage$v('The `start` method needs to be called before `createURL`.'));
|
|
16008
16535
|
}
|
|
16009
16536
|
return this._createURL(nextState);
|
|
16010
16537
|
}
|
|
@@ -16012,7 +16539,7 @@
|
|
|
16012
16539
|
key: "refresh",
|
|
16013
16540
|
value: function refresh() {
|
|
16014
16541
|
if (!this.mainHelper) {
|
|
16015
|
-
throw new Error(withUsage$
|
|
16542
|
+
throw new Error(withUsage$v('The `start` method needs to be called before `refresh`.'));
|
|
16016
16543
|
}
|
|
16017
16544
|
this.mainHelper.clearCache().search();
|
|
16018
16545
|
}
|
|
@@ -16092,6 +16619,70 @@
|
|
|
16092
16619
|
|
|
16093
16620
|
var _extends$1 = unwrapExports(_extends_1);
|
|
16094
16621
|
|
|
16622
|
+
var _typeof_1 = createCommonjsModule(function (module) {
|
|
16623
|
+
function _typeof(obj) {
|
|
16624
|
+
"@babel/helpers - typeof";
|
|
16625
|
+
|
|
16626
|
+
return (module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
16627
|
+
return typeof obj;
|
|
16628
|
+
} : function (obj) {
|
|
16629
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
16630
|
+
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(obj);
|
|
16631
|
+
}
|
|
16632
|
+
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
16633
|
+
});
|
|
16634
|
+
|
|
16635
|
+
unwrapExports(_typeof_1);
|
|
16636
|
+
|
|
16637
|
+
var toPrimitive = createCommonjsModule(function (module) {
|
|
16638
|
+
var _typeof = _typeof_1["default"];
|
|
16639
|
+
function _toPrimitive(input, hint) {
|
|
16640
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
16641
|
+
var prim = input[Symbol.toPrimitive];
|
|
16642
|
+
if (prim !== undefined) {
|
|
16643
|
+
var res = prim.call(input, hint || "default");
|
|
16644
|
+
if (_typeof(res) !== "object") return res;
|
|
16645
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
16646
|
+
}
|
|
16647
|
+
return (hint === "string" ? String : Number)(input);
|
|
16648
|
+
}
|
|
16649
|
+
module.exports = _toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
16650
|
+
});
|
|
16651
|
+
|
|
16652
|
+
unwrapExports(toPrimitive);
|
|
16653
|
+
|
|
16654
|
+
var toPropertyKey = createCommonjsModule(function (module) {
|
|
16655
|
+
var _typeof = _typeof_1["default"];
|
|
16656
|
+
|
|
16657
|
+
function _toPropertyKey(arg) {
|
|
16658
|
+
var key = toPrimitive(arg, "string");
|
|
16659
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
16660
|
+
}
|
|
16661
|
+
module.exports = _toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
16662
|
+
});
|
|
16663
|
+
|
|
16664
|
+
unwrapExports(toPropertyKey);
|
|
16665
|
+
|
|
16666
|
+
var defineProperty = createCommonjsModule(function (module) {
|
|
16667
|
+
function _defineProperty(obj, key, value) {
|
|
16668
|
+
key = toPropertyKey(key);
|
|
16669
|
+
if (key in obj) {
|
|
16670
|
+
Object.defineProperty(obj, key, {
|
|
16671
|
+
value: value,
|
|
16672
|
+
enumerable: true,
|
|
16673
|
+
configurable: true,
|
|
16674
|
+
writable: true
|
|
16675
|
+
});
|
|
16676
|
+
} else {
|
|
16677
|
+
obj[key] = value;
|
|
16678
|
+
}
|
|
16679
|
+
return obj;
|
|
16680
|
+
}
|
|
16681
|
+
module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
16682
|
+
});
|
|
16683
|
+
|
|
16684
|
+
var _defineProperty$1 = unwrapExports(defineProperty);
|
|
16685
|
+
|
|
16095
16686
|
var objectWithoutPropertiesLoose = createCommonjsModule(function (module) {
|
|
16096
16687
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
16097
16688
|
if (source == null) return {};
|
|
@@ -16143,44 +16734,191 @@
|
|
|
16143
16734
|
}, []).filter(Boolean).join(' ');
|
|
16144
16735
|
}
|
|
16145
16736
|
|
|
16146
|
-
|
|
16147
|
-
|
|
16148
|
-
|
|
16149
|
-
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
highlightedTagName = _ref2.highlightedTagName,
|
|
16153
|
-
isHighlighted = _ref2.isHighlighted,
|
|
16154
|
-
nonHighlightedTagName = _ref2.nonHighlightedTagName;
|
|
16155
|
-
var TagName = isHighlighted ? highlightedTagName : nonHighlightedTagName;
|
|
16156
|
-
return createElement(TagName, {
|
|
16157
|
-
className: isHighlighted ? classNames.highlighted : classNames.nonHighlighted
|
|
16158
|
-
}, children);
|
|
16737
|
+
function createDefaultEmptyComponent(_ref) {
|
|
16738
|
+
var createElement = _ref.createElement,
|
|
16739
|
+
Fragment = _ref.Fragment;
|
|
16740
|
+
var _ref2 = createElement(Fragment, null, "No results");
|
|
16741
|
+
return function DefaultEmpty() {
|
|
16742
|
+
return _ref2;
|
|
16159
16743
|
};
|
|
16160
16744
|
}
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
Fragment: Fragment
|
|
16167
|
-
});
|
|
16168
|
-
return function Highlight(userProps) {
|
|
16169
|
-
var parts = userProps.parts,
|
|
16170
|
-
_userProps$highlighte = userProps.highlightedTagName,
|
|
16171
|
-
highlightedTagName = _userProps$highlighte === void 0 ? 'mark' : _userProps$highlighte,
|
|
16172
|
-
_userProps$nonHighlig = userProps.nonHighlightedTagName,
|
|
16173
|
-
nonHighlightedTagName = _userProps$nonHighlig === void 0 ? 'span' : _userProps$nonHighlig,
|
|
16174
|
-
_userProps$separator = userProps.separator,
|
|
16175
|
-
separator = _userProps$separator === void 0 ? ', ' : _userProps$separator,
|
|
16176
|
-
className = userProps.className,
|
|
16177
|
-
_userProps$classNames = userProps.classNames,
|
|
16745
|
+
|
|
16746
|
+
function createDefaultHeaderComponent(_ref) {
|
|
16747
|
+
var createElement = _ref.createElement;
|
|
16748
|
+
return function DefaultHeader(userProps) {
|
|
16749
|
+
var _userProps$classNames = userProps.classNames,
|
|
16178
16750
|
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16751
|
+
items = userProps.items,
|
|
16752
|
+
translations = userProps.translations;
|
|
16753
|
+
if (!items || items.length < 1) {
|
|
16754
|
+
return null;
|
|
16755
|
+
}
|
|
16756
|
+
if (!translations.title) {
|
|
16757
|
+
return null;
|
|
16758
|
+
}
|
|
16759
|
+
return createElement("h3", {
|
|
16760
|
+
className: classNames.title
|
|
16761
|
+
}, translations.title);
|
|
16762
|
+
};
|
|
16763
|
+
}
|
|
16764
|
+
|
|
16765
|
+
function createDefaultItemComponent(_ref) {
|
|
16766
|
+
var createElement = _ref.createElement,
|
|
16767
|
+
Fragment = _ref.Fragment;
|
|
16768
|
+
return function DefaultItem(userProps) {
|
|
16769
|
+
return createElement(Fragment, null, JSON.stringify(userProps.item, null, 2));
|
|
16770
|
+
};
|
|
16771
|
+
}
|
|
16772
|
+
|
|
16773
|
+
function createListViewComponent(_ref) {
|
|
16774
|
+
var createElement = _ref.createElement;
|
|
16775
|
+
return function ListView(userProps) {
|
|
16776
|
+
var _userProps$classNames = userProps.classNames,
|
|
16777
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
16778
|
+
ItemComponent = userProps.itemComponent,
|
|
16779
|
+
items = userProps.items,
|
|
16780
|
+
sendEvent = userProps.sendEvent;
|
|
16781
|
+
return createElement("div", {
|
|
16782
|
+
className: classNames.container
|
|
16783
|
+
}, createElement("ol", {
|
|
16784
|
+
className: classNames.list
|
|
16785
|
+
}, items.map(function (item) {
|
|
16786
|
+
return createElement("li", {
|
|
16787
|
+
key: item.objectID,
|
|
16788
|
+
className: classNames.item,
|
|
16789
|
+
onClick: sendEvent,
|
|
16790
|
+
onAuxClick: sendEvent
|
|
16791
|
+
}, createElement(ItemComponent, {
|
|
16792
|
+
item: item
|
|
16793
|
+
}));
|
|
16794
|
+
})));
|
|
16795
|
+
};
|
|
16796
|
+
}
|
|
16797
|
+
|
|
16798
|
+
var _excluded$9 = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "view", "items", "status", "translations", "sendEvent"];
|
|
16799
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
16800
|
+
var keys = Object.keys(object);
|
|
16801
|
+
if (Object.getOwnPropertySymbols) {
|
|
16802
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
16803
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
16804
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
16805
|
+
})), keys.push.apply(keys, symbols);
|
|
16806
|
+
}
|
|
16807
|
+
return keys;
|
|
16808
|
+
}
|
|
16809
|
+
function _objectSpread(target) {
|
|
16810
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
16811
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
16812
|
+
i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) {
|
|
16813
|
+
_defineProperty$1(target, key, source[key]);
|
|
16814
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) {
|
|
16815
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
16816
|
+
});
|
|
16817
|
+
}
|
|
16818
|
+
return target;
|
|
16819
|
+
}
|
|
16820
|
+
function createFrequentlyBoughtTogetherComponent(_ref) {
|
|
16821
|
+
var createElement = _ref.createElement,
|
|
16822
|
+
Fragment = _ref.Fragment;
|
|
16823
|
+
return function FrequentlyBoughtTogether(userProps) {
|
|
16824
|
+
var _userProps$classNames = userProps.classNames,
|
|
16825
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
16826
|
+
_userProps$emptyCompo = userProps.emptyComponent,
|
|
16827
|
+
EmptyComponent = _userProps$emptyCompo === void 0 ? createDefaultEmptyComponent({
|
|
16828
|
+
createElement: createElement,
|
|
16829
|
+
Fragment: Fragment
|
|
16830
|
+
}) : _userProps$emptyCompo,
|
|
16831
|
+
_userProps$headerComp = userProps.headerComponent,
|
|
16832
|
+
HeaderComponent = _userProps$headerComp === void 0 ? createDefaultHeaderComponent({
|
|
16833
|
+
createElement: createElement,
|
|
16834
|
+
Fragment: Fragment
|
|
16835
|
+
}) : _userProps$headerComp,
|
|
16836
|
+
_userProps$itemCompon = userProps.itemComponent,
|
|
16837
|
+
ItemComponent = _userProps$itemCompon === void 0 ? createDefaultItemComponent({
|
|
16838
|
+
createElement: createElement,
|
|
16839
|
+
Fragment: Fragment
|
|
16840
|
+
}) : _userProps$itemCompon,
|
|
16841
|
+
_userProps$view = userProps.view,
|
|
16842
|
+
View = _userProps$view === void 0 ? createListViewComponent({
|
|
16843
|
+
createElement: createElement,
|
|
16844
|
+
Fragment: Fragment
|
|
16845
|
+
}) : _userProps$view,
|
|
16846
|
+
items = userProps.items,
|
|
16847
|
+
status = userProps.status,
|
|
16848
|
+
userTranslations = userProps.translations,
|
|
16849
|
+
sendEvent = userProps.sendEvent,
|
|
16850
|
+
props = _objectWithoutProperties$1(userProps, _excluded$9);
|
|
16851
|
+
var translations = _objectSpread({
|
|
16852
|
+
title: 'Frequently bought together',
|
|
16853
|
+
sliderLabel: 'Frequently bought together products'
|
|
16854
|
+
}, userTranslations);
|
|
16855
|
+
var cssClasses = {
|
|
16856
|
+
root: cx('ais-FrequentlyBoughtTogether', classNames.root),
|
|
16857
|
+
emptyRoot: cx('ais-FrequentlyBoughtTogether', classNames.root, 'ais-FrequentlyBoughtTogether--empty', classNames.emptyRoot, props.className),
|
|
16858
|
+
title: cx('ais-FrequentlyBoughtTogether-title', classNames.title),
|
|
16859
|
+
container: cx('ais-FrequentlyBoughtTogether-container', classNames.container),
|
|
16860
|
+
list: cx('ais-FrequentlyBoughtTogether-list', classNames.list),
|
|
16861
|
+
item: cx('ais-FrequentlyBoughtTogether-item', classNames.item)
|
|
16862
|
+
};
|
|
16863
|
+
if (items.length === 0 && status === 'idle') {
|
|
16864
|
+
return createElement("section", _extends$1({}, props, {
|
|
16865
|
+
className: cssClasses.emptyRoot
|
|
16866
|
+
}), createElement(EmptyComponent, null));
|
|
16867
|
+
}
|
|
16868
|
+
return createElement("section", _extends$1({}, props, {
|
|
16869
|
+
className: cssClasses.root
|
|
16870
|
+
}), createElement(HeaderComponent, {
|
|
16871
|
+
classNames: cssClasses,
|
|
16872
|
+
items: items,
|
|
16873
|
+
translations: translations
|
|
16874
|
+
}), createElement(View, {
|
|
16875
|
+
classNames: cssClasses,
|
|
16876
|
+
translations: translations,
|
|
16877
|
+
itemComponent: ItemComponent,
|
|
16878
|
+
items: items,
|
|
16879
|
+
sendEvent: sendEvent
|
|
16880
|
+
}));
|
|
16881
|
+
};
|
|
16882
|
+
}
|
|
16883
|
+
|
|
16884
|
+
var _excluded$a = ["parts", "highlightedTagName", "nonHighlightedTagName", "separator", "className", "classNames"];
|
|
16885
|
+
function createHighlightPartComponent(_ref) {
|
|
16886
|
+
var createElement = _ref.createElement;
|
|
16887
|
+
return function HighlightPart(_ref2) {
|
|
16888
|
+
var classNames = _ref2.classNames,
|
|
16889
|
+
children = _ref2.children,
|
|
16890
|
+
highlightedTagName = _ref2.highlightedTagName,
|
|
16891
|
+
isHighlighted = _ref2.isHighlighted,
|
|
16892
|
+
nonHighlightedTagName = _ref2.nonHighlightedTagName;
|
|
16893
|
+
var TagName = isHighlighted ? highlightedTagName : nonHighlightedTagName;
|
|
16894
|
+
return createElement(TagName, {
|
|
16895
|
+
className: isHighlighted ? classNames.highlighted : classNames.nonHighlighted
|
|
16896
|
+
}, children);
|
|
16897
|
+
};
|
|
16898
|
+
}
|
|
16899
|
+
function createHighlightComponent(_ref3) {
|
|
16900
|
+
var createElement = _ref3.createElement,
|
|
16901
|
+
Fragment = _ref3.Fragment;
|
|
16902
|
+
var HighlightPart = createHighlightPartComponent({
|
|
16903
|
+
createElement: createElement,
|
|
16904
|
+
Fragment: Fragment
|
|
16905
|
+
});
|
|
16906
|
+
return function Highlight(userProps) {
|
|
16907
|
+
var parts = userProps.parts,
|
|
16908
|
+
_userProps$highlighte = userProps.highlightedTagName,
|
|
16909
|
+
highlightedTagName = _userProps$highlighte === void 0 ? 'mark' : _userProps$highlighte,
|
|
16910
|
+
_userProps$nonHighlig = userProps.nonHighlightedTagName,
|
|
16911
|
+
nonHighlightedTagName = _userProps$nonHighlig === void 0 ? 'span' : _userProps$nonHighlig,
|
|
16912
|
+
_userProps$separator = userProps.separator,
|
|
16913
|
+
separator = _userProps$separator === void 0 ? ', ' : _userProps$separator,
|
|
16914
|
+
className = userProps.className,
|
|
16915
|
+
_userProps$classNames = userProps.classNames,
|
|
16916
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
16917
|
+
props = _objectWithoutProperties$1(userProps, _excluded$a);
|
|
16918
|
+
return createElement("span", _extends$1({}, props, {
|
|
16919
|
+
className: cx(classNames.root, className)
|
|
16920
|
+
}), parts.map(function (part, partIndex) {
|
|
16921
|
+
var isLastPart = partIndex === parts.length - 1;
|
|
16184
16922
|
return createElement(Fragment, {
|
|
16185
16923
|
key: partIndex
|
|
16186
16924
|
}, part.map(function (subPart, subPartIndex) {
|
|
@@ -16198,14 +16936,13 @@
|
|
|
16198
16936
|
};
|
|
16199
16937
|
}
|
|
16200
16938
|
|
|
16201
|
-
var _excluded$
|
|
16939
|
+
var _excluded$b = ["classNames", "hits", "itemComponent", "sendEvent", "emptyComponent", "banner", "bannerComponent"];
|
|
16202
16940
|
|
|
16203
16941
|
// Should be imported from a shared package in the future
|
|
16204
16942
|
|
|
16205
16943
|
function createDefaultBannerComponent(_ref) {
|
|
16206
16944
|
var createElement = _ref.createElement;
|
|
16207
16945
|
return function DefaultBanner(_ref2) {
|
|
16208
|
-
var _banner$link;
|
|
16209
16946
|
var classNames = _ref2.classNames,
|
|
16210
16947
|
banner = _ref2.banner;
|
|
16211
16948
|
if (!banner.image.urls[0].url) {
|
|
@@ -16213,7 +16950,7 @@
|
|
|
16213
16950
|
}
|
|
16214
16951
|
return createElement("aside", {
|
|
16215
16952
|
className: cx('ais-Hits-banner', classNames.bannerRoot)
|
|
16216
|
-
},
|
|
16953
|
+
}, banner.link ? createElement("a", {
|
|
16217
16954
|
className: cx('ais-Hits-banner-link', classNames.bannerLink),
|
|
16218
16955
|
href: banner.link.url,
|
|
16219
16956
|
target: banner.link.target
|
|
@@ -16244,7 +16981,7 @@
|
|
|
16244
16981
|
EmptyComponent = userProps.emptyComponent,
|
|
16245
16982
|
banner = userProps.banner,
|
|
16246
16983
|
BannerComponent = userProps.bannerComponent,
|
|
16247
|
-
props = _objectWithoutProperties$1(userProps, _excluded$
|
|
16984
|
+
props = _objectWithoutProperties$1(userProps, _excluded$b);
|
|
16248
16985
|
return createElement("div", _extends$1({}, props, {
|
|
16249
16986
|
className: cx('ais-Hits', classNames.root, hits.length === 0 && cx('ais-Hits--empty', classNames.emptyRoot), props.className)
|
|
16250
16987
|
}), banner && (BannerComponent ? createElement(BannerComponent, {
|
|
@@ -16272,6 +17009,264 @@
|
|
|
16272
17009
|
};
|
|
16273
17010
|
}
|
|
16274
17011
|
|
|
17012
|
+
var _excluded$c = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "view", "items", "status", "translations", "sendEvent"];
|
|
17013
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
17014
|
+
var keys = Object.keys(object);
|
|
17015
|
+
if (Object.getOwnPropertySymbols) {
|
|
17016
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
17017
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
17018
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
17019
|
+
})), keys.push.apply(keys, symbols);
|
|
17020
|
+
}
|
|
17021
|
+
return keys;
|
|
17022
|
+
}
|
|
17023
|
+
function _objectSpread$1(target) {
|
|
17024
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
17025
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
17026
|
+
i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) {
|
|
17027
|
+
_defineProperty$1(target, key, source[key]);
|
|
17028
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) {
|
|
17029
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
17030
|
+
});
|
|
17031
|
+
}
|
|
17032
|
+
return target;
|
|
17033
|
+
}
|
|
17034
|
+
function createRelatedProductsComponent(_ref) {
|
|
17035
|
+
var createElement = _ref.createElement,
|
|
17036
|
+
Fragment = _ref.Fragment;
|
|
17037
|
+
return function RelatedProducts(userProps) {
|
|
17038
|
+
var _userProps$classNames = userProps.classNames,
|
|
17039
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
17040
|
+
_userProps$emptyCompo = userProps.emptyComponent,
|
|
17041
|
+
EmptyComponent = _userProps$emptyCompo === void 0 ? createDefaultEmptyComponent({
|
|
17042
|
+
createElement: createElement,
|
|
17043
|
+
Fragment: Fragment
|
|
17044
|
+
}) : _userProps$emptyCompo,
|
|
17045
|
+
_userProps$headerComp = userProps.headerComponent,
|
|
17046
|
+
HeaderComponent = _userProps$headerComp === void 0 ? createDefaultHeaderComponent({
|
|
17047
|
+
createElement: createElement,
|
|
17048
|
+
Fragment: Fragment
|
|
17049
|
+
}) : _userProps$headerComp,
|
|
17050
|
+
_userProps$itemCompon = userProps.itemComponent,
|
|
17051
|
+
ItemComponent = _userProps$itemCompon === void 0 ? createDefaultItemComponent({
|
|
17052
|
+
createElement: createElement,
|
|
17053
|
+
Fragment: Fragment
|
|
17054
|
+
}) : _userProps$itemCompon,
|
|
17055
|
+
_userProps$view = userProps.view,
|
|
17056
|
+
View = _userProps$view === void 0 ? createListViewComponent({
|
|
17057
|
+
createElement: createElement,
|
|
17058
|
+
Fragment: Fragment
|
|
17059
|
+
}) : _userProps$view,
|
|
17060
|
+
items = userProps.items,
|
|
17061
|
+
status = userProps.status,
|
|
17062
|
+
userTranslations = userProps.translations,
|
|
17063
|
+
sendEvent = userProps.sendEvent,
|
|
17064
|
+
props = _objectWithoutProperties$1(userProps, _excluded$c);
|
|
17065
|
+
var translations = _objectSpread$1({
|
|
17066
|
+
title: 'Related products',
|
|
17067
|
+
sliderLabel: 'Related products'
|
|
17068
|
+
}, userTranslations);
|
|
17069
|
+
var cssClasses = {
|
|
17070
|
+
root: cx('ais-RelatedProducts', classNames.root),
|
|
17071
|
+
emptyRoot: cx('ais-RelatedProducts', classNames.root, 'ais-RelatedProducts--empty', classNames.emptyRoot, props.className),
|
|
17072
|
+
title: cx('ais-RelatedProducts-title', classNames.title),
|
|
17073
|
+
container: cx('ais-RelatedProducts-container', classNames.container),
|
|
17074
|
+
list: cx('ais-RelatedProducts-list', classNames.list),
|
|
17075
|
+
item: cx('ais-RelatedProducts-item', classNames.item)
|
|
17076
|
+
};
|
|
17077
|
+
if (items.length === 0 && status === 'idle') {
|
|
17078
|
+
return createElement("section", _extends$1({}, props, {
|
|
17079
|
+
className: cssClasses.emptyRoot
|
|
17080
|
+
}), createElement(EmptyComponent, null));
|
|
17081
|
+
}
|
|
17082
|
+
return createElement("section", _extends$1({}, props, {
|
|
17083
|
+
className: cssClasses.root
|
|
17084
|
+
}), createElement(HeaderComponent, {
|
|
17085
|
+
classNames: cssClasses,
|
|
17086
|
+
items: items,
|
|
17087
|
+
translations: translations
|
|
17088
|
+
}), createElement(View, {
|
|
17089
|
+
classNames: cssClasses,
|
|
17090
|
+
translations: translations,
|
|
17091
|
+
itemComponent: ItemComponent,
|
|
17092
|
+
items: items,
|
|
17093
|
+
sendEvent: sendEvent
|
|
17094
|
+
}));
|
|
17095
|
+
};
|
|
17096
|
+
}
|
|
17097
|
+
|
|
17098
|
+
var _excluded$d = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "view", "items", "status", "translations", "sendEvent"];
|
|
17099
|
+
function ownKeys$3(object, enumerableOnly) {
|
|
17100
|
+
var keys = Object.keys(object);
|
|
17101
|
+
if (Object.getOwnPropertySymbols) {
|
|
17102
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
17103
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
17104
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
17105
|
+
})), keys.push.apply(keys, symbols);
|
|
17106
|
+
}
|
|
17107
|
+
return keys;
|
|
17108
|
+
}
|
|
17109
|
+
function _objectSpread$2(target) {
|
|
17110
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
17111
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
17112
|
+
i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) {
|
|
17113
|
+
_defineProperty$1(target, key, source[key]);
|
|
17114
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) {
|
|
17115
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
17116
|
+
});
|
|
17117
|
+
}
|
|
17118
|
+
return target;
|
|
17119
|
+
}
|
|
17120
|
+
function createTrendingItemsComponent(_ref) {
|
|
17121
|
+
var createElement = _ref.createElement,
|
|
17122
|
+
Fragment = _ref.Fragment;
|
|
17123
|
+
return function TrendingItems(userProps) {
|
|
17124
|
+
var _userProps$classNames = userProps.classNames,
|
|
17125
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
17126
|
+
_userProps$emptyCompo = userProps.emptyComponent,
|
|
17127
|
+
EmptyComponent = _userProps$emptyCompo === void 0 ? createDefaultEmptyComponent({
|
|
17128
|
+
createElement: createElement,
|
|
17129
|
+
Fragment: Fragment
|
|
17130
|
+
}) : _userProps$emptyCompo,
|
|
17131
|
+
_userProps$headerComp = userProps.headerComponent,
|
|
17132
|
+
HeaderComponent = _userProps$headerComp === void 0 ? createDefaultHeaderComponent({
|
|
17133
|
+
createElement: createElement,
|
|
17134
|
+
Fragment: Fragment
|
|
17135
|
+
}) : _userProps$headerComp,
|
|
17136
|
+
_userProps$itemCompon = userProps.itemComponent,
|
|
17137
|
+
ItemComponent = _userProps$itemCompon === void 0 ? createDefaultItemComponent({
|
|
17138
|
+
createElement: createElement,
|
|
17139
|
+
Fragment: Fragment
|
|
17140
|
+
}) : _userProps$itemCompon,
|
|
17141
|
+
_userProps$view = userProps.view,
|
|
17142
|
+
View = _userProps$view === void 0 ? createListViewComponent({
|
|
17143
|
+
createElement: createElement,
|
|
17144
|
+
Fragment: Fragment
|
|
17145
|
+
}) : _userProps$view,
|
|
17146
|
+
items = userProps.items,
|
|
17147
|
+
status = userProps.status,
|
|
17148
|
+
userTranslations = userProps.translations,
|
|
17149
|
+
sendEvent = userProps.sendEvent,
|
|
17150
|
+
props = _objectWithoutProperties$1(userProps, _excluded$d);
|
|
17151
|
+
var translations = _objectSpread$2({
|
|
17152
|
+
title: 'Trending items',
|
|
17153
|
+
sliderLabel: 'Trending items'
|
|
17154
|
+
}, userTranslations);
|
|
17155
|
+
var cssClasses = {
|
|
17156
|
+
root: cx('ais-TrendingItems', classNames.root),
|
|
17157
|
+
emptyRoot: cx('ais-TrendingItems', classNames.root, 'ais-TrendingItems--empty', classNames.emptyRoot, props.className),
|
|
17158
|
+
title: cx('ais-TrendingItems-title', classNames.title),
|
|
17159
|
+
container: cx('ais-TrendingItems-container', classNames.container),
|
|
17160
|
+
list: cx('ais-TrendingItems-list', classNames.list),
|
|
17161
|
+
item: cx('ais-TrendingItems-item', classNames.item)
|
|
17162
|
+
};
|
|
17163
|
+
if (items.length === 0 && status === 'idle') {
|
|
17164
|
+
return createElement("section", _extends$1({}, props, {
|
|
17165
|
+
className: cssClasses.emptyRoot
|
|
17166
|
+
}), createElement(EmptyComponent, null));
|
|
17167
|
+
}
|
|
17168
|
+
return createElement("section", _extends$1({}, props, {
|
|
17169
|
+
className: cssClasses.root
|
|
17170
|
+
}), createElement(HeaderComponent, {
|
|
17171
|
+
classNames: cssClasses,
|
|
17172
|
+
items: items,
|
|
17173
|
+
translations: translations
|
|
17174
|
+
}), createElement(View, {
|
|
17175
|
+
classNames: cssClasses,
|
|
17176
|
+
translations: translations,
|
|
17177
|
+
itemComponent: ItemComponent,
|
|
17178
|
+
items: items,
|
|
17179
|
+
sendEvent: sendEvent
|
|
17180
|
+
}));
|
|
17181
|
+
};
|
|
17182
|
+
}
|
|
17183
|
+
|
|
17184
|
+
var _excluded$e = ["classNames", "emptyComponent", "headerComponent", "itemComponent", "view", "items", "status", "translations", "sendEvent"];
|
|
17185
|
+
function ownKeys$4(object, enumerableOnly) {
|
|
17186
|
+
var keys = Object.keys(object);
|
|
17187
|
+
if (Object.getOwnPropertySymbols) {
|
|
17188
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
17189
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
17190
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
17191
|
+
})), keys.push.apply(keys, symbols);
|
|
17192
|
+
}
|
|
17193
|
+
return keys;
|
|
17194
|
+
}
|
|
17195
|
+
function _objectSpread$3(target) {
|
|
17196
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
17197
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
17198
|
+
i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) {
|
|
17199
|
+
_defineProperty$1(target, key, source[key]);
|
|
17200
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) {
|
|
17201
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
17202
|
+
});
|
|
17203
|
+
}
|
|
17204
|
+
return target;
|
|
17205
|
+
}
|
|
17206
|
+
function createLookingSimilarComponent(_ref) {
|
|
17207
|
+
var createElement = _ref.createElement,
|
|
17208
|
+
Fragment = _ref.Fragment;
|
|
17209
|
+
return function LookingSimilar(userProps) {
|
|
17210
|
+
var _userProps$classNames = userProps.classNames,
|
|
17211
|
+
classNames = _userProps$classNames === void 0 ? {} : _userProps$classNames,
|
|
17212
|
+
_userProps$emptyCompo = userProps.emptyComponent,
|
|
17213
|
+
EmptyComponent = _userProps$emptyCompo === void 0 ? createDefaultEmptyComponent({
|
|
17214
|
+
createElement: createElement,
|
|
17215
|
+
Fragment: Fragment
|
|
17216
|
+
}) : _userProps$emptyCompo,
|
|
17217
|
+
_userProps$headerComp = userProps.headerComponent,
|
|
17218
|
+
HeaderComponent = _userProps$headerComp === void 0 ? createDefaultHeaderComponent({
|
|
17219
|
+
createElement: createElement,
|
|
17220
|
+
Fragment: Fragment
|
|
17221
|
+
}) : _userProps$headerComp,
|
|
17222
|
+
_userProps$itemCompon = userProps.itemComponent,
|
|
17223
|
+
ItemComponent = _userProps$itemCompon === void 0 ? createDefaultItemComponent({
|
|
17224
|
+
createElement: createElement,
|
|
17225
|
+
Fragment: Fragment
|
|
17226
|
+
}) : _userProps$itemCompon,
|
|
17227
|
+
_userProps$view = userProps.view,
|
|
17228
|
+
View = _userProps$view === void 0 ? createListViewComponent({
|
|
17229
|
+
createElement: createElement,
|
|
17230
|
+
Fragment: Fragment
|
|
17231
|
+
}) : _userProps$view,
|
|
17232
|
+
items = userProps.items,
|
|
17233
|
+
status = userProps.status,
|
|
17234
|
+
userTranslations = userProps.translations,
|
|
17235
|
+
sendEvent = userProps.sendEvent,
|
|
17236
|
+
props = _objectWithoutProperties$1(userProps, _excluded$e);
|
|
17237
|
+
var translations = _objectSpread$3({
|
|
17238
|
+
title: 'Looking similar',
|
|
17239
|
+
sliderLabel: 'Looking similar'
|
|
17240
|
+
}, userTranslations);
|
|
17241
|
+
var cssClasses = {
|
|
17242
|
+
root: cx('ais-LookingSimilar', classNames.root),
|
|
17243
|
+
emptyRoot: cx('ais-LookingSimilar', classNames.root, 'ais-LookingSimilar--empty', classNames.emptyRoot, props.className),
|
|
17244
|
+
title: cx('ais-LookingSimilar-title', classNames.title),
|
|
17245
|
+
container: cx('ais-LookingSimilar-container', classNames.container),
|
|
17246
|
+
list: cx('ais-LookingSimilar-list', classNames.list),
|
|
17247
|
+
item: cx('ais-LookingSimilar-item', classNames.item)
|
|
17248
|
+
};
|
|
17249
|
+
if (items.length === 0 && status === 'idle') {
|
|
17250
|
+
return createElement("section", _extends$1({}, props, {
|
|
17251
|
+
className: cssClasses.emptyRoot
|
|
17252
|
+
}), createElement(EmptyComponent, null));
|
|
17253
|
+
}
|
|
17254
|
+
return createElement("section", _extends$1({}, props, {
|
|
17255
|
+
className: cssClasses.root
|
|
17256
|
+
}), createElement(HeaderComponent, {
|
|
17257
|
+
classNames: cssClasses,
|
|
17258
|
+
items: items,
|
|
17259
|
+
translations: translations
|
|
17260
|
+
}), createElement(View, {
|
|
17261
|
+
classNames: cssClasses,
|
|
17262
|
+
translations: translations,
|
|
17263
|
+
itemComponent: ItemComponent,
|
|
17264
|
+
items: items,
|
|
17265
|
+
sendEvent: sendEvent
|
|
17266
|
+
}));
|
|
17267
|
+
};
|
|
17268
|
+
}
|
|
17269
|
+
|
|
16275
17270
|
function prepareTemplates(
|
|
16276
17271
|
// can not use = {} here, since the template could have different constraints
|
|
16277
17272
|
defaultTemplates) {
|
|
@@ -17088,11 +18083,11 @@
|
|
|
17088
18083
|
Fragment: p
|
|
17089
18084
|
});
|
|
17090
18085
|
|
|
17091
|
-
var _excluded$
|
|
18086
|
+
var _excluded$f = ["classNames"];
|
|
17092
18087
|
function Highlight(_ref) {
|
|
17093
18088
|
var _ref$classNames = _ref.classNames,
|
|
17094
18089
|
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
17095
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18090
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
17096
18091
|
return h(InternalHighlight, _extends({
|
|
17097
18092
|
classNames: {
|
|
17098
18093
|
root: cx('ais-Highlight', classNames.root),
|
|
@@ -17103,12 +18098,12 @@
|
|
|
17103
18098
|
}, props));
|
|
17104
18099
|
}
|
|
17105
18100
|
|
|
17106
|
-
var _excluded$
|
|
18101
|
+
var _excluded$g = ["hit", "attribute", "cssClasses"];
|
|
17107
18102
|
function Highlight$1(_ref) {
|
|
17108
18103
|
var hit = _ref.hit,
|
|
17109
18104
|
attribute = _ref.attribute,
|
|
17110
18105
|
cssClasses = _ref.cssClasses,
|
|
17111
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18106
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
17112
18107
|
var property = getPropertyByPath(hit._highlightResult, attribute) || [];
|
|
17113
18108
|
var properties = toArray(property);
|
|
17114
18109
|
_warning(Boolean(properties.length), "Could not enable highlight for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) ;
|
|
@@ -17122,11 +18117,11 @@
|
|
|
17122
18117
|
}));
|
|
17123
18118
|
}
|
|
17124
18119
|
|
|
17125
|
-
var _excluded$
|
|
18120
|
+
var _excluded$h = ["classNames"];
|
|
17126
18121
|
function ReverseHighlight(_ref) {
|
|
17127
18122
|
var _ref$classNames = _ref.classNames,
|
|
17128
18123
|
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
17129
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18124
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
|
17130
18125
|
return h(InternalHighlight, _extends({
|
|
17131
18126
|
classNames: {
|
|
17132
18127
|
root: cx('ais-ReverseHighlight', classNames.root),
|
|
@@ -17137,13 +18132,13 @@
|
|
|
17137
18132
|
}, props));
|
|
17138
18133
|
}
|
|
17139
18134
|
|
|
17140
|
-
var _excluded$
|
|
18135
|
+
var _excluded$i = ["hit", "attribute", "cssClasses"],
|
|
17141
18136
|
_excluded2$3 = ["isHighlighted"];
|
|
17142
18137
|
function ReverseHighlight$1(_ref) {
|
|
17143
18138
|
var hit = _ref.hit,
|
|
17144
18139
|
attribute = _ref.attribute,
|
|
17145
18140
|
cssClasses = _ref.cssClasses,
|
|
17146
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18141
|
+
props = _objectWithoutProperties(_ref, _excluded$i);
|
|
17147
18142
|
var property = getPropertyByPath(hit._highlightResult, attribute) || [];
|
|
17148
18143
|
var properties = toArray(property);
|
|
17149
18144
|
_warning(Boolean(properties.length), "Could not enable highlight for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is either searchable or specified in `attributesToHighlight`.\n\nSee: https://alg.li/highlighting\n")) ;
|
|
@@ -17163,11 +18158,11 @@
|
|
|
17163
18158
|
}));
|
|
17164
18159
|
}
|
|
17165
18160
|
|
|
17166
|
-
var _excluded$
|
|
18161
|
+
var _excluded$j = ["classNames"];
|
|
17167
18162
|
function ReverseSnippet(_ref) {
|
|
17168
18163
|
var _ref$classNames = _ref.classNames,
|
|
17169
18164
|
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
17170
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18165
|
+
props = _objectWithoutProperties(_ref, _excluded$j);
|
|
17171
18166
|
return h(InternalHighlight, _extends({
|
|
17172
18167
|
classNames: {
|
|
17173
18168
|
root: cx('ais-ReverseSnippet', classNames.root),
|
|
@@ -17178,13 +18173,13 @@
|
|
|
17178
18173
|
}, props));
|
|
17179
18174
|
}
|
|
17180
18175
|
|
|
17181
|
-
var _excluded$
|
|
18176
|
+
var _excluded$k = ["hit", "attribute", "cssClasses"],
|
|
17182
18177
|
_excluded2$4 = ["isHighlighted"];
|
|
17183
18178
|
function ReverseSnippet$1(_ref) {
|
|
17184
18179
|
var hit = _ref.hit,
|
|
17185
18180
|
attribute = _ref.attribute,
|
|
17186
18181
|
cssClasses = _ref.cssClasses,
|
|
17187
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18182
|
+
props = _objectWithoutProperties(_ref, _excluded$k);
|
|
17188
18183
|
var property = getPropertyByPath(hit._snippetResult, attribute) || [];
|
|
17189
18184
|
var properties = toArray(property);
|
|
17190
18185
|
_warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) ;
|
|
@@ -17204,11 +18199,11 @@
|
|
|
17204
18199
|
}));
|
|
17205
18200
|
}
|
|
17206
18201
|
|
|
17207
|
-
var _excluded$
|
|
18202
|
+
var _excluded$l = ["classNames"];
|
|
17208
18203
|
function Snippet(_ref) {
|
|
17209
18204
|
var _ref$classNames = _ref.classNames,
|
|
17210
18205
|
classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
|
|
17211
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18206
|
+
props = _objectWithoutProperties(_ref, _excluded$l);
|
|
17212
18207
|
return h(InternalHighlight, _extends({
|
|
17213
18208
|
classNames: {
|
|
17214
18209
|
root: cx('ais-Snippet', classNames.root),
|
|
@@ -17219,12 +18214,12 @@
|
|
|
17219
18214
|
}, props));
|
|
17220
18215
|
}
|
|
17221
18216
|
|
|
17222
|
-
var _excluded$
|
|
18217
|
+
var _excluded$m = ["hit", "attribute", "cssClasses"];
|
|
17223
18218
|
function Snippet$1(_ref) {
|
|
17224
18219
|
var hit = _ref.hit,
|
|
17225
18220
|
attribute = _ref.attribute,
|
|
17226
18221
|
cssClasses = _ref.cssClasses,
|
|
17227
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
18222
|
+
props = _objectWithoutProperties(_ref, _excluded$m);
|
|
17228
18223
|
var property = getPropertyByPath(hit._snippetResult, attribute) || [];
|
|
17229
18224
|
var properties = toArray(property);
|
|
17230
18225
|
_warning(Boolean(properties.length), "Could not enable snippet for \"".concat(attribute.toString(), "\", will display an empty string.\nPlease check whether this attribute exists and is specified in `attributesToSnippet`.\n\nSee: https://alg.li/highlighting\n")) ;
|
|
@@ -17468,7 +18463,7 @@
|
|
|
17468
18463
|
}
|
|
17469
18464
|
};
|
|
17470
18465
|
|
|
17471
|
-
var withUsage$
|
|
18466
|
+
var withUsage$w = createDocumentationMessageGenerator({
|
|
17472
18467
|
name: 'answers'
|
|
17473
18468
|
});
|
|
17474
18469
|
var suit$4 = component('Answers');
|
|
@@ -17515,7 +18510,7 @@
|
|
|
17515
18510
|
_ref3$cssClasses = _ref3.cssClasses,
|
|
17516
18511
|
userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
|
|
17517
18512
|
if (!container) {
|
|
17518
|
-
throw new Error(withUsage$
|
|
18513
|
+
throw new Error(withUsage$w('The `container` option is required.'));
|
|
17519
18514
|
}
|
|
17520
18515
|
var containerNode = getContainerNode(container);
|
|
17521
18516
|
var cssClasses = {
|
|
@@ -17559,8 +18554,8 @@
|
|
|
17559
18554
|
};
|
|
17560
18555
|
var answers = deprecate(answersWidget, 'The answers widget is deprecated and will be removed in InstantSearch.js 5.0');
|
|
17561
18556
|
|
|
17562
|
-
var _excluded$
|
|
17563
|
-
var withUsage$
|
|
18557
|
+
var _excluded$n = ["container", "widgets", "fallbackWidget"];
|
|
18558
|
+
var withUsage$x = createDocumentationMessageGenerator({
|
|
17564
18559
|
name: 'dynamic-widgets'
|
|
17565
18560
|
});
|
|
17566
18561
|
var suit$5 = component('DynamicWidgets');
|
|
@@ -17577,14 +18572,14 @@
|
|
|
17577
18572
|
containerSelector = _ref.container,
|
|
17578
18573
|
widgets = _ref.widgets,
|
|
17579
18574
|
fallbackWidget = _ref.fallbackWidget,
|
|
17580
|
-
otherWidgetParams = _objectWithoutProperties(_ref, _excluded$
|
|
18575
|
+
otherWidgetParams = _objectWithoutProperties(_ref, _excluded$n);
|
|
17581
18576
|
if (!containerSelector) {
|
|
17582
|
-
throw new Error(withUsage$
|
|
18577
|
+
throw new Error(withUsage$x('The `container` option is required.'));
|
|
17583
18578
|
}
|
|
17584
18579
|
if (!(widgets && Array.isArray(widgets) && widgets.every(function (widget) {
|
|
17585
18580
|
return typeof widget === 'function';
|
|
17586
18581
|
}))) {
|
|
17587
|
-
throw new Error(withUsage$
|
|
18582
|
+
throw new Error(withUsage$x('The `widgets` option expects an array of callbacks.'));
|
|
17588
18583
|
}
|
|
17589
18584
|
var userContainer = getContainerNode(containerSelector);
|
|
17590
18585
|
var rootContainer = document.createElement('div');
|
|
@@ -17633,7 +18628,7 @@
|
|
|
17633
18628
|
});
|
|
17634
18629
|
};
|
|
17635
18630
|
|
|
17636
|
-
var withUsage$
|
|
18631
|
+
var withUsage$y = createDocumentationMessageGenerator({
|
|
17637
18632
|
name: 'analytics'
|
|
17638
18633
|
});
|
|
17639
18634
|
// @major this widget will be removed from the next major version.
|
|
@@ -17649,7 +18644,7 @@
|
|
|
17649
18644
|
_ref$pushPagination = _ref.pushPagination,
|
|
17650
18645
|
pushPagination = _ref$pushPagination === void 0 ? false : _ref$pushPagination;
|
|
17651
18646
|
if (!pushFunction) {
|
|
17652
|
-
throw new Error(withUsage$
|
|
18647
|
+
throw new Error(withUsage$y('The `pushFunction` option is required.'));
|
|
17653
18648
|
}
|
|
17654
18649
|
_warning(false, "`analytics` widget has been deprecated. It is still supported in 4.x releases, but not further. It is replaced by the `insights` middleware.\n\nFor the migration, visit https://www.algolia.com/doc/guides/building-search-ui/upgrade-guides/js/#analytics-widget") ;
|
|
17655
18650
|
var cachedState = null;
|
|
@@ -17835,7 +18830,7 @@
|
|
|
17835
18830
|
}
|
|
17836
18831
|
};
|
|
17837
18832
|
|
|
17838
|
-
var withUsage$
|
|
18833
|
+
var withUsage$z = createDocumentationMessageGenerator({
|
|
17839
18834
|
name: 'breadcrumb'
|
|
17840
18835
|
});
|
|
17841
18836
|
var suit$6 = component('Breadcrumb');
|
|
@@ -17880,7 +18875,7 @@
|
|
|
17880
18875
|
_ref3$cssClasses = _ref3.cssClasses,
|
|
17881
18876
|
userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
|
|
17882
18877
|
if (!container) {
|
|
17883
|
-
throw new Error(withUsage$
|
|
18878
|
+
throw new Error(withUsage$z('The `container` option is required.'));
|
|
17884
18879
|
}
|
|
17885
18880
|
var containerNode = getContainerNode(container);
|
|
17886
18881
|
var cssClasses = {
|
|
@@ -17951,7 +18946,7 @@
|
|
|
17951
18946
|
}
|
|
17952
18947
|
};
|
|
17953
18948
|
|
|
17954
|
-
var withUsage$
|
|
18949
|
+
var withUsage$A = createDocumentationMessageGenerator({
|
|
17955
18950
|
name: 'clear-refinements'
|
|
17956
18951
|
});
|
|
17957
18952
|
var suit$7 = component('ClearRefinements');
|
|
@@ -17991,7 +18986,7 @@
|
|
|
17991
18986
|
_ref3$cssClasses = _ref3.cssClasses,
|
|
17992
18987
|
userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
|
|
17993
18988
|
if (!container) {
|
|
17994
|
-
throw new Error(withUsage$
|
|
18989
|
+
throw new Error(withUsage$A('The `container` option is required.'));
|
|
17995
18990
|
}
|
|
17996
18991
|
var containerNode = getContainerNode(container);
|
|
17997
18992
|
var cssClasses = {
|
|
@@ -18085,7 +19080,7 @@
|
|
|
18085
19080
|
})));
|
|
18086
19081
|
};
|
|
18087
19082
|
|
|
18088
|
-
var withUsage$
|
|
19083
|
+
var withUsage$B = createDocumentationMessageGenerator({
|
|
18089
19084
|
name: 'current-refinements'
|
|
18090
19085
|
});
|
|
18091
19086
|
var suit$8 = component('CurrentRefinements');
|
|
@@ -18114,7 +19109,7 @@
|
|
|
18114
19109
|
userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses,
|
|
18115
19110
|
transformItems = _ref3.transformItems;
|
|
18116
19111
|
if (!container) {
|
|
18117
|
-
throw new Error(withUsage$
|
|
19112
|
+
throw new Error(withUsage$B('The `container` option is required.'));
|
|
18118
19113
|
}
|
|
18119
19114
|
var containerNode = getContainerNode(container);
|
|
18120
19115
|
var cssClasses = {
|
|
@@ -18551,10 +19546,10 @@
|
|
|
18551
19546
|
}), container.querySelector(".".concat(cssClasses.tree)));
|
|
18552
19547
|
};
|
|
18553
19548
|
|
|
18554
|
-
var _excluded$
|
|
19549
|
+
var _excluded$o = ["initialZoom", "initialPosition", "templates", "cssClasses", "builtInMarker", "customHTMLMarker", "enableRefine", "enableClearMapRefinement", "enableRefineControl", "container", "googleReference"],
|
|
18555
19550
|
_excluded2$5 = ["item"],
|
|
18556
19551
|
_excluded3 = ["item"];
|
|
18557
|
-
var withUsage$
|
|
19552
|
+
var withUsage$C = createDocumentationMessageGenerator({
|
|
18558
19553
|
name: 'geo-search'
|
|
18559
19554
|
});
|
|
18560
19555
|
var suit$9 = component('GeoSearch');
|
|
@@ -18595,7 +19590,7 @@
|
|
|
18595
19590
|
enableRefineControl = _ref$enableRefineCont === void 0 ? true : _ref$enableRefineCont,
|
|
18596
19591
|
container = _ref.container,
|
|
18597
19592
|
googleReference = _ref.googleReference,
|
|
18598
|
-
otherWidgetParams = _objectWithoutProperties(_ref, _excluded$
|
|
19593
|
+
otherWidgetParams = _objectWithoutProperties(_ref, _excluded$o);
|
|
18599
19594
|
var defaultBuiltInMarker = {
|
|
18600
19595
|
createOptions: function createOptions() {
|
|
18601
19596
|
return {};
|
|
@@ -18609,10 +19604,10 @@
|
|
|
18609
19604
|
events: {}
|
|
18610
19605
|
};
|
|
18611
19606
|
if (!container) {
|
|
18612
|
-
throw new Error(withUsage$
|
|
19607
|
+
throw new Error(withUsage$C('The `container` option is required.'));
|
|
18613
19608
|
}
|
|
18614
19609
|
if (!googleReference) {
|
|
18615
|
-
throw new Error(withUsage$
|
|
19610
|
+
throw new Error(withUsage$C('The `googleReference` option is required.'));
|
|
18616
19611
|
}
|
|
18617
19612
|
var containerNode = getContainerNode(container);
|
|
18618
19613
|
var cssClasses = {
|
|
@@ -18932,7 +19927,7 @@
|
|
|
18932
19927
|
})), subItems);
|
|
18933
19928
|
}
|
|
18934
19929
|
|
|
18935
|
-
var _excluded$
|
|
19930
|
+
var _excluded$p = ["root"];
|
|
18936
19931
|
|
|
18937
19932
|
// CSS types
|
|
18938
19933
|
|
|
@@ -18959,7 +19954,7 @@
|
|
|
18959
19954
|
if (isHierarchicalMenuItem(facetValue) && Array.isArray(facetValue.data) && facetValue.data.length > 0) {
|
|
18960
19955
|
var _this$props$cssClasse = _this.props.cssClasses,
|
|
18961
19956
|
root = _this$props$cssClasse.root,
|
|
18962
|
-
cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$
|
|
19957
|
+
cssClasses = _objectWithoutProperties(_this$props$cssClasse, _excluded$p);
|
|
18963
19958
|
subItems = h(RefinementList, _extends({}, _this.props, {
|
|
18964
19959
|
// We want to keep `root` required for external usage but not for the
|
|
18965
19960
|
// sub items.
|
|
@@ -19156,7 +20151,7 @@
|
|
|
19156
20151
|
}
|
|
19157
20152
|
};
|
|
19158
20153
|
|
|
19159
|
-
var withUsage$
|
|
20154
|
+
var withUsage$D = createDocumentationMessageGenerator({
|
|
19160
20155
|
name: 'hierarchical-menu'
|
|
19161
20156
|
});
|
|
19162
20157
|
var suit$a = component('HierarchicalMenu');
|
|
@@ -19266,7 +20261,7 @@
|
|
|
19266
20261
|
_ref3$cssClasses = _ref3.cssClasses,
|
|
19267
20262
|
userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses;
|
|
19268
20263
|
if (!container) {
|
|
19269
|
-
throw new Error(withUsage$
|
|
20264
|
+
throw new Error(withUsage$D('The `container` option is required.'));
|
|
19270
20265
|
}
|
|
19271
20266
|
var containerNode = getContainerNode(container);
|
|
19272
20267
|
var cssClasses = {
|
|
@@ -19347,8 +20342,8 @@
|
|
|
19347
20342
|
}
|
|
19348
20343
|
};
|
|
19349
20344
|
|
|
19350
|
-
var _excluded$
|
|
19351
|
-
var withUsage$
|
|
20345
|
+
var _excluded$q = ["hit", "index"];
|
|
20346
|
+
var withUsage$E = createDocumentationMessageGenerator({
|
|
19352
20347
|
name: 'hits'
|
|
19353
20348
|
});
|
|
19354
20349
|
var Hits = createHitsComponent({
|
|
@@ -19395,7 +20390,7 @@
|
|
|
19395
20390
|
var itemComponent = function itemComponent(_ref4) {
|
|
19396
20391
|
var hit = _ref4.hit,
|
|
19397
20392
|
index = _ref4.index,
|
|
19398
|
-
rootProps = _objectWithoutProperties(_ref4, _excluded$
|
|
20393
|
+
rootProps = _objectWithoutProperties(_ref4, _excluded$q);
|
|
19399
20394
|
return h(Template, _extends({}, renderState.templateProps, {
|
|
19400
20395
|
templateKey: "item",
|
|
19401
20396
|
rootTagName: "li",
|
|
@@ -19447,7 +20442,7 @@
|
|
|
19447
20442
|
_ref5$cssClasses = _ref5.cssClasses,
|
|
19448
20443
|
cssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses;
|
|
19449
20444
|
if (!container) {
|
|
19450
|
-
throw new Error(withUsage$
|
|
20445
|
+
throw new Error(withUsage$E('The `container` option is required.'));
|
|
19451
20446
|
}
|
|
19452
20447
|
var containerNode = getContainerNode(container);
|
|
19453
20448
|
var specializedRenderer = renderer$6({
|
|
@@ -19489,7 +20484,7 @@
|
|
|
19489
20484
|
}));
|
|
19490
20485
|
}
|
|
19491
20486
|
|
|
19492
|
-
var withUsage$
|
|
20487
|
+
var withUsage$F = createDocumentationMessageGenerator({
|
|
19493
20488
|
name: 'hits-per-page'
|
|
19494
20489
|
});
|
|
19495
20490
|
var suit$b = component('HitsPerPage');
|
|
@@ -19525,7 +20520,7 @@
|
|
|
19525
20520
|
userCssClasses = _ref5$cssClasses === void 0 ? {} : _ref5$cssClasses,
|
|
19526
20521
|
transformItems = _ref5.transformItems;
|
|
19527
20522
|
if (!container) {
|
|
19528
|
-
throw new Error(withUsage$
|
|
20523
|
+
throw new Error(withUsage$F('The `container` option is required.'));
|
|
19529
20524
|
}
|
|
19530
20525
|
var containerNode = getContainerNode(container);
|
|
19531
20526
|
var cssClasses = {
|
|
@@ -19642,7 +20637,7 @@
|
|
|
19642
20637
|
}
|
|
19643
20638
|
};
|
|
19644
20639
|
|
|
19645
|
-
var withUsage$
|
|
20640
|
+
var withUsage$G = createDocumentationMessageGenerator({
|
|
19646
20641
|
name: 'infinite-hits'
|
|
19647
20642
|
});
|
|
19648
20643
|
var suit$c = component('InfiniteHits');
|
|
@@ -19699,7 +20694,7 @@
|
|
|
19699
20694
|
showPrevious = _ref3.showPrevious,
|
|
19700
20695
|
cache = _ref3.cache;
|
|
19701
20696
|
if (!container) {
|
|
19702
|
-
throw new Error(withUsage$
|
|
20697
|
+
throw new Error(withUsage$G('The `container` option is required.'));
|
|
19703
20698
|
}
|
|
19704
20699
|
var containerNode = getContainerNode(container);
|
|
19705
20700
|
var cssClasses = {
|
|
@@ -19769,7 +20764,7 @@
|
|
|
19769
20764
|
}
|
|
19770
20765
|
};
|
|
19771
20766
|
|
|
19772
|
-
var withUsage$
|
|
20767
|
+
var withUsage$H = createDocumentationMessageGenerator({
|
|
19773
20768
|
name: 'menu'
|
|
19774
20769
|
});
|
|
19775
20770
|
var suit$d = component('Menu');
|
|
@@ -19827,7 +20822,7 @@
|
|
|
19827
20822
|
templates = _ref3$templates === void 0 ? {} : _ref3$templates,
|
|
19828
20823
|
transformItems = _ref3.transformItems;
|
|
19829
20824
|
if (!container) {
|
|
19830
|
-
throw new Error(withUsage$
|
|
20825
|
+
throw new Error(withUsage$H('The `container` option is required.'));
|
|
19831
20826
|
}
|
|
19832
20827
|
var containerNode = getContainerNode(container);
|
|
19833
20828
|
var cssClasses = {
|
|
@@ -19935,7 +20930,7 @@
|
|
|
19935
20930
|
}
|
|
19936
20931
|
};
|
|
19937
20932
|
|
|
19938
|
-
var withUsage$
|
|
20933
|
+
var withUsage$I = createDocumentationMessageGenerator({
|
|
19939
20934
|
name: 'menu-select'
|
|
19940
20935
|
});
|
|
19941
20936
|
var suit$e = component('MenuSelect');
|
|
@@ -19978,7 +20973,7 @@
|
|
|
19978
20973
|
templates = _ref3$templates === void 0 ? {} : _ref3$templates,
|
|
19979
20974
|
transformItems = _ref3.transformItems;
|
|
19980
20975
|
if (!container) {
|
|
19981
|
-
throw new Error(withUsage$
|
|
20976
|
+
throw new Error(withUsage$I('The `container` option is required.'));
|
|
19982
20977
|
}
|
|
19983
20978
|
var containerNode = getContainerNode(container);
|
|
19984
20979
|
var cssClasses = {
|
|
@@ -20031,7 +21026,7 @@
|
|
|
20031
21026
|
}
|
|
20032
21027
|
};
|
|
20033
21028
|
|
|
20034
|
-
var withUsage$
|
|
21029
|
+
var withUsage$J = createDocumentationMessageGenerator({
|
|
20035
21030
|
name: 'numeric-menu'
|
|
20036
21031
|
});
|
|
20037
21032
|
var suit$f = component('NumericMenu');
|
|
@@ -20075,7 +21070,7 @@
|
|
|
20075
21070
|
templates = _ref3$templates === void 0 ? {} : _ref3$templates,
|
|
20076
21071
|
transformItems = _ref3.transformItems;
|
|
20077
21072
|
if (!container) {
|
|
20078
|
-
throw new Error(withUsage$
|
|
21073
|
+
throw new Error(withUsage$J('The `container` option is required.'));
|
|
20079
21074
|
}
|
|
20080
21075
|
var containerNode = getContainerNode(container);
|
|
20081
21076
|
var cssClasses = {
|
|
@@ -20236,7 +21231,7 @@
|
|
|
20236
21231
|
}
|
|
20237
21232
|
|
|
20238
21233
|
var suit$g = component('Pagination');
|
|
20239
|
-
var withUsage$
|
|
21234
|
+
var withUsage$K = createDocumentationMessageGenerator({
|
|
20240
21235
|
name: 'pagination'
|
|
20241
21236
|
});
|
|
20242
21237
|
var defaultTemplates$a = {
|
|
@@ -20318,7 +21313,7 @@
|
|
|
20318
21313
|
_ref4$scrollTo = _ref4.scrollTo,
|
|
20319
21314
|
userScrollTo = _ref4$scrollTo === void 0 ? 'body' : _ref4$scrollTo;
|
|
20320
21315
|
if (!container) {
|
|
20321
|
-
throw new Error(withUsage$
|
|
21316
|
+
throw new Error(withUsage$K('The `container` option is required.'));
|
|
20322
21317
|
}
|
|
20323
21318
|
var containerNode = getContainerNode(container);
|
|
20324
21319
|
var scrollTo = userScrollTo === true ? 'body' : userScrollTo;
|
|
@@ -20453,7 +21448,7 @@
|
|
|
20453
21448
|
}));
|
|
20454
21449
|
}
|
|
20455
21450
|
|
|
20456
|
-
var withUsage$
|
|
21451
|
+
var withUsage$L = createDocumentationMessageGenerator({
|
|
20457
21452
|
name: 'panel'
|
|
20458
21453
|
});
|
|
20459
21454
|
var suit$h = component('Panel');
|
|
@@ -20530,7 +21525,7 @@
|
|
|
20530
21525
|
return function (widgetFactory) {
|
|
20531
21526
|
return function (widgetParams) {
|
|
20532
21527
|
if (!(widgetParams && widgetParams.container)) {
|
|
20533
|
-
throw new Error(withUsage$
|
|
21528
|
+
throw new Error(withUsage$L("The `container` option is required in the widget within the panel."));
|
|
20534
21529
|
}
|
|
20535
21530
|
var containerNode = getContainerNode(widgetParams.container);
|
|
20536
21531
|
var defaultTemplates = {
|
|
@@ -20604,7 +21599,7 @@
|
|
|
20604
21599
|
};
|
|
20605
21600
|
};
|
|
20606
21601
|
|
|
20607
|
-
var _excluded$
|
|
21602
|
+
var _excluded$r = ["placesReference", "defaultPosition"],
|
|
20608
21603
|
_excluded2$6 = ["places"];
|
|
20609
21604
|
|
|
20610
21605
|
/* Places.js is an optional dependency, no error should be reported if the package is missing */
|
|
@@ -20620,7 +21615,7 @@
|
|
|
20620
21615
|
placesReference = _ref.placesReference,
|
|
20621
21616
|
_ref$defaultPosition = _ref.defaultPosition,
|
|
20622
21617
|
defaultPosition = _ref$defaultPosition === void 0 ? [] : _ref$defaultPosition,
|
|
20623
|
-
placesOptions = _objectWithoutProperties(_ref, _excluded$
|
|
21618
|
+
placesOptions = _objectWithoutProperties(_ref, _excluded$r);
|
|
20624
21619
|
if (typeof placesReference !== 'function') {
|
|
20625
21620
|
throw new Error('The `placesReference` option requires a valid Places.js reference.');
|
|
20626
21621
|
}
|
|
@@ -20733,7 +21728,7 @@
|
|
|
20733
21728
|
};
|
|
20734
21729
|
|
|
20735
21730
|
var suit$i = component('PoweredBy');
|
|
20736
|
-
var withUsage$
|
|
21731
|
+
var withUsage$M = createDocumentationMessageGenerator({
|
|
20737
21732
|
name: 'powered-by'
|
|
20738
21733
|
});
|
|
20739
21734
|
var renderer$e = function renderer(_ref) {
|
|
@@ -20762,7 +21757,7 @@
|
|
|
20762
21757
|
_ref3$theme = _ref3.theme,
|
|
20763
21758
|
theme = _ref3$theme === void 0 ? 'light' : _ref3$theme;
|
|
20764
21759
|
if (!container) {
|
|
20765
|
-
throw new Error(withUsage$
|
|
21760
|
+
throw new Error(withUsage$M('The `container` option is required.'));
|
|
20766
21761
|
}
|
|
20767
21762
|
var containerNode = getContainerNode(container);
|
|
20768
21763
|
var cssClasses = {
|
|
@@ -20790,13 +21785,13 @@
|
|
|
20790
21785
|
});
|
|
20791
21786
|
};
|
|
20792
21787
|
|
|
20793
|
-
var withUsage$
|
|
21788
|
+
var withUsage$N = createDocumentationMessageGenerator({
|
|
20794
21789
|
name: 'query-rule-context'
|
|
20795
21790
|
});
|
|
20796
21791
|
var queryRuleContext = function queryRuleContext() {
|
|
20797
21792
|
var widgetParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20798
21793
|
if (!widgetParams.trackedFilters) {
|
|
20799
|
-
throw new Error(withUsage$
|
|
21794
|
+
throw new Error(withUsage$N('The `trackedFilters` option is required.'));
|
|
20800
21795
|
}
|
|
20801
21796
|
return _objectSpread2(_objectSpread2({}, connectQueryRules(noop)(widgetParams)), {}, {
|
|
20802
21797
|
$$widgetType: 'ais.queryRuleContext'
|
|
@@ -20825,7 +21820,7 @@
|
|
|
20825
21820
|
return JSON.stringify(items, null, 2);
|
|
20826
21821
|
}
|
|
20827
21822
|
};
|
|
20828
|
-
var withUsage$
|
|
21823
|
+
var withUsage$O = createDocumentationMessageGenerator({
|
|
20829
21824
|
name: 'query-rule-custom-data'
|
|
20830
21825
|
});
|
|
20831
21826
|
var suit$j = component('QueryRuleCustomData');
|
|
@@ -20854,7 +21849,7 @@
|
|
|
20854
21849
|
return items;
|
|
20855
21850
|
} : _ref4$transformItems;
|
|
20856
21851
|
if (!container) {
|
|
20857
|
-
throw new Error(withUsage$
|
|
21852
|
+
throw new Error(withUsage$O('The `container` option is required.'));
|
|
20858
21853
|
}
|
|
20859
21854
|
var cssClasses = {
|
|
20860
21855
|
root: cx(suit$j(), userCssClasses.root)
|
|
@@ -20877,6 +21872,107 @@
|
|
|
20877
21872
|
});
|
|
20878
21873
|
};
|
|
20879
21874
|
|
|
21875
|
+
var withUsage$P = createDocumentationMessageGenerator({
|
|
21876
|
+
name: 'related-products'
|
|
21877
|
+
});
|
|
21878
|
+
var RelatedProducts = createRelatedProductsComponent({
|
|
21879
|
+
createElement: h,
|
|
21880
|
+
Fragment: p
|
|
21881
|
+
});
|
|
21882
|
+
function createRenderer(_ref) {
|
|
21883
|
+
var renderState = _ref.renderState,
|
|
21884
|
+
cssClasses = _ref.cssClasses,
|
|
21885
|
+
containerNode = _ref.containerNode,
|
|
21886
|
+
templates = _ref.templates;
|
|
21887
|
+
return function renderer(_ref2, isFirstRendering) {
|
|
21888
|
+
var items = _ref2.items,
|
|
21889
|
+
results = _ref2.results,
|
|
21890
|
+
instantSearchInstance = _ref2.instantSearchInstance;
|
|
21891
|
+
if (isFirstRendering) {
|
|
21892
|
+
renderState.templateProps = prepareTemplateProps({
|
|
21893
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
21894
|
+
defaultTemplates: {},
|
|
21895
|
+
templatesConfig: instantSearchInstance.templatesConfig,
|
|
21896
|
+
templates: templates
|
|
21897
|
+
});
|
|
21898
|
+
return;
|
|
21899
|
+
}
|
|
21900
|
+
var headerComponent = templates.header ? function (data) {
|
|
21901
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
21902
|
+
templateKey: "header",
|
|
21903
|
+
rootTagName: "fragment",
|
|
21904
|
+
data: {
|
|
21905
|
+
cssClasses: data.classNames,
|
|
21906
|
+
items: data.items
|
|
21907
|
+
}
|
|
21908
|
+
}));
|
|
21909
|
+
} : undefined;
|
|
21910
|
+
var itemComponent = templates.item ? function (_ref3) {
|
|
21911
|
+
var item = _ref3.item;
|
|
21912
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
21913
|
+
templateKey: "item",
|
|
21914
|
+
rootTagName: "fragment",
|
|
21915
|
+
data: item
|
|
21916
|
+
}));
|
|
21917
|
+
} : undefined;
|
|
21918
|
+
var emptyComponent = templates.empty ? function () {
|
|
21919
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
21920
|
+
templateKey: "empty",
|
|
21921
|
+
rootTagName: "fragment",
|
|
21922
|
+
data: results
|
|
21923
|
+
}));
|
|
21924
|
+
} : undefined;
|
|
21925
|
+
P(h(RelatedProducts, {
|
|
21926
|
+
items: items,
|
|
21927
|
+
sendEvent: function sendEvent() {},
|
|
21928
|
+
classNames: cssClasses,
|
|
21929
|
+
headerComponent: headerComponent,
|
|
21930
|
+
itemComponent: itemComponent,
|
|
21931
|
+
emptyComponent: emptyComponent,
|
|
21932
|
+
status: instantSearchInstance.status
|
|
21933
|
+
}), containerNode);
|
|
21934
|
+
};
|
|
21935
|
+
}
|
|
21936
|
+
var relatedProducts = function relatedProducts(widgetParams) {
|
|
21937
|
+
var _ref4 = widgetParams || {},
|
|
21938
|
+
container = _ref4.container,
|
|
21939
|
+
objectIDs = _ref4.objectIDs,
|
|
21940
|
+
limit = _ref4.limit,
|
|
21941
|
+
queryParameters = _ref4.queryParameters,
|
|
21942
|
+
fallbackParameters = _ref4.fallbackParameters,
|
|
21943
|
+
threshold = _ref4.threshold,
|
|
21944
|
+
escapeHTML = _ref4.escapeHTML,
|
|
21945
|
+
transformItems = _ref4.transformItems,
|
|
21946
|
+
_ref4$templates = _ref4.templates,
|
|
21947
|
+
templates = _ref4$templates === void 0 ? {} : _ref4$templates,
|
|
21948
|
+
_ref4$cssClasses = _ref4.cssClasses,
|
|
21949
|
+
cssClasses = _ref4$cssClasses === void 0 ? {} : _ref4$cssClasses;
|
|
21950
|
+
if (!container) {
|
|
21951
|
+
throw new Error(withUsage$P('The `container` option is required.'));
|
|
21952
|
+
}
|
|
21953
|
+
var containerNode = getContainerNode(container);
|
|
21954
|
+
var specializedRenderer = createRenderer({
|
|
21955
|
+
containerNode: containerNode,
|
|
21956
|
+
cssClasses: cssClasses,
|
|
21957
|
+
renderState: {},
|
|
21958
|
+
templates: templates
|
|
21959
|
+
});
|
|
21960
|
+
var makeWidget = connectRelatedProducts(specializedRenderer, function () {
|
|
21961
|
+
return P(null, containerNode);
|
|
21962
|
+
});
|
|
21963
|
+
return _objectSpread2(_objectSpread2({}, makeWidget({
|
|
21964
|
+
objectIDs: objectIDs,
|
|
21965
|
+
limit: limit,
|
|
21966
|
+
queryParameters: queryParameters,
|
|
21967
|
+
fallbackParameters: fallbackParameters,
|
|
21968
|
+
threshold: threshold,
|
|
21969
|
+
escapeHTML: escapeHTML,
|
|
21970
|
+
transformItems: transformItems
|
|
21971
|
+
})), {}, {
|
|
21972
|
+
$$widgetType: 'ais.relatedProducts'
|
|
21973
|
+
});
|
|
21974
|
+
};
|
|
21975
|
+
|
|
20880
21976
|
// Strips leading `0` from a positive number value
|
|
20881
21977
|
function stripLeadingZeroFromInput(value) {
|
|
20882
21978
|
return value.replace(/^(0+)\d/, function (part) {
|
|
@@ -20987,7 +22083,7 @@
|
|
|
20987
22083
|
return RangeInput;
|
|
20988
22084
|
}(d);
|
|
20989
22085
|
|
|
20990
|
-
var withUsage$
|
|
22086
|
+
var withUsage$Q = createDocumentationMessageGenerator({
|
|
20991
22087
|
name: 'range-input'
|
|
20992
22088
|
});
|
|
20993
22089
|
var suit$k = component('RangeInput');
|
|
@@ -21052,7 +22148,7 @@
|
|
|
21052
22148
|
_ref3$templates = _ref3.templates,
|
|
21053
22149
|
templates = _ref3$templates === void 0 ? {} : _ref3$templates;
|
|
21054
22150
|
if (!container) {
|
|
21055
|
-
throw new Error(withUsage$
|
|
22151
|
+
throw new Error(withUsage$Q('The `container` option is required.'));
|
|
21056
22152
|
}
|
|
21057
22153
|
var containerNode = getContainerNode(container);
|
|
21058
22154
|
var cssClasses = {
|
|
@@ -21775,7 +22871,7 @@
|
|
|
21775
22871
|
return Slider;
|
|
21776
22872
|
}(d);
|
|
21777
22873
|
|
|
21778
|
-
var withUsage$
|
|
22874
|
+
var withUsage$R = createDocumentationMessageGenerator({
|
|
21779
22875
|
name: 'range-slider'
|
|
21780
22876
|
});
|
|
21781
22877
|
var suit$l = component('RangeSlider');
|
|
@@ -21844,7 +22940,7 @@
|
|
|
21844
22940
|
_ref3$tooltips = _ref3.tooltips,
|
|
21845
22941
|
tooltips = _ref3$tooltips === void 0 ? true : _ref3$tooltips;
|
|
21846
22942
|
if (!container) {
|
|
21847
|
-
throw new Error(withUsage$
|
|
22943
|
+
throw new Error(withUsage$R('The `container` option is required.'));
|
|
21848
22944
|
}
|
|
21849
22945
|
var containerNode = getContainerNode(container);
|
|
21850
22946
|
var cssClasses = {
|
|
@@ -21923,7 +23019,7 @@
|
|
|
21923
23019
|
}
|
|
21924
23020
|
};
|
|
21925
23021
|
|
|
21926
|
-
var withUsage$
|
|
23022
|
+
var withUsage$S = createDocumentationMessageGenerator({
|
|
21927
23023
|
name: 'rating-menu'
|
|
21928
23024
|
});
|
|
21929
23025
|
var suit$m = component('RatingMenu');
|
|
@@ -22011,7 +23107,7 @@
|
|
|
22011
23107
|
_ref5$templates = _ref5.templates,
|
|
22012
23108
|
templates = _ref5$templates === void 0 ? {} : _ref5$templates;
|
|
22013
23109
|
if (!container) {
|
|
22014
|
-
throw new Error(withUsage$
|
|
23110
|
+
throw new Error(withUsage$S('The `container` option is required.'));
|
|
22015
23111
|
}
|
|
22016
23112
|
var containerNode = getContainerNode(container);
|
|
22017
23113
|
var cssClasses = {
|
|
@@ -22171,7 +23267,7 @@
|
|
|
22171
23267
|
}
|
|
22172
23268
|
};
|
|
22173
23269
|
|
|
22174
|
-
var withUsage$
|
|
23270
|
+
var withUsage$T = createDocumentationMessageGenerator({
|
|
22175
23271
|
name: 'refinement-list'
|
|
22176
23272
|
});
|
|
22177
23273
|
var suit$n = component('RefinementList');
|
|
@@ -22271,7 +23367,7 @@
|
|
|
22271
23367
|
templates = _ref3$templates === void 0 ? {} : _ref3$templates,
|
|
22272
23368
|
transformItems = _ref3.transformItems;
|
|
22273
23369
|
if (!container) {
|
|
22274
|
-
throw new Error(withUsage$
|
|
23370
|
+
throw new Error(withUsage$T('The `container` option is required.'));
|
|
22275
23371
|
}
|
|
22276
23372
|
var escapeFacetValues = searchable ? Boolean(searchableEscapeFacetValues) : false;
|
|
22277
23373
|
var containerNode = getContainerNode(container);
|
|
@@ -22422,7 +23518,7 @@
|
|
|
22422
23518
|
}
|
|
22423
23519
|
};
|
|
22424
23520
|
|
|
22425
|
-
var withUsage$
|
|
23521
|
+
var withUsage$U = createDocumentationMessageGenerator({
|
|
22426
23522
|
name: 'relevant-sort'
|
|
22427
23523
|
});
|
|
22428
23524
|
var suit$o = component('RelevantSort');
|
|
@@ -22450,7 +23546,7 @@
|
|
|
22450
23546
|
_widgetParams$cssClas = widgetParams.cssClasses,
|
|
22451
23547
|
userCssClasses = _widgetParams$cssClas === void 0 ? {} : _widgetParams$cssClas;
|
|
22452
23548
|
if (!container) {
|
|
22453
|
-
throw new Error(withUsage$
|
|
23549
|
+
throw new Error(withUsage$U('The `container` option is required.'));
|
|
22454
23550
|
}
|
|
22455
23551
|
var containerNode = getContainerNode(container);
|
|
22456
23552
|
var cssClasses = {
|
|
@@ -22477,7 +23573,7 @@
|
|
|
22477
23573
|
});
|
|
22478
23574
|
};
|
|
22479
23575
|
|
|
22480
|
-
var withUsage$
|
|
23576
|
+
var withUsage$V = createDocumentationMessageGenerator({
|
|
22481
23577
|
name: 'search-box'
|
|
22482
23578
|
});
|
|
22483
23579
|
var suit$p = component('SearchBox');
|
|
@@ -22545,7 +23641,7 @@
|
|
|
22545
23641
|
_ref3$templates = _ref3.templates,
|
|
22546
23642
|
userTemplates = _ref3$templates === void 0 ? {} : _ref3$templates;
|
|
22547
23643
|
if (!container) {
|
|
22548
|
-
throw new Error(withUsage$
|
|
23644
|
+
throw new Error(withUsage$V('The `container` option is required.'));
|
|
22549
23645
|
}
|
|
22550
23646
|
var containerNode = getContainerNode(container);
|
|
22551
23647
|
var cssClasses = {
|
|
@@ -22598,7 +23694,7 @@
|
|
|
22598
23694
|
});
|
|
22599
23695
|
};
|
|
22600
23696
|
|
|
22601
|
-
var withUsage$
|
|
23697
|
+
var withUsage$W = createDocumentationMessageGenerator({
|
|
22602
23698
|
name: 'sort-by'
|
|
22603
23699
|
});
|
|
22604
23700
|
var suit$q = component('SortBy');
|
|
@@ -22636,7 +23732,7 @@
|
|
|
22636
23732
|
userCssClasses = _ref3$cssClasses === void 0 ? {} : _ref3$cssClasses,
|
|
22637
23733
|
transformItems = _ref3.transformItems;
|
|
22638
23734
|
if (!container) {
|
|
22639
|
-
throw new Error(withUsage$
|
|
23735
|
+
throw new Error(withUsage$W('The `container` option is required.'));
|
|
22640
23736
|
}
|
|
22641
23737
|
var containerNode = getContainerNode(container);
|
|
22642
23738
|
var cssClasses = {
|
|
@@ -22664,13 +23760,13 @@
|
|
|
22664
23760
|
});
|
|
22665
23761
|
};
|
|
22666
23762
|
|
|
22667
|
-
var _excluded$
|
|
23763
|
+
var _excluded$s = ["nbHits", "nbSortedHits", "cssClasses", "templateProps"];
|
|
22668
23764
|
var Stats = function Stats(_ref) {
|
|
22669
23765
|
var nbHits = _ref.nbHits,
|
|
22670
23766
|
nbSortedHits = _ref.nbSortedHits,
|
|
22671
23767
|
cssClasses = _ref.cssClasses,
|
|
22672
23768
|
templateProps = _ref.templateProps,
|
|
22673
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
23769
|
+
rest = _objectWithoutProperties(_ref, _excluded$s);
|
|
22674
23770
|
return h("div", {
|
|
22675
23771
|
className: cx(cssClasses.root)
|
|
22676
23772
|
}, h(Template, _extends({}, templateProps, {
|
|
@@ -22693,7 +23789,7 @@
|
|
|
22693
23789
|
})));
|
|
22694
23790
|
};
|
|
22695
23791
|
|
|
22696
|
-
var withUsage$
|
|
23792
|
+
var withUsage$X = createDocumentationMessageGenerator({
|
|
22697
23793
|
name: 'stats'
|
|
22698
23794
|
});
|
|
22699
23795
|
var suit$r = component('Stats');
|
|
@@ -22788,7 +23884,7 @@
|
|
|
22788
23884
|
_ref5$templates = _ref5.templates,
|
|
22789
23885
|
templates = _ref5$templates === void 0 ? {} : _ref5$templates;
|
|
22790
23886
|
if (!container) {
|
|
22791
|
-
throw new Error(withUsage$
|
|
23887
|
+
throw new Error(withUsage$X('The `container` option is required.'));
|
|
22792
23888
|
}
|
|
22793
23889
|
var containerNode = getContainerNode(container);
|
|
22794
23890
|
var cssClasses = {
|
|
@@ -22846,7 +23942,7 @@
|
|
|
22846
23942
|
}
|
|
22847
23943
|
};
|
|
22848
23944
|
|
|
22849
|
-
var withUsage$
|
|
23945
|
+
var withUsage$Y = createDocumentationMessageGenerator({
|
|
22850
23946
|
name: 'toggle-refinement'
|
|
22851
23947
|
});
|
|
22852
23948
|
var suit$s = component('ToggleRefinement');
|
|
@@ -22899,7 +23995,7 @@
|
|
|
22899
23995
|
on = _ref3$on === void 0 ? true : _ref3$on,
|
|
22900
23996
|
off = _ref3.off;
|
|
22901
23997
|
if (!container) {
|
|
22902
|
-
throw new Error(withUsage$
|
|
23998
|
+
throw new Error(withUsage$Y('The `container` option is required.'));
|
|
22903
23999
|
}
|
|
22904
24000
|
var containerNode = getContainerNode(container);
|
|
22905
24001
|
var cssClasses = {
|
|
@@ -22932,6 +24028,111 @@
|
|
|
22932
24028
|
});
|
|
22933
24029
|
};
|
|
22934
24030
|
|
|
24031
|
+
var withUsage$Z = createDocumentationMessageGenerator({
|
|
24032
|
+
name: 'trending-items'
|
|
24033
|
+
});
|
|
24034
|
+
var TrendingItems = createTrendingItemsComponent({
|
|
24035
|
+
createElement: h,
|
|
24036
|
+
Fragment: p
|
|
24037
|
+
});
|
|
24038
|
+
function createRenderer$1(_ref) {
|
|
24039
|
+
var renderState = _ref.renderState,
|
|
24040
|
+
cssClasses = _ref.cssClasses,
|
|
24041
|
+
containerNode = _ref.containerNode,
|
|
24042
|
+
templates = _ref.templates;
|
|
24043
|
+
return function renderer(_ref2, isFirstRendering) {
|
|
24044
|
+
var items = _ref2.items,
|
|
24045
|
+
results = _ref2.results,
|
|
24046
|
+
instantSearchInstance = _ref2.instantSearchInstance;
|
|
24047
|
+
if (isFirstRendering) {
|
|
24048
|
+
renderState.templateProps = prepareTemplateProps({
|
|
24049
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
24050
|
+
defaultTemplates: {},
|
|
24051
|
+
templatesConfig: instantSearchInstance.templatesConfig,
|
|
24052
|
+
templates: templates
|
|
24053
|
+
});
|
|
24054
|
+
return;
|
|
24055
|
+
}
|
|
24056
|
+
var headerComponent = templates.header ? function (data) {
|
|
24057
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24058
|
+
templateKey: "header",
|
|
24059
|
+
rootTagName: "fragment",
|
|
24060
|
+
data: {
|
|
24061
|
+
cssClasses: data.classNames,
|
|
24062
|
+
items: data.items
|
|
24063
|
+
}
|
|
24064
|
+
}));
|
|
24065
|
+
} : undefined;
|
|
24066
|
+
var itemComponent = templates.item ? function (_ref3) {
|
|
24067
|
+
var item = _ref3.item;
|
|
24068
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24069
|
+
templateKey: "item",
|
|
24070
|
+
rootTagName: "fragment",
|
|
24071
|
+
data: item
|
|
24072
|
+
}));
|
|
24073
|
+
} : undefined;
|
|
24074
|
+
var emptyComponent = templates.empty ? function () {
|
|
24075
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24076
|
+
templateKey: "empty",
|
|
24077
|
+
rootTagName: "fragment",
|
|
24078
|
+
data: results
|
|
24079
|
+
}));
|
|
24080
|
+
} : undefined;
|
|
24081
|
+
P(h(TrendingItems, {
|
|
24082
|
+
items: items,
|
|
24083
|
+
sendEvent: function sendEvent() {},
|
|
24084
|
+
classNames: cssClasses,
|
|
24085
|
+
headerComponent: headerComponent,
|
|
24086
|
+
itemComponent: itemComponent,
|
|
24087
|
+
emptyComponent: emptyComponent,
|
|
24088
|
+
status: instantSearchInstance.status
|
|
24089
|
+
}), containerNode);
|
|
24090
|
+
};
|
|
24091
|
+
}
|
|
24092
|
+
var trendingItems = function trendingItems(widgetParams) {
|
|
24093
|
+
var _ref4 = widgetParams || {},
|
|
24094
|
+
container = _ref4.container,
|
|
24095
|
+
facetName = _ref4.facetName,
|
|
24096
|
+
facetValue = _ref4.facetValue,
|
|
24097
|
+
limit = _ref4.limit,
|
|
24098
|
+
queryParameters = _ref4.queryParameters,
|
|
24099
|
+
fallbackParameters = _ref4.fallbackParameters,
|
|
24100
|
+
threshold = _ref4.threshold,
|
|
24101
|
+
escapeHTML = _ref4.escapeHTML,
|
|
24102
|
+
transformItems = _ref4.transformItems,
|
|
24103
|
+
_ref4$templates = _ref4.templates,
|
|
24104
|
+
templates = _ref4$templates === void 0 ? {} : _ref4$templates,
|
|
24105
|
+
_ref4$cssClasses = _ref4.cssClasses,
|
|
24106
|
+
cssClasses = _ref4$cssClasses === void 0 ? {} : _ref4$cssClasses;
|
|
24107
|
+
if (!container) {
|
|
24108
|
+
throw new Error(withUsage$Z('The `container` option is required.'));
|
|
24109
|
+
}
|
|
24110
|
+
var containerNode = getContainerNode(container);
|
|
24111
|
+
var specializedRenderer = createRenderer$1({
|
|
24112
|
+
containerNode: containerNode,
|
|
24113
|
+
cssClasses: cssClasses,
|
|
24114
|
+
renderState: {},
|
|
24115
|
+
templates: templates
|
|
24116
|
+
});
|
|
24117
|
+
var makeWidget = connectTrendingItems(specializedRenderer, function () {
|
|
24118
|
+
return P(null, containerNode);
|
|
24119
|
+
});
|
|
24120
|
+
var facetParameters = facetName && facetValue ? {
|
|
24121
|
+
facetName: facetName,
|
|
24122
|
+
facetValue: facetValue
|
|
24123
|
+
} : {};
|
|
24124
|
+
return _objectSpread2(_objectSpread2({}, makeWidget(_objectSpread2(_objectSpread2({}, facetParameters), {}, {
|
|
24125
|
+
limit: limit,
|
|
24126
|
+
queryParameters: queryParameters,
|
|
24127
|
+
fallbackParameters: fallbackParameters,
|
|
24128
|
+
threshold: threshold,
|
|
24129
|
+
escapeHTML: escapeHTML,
|
|
24130
|
+
transformItems: transformItems
|
|
24131
|
+
}))), {}, {
|
|
24132
|
+
$$widgetType: 'ais.trendingItems'
|
|
24133
|
+
});
|
|
24134
|
+
};
|
|
24135
|
+
|
|
22935
24136
|
var VoiceSearch = function VoiceSearch(_ref) {
|
|
22936
24137
|
var cssClasses = _ref.cssClasses,
|
|
22937
24138
|
isBrowserSupported = _ref.isBrowserSupported,
|
|
@@ -23066,7 +24267,7 @@
|
|
|
23066
24267
|
}
|
|
23067
24268
|
};
|
|
23068
24269
|
|
|
23069
|
-
var withUsage$
|
|
24270
|
+
var withUsage$_ = createDocumentationMessageGenerator({
|
|
23070
24271
|
name: 'voice-search'
|
|
23071
24272
|
});
|
|
23072
24273
|
var suit$t = component('VoiceSearch');
|
|
@@ -23102,7 +24303,7 @@
|
|
|
23102
24303
|
additionalQueryParameters = _ref3.additionalQueryParameters,
|
|
23103
24304
|
createVoiceSearchHelper = _ref3.createVoiceSearchHelper;
|
|
23104
24305
|
if (!container) {
|
|
23105
|
-
throw new Error(withUsage$
|
|
24306
|
+
throw new Error(withUsage$_('The `container` option is required.'));
|
|
23106
24307
|
}
|
|
23107
24308
|
var containerNode = getContainerNode(container);
|
|
23108
24309
|
var cssClasses = {
|
|
@@ -23136,6 +24337,206 @@
|
|
|
23136
24337
|
});
|
|
23137
24338
|
};
|
|
23138
24339
|
|
|
24340
|
+
var withUsage$$ = createDocumentationMessageGenerator({
|
|
24341
|
+
name: 'frequently-bought-together'
|
|
24342
|
+
});
|
|
24343
|
+
var FrequentlyBoughtTogether = createFrequentlyBoughtTogetherComponent({
|
|
24344
|
+
createElement: h,
|
|
24345
|
+
Fragment: p
|
|
24346
|
+
});
|
|
24347
|
+
var renderer$q = function renderer(_ref) {
|
|
24348
|
+
var renderState = _ref.renderState,
|
|
24349
|
+
cssClasses = _ref.cssClasses,
|
|
24350
|
+
containerNode = _ref.containerNode,
|
|
24351
|
+
templates = _ref.templates;
|
|
24352
|
+
return function (_ref2, isFirstRendering) {
|
|
24353
|
+
var items = _ref2.items,
|
|
24354
|
+
results = _ref2.results,
|
|
24355
|
+
instantSearchInstance = _ref2.instantSearchInstance;
|
|
24356
|
+
if (isFirstRendering) {
|
|
24357
|
+
renderState.templateProps = prepareTemplateProps({
|
|
24358
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
24359
|
+
defaultTemplates: {},
|
|
24360
|
+
templatesConfig: instantSearchInstance.templatesConfig,
|
|
24361
|
+
templates: templates
|
|
24362
|
+
});
|
|
24363
|
+
return;
|
|
24364
|
+
}
|
|
24365
|
+
var headerComponent = templates.header ? function (data) {
|
|
24366
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24367
|
+
templateKey: "header",
|
|
24368
|
+
rootTagName: "fragment",
|
|
24369
|
+
data: {
|
|
24370
|
+
cssClasses: data.classNames,
|
|
24371
|
+
items: data.items
|
|
24372
|
+
}
|
|
24373
|
+
}));
|
|
24374
|
+
} : undefined;
|
|
24375
|
+
var itemComponent = templates.item ? function (_ref3) {
|
|
24376
|
+
var item = _ref3.item;
|
|
24377
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24378
|
+
templateKey: "item",
|
|
24379
|
+
rootTagName: "fragment",
|
|
24380
|
+
data: item
|
|
24381
|
+
}));
|
|
24382
|
+
} : undefined;
|
|
24383
|
+
var emptyComponent = templates.empty ? function () {
|
|
24384
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24385
|
+
templateKey: "empty",
|
|
24386
|
+
rootTagName: "fragment",
|
|
24387
|
+
data: results
|
|
24388
|
+
}));
|
|
24389
|
+
} : undefined;
|
|
24390
|
+
P(h(FrequentlyBoughtTogether, {
|
|
24391
|
+
items: items,
|
|
24392
|
+
headerComponent: headerComponent,
|
|
24393
|
+
itemComponent: itemComponent,
|
|
24394
|
+
sendEvent: function sendEvent() {},
|
|
24395
|
+
classNames: cssClasses,
|
|
24396
|
+
emptyComponent: emptyComponent,
|
|
24397
|
+
status: instantSearchInstance.status
|
|
24398
|
+
}), containerNode);
|
|
24399
|
+
};
|
|
24400
|
+
};
|
|
24401
|
+
var frequentlyBoughtTogether = function frequentlyBoughtTogether(widgetParams) {
|
|
24402
|
+
var _ref4 = widgetParams || {},
|
|
24403
|
+
container = _ref4.container,
|
|
24404
|
+
objectIDs = _ref4.objectIDs,
|
|
24405
|
+
limit = _ref4.limit,
|
|
24406
|
+
queryParameters = _ref4.queryParameters,
|
|
24407
|
+
threshold = _ref4.threshold,
|
|
24408
|
+
escapeHTML = _ref4.escapeHTML,
|
|
24409
|
+
transformItems = _ref4.transformItems,
|
|
24410
|
+
_ref4$templates = _ref4.templates,
|
|
24411
|
+
templates = _ref4$templates === void 0 ? {} : _ref4$templates,
|
|
24412
|
+
_ref4$cssClasses = _ref4.cssClasses,
|
|
24413
|
+
cssClasses = _ref4$cssClasses === void 0 ? {} : _ref4$cssClasses;
|
|
24414
|
+
if (!container) {
|
|
24415
|
+
throw new Error(withUsage$$('The `container` option is required.'));
|
|
24416
|
+
}
|
|
24417
|
+
var containerNode = getContainerNode(container);
|
|
24418
|
+
var specializedRenderer = renderer$q({
|
|
24419
|
+
containerNode: containerNode,
|
|
24420
|
+
cssClasses: cssClasses,
|
|
24421
|
+
renderState: {},
|
|
24422
|
+
templates: templates
|
|
24423
|
+
});
|
|
24424
|
+
var makeWidget = connectFrequentlyBoughtTogether(specializedRenderer, function () {
|
|
24425
|
+
return P(null, containerNode);
|
|
24426
|
+
});
|
|
24427
|
+
return _objectSpread2(_objectSpread2({}, makeWidget({
|
|
24428
|
+
objectIDs: objectIDs,
|
|
24429
|
+
limit: limit,
|
|
24430
|
+
queryParameters: queryParameters,
|
|
24431
|
+
threshold: threshold,
|
|
24432
|
+
escapeHTML: escapeHTML,
|
|
24433
|
+
transformItems: transformItems
|
|
24434
|
+
})), {}, {
|
|
24435
|
+
$$widgetType: 'ais.frequentlyBoughtTogether'
|
|
24436
|
+
});
|
|
24437
|
+
};
|
|
24438
|
+
|
|
24439
|
+
var withUsage$10 = createDocumentationMessageGenerator({
|
|
24440
|
+
name: 'looking-similar'
|
|
24441
|
+
});
|
|
24442
|
+
var LookingSimilar = createLookingSimilarComponent({
|
|
24443
|
+
createElement: h,
|
|
24444
|
+
Fragment: p
|
|
24445
|
+
});
|
|
24446
|
+
var renderer$r = function renderer(_ref) {
|
|
24447
|
+
var renderState = _ref.renderState,
|
|
24448
|
+
cssClasses = _ref.cssClasses,
|
|
24449
|
+
containerNode = _ref.containerNode,
|
|
24450
|
+
templates = _ref.templates;
|
|
24451
|
+
return function (_ref2, isFirstRendering) {
|
|
24452
|
+
var items = _ref2.items,
|
|
24453
|
+
results = _ref2.results,
|
|
24454
|
+
instantSearchInstance = _ref2.instantSearchInstance;
|
|
24455
|
+
if (isFirstRendering) {
|
|
24456
|
+
renderState.templateProps = prepareTemplateProps({
|
|
24457
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
24458
|
+
defaultTemplates: {},
|
|
24459
|
+
templatesConfig: instantSearchInstance.templatesConfig,
|
|
24460
|
+
templates: templates
|
|
24461
|
+
});
|
|
24462
|
+
return;
|
|
24463
|
+
}
|
|
24464
|
+
var headerComponent = templates.header ? function (data) {
|
|
24465
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24466
|
+
templateKey: "header",
|
|
24467
|
+
rootTagName: "fragment",
|
|
24468
|
+
data: {
|
|
24469
|
+
cssClasses: data.classNames,
|
|
24470
|
+
items: data.items
|
|
24471
|
+
}
|
|
24472
|
+
}));
|
|
24473
|
+
} : undefined;
|
|
24474
|
+
var itemComponent = templates.item ? function (_ref3) {
|
|
24475
|
+
var item = _ref3.item;
|
|
24476
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24477
|
+
templateKey: "item",
|
|
24478
|
+
rootTagName: "fragment",
|
|
24479
|
+
data: item
|
|
24480
|
+
}));
|
|
24481
|
+
} : undefined;
|
|
24482
|
+
var emptyComponent = templates.empty ? function () {
|
|
24483
|
+
return h(Template, _extends({}, renderState.templateProps, {
|
|
24484
|
+
templateKey: "empty",
|
|
24485
|
+
rootTagName: "fragment",
|
|
24486
|
+
data: results
|
|
24487
|
+
}));
|
|
24488
|
+
} : undefined;
|
|
24489
|
+
P(h(LookingSimilar, {
|
|
24490
|
+
items: items,
|
|
24491
|
+
headerComponent: headerComponent,
|
|
24492
|
+
itemComponent: itemComponent,
|
|
24493
|
+
sendEvent: function sendEvent() {},
|
|
24494
|
+
classNames: cssClasses,
|
|
24495
|
+
emptyComponent: emptyComponent,
|
|
24496
|
+
status: instantSearchInstance.status
|
|
24497
|
+
}), containerNode);
|
|
24498
|
+
};
|
|
24499
|
+
};
|
|
24500
|
+
var lookingSimilar = function lookingSimilar(widgetParams) {
|
|
24501
|
+
var _ref4 = widgetParams || {},
|
|
24502
|
+
container = _ref4.container,
|
|
24503
|
+
objectIDs = _ref4.objectIDs,
|
|
24504
|
+
limit = _ref4.limit,
|
|
24505
|
+
queryParameters = _ref4.queryParameters,
|
|
24506
|
+
fallbackParameters = _ref4.fallbackParameters,
|
|
24507
|
+
threshold = _ref4.threshold,
|
|
24508
|
+
escapeHTML = _ref4.escapeHTML,
|
|
24509
|
+
transformItems = _ref4.transformItems,
|
|
24510
|
+
_ref4$templates = _ref4.templates,
|
|
24511
|
+
templates = _ref4$templates === void 0 ? {} : _ref4$templates,
|
|
24512
|
+
_ref4$cssClasses = _ref4.cssClasses,
|
|
24513
|
+
cssClasses = _ref4$cssClasses === void 0 ? {} : _ref4$cssClasses;
|
|
24514
|
+
if (!container) {
|
|
24515
|
+
throw new Error(withUsage$10('The `container` option is required.'));
|
|
24516
|
+
}
|
|
24517
|
+
var containerNode = getContainerNode(container);
|
|
24518
|
+
var specializedRenderer = renderer$r({
|
|
24519
|
+
containerNode: containerNode,
|
|
24520
|
+
cssClasses: cssClasses,
|
|
24521
|
+
renderState: {},
|
|
24522
|
+
templates: templates
|
|
24523
|
+
});
|
|
24524
|
+
var makeWidget = connectLookingSimilar(specializedRenderer, function () {
|
|
24525
|
+
return P(null, containerNode);
|
|
24526
|
+
});
|
|
24527
|
+
return _objectSpread2(_objectSpread2({}, makeWidget({
|
|
24528
|
+
objectIDs: objectIDs,
|
|
24529
|
+
limit: limit,
|
|
24530
|
+
queryParameters: queryParameters,
|
|
24531
|
+
fallbackParameters: fallbackParameters,
|
|
24532
|
+
threshold: threshold,
|
|
24533
|
+
escapeHTML: escapeHTML,
|
|
24534
|
+
transformItems: transformItems
|
|
24535
|
+
})), {}, {
|
|
24536
|
+
$$widgetType: 'ais.lookingSimilar'
|
|
24537
|
+
});
|
|
24538
|
+
};
|
|
24539
|
+
|
|
23139
24540
|
/** @deprecated answers is no longer supported */
|
|
23140
24541
|
var EXPERIMENTAL_answers = deprecate(answers, 'answers is no longer supported');
|
|
23141
24542
|
|
|
@@ -23168,6 +24569,7 @@
|
|
|
23168
24569
|
poweredBy: poweredBy,
|
|
23169
24570
|
queryRuleContext: queryRuleContext,
|
|
23170
24571
|
queryRuleCustomData: queryRuleCustomData,
|
|
24572
|
+
relatedProducts: relatedProducts,
|
|
23171
24573
|
rangeInput: rangeInput,
|
|
23172
24574
|
rangeSlider: rangeSlider,
|
|
23173
24575
|
ratingMenu: ratingMenu,
|
|
@@ -23177,7 +24579,10 @@
|
|
|
23177
24579
|
sortBy: sortBy,
|
|
23178
24580
|
stats: stats,
|
|
23179
24581
|
toggleRefinement: toggleRefinement,
|
|
23180
|
-
|
|
24582
|
+
trendingItems: trendingItems,
|
|
24583
|
+
voiceSearch: voiceSearch,
|
|
24584
|
+
frequentlyBoughtTogether: frequentlyBoughtTogether,
|
|
24585
|
+
lookingSimilar: lookingSimilar
|
|
23181
24586
|
});
|
|
23182
24587
|
|
|
23183
24588
|
/**
|