react-instantsearch-core 6.40.4 → 7.0.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.
Files changed (263) hide show
  1. package/README.md +70 -2
  2. package/dist/cjs/components/Configure.js +13 -0
  3. package/dist/cjs/components/DynamicWidgets.js +63 -0
  4. package/dist/cjs/components/Index.js +24 -0
  5. package/dist/cjs/components/InstantSearch.js +27 -0
  6. package/dist/cjs/{connectors/connectConfigure.js → components/InstantSearchSSRProvider.js} +27 -63
  7. package/dist/cjs/components/InstantSearchServerContext.js +12 -0
  8. package/dist/cjs/connectors/useBreadcrumb.js +12 -0
  9. package/dist/cjs/connectors/useClearRefinements.js +12 -0
  10. package/dist/cjs/connectors/useConfigure.js +14 -0
  11. package/dist/cjs/connectors/useCurrentRefinements.js +12 -0
  12. package/dist/cjs/connectors/useDynamicWidgets.js +22 -0
  13. package/dist/cjs/connectors/useGeoSearch.js +12 -0
  14. package/dist/cjs/connectors/useHierarchicalMenu.js +12 -0
  15. package/dist/cjs/connectors/useHits.js +12 -0
  16. package/dist/cjs/connectors/useHitsPerPage.js +12 -0
  17. package/dist/cjs/connectors/useInfiniteHits.js +12 -0
  18. package/dist/cjs/connectors/useMenu.js +12 -0
  19. package/dist/cjs/connectors/useNumericMenu.js +12 -0
  20. package/dist/cjs/connectors/usePagination.js +12 -0
  21. package/dist/cjs/connectors/usePoweredBy.js +21 -0
  22. package/dist/cjs/connectors/useQueryRules.js +12 -0
  23. package/dist/cjs/connectors/useRange.js +12 -0
  24. package/dist/cjs/connectors/useRefinementList.js +12 -0
  25. package/dist/cjs/connectors/useSearchBox.js +12 -0
  26. package/dist/cjs/connectors/useSortBy.js +12 -0
  27. package/dist/cjs/connectors/useStats.js +12 -0
  28. package/dist/cjs/connectors/useToggleRefinement.js +12 -0
  29. package/dist/cjs/hooks/useConnector.js +136 -0
  30. package/dist/cjs/hooks/useInstantSearch.js +58 -0
  31. package/dist/cjs/index.js +328 -320
  32. package/dist/cjs/lib/IndexContext.js +12 -0
  33. package/dist/cjs/lib/InstantSearchContext.js +12 -0
  34. package/dist/cjs/lib/InstantSearchSSRContext.js +12 -0
  35. package/dist/cjs/lib/createSearchResults.js +27 -0
  36. package/dist/cjs/lib/dequal.js +53 -0
  37. package/dist/cjs/lib/getIndexSearchResults.js +32 -0
  38. package/dist/cjs/lib/invariant.js +25 -0
  39. package/dist/cjs/lib/noop.js +8 -0
  40. package/dist/cjs/lib/useForceUpdate.js +25 -0
  41. package/dist/cjs/lib/useIndex.js +38 -0
  42. package/dist/cjs/lib/useIndexContext.js +14 -0
  43. package/dist/cjs/lib/useInstantSearchApi.js +191 -0
  44. package/dist/cjs/lib/useInstantSearchContext.js +14 -0
  45. package/dist/cjs/lib/useInstantSearchSSRContext.js +11 -0
  46. package/dist/cjs/lib/useInstantSearchServerContext.js +11 -0
  47. package/dist/cjs/lib/useIsomorphicLayoutEffect.js +14 -0
  48. package/dist/cjs/lib/useSearchResults.js +46 -0
  49. package/dist/cjs/lib/useSearchState.js +48 -0
  50. package/dist/cjs/lib/useStableValue.js +26 -0
  51. package/dist/cjs/lib/useWidget.js +78 -0
  52. package/dist/cjs/lib/warn.js +41 -0
  53. package/dist/cjs/package.json +1 -0
  54. package/dist/cjs/server/getServerState.js +93 -0
  55. package/dist/cjs/{types → server}/index.js +4 -4
  56. package/dist/cjs/{core/version.js → version.js} +1 -1
  57. package/dist/es/components/Configure.d.ts +3 -0
  58. package/dist/es/components/Configure.js +7 -0
  59. package/dist/es/components/DynamicWidgets.d.ts +13 -0
  60. package/dist/es/components/DynamicWidgets.js +55 -0
  61. package/dist/es/components/Index.d.ts +6 -0
  62. package/dist/es/components/Index.js +17 -0
  63. package/dist/es/components/InstantSearch.d.ts +7 -0
  64. package/dist/es/components/InstantSearch.js +20 -0
  65. package/dist/es/components/InstantSearchSSRProvider.d.ts +13 -0
  66. package/dist/es/{connectors/connectConfigure.js → components/InstantSearchSSRProvider.js} +26 -61
  67. package/dist/es/components/InstantSearchServerContext.d.ts +12 -0
  68. package/dist/es/components/InstantSearchServerContext.js +5 -0
  69. package/dist/es/connectors/useBreadcrumb.d.ts +4 -0
  70. package/dist/es/connectors/useBreadcrumb.js +5 -0
  71. package/dist/es/connectors/useClearRefinements.d.ts +4 -0
  72. package/dist/es/connectors/useClearRefinements.js +5 -0
  73. package/dist/es/connectors/useConfigure.d.ts +4 -0
  74. package/dist/es/connectors/useConfigure.js +7 -0
  75. package/dist/es/connectors/useCurrentRefinements.d.ts +4 -0
  76. package/dist/es/connectors/useCurrentRefinements.js +5 -0
  77. package/dist/es/connectors/useDynamicWidgets.d.ts +4 -0
  78. package/dist/es/connectors/useDynamicWidgets.js +15 -0
  79. package/dist/es/connectors/useGeoSearch.d.ts +6 -0
  80. package/dist/es/connectors/useGeoSearch.js +5 -0
  81. package/dist/es/connectors/useHierarchicalMenu.d.ts +4 -0
  82. package/dist/es/connectors/useHierarchicalMenu.js +5 -0
  83. package/dist/es/connectors/useHits.d.ts +5 -0
  84. package/dist/es/connectors/useHits.js +5 -0
  85. package/dist/es/connectors/useHitsPerPage.d.ts +4 -0
  86. package/dist/es/connectors/useHitsPerPage.js +5 -0
  87. package/dist/es/connectors/useInfiniteHits.d.ts +5 -0
  88. package/dist/es/connectors/useInfiniteHits.js +5 -0
  89. package/dist/es/connectors/useMenu.d.ts +4 -0
  90. package/dist/es/connectors/useMenu.js +5 -0
  91. package/dist/es/connectors/useNumericMenu.d.ts +4 -0
  92. package/dist/es/connectors/useNumericMenu.js +5 -0
  93. package/dist/es/connectors/usePagination.d.ts +4 -0
  94. package/dist/es/connectors/usePagination.js +5 -0
  95. package/dist/es/connectors/usePoweredBy.d.ts +2 -0
  96. package/dist/es/connectors/usePoweredBy.js +15 -0
  97. package/dist/es/connectors/useQueryRules.d.ts +4 -0
  98. package/dist/es/connectors/useQueryRules.js +5 -0
  99. package/dist/es/connectors/useRange.d.ts +4 -0
  100. package/dist/es/connectors/useRange.js +5 -0
  101. package/dist/es/connectors/useRefinementList.d.ts +4 -0
  102. package/dist/es/connectors/useRefinementList.js +5 -0
  103. package/dist/es/connectors/useSearchBox.d.ts +4 -0
  104. package/dist/es/connectors/useSearchBox.js +5 -0
  105. package/dist/es/connectors/useSortBy.d.ts +4 -0
  106. package/dist/es/connectors/useSortBy.js +5 -0
  107. package/dist/es/connectors/useStats.d.ts +4 -0
  108. package/dist/es/connectors/useStats.js +5 -0
  109. package/dist/es/connectors/useToggleRefinement.d.ts +4 -0
  110. package/dist/es/connectors/useToggleRefinement.js +5 -0
  111. package/dist/es/hooks/useConnector.d.ts +3 -0
  112. package/dist/es/hooks/useConnector.js +130 -0
  113. package/dist/es/hooks/useInstantSearch.d.ts +32 -0
  114. package/dist/es/hooks/useInstantSearch.js +52 -0
  115. package/dist/es/index.d.ts +31 -0
  116. package/dist/es/index.js +31 -87
  117. package/dist/es/lib/IndexContext.d.ts +3 -0
  118. package/dist/es/lib/IndexContext.js +5 -0
  119. package/dist/es/lib/InstantSearchContext.d.ts +3 -0
  120. package/dist/es/lib/InstantSearchContext.js +5 -0
  121. package/dist/es/lib/InstantSearchSSRContext.d.ts +8 -0
  122. package/dist/es/lib/InstantSearchSSRContext.js +5 -0
  123. package/dist/es/lib/createSearchResults.d.ts +3 -0
  124. package/dist/es/lib/createSearchResults.js +20 -0
  125. package/dist/es/lib/dequal.d.ts +1 -0
  126. package/dist/es/lib/dequal.js +47 -0
  127. package/dist/es/lib/getIndexSearchResults.d.ts +9 -0
  128. package/dist/es/lib/getIndexSearchResults.js +26 -0
  129. package/dist/es/lib/invariant.d.ts +9 -0
  130. package/dist/es/lib/invariant.js +19 -0
  131. package/dist/es/lib/noop.d.ts +1 -0
  132. package/dist/es/lib/noop.js +1 -0
  133. package/dist/es/lib/useForceUpdate.d.ts +6 -0
  134. package/dist/es/lib/useForceUpdate.js +20 -0
  135. package/dist/es/lib/useIndex.d.ts +3 -0
  136. package/dist/es/lib/useIndex.js +31 -0
  137. package/dist/es/lib/useIndexContext.d.ts +2 -0
  138. package/dist/es/lib/useIndexContext.js +8 -0
  139. package/dist/es/lib/useInstantSearchApi.d.ts +21 -0
  140. package/dist/es/lib/useInstantSearchApi.js +184 -0
  141. package/dist/es/lib/useInstantSearchContext.d.ts +3 -0
  142. package/dist/es/lib/useInstantSearchContext.js +8 -0
  143. package/dist/es/lib/useInstantSearchSSRContext.d.ts +3 -0
  144. package/dist/es/lib/useInstantSearchSSRContext.js +5 -0
  145. package/dist/es/lib/useInstantSearchServerContext.d.ts +3 -0
  146. package/dist/es/lib/useInstantSearchServerContext.js +5 -0
  147. package/dist/es/lib/useIsomorphicLayoutEffect.d.ts +7 -0
  148. package/dist/es/lib/useIsomorphicLayoutEffect.js +8 -0
  149. package/dist/es/lib/useSearchResults.d.ts +7 -0
  150. package/dist/es/lib/useSearchResults.js +40 -0
  151. package/dist/es/lib/useSearchState.d.ts +8 -0
  152. package/dist/es/lib/useSearchState.js +42 -0
  153. package/dist/es/lib/useStableValue.d.ts +1 -0
  154. package/dist/es/lib/useStableValue.js +20 -0
  155. package/dist/es/lib/useWidget.d.ts +8 -0
  156. package/dist/es/lib/useWidget.js +72 -0
  157. package/dist/es/lib/warn.d.ts +10 -0
  158. package/dist/es/lib/warn.js +33 -0
  159. package/dist/es/server/getServerState.d.ts +10 -0
  160. package/dist/es/server/getServerState.js +86 -0
  161. package/dist/es/server/index.d.ts +1 -0
  162. package/dist/es/server/index.js +1 -0
  163. package/dist/es/version.d.ts +2 -0
  164. package/dist/es/version.js +1 -0
  165. package/dist/umd/ReactInstantSearchCore.js +14071 -7955
  166. package/dist/umd/ReactInstantSearchCore.js.map +1 -1
  167. package/dist/umd/ReactInstantSearchCore.min.js +1 -1
  168. package/dist/umd/ReactInstantSearchCore.min.js.map +1 -1
  169. package/package.json +23 -8
  170. package/dist/cjs/connectors/connectAutoComplete.js +0 -104
  171. package/dist/cjs/connectors/connectBreadcrumb.js +0 -123
  172. package/dist/cjs/connectors/connectConfigureRelatedItems.js +0 -127
  173. package/dist/cjs/connectors/connectCurrentRefinements.js +0 -69
  174. package/dist/cjs/connectors/connectDynamicWidgets.js +0 -65
  175. package/dist/cjs/connectors/connectGeoSearch.js +0 -189
  176. package/dist/cjs/connectors/connectHierarchicalMenu.js +0 -273
  177. package/dist/cjs/connectors/connectHighlight.js +0 -87
  178. package/dist/cjs/connectors/connectHitInsights.js +0 -76
  179. package/dist/cjs/connectors/connectHits.js +0 -88
  180. package/dist/cjs/connectors/connectHitsPerPage.js +0 -97
  181. package/dist/cjs/connectors/connectInfiniteHits.js +0 -154
  182. package/dist/cjs/connectors/connectMenu.js +0 -221
  183. package/dist/cjs/connectors/connectNumericMenu.js +0 -215
  184. package/dist/cjs/connectors/connectPagination.js +0 -94
  185. package/dist/cjs/connectors/connectPoweredBy.js +0 -27
  186. package/dist/cjs/connectors/connectQueryRules.js +0 -129
  187. package/dist/cjs/connectors/connectRange.js +0 -287
  188. package/dist/cjs/connectors/connectRefinementList.js +0 -243
  189. package/dist/cjs/connectors/connectRelevantSort.js +0 -56
  190. package/dist/cjs/connectors/connectScrollTo.js +0 -70
  191. package/dist/cjs/connectors/connectSearchBox.js +0 -104
  192. package/dist/cjs/connectors/connectSortBy.js +0 -100
  193. package/dist/cjs/connectors/connectStateResults.js +0 -79
  194. package/dist/cjs/connectors/connectStats.js +0 -39
  195. package/dist/cjs/connectors/connectToggleRefinement.js +0 -163
  196. package/dist/cjs/connectors/connectVoiceSearch.js +0 -124
  197. package/dist/cjs/core/context.js +0 -37
  198. package/dist/cjs/core/createConnector.js +0 -268
  199. package/dist/cjs/core/createInstantSearchManager.d.js +0 -1
  200. package/dist/cjs/core/createInstantSearchManager.js +0 -541
  201. package/dist/cjs/core/createStore.js +0 -27
  202. package/dist/cjs/core/createWidgetsManager.js +0 -39
  203. package/dist/cjs/core/highlight.js +0 -102
  204. package/dist/cjs/core/indexUtils.js +0 -214
  205. package/dist/cjs/core/metadata.js +0 -46
  206. package/dist/cjs/core/translatable.js +0 -82
  207. package/dist/cjs/core/utils.js +0 -161
  208. package/dist/cjs/types/algoliasearch.js +0 -1
  209. package/dist/cjs/types/translatable.js +0 -1
  210. package/dist/cjs/widgets/Configure.js +0 -48
  211. package/dist/cjs/widgets/ConfigureRelatedItems.js +0 -21
  212. package/dist/cjs/widgets/DynamicWidgets.js +0 -61
  213. package/dist/cjs/widgets/Index.js +0 -149
  214. package/dist/cjs/widgets/InstantSearch.js +0 -251
  215. package/dist/cjs/widgets/QueryRuleContext.js +0 -14
  216. package/dist/es/connectors/connectAutoComplete.js +0 -96
  217. package/dist/es/connectors/connectBreadcrumb.js +0 -115
  218. package/dist/es/connectors/connectConfigureRelatedItems.js +0 -121
  219. package/dist/es/connectors/connectCurrentRefinements.js +0 -62
  220. package/dist/es/connectors/connectDynamicWidgets.js +0 -56
  221. package/dist/es/connectors/connectGeoSearch.js +0 -182
  222. package/dist/es/connectors/connectHierarchicalMenu.js +0 -264
  223. package/dist/es/connectors/connectHighlight.js +0 -79
  224. package/dist/es/connectors/connectHitInsights.js +0 -69
  225. package/dist/es/connectors/connectHits.js +0 -81
  226. package/dist/es/connectors/connectHitsPerPage.js +0 -89
  227. package/dist/es/connectors/connectInfiniteHits.js +0 -146
  228. package/dist/es/connectors/connectMenu.js +0 -213
  229. package/dist/es/connectors/connectNumericMenu.js +0 -207
  230. package/dist/es/connectors/connectPagination.js +0 -86
  231. package/dist/es/connectors/connectPoweredBy.js +0 -20
  232. package/dist/es/connectors/connectQueryRules.js +0 -122
  233. package/dist/es/connectors/connectRange.js +0 -280
  234. package/dist/es/connectors/connectRefinementList.js +0 -235
  235. package/dist/es/connectors/connectRelevantSort.js +0 -50
  236. package/dist/es/connectors/connectScrollTo.js +0 -63
  237. package/dist/es/connectors/connectSearchBox.js +0 -96
  238. package/dist/es/connectors/connectSortBy.js +0 -92
  239. package/dist/es/connectors/connectStateResults.js +0 -72
  240. package/dist/es/connectors/connectStats.js +0 -32
  241. package/dist/es/connectors/connectToggleRefinement.js +0 -155
  242. package/dist/es/connectors/connectVoiceSearch.js +0 -116
  243. package/dist/es/core/context.js +0 -28
  244. package/dist/es/core/createConnector.js +0 -257
  245. package/dist/es/core/createInstantSearchManager.d.js +0 -0
  246. package/dist/es/core/createInstantSearchManager.js +0 -534
  247. package/dist/es/core/createStore.js +0 -21
  248. package/dist/es/core/createWidgetsManager.js +0 -33
  249. package/dist/es/core/highlight.js +0 -94
  250. package/dist/es/core/indexUtils.js +0 -203
  251. package/dist/es/core/metadata.js +0 -38
  252. package/dist/es/core/translatable.js +0 -74
  253. package/dist/es/core/utils.js +0 -139
  254. package/dist/es/core/version.js +0 -1
  255. package/dist/es/types/algoliasearch.js +0 -1
  256. package/dist/es/types/index.js +0 -1
  257. package/dist/es/types/translatable.js +0 -1
  258. package/dist/es/widgets/Configure.js +0 -42
  259. package/dist/es/widgets/ConfigureRelatedItems.js +0 -13
  260. package/dist/es/widgets/DynamicWidgets.js +0 -51
  261. package/dist/es/widgets/Index.js +0 -138
  262. package/dist/es/widgets/InstantSearch.js +0 -241
  263. package/dist/es/widgets/QueryRuleContext.js +0 -6
