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

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 (131) 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.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
  10. package/dist/cjs/checkout/hooks/useBnpCalculateForCart.js +1 -1
  11. package/dist/cjs/components/Html/index.js +1 -1
  12. package/dist/cjs/components/Portal/index.js +1 -1
  13. package/dist/cjs/hooks/ui-hooks/useIsDesktop/index.js +2 -2
  14. package/dist/cjs/hooks/useAllSelectedFilters/index.js +3 -3
  15. package/dist/cjs/hooks/usePrice/index.js +1 -1
  16. package/dist/cjs/hooks/useProgressBar/hooks/useGetSetState.js +1 -24
  17. package/dist/cjs/hooks/useSelectedFilters/index.js +3 -3
  18. package/dist/cjs/hooks/useVouchers/index.js +1 -2
  19. package/dist/cjs/listing/api/queries/useAggregateQuery.js +7 -7
  20. package/dist/cjs/listing/api/queries/useInfiniteListing.js +4 -4
  21. package/dist/cjs/listing/api/queries/useListingQuery.js +18 -21
  22. package/dist/cjs/listing/api/queries/usePredicate.js +4 -4
  23. package/dist/cjs/listing/components/BasicListingSEO.js +1 -1
  24. package/dist/cjs/listing/hooks/useListingAlias.js +2 -4
  25. package/dist/cjs/listing/hooks/useListingBreadcrumbs.js +4 -4
  26. package/dist/cjs/listing/hooks/useListingCategories.js +7 -8
  27. package/dist/cjs/listing/hooks/useListingConfig.js +3 -5
  28. package/dist/cjs/listing/hooks/useListingFilters.js +18 -19
  29. package/dist/cjs/listing/hooks/useListingItems.js +2 -2
  30. package/dist/cjs/listing/hooks/useListingMeta.js +5 -4
  31. package/dist/cjs/listing/hooks/useListingPagination.js +3 -4
  32. package/dist/cjs/listing/hooks/useListingSlug.js +3 -1
  33. package/dist/cjs/listing/hooks/useSlideFilter.js +4 -3
  34. package/dist/cjs/listing/hooks/useSort.js +48 -17
  35. package/dist/cjs/listing/hooks/utils.js +2 -1
  36. package/dist/cjs/listing/ssr/prefetchCategories.js +1 -1
  37. package/dist/cjs/listing/ssr/prefetchListing.js +7 -8
  38. package/dist/cjs/listing/utils/buildCategoryQuery.js +8 -9
  39. package/dist/cjs/listing/utils/buildFilterQuery.js +5 -7
  40. package/dist/cjs/listing/utils/calculateOffset.js +1 -1
  41. package/dist/cjs/listing/utils/getListingAlias.js +5 -6
  42. package/dist/cjs/listing/utils/getListingPageType.js +4 -3
  43. package/dist/cjs/navigation/components/SearchBox/Components/Container/index.js +1 -1
  44. package/dist/cjs/navigation/components/SearchBox/Components/EmptyBox/index.js +19 -18
  45. package/dist/cjs/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
  46. package/dist/cjs/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -1
  47. package/dist/cjs/navigation/components/SearchBox/Components/Products/index.js +2 -2
  48. package/dist/cjs/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
  49. package/dist/cjs/navigation/components/SearchBox/index.js +11 -11
  50. package/dist/cjs/product/hooks/useBnpOffers.js +2 -25
  51. package/dist/cjs/seo/components/GlobalSEO/index.js +3 -3
  52. package/dist/esm/analytics/Pixel/hooks/usePixelProductClick.js +1 -1
  53. package/dist/esm/analytics/Pixel/hooks/usePixelProductDetails.js +1 -1
  54. package/dist/esm/analytics/Pixel/hooks/usePixelProductsImpression.js +1 -1
  55. package/dist/esm/analytics/Pixel/mainScript.js +0 -1
  56. package/dist/esm/analytics/Pixel/usePixel.js +1 -1
  57. package/dist/esm/analytics/Releva/useReleva.js +1 -1
  58. package/dist/esm/analytics/addToCart.js +0 -1
  59. package/dist/esm/analytics/initiateCheckout.js +0 -1
  60. package/dist/esm/analytics/pageView.js +1 -1
  61. package/dist/esm/analytics/viewContent.js +0 -1
  62. package/dist/esm/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
  63. package/dist/esm/checkout/hooks/useBnpCalculateForCart.js +1 -1
  64. package/dist/esm/components/GoogleOneTap/index.js +1 -1
  65. package/dist/esm/components/Html/index.js +1 -1
  66. package/dist/esm/components/Portal/index.js +1 -1
  67. package/dist/esm/hooks/ui-hooks/useIsDesktop/index.js +2 -2
  68. package/dist/esm/hooks/useAllSelectedFilters/index.js +4 -4
  69. package/dist/esm/hooks/usePrice/index.js +1 -1
  70. package/dist/esm/hooks/useProgressBar/hooks/useGetSetState.js +1 -1
  71. package/dist/esm/hooks/useSelectedFilters/index.js +4 -4
  72. package/dist/esm/hooks/useVouchers/index.js +1 -2
  73. package/dist/esm/listing/api/queries/useAggregateQuery.js +7 -7
  74. package/dist/esm/listing/api/queries/useInfiniteListing.js +4 -4
  75. package/dist/esm/listing/api/queries/useListingQuery.js +18 -21
  76. package/dist/esm/listing/api/queries/usePredicate.js +4 -4
  77. package/dist/esm/listing/components/BasicListingSEO.js +1 -1
  78. package/dist/esm/listing/hooks/useListingAlias.js +2 -4
  79. package/dist/esm/listing/hooks/useListingBreadcrumbs.js +5 -5
  80. package/dist/esm/listing/hooks/useListingCategories.js +8 -9
  81. package/dist/esm/listing/hooks/useListingConfig.js +4 -6
  82. package/dist/esm/listing/hooks/useListingFilters.js +18 -19
  83. package/dist/esm/listing/hooks/useListingItems.js +2 -2
  84. package/dist/esm/listing/hooks/useListingMeta.js +6 -5
  85. package/dist/esm/listing/hooks/useListingPagination.js +3 -4
  86. package/dist/esm/listing/hooks/useListingSlug.js +3 -1
  87. package/dist/esm/listing/hooks/useSlideFilter.js +5 -4
  88. package/dist/esm/listing/hooks/useSort.js +48 -17
  89. package/dist/esm/listing/hooks/utils.js +2 -1
  90. package/dist/esm/listing/ssr/prefetchCategories.js +2 -2
  91. package/dist/esm/listing/ssr/prefetchListing.js +7 -8
  92. package/dist/esm/listing/utils/buildCategoryQuery.js +8 -9
  93. package/dist/esm/listing/utils/buildFilterQuery.js +5 -7
  94. package/dist/esm/listing/utils/calculateOffset.js +1 -1
  95. package/dist/esm/listing/utils/getListingAlias.js +5 -6
  96. package/dist/esm/listing/utils/getListingPageType.js +4 -3
  97. package/dist/esm/navigation/components/SearchBox/Components/Container/index.js +1 -1
  98. package/dist/esm/navigation/components/SearchBox/Components/EmptyBox/index.js +19 -18
  99. package/dist/esm/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
  100. package/dist/esm/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -1
  101. package/dist/esm/navigation/components/SearchBox/Components/Products/index.js +2 -2
  102. package/dist/esm/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
  103. package/dist/esm/navigation/components/SearchBox/index.js +11 -11
  104. package/dist/esm/product/hooks/useBnpOffers.js +2 -2
  105. package/dist/esm/seo/components/GlobalSEO/index.js +3 -3
  106. package/dist/types/listing/api/queries/useAggregateQuery.d.ts +2 -1
  107. package/dist/types/listing/api/queries/useListingQuery.d.ts +4 -2
  108. package/dist/types/listing/api/queries/usePredicate.d.ts +2 -1
  109. package/dist/types/listing/hooks/useListingAlias.d.ts +2 -1
  110. package/dist/types/listing/hooks/useListingFilters.d.ts +0 -1
  111. package/dist/types/listing/hooks/useListingItems.d.ts +3 -2
  112. package/dist/types/listing/hooks/useListingSEOCategories.d.ts +6 -4
  113. package/dist/types/listing/hooks/useSort.d.ts +6 -5
  114. package/dist/types/listing/hooks/utils.d.ts +3 -2
  115. package/dist/types/listing/ssr/prefetchCategories.d.ts +2 -2
  116. package/dist/types/listing/ssr/prefetchListing.d.ts +4 -5
  117. package/dist/types/listing/ssr/prefetchPredicate.d.ts +2 -1
  118. package/dist/types/listing/types.d.ts +27 -16
  119. package/dist/types/listing/utils/buildCategoryQuery.d.ts +2 -1
  120. package/dist/types/listing/utils/buildFilterQuery.d.ts +2 -1
  121. package/dist/types/listing/utils/extendFilter.d.ts +3 -2
  122. package/dist/types/listing/utils/getListingAlias.d.ts +2 -1
  123. package/dist/types/listing/utils/getListingPageType.d.ts +2 -2
  124. package/dist/types/navigation/components/SearchBox/Components/Container/index.d.ts +10 -9
  125. package/dist/types/navigation/components/SearchBox/Components/EmptyBox/index.d.ts +22 -21
  126. package/dist/types/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.d.ts +8 -7
  127. package/dist/types/navigation/components/SearchBox/Components/Products/index.d.ts +9 -8
  128. package/dist/types/navigation/components/SearchBox/index.d.ts +31 -30
  129. package/dist/types/types/index.d.ts +38 -40
  130. package/dist/types/utils/getSelectedFilters.d.ts +2 -1
  131. package/package.json +11 -5
