@sentecacommerce-theme/lib 0.13.5-alpha.7 → 0.13.7-alpha.6

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 (233) hide show
  1. package/dist/cjs/analytics/Pixel/hooks/usePixelProductClick.js +1 -1
  2. package/dist/cjs/analytics/Pixel/hooks/usePixelProductDetails.js +1 -1
  3. package/dist/cjs/analytics/Pixel/hooks/usePixelProductsImpression.js +1 -1
  4. package/dist/cjs/analytics/Pixel/usePixel.js +1 -1
  5. package/dist/cjs/analytics/Releva/useReleva.js +1 -1
  6. package/dist/cjs/analytics/addToCart.js +0 -1
  7. package/dist/cjs/analytics/initiateCheckout.js +0 -1
  8. package/dist/cjs/analytics/viewContent.js +0 -1
  9. package/dist/cjs/api/myCartApi/index.js +2 -1
  10. package/dist/cjs/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
  11. package/dist/cjs/basket/api/index.js +37 -0
  12. package/dist/cjs/basket/api/mutations/index.js +37 -0
  13. package/dist/cjs/basket/api/mutations/useReplaceBasketMutation.js +58 -0
  14. package/dist/cjs/basket/hooks/index.js +52 -0
  15. package/dist/cjs/basket/hooks/useBasketCrossSaleItems.js +99 -0
  16. package/dist/cjs/basket/hooks/useReplaceBasket.js +10 -0
  17. package/dist/cjs/basket/index.js +37 -0
  18. package/dist/cjs/checkout/api/keys.js +8 -1
  19. package/dist/cjs/checkout/api/queries/index.js +15 -0
  20. package/dist/cjs/checkout/api/queries/useBnpCalculateForCartQuery.js +60 -0
  21. package/dist/cjs/checkout/hooks/index.js +15 -0
  22. package/dist/cjs/checkout/hooks/useBnpCalculateForCart.js +120 -0
  23. package/dist/cjs/components/Html/index.js +1 -1
  24. package/dist/cjs/components/Portal/index.js +1 -1
  25. package/dist/cjs/contexts/CheckoutForm/hooks/usePayment/index.js +7 -2
  26. package/dist/cjs/contexts/CheckoutForm/index.js +5 -3
  27. package/dist/cjs/hooks/ui-hooks/useIsDesktop/index.js +2 -2
  28. package/dist/cjs/hooks/useAllSelectedFilters/index.js +3 -3
  29. package/dist/cjs/hooks/useLineItem/index.js +7 -0
  30. package/dist/cjs/hooks/usePrice/index.js +1 -1
  31. package/dist/cjs/hooks/useProduct/index.js +26 -5
  32. package/dist/cjs/hooks/useProduct/utils/index.js +14 -1
  33. package/dist/cjs/hooks/useProgressBar/hooks/useGetSetState.js +1 -24
  34. package/dist/cjs/hooks/useSelectedFilters/index.js +3 -3
  35. package/dist/cjs/hooks/useVouchers/index.js +1 -2
  36. package/dist/cjs/index.js +24 -0
  37. package/dist/cjs/listing/api/queries/useAggregateQuery.js +47 -12
  38. package/dist/cjs/listing/api/queries/useInfiniteListing.js +4 -4
  39. package/dist/cjs/listing/api/queries/useListingQuery.js +37 -22
  40. package/dist/cjs/listing/api/queries/usePredicate.js +4 -4
  41. package/dist/cjs/listing/components/BasicListingSEO.js +1 -1
  42. package/dist/cjs/listing/hooks/useListingAlias.js +2 -4
  43. package/dist/cjs/listing/hooks/useListingBreadcrumbs.js +4 -4
  44. package/dist/cjs/listing/hooks/useListingCategories.js +7 -8
  45. package/dist/cjs/listing/hooks/useListingConfig.js +4 -5
  46. package/dist/cjs/listing/hooks/useListingFilters.js +19 -20
  47. package/dist/cjs/listing/hooks/useListingItems.js +2 -2
  48. package/dist/cjs/listing/hooks/useListingMeta.js +5 -4
  49. package/dist/cjs/listing/hooks/useListingPagination.js +4 -4
  50. package/dist/cjs/listing/hooks/useListingSlug.js +3 -1
  51. package/dist/cjs/listing/hooks/useSlideFilter.js +4 -3
  52. package/dist/cjs/listing/hooks/utils.js +2 -1
  53. package/dist/cjs/listing/ssr/prefetchListing.js +4 -4
  54. package/dist/cjs/listing/types.js +8 -1
  55. package/dist/cjs/listing/utils/buildCategoryQuery.js +16 -12
  56. package/dist/cjs/listing/utils/buildFilterQuery.js +5 -7
  57. package/dist/cjs/listing/utils/getListingAlias.js +5 -6
  58. package/dist/cjs/listing/utils/getListingPageType.js +4 -3
  59. package/dist/cjs/navigation/components/SearchBox/Components/Container/index.js +1 -1
  60. package/dist/cjs/navigation/components/SearchBox/Components/EmptyBox/index.js +19 -18
  61. package/dist/cjs/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
  62. package/dist/cjs/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -1
  63. package/dist/cjs/navigation/components/SearchBox/Components/Products/index.js +2 -2
  64. package/dist/cjs/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
  65. package/dist/cjs/navigation/components/SearchBox/index.js +11 -11
  66. package/dist/cjs/order/api/mutations/index.js +15 -0
  67. package/dist/cjs/order/api/mutations/useUpdateOrderCustomFieldMutation.js +15 -0
  68. package/dist/cjs/order/hooks/index.js +15 -0
  69. package/dist/cjs/order/hooks/useUpdateOrderCustomField.js +9 -0
  70. package/dist/cjs/product/api/keys.js +11 -0
  71. package/dist/cjs/product/api/queries/index.js +37 -0
  72. package/dist/cjs/product/api/queries/useBnpOffersQuery.js +64 -0
  73. package/dist/cjs/product/hooks/index.js +37 -0
  74. package/dist/cjs/product/hooks/useBnpOffers.js +89 -0
  75. package/dist/cjs/product/index.js +15 -0
  76. package/dist/cjs/seo/components/GlobalSEO/index.js +3 -3
  77. package/dist/cjs/user/api/queries/index.js +15 -0
  78. package/dist/cjs/user/api/queries/useGetMyLoyaltyCardQuery.js +21 -0
  79. package/dist/cjs/user/api/utils/getUserToken.js +16 -0
  80. package/dist/cjs/user/api/utils/index.js +12 -0
  81. package/dist/cjs/user/hooks/index.js +24 -0
  82. package/dist/cjs/user/hooks/useGetMyLoyaltyCard.js +9 -0
  83. package/dist/cjs/user/hooks/useGetUserToken.js +15 -0
  84. package/dist/esm/analytics/Pixel/hooks/usePixelProductClick.js +1 -1
  85. package/dist/esm/analytics/Pixel/hooks/usePixelProductDetails.js +1 -1
  86. package/dist/esm/analytics/Pixel/hooks/usePixelProductsImpression.js +1 -1
  87. package/dist/esm/analytics/Pixel/mainScript.js +0 -1
  88. package/dist/esm/analytics/Pixel/usePixel.js +1 -1
  89. package/dist/esm/analytics/Releva/useReleva.js +1 -1
  90. package/dist/esm/analytics/addToCart.js +0 -1
  91. package/dist/esm/analytics/initiateCheckout.js +0 -1
  92. package/dist/esm/analytics/pageView.js +1 -1
  93. package/dist/esm/analytics/viewContent.js +0 -1
  94. package/dist/esm/api/myCartApi/index.js +2 -1
  95. package/dist/esm/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
  96. package/dist/esm/basket/api/index.js +1 -0
  97. package/dist/esm/basket/api/mutations/index.js +1 -0
  98. package/dist/esm/basket/api/mutations/useReplaceBasketMutation.js +48 -0
  99. package/dist/esm/basket/hooks/index.js +2 -0
  100. package/dist/esm/basket/hooks/useBasketCrossSaleItems.js +67 -0
  101. package/dist/esm/basket/hooks/useReplaceBasket.js +2 -0
  102. package/dist/esm/basket/index.js +1 -0
  103. package/dist/esm/checkout/api/keys.js +6 -0
  104. package/dist/esm/checkout/api/queries/index.js +1 -0
  105. package/dist/esm/checkout/api/queries/useBnpCalculateForCartQuery.js +50 -0
  106. package/dist/esm/checkout/hooks/index.js +1 -0
  107. package/dist/esm/checkout/hooks/useBnpCalculateForCart.js +92 -0
  108. package/dist/esm/components/GoogleOneTap/index.js +1 -1
  109. package/dist/esm/components/Html/index.js +1 -1
  110. package/dist/esm/components/Portal/index.js +1 -1
  111. package/dist/esm/contexts/CheckoutForm/hooks/usePayment/index.js +7 -2
  112. package/dist/esm/contexts/CheckoutForm/index.js +5 -3
  113. package/dist/esm/hooks/ui-hooks/useIsDesktop/index.js +2 -2
  114. package/dist/esm/hooks/useAllSelectedFilters/index.js +4 -4
  115. package/dist/esm/hooks/useLineItem/index.js +2 -0
  116. package/dist/esm/hooks/usePrice/index.js +1 -1
  117. package/dist/esm/hooks/useProduct/index.js +27 -6
  118. package/dist/esm/hooks/useProduct/utils/index.js +13 -0
  119. package/dist/esm/hooks/useProgressBar/hooks/useGetSetState.js +1 -1
  120. package/dist/esm/hooks/useSelectedFilters/index.js +4 -4
  121. package/dist/esm/hooks/useVouchers/index.js +1 -2
  122. package/dist/esm/index.js +4 -0
  123. package/dist/esm/listing/api/queries/useAggregateQuery.js +47 -12
  124. package/dist/esm/listing/api/queries/useInfiniteListing.js +4 -4
  125. package/dist/esm/listing/api/queries/useListingQuery.js +37 -22
  126. package/dist/esm/listing/api/queries/usePredicate.js +4 -4
  127. package/dist/esm/listing/components/BasicListingSEO.js +1 -1
  128. package/dist/esm/listing/hooks/useListingAlias.js +2 -4
  129. package/dist/esm/listing/hooks/useListingBreadcrumbs.js +5 -5
  130. package/dist/esm/listing/hooks/useListingCategories.js +8 -9
  131. package/dist/esm/listing/hooks/useListingConfig.js +5 -6
  132. package/dist/esm/listing/hooks/useListingFilters.js +19 -20
  133. package/dist/esm/listing/hooks/useListingItems.js +2 -2
  134. package/dist/esm/listing/hooks/useListingMeta.js +6 -5
  135. package/dist/esm/listing/hooks/useListingPagination.js +4 -4
  136. package/dist/esm/listing/hooks/useListingSlug.js +3 -1
  137. package/dist/esm/listing/hooks/useSlideFilter.js +5 -4
  138. package/dist/esm/listing/hooks/utils.js +2 -1
  139. package/dist/esm/listing/ssr/prefetchListing.js +4 -4
  140. package/dist/esm/listing/types.js +7 -0
  141. package/dist/esm/listing/utils/buildCategoryQuery.js +16 -12
  142. package/dist/esm/listing/utils/buildFilterQuery.js +5 -7
  143. package/dist/esm/listing/utils/getListingAlias.js +5 -6
  144. package/dist/esm/listing/utils/getListingPageType.js +4 -3
  145. package/dist/esm/navigation/components/SearchBox/Components/Container/index.js +1 -1
  146. package/dist/esm/navigation/components/SearchBox/Components/EmptyBox/index.js +19 -18
  147. package/dist/esm/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
  148. package/dist/esm/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -1
  149. package/dist/esm/navigation/components/SearchBox/Components/Products/index.js +2 -2
  150. package/dist/esm/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
  151. package/dist/esm/navigation/components/SearchBox/index.js +11 -11
  152. package/dist/esm/order/api/mutations/index.js +1 -0
  153. package/dist/esm/order/api/mutations/useUpdateOrderCustomFieldMutation.js +10 -0
  154. package/dist/esm/order/hooks/index.js +1 -0
  155. package/dist/esm/order/hooks/useUpdateOrderCustomField.js +4 -0
  156. package/dist/esm/product/api/keys.js +6 -0
  157. package/dist/esm/product/api/queries/index.js +1 -0
  158. package/dist/esm/product/api/queries/useBnpOffersQuery.js +54 -0
  159. package/dist/esm/product/hooks/index.js +1 -0
  160. package/dist/esm/product/hooks/useBnpOffers.js +84 -0
  161. package/dist/esm/product/index.js +1 -0
  162. package/dist/esm/seo/components/GlobalSEO/index.js +3 -3
  163. package/dist/esm/user/api/queries/index.js +1 -0
  164. package/dist/esm/user/api/queries/useGetMyLoyaltyCardQuery.js +16 -0
  165. package/dist/esm/user/api/utils/getUserToken.js +6 -0
  166. package/dist/esm/user/api/utils/index.js +1 -0
  167. package/dist/esm/user/hooks/index.js +2 -0
  168. package/dist/esm/user/hooks/useGetMyLoyaltyCard.js +4 -0
  169. package/dist/esm/user/hooks/useGetUserToken.js +5 -0
  170. package/dist/types/api/myCartApi/index.d.ts +1 -0
  171. package/dist/types/basket/api/index.d.ts +1 -0
  172. package/dist/types/basket/api/mutations/index.d.ts +1 -0
  173. package/dist/types/basket/api/mutations/useReplaceBasketMutation.d.ts +2 -0
  174. package/dist/types/basket/hooks/index.d.ts +2 -0
  175. package/dist/types/basket/hooks/useBasketCrossSaleItems.d.ts +9 -0
  176. package/dist/types/basket/hooks/useReplaceBasket.d.ts +2 -0
  177. package/dist/types/basket/index.d.ts +1 -0
  178. package/dist/types/checkout/api/keys.d.ts +1 -0
  179. package/dist/types/checkout/api/queries/index.d.ts +1 -0
  180. package/dist/types/checkout/api/queries/useBnpCalculateForCartQuery.d.ts +4 -0
  181. package/dist/types/checkout/hooks/index.d.ts +1 -0
  182. package/dist/types/checkout/hooks/useBnpCalculateForCart.d.ts +39 -0
  183. package/dist/types/contexts/CheckoutForm/hooks/usePayment/index.d.ts +2 -0
  184. package/dist/types/contexts/CheckoutForm/index.d.ts +2 -1
  185. package/dist/types/hooks/order-hooks/useReferralOrders/index.d.ts +1 -0
  186. package/dist/types/hooks/useLineItem/index.d.ts +2 -2
  187. package/dist/types/hooks/useProduct/index.d.ts +1 -0
  188. package/dist/types/hooks/useProduct/utils/index.d.ts +1 -0
  189. package/dist/types/index.d.ts +3 -0
  190. package/dist/types/listing/api/queries/useAggregateQuery.d.ts +6 -4
  191. package/dist/types/listing/api/queries/useListingQuery.d.ts +4 -2
  192. package/dist/types/listing/api/queries/usePredicate.d.ts +2 -1
  193. package/dist/types/listing/hooks/useListingAlias.d.ts +2 -1
  194. package/dist/types/listing/hooks/useListingFilters.d.ts +0 -1
  195. package/dist/types/listing/hooks/useListingItems.d.ts +3 -2
  196. package/dist/types/listing/hooks/useListingSEOCategories.d.ts +6 -4
  197. package/dist/types/listing/hooks/utils.d.ts +3 -2
  198. package/dist/types/listing/ssr/prefetchCategories.d.ts +2 -2
  199. package/dist/types/listing/ssr/prefetchListing.d.ts +4 -4
  200. package/dist/types/listing/ssr/prefetchPredicate.d.ts +2 -1
  201. package/dist/types/listing/types.d.ts +32 -16
  202. package/dist/types/listing/utils/buildCategoryQuery.d.ts +2 -1
  203. package/dist/types/listing/utils/buildFilterQuery.d.ts +2 -1
  204. package/dist/types/listing/utils/extendFilter.d.ts +3 -2
  205. package/dist/types/listing/utils/getListingAlias.d.ts +2 -1
  206. package/dist/types/listing/utils/getListingPageType.d.ts +2 -2
  207. package/dist/types/navigation/components/SearchBox/Components/Container/index.d.ts +10 -9
  208. package/dist/types/navigation/components/SearchBox/Components/EmptyBox/index.d.ts +22 -21
  209. package/dist/types/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.d.ts +8 -7
  210. package/dist/types/navigation/components/SearchBox/Components/Products/index.d.ts +9 -8
  211. package/dist/types/navigation/components/SearchBox/index.d.ts +31 -30
  212. package/dist/types/order/api/mutations/index.d.ts +1 -0
  213. package/dist/types/order/api/mutations/useUpdateCustomLineItemMutation.d.ts +2 -5
  214. package/dist/types/order/api/mutations/useUpdateOrderCustomFieldMutation.d.ts +9 -0
  215. package/dist/types/order/hooks/index.d.ts +1 -0
  216. package/dist/types/order/hooks/useUpdateCustomLineItem.d.ts +2 -2
  217. package/dist/types/order/hooks/useUpdateOrderCustomField.d.ts +2 -0
  218. package/dist/types/product/api/keys.d.ts +1 -0
  219. package/dist/types/product/api/queries/index.d.ts +1 -0
  220. package/dist/types/product/api/queries/useBnpOffersQuery.d.ts +5 -0
  221. package/dist/types/product/hooks/index.d.ts +1 -0
  222. package/dist/types/product/hooks/useBnpOffers.d.ts +37 -0
  223. package/dist/types/product/index.d.ts +1 -0
  224. package/dist/types/types/index.d.ts +38 -40
  225. package/dist/types/user/api/queries/index.d.ts +1 -0
  226. package/dist/types/user/api/queries/useGetMyLoyaltyCardQuery.d.ts +5 -0
  227. package/dist/types/user/api/utils/getUserToken.d.ts +1 -0
  228. package/dist/types/user/api/utils/index.d.ts +1 -0
  229. package/dist/types/user/hooks/index.d.ts +2 -0
  230. package/dist/types/user/hooks/useGetMyLoyaltyCard.d.ts +2 -0
  231. package/dist/types/user/hooks/useGetUserToken.d.ts +1 -0
  232. package/dist/types/utils/getSelectedFilters.d.ts +2 -1
  233. package/package.json +19 -13
