ecomlab-components-next 0.1.60 → 0.1.61

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.
@@ -23,7 +23,6 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
23
23
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
24
24
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
25
25
  var AdvantagesBlock = function AdvantagesBlock(_ref) {
26
- var _window;
27
26
  var title = _ref.title,
28
27
  _ref$list = _ref.list,
29
28
  list = _ref$list === void 0 ? [] : _ref$list,
@@ -32,45 +31,52 @@ var AdvantagesBlock = function AdvantagesBlock(_ref) {
32
31
  _ref$className = _ref.className,
33
32
  className = _ref$className === void 0 ? '' : _ref$className,
34
33
  width = _ref.width,
35
- btn = _ref.btn;
34
+ btn = _ref.btn,
35
+ _ref$linkMain = _ref.linkMain,
36
+ linkMain = _ref$linkMain === void 0 ? 'https://lk.ecomru.ru' : _ref$linkMain;
36
37
  var _useState = (0, _react.useState)(''),
37
38
  _useState2 = _slicedToArray(_useState, 2),
38
39
  refPage = _useState2[0],
39
40
  setRefPage = _useState2[1];
40
41
  var blocksRef = (0, _react.useRef)([]);
41
- var _useState3 = (0, _react.useState)([]),
42
+ var _useState3 = (0, _react.useState)(0),
42
43
  _useState4 = _slicedToArray(_useState3, 2),
43
44
  maxHeight = _useState4[0],
44
45
  setMaxHeight = _useState4[1];
45
- var _useState5 = (0, _react.useState)((_window = window) === null || _window === void 0 ? void 0 : _window.innerWidth),
46
+ var _useState5 = (0, _react.useState)(typeof window !== 'undefined' ? window.innerWidth : 0),
46
47
  _useState6 = _slicedToArray(_useState5, 2),
47
- withGeneral = _useState6[0],
48
- setWidthGeneral = _useState6[1];
49
- (0, _react.useEffect)(function () {
50
- var _window2;
51
- var currentUrl = (_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.location) === null || _window2 === void 0 ? void 0 : _window2.href;
52
- setRefPage("?ref_page=".concat(currentUrl));
53
- }, [list]);
54
- var setHeight = function setHeight() {
55
- var _window3;
56
- setWidthGeneral((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.innerWidth);
57
- setMaxHeight(0);
58
- var heights = blocksRef.current.map(function (block) {
48
+ windowWidth = _useState6[0],
49
+ setWindowWidth = _useState6[1];
50
+
51
+ // Мемоизированная функция для установки высоты
52
+ var setHeight = (0, _react.useCallback)(function () {
53
+ if (blocksRef.current.length === 0) return;
54
+ setWindowWidth(window.innerWidth);
55
+ var heights = blocksRef.current.filter(Boolean).map(function (block) {
59
56
  var _block$getBoundingCli;
60
57
  return (_block$getBoundingCli = block.getBoundingClientRect()) === null || _block$getBoundingCli === void 0 ? void 0 : _block$getBoundingCli.height;
61
58
  });
62
- var max = Math.max.apply(Math, _toConsumableArray(heights));
63
- setMaxHeight(max);
64
- };
59
+ if (heights.length > 0) {
60
+ setMaxHeight(Math.max.apply(Math, _toConsumableArray(heights)));
61
+ }
62
+ }, []);
63
+
64
+ // Эффект для рефа страницы
65
+ (0, _react.useEffect)(function () {
66
+ if (typeof window !== 'undefined') {
67
+ setRefPage("?ref_page=".concat(window.location.href));
68
+ }
69
+ }, []);
70
+
71
+ // Эффект для обработки ресайза
65
72
  (0, _react.useEffect)(function () {
73
+ if (typeof window === 'undefined') return;
74
+ setHeight(); // Инициализация высоты
66
75
  window.addEventListener("resize", setHeight);
67
- window.addEventListener('load', setHeight);
68
76
  return function () {
69
- var _window4;
70
77
  window.removeEventListener("resize", setHeight);
71
- (_window4 = window) === null || _window4 === void 0 || _window4.removeEventListener('load', setHeight);
72
78
  };
73
- }, [blocksRef]);
79
+ }, [setHeight]);
74
80
  return /*#__PURE__*/_react["default"].createElement("section", {
75
81
  className: "advantages-block ".concat(className)
76
82
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -83,35 +89,34 @@ var AdvantagesBlock = function AdvantagesBlock(_ref) {
83
89
  className: "advantages-block__description-white"
84
90
  }, descriptionWhite), (list === null || list === void 0 ? void 0 : list.length) > 0 && /*#__PURE__*/_react["default"].createElement("div", {
85
91
  className: "advantages-block__items"
86
- }, list === null || list === void 0 ? void 0 : list.map(function (_ref2, ind) {
87
- var title = _ref2.title,
88
- description = _ref2.description;
92
+ }, list.map(function (_ref2, index) {
93
+ var itemTitle = _ref2.title,
94
+ itemDescription = _ref2.description;
89
95
  return /*#__PURE__*/_react["default"].createElement("div", {
90
- className: "advantages-block__item ".concat(className),
91
- key: title + ind,
96
+ className: "advantages-block__item ".concat(className),
97
+ key: "".concat(itemTitle, "-").concat(index),
92
98
  style: {
93
- maxWidth: width == 'auto' ? 'fit-content' : ''
99
+ maxWidth: width === 'auto' ? 'fit-content' : undefined
94
100
  }
95
101
  }, /*#__PURE__*/_react["default"].createElement("div", {
96
102
  style: {
97
- height: withGeneral > 430 ? maxHeight : ''
103
+ height: windowWidth > 430 ? maxHeight : undefined
98
104
  }
99
- }, title && /*#__PURE__*/_react["default"].createElement("div", {
105
+ }, itemTitle && /*#__PURE__*/_react["default"].createElement("div", {
100
106
  className: "advantages-block__item-title",
101
107
  ref: function ref(el) {
102
- return blocksRef.current[ind] = el;
108
+ return blocksRef.current[index] = el;
103
109
  }
104
- }, title)), description && /*#__PURE__*/_react["default"].createElement("p", {
110
+ }, itemTitle)), itemDescription && /*#__PURE__*/_react["default"].createElement("p", {
105
111
  className: "advantages-block__item-description"
106
- }, description));
112
+ }, itemDescription));
107
113
  })), btn && /*#__PURE__*/_react["default"].createElement(_ButtonBasic["default"], {
108
114
  green: true,
109
115
  width: "320px",
110
116
  text: btn,
111
117
  onClick: function onClick() {
112
- var _window5;
113
- return (_window5 = window) === null || _window5 === void 0 ? void 0 : _window5.open("https://lk.ecomru.ru/auth".concat(refPage), '_blunk');
118
+ return window.open("".concat(linkMain, "/auth").concat(refPage), '_blank');
114
119
  }
115
120
  }));
116
121
  };
