@sentecacommerce-theme/lib 0.12.100 → 0.13.1

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 (56) hide show
  1. package/dist/cjs/analytics/Pixel/mainScript.js +1 -2
  2. package/dist/cjs/api/getSDKConfig.js +2 -4
  3. package/dist/cjs/api/myCartApi/index.js +2 -8
  4. package/dist/cjs/config/SentecaProvider.js +1 -3
  5. package/dist/cjs/hooks/useAvailability/index.js +1 -1
  6. package/dist/cjs/hooks/useProduct/index.js +5 -15
  7. package/dist/cjs/hooks/wishlist-hooks/useWishlistItem/index.js +15 -39
  8. package/dist/cjs/listing/api/queries/useListingQuery.js +1 -1
  9. package/dist/cjs/listing/hooks/useListingMeta.js +40 -49
  10. package/dist/cjs/listing/hooks/useSlideFilter.js +3 -24
  11. package/dist/cjs/listing/ssr/prefetchCategories.js +6 -5
  12. package/dist/cjs/listing/ssr/prefetchPredicate.js +4 -4
  13. package/dist/cjs/navigation/components/SearchBox/Components/EmptyBox/index.js +7 -7
  14. package/dist/cjs/navigation/components/SearchBox/index.js +4 -4
  15. package/dist/cjs/seo/components/TranslationsMeta/index.js +14 -43
  16. package/dist/cjs/seo/components/index.js +0 -12
  17. package/dist/cjs/seo/hooks/useSeoTranslations.js +14 -55
  18. package/dist/cjs/ui/components/GridStyles.js +2 -2
  19. package/dist/cjs/ui/components/RangeSliderInput.js +1 -14
  20. package/dist/cjs/utils/index.js +0 -12
  21. package/dist/cjs/utils/isTouchDevice.js +1 -2
  22. package/dist/esm/analytics/Pixel/mainScript.js +1 -2
  23. package/dist/esm/api/getSDKConfig.js +3 -5
  24. package/dist/esm/api/myCartApi/index.js +2 -8
  25. package/dist/esm/config/SentecaProvider.js +1 -3
  26. package/dist/esm/hooks/useAvailability/index.js +1 -1
  27. package/dist/esm/hooks/useProduct/index.js +16 -26
  28. package/dist/esm/hooks/wishlist-hooks/useWishlistItem/index.js +13 -21
  29. package/dist/esm/listing/api/queries/useListingQuery.js +1 -1
  30. package/dist/esm/listing/hooks/useListingMeta.js +40 -49
  31. package/dist/esm/listing/hooks/useSlideFilter.js +3 -24
  32. package/dist/esm/listing/ssr/prefetchCategories.js +7 -6
  33. package/dist/esm/listing/ssr/prefetchPredicate.js +4 -4
  34. package/dist/esm/navigation/components/SearchBox/Components/EmptyBox/index.js +7 -7
  35. package/dist/esm/navigation/components/SearchBox/index.js +4 -4
  36. package/dist/esm/seo/components/TranslationsMeta/index.js +14 -43
  37. package/dist/esm/seo/components/index.js +0 -1
  38. package/dist/esm/seo/hooks/useSeoTranslations.js +14 -55
  39. package/dist/esm/ui/components/GridStyles.js +2 -2
  40. package/dist/esm/ui/components/RangeSliderInput.js +1 -14
  41. package/dist/esm/utils/index.js +0 -1
  42. package/dist/esm/utils/isTouchDevice.js +1 -2
  43. package/dist/types/listing/hooks/useSlideFilter.d.ts +0 -4
  44. package/dist/types/listing/types.d.ts +0 -10
  45. package/dist/types/navigation/components/SearchBox/Components/EmptyBox/index.d.ts +4 -5
  46. package/dist/types/navigation/components/SearchBox/index.d.ts +6 -7
  47. package/dist/types/seo/components/index.d.ts +0 -1
  48. package/dist/types/seo/hooks/useSeoTranslations.d.ts +3 -5
  49. package/dist/types/ui/components/GridStyles.d.ts +1 -2
  50. package/dist/types/ui/components/RangeSliderInput.d.ts +1 -2
  51. package/dist/types/utils/index.d.ts +0 -1
  52. package/package.json +4 -4
  53. package/dist/cjs/utils/getLocaleFromPath.js +0 -13
  54. package/dist/esm/utils/getLocaleFromPath.js +0 -8
  55. package/dist/types/seo/components/TranslationsMeta/index.d.ts +0 -1
  56. package/dist/types/utils/getLocaleFromPath.d.ts +0 -1
@@ -4,6 +4,7 @@ import { customFieldsToMap, escape, getTranslatableField } from '../../utils';
4
4
  import { assetsFieldsToMap } from '../../utils/assetsToMap';