@@ -7,7 +7,6 @@ import { useListingSlug } from './useListingSlug';
7
7
  import { stripQueryProps } from '../../utils/generateQueryFromRouter';
8
8
  import { typeToSuffix } from '../../utils/typeToSuffix';
9
9
  import { getSelectedFilters } from '../../utils';
10
- import { useConfigState } from '../../index';
11
10
  function _arrayWithHoles(arr) {
12
11
  if (Array.isArray(arr)) return arr;
13
12
  }
@@ -71,19 +70,19 @@ function _slicedToArray(arr, i) {
71
70
  var ListingFiltersStateContext = /*#__PURE__*/ React.createContext(undefined);
72
71
  export function ListingFiltersProvider(param) {
73
72
  var children = param.children;
74
- var ref = useListingConfig(), aggregates = ref.aggregates, pageType = ref.type;
75
- var ref1 = useAggregateQuery(aggregates, AggregateRequestEnum.Filters), aggData = ref1.data, isLoading = ref1.isLoading, isFetching = ref1.isFetching;
76
- var config = useConfigState();
73
+ var ref3 = useListingConfig(), aggregates = ref3.aggregates, pageType = ref3.type, attributeSortType = ref3.attributeSortType, meta = ref3.meta;
74
+ var ref1 = useAggregateQuery(aggregates, AggregateRequestEnum.Filters, attributeSortType), aggData = ref1.data, isLoading = ref1.isLoading, isFetching = ref1.isFetching;
77
75
  var router = useRouter();
78
76
  var slug = useListingSlug();
79
77
  var data = React.useMemo(function() {
80
78
  if (!isLoading && aggData) {
81
79
  var result = aggregates === null || aggregates === void 0 ? void 0 : aggregates.sort(function(a, b) {
82
- return a.order - b.order;
80
+ return Number(a.order) - Number(b.order);
83
81
  }).map(function(currentAggregate) {
84
- var type = currentAggregate.aggregationType.toString();
85
- var term = currentAggregate.aggregationDefinition.split(':')[0];
86
- var filter = currentAggregate.filterDefinition;
82
+ var ref, ref2;
83
+ var type = (currentAggregate === null || currentAggregate === void 0 ? void 0 : (ref = currentAggregate.aggregationType) === null || ref === void 0 ? void 0 : ref.toString()) || '';
84
+ var term = (currentAggregate === null || currentAggregate === void 0 ? void 0 : (ref2 = currentAggregate.aggregationDefinition) === null || ref2 === void 0 ? void 0 : ref2.split(':')[0]) || '';
85
+ var filter = (currentAggregate === null || currentAggregate === void 0 ? void 0 : currentAggregate.filterDefinition) || '';
87
86
  var current = aggData[type].find(function(agg) {
88
87
  return agg.name === term;
89
88
  });
@@ -135,7 +134,7 @@ export function ListingFiltersProvider(param) {
135
134
  });
136
135
  };
137
136
  var selectedFilters = React.useMemo(function() {
138
- return getSelectedFilters(router, slug, data, config);
137
+ return getSelectedFilters(router, slug, data, meta);
139
138
  }, [
140
139
  router,
141
140
  data
@@ -159,10 +158,10 @@ export function useListingFilters() {
159
158
  }
160
159
  function generateFilters(param) {
161
160
  var rawFilters = param.rawFilters, type = param.type, filter = param.filter, slug = param.slug, router = param.router, pageType = param.pageType;
162
- var ref, ref2;
163
- return (ref2 = (ref = rawFilters.results) === null || ref === void 0 ? void 0 : ref.filter(function(res) {
161
+ var ref, ref4;
162
+ return (ref4 = (ref = rawFilters.results) === null || ref === void 0 ? void 0 : ref.filter(function(res) {
164
163
  return res.count > 0;
165
- })) === null || ref2 === void 0 ? void 0 : ref2.map(function(currentTerm) {
164
+ })) === null || ref4 === void 0 ? void 0 : ref4.map(function(currentTerm) {
166
165
  var filterKey = mapKey(currentTerm, type);
167
166
  var selected = isFilterSelected(router, filter, filterKey, filtersOperatorsMap[type]);
168
167
  return {
@@ -180,11 +179,11 @@ function generateFilters(param) {
180
179
  });
181
180
  }
182
181
  var isFilterSelected = function(router, filter, filterKey, type) {
183
- var ref, ref3, ref4, ref5, ref6;
182
+ var ref, ref5, ref6, ref7, ref8;
184
183
  var areFiltersArray = Array.isArray((ref = router.query) === null || ref === void 0 ? void 0 : ref.filter);
185
- return areFiltersArray ? !!((ref4 = (ref3 = router.query.filter) === null || ref3 === void 0 ? void 0 : ref3.find(function(sel) {
184
+ return areFiltersArray ? !!((ref6 = (ref5 = router.query.filter) === null || ref5 === void 0 ? void 0 : ref5.find(function(sel) {
186
185
  return sel.includes("".concat(filter, ";").concat(type));
187
- })) === null || ref4 === void 0 ? void 0 : ref4.includes(filterKey)) : ((ref5 = router.query.filter) === null || ref5 === void 0 ? void 0 : ref5.includes("".concat(filter, ";").concat(type))) && ((ref6 = router.query.filter) === null || ref6 === void 0 ? void 0 : ref6.includes(filterKey));
186
+ })) === null || ref6 === void 0 ? void 0 : ref6.includes(filterKey)) : ((ref7 = router.query.filter) === null || ref7 === void 0 ? void 0 : ref7.includes("".concat(filter, ";").concat(type))) && ((ref8 = router.query.filter) === null || ref8 === void 0 ? void 0 : ref8.includes(filterKey));
188
187
  };
189
188
  export var filtersOperatorsMap = {
190
189
  ranges: 'range',
@@ -213,12 +212,12 @@ var generateQueryString = function(query, pair, remove) {
213
212
  var extractFilter = function(param) {
214
213
  var _str = param.str, str = _str === void 0 ? '' : _str, aggPair = param.aggPair;
215
214
  var ref = _slicedToArray(str.split(';'), 3), type = ref[0], operator = ref[1], val = ref[2];
216
- var ref7;
217
- var filterType = (ref7 = aggPair === null || aggPair === void 0 ? void 0 : aggPair.aggType) !== null && ref7 !== void 0 ? ref7 : type;
218
- var ref8;
219
- var filterVal = (ref8 = aggPair === null || aggPair === void 0 ? void 0 : aggPair.aggKey) !== null && ref8 !== void 0 ? ref8 : val;
220
215
  var ref9;
221
- var filterOperator = (ref9 = aggPair === null || aggPair === void 0 ? void 0 : aggPair.aggOperator) !== null && ref9 !== void 0 ? ref9 : operator;
216
+ var filterType = (ref9 = aggPair === null || aggPair === void 0 ? void 0 : aggPair.aggType) !== null && ref9 !== void 0 ? ref9 : type;
217
+ var ref10;
218
+ var filterVal = (ref10 = aggPair === null || aggPair === void 0 ? void 0 : aggPair.aggKey) !== null && ref10 !== void 0 ? ref10 : val;
219
+ var ref11;
220
+ var filterOperator = (ref11 = aggPair === null || aggPair === void 0 ? void 0 : aggPair.aggOperator) !== null && ref11 !== void 0 ? ref11 : operator;
222
221
  if (activeFilters[filterType]) {
223
222
  activeFilters[filterType] += ",".concat(filterVal);
224
223
  } else {
@@ -5,7 +5,7 @@ export var useListingItems = function() {
5
5
  var config = useListingConfig();
6
6
  var ref1 = useListingQuery(), data = ref1.data, isLoading = ref1.isLoading, isFetching = ref1.isFetching;
7
7
  var generatePlaceholders = function(products) {
8
- return new Array(products !== null && products !== void 0 ? products : 24).fill(null).map(function(_, i) {
8
+ return new Array(products || 24).fill(null).map(function(_, i) {
9
9
  return {
10
10
  _id: "".concat(i),
11
11
  isPlaceholder: true
@@ -15,7 +15,7 @@ export var useListingItems = function() {
15
15
  var result = React.useMemo(function() {
16
16
  var ref;
17
17
  return {
18
- items: !(data === null || data === void 0 ? void 0 : data.results) ? generatePlaceholders(config.productsPerPage) : data === null || data === void 0 ? void 0 : data.results,
18
+ items: !(data === null || data === void 0 ? void 0 : data.results) ? generatePlaceholders(config.meta.limit || 24) : data === null || data === void 0 ? void 0 : data.results,
19
19
  total: (ref = data === null || data === void 0 ? void 0 : data.total) !== null && ref !== void 0 ? ref : 0,
20
20
  didYouMean: data === null || data === void 0 ? void 0 : data.didYouMean,
21
21
  isLoading: isLoading,
@@ -5,9 +5,10 @@ import { assetsFieldsToMap } from '../../utils/assetsToMap';
5
5
  import { useRouter } from 'next/router';
6
6
  import { getListingPageType } from '../utils';
7
7
  import { ListingTypesEnum } from '../types';
8
- import { useListingAlias, useConfigState } from '../../index';
8
+ import { useListingAlias } from '../../index';
9
9
  import { useListingFilters } from './useListingFilters';
10
10
  import { useListingCategories } from './useListingCategories';
11
+ import { useListingConfig } from '.';
11
12
  function _arrayWithoutHoles(arr) {
12
13
  if (Array.isArray(arr)) {
13
14
  for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++){
@@ -31,14 +32,14 @@ export var useListingMeta = function() {
31
32
  var ref1 = useListingQuery(), listingQuery = ref1.data;
32
33
  var ref2 = useListingCategories(), categoriesData = ref2.data;
33
34
  var ref3 = useListingFilters(), filtersData = ref3.data;
34
- var slug = useListingAlias().slug;
35
- var config = useConfigState();
35
+ var meta = useListingConfig().meta;
36
+ var slug = useListingAlias(meta).slug;
36
37
  var result = React.useMemo(function() {
37
38
  var ref;
38
39
  var customFields = customFieldsToMap(predicate === null || predicate === void 0 ? void 0 : predicate.custom);
39
40
  var assets = assetsFieldsToMap(predicate === null || predicate === void 0 ? void 0 : predicate.assets);
40
41
  var description = ((ref = getTranslatableField(predicate === null || predicate === void 0 ? void 0 : predicate.description)) === null || ref === void 0 ? void 0 : ref.trim()) || '';
41
- var displayName = processDisplayName(slug, config, predicate === null || predicate === void 0 ? void 0 : predicate.name, predicate === null || predicate === void 0 ? void 0 : predicate.breadcrumb, router, filtersData, categoriesData);
42
+ var displayName = processDisplayName(slug, meta, predicate === null || predicate === void 0 ? void 0 : predicate.name, predicate === null || predicate === void 0 ? void 0 : predicate.breadcrumb, router, filtersData, categoriesData);
42
43
  return {
43
44
  displayName: displayName,
44
45
  description: description,
@@ -76,7 +77,7 @@ function processDisplayName(slug, config, name, breadcrumb, router, aggData, cat
76
77
  var categoryName = getCategoryName(router, categoriesData);
77
78
  var type = getListingPageType(router, slug, config);
78
79
  if (type === ListingTypesEnum.AttrPage) {
79
- return "Всичко за ".concat(config.listing.titleAliases[slug]);
80
+ return "Всичко за ".concat(config.titleAliases[slug]);
80
81
  }
81
82
  if (router === null || router === void 0 ? void 0 : router.query.cat) {
82
83
  var attribute = getTranslatableField(breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.label);
@@ -39,17 +39,17 @@ export var useListingPagination = function() {
39
39
  var slug = useListingSlug();
40
40
  var ref = useListingQuery(), data = ref.data, isLoading = ref.isLoading;
41
41
  var result = React.useMemo(function() {
42
- var _productsPerPage;
42
+ var _limit;
43
43
  return {
44
44
  pagination: getPagination(data === null || data === void 0 ? void 0 : data.total, generateQueryFromRouter(_objectSpread({
45
- limit: (_productsPerPage = config.productsPerPage) !== null && _productsPerPage !== void 0 ? _productsPerPage : 24,
45
+ limit: (_limit = config.meta.limit) !== null && _limit !== void 0 ? _limit : 24,
46
46
  sort: router.query.sort
47
- }, router.query)), config.defaultSortKey),
47
+ }, router.query)), config.defaultSortKey || 'defaultSort'),
48
48
  query: generateQuery(router, slug)
49
49
  };
50
50
  }, [
51
51
  config.defaultSortKey,
52
- config.productsPerPage,
52
+ config.meta.limit,
53
53
  data === null || data === void 0 ? void 0 : data.total,
54
54
  router,
55
55
  slug
@@ -1,9 +1,11 @@
1
1
  import { useRouter } from 'next/router';
2
+ import { useListingConfig } from '.';
2
3
  import { useListingAlias } from '../index';
3
4
  import { getSlug } from '../utils';
4
5
  export var useListingSlug = function() {
5
6
  var router = useRouter();
6
- var ref = useListingAlias(), aliasedSlug = ref.slug;
7
+ var meta = useListingConfig().meta;
8
+ var ref = useListingAlias(meta), aliasedSlug = ref.slug;
7
9
  var slug = getSlug(router, aliasedSlug);
8
10
  return slug;
9
11
  };
@@ -3,7 +3,8 @@ import { useRouter } from 'next/router';
3
3
  import { createAggregateQuery } from '../../utils';
4
4
  import { getListingPageType } from '../utils';
5
5
  import { filtersOperatorsMap } from './useListingFilters';
6
- import { useListingAlias, useConfigState } from '../../index';
6
+ import { useListingAlias } from '../../index';
7
+ import { useListingConfig } from '.';
7
8
  function _arrayWithHoles(arr) {
8
9
  if (Array.isArray(arr)) return arr;
9
10
  }
@@ -38,8 +39,8 @@ function _slicedToArray(arr, i) {
38
39
  export var useSlideFilter = function(filterName, min, max) {
39
40
  var ref;
40
41
  var router = useRouter();
41
- var slug = useListingAlias().slug;
42
- var config = useConfigState();
42
+ var meta = useListingConfig().meta;
43
+ var slug = useListingAlias(meta).slug;
43
44
  var allFilters = router.query.filter;
44
45
  var filterQuery = "".concat(filterName, ";range;");
45
46
  var getFilter = function() {
@@ -66,7 +67,7 @@ export var useSlideFilter = function(filterName, min, max) {
66
67
  var formattedTo = Math.max(data.from, Math.min(data.to, max));
67
68
  clearTimeout(timeoutRef.current);
68
69
  timeoutRef.current = setTimeout(function() {
69
- router.push(createAggregateQuery(getListingPageType(router, slug, config), router.query.slug, {
70
+ router.push(createAggregateQuery(getListingPageType(router, slug, meta), router.query.slug, {
70
71
  aggType: filterName,
71
72
  aggKey: "".concat(formattedFrom, ",").concat(formattedTo),
72
73
  aggOperator: filtersOperatorsMap.stats
@@ -6,7 +6,8 @@ export function processCategoriesResponse(response, type, term) {
6
6
  return result;
7
7
  }
8
8
  export function getAggregateTypeAndTerm(aggregates) {
9
- var type = aggregates === null || aggregates === void 0 ? void 0 : aggregates.aggregationType.toString();
9
+ var ref;
10
+ var type = (aggregates === null || aggregates === void 0 ? void 0 : (ref = aggregates.aggregationType) === null || ref === void 0 ? void 0 : ref.toString()) || '';
10
11
  var term = aggregates === null || aggregates === void 0 ? void 0 : aggregates.aggregationDefinition;
11
12
  return {
12
13
  type: type,
@@ -36,11 +36,11 @@ export function prefetchListing(_) {
36
36
  }
37
37
  function _prefetchListing() {
38
38
  _prefetchListing = _asyncToGenerator(regeneratorRuntime.mark(function _callee(param) {
39
- var queryCache, router, predicate, config, ref, aliasedSlug, type, postFilter, ref1, ref2, sort, _limit, limit, offset, queryKeys, data;
39
+ var queryCache, router, predicate, config, defaultSortKey, ref, aliasedSlug, type, postFilter, ref1, ref2, sort, ref3, limit, offset, queryKeys, data;
40
40
  return regeneratorRuntime.wrap(function _callee$(_ctx) {
41
41
  while(1)switch(_ctx.prev = _ctx.next){
42
42
  case 0:
43
- queryCache = param.queryCache, router = param.router, predicate = param.predicate, config = param.config;
43
+ queryCache = param.queryCache, router = param.router, predicate = param.predicate, config = param.config, defaultSortKey = param.defaultSortKey;
44
44
  ;
45
45
  aliasedSlug = getListingAlias({
46
46
  router: router,
@@ -49,9 +49,9 @@ function _prefetchListing() {
49
49
  type = getListingPageType(router, aliasedSlug, config);
50
50
  postFilter = getPostFilters(router);
51
51
  ;
52
- sort = (ref2 = (ref1 = router.query.sort) !== null && ref1 !== void 0 ? ref1 : config === null || config === void 0 ? void 0 : config.listing.defaultSortKey) !== null && ref2 !== void 0 ? ref2 : 'defaultSort';
52
+ sort = (ref2 = (ref1 = router.query.sort) !== null && ref1 !== void 0 ? ref1 : defaultSortKey) !== null && ref2 !== void 0 ? ref2 : 'defaultSort';
53
53
  ;
54
- limit = !!router.query.limit ? Number(router.query.limit) : (_limit = config === null || config === void 0 ? void 0 : config.listing.limit) !== null && _limit !== void 0 ? _limit : 24;
54
+ limit = !!router.query.limit ? Number(router.query.limit) : (ref3 = config === null || config === void 0 ? void 0 : config.limit) !== null && ref3 !== void 0 ? ref3 : 24;
55
55
  offset = calculateOffset((ref = router.query) === null || ref === void 0 ? void 0 : ref.page, limit);
56
56
  queryKeys = getListingQueryKeys({
57
57
  type: type,
@@ -1,3 +1,10 @@
1
+ var AggregateSortEnum1;
2
+ export { AggregateSortEnum1 as AggregateSortEnum, };
3
+ (function(AggregateSortEnum) {
4
+ AggregateSortEnum["Index"] = 'index';
5
+ AggregateSortEnum["Alphabetically"] = 'alphabetically';
6
+ })(AggregateSortEnum1 || (AggregateSortEnum1 = {
7
+ }));
1
8
  var ListingTypesEnum1;
2
9
  export { ListingTypesEnum1 as ListingTypesEnum, };
3
10
  (function(ListingTypesEnum) {
@@ -32,14 +32,13 @@ function _objectSpread(target) {
32
32
  var _obj;
33
33
  export var buildCategoryQuery = function(param) {
34
34
  var aggregates = param.aggregates, predicate = param.predicate, postFilter = param.postFilter, pageType = param.pageType, config = param.config, router = param.router, slug = param.slug;
35
- var ref, ref1;
36
- var type = aggregates === null || aggregates === void 0 ? void 0 : (ref = aggregates[0]) === null || ref === void 0 ? void 0 : ref.aggregationType;
37
- var term = aggregates === null || aggregates === void 0 ? void 0 : (ref1 = aggregates[0]) === null || ref1 === void 0 ? void 0 : ref1.aggregationDefinition;
35
+ var ref2, ref1;
36
+ var type = (aggregates === null || aggregates === void 0 ? void 0 : (ref2 = aggregates[0]) === null || ref2 === void 0 ? void 0 : ref2.aggregationType) || '';
37
+ var term = (aggregates === null || aggregates === void 0 ? void 0 : (ref1 = aggregates[0]) === null || ref1 === void 0 ? void 0 : ref1.aggregationDefinition) || '';
38
38
  var aggValue = getAggValue({
39
39
  id: predicate === null || predicate === void 0 ? void 0 : predicate._id,
40
40
  term: term
41
41
  });
42
- var listingConfig = config === null || config === void 0 ? void 0 : config.listing;
43
42
  var getFilters = function() {
44
43
  var filter = '';
45
44
  switch(pageType){
@@ -49,14 +48,19 @@ export var buildCategoryQuery = function(param) {
49
48
  }));
50
49
  if (router.query.cat) filter += extendFilter({
51
50
  slug: slug,
52
- filterExtension: listingConfig === null || listingConfig === void 0 ? void 0 : listingConfig.filterExtension
51
+ filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension
53
52
  });
54
53
  break;
55
54
  case ListingTypesEnum.Category:
56
- if (router.query.cat) filter += extendFilter({
57
- slug: slug,
58
- filterExtension: listingConfig === null || listingConfig === void 0 ? void 0 : listingConfig.filterExtension
59
- });
55
+ if (router.query.cat) {
56
+ filter += extendFilter({
57
+ slug: slug,
58
+ filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension
59
+ });
60
+ } else {
61
+ var ref;
62
+ filter += (ref = config === null || config === void 0 ? void 0 : config.filterExtension) !== null && ref !== void 0 ? ref : '';
63
+ }
60
64
  if (postFilter) {
61
65
  if (router.query.cat) filter += '&';
62
66
  filter += postFilter;
@@ -65,7 +69,7 @@ export var buildCategoryQuery = function(param) {
65
69
  case ListingTypesEnum.AttrPage:
66
70
  filter += extendFilter({
67
71
  slug: slug,
68
- filterExtension: listingConfig === null || listingConfig === void 0 ? void 0 : listingConfig.filterExtension
72
+ filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension
69
73
  });
70
74
  if (postFilter) filter += "&".concat(postFilter);
71
75
  break;
@@ -76,14 +80,14 @@ export var buildCategoryQuery = function(param) {
76
80
  if (postFilter) filter += "&".concat(postFilter);
77
81
  break;
78
82
  default:
79
- return "".concat((listingConfig === null || listingConfig === void 0 ? void 0 : listingConfig.filterExtension) + "".concat(postFilter !== null && postFilter !== void 0 ? postFilter : ''));
83
+ return "".concat((config === null || config === void 0 ? void 0 : config.filterExtension) + "".concat(postFilter !== null && postFilter !== void 0 ? postFilter : ''));
80
84
  }
81
85
  return filter;
82
86
  };
83
87
  var query = (_obj = {
84
88
  }, _defineProperty(_obj, type, aggValue), _defineProperty(_obj, "filter", getFilters()), _obj);
85
89
  if (pageType === ListingTypesEnum.Collection) {
86
- var collapseMode = listingConfig === null || listingConfig === void 0 ? void 0 : listingConfig.collapseMode;
90
+ var collapseMode = config === null || config === void 0 ? void 0 : config.collapseMode;
87
91
  query = _objectSpread({
88
92
  }, query, {
89
93
  collapseMode: collapseMode
@@ -66,20 +66,17 @@ export var buildFilterQuery = function(param) {
66
66
  var ref;
67
67
  var query = (predicate === null || predicate === void 0 ? void 0 : predicate.filters) || (predicate === null || predicate === void 0 ? void 0 : predicate._id) || slug;
68
68
  var queryType = pageType === ListingTypesEnum.Search ? 'text' : pageType;
69
- var filterExtension, collapseMode;
70
- if (config.listing) {
71
- filterExtension = config.listing.filterExtension;
72
- collapseMode = config.listing.collapseMode;
73
- }
69
+ var ref1 = config || {
70
+ }, filterExtension = ref1.filterExtension, collapseMode = ref1.collapseMode;
74
71
  var filter = '';
75
72
  if (pageType === ListingTypesEnum.AttrPage) {
76
- var ref1 = _slicedToArray(getAttributePageType(router, slug), 2), type = ref1[0], val = ref1[1];
73
+ var ref2 = _slicedToArray(getAttributePageType(router, slug), 2), type = ref2[0], val = ref2[1];
77
74
  filter = "attr.".concat(type, ";eq;\"").concat(val, "\"");
78
75
  } else {
79
76
  filter = "".concat(queryType, ";eq;\"").concat(query, "\"");
80
77
  }
81
78
  if (router.query.cat) {
82
- var ref2 = _slicedToArray(getAttributePageType(router, slug), 2), type1 = ref2[0], val1 = ref2[1];
79
+ var ref3 = _slicedToArray(getAttributePageType(router, slug), 2), type1 = ref3[0], val1 = ref3[1];
83
80
  filter += "&attr.".concat(type1, ";eq;").concat(val1);
84
81
  }
85
82
  if (pageType === ListingTypesEnum.View) {
@@ -93,6 +90,7 @@ export var buildFilterQuery = function(param) {
93
90
  var aggregatesMap = aggregates === null || aggregates === void 0 ? void 0 : aggregates.reduce(function(map, agg) {
94
91
  var aggregateType = agg.aggregationType;
95
92
  var aggregationTerm = agg.aggregationDefinition;
93
+ if (!aggregateType) return map;
96
94
  if (map[aggregateType]) {
97
95
  return _objectSpread({
98
96
  }, map, _defineProperty({
@@ -31,15 +31,15 @@ function _slicedToArray(arr, i) {
31
31
  }
32
32
  export var getListingAlias = function(param) {
33
33
  var router = param.router, config = param.config;
34
- var ref;
35
34
  var query = router.query;
36
- if (!(config === null || config === void 0 ? void 0 : (ref = config.listing) === null || ref === void 0 ? void 0 : ref.slugAliases)) return query.slug;
37
- var _listing = config.listing, aliases = _listing.slugAliases;
35
+ if (!(config === null || config === void 0 ? void 0 : config.slugAliases)) return query.slug;
36
+ var aliases = config.slugAliases;
38
37
  var slugMap = {
39
38
  };
40
39
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
41
40
  try {
42
- for(var _iterator = Object.entries(aliases)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
41
+ for(var _iterator = Object.entries(aliases || {
42
+ })[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
43
43
  var _value = _slicedToArray(_step.value, 2), path = _value[0], alias = _value[1];
44
44
  slugMap[alias] = path;
45
45
  }
@@ -57,6 +57,5 @@ export var getListingAlias = function(param) {
57
57
  }
58
58
  }
59
59
  }
60
- var ref1;
61
- return (ref1 = slugMap[query === null || query === void 0 ? void 0 : query.slug]) !== null && ref1 !== void 0 ? ref1 : query.slug;
60
+ return slugMap[query === null || query === void 0 ? void 0 : query.slug] || query.slug;
62
61
  };
@@ -1,5 +1,5 @@
1
1
  import { ListingTypesEnum } from '..';
2
- export var getListingPageType = function(router, slug, config) {
2
+ export var getListingPageType = function(router, slug, meta) {
3
3
  var ref;
4
4
  var pageTypeMap = {
5
5
  '/[slug]/c': ListingTypesEnum.Category,
@@ -11,8 +11,9 @@ export var getListingPageType = function(router, slug, config) {
11
11
  };
12
12
  var slugAliases = {
13
13
  };
14
- if (config) slugAliases = config.listing;
15
- if ((((ref = Object.keys(slugAliases)) === null || ref === void 0 ? void 0 : ref.includes(slug)) || (slug === null || slug === void 0 ? void 0 : slug.includes('sex'))) && !router.query.cat) {
14
+ if (meta) slugAliases = meta.slugAliases;
15
+ if ((((ref = Object.keys(slugAliases || {
16
+ })) === null || ref === void 0 ? void 0 : ref.includes(slug)) || (slug === null || slug === void 0 ? void 0 : slug.includes('sex'))) && !router.query.cat) {
16
17
  return ListingTypesEnum.AttrPage;
17
18
  }
18
19
  if (router.query.q || router.query.search) {
@@ -48,7 +48,7 @@ export var Container = function(param) {
48
48
  mobile: onlyMobile,
49
49
  desktop: onlyDesktop
50
50
  }, Boolean(title) && /*#__PURE__*/ React.createElement(Headline, {
51
- color: labelsColor
51
+ color: labelsColor || ''
52
52
  }, title), /*#__PURE__*/ React.createElement(Flex, null, children)));
53
53
  };
54
54
  var Wrapper = styled.div.attrs(function(props) {
@@ -62,6 +62,7 @@ function _templateObject4() {
62
62
  }
63
63
  export var EmptyBox = function(param) {
64
64
  var backgroundColor = param.backgroundColor, searchHistory = param.searchHistory, labels = param.labels, labelsColor = param.labelsColor, textColor = param.textColor, onClose = param.onClose, canDisplayPopular = param.canDisplayPopular, canDisplayRecent = param.canDisplayRecent, withRecent = param.withRecent, promoOffers = param.promoOffers, searchValue = param.searchValue, isLoading = param.isLoading;
65
+ var ref, ref1, ref2, ref3;
65
66
  return(/*#__PURE__*/ React.createElement(React.Fragment, null, isLoading ? /*#__PURE__*/ React.createElement("div", {
66
67
  style: {
67
68
  width: '100%',
@@ -70,28 +71,28 @@ export var EmptyBox = function(param) {
70
71
  }, /*#__PURE__*/ React.createElement(Spinner, null)) : /*#__PURE__*/ React.createElement(Wrapper, null, !searchValue || (searchValue === null || searchValue === void 0 ? void 0 : searchValue.length) < 3 ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(BlogCol, {
71
72
  backgroundColor: backgroundColor
72
73
  }, /*#__PURE__*/ React.createElement(BlogContainer, {
73
- blogTitle: labels.blog.blogTitle,
74
- image: labels.blog.image,
75
- url: labels.blog.url,
76
- description: labels.blog.description,
77
- title: labels.blogLabel,
78
- labelsColor: labelsColor,
79
- textColor: textColor,
74
+ blogTitle: (labels === null || labels === void 0 ? void 0 : (ref = labels.blog) === null || ref === void 0 ? void 0 : ref.blogTitle) || '',
75
+ image: (labels === null || labels === void 0 ? void 0 : (ref1 = labels.blog) === null || ref1 === void 0 ? void 0 : ref1.image) || '',
76
+ url: (labels === null || labels === void 0 ? void 0 : (ref2 = labels.blog) === null || ref2 === void 0 ? void 0 : ref2.url) || '',
77
+ description: (labels === null || labels === void 0 ? void 0 : (ref3 = labels.blog) === null || ref3 === void 0 ? void 0 : ref3.description) || '',
78
+ title: (labels === null || labels === void 0 ? void 0 : labels.blogLabel) || '',
79
+ labelsColor: labelsColor || '',
80
+ textColor: textColor || '',
80
81
  onClose: onClose
81
82
  })), /*#__PURE__*/ React.createElement(SuggestedSearches, null, canDisplayPopular && /*#__PURE__*/ React.createElement(PopularSearches, {
82
- title: labels.popularSearchesLabel,
83
+ title: (labels === null || labels === void 0 ? void 0 : labels.popularSearchesLabel) || '',
83
84
  onClose: onClose,
84
- textColor: textColor,
85
- labelsColor: labelsColor
85
+ textColor: textColor || '',
86
+ labelsColor: labelsColor || ''
86
87
  }), withRecent && canDisplayRecent && /*#__PURE__*/ React.createElement(RecentSearches, {
87
- title: labels.recentSearchesLabel,
88
+ title: (labels === null || labels === void 0 ? void 0 : labels.recentSearchesLabel) || '',
88
89
  data: searchHistory,
89
90
  onClose: onClose,
90
- textColor: textColor,
91
- labelsColor: labelsColor
91
+ textColor: textColor || '',
92
+ labelsColor: labelsColor || ''
92
93
  }))) : /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Container, {
93
94
  labelsColor: labelsColor,
94
- title: labels.productsLabel,
95
+ title: (labels === null || labels === void 0 ? void 0 : labels.productsLabel) || '',
95
96
  onlyMobile: true
96
97
  }, /*#__PURE__*/ React.createElement(NoResultsDesc, {
97
98
  className: "SEARCH_BOX_NO_RESULT"
@@ -99,14 +100,14 @@ export var EmptyBox = function(param) {
99
100
  backgroundColor: backgroundColor
100
101
  }, /*#__PURE__*/ React.createElement(Products, {
101
102
  data: promoOffers,
102
- textColor: textColor,
103
- labelsColor: labelsColor,
103
+ textColor: textColor || '',
104
+ labelsColor: labelsColor || '',
104
105
  onClose: onClose,
105
- title: labels.promoOffersLabel,
106
+ title: (labels === null || labels === void 0 ? void 0 : labels.promoOffersLabel) || '',
106
107
  offers: true
107
108
  })), /*#__PURE__*/ React.createElement(Container, {
108
109
  labelsColor: labelsColor,
109
- title: labels.productsLabel,
110
+ title: (labels === null || labels === void 0 ? void 0 : labels.productsLabel) || '',
110
111
  onlyDesktop: true
111
112
  }, /*#__PURE__*/ React.createElement(NoResultsDesc, {
112
113
  className: "SEARCH_BOX_NO_RESULT"
@@ -6,7 +6,7 @@ export var PopularSearches = function(param) {
6
6
  var title = param.title, data = param.data, onClose = param.onClose, labelsColor = param.labelsColor, textColor = param.textColor, searchValue = param.searchValue;
7
7
  var config = useConfigState();
8
8
  var ref = usePopularSearches({
9
- key: config.interfaceKey
9
+ key: config.interfaceKey || ''
10
10
  }), popularSearches = ref.popularSearches, arePopularLoading = ref.isLoading, status = ref.status;
11
11
  return(/*#__PURE__*/ React.createElement(Container, {
12
12
  labelsColor: labelsColor,
@@ -151,7 +151,7 @@ export var ProductCard = function(param) {
151
151
  fontWeight: 400
152
152
  }
153
153
  }, name), /*#__PURE__*/ React.createElement(PriceContainer, null, discountPrice ? /*#__PURE__*/ React.createElement(Price, null, /*#__PURE__*/ React.createElement(NewPrice, null, discountPrice.displayValue), /*#__PURE__*/ React.createElement(OriginalPrice, null, price.displayValue)) : /*#__PURE__*/ React.createElement(ProductCardPrice, {
154
- color: priceColor
154
+ color: priceColor || ''
155
155
  }, price.displayValue)))))), /*#__PURE__*/ React.createElement(Divider, {
156
156
  isLast: isLast
157
157
  })));
@@ -28,7 +28,7 @@ export var Products = function(param) {
28
28
  labelsColor: labelsColor,
29
29
  title: title,
30
30
  offers: offers,
31
- noData: !data || (data === null || data === void 0 ? void 0 : data.length) < 1
31
+ noData: !data || (data === null || data === void 0 ? void 0 : data.length) < 1 || null
32
32
  }, Boolean(data === null || data === void 0 ? void 0 : data.length) ? /*#__PURE__*/ React.createElement("div", {
33
33
  className: "row ".concat(offers ? 'flex-column' : '')
34
34
  }, data === null || data === void 0 ? void 0 : data.map(function(product, index) {
@@ -39,7 +39,7 @@ export var Products = function(param) {
39
39
  labelsColor: labelsColor,
40
40
  priceColor: priceColor,
41
41
  onClose: onClose,
42
- isLast: index === (data === null || data === void 0 ? void 0 : data.length) - 1,
42
+ isLast: index === (data === null || data === void 0 ? void 0 : data.length) - 1 || null,
43
43
  offers: offers,
44
44
  productSpacing: productSpacing
45
45
  }));
@@ -6,7 +6,7 @@ export var RecentSearches = function(param) {
6
6
  return(/*#__PURE__*/ React.createElement(Container, {
7
7
  labelsColor: labelsColor,
8
8
  title: title,
9
- noData: !data || (data === null || data === void 0 ? void 0 : data.length) < 1
9
+ noData: !data || (data === null || data === void 0 ? void 0 : data.length) < 1 || null
10
10
  }, data && /*#__PURE__*/ React.createElement(RecentSearchesList, {
11
11
  data: data,
12
12
  onClose: onClose,
@@ -141,7 +141,7 @@ var BottomMenuEnum1;
141
141
  })(BottomMenuEnum1 || (BottomMenuEnum1 = {
142
142
  }));
143
143
  export var SearchBox = function(param) {
144
- var isLoading = param.isLoading, onClose = param.onClose, suggestedBrands = param.suggestedBrands, suggestedCategories = param.suggestedCategories, suggestions = param.suggestions, searchValue = param.searchValue, _withRecent = param.withRecent, withRecent = _withRecent === void 0 ? true : _withRecent, labels = param.labels, bottomMenu = param.bottomMenu, labelsColor = param.labelsColor, textColor = param.textColor, priceColor = param.priceColor, backgroundColor = param.backgroundColor, onSearchSubmit = param.onSearchSubmit, top = param.top, delay = param.delay, isContainer = param.isContainer, noCloseButton = param.noCloseButton, productSpacing = param.productSpacing, closeButtonOnTop = param.closeButtonOnTop, _hasPopularSearches = param.hasPopularSearches, hasPopularSearches = _hasPopularSearches === void 0 ? false : _hasPopularSearches;
144
+ var isLoading = param.isLoading, onClose = param.onClose, suggestedBrands = param.suggestedBrands, suggestedCategories = param.suggestedCategories, suggestions = param.suggestions, searchValue = param.searchValue, _withRecent = param.withRecent, withRecent = _withRecent === void 0 ? true : _withRecent, labels = param.labels, bottomMenu = param.bottomMenu, labelsColor = param.labelsColor, textColor = param.textColor, priceColor = param.priceColor, backgroundColor = param.backgroundColor, onSearchSubmit = param.onSearchSubmit, top = param.top, delay = param.delay, isContainer = param.isContainer, noCloseButton = param.noCloseButton, productSpacing = param.productSpacing, closeButtonOnTop = param.closeButtonOnTop, _hasPopularSearches = param.hasPopularSearches, hasPopularSearches = _hasPopularSearches === void 0 ? null : _hasPopularSearches;
145
145
  var ref = useSearchHistory(), data = ref.data, loadingRecent = ref.isLoading;
146
146
  var canDisplayRecent = !loadingRecent;
147
147
  var searchHistory = data === null || data === void 0 ? void 0 : data.results;
@@ -169,21 +169,21 @@ export var SearchBox = function(param) {
169
169
  }, /*#__PURE__*/ React.createElement(SearchBoxContent, {
170
170
  isContainer: isContainer
171
171
  }, /*#__PURE__*/ React.createElement(Row, null, /*#__PURE__*/ React.createElement(Placeholder, null), showResults ? /*#__PURE__*/ React.createElement(ResultsBox, null, /*#__PURE__*/ React.createElement(SuggestedBrandsCol, {
172
- backgroundColor: backgroundColor
172
+ backgroundColor: backgroundColor || ''
173
173
  }, suggestedBrands.length !== 0 && /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Suggestions, {
174
174
  data: displayableBrands,
175
175
  onClose: onClose,
176
- searchValue: searchValue,
177
- title: labels.suggestedBrandsLabel,
178
- labelsColor: labelsColor,
179
- textColor: textColor
176
+ searchValue: searchValue || '',
177
+ title: (labels === null || labels === void 0 ? void 0 : labels.suggestedBrandsLabel) || '',
178
+ labelsColor: labelsColor || '',
179
+ textColor: textColor || ''
180
180
  })), suggestedCategories.length > 0 && /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Suggestions, {
181
181
  data: suggestedCategories,
182
182
  onClose: onClose,
183
- searchValue: searchValue,
184
- title: labels.suggestedCategoriesLabel,
185
- labelsColor: labelsColor,
186
- textColor: textColor
183
+ searchValue: searchValue || '',
184
+ title: (labels === null || labels === void 0 ? void 0 : labels.suggestedCategoriesLabel) || '',
185
+ labelsColor: labelsColor || '',
186
+ textColor: textColor || ''
187
187
  }))), /*#__PURE__*/ React.createElement(ProductsWrapper, {
188
188
  backgroundColor: backgroundColor
189
189
  }, /*#__PURE__*/ React.createElement(Products, {
@@ -212,7 +212,7 @@ export var SearchBox = function(param) {
212
212
  onClose: onClose,
213
213
  searchHistory: searchHistory,
214
214
  textColor: textColor,
215
- canDisplayRecent: canDisplayRecent,
215
+ canDisplayRecent: canDisplayRecent || null,
216
216
  withRecent: withRecent,
217
217
  promoOffers: promoOffers,
218
218
  searchValue: searchValue
@@ -1 +1,2 @@
1
1
  export * from './useUpdateCustomLineItemMutation';
2
+ export * from './useUpdateOrderCustomFieldMutation';
@@ -0,0 +1,10 @@
1
+ import { MyCartSetCartCustomField } from '@sentecacommerce/sdk';
2
+ import { useMutation } from 'react-query';
3
+ export var useUpdateOrderCustomFieldMutation = function(callback) {
4
+ return useMutation(function(values) {
5
+ return MyCartSetCartCustomField(values.customFields);
6
+ }, {
7
+ onSuccess: callback === null || callback === void 0 ? void 0 : callback.onSuccess,
8
+ onError: callback === null || callback === void 0 ? void 0 : callback.onError
9
+ });
10
+ };
@@ -1 +1,2 @@
1
1
  export * from './useUpdateCustomLineItem';
2
+ export * from './useUpdateOrderCustomField';