@@ -1,122 +0,0 @@
1
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
2
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- import createConnector from "../core/createConnector.js";
8
- // @ts-ignore
9
- import { getResults, getIndexId, hasMultipleIndices } from "../core/indexUtils.js";
10
- // A context rule must consist only of alphanumeric characters, hyphens, and underscores.
11
- // See https://www.algolia.com/doc/guides/managing-results/refine-results/merchandising-and-promoting/in-depth/implementing-query-rules/#context
12
- function escapeRuleContext(ruleName) {
13
- return ruleName.replace(/[^a-z0-9-_]+/gi, '_');
14
- }
15
- function getWidgetRefinements(attribute, widgetKey, searchState) {
16
- var widgetState = searchState[widgetKey];
17
- switch (widgetKey) {
18
- case 'range':
19
- return Object.keys(widgetState[attribute]).map(function (rangeKey) {
20
- return widgetState[attribute][rangeKey];
21
- });
22
- case 'refinementList':
23
- return widgetState[attribute];
24
- case 'hierarchicalMenu':
25
- return [widgetState[attribute]];
26
- case 'menu':
27
- return [widgetState[attribute]];
28
- case 'multiRange':
29
- return widgetState[attribute].split(':');
30
- case 'toggle':
31
- return [widgetState[attribute]];
32
- default:
33
- return [];
34
- }
35
- }
36
- function getRefinements(attribute) {
37
- var searchState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
38
- var refinements = Object.keys(searchState).filter(function (widgetKey) {
39
- return searchState[widgetKey] !== undefined && searchState[widgetKey][attribute] !== undefined;
40
- }).map(function (widgetKey) {
41
- return getWidgetRefinements(attribute, widgetKey, searchState);
42
- }).reduce(function (acc, current) {
43
- return acc.concat(current);
44
- }, []); // flatten the refinements
45
-
46
- return refinements;
47
- }
48
- function getRuleContextsFromTrackedFilters(_ref) {
49
- var searchState = _ref.searchState,
50
- trackedFilters = _ref.trackedFilters;
51
- var ruleContexts = Object.keys(trackedFilters).reduce(function (facets, facetName) {
52
- var facetRefinements = getRefinements(facetName, searchState);
53
- var getTrackedFacetValues = trackedFilters[facetName];
54
- var trackedFacetValues = getTrackedFacetValues(facetRefinements);
55
- return [].concat(_toConsumableArray(facets), _toConsumableArray(facetRefinements.filter(function (facetRefinement) {
56
- return trackedFacetValues.includes(facetRefinement);
57
- }).map(function (facetValue) {
58
- return escapeRuleContext("ais-".concat(facetName, "-").concat(facetValue));
59
- })));
60
- }, []);
61
- return ruleContexts;
62
- }
63
- var defaultProps = {
64
- transformItems: function transformItems(items) {
65
- return items;
66
- },
67
- transformRuleContexts: function transformRuleContexts(ruleContexts) {
68
- return ruleContexts;
69
- },
70
- trackedFilters: {}
71
- };
72
- export default createConnector({
73
- displayName: 'AlgoliaQueryRules',
74
- $$type: 'ais.queryRules',
75
- defaultProps: defaultProps,
76
- getProvidedProps: function getProvidedProps(props, _1, searchResults) {
77
- var results = getResults(searchResults, {
78
- ais: props.contextValue,
79
- multiIndexContext: props.indexContextValue
80
- });
81
- if (results === null) {
82
- return {
83
- items: [],
84
- canRefine: false
85
- };
86
- }
87
- var _results$userData = results.userData,
88
- userData = _results$userData === void 0 ? [] : _results$userData;
89
- var transformItems = props.transformItems;
90
- var transformedItems = transformItems(userData);
91
- return {
92
- items: transformedItems,
93
- canRefine: transformedItems.length > 0
94
- };
95
- },
96
- getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
97
- if (Object.keys(props.trackedFilters).length === 0) {
98
- return searchParameters;
99
- }
100
- var indexSearchState = hasMultipleIndices({
101
- ais: props.contextValue,
102
- multiIndexContext: props.indexContextValue
103
- }) && searchState.indices ? searchState.indices[getIndexId({
104
- ais: props.contextValue,
105
- multiIndexContext: props.indexContextValue
106
- })] : searchState;
107
- var newRuleContexts = getRuleContextsFromTrackedFilters({
108
- searchState: indexSearchState,
109
- trackedFilters: props.trackedFilters
110
- });
111
- var initialRuleContexts = searchParameters.ruleContexts || [];
112
- var nextRuleContexts = [].concat(_toConsumableArray(initialRuleContexts), _toConsumableArray(newRuleContexts));
113
- if (process.env.NODE_ENV === 'development') {
114
- if (nextRuleContexts.length > 10) {
115
- // eslint-disable-next-line no-console
116
- console.warn("The maximum number of `ruleContexts` is 10. They have been sliced to that limit.\nConsider using `transformRuleContexts` to minimize the number of rules sent to Algolia.");
117
- }
118
- }
119
- var ruleContexts = props.transformRuleContexts(nextRuleContexts).slice(0, 10);
120
- return searchParameters.setQueryParameter('ruleContexts', ruleContexts);
121
- }
122
- });
@@ -1,280 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4
- 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); }
5
- import PropTypes from 'prop-types';
6
- import createConnector from "../core/createConnector.js";
7
- import { cleanUpValue, getIndexId, refineValue, getCurrentRefinementValue, getResults } from "../core/indexUtils.js";
8
-
9
- /**
10
- * connectRange connector provides the logic to create connected
11
- * components that will give the ability for a user to refine results using
12
- * a numeric range.
13
- * @name connectRange
14
- * @kind connector
15
- * @requirements The attribute passed to the `attribute` prop must be present in “attributes for faceting”
16
- * on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
17
- * The values inside the attribute must be JavaScript numbers (not strings).
18
- * @propType {string} attribute - Name of the attribute for faceting
19
- * @propType {{min?: number, max?: number}} [defaultRefinement] - Default searchState of the widget containing the start and the end of the range.
20
- * @propType {number} [min] - Minimum value. When this isn't set, the minimum value will be automatically computed by Algolia using the data in the index.
21
- * @propType {number} [max] - Maximum value. When this isn't set, the maximum value will be automatically computed by Algolia using the data in the index.
22
- * @propType {number} [precision=0] - Number of digits after decimal point to use.
23
- * @providedPropType {function} refine - a function to select a range.
24
- * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
25
- * @providedPropType {string} currentRefinement - the refinement currently applied
26
- * @providedPropType {number} min - the minimum value available.
27
- * @providedPropType {number} max - the maximum value available.
28
- * @providedPropType {number} precision - Number of digits after decimal point to use.
29
- */
30
-
31
- function getId(props) {
32
- return props.attribute;
33
- }
34
- var namespace = 'range';
35
- function getCurrentRange(boundaries, stats, precision) {
36
- var pow = Math.pow(10, precision);
37
- var min;
38
- if (typeof boundaries.min === 'number' && isFinite(boundaries.min)) {
39
- min = boundaries.min;
40
- } else if (typeof stats.min === 'number' && isFinite(stats.min)) {
41
- min = stats.min;
42
- } else {
43
- min = undefined;
44
- }
45
- var max;
46
- if (typeof boundaries.max === 'number' && isFinite(boundaries.max)) {
47
- max = boundaries.max;
48
- } else if (typeof stats.max === 'number' && isFinite(stats.max)) {
49
- max = stats.max;
50
- } else {
51
- max = undefined;
52
- }
53
- return {
54
- min: min !== undefined ? Math.floor(min * pow) / pow : min,
55
- max: max !== undefined ? Math.ceil(max * pow) / pow : max
56
- };
57
- }
58
- function getCurrentRefinement(props, searchState, currentRange, context) {
59
- var _getCurrentRefinement = getCurrentRefinementValue(props, searchState, context, "".concat(namespace, ".").concat(getId(props)), {}),
60
- min = _getCurrentRefinement.min,
61
- max = _getCurrentRefinement.max;
62
- var isFloatPrecision = Boolean(props.precision);
63
- var nextMin = min;
64
- if (typeof nextMin === 'string') {
65
- nextMin = isFloatPrecision ? parseFloat(nextMin) : parseInt(nextMin, 10);
66
- }
67
- var nextMax = max;
68
- if (typeof nextMax === 'string') {
69
- nextMax = isFloatPrecision ? parseFloat(nextMax) : parseInt(nextMax, 10);
70
- }
71
- var refinement = {
72
- min: nextMin,
73
- max: nextMax
74
- };
75
- var hasMinBound = props.min !== undefined;
76
- var hasMaxBound = props.max !== undefined;
77
- var hasMinRefinment = refinement.min !== undefined;
78
- var hasMaxRefinment = refinement.max !== undefined;
79
- if (hasMinBound && hasMinRefinment && refinement.min < currentRange.min) {
80
- throw Error("You can't provide min value lower than range.");
81
- }
82
- if (hasMaxBound && hasMaxRefinment && refinement.max > currentRange.max) {
83
- throw Error("You can't provide max value greater than range.");
84
- }
85
- if (hasMinBound && !hasMinRefinment) {
86
- refinement.min = currentRange.min;
87
- }
88
- if (hasMaxBound && !hasMaxRefinment) {
89
- refinement.max = currentRange.max;
90
- }
91
- return refinement;
92
- }
93
- function getCurrentRefinementWithRange(refinement, range) {
94
- return {
95
- min: refinement.min !== undefined ? refinement.min : range.min,
96
- max: refinement.max !== undefined ? refinement.max : range.max
97
- };
98
- }
99
- function nextValueForRefinement(hasBound, isReset, range, value) {
100
- var next;
101
- if (!hasBound && range === value) {
102
- next = undefined;
103
- } else if (hasBound && isReset) {
104
- next = range;
105
- } else {
106
- next = value;
107
- }
108
- return next;
109
- }
110
- function _refine(props, searchState, nextRefinement, currentRange, context) {
111
- var nextMin = nextRefinement.min,
112
- nextMax = nextRefinement.max;
113
- var currentMinRange = currentRange.min,
114
- currentMaxRange = currentRange.max;
115
- var isMinReset = nextMin === undefined || nextMin === '';
116
- var isMaxReset = nextMax === undefined || nextMax === '';
117
- var nextMinAsNumber = !isMinReset ? parseFloat(nextMin) : undefined;
118
- var nextMaxAsNumber = !isMaxReset ? parseFloat(nextMax) : undefined;
119
- var isNextMinValid = isMinReset || isFinite(nextMinAsNumber);
120
- var isNextMaxValid = isMaxReset || isFinite(nextMaxAsNumber);
121
- if (!isNextMinValid || !isNextMaxValid) {
122
- throw Error("You can't provide non finite values to the range connector.");
123
- }
124
- if (nextMinAsNumber < currentMinRange) {
125
- throw Error("You can't provide min value lower than range.");
126
- }
127
- if (nextMaxAsNumber > currentMaxRange) {
128
- throw Error("You can't provide max value greater than range.");
129
- }
130
- var id = getId(props);
131
- var resetPage = true;
132
- var nextValue = _defineProperty({}, id, {
133
- min: nextValueForRefinement(props.min !== undefined, isMinReset, currentMinRange, nextMinAsNumber),
134
- max: nextValueForRefinement(props.max !== undefined, isMaxReset, currentMaxRange, nextMaxAsNumber)
135
- });
136
- return refineValue(searchState, nextValue, context, resetPage, namespace);
137
- }
138
- function _cleanUp(props, searchState, context) {
139
- return cleanUpValue(searchState, context, "".concat(namespace, ".").concat(getId(props)));
140
- }
141
- export default createConnector({
142
- displayName: 'AlgoliaRange',
143
- $$type: 'ais.range',
144
- propTypes: {
145
- id: PropTypes.string,
146
- attribute: PropTypes.string.isRequired,
147
- defaultRefinement: PropTypes.shape({
148
- min: PropTypes.number,
149
- max: PropTypes.number
150
- }),
151
- min: PropTypes.number,
152
- max: PropTypes.number,
153
- precision: PropTypes.number,
154
- header: PropTypes.node,
155
- footer: PropTypes.node
156
- },
157
- defaultProps: {
158
- precision: 0
159
- },
160
- getProvidedProps: function getProvidedProps(props, searchState, searchResults) {
161
- var attribute = props.attribute,
162
- precision = props.precision,
163
- minBound = props.min,
164
- maxBound = props.max;
165
- var results = getResults(searchResults, {
166
- ais: props.contextValue,
167
- multiIndexContext: props.indexContextValue
168
- });
169
- var hasFacet = results && results.getFacetByName(attribute);
170
- var stats = hasFacet ? results.getFacetStats(attribute) || {} : {};
171
- var facetValues = hasFacet ? results.getFacetValues(attribute) : [];
172
- var count = facetValues.map(function (v) {
173
- return {
174
- value: v.name,
175
- count: v.count
176
- };
177
- });
178
- var _getCurrentRange = getCurrentRange({
179
- min: minBound,
180
- max: maxBound
181
- }, stats, precision),
182
- rangeMin = _getCurrentRange.min,
183
- rangeMax = _getCurrentRange.max;
184
-
185
- // The searchState is not always in sync with the helper state. For example
186
- // when we set boundaries on the first render the searchState don't have
187
- // the correct refinement. If this behavior change in the upcoming version
188
- // we could store the range inside the searchState instead of rely on `this`.
189
- this._currentRange = {
190
- min: rangeMin,
191
- max: rangeMax
192
- };
193
- var currentRefinement = getCurrentRefinement(props, searchState, this._currentRange, {
194
- ais: props.contextValue,
195
- multiIndexContext: props.indexContextValue
196
- });
197
- return {
198
- min: rangeMin,
199
- max: rangeMax,
200
- canRefine: count.length > 0,
201
- currentRefinement: getCurrentRefinementWithRange(currentRefinement, this._currentRange),
202
- count: count,
203
- precision: precision
204
- };
205
- },
206
- refine: function refine(props, searchState, nextRefinement) {
207
- return _refine(props, searchState, nextRefinement, this._currentRange, {
208
- ais: props.contextValue,
209
- multiIndexContext: props.indexContextValue
210
- });
211
- },
212
- cleanUp: function cleanUp(props, searchState) {
213
- return _cleanUp(props, searchState, {
214
- ais: props.contextValue,
215
- multiIndexContext: props.indexContextValue
216
- });
217
- },
218
- getSearchParameters: function getSearchParameters(params, props, searchState) {
219
- var attribute = props.attribute;
220
- var _getCurrentRefinement2 = getCurrentRefinement(props, searchState, this._currentRange, {
221
- ais: props.contextValue,
222
- multiIndexContext: props.indexContextValue
223
- }),
224
- min = _getCurrentRefinement2.min,
225
- max = _getCurrentRefinement2.max;
226
- params = params.addDisjunctiveFacet(attribute);
227
- if (min !== undefined) {
228
- params = params.addNumericRefinement(attribute, '>=', min);
229
- }
230
- if (max !== undefined) {
231
- params = params.addNumericRefinement(attribute, '<=', max);
232
- }
233
- return params;
234
- },
235
- getMetadata: function getMetadata(props, searchState) {
236
- var _this = this;
237
- var _this$_currentRange = this._currentRange,
238
- minRange = _this$_currentRange.min,
239
- maxRange = _this$_currentRange.max;
240
- var _getCurrentRefinement3 = getCurrentRefinement(props, searchState, this._currentRange, {
241
- ais: props.contextValue,
242
- multiIndexContext: props.indexContextValue
243
- }),
244
- minValue = _getCurrentRefinement3.min,
245
- maxValue = _getCurrentRefinement3.max;
246
- var items = [];
247
- var hasMin = minValue !== undefined;
248
- var hasMax = maxValue !== undefined;
249
- var shouldDisplayMinLabel = hasMin && minValue !== minRange;
250
- var shouldDisplayMaxLabel = hasMax && maxValue !== maxRange;
251
- if (shouldDisplayMinLabel || shouldDisplayMaxLabel) {
252
- var fragments = [hasMin ? "".concat(minValue, " <= ") : '', props.attribute, hasMax ? " <= ".concat(maxValue) : ''];
253
- items.push({
254
- label: fragments.join(''),
255
- attribute: props.attribute,
256
- value: function value(nextState) {
257
- return _refine(props, nextState, {}, _this._currentRange, {
258
- ais: props.contextValue,
259
- multiIndexContext: props.indexContextValue
260
- });
261
- },
262
- currentRefinement: getCurrentRefinementWithRange({
263
- min: minValue,
264
- max: maxValue
265
- }, {
266
- min: minRange,
267
- max: maxRange
268
- })
269
- });
270
- }
271
- return {
272
- id: getId(props),
273
- index: getIndexId({
274
- ais: props.contextValue,
275
- multiIndexContext: props.indexContextValue
276
- }),
277
- items: items
278
- };
279
- }
280
- });
@@ -1,235 +0,0 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4
- 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); }
5
- import PropTypes from 'prop-types';
6
- import createConnector from "../core/createConnector.js";
7
- import { cleanUpValue, getIndexId, refineValue, getCurrentRefinementValue, getResults } from "../core/indexUtils.js";
8
- import { unescapeFacetValue } from "../core/utils.js";
9
- var namespace = 'refinementList';
10
- function getId(props) {
11
- return props.attribute;
12
- }
13
- function getCurrentRefinement(props, searchState, context) {
14
- var currentRefinement = getCurrentRefinementValue(props, searchState, context, "".concat(namespace, ".").concat(getId(props)), []);
15
- if (typeof currentRefinement !== 'string') {
16
- return currentRefinement;
17
- }
18
- if (currentRefinement) {
19
- return [currentRefinement];
20
- }
21
- return [];
22
- }
23
- function getValue(value, props, searchState, context) {
24
- var currentRefinement = getCurrentRefinement(props, searchState, context);
25
- var isAnewValue = currentRefinement.indexOf(value) === -1;
26
- var nextRefinement = isAnewValue ? currentRefinement.concat([value]) // cannot use .push(), it mutates
27
- : currentRefinement.filter(function (selectedValue) {
28
- return selectedValue !== value;
29
- }); // cannot use .splice(), it mutates
30
- return nextRefinement;
31
- }
32
- function getLimit(_ref) {
33
- var showMore = _ref.showMore,
34
- limit = _ref.limit,
35
- showMoreLimit = _ref.showMoreLimit;
36
- return showMore ? showMoreLimit : limit;
37
- }
38
- function _refine(props, searchState, nextRefinement, context) {
39
- var id = getId(props);
40
- // Setting the value to an empty string ensures that it is persisted in
41
- // the URL as an empty value.
42
- // This is necessary in the case where `defaultRefinement` contains one
43
- // item and we try to deselect it. `nextSelected` would be an empty array,
44
- // which would not be persisted to the URL.
45
- // {foo: ['bar']} => "foo[0]=bar"
46
- // {foo: []} => ""
47
- var nextValue = _defineProperty({}, id, nextRefinement.length > 0 ? nextRefinement : '');
48
- var resetPage = true;
49
- return refineValue(searchState, nextValue, context, resetPage, namespace);
50
- }
51
- function _cleanUp(props, searchState, context) {
52
- return cleanUpValue(searchState, context, "".concat(namespace, ".").concat(getId(props)));
53
- }
54
- /**
55
- * connectRefinementList connector provides the logic to build a widget that will
56
- * give the user the ability to choose multiple values for a specific facet.
57
- * @name connectRefinementList
58
- * @kind connector
59
- * @requirements The attribute passed to the `attribute` prop must be present in "attributes for faceting"
60
- * on the Algolia dashboard or configured as `attributesForFaceting` via a set settings call to the Algolia API.
61
- * @propType {string} attribute - the name of the attribute in the record
62
- * @propType {boolean} [searchable=false] - allow search inside values
63
- * @propType {string} [operator=or] - How to apply the refinements. Possible values: 'or' or 'and'.
64
- * @propType {boolean} [showMore=false] - true if the component should display a button that will expand the number of items
65
- * @propType {number} [limit=10] - the minimum number of displayed items
66
- * @propType {number} [showMoreLimit=20] - the maximun number of displayed items. Only used when showMore is set to `true`
67
- * @propType {string[]} defaultRefinement - the values of the items selected by default. The searchState of this widget takes the form of a list of `string`s, which correspond to the values of all selected refinements. However, when there are no refinements selected, the value of the searchState is an empty string.
68
- * @propType {function} [transformItems] - Function to modify the items being displayed, e.g. for filtering or sorting them. Takes an items as parameter and expects it back in return.
69
- * @providedPropType {function} refine - a function to toggle a refinement
70
- * @providedPropType {function} createURL - a function to generate a URL for the corresponding search state
71
- * @providedPropType {string[]} currentRefinement - the refinement currently applied
72
- * @providedPropType {array.<{count: number, isRefined: boolean, label: string, value: string}>} items - the list of items the RefinementList can display.
73
- * @providedPropType {function} searchForItems - a function to toggle a search inside items values
74
- * @providedPropType {boolean} isFromSearch - a boolean that says if the `items` props contains facet values from the global search or from the search inside items.
75
- * @providedPropType {boolean} canRefine - a boolean that says whether you can refine
76
- */
77
-
78
- var sortBy = ['isRefined', 'count:desc', 'name:asc'];
79
- export default createConnector({
80
- displayName: 'AlgoliaRefinementList',
81
- $$type: 'ais.refinementList',
82
- propTypes: {
83
- id: PropTypes.string,
84
- attribute: PropTypes.string.isRequired,
85
- operator: PropTypes.oneOf(['and', 'or']),
86
- showMore: PropTypes.bool,
87
- limit: PropTypes.number,
88
- showMoreLimit: PropTypes.number,
89
- defaultRefinement: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
90
- searchable: PropTypes.bool,
91
- transformItems: PropTypes.func,
92
- facetOrdering: PropTypes.bool
93
- },
94
- defaultProps: {
95
- operator: 'or',
96
- showMore: false,
97
- limit: 10,
98
- showMoreLimit: 20,
99
- facetOrdering: true
100
- },
101
- getProvidedProps: function getProvidedProps(props, searchState, searchResults, metadata, searchForFacetValuesResults) {
102
- var attribute = props.attribute,
103
- searchable = props.searchable,
104
- indexContextValue = props.indexContextValue,
105
- facetOrdering = props.facetOrdering;
106
- var results = getResults(searchResults, {
107
- ais: props.contextValue,
108
- multiIndexContext: props.indexContextValue
109
- });
110
- var canRefine = Boolean(results) && Boolean(results.getFacetByName(attribute));
111
- var isFromSearch = Boolean(searchForFacetValuesResults && searchForFacetValuesResults[attribute] && searchForFacetValuesResults.query !== '');
112
-
113
- // Search For Facet Values is not available with derived helper (used for multi index search)
114
- if (searchable && indexContextValue) {
115
- throw new Error('react-instantsearch: searching in *List is not available when used inside a' + ' multi index context');
116
- }
117
- if (!canRefine) {
118
- return {
119
- items: [],
120
- currentRefinement: getCurrentRefinement(props, searchState, {
121
- ais: props.contextValue,
122
- multiIndexContext: props.indexContextValue
123
- }),
124
- canRefine: canRefine,
125
- isFromSearch: isFromSearch,
126
- searchable: searchable
127
- };
128
- }
129
- var items = isFromSearch ? searchForFacetValuesResults[attribute].map(function (v) {
130
- return {
131
- label: v.value,
132
- value: getValue(v.escapedValue, props, searchState, {
133
- ais: props.contextValue,
134
- multiIndexContext: props.indexContextValue
135
- }),
136
- _highlightResult: {
137
- label: {
138
- value: v.highlighted
139
- }
140
- },
141
- count: v.count,
142
- isRefined: v.isRefined
143
- };
144
- }) : results.getFacetValues(attribute, {
145
- sortBy: sortBy,
146
- facetOrdering: facetOrdering
147
- }).map(function (v) {
148
- return {
149
- label: v.name,
150
- value: getValue(v.escapedValue, props, searchState, {
151
- ais: props.contextValue,
152
- multiIndexContext: props.indexContextValue
153
- }),
154
- count: v.count,
155
- isRefined: v.isRefined
156
- };
157
- });
158
- var transformedItems = props.transformItems ? props.transformItems(items) : items;
159
- return {
160
- items: transformedItems.slice(0, getLimit(props)),
161
- currentRefinement: getCurrentRefinement(props, searchState, {
162
- ais: props.contextValue,
163
- multiIndexContext: props.indexContextValue
164
- }),
165
- isFromSearch: isFromSearch,
166
- searchable: searchable,
167
- canRefine: transformedItems.length > 0
168
- };
169
- },
170
- refine: function refine(props, searchState, nextRefinement) {
171
- return _refine(props, searchState, nextRefinement, {
172
- ais: props.contextValue,
173
- multiIndexContext: props.indexContextValue
174
- });
175
- },
176
- searchForFacetValues: function searchForFacetValues(props, searchState, nextRefinement) {
177
- return {
178
- facetName: props.attribute,
179
- query: nextRefinement,
180
- maxFacetHits: getLimit(props)
181
- };
182
- },
183
- cleanUp: function cleanUp(props, searchState) {
184
- return _cleanUp(props, searchState, {
185
- ais: props.contextValue,
186
- multiIndexContext: props.indexContextValue
187
- });
188
- },
189
- getSearchParameters: function getSearchParameters(searchParameters, props, searchState) {
190
- var attribute = props.attribute,
191
- operator = props.operator;
192
- var addKey = operator === 'and' ? 'addFacet' : 'addDisjunctiveFacet';
193
- var addRefinementKey = "".concat(addKey, "Refinement");
194
- searchParameters = searchParameters.setQueryParameters({
195
- maxValuesPerFacet: Math.max(searchParameters.maxValuesPerFacet || 0, getLimit(props))
196
- });
197
- searchParameters = searchParameters[addKey](attribute);
198
- return getCurrentRefinement(props, searchState, {
199
- ais: props.contextValue,
200
- multiIndexContext: props.indexContextValue
201
- }).reduce(function (res, val) {
202
- return res[addRefinementKey](attribute, val);
203
- }, searchParameters);
204
- },
205
- getMetadata: function getMetadata(props, searchState) {
206
- var id = getId(props);
207
- var context = {
208
- ais: props.contextValue,
209
- multiIndexContext: props.indexContextValue
210
- };
211
- return {
212
- id: id,
213
- index: getIndexId(context),
214
- items: getCurrentRefinement(props, searchState, context).length > 0 ? [{
215
- attribute: props.attribute,
216
- label: "".concat(props.attribute, ": "),
217
- currentRefinement: getCurrentRefinement(props, searchState, context),
218
- value: function value(nextState) {
219
- return _refine(props, nextState, [], context);
220
- },
221
- items: getCurrentRefinement(props, searchState, context).map(function (item) {
222
- return {
223
- label: unescapeFacetValue("".concat(item)),
224
- value: function value(nextState) {
225
- var nextSelectedItems = getCurrentRefinement(props, nextState, context).filter(function (other) {
226
- return other !== item;
227
- });
228
- return _refine(props, searchState, nextSelectedItems, context);
229
- }
230
- };
231
- })
232
- }] : []
233
- };
234
- }
235
- });