5
5
  import { useRouter } from 'next/router';
6
6
  import { getListingPageType } from '../utils';
7
+ import { ListingTypesEnum } from '../types';
7
8
  import { useListingAlias } from '../../index';
8
9
  import { useListingFilters } from './useListingFilters';
9
10
  import { useListingCategories } from './useListingCategories';
@@ -22,33 +23,6 @@ function _iterableToArray(iter) {
22
23
  function _nonIterableSpread() {
23
24
  throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
24
25
  }
25
- function _objectWithoutProperties(source, excluded) {
26
- if (source == null) return {};
27
- var target = _objectWithoutPropertiesLoose(source, excluded);
28
- var key, i;
29
- if (Object.getOwnPropertySymbols) {
30
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
31
- for(i = 0; i < sourceSymbolKeys.length; i++){
32
- key = sourceSymbolKeys[i];
33
- if (excluded.indexOf(key) >= 0) continue;
34
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
35
- target[key] = source[key];
36
- }
37
- }
38
- return target;
39
- }
40
- function _objectWithoutPropertiesLoose(source, excluded) {
41
- if (source == null) return {};
42
- var target = {};
43
- var sourceKeys = Object.keys(source);
44
- var key, i;
45
- for(i = 0; i < sourceKeys.length; i++){
46
- key = sourceKeys[i];
47
- if (excluded.indexOf(key) >= 0) continue;
48
- target[key] = source[key];
49
- }
50
- return target;
51
- }
52
26
  function _toConsumableArray(arr) {
53
27
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
54
28
  }
@@ -106,57 +80,74 @@ export var useListingMeta = function() {
106
80
  return result;
107
81
  };
108
82
  function processDisplayName(slug, config, name, breadcrumb, router, aggData, categoriesData) {
109
- var ref, ref5;
110
83
  var listingName = getTranslatableField(name);
111
84
  var brandName = getBrandName(router, aggData);
112
85
  var categoryName = getCategoryName(router, categoriesData);
113
86
  var type = getListingPageType(router, slug, config);
114
- var getTitle = config.getTitle, rest = _objectWithoutProperties(config, [
115
- "getTitle"
116
- ]);
117
- var title = getTitle === null || getTitle === void 0 ? void 0 : getTitle(type, rest, {
118
- category: categoryName,
119
- brand: brandName,
120
- defaultName: listingName,
121
- attribute: (ref = config.titleAliases) === null || ref === void 0 ? void 0 : ref[slug],
122
- childAttribute: getTranslatableField(breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.label),
123
- search: router === null || router === void 0 ? void 0 : (ref5 = router.query) === null || ref5 === void 0 ? void 0 : ref5.search,
124
- isWithAttribute: Boolean(router === null || router === void 0 ? void 0 : router.query.cat)
125
- });
126
- return title || listingName;
87
+ if (type === ListingTypesEnum.AttrPage) {
88
+ return "Всичко за ".concat(config.titleAliases[slug]);
89
+ }
90
+ if (router === null || router === void 0 ? void 0 : router.query.cat) {
91
+ var attribute = getTranslatableField(breadcrumb === null || breadcrumb === void 0 ? void 0 : breadcrumb.label);
92
+ if (type === ListingTypesEnum.Category) {
93
+ if (!brandName) {
94
+ return "".concat(listingName, " за ").concat(attribute);
95
+ }
96
+ return "".concat(listingName, " за ").concat(attribute, " от ").concat(brandName);
97
+ }
98
+ if (type === ListingTypesEnum.Brand) {
99
+ if (!categoryName) {
100
+ return "Всички продукти от ".concat(listingName, " за ").concat(attribute);
101
+ }
102
+ return "".concat(categoryName, " от ").concat(listingName, " за ").concat(attribute);
103
+ }
104
+ }
105
+ if (type === ListingTypesEnum.Category && brandName) {
106
+ return "".concat(listingName, " от ").concat(brandName);
107
+ }
108
+ if (type === ListingTypesEnum.Brand) {
109
+ if (!categoryName) {
110
+ return "Всички продукти от ".concat(listingName);
111
+ }
112
+ return "".concat(categoryName, " от ").concat(listingName);
113
+ }
114
+ if (type === ListingTypesEnum.Search && (router === null || router === void 0 ? void 0 : router.query.search)) {
115
+ return "".concat(listingName, " от \"").concat(router.query.search, "\"");
116
+ }
117
+ return listingName;
127
118
  }
128
119
  function getFilterByType(filterType, router) {
129
120
  var filterId = '';
130
121
  if (Array.isArray(router === null || router === void 0 ? void 0 : router.query.filter)) {
131
- var ref, ref6;
122
+ var ref, ref5;
132
123
  var filters = (ref = router === null || router === void 0 ? void 0 : router.query.filter) === null || ref === void 0 ? void 0 : ref.filter(function(x) {
133
124
  return x === null || x === void 0 ? void 0 : x.includes(filterType);
134
125
  });
135
126
  if ((filters === null || filters === void 0 ? void 0 : filters.length) && filters.length > 1) {
136
127
  return '';
137
128
  }
138
- var filterTerm = (ref6 = /\d+/.exec((filters === null || filters === void 0 ? void 0 : filters[0]) || '')) === null || ref6 === void 0 ? void 0 : ref6[0];
129
+ var filterTerm = (ref5 = /\d+/.exec((filters === null || filters === void 0 ? void 0 : filters[0]) || '')) === null || ref5 === void 0 ? void 0 : ref5[0];
139
130
  if (!filterTerm) return '';
140
131
  filterId = filterTerm;
141
132
  } else {
142
- var ref7, ref8, ref9;
143
- var isFiltered = router === null || router === void 0 ? void 0 : (ref7 = router.query) === null || ref7 === void 0 ? void 0 : (ref8 = ref7.filter) === null || ref8 === void 0 ? void 0 : ref8.includes(filterType);
133
+ var ref6, ref7, ref8;
134
+ var isFiltered = router === null || router === void 0 ? void 0 : (ref6 = router.query) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.filter) === null || ref7 === void 0 ? void 0 : ref7.includes(filterType);
144
135
  if (!isFiltered) {
145
136
  return '';
146
137
  }
147
- filterId = (ref9 = /(\w+)-(\d+)/.exec(router === null || router === void 0 ? void 0 : router.query.filter)) === null || ref9 === void 0 ? void 0 : ref9[0];
138
+ filterId = (ref8 = /(\w+)-(\d+)/.exec(router === null || router === void 0 ? void 0 : router.query.filter)) === null || ref8 === void 0 ? void 0 : ref8[0];
148
139
  }
149
140
  return filterId;
150
141
  }