117
- var _default = exports["default"] = AdvantagesBlock;
122
+ var _default = exports["default"] = /*#__PURE__*/_react["default"].memo(AdvantagesBlock);
@@ -23,7 +23,9 @@ var BlocksInfo = function BlocksInfo(_ref) {
23
23
  var title = _ref.title,
24
24
  _ref$list = _ref.list,
25
25
  list = _ref$list === void 0 ? [] : _ref$list,
26
- child = _ref.child;
26
+ child = _ref.child,
27
+ _ref$linkMain = _ref.linkMain,
28
+ linkMain = _ref$linkMain === void 0 ? 'https://lk.ecomru.ru' : _ref$linkMain;
27
29
  var _useState = (0, _react.useState)(''),
28
30
  _useState2 = _slicedToArray(_useState, 2),
29
31
  refPage = _useState2[0],
@@ -72,7 +74,7 @@ var BlocksInfo = function BlocksInfo(_ref) {
72
74
  text: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C",
73
75
  onClick: function onClick() {
74
76
  var _window2;
75
- return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("https://lk.ecomru.ru/auth".concat(refPage), '_blunk');
77
+ return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("".concat(linkMain, "/auth").concat(refPage), '_blunk');
76
78
  },
77
79
  size: "50px",
78
80
  style: {
@@ -28,7 +28,9 @@ var list_about_us = [{
28
28
  var ClientsAboutUs = function ClientsAboutUs(_ref) {
29
29
  var blockquote = _ref.blockquote,
30
30
  cite = _ref.cite,
31
- title = _ref.title;
31
+ title = _ref.title,
32
+ _ref$linkMain = _ref.linkMain,
33
+ linkMain = _ref$linkMain === void 0 ? 'https://lk.ecomru.ru' : _ref$linkMain;
32
34
  var _useState = (0, _react.useState)(''),
33
35
  _useState2 = _slicedToArray(_useState, 2),
34
36
  refPage = _useState2[0],
@@ -65,14 +67,14 @@ var ClientsAboutUs = function ClientsAboutUs(_ref) {
65
67
  text: btnName ? btnName : 'Подключиться',
66
68
  onClick: function onClick() {
67
69
  var _window2;
68
- return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("https://lk.ecomru.ru/auth".concat(refPage), '_blunk');
70
+ return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("".concat(linkMain, "/auth").concat(refPage), '_blunk');
69
71
  },
70
72
  width: "130px",
71
73
  minWidth: "130px"
72
74
  }) : /*#__PURE__*/_react["default"].createElement("button", {
73
75
  onClick: function onClick() {
74
76
  var _window3;
75
- return (_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.open("https://lk.ecomru.ru/auth".concat(refPage), '_blunk');
77
+ return (_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.open("".concat(linkMain, "/auth").concat(refPage), '_blunk');
76
78
  },
77
79
  className: "clients-about-us__card-btn"
78
80
  }, btnName ? btnName : 'Подключиться'));
@@ -30,7 +30,9 @@ var Header = function Header(_ref) {
30
30
  name_service = _ref.name_service,
31
31
  icon_service = _ref.icon_service,
32
32
  hideYandex = _ref.hideYandex,
33
- arrIcon = _ref.arrIcon;
33
+ arrIcon = _ref.arrIcon,
34
+ _ref$linkMain = _ref.linkMain,
35
+ linkMain = _ref$linkMain === void 0 ? 'https://lk.ecomru.ru' : _ref$linkMain;
34
36
  var _useState = (0, _react.useState)(''),
35
37
  _useState2 = _slicedToArray(_useState, 2),
36
38
  refPage = _useState2[0],
@@ -94,7 +96,7 @@ var Header = function Header(_ref) {
94
96
  green: true,
95
97
  onClick: function onClick() {
96
98
  var _window2;
97
- return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("https://lk.ecomru.ru/auth".concat(refPage), '_blunk');
99
+ return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("".concat(linkMain, "/auth").concat(refPage), '_blunk');
98
100
  },
99
101
  text: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0431\u0435\u0441\u043F\u043B\u0430\u0442\u043D\u043E",
100
102
  maxWidth: "320px",
@@ -24,7 +24,9 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
24
24
  function DropMenuMobileVersion(_ref) {
25
25
  var items = _ref.items,
26
26
  isOpenMobileMenu = _ref.isOpenMobileMenu,
27
- setOpen = _ref.setOpen;
27
+ setOpen = _ref.setOpen,
28
+ _ref$linkMain = _ref.linkMain,
29
+ linkMain = _ref$linkMain === void 0 ? 'https://lk.ecomru.ru' : _ref$linkMain;
28
30
  var _useState = (0, _react.useState)(null),
29
31
  _useState2 = _slicedToArray(_useState, 2),
30
32
  activeItem = _useState2[0],
@@ -119,7 +121,7 @@ function DropMenuMobileVersion(_ref) {
119
121
  text: "\u0412\u043E\u0439\u0442\u0438",
120
122
  onClick: function onClick() {
121
123
  var _window2;
122
- return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("https://lk.ecomru.ru/auth".concat(refPage), '_blunk');
124
+ return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("".concat(linkMain, "/auth").concat(refPage), '_blunk');
123
125
  },
124
126
  style: {
125
127
  borderRadius: '4px'
@@ -130,7 +132,7 @@ function DropMenuMobileVersion(_ref) {
130
132
  text: "\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044F",
131
133
  onClick: function onClick() {
132
134
  var _window3;
133
- return (_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.open("https://lk.ecomru.ru/auth/signup".concat(refPage), '_blunk');
135
+ return (_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.open("".concat(linkMain, "/auth/signup").concat(refPage), '_blunk');
134
136
  },
135
137
  style: {
136
138
  borderRadius: '4px'
@@ -276,7 +276,9 @@ var btn = [{
276
276
  var Header = function Header(_ref) {
277
277
  var _ref$activeLang = _ref.activeLang,
278
278
  activeLang = _ref$activeLang === void 0 ? 'ru' : _ref$activeLang,
279
- setActiveLang = _ref.setActiveLang;
279
+ setActiveLang = _ref.setActiveLang,
280
+ _ref$linkMain = _ref.linkMain,
281
+ linkMain = _ref$linkMain === void 0 ? 'https://lk.ecomru.ru' : _ref$linkMain;
280
282
  var _useState = (0, _react.useState)(false),
281
283
  _useState2 = _slicedToArray(_useState, 2),
282
284
  isOpenSelect = _useState2[0],
@@ -425,7 +427,7 @@ var Header = function Header(_ref) {
425
427
  className: "select-language"
426
428
  }, gropBtn), activeLang === null || activeLang === void 0 ? void 0 : activeLang.toUpperCase(), /*#__PURE__*/_react["default"].createElement(_ArrowGreen.ArrowGreen, null)), /*#__PURE__*/_react["default"].createElement("a", {
427
429
  className: "header__link-box",
428
- href: "https://lk.ecomru.ru/auth".concat(refUtm ? "?ref_utm=".concat(refUtm) : ''),
430
+ href: "".concat(linkMain, "/auth").concat(refUtm ? "?ref_utm=".concat(refUtm) : ''),
429
431
  target: "_blank"
430
432
  }, /*#__PURE__*/_react["default"].createElement("button", {
431
433
  className: "header__btn-green"
@@ -25,7 +25,9 @@ var StepItems = function StepItems(_ref) {
25
25
  _ref$list = _ref.list,
26
26
  list = _ref$list === void 0 ? [] : _ref$list,
27
27
  _ref$className = _ref.className,
28
- className = _ref$className === void 0 ? '' : _ref$className;
28
+ className = _ref$className === void 0 ? '' : _ref$className,
29
+ _ref$linkMain = _ref.linkMain,
30
+ linkMain = _ref$linkMain === void 0 ? 'https://lk.ecomru.ru' : _ref$linkMain;
29
31
  var _useState = (0, _react.useState)(''),
30
32
  _useState2 = _slicedToArray(_useState, 2),
31
33
  refPage = _useState2[0],
@@ -67,7 +69,7 @@ var StepItems = function StepItems(_ref) {
67
69
  width: "100%",
68
70
  onClick: function onClick() {
69
71
  var _window2;
70
- return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("https://lk.ecomru.ru/auth".concat(refPage), '_blunk');
72
+ return (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.open("".concat(linkMain, "/auth").concat(refPage), '_blunk');
71
73
  }
72
74
  }));
73
75
  };
@@ -42,7 +42,9 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
42
42
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
43
43
  var TariffPlan = function TariffPlan(_ref) {
44
44
  var _btns$;
45
- var current = _ref.current;
45
+ var current = _ref.current,
46
+ _ref$linkMain = _ref.linkMain,
47
+ linkMain = _ref$linkMain === void 0 ? 'https://lk.ecomru.ru' : _ref$linkMain;
46
48
  var tarifs_cards_min_list = [{
47
49
  period: '1 Месяц'
48
50
  }, {
@@ -633,7 +635,7 @@ var TariffPlan = function TariffPlan(_ref) {
633
635
  text: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C",
634
636
  onClick: function onClick() {
635
637
  var _window;
636
- return (_window = window) === null || _window === void 0 ? void 0 : _window.open("https://lk.ecomru.ru/auth?ref-pricePlan=".concat(ref, "&ref-page=/settings/tariff"), '_blunk');
638
+ return (_window = window) === null || _window === void 0 ? void 0 : _window.open("".concat(linkMain, "/auth?ref-pricePlan=").concat(ref, "&ref-page=/settings/tariff"), '_blunk');
637
639
  },
638
640
  width: "100%",
639
641
  size: "36px",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecomlab-components-next",
3
- "version": "0.1.60",
3
+ "version": "0.1.61",
4
4
  "description": "A set of common and reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "files": [