@@ -49,7 +49,7 @@ var usePixelProductClick = function() {
49
49
  var pixel = window.pixel;
50
50
  pixel.productClick(product, _objectSpread({
51
51
  }, info, {
52
- merchantKey: defaultMerchant
52
+ merchantKey: defaultMerchant || ''
53
53
  }));
54
54
  }
55
55
  };
@@ -59,7 +59,7 @@ var usePixelProductDetails = function() {
59
59
  id: metaData._id,
60
60
  sku: selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.sku
61
61
  }, {
62
- merchantKey: defaultMerchant
62
+ merchantKey: defaultMerchant || ''
63
63
  });
64
64
  setSentData.on();
65
65
  }
@@ -75,7 +75,7 @@ var usePixelProductsImpression = function(param) {
75
75
  products: products
76
76
  }
77
77
  ] : productsData, {
78
- merchantKey: defaultMerchant
78
+ merchantKey: defaultMerchant || ''
79
79
  });
80
80
  };
81
81
  sendImpressions();
@@ -40,7 +40,7 @@ var usePixel = function() {
40
40
  var product = param.product, currencyCode = param.currencyCode;
41
41
  pixel === null || pixel === void 0 ? void 0 : pixel.addLineItem(product, {
42
42
  currencyCode: currencyCode,
43
- merchantKey: defaultMerchant
43
+ merchantKey: defaultMerchant || ''
44
44
  });
45
45
  };
46
46
  var pixelRemoveLineItem = function(param) {
@@ -166,7 +166,7 @@ var RelevaProvider = function(param1) {
166
166
  var ref3, ref4;
167
167
  var token = (ref4 = (ref3 = _jsCookie.default.get('token')) !== null && ref3 !== void 0 ? ref3 : _jsCookie.default.get('anonymousToken')) !== null && ref4 !== void 0 ? ref4 : process.env.API_KEY;
168
168
  var interfaceKey = (0, _index).useConfigState().interfaceKey;
169
- var ref5 = (0, _hooks).useRelevaData(payload, isReady, token, interfaceKey), recommenders = ref5.recommenders, banners = ref5.banners, pixelData = ref5.pixelData;
169
+ var ref5 = (0, _hooks).useRelevaData(payload, isReady, token, interfaceKey || ''), recommenders = ref5.recommenders, banners = ref5.banners, pixelData = ref5.pixelData;
170
170
  var values = {
171
171
  onProductPage: onProductPage,
172
172
  changeProfileData: changeProfileData,
@@ -8,7 +8,6 @@ var addToCart = function(sku, quantity, price) {
8
8
  var value = (0, _decodePrice).decodePrice(price) * quantity;
9
9
  var currency = price.currencyCode;
10
10
  window.fbq('track', 'AddToCart', {
11
- // eslint-disable-next-line @typescript-eslint/camelcase
12
11
  content_type: 'product',
13
12
  value: value,
14
13
  currency: currency,
@@ -14,7 +14,6 @@ var initiateCheckout = function(order) {
14
14
  var currency = order.currencyCode;
15
15
  var value = (0, _decodePrice).decodePrice(order.grandTotalPrice);
16
16
  window.fbq('track', 'InitiateCheckout', {
17
- // eslint-disable-next-line @typescript-eslint/camelcase
18
17
  content_type: 'product',
19
18
  contents: contents,
20
19
  currency: currency,
@@ -7,7 +7,6 @@ var viewContent = function(data) {
7
7
  var quantity = data.quantity, price = data.price, currency = data.currencyCode, id = data.sku;
8
8
  var value = price * quantity;
9
9
  window.fbq('track', 'ViewContent', {
10
- // eslint-disable-next-line @typescript-eslint/camelcase
11
10
  content_type: 'product',
12
11
  value: value,
13
12
  currency: currency,
@@ -11,7 +11,7 @@ function useSetMerchantPaymentMethod(onSuccess) {
11
11
  var config = (0, _useConfig).useConfigState();
12
12
  return (0, _reactQuery).useMutation(function(values) {
13
13
  return (0, _sdk).MyCartSetMerchantsPaymentMethods({
14
- methods: formatData(values, config.defaultMerchant)
14
+ methods: formatData(values, config.defaultMerchant || '')
15
15
  });
16
16
  }, {
17
17
  onMutate: function() {
@@ -65,7 +65,7 @@ var useBnpCalculateForCart = function(props) {
65
65
  preferredInstallmentCentAmount: preferredInstallmentCentAmount,
66
66
  downPaymentCentAmount: downPaymentCentAmount
67
67
  });
68
- var configLocale = (ref8 = (0, _index).useConfigState()) === null || ref8 === void 0 ? void 0 : (ref1 = ref8.price) === null || ref1 === void 0 ? void 0 : ref1.locale;
68
+ var configLocale = ((ref8 = (0, _index).useConfigState()) === null || ref8 === void 0 ? void 0 : (ref1 = ref8.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
69
69
  return (0, _react).useMemo(function() {
70
70
  var ref, ref5, ref6, ref7;
71
71
  return _objectSpread({
@@ -50,7 +50,7 @@ var Html = function(param) {
50
50
  containerRef.current.querySelectorAll('a').forEach(function(a) {
51
51
  var ref;
52
52
  if (!((ref = a.href) === null || ref === void 0 ? void 0 : ref.trim())) return;
53
- var isHrefLocal = a.href[0] === '/' || a.href.includes(domain);
53
+ var isHrefLocal = a.href[0] === '/' || domain && a.href.includes(domain);
54
54
  if (isHrefLocal) {
55
55
  a.addEventListener('click', cb);
56
56
  links.push(a);
@@ -23,7 +23,7 @@ var Portal = function(param) {
23
23
  // In that case, it's important to append to the correct document element.
24
24
  var ownerDocument = mountNode.current.ownerDocument;
25
25
  portalNode.current = ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.createElement(type);
26
- ownerDocument.body.appendChild(portalNode.current);
26
+ ownerDocument === null || ownerDocument === void 0 ? void 0 : ownerDocument.body.appendChild(portalNode.current);
27
27
  forceUpdate();
28
28
  return function() {
29
29
  if (portalNode.current && portalNode.current.ownerDocument) {
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  exports.useIsDesktop = void 0;
5
5
  var _useConfig = require("../../useConfig");
6
6
  var useIsDesktop = function() {
7
- var ref;
7
+ var ref, ref1, ref2, ref3, ref4;
8
8
  var config = (0, _useConfig).useConfigState();
9
- return typeof document !== 'undefined' && document.body.clientWidth > Number((ref = config.theme.breakpoints) === null || ref === void 0 ? void 0 : ref.lg.min.split('px')[0]);
9
+ return typeof document !== 'undefined' && document.body.clientWidth > Number((ref = config) === null || ref === void 0 ? void 0 : (ref1 = ref.theme) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.breakpoints) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.lg) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.min) === null || ref4 === void 0 ? void 0 : ref4.split('px')[0]);
10
10
  };
11
11
  exports.useIsDesktop = useIsDesktop;
@@ -8,11 +8,11 @@ var _utils = require("../../utils");
8
8
  var _index = require("../../index");
9
9
  var useAllSelectedFilters = function(aggregations) {
10
10
  var router = (0, _router).useRouter();
11
- var config = (0, _index).useConfigState();
12
- var slug = (0, _index).useListingAlias().slug;
11
+ var meta = (0, _index).useListingConfig().meta;
12
+ var slug = (0, _index).useListingAlias(meta).slug;
13
13
  return (0, _react).useMemo(function() {
14
14
  return (aggregations === null || aggregations === void 0 ? void 0 : aggregations.reduce(function(items, filter) {
15
- return items.concat((0, _utils).getSelectedFilters(router, slug, filter, config));
15
+ return items.concat((0, _utils).getSelectedFilters(router, slug, filter, meta));
16
16
  }, [])) || [];
17
17
  }, [
18
18
  aggregations,
@@ -8,7 +8,7 @@ var _useConfig = require("../useConfig");
8
8
  var usePrice = function(param) {
9
9
  var price = param.price, discountedPrice = param.discountedPrice;
10
10
  var ref, ref1;
11
- var configLocale = (ref = (0, _useConfig).useConfigState()) === null || ref === void 0 ? void 0 : (ref1 = ref.price) === null || ref1 === void 0 ? void 0 : ref1.locale;
11
+ var configLocale = ((ref = (0, _useConfig).useConfigState()) === null || ref === void 0 ? void 0 : (ref1 = ref.price) === null || ref1 === void 0 ? void 0 : ref1.locale) || '';
12
12
  var precision = (price === null || price === void 0 ? void 0 : price.fractionDigits) || 2;
13
13
  var currency = (price === null || price === void 0 ? void 0 : price.currencyCode) || 'BGN' // to be replaced with interface currencyCode
14
14
  ;
@@ -2,7 +2,7 @@ Object.defineProperty(exports, "__esModule", {
2
2
  value: true
3
3
  });
4
4
  exports.useGetSetState = void 0;
5
- var _react = _interopRequireWildcard(require("react"));
5
+ var _react = require("react");
6
6
  var _ = require("./");
7
7
  function _defineProperty(obj, key, value) {
8
8
  if (key in obj) {
@@ -17,29 +17,6 @@ function _defineProperty(obj, key, value) {
17
17
  }
18
18
  return obj;
19
19
  }
20
- function _interopRequireWildcard(obj) {
21
- if (obj && obj.__esModule) {
22
- return obj;
23
- } else {
24
- var newObj = {
25
- };
26
- if (obj != null) {
27
- for(var key in obj){
28
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
29
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
30
- };
31
- if (desc.get || desc.set) {
32
- Object.defineProperty(newObj, key, desc);
33
- } else {
34
- newObj[key] = obj[key];
35
- }
36
- }
37
- }
38
- }
39
- newObj.default = obj;
40
- return newObj;
41
- }
42
- }
43
20
  function _objectSpread(target) {
44
21
  for(var i = 1; i < arguments.length; i++){
45
22
  var source = arguments[i] != null ? arguments[i] : {
@@ -7,8 +7,8 @@ var _utils = require("../../utils");
7
7
  var _index = require("../../index");
8
8
  var useSelectedFilters = function(filters) {
9
9
  var router = (0, _router).useRouter();
10
- var config = (0, _index).useConfigState();
11
- var slug = (0, _index).useListingAlias().slug;
12
- return (0, _utils).getSelectedFilters(router, slug, filters, config);
10
+ var meta = (0, _index).useListingConfig().meta;
11
+ var slug = (0, _index).useListingAlias(meta).slug;
12
+ return (0, _utils).getSelectedFilters(router, slug, filters, meta);
13
13
  };
14
14
  exports.useSelectedFilters = useSelectedFilters;
@@ -14,8 +14,7 @@ function mapVoucherData(element) {
14
14
  var limitValue = element.cartDiscounts[0].resource.maxDiscountValue.centAmount;
15
15
  var limitCurrency = element.cartDiscounts[0].resource.maxDiscountValue.currencyCode;
16
16
  var endDate = new Date(element.validTo).toLocaleDateString('bg-BG');
17
- var isUsed = //@ts-ignore
18
- element.totalApplications >= element.maxApplicationsPerCustomer;
17
+ var isUsed = element.totalApplications >= ((element === null || element === void 0 ? void 0 : element.maxApplicationsPerCustomer) || 1);
19
18
  return {
20
19
  voucherCode: voucherCode,
21
20
  campaign: campaign,
@@ -13,7 +13,7 @@ var _hooks = require("../../hooks");
13
13
  var _types = require("../../types");
14
14
  var _utils = require("../../utils");
15
15
  var _utils1 = require("../../../utils");
16
- var _index = require("../../../index");
16
+ var _ = require("../..");
17
17
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
18
18
  try {
19
19
  var info = gen[key](arg);
@@ -87,11 +87,11 @@ exports.AggregateRequestEnum = AggregateRequestEnum1;
87
87
  var useAggregateQuery = function(aggregates, request, sort) {
88
88
  var router = (0, _router).useRouter();
89
89
  var ref = (0, _usePredicate).usePredicate(), predicate = ref.data;
90
- var defaultConfig = (0, _index).useConfigState();
90
+ var meta = (0, _).useListingConfig().meta;
91
91
  var postFilter = getPostFilters(router);
92
92
  var aggregateKeys = generateAggregateKey(aggregates);
93
93
  var predicateId = predicate === null || predicate === void 0 ? void 0 : predicate._id;
94
- var ref1 = (0, _hooks).useListingAlias(), aliasedSlug = ref1.slug;
94
+ var ref1 = (0, _hooks).useListingAlias(meta), aliasedSlug = ref1.slug;
95
95
  var queryKeys = [
96
96
  request.toString(),
97
97
  aggregateKeys,
@@ -116,7 +116,7 @@ var useAggregateQuery = function(aggregates, request, sort) {
116
116
  router: router,
117
117
  postFilter: postFilter,
118
118
  slug: aliasedSlug,
119
- config: defaultConfig
119
+ config: meta
120
120
  });
121
121
  if (sort) {
122
122
  query = _objectSpread({
@@ -137,7 +137,7 @@ var useAggregateQuery = function(aggregates, request, sort) {
137
137
  })), {
138
138
  refetchOnMount: false,
139
139
  refetchOnWindowFocus: false,
140
- enabled: isQueryEnabled(router, aliasedSlug, predicateId, defaultConfig),
140
+ enabled: isQueryEnabled(router, aliasedSlug, predicateId, meta),
141
141
  keepPreviousData: true,
142
142
  staleTime: 30000
143
143
  });
@@ -180,8 +180,8 @@ function getPostFilters(router) {
180
180
  var query = router.query;
181
181
  return query && Array.isArray(query.filter) ? query === null || query === void 0 ? void 0 : (ref = query.filter) === null || ref === void 0 ? void 0 : ref.join('&') : query === null || query === void 0 ? void 0 : query.filter;
182
182
  }
183
- function isQueryEnabled(router, slug, predicate, config) {
184
- var pageType = (0, _utils).getListingPageType(router, slug, config);
183
+ function isQueryEnabled(router, slug, predicate, meta) {
184
+ var pageType = (0, _utils).getListingPageType(router, slug, meta);
185
185
  if (pageType === _types.ListingTypesEnum.Search) {
186
186
  return (0, _utils1).canUseDOM();
187
187
  }
@@ -80,8 +80,8 @@ var useInfiniteListing = function() {
80
80
  var config = (0, _hooks).useListingConfig();
81
81
  var ref3 = (0, _usePredicate).usePredicate(), predicate = ref3.data;
82
82
  var query = router.query;
83
- var ref1 = (0, _hooks).useListingAlias(), aliasedSlug = ref1.slug;
84
- var limit = config.productsPerPage || 24;
83
+ var ref1 = (0, _hooks).useListingAlias(config.meta), aliasedSlug = ref1.slug;
84
+ var limit = config.meta.limit || 24;
85
85
  var postFilter = (0, _utils).getPostFilters(router);
86
86
  var ref2;
87
87
  var queryKeys = (0, _keys).getListingQueryKeys({
@@ -104,11 +104,11 @@ var useInfiniteListing = function() {
104
104
  data = (0, _useListingQuery).processListingQuery({
105
105
  predicate: predicate,
106
106
  limit: limit,
107
- sort: config === null || config === void 0 ? void 0 : config.defaultSortKey,
107
+ sort: (config === null || config === void 0 ? void 0 : config.defaultSortKey) || 'defaultSort',
108
108
  router: router,
109
109
  postFilter: postFilter,
110
110
  offset: offset,
111
- config: config,
111
+ config: config.meta,
112
112
  slug: aliasedSlug
113
113
  });
114
114
  return _ctx.abrupt("return", data);
@@ -12,7 +12,6 @@ var _hooks = require("../../hooks");
12
12
  var _ = require("..");
13
13
  var _types = require("../../types");
14
14
  var _utils = require("../../utils");
15
- var _1 = require("../../..");
16
15
  function _arrayWithHoles(arr) {
17
16
  if (Array.isArray(arr)) return arr;
18
17
  }
@@ -108,25 +107,21 @@ function _slicedToArray(arr, i) {
108
107
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
109
108
  }
110
109
  var useListingQuery = function() {
111
- var ref, ref1, ref2;
110
+ var ref;
112
111
  var router = (0, _router).useRouter();
113
112
  var slug = (0, _hooks).useListingSlug();
114
113
  var config = (0, _hooks).useListingConfig();
115
- var globalConfig = (0, _1).useConfigState();
116
- var ref3 = (0, _).usePredicate(), predicate = ref3.data;
117
- var ref4 = (0, _hooks).useListingAlias(), aliasedSlug = ref4.slug;
114
+ var ref1 = (0, _).usePredicate(), predicate = ref1.data;
115
+ var ref2 = (0, _hooks).useListingAlias(config.meta), aliasedSlug = ref2.slug;
118
116
  var query = router.query;
119
117
  var postFilter = (0, _utils).getPostFilters(router);
120
- var ref5, ref6;
121
- var limit = (ref6 = (ref5 = (ref = router.query) === null || ref === void 0 ? void 0 : ref.limit) !== null && ref5 !== void 0 ? ref5 : globalConfig === null || globalConfig === void 0 ? void 0 : (ref1 = globalConfig.listing) === null || ref1 === void 0 ? void 0 : ref1.limit) !== null && ref6 !== void 0 ? ref6 : 24;
122
- var _sort, ref7;
123
- var sort = (ref7 = (_sort = query.sort) !== null && _sort !== void 0 ? _sort : globalConfig === null || globalConfig === void 0 ? void 0 : (ref2 = globalConfig.listing) === null || ref2 === void 0 ? void 0 : ref2.defaultSortKey) !== null && ref7 !== void 0 ? ref7 : 'defaultSort';
118
+ var limit = !!router.query.limit ? Number(router.query.limit) : (config === null || config === void 0 ? void 0 : (ref = config.meta) === null || ref === void 0 ? void 0 : ref.limit) || 24;
119
+ var sort = query.sort || (config === null || config === void 0 ? void 0 : config.defaultSortKey) || 'defaultSort';
124
120
  var offset = (0, _utils).calculateOffset(query === null || query === void 0 ? void 0 : query.page, limit);
125
- var _sort1, ref8;
126
121
  var queryKeys = (0, _).getListingQueryKeys({
127
122
  type: config.type,
128
123
  predicate: predicate,
129
- sort: (ref8 = (_sort1 = query.sort) !== null && _sort1 !== void 0 ? _sort1 : globalConfig.defaultSortKey) !== null && ref8 !== void 0 ? ref8 : sort,
124
+ sort: sort,
130
125
  postFilter: postFilter,
131
126
  slug: slug,
132
127
  offset: offset
@@ -136,18 +131,21 @@ var useListingQuery = function() {
136
131
  return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
137
132
  while(1)switch(_ctx.prev = _ctx.next){
138
133
  case 0:
139
- data = processListingQuery({
134
+ _ctx.next = 2;
135
+ return processListingQuery({
140
136
  predicate: predicate,
141
137
  limit: limit,
142
138
  sort: sort,
143
139
  router: router,
144
140
  postFilter: postFilter,
145
141
  offset: offset,
146
- config: globalConfig,
142
+ config: config.meta,
147
143
  slug: aliasedSlug
148
144
  });
149
- return _ctx.abrupt("return", data);
150
145
  case 2:
146
+ data = _ctx.sent;
147
+ return _ctx.abrupt("return", data);
148
+ case 4:
151
149
  case "end":
152
150
  return _ctx.stop();
153
151
  }
@@ -167,12 +165,11 @@ function processListingQuery(_) {
167
165
  }
168
166
  function _processListingQuery() {
169
167
  _processListingQuery = _asyncToGenerator(_regeneratorRuntime.default.mark(function _callee(param) {
170
- var predicate, router, limit, sort, postFilter, offset, config, slug, ref, query, type, filter, _sort;
168
+ var predicate, router, limit, sort, postFilter, offset, config, slug, query, type, filter, _sort;
171
169
  return _regeneratorRuntime.default.wrap(function _callee$(_ctx) {
172
170
  while(1)switch(_ctx.prev = _ctx.next){
173
171
  case 0:
174
172
  predicate = param.predicate, router = param.router, limit = param.limit, sort = param.sort, postFilter = param.postFilter, offset = param.offset, config = param.config, slug = param.slug;
175
- ;
176
173
  query = router.query;
177
174
  type = (0, _utils).getListingPageType(router, slug, config);
178
175
  filter = generateFilter(type, query, slug, predicate);
@@ -182,16 +179,16 @@ function _processListingQuery() {
182
179
  offset: offset || 0,
183
180
  filter: (0, _utils).extendFilter({
184
181
  slug: filter,
185
- filterExtension: config === null || config === void 0 ? void 0 : (ref = config.listing) === null || ref === void 0 ? void 0 : ref.filterExtension,
182
+ filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension,
186
183
  noSplit: true
187
184
  }),
188
185
  sort: (_sort = query.sort) !== null && _sort !== void 0 ? _sort : sort
189
186
  }, (query === null || query === void 0 ? void 0 : query.filter) && {
190
187
  postFilter: postFilter
191
- }, (config === null || config === void 0 ? void 0 : config.listing.collapseMode) && type !== _types.ListingTypesEnum.Collection && {
192
- collapseMode: config === null || config === void 0 ? void 0 : config.listing.collapseMode
188
+ }, (config === null || config === void 0 ? void 0 : config.collapseMode) && type !== _types.ListingTypesEnum.Collection && {
189
+ collapseMode: config === null || config === void 0 ? void 0 : config.collapseMode
193
190
  })));
194
- case 7:
191
+ case 6:
195
192
  case "end":
196
193
  return _ctx.stop();
197
194
  }
@@ -224,6 +221,6 @@ function isListingQueryEnabled(type, predicate) {
224
221
  return false;
225
222
  }
226
223
  function parseAttribute(slug) {
227
- var ref = _slicedToArray(slug.split('-'), 2), type = ref[0], val = ref[1];
224
+ var ref = _slicedToArray((slug === null || slug === void 0 ? void 0 : slug.split('-')) || [], 2), type = ref[0], val = ref[1];
228
225
  return "attr.".concat(type, ";eq;\"").concat(val, "\"");
229
226
  }
@@ -7,11 +7,11 @@ var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"))
7
7
  var _sdk = require("@sentecacommerce/sdk");
8
8
  var _reactQuery = require("react-query");
9
9
  var _router = require("next/router");
10
- var _index = require("../../../index");
11
10
  var _types = require("../../types");
12
11
  var _ = require("../");
13
12
  var _utils = require("../../utils");
14
13
  var _hooks = require("../../hooks");
14
+ var _1 = require("../..");
15
15
  function _arrayWithHoles(arr) {
16
16
  if (Array.isArray(arr)) return arr;
17
17
  }
@@ -95,9 +95,9 @@ var getBySlugMap = (_obj = {
95
95
  }, _defineProperty(_obj, _types.ListingTypesEnum.Category, _sdk.CategoriesGetBySlug), _defineProperty(_obj, _types.ListingTypesEnum.View, _sdk.ViewsGetBySlug), _defineProperty(_obj, _types.ListingTypesEnum.Brand, _sdk.BrandsGetBySlug), _defineProperty(_obj, _types.ListingTypesEnum.Collection, _sdk.CollectionsGetBySlug), _obj);
96
96
  var usePredicate = function() {
97
97
  var slug = (0, _hooks).useListingSlug();
98
+ var meta = (0, _1).useListingConfig().meta;
98
99
  var router = (0, _router).useRouter();
99
- var config = (0, _index).useConfigState();
100
- var ref = (0, _hooks).useListingAlias(), aliasedSlug = ref.slug;
100
+ var ref = (0, _hooks).useListingAlias(meta), aliasedSlug = ref.slug;
101
101
  var attribute = router.query.cat && aliasedSlug;
102
102
  return (0, _reactQuery).useQuery([
103
103
  _.ListingQueryKeysEnum.usePredicate,
@@ -109,7 +109,7 @@ var usePredicate = function() {
109
109
  while(1)switch(_ctx.prev = _ctx.next){
110
110
  case 0:
111
111
  _ctx.next = 2;
112
- return processPredicateRequest(slug, router, aliasedSlug, config);
112
+ return processPredicateRequest(slug, router, aliasedSlug, meta);
113
113
  case 2:
114
114
  data = _ctx.sent;
115
115
  return _ctx.abrupt("return", data);
@@ -31,7 +31,7 @@ var BasicListingSEO = function(param) {
31
31
  }), /*#__PURE__*/ _react.default.createElement(_seo.OpenGraph, {
32
32
  title: formattedTitle,
33
33
  type: "website",
34
- image: image || topBanner || imagesConfig.fallbackImage,
34
+ image: image || topBanner || (imagesConfig === null || imagesConfig === void 0 ? void 0 : imagesConfig.fallbackImage) || '',
35
35
  additionalProps: [
36
36
  {
37
37
  key: 'description',
@@ -3,14 +3,12 @@ Object.defineProperty(exports, "__esModule", {
3
3
  });
4
4
  exports.useListingAlias = void 0;
5
5
  var _utils = require("../utils");
6
- var _ = require("../..");
7
6
  var _router = require("next/router");
8
- var useListingAlias = function() {
7
+ var useListingAlias = function(meta) {
9
8
  var router = (0, _router).useRouter();
10
- var config = (0, _).useConfigState();
11
9
  var slug = (0, _utils).getListingAlias({
12
10
  router: router,
13
- config: config
11
+ config: meta
14
12
  });
15
13
  return {
16
14
  slug: slug
@@ -34,16 +34,16 @@ function _toConsumableArray(arr) {
34
34
  }
35
35
  var _instance;
36
36
  var useListingBreadcrumbs = function() {
37
- var ref = (0, _api).usePredicate(), data = ref.data, isLoading = ref.isLoading;
37
+ var ref1 = (0, _api).usePredicate(), data = ref1.data, isLoading = ref1.isLoading;
38
38
  var config = (0, _).useListingConfig();
39
39
  var router = (0, _router).useRouter();
40
- var mainConfig = (0, _index).useConfigState();
41
- var slug = (0, _index).useListingAlias().slug;
40
+ var slug = (0, _index).useListingAlias(config.meta).slug;
42
41
  var result = _react.default.useMemo(function() {
43
42
  if (config.type === _1.ListingTypesEnum.AttrPage) {
43
+ var ref;
44
44
  return [
45
45
  {
46
- name: mainConfig.listing.titleAliases[slug],
46
+ name: (ref = config.meta) === null || ref === void 0 ? void 0 : ref.titleAliases[slug],
47
47
  id: '',
48
48
  link: "/".concat(router.query.slug, "/c")
49
49
  },
@@ -38,19 +38,18 @@ var ListingCategoriesStateContext = /*#__PURE__*/ _react.default.createContext(u
38
38
  function ListingCategoriesProvider(param) {
39
39
  var children = param.children;
40
40
  var router = (0, _router).useRouter();
41
- var categoryTreeConfig = (0, _useListingConfig).useListingConfig().categoryTreeConfig;
42
- var slug = (0, _index).useListingAlias().slug;
43
- var config = (0, _index).useConfigState();
44
- var ref = (0, _api).useAggregateQuery([
41
+ var ref = (0, _useListingConfig).useListingConfig(), categoryTreeConfig = ref.categoryTreeConfig, meta = ref.meta;
42
+ var slug = (0, _index).useListingAlias(meta).slug;
43
+ var ref1 = (0, _api).useAggregateQuery([
45
44
  categoryTreeConfig
46
- ], _api.AggregateRequestEnum.Categories), aggData = ref.data, isLoading = ref.isLoading;
47
- var currentCategory = generateCurrentUrl(router, slug, config);
48
- var ref1 = (0, _utils1).getAggregateTypeAndTerm(categoryTreeConfig), type = ref1.type, term = ref1.term;
45
+ ], _api.AggregateRequestEnum.Categories), aggData = ref1.data, isLoading = ref1.isLoading;
46
+ var currentCategory = generateCurrentUrl(router, slug, meta);
47
+ var ref2 = (0, _utils1).getAggregateTypeAndTerm(categoryTreeConfig), type = ref2.type, term = ref2.term;
49
48
  var data = _react.default.useMemo(function() {
50
49
  if (aggData) {
51
50
  var response = (0, _utils1).processCategoriesResponse(aggData, type, term);
52
51
  var nodes = response.map(function(current) {
53
- return buildNodes(current, router, slug, config);
52
+ return buildNodes(current, router, slug, meta);
54
53
  });
55
54
  var categoryTree = buildCategories(nodes);
56
55
  return categoryTree;
@@ -47,22 +47,20 @@ var ListingPageContext = /*#__PURE__*/ _react.default.createContext(undefined);
47
47
  function ListingPageProvider(param) {
48
48
  var config = param.config, children = param.children;
49
49
  var router = (0, _router).useRouter();
50
- var slug = (0, _index).useListingAlias().slug;
51
- var mainConfig = (0, _index).useConfigState();
50
+ var slug = (0, _index).useListingAlias(config.meta).slug;
52
51
  var data = _react.default.useMemo(function() {
53
52
  return _objectSpread({
54
53
  }, config, {
55
- type: (0, _utils).getListingPageType(router, slug, mainConfig)
54
+ type: (0, _utils).getListingPageType(router, slug, config.meta)
56
55
  });
57
56
  }, [
58
57
  router.pathname,
59
58
  config.aggregates,
60
59
  config.categoryTreeConfig,
61
60
  config.defaultSortKey,
62
- config.productsPerPage,
63
61
  config.seoAggregates,
64
62
  config.sortOptions,
65
- config.filterExtension,
63
+ config.meta,
66
64
  config.attributeSortType,
67
65
  ]);
68
66
  return(/*#__PURE__*/ _react.default.createElement(ListingPageContext.Provider, {