151
142
  function getBrandName(router, filtersData) {
152
- var ref, ref10, ref11;
143
+ var ref, ref9, ref10;
153
144
  var brandId = getFilterByType('brand', router);
154
145
  var brand = (ref = filtersData === null || filtersData === void 0 ? void 0 : filtersData.find(function(x) {
155
146
  return x.name === 'Brands';
156
- })) === null || ref === void 0 ? void 0 : (ref10 = ref.items) === null || ref10 === void 0 ? void 0 : ref10.find(function(x) {
147
+ })) === null || ref === void 0 ? void 0 : (ref9 = ref.items) === null || ref9 === void 0 ? void 0 : ref9.find(function(x) {
157
148
  return x.data.key === brandId;
158
149
  });
159
- return getTranslatableField(brand === null || brand === void 0 ? void 0 : (ref11 = brand.meta) === null || ref11 === void 0 ? void 0 : ref11.name);
150
+ return getTranslatableField(brand === null || brand === void 0 ? void 0 : (ref10 = brand.meta) === null || ref10 === void 0 ? void 0 : ref10.name);
160
151
  }
161
152
  function getCategoryName(router, categories) {
162
153
  var categoryId = getFilterByType('category', router);
@@ -52,7 +52,7 @@ function _unsupportedIterableToArray(o, minLen) {
52
52
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
53
53
  }
54
54
  export var useSlideFilter = function(filterName, min, max) {
55
- var ref3;
55
+ var ref;
56
56
  var router = useRouter();
57
57
  var meta = useListingConfig().meta;
58
58
  var slug = useListingAlias(meta).slug;
@@ -67,7 +67,7 @@ export var useSlideFilter = function(filterName, min, max) {
67
67
  }
68
68
  if (allFilters.includes(filterQuery)) return allFilters;
69
69
  };
70
- var filter = (ref3 = getFilter()) === null || ref3 === void 0 ? void 0 : ref3.replace(filterQuery, '');
70
+ var filter = (ref = getFilter()) === null || ref === void 0 ? void 0 : ref.replace(filterQuery, '');
71
71
  var ref1 = _slicedToArray(filter ? filter.split(',') : [
72
72
  min,
73
73
  max
@@ -77,29 +77,9 @@ export var useSlideFilter = function(filterName, min, max) {
77
77
  to: +to || max
78
78
  }), 2), state = ref2[0], setState = ref2[1];
79
79
  var timeoutRef = useRef();
80
- var getFormattedPriceRange = function(data) {
80
+ var updateValue = useCallback(function(data) {
81
81
  var formattedFrom = Math.min(Math.max(data.from, min), data.to);
82
82
  var formattedTo = Math.max(data.from, Math.min(data.to, max));
83
- return {
84
- formattedFrom: formattedFrom,
85
- formattedTo: formattedTo
86
- };
87
- };
88
- var updateValue = useCallback(function(data) {
89
- var ref = getFormattedPriceRange(data), formattedFrom = ref.formattedFrom, formattedTo = ref.formattedTo;
90
- setState({
91
- from: formattedFrom,
92
- to: formattedTo
93
- });
94
- }, [
95
- filterName,
96
- max,
97
- min,
98
- router,
99
- slug
100
- ]);
101
- var applyFilter = useCallback(function(data) {
102
- var ref = getFormattedPriceRange(data), formattedFrom = ref.formattedFrom, formattedTo = ref.formattedTo;
103
83
  clearTimeout(timeoutRef.current);
104
84
  timeoutRef.current = setTimeout(function() {
105
85
  router.push(createAggregateQuery(getListingPageType(router, slug, meta), router.query.slug, {
@@ -121,7 +101,6 @@ export var useSlideFilter = function(filterName, min, max) {
121
101
  ]);
122
102
  return {
123
103
  value: state,
124
- applyFilter: applyFilter,
125
104
  updateValue: updateValue
126
105
  };
127
106
  };
@@ -1,6 +1,6 @@
1
1
  import regeneratorRuntime from "regenerator-runtime";
2
2
  import { CatalogAggregate } from '@sentecacommerce/sdk';
3
- import { getListingAlias, getPostFilters } from '../utils';
3
+ import { getSlug, getListingAlias, getPostFilters } from '../utils';
4
4
  import { prepareAggregateQuery, AggregateRequestEnum, generateAggregateKey } from '../api';
5
5
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
6
6
  try {
@@ -36,7 +36,7 @@ export function prefetchCategories(queryCache, router, predicate, aggregates, co
36
36
  }
37
37
  function _prefetchCategories() {
38
38
  _prefetchCategories = _asyncToGenerator(regeneratorRuntime.mark(function _callee(queryCache, router, predicate, aggregates, config) {
39
- var aggregateKeys, aliasedSlug, query, response;
39
+ var aggregateKeys, aliasedSlug, slug, query, response;
40
40
  return regeneratorRuntime.wrap(function _callee$(_ctx) {
41
41
  while(1)switch(_ctx.prev = _ctx.next){
42
42
  case 0:
@@ -45,18 +45,19 @@ function _prefetchCategories() {
45
45
  router: router,
46
46
  config: config
47
47
  });
48
+ slug = getSlug(router, aliasedSlug);
48
49
  query = prepareAggregateQuery({
49
50
  request: AggregateRequestEnum.Categories,
50
51
  router: router,
51
52
  predicate: predicate,
52
53
  slug: aliasedSlug,
53
54
  aggregates: aggregates,
54
- postFilter: getPostFilters(router),
55
+ postFilter: undefined,
55
56
  config: config
56
57
  });
57
- _ctx.next = 5;
58
+ _ctx.next = 6;
58
59
  return CatalogAggregate(query);
59
- case 5:
60
+ case 6:
60
61
  response = _ctx.sent;
61
62
  queryCache.setQueryData([
62
63
  AggregateRequestEnum.Categories,
@@ -67,7 +68,7 @@ function _prefetchCategories() {
67
68
  staleTime: 30000
68
69
  });
69
70
  return _ctx.abrupt("return", response);
70
- case 8:
71
+ case 9:
71
72
  case "end":
72
73
  return _ctx.stop();
73
74
  }
@@ -35,20 +35,20 @@ export function prefetchPredicate(queryCache, router, config) {
35
35
  }
36
36
  function _prefetchPredicate() {
37
37
  _prefetchPredicate = _asyncToGenerator(regeneratorRuntime.mark(function _callee(queryCache, router, config) {
38
- var aliasedSlug, slug, data, attribute;
38
+ var attribute, aliasedSlug, slug, data;
39
39
  return regeneratorRuntime.wrap(function _callee$(_ctx) {
40
40
  while(1)switch(_ctx.prev = _ctx.next){
41
41
  case 0:
42
+ attribute = router.query.cat && router.query.slug;
42
43
  aliasedSlug = getListingAlias({
43
44
  router: router,
44
45
  config: config
45
46
  });
46
47
  slug = getSlug(router, aliasedSlug);
47
- _ctx.next = 4;
48
+ _ctx.next = 5;
48
49
  return processPredicateRequest(slug, router, aliasedSlug);
49
- case 4:
50
+ case 5:
50
51
  data = _ctx.sent;
51
- attribute = router.query.cat && aliasedSlug;
52
52
  queryCache.setQueryData([
53
53
  ListingQueryKeysEnum.usePredicate,
54
54
  slug,
@@ -80,38 +80,38 @@ export var EmptyBox = function(param) {
80
80
  textColor: textColor || '',
81
81
  onClose: onClose
82
82
  })), /*#__PURE__*/ React.createElement(SuggestedSearches, null, canDisplayPopular && /*#__PURE__*/ React.createElement(PopularSearches, {
83
- title: (labels === null || labels === void 0 ? void 0 : labels.popularSearches) || '',
83
+ title: (labels === null || labels === void 0 ? void 0 : labels.popularSearchesLabel) || '',
84
84
  onClose: onClose,
85
85
  textColor: textColor || '',
86
86
  labelsColor: labelsColor || ''
87
87
  }), withRecent && canDisplayRecent && /*#__PURE__*/ React.createElement(RecentSearches, {
88
- title: (labels === null || labels === void 0 ? void 0 : labels.recentSearches) || '',
88
+ title: (labels === null || labels === void 0 ? void 0 : labels.recentSearchesLabel) || '',
89
89
  data: searchHistory,
90
90
  onClose: onClose,
91
91
  textColor: textColor || '',
92
92
  labelsColor: labelsColor || ''
93
93
  }))) : /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Container, {
94
94
  labelsColor: labelsColor,
95
- title: (labels === null || labels === void 0 ? void 0 : labels.products) || '',
95
+ title: (labels === null || labels === void 0 ? void 0 : labels.productsLabel) || '',
96
96
  onlyMobile: true
97
97
  }, /*#__PURE__*/ React.createElement(NoResultsDesc, {
98
98
  className: "SEARCH_BOX_NO_RESULT"
99
- }, labels === null || labels === void 0 ? void 0 : labels.noResults)), /*#__PURE__*/ React.createElement(PromoCol, {
99
+ }, "No results found")), /*#__PURE__*/ React.createElement(PromoCol, {
100
100
  backgroundColor: backgroundColor
101
101
  }, /*#__PURE__*/ React.createElement(Products, {
102
102
  data: promoOffers,
103
103
  textColor: textColor || '',
104
104
  labelsColor: labelsColor || '',
105
105
  onClose: onClose,
106
- title: (labels === null || labels === void 0 ? void 0 : labels.promoOffers) || '',
106
+ title: (labels === null || labels === void 0 ? void 0 : labels.promoOffersLabel) || '',
107
107
  offers: true
108
108
  })), /*#__PURE__*/ React.createElement(Container, {
109
109
  labelsColor: labelsColor,
110
- title: (labels === null || labels === void 0 ? void 0 : labels.products) || '',
110
+ title: (labels === null || labels === void 0 ? void 0 : labels.productsLabel) || '',
111
111
  onlyDesktop: true
112
112
  }, /*#__PURE__*/ React.createElement(NoResultsDesc, {
113
113
  className: "SEARCH_BOX_NO_RESULT"
114
- }, labels === null || labels === void 0 ? void 0 : labels.noResults))))));
114
+ }, "No results found"))))));
115
115
  };
116
116
  var Wrapper = styled.div.attrs({
117
117
  className: 'd-flex flex-column flex-lg-row mx-lg-auto '
@@ -173,14 +173,14 @@ export var SearchBox = function(param) {
173
173
  data: displayableBrands,
174
174
  onClose: onClose,
175
175
  searchValue: searchValue || '',
176
- title: (labels === null || labels === void 0 ? void 0 : labels.suggestedBrands) || '',
176
+ title: (labels === null || labels === void 0 ? void 0 : labels.suggestedBrandsLabel) || '',
177
177
  labelsColor: labelsColor || '',
178
178
  textColor: textColor || ''
179
179
  })), suggestedCategories.length > 0 && /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Suggestions, {
180
180
  data: suggestedCategories,
181
181
  onClose: onClose,
182
182
  searchValue: searchValue || '',
183
- title: (labels === null || labels === void 0 ? void 0 : labels.suggestedCategories) || '',
183
+ title: (labels === null || labels === void 0 ? void 0 : labels.suggestedCategoriesLabel) || '',
184
184
  labelsColor: labelsColor || '',
185
185
  textColor: textColor || ''
186
186
  }))), /*#__PURE__*/ React.createElement(ProductsWrapper, {
@@ -188,7 +188,7 @@ export var SearchBox = function(param) {
188
188
  }, /*#__PURE__*/ React.createElement(Products, {
189
189
  data: suggestions,
190
190
  bottomMenu: bottomMenu,
191
- title: labels === null || labels === void 0 ? void 0 : labels.products,
191
+ title: labels === null || labels === void 0 ? void 0 : labels.productsLabel,
192
192
  priceColor: priceColor,
193
193
  labelsColor: labelsColor,
194
194
  textColor: textColor,
@@ -197,7 +197,7 @@ export var SearchBox = function(param) {
197
197
  productSpacing: productSpacing
198
198
  }), bottomMenu === BottomMenuEnum.promo && promoOffers && /*#__PURE__*/ React.createElement(Products, {
199
199
  data: promoOffers,
200
- title: labels.promoOffers,
200
+ title: labels.promoOffersLabel,
201
201
  labelsColor: labelsColor,
202
202
  textColor: textColor,
203
203
  onClose: onClose,
@@ -1,48 +1,19 @@
1
1
  import React from 'react';
2
2
  import { useSeoTranslations } from '../../hooks/useSeoTranslations';
3
3
  import Head from 'next/head';
4
- import { useRouter } from 'next/router';
5
- function _extends() {
6
- _extends = Object.assign || function(target) {
7
- for(var i = 1; i < arguments.length; i++){
8
- var source = arguments[i];
9
- for(var key in source){
10
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11
- target[key] = source[key];
12
- }
13
- }
14
- }
15
- return target;
16
- };
17
- return _extends.apply(this, arguments);
18
- }
19
4
  export var TranslationsMeta = function() {
20
- var ref = useSeoTranslations(), translationsMap = ref.translationsMap, allLocales = ref.allLocales, defaultLocale = ref.defaultLocale;
21
- var router = useRouter();
22
- var defaultTranslation = translationsMap[defaultLocale];
23
- var isError = router.route === '/404' || router.route === '/_error';
24
- if (isError) return null;
25
- var domain = defaultTranslation === null || defaultTranslation === void 0 ? void 0 : defaultTranslation.domain;
26
- return(/*#__PURE__*/ React.createElement(Head, null, allLocales === null || allLocales === void 0 ? void 0 : allLocales.map(function(locale) {
27
- var translation = translationsMap === null || translationsMap === void 0 ? void 0 : translationsMap[locale];
28
- var href = translation === null || translation === void 0 ? void 0 : translation.slug;
29
- // go to the same page but with the right locale.
30
- // This is for pages that does not have a translated slug
31
- // example: /checkout -> /en/checkout, /ro/checkout
32
- if (!href) href = "/".concat(locale).concat(router.asPath);
33
- return(/*#__PURE__*/ React.createElement("link", _extends({
34
- rel: "alternate"
35
- }, {
36
- hreflang: locale
37
- }, {
38
- href: domain + href,
39
- key: 'Translation__' + href
40
- })));
41
- }), defaultTranslation && /*#__PURE__*/ React.createElement("link", _extends({
42
- rel: "alternate"
43
- }, {
44
- hreflang: 'x-default'
45
- }, {
46
- href: "".concat(domain).concat(defaultTranslation === null || defaultTranslation === void 0 ? void 0 : defaultTranslation.slug)
47
- }))));
5
+ var ref = useSeoTranslations() || {}, translations = ref.translations, defaultLocaleSlug = ref.defaultLocaleSlug;
6
+ if (!translations || !defaultLocaleSlug) return null;
7
+ return(/*#__PURE__*/ React.createElement(Head, null, translations === null || translations === void 0 ? void 0 : translations.map(function(translation) {
8
+ return(/*#__PURE__*/ React.createElement("link", {
9
+ rel: "alternate",
10
+ hrefLang: translation.locale,
11
+ href: translation.slug,
12
+ key: 'Translation__' + translation.slug
13
+ }));
14
+ }), /*#__PURE__*/ React.createElement("link", {
15
+ rel: "alternate",
16
+ hrefLang: "x-default",
17
+ href: defaultLocaleSlug
18
+ })));
48
19
  };
@@ -4,4 +4,3 @@ export * from './GlobalSEO';
4
4
  export * from './OpenGraph';
5
5
  export * from './ProductSEO';
6
6
  export * from './HiddenBreadcrumb';
7
- export * from './TranslationsMeta';
@@ -1,79 +1,38 @@
1
1
  import React from 'react';
2
- import { useRouter } from 'next/router';
3
- function _defineProperty(obj, key, value) {
4
- if (key in obj) {
5
- Object.defineProperty(obj, key, {
6
- value: value,
7
- enumerable: true,
8
- configurable: true,
9
- writable: true
10
- });
11
- } else {
12
- obj[key] = value;
13
- }
14
- return obj;
15
- }
16
- function _objectSpread(target) {
17
- for(var i = 1; i < arguments.length; i++){
18
- var source = arguments[i] != null ? arguments[i] : {};
19
- var ownKeys = Object.keys(source);
20
- if (typeof Object.getOwnPropertySymbols === "function") {
21
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
22
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
23
- }));
24
- }
25
- ownKeys.forEach(function(key) {
26
- _defineProperty(target, key, source[key]);
27
- });
28
- }
29
- return target;
30
- }
31
2
  var SeoTranslationsContext = /*#__PURE__*/ React.createContext({});
32
3
  export var SeoTranslationsProvider = function(param) {
33
4
  var children = param.children, translations = param.translations, defaultLocale = param.defaultLocale, localesMap = param.localesMap;
34
- var router = useRouter();
35
- var currentLocale = router.locale;
36
- var currentPath = router.asPath;
37
5
  var data1 = React.useMemo(function() {
38
- if (!translations) translations = {};
39
- translations[currentLocale] = {
40
- slug: currentPath.split('?')[0].replace("/".concat(currentLocale), ''),
41
- title: '',
42
- id: Date.now().toString()
43
- };
44
- var map = Object.keys(translations || {}).filter(function(lang) {
6
+ var defaultLocaleSlug = '';
7
+ var list = Object.keys(translations || {}).filter(function(lang) {
45
8
  return Boolean(localesMap[lang]);
46
- }).reduce(function(acc, lang) {
47
- var ref;
9
+ }).map(function(lang) {
48
10
  var data = translations === null || translations === void 0 ? void 0 : translations[lang];
49
11
  var localeData = localesMap[lang];
50
12
  var isDefault = defaultLocale === lang;
51
- var isFrontPage = data.slug === '/';
52
- var prefix = ((ref = data.slug) === null || ref === void 0 ? void 0 : ref[0]) === '/' ? '' : '/';
53
- var slug = "".concat(isDefault ? '' : "/".concat(lang)).concat(prefix).concat(isFrontPage ? '' : data.slug);
54
- return _objectSpread({}, acc, _defineProperty({}, lang, {
13
+ var slug = "".concat(localeData.domain, "/").concat(isDefault ? lang + '/' : '').concat(data.slug);
14
+ if (isDefault) defaultLocaleSlug = slug;
15
+ return {
55
16
  slug: slug,
17
+ title: data.title,
56
18
  locale: lang,
57
- isDefault: isDefault,
58
- domain: "https://".concat(localeData.domain)
59
- }));
60
- }, {});
19
+ isDefault: isDefault
20
+ };
21
+ });
61
22
  return {
62
- translationsMap: map,
23
+ translations: list,
63
24
  defaultLocale: defaultLocale,
64
- allLocales: Object.keys(localesMap)
25
+ defaultLocaleSlug: defaultLocaleSlug
65
26
  };
66
27
  }, [
67
28
  defaultLocale,
68
29
  translations,
69
- localesMap,
70
- currentLocale,
71
- currentPath
30
+ localesMap
72
31
  ]);
73
32
  return(/*#__PURE__*/ React.createElement(SeoTranslationsContext.Provider, {
74
33
  value: data1
75
34
  }, children));
76
35
  };
77
36
  export var useSeoTranslations = function() {
78
- return React.useContext(SeoTranslationsContext) || {};
37
+ return React.useContext(SeoTranslationsContext);
79
38
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export var GridStyles = function(param) {
3
- var spaceX = param.spaceX, breakpoints = param.breakpoints, _remSize = param.remSize, remSize = _remSize === void 0 ? 10 : _remSize, _spaceBetweenSections = param.spaceBetweenSections, spaceBetweenSections = _spaceBetweenSections === void 0 ? 80 : _spaceBetweenSections;
3
+ var spaceX = param.spaceX, breakpoints = param.breakpoints, _remSize = param.remSize, remSize = _remSize === void 0 ? 10 : _remSize;
4
4
  var getSize = function getSize(width) {
5
5
  return "min-width: calc(".concat(width, "% - ").concat(spaceX / remSize, "rem);") + "max-width: calc(".concat(width, "% - ").concat(spaceX / remSize, "rem);") + "margin: 0 ".concat(spaceX / 2 / remSize, "rem;");
6
6
  };
@@ -20,7 +20,7 @@ export var GridStyles = function(param) {
20
20
  }, '');
21
21
  return(/*#__PURE__*/ React.createElement("style", {
22
22
  dangerouslySetInnerHTML: {
23
- __html: "\n .Page--row {\n display: flex;\n display: -webkit-flex;\n flex-wrap: wrap;\n -webkit-flex-wrap: wrap;\n margin: 0 -".concat(spaceX / remSize / 2, "rem;\n }\n\n .Page__section {\n padding-bottom: ").concat(spaceBetweenSections / remSize, "rem;\n }\n\n .Page--col {\n display: block;\n width: 100%;\n }\n \n .size-default-inherit {\n width: 100%;\n }\n ").concat(queries, "\n ")
23
+ __html: "\n .Page--row {\n display: flex;\n display: -webkit-flex;\n flex-wrap: wrap;\n -webkit-flex-wrap: wrap;\n margin: 0 -".concat(spaceX / remSize / 2, "rem;\n }\n\n .Page__section {\n padding-bottom: 8rem;\n }\n\n .Page--col {\n display: block;\n width: 100%;\n }\n \n .size-default-inherit {\n width: 100%;\n }\n ").concat(queries, "\n ")
24
24
  }
25
25
  }));
26
26
  };
@@ -117,7 +117,7 @@ export var RangeSlideClasses = {
117
117
  thumbActive: 'RangeSlider--thumb-active'
118
118
  };
119
119
  export var RangeSliderInput = function(param) {
120
- var defaultValue = param.defaultValue, onChange = param.onChange, onSlide = param.onSlide, _min = param.min, min = _min === void 0 ? 0 : _min, _max = param.max, max = _max === void 0 ? 100 : _max, _step = param.step, step = _step === void 0 ? 1 : _step;
120
+ var defaultValue = param.defaultValue, onChange = param.onChange, _min = param.min, min = _min === void 0 ? 0 : _min, _max = param.max, max = _max === void 0 ? 100 : _max, _step = param.step, step = _step === void 0 ? 1 : _step;
121
121
  var ref1 = _slicedToArray(useState(defaultValue), 2), value = ref1[0], setValue = ref1[1];
122
122
  var inputLeftRef = React.useRef(null);
123
123
  var inputRightRef = React.useRef(null);
@@ -130,17 +130,6 @@ export var RangeSliderInput = function(param) {
130
130
  }, [
131
131
  defaultValue
132
132
  ]);
133
- var onSlideGeneric = function() {
134
- var inputLeft = inputLeftRef.current;
135
- var inputRight = inputRightRef.current;
136
- if (!inputLeft || !inputRight) return;
137
- var leftValue = Math.min(Number(inputLeft.value), Number(inputRight.value) - 1);
138
- var rightValue = Math.max(Number(inputRight.value), Number(inputLeft.value) + 1);
139
- onSlide === null || onSlide === void 0 ? void 0 : onSlide({
140
- left: leftValue,
141
- right: rightValue
142
- });
143
- };
144
133
  var updateLeftValue = useCallback(function() {
145
134
  var inputLeft = inputLeftRef.current;
146
135
  var inputRight = inputRightRef.current;
@@ -149,7 +138,6 @@ export var RangeSliderInput = function(param) {
149
138
  setValue(_objectSpread({}, value, {
150
139
  left: leftValue
151
140
  }));
152
- onSlideGeneric();
153
141
  }, [
154
142
  setValue,
155
143
  value
@@ -162,7 +150,6 @@ export var RangeSliderInput = function(param) {
162
150
  setValue(_objectSpread({}, value, {
163
151
  right: rightValue
164
152
  }));
165
- onSlideGeneric();
166
153
  }, [
167
154
  setValue,
168
155
  value
@@ -13,7 +13,6 @@ export * from './getTranslatableField';
13
13
  export * from './formatAsCurrency';
14
14
  export * from './createCatalogBreadcrumb';
15
15
  export * from './adjustColor';
16
- export * from './getLocaleFromPath';
17
16
  export * from './calcDiscount';
18
17
  export * from './canUseDom';
19
18
  export * from './getFirst';
@@ -1,4 +1,3 @@
1
- import { canUseDOM } from "./canUseDom";
2
1
  export function isTouchDevice() {
3
- return canUseDOM() && ('ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0);
2
+ return 'ontouchstart' in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
4
3
  }
@@ -3,10 +3,6 @@ export declare const useSlideFilter: (filterName: string, min: number, max: numb
3
3
  from: number;
4
4
  to: number;
5
5
  };
6
- applyFilter: (data: {
7
- from: number;
8
- to: number;
9
- }) => void;
10
6
  updateValue: (data: {
11
7
  from: number;
12
8
  to: number;
@@ -84,14 +84,4 @@ export interface ListingPageMeta {
84
84
  collapseMode?: StringField;
85
85
  limit: NumberField;
86
86
  includeVariants?: BooleanField;
87
- getTitle?: GetListingPageTitle;
88
87
  }
89
- export declare type GetListingPageTitle = (type: ListingTypesEnum, meta: Omit<ListingPageMeta, 'getTitle'>, data: {
90
- brand?: string;
91
- category?: string;
92
- defaultName?: string;
93
- attribute?: string;
94
- search?: string;
95
- isWithAttribute: boolean;
96
- childAttribute?: string;
97
- }) => string;
@@ -3,12 +3,11 @@ interface EmptyBoxProps {
3
3
  backgroundColor?: StringField;
4
4
  searchHistory?: any[];
5
5
  labels: GroupField<{
6
- promoOffers: StringField;
7
- products: StringField;
8
- recentSearches: StringField;
9
- popularSearches: StringField;
6
+ promoOffersLabel: StringField;
7
+ productsLabel: StringField;
8
+ recentSearchesLabel: StringField;
9
+ popularSearchesLabel: StringField;
10
10
  blogLabel: StringField;
11
- noResults: StringField;
12
11
  blog: GroupField<{
13
12
  blogTitle: StringField;
14
13
  image: StringField;