@sledge-app/react-instant-search 0.0.61 → 0.0.63

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.
@@ -16,15 +16,6 @@ const LOCAL_STORAGE_KEY = {
16
16
  INSTANT_SEARCH_SETTING: "sledge-instant-search-setting"
17
17
  };
18
18
  const SEARCH_RESULT_URL = "/pages/search-result";
19
- const SEPARATE_COMPONENT_DISPLAY_NAME = {
20
- PRODUCT: {
21
- CARDS: "ProductCards"
22
- },
23
- SUGGESTION_KEYWORD_LISTS: "SuggestionKeywordLists",
24
- OTHER_INDEX_LISTS: "OtherIndexLists",
25
- SEARCH_VIEW_MORE_RESULT: "SearchViewMoreResult",
26
- WISHLIST_WIDGET_ALERT: "WishlistWidgetAlert"
27
- };
28
19
  const ELEMENT_ID = {
29
20
  PRODUCT_REVIEW: {
30
21
  ELEMENT_WIDGET: "product-review-widget"
@@ -2224,19 +2215,19 @@ const SearchIconWidget = (props) => {
2224
2215
  let searchViewMoreResultComponent = null;
2225
2216
  React__default.Children.map(children, (child) => {
2226
2217
  if (React__default.isValidElement(child) && isFunction(child.type)) {
2227
- const { component } = (child == null ? void 0 : child.props) || {};
2228
- switch (child.type.name) {
2229
- case SEPARATE_COMPONENT_DISPLAY_NAME.PRODUCT.CARDS:
2230
- productCardsComponent = component;
2218
+ const { productCard, suggestionKeywordList, otherIndexList, searchViewMoreResult } = (child == null ? void 0 : child.props) || {};
2219
+ switch (true) {
2220
+ case isFunction(productCard):
2221
+ productCardsComponent = productCard;
2231
2222
  break;
2232
- case SEPARATE_COMPONENT_DISPLAY_NAME.SUGGESTION_KEYWORD_LISTS:
2233
- suggestionKeywordListsComponent = component;
2223
+ case isFunction(suggestionKeywordList):
2224
+ suggestionKeywordListsComponent = suggestionKeywordList;
2234
2225
  break;
2235
- case SEPARATE_COMPONENT_DISPLAY_NAME.OTHER_INDEX_LISTS:
2236
- otherIndexListsComponent = component;
2226
+ case isFunction(otherIndexList):
2227
+ otherIndexListsComponent = otherIndexList;
2237
2228
  break;
2238
- case SEPARATE_COMPONENT_DISPLAY_NAME.SEARCH_VIEW_MORE_RESULT:
2239
- searchViewMoreResultComponent = component;
2229
+ case isFunction(searchViewMoreResult):
2230
+ searchViewMoreResultComponent = searchViewMoreResult;
2240
2231
  break;
2241
2232
  }
2242
2233
  }
@@ -2679,9 +2670,13 @@ const SearchResultWidget = (props) => {
2679
2670
  const { collectionId } = data || {};
2680
2671
  let productCardsComponent = null;
2681
2672
  React__default.Children.map(children, (child) => {
2682
- if (React__default.isValidElement(child) && isFunction(child.type) && child.type.name === SEPARATE_COMPONENT_DISPLAY_NAME.PRODUCT.CARDS) {
2683
- const { component } = (child == null ? void 0 : child.props) || {};
2684
- productCardsComponent = component;
2673
+ if (React__default.isValidElement(child) && isFunction(child.type)) {
2674
+ const { productCard } = (child == null ? void 0 : child.props) || {};
2675
+ switch (true) {
2676
+ case isFunction(productCard):
2677
+ productCardsComponent = productCard;
2678
+ break;
2679
+ }
2685
2680
  }
2686
2681
  });
2687
2682
  const [isFirstLoading, setIsFirstLoading] = React__default.useState(true);
@@ -3955,19 +3950,19 @@ const SearchWidget = (props) => {
3955
3950
  let searchViewMoreResultComponent = null;
3956
3951
  React__default.Children.map(children, (child) => {
3957
3952
  if (React__default.isValidElement(child) && isFunction(child.type)) {
3958
- const { component } = (child == null ? void 0 : child.props) || {};
3959
- switch (child.type.name) {
3960
- case SEPARATE_COMPONENT_DISPLAY_NAME.PRODUCT.CARDS:
3961
- productCardsComponent = component;
3953
+ const { productCard, suggestionKeywordList, otherIndexList, searchViewMoreResult } = (child == null ? void 0 : child.props) || {};
3954
+ switch (true) {
3955
+ case isFunction(productCard):
3956
+ productCardsComponent = productCard;
3962
3957
  break;
3963
- case SEPARATE_COMPONENT_DISPLAY_NAME.SUGGESTION_KEYWORD_LISTS:
3964
- suggestionKeywordListsComponent = component;
3958
+ case isFunction(suggestionKeywordList):
3959
+ suggestionKeywordListsComponent = suggestionKeywordList;
3965
3960
  break;
3966
- case SEPARATE_COMPONENT_DISPLAY_NAME.OTHER_INDEX_LISTS:
3967
- otherIndexListsComponent = component;
3961
+ case isFunction(otherIndexList):
3962
+ otherIndexListsComponent = otherIndexList;
3968
3963
  break;
3969
- case SEPARATE_COMPONENT_DISPLAY_NAME.SEARCH_VIEW_MORE_RESULT:
3970
- searchViewMoreResultComponent = component;
3964
+ case isFunction(searchViewMoreResult):
3965
+ searchViewMoreResultComponent = searchViewMoreResult;
3971
3966
  break;
3972
3967
  }
3973
3968
  }