instantsearch.js 4.53.0 → 4.54.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.
@@ -209,6 +209,10 @@ var connectHierarchicalMenu = function connectHierarchicalMenu(renderFn) {
209
209
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
210
210
  var uiState = _ref6.uiState;
211
211
  var values = uiState.hierarchicalMenu && uiState.hierarchicalMenu[hierarchicalFacetName];
212
+ if (searchParameters.isConjunctiveFacet(hierarchicalFacetName) || searchParameters.isDisjunctiveFacet(hierarchicalFacetName)) {
213
+ process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "HierarchicalMenu: Attribute \"".concat(hierarchicalFacetName, "\" is already used by another widget applying conjunctive or disjunctive faceting.\nAs this is not supported, please make sure to remove this other widget or this HierarchicalMenu widget will not work at all.")) : void 0;
214
+ return searchParameters;
215
+ }
212
216
  if (searchParameters.isHierarchicalFacet(hierarchicalFacetName)) {
213
217
  var facet = searchParameters.getHierarchicalFacetByName(hierarchicalFacetName);
214
218
  process.env.NODE_ENV === 'development' ? (0, _utils.warning)((0, _utils.isEqual)(facet.attributes, attributes) && facet.separator === separator && facet.rootPath === rootPath, 'Using Breadcrumb and HierarchicalMenu on the same facet with different options overrides the configuration of the HierarchicalMenu.') : void 0;
@@ -181,6 +181,10 @@ var connectMenu = function connectMenu(renderFn) {
181
181
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
182
182
  var uiState = _ref5.uiState;
183
183
  var value = uiState.menu && uiState.menu[attribute];
184
+ if (searchParameters.isConjunctiveFacet(attribute) || searchParameters.isDisjunctiveFacet(attribute)) {
185
+ process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "Menu: Attribute \"".concat(attribute, "\" is already used by another widget applying conjunctive or disjunctive faceting.\nAs this is not supported, please make sure to remove this other widget or this Menu widget will not work at all.")) : void 0;
186
+ return searchParameters;
187
+ }
184
188
  var withFacetConfiguration = searchParameters.removeHierarchicalFacet(attribute).addHierarchicalFacet({
185
189
  name: attribute,
186
190
  attributes: [attribute]
@@ -253,6 +253,14 @@ var connectRefinementList = function connectRefinementList(renderFn) {
253
253
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
254
254
  var uiState = _ref6.uiState;
255
255
  var isDisjunctive = operator === 'or';
256
+ if (searchParameters.isHierarchicalFacet(attribute)) {
257
+ process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "RefinementList: Attribute \"".concat(attribute, "\" is already used by another widget applying hierarchical faceting.\nAs this is not supported, please make sure to remove this other widget or this RefinementList widget will not work at all.")) : void 0;
258
+ return searchParameters;
259
+ }
260
+ if (isDisjunctive && searchParameters.isConjunctiveFacet(attribute) || !isDisjunctive && searchParameters.isDisjunctiveFacet(attribute)) {
261
+ process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "RefinementList: Attribute \"".concat(attribute, "\" is used by another refinement list with a different operator.\nAs this is not supported, please make sure to only use this attribute with one of the two operators.")) : void 0;
262
+ return searchParameters;
263
+ }
256
264
  var values = uiState.refinementList && uiState.refinementList[attribute];
257
265
  var withoutRefinements = searchParameters.clearRefinements(attribute);
258
266
  var withFacetConfiguration = isDisjunctive ? withoutRefinements.addDisjunctiveFacet(attribute) : withoutRefinements.addFacet(attribute);
@@ -257,6 +257,10 @@ var connectToggleRefinement = function connectToggleRefinement(renderFn) {
257
257
  },
258
258
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref11) {
259
259
  var uiState = _ref11.uiState;
260
+ if (searchParameters.isHierarchicalFacet(attribute) || searchParameters.isConjunctiveFacet(attribute)) {
261
+ process.env.NODE_ENV === 'development' ? (0, _utils.warning)(false, "ToggleRefinement: Attribute \"".concat(attribute, "\" is already used by another widget of a different type.\nAs this is not supported, please make sure to remove this other widget or this ToggleRefinement widget will not work at all.")) : void 0;
262
+ return searchParameters;
263
+ }
260
264
  var withFacetConfiguration = searchParameters.clearRefinements(attribute).addDisjunctiveFacet(attribute);
261
265
  var isRefined = Boolean(uiState.toggle && uiState.toggle[attribute]);
262
266
  if (isRefined) {
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '4.53.0';
7
+ var _default = '4.54.0';
8
8
  exports.default = _default;
@@ -14,6 +14,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
14
14
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
15
15
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
16
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
+ /* Places.js is an optional dependency, no error should be reported if the package is missing */
17
18
  /** @ts-ignore */
18
19
 
19
20
  // using the type like this requires only one ts-ignore
@@ -1,4 +1,4 @@
1
- /*! InstantSearch.js 4.53.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
1
+ /*! InstantSearch.js 4.54.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch.js */
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) :
@@ -2432,6 +2432,10 @@
2432
2432
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
2433
2433
  var uiState = _ref6.uiState;
2434
2434
  var values = uiState.hierarchicalMenu && uiState.hierarchicalMenu[hierarchicalFacetName];
2435
+ if (searchParameters.isConjunctiveFacet(hierarchicalFacetName) || searchParameters.isDisjunctiveFacet(hierarchicalFacetName)) {
2436
+ _warning(false, "HierarchicalMenu: Attribute \"".concat(hierarchicalFacetName, "\" is already used by another widget applying conjunctive or disjunctive faceting.\nAs this is not supported, please make sure to remove this other widget or this HierarchicalMenu widget will not work at all.")) ;
2437
+ return searchParameters;
2438
+ }
2435
2439
  if (searchParameters.isHierarchicalFacet(hierarchicalFacetName)) {
2436
2440
  var facet = searchParameters.getHierarchicalFacetByName(hierarchicalFacetName);
2437
2441
  _warning(isEqual(facet.attributes, attributes) && facet.separator === separator && facet.rootPath === rootPath, 'Using Breadcrumb and HierarchicalMenu on the same facet with different options overrides the configuration of the HierarchicalMenu.') ;
@@ -3277,6 +3281,10 @@
3277
3281
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref5) {
3278
3282
  var uiState = _ref5.uiState;
3279
3283
  var value = uiState.menu && uiState.menu[attribute];
3284
+ if (searchParameters.isConjunctiveFacet(attribute) || searchParameters.isDisjunctiveFacet(attribute)) {
3285
+ _warning(false, "Menu: Attribute \"".concat(attribute, "\" is already used by another widget applying conjunctive or disjunctive faceting.\nAs this is not supported, please make sure to remove this other widget or this Menu widget will not work at all.")) ;
3286
+ return searchParameters;
3287
+ }
3280
3288
  var withFacetConfiguration = searchParameters.removeHierarchicalFacet(attribute).addHierarchicalFacet({
3281
3289
  name: attribute,
3282
3290
  attributes: [attribute]
@@ -4223,6 +4231,14 @@
4223
4231
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref6) {
4224
4232
  var uiState = _ref6.uiState;
4225
4233
  var isDisjunctive = operator === 'or';
4234
+ if (searchParameters.isHierarchicalFacet(attribute)) {
4235
+ _warning(false, "RefinementList: Attribute \"".concat(attribute, "\" is already used by another widget applying hierarchical faceting.\nAs this is not supported, please make sure to remove this other widget or this RefinementList widget will not work at all.")) ;
4236
+ return searchParameters;
4237
+ }
4238
+ if (isDisjunctive && searchParameters.isConjunctiveFacet(attribute) || !isDisjunctive && searchParameters.isDisjunctiveFacet(attribute)) {
4239
+ _warning(false, "RefinementList: Attribute \"".concat(attribute, "\" is used by another refinement list with a different operator.\nAs this is not supported, please make sure to only use this attribute with one of the two operators.")) ;
4240
+ return searchParameters;
4241
+ }
4226
4242
  var values = uiState.refinementList && uiState.refinementList[attribute];
4227
4243
  var withoutRefinements = searchParameters.clearRefinements(attribute);
4228
4244
  var withFacetConfiguration = isDisjunctive ? withoutRefinements.addDisjunctiveFacet(attribute) : withoutRefinements.addFacet(attribute);
@@ -4988,6 +5004,10 @@
4988
5004
  },
4989
5005
  getWidgetSearchParameters: function getWidgetSearchParameters(searchParameters, _ref11) {
4990
5006
  var uiState = _ref11.uiState;
5007
+ if (searchParameters.isHierarchicalFacet(attribute) || searchParameters.isConjunctiveFacet(attribute)) {
5008
+ _warning(false, "ToggleRefinement: Attribute \"".concat(attribute, "\" is already used by another widget of a different type.\nAs this is not supported, please make sure to remove this other widget or this ToggleRefinement widget will not work at all.")) ;
5009
+ return searchParameters;
5010
+ }
4991
5011
  var withFacetConfiguration = searchParameters.clearRefinements(attribute).addDisjunctiveFacet(attribute);
4992
5012
  var isRefined = Boolean(uiState.toggle && uiState.toggle[attribute]);
4993
5013
  if (isRefined) {
@@ -13620,7 +13640,7 @@
13620
13640
  };
13621
13641
  }
13622
13642
 
13623
- var version$1 = '4.53.0';
13643
+ var version$1 = '4.54.0';
13624
13644
 
13625
13645
  var withUsage$r = createDocumentationMessageGenerator({
13626
13646
  name: 'instantsearch'
@@ -18673,6 +18693,7 @@
18673
18693
 
18674
18694
  var _excluded$l = ["placesReference", "defaultPosition"],
18675
18695
  _excluded2$4 = ["places"];
18696
+ /* Places.js is an optional dependency, no error should be reported if the package is missing */
18676
18697
  /** @ts-ignore */
18677
18698
 
18678
18699
  // using the type like this requires only one ts-ignore