ecomlab-components-next 0.1.208 → 0.1.210

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.
@@ -831,7 +831,7 @@ var ArticleViewV2 = function ArticleViewV2(_ref) {
831
831
  setListLinks: setListLinks,
832
832
  fetchDataById: fetchDataById,
833
833
  activeLang: activeLang
834
- })))), (listPreview === null || listPreview === void 0 ? void 0 : listPreview.length) && /*#__PURE__*/_react["default"].createElement("div", {
834
+ })))), listPreview !== null && listPreview !== void 0 && listPreview.length ? /*#__PURE__*/_react["default"].createElement("div", {
835
835
  className: "article-view__this-will-be-interesting"
836
836
  }, /*#__PURE__*/_react["default"].createElement("h2", {
837
837
  className: "article-view__this-will-be-interesting-title"
@@ -869,6 +869,6 @@ var ArticleViewV2 = function ArticleViewV2(_ref) {
869
869
  // }}
870
870
  }));
871
871
  // </div>
872
- }))));
872
+ }))) : null);
873
873
  };
874
874
  var _default = exports["default"] = ArticleViewV2;
@@ -22,7 +22,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
22
22
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
23
23
  var formStubTitle = '';
24
24
  var formStubSubTitle = '';
25
- var formStubBitrixToken = 'hxdxe0cpclw65c0j';
25
+ var formStubBitrixToken = 'gAAAAABopIEPlTICTdgD52GgH_GRFS30Tou2Ok2ICeC3ECQ8_aSQMMjTqU0HS7y9krbifcKbXroyR0iMmN6UXq1KL4xP0UtjYg==';
26
+ var urlFetch = "https://apps0.ecomru.ru:4447/api/crm/deals/create?step_id=167&token=".concat(formStubBitrixToken, "&author=546&responsible=546");
26
27
  var FormBtn = exports.FormBtn = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
27
28
  var data = _ref.data,
28
29
  onChange = _ref.onChange,
@@ -288,6 +289,38 @@ var FormBtn = exports.FormBtn = /*#__PURE__*/(0, _react.forwardRef)(function (_r
288
289
  type: 'input',
289
290
  hidden: true
290
291
  }];
292
+ var formStubData = [{
293
+ id: 'name',
294
+ placeholder: '',
295
+ hidden: true,
296
+ value: 'Лид клиент',
297
+ inputType: 'text',
298
+ type: 'input'
299
+ }, {
300
+ id: 'f_61',
301
+ placeholder: 'Имя',
302
+ inputType: 'name',
303
+ required: true,
304
+ type: 'input'
305
+ }, {
306
+ id: 'f_62',
307
+ placeholder: 'Email',
308
+ inputType: 'email',
309
+ type: 'input',
310
+ required: true
311
+ }, {
312
+ id: 'f_63',
313
+ placeholder: 'Телефон',
314
+ inputType: 'tel',
315
+ type: 'input',
316
+ required: true
317
+ }, {
318
+ id: 'f_64',
319
+ placeholder: 'Комментарий',
320
+ inputType: 'description',
321
+ type: 'textarea',
322
+ required: true
323
+ }];
291
324
  var currentColor = function currentColor() {
292
325
  if (activePortal == '6') return '#22C55E'; //gtcom зел
293
326
  if (activePortal == '2') return '#1890FF'; //ecom гол
@@ -378,9 +411,10 @@ var FormBtn = exports.FormBtn = /*#__PURE__*/(0, _react.forwardRef)(function (_r
378
411
  setIsModal: function setIsModal(e) {
379
412
  return setIsModalBitrix(e);
380
413
  },
381
- inputArr: translateformStubData(),
414
+ inputArr: formStubData,
382
415
  bitrixToken: formStubBitrixToken,
383
- subTitle: translateFreeConsultation()
416
+ subTitle: translateFreeConsultation(),
417
+ urlFetch: urlFetch
384
418
  }), /*#__PURE__*/_react["default"].createElement("p", {
385
419
  className: "text_blue",
386
420
  onClick: function onClick(e) {
@@ -49,7 +49,9 @@ var ModalBitrixForm = exports.ModalBitrixForm = function ModalBitrixForm(_ref) {
49
49
  _ref$activeLang = _ref.activeLang,
50
50
  activeLang = _ref$activeLang === void 0 ? 'ru' : _ref$activeLang,
51
51
  _ref$communication = _ref.communication,
52
- communication = _ref$communication === void 0 ? false : _ref$communication;
52
+ communication = _ref$communication === void 0 ? false : _ref$communication,
53
+ _ref$urlFetch = _ref.urlFetch,
54
+ urlFetch = _ref$urlFetch === void 0 ? '' : _ref$urlFetch;
53
55
  var _useState = (0, _react.useState)({}),
54
56
  _useState2 = _slicedToArray(_useState, 2),
55
57
  inputValue = _useState2[0],
@@ -87,7 +89,7 @@ var ModalBitrixForm = exports.ModalBitrixForm = function ModalBitrixForm(_ref) {
87
89
  return 'Отправить';
88
90
  };
89
91
  var fetchTest = function fetchTest() {
90
- var _current$map;
92
+ var _Object$entries;
91
93
  var tg;
92
94
  var current = Object.entries(inputValue).filter(function (_ref2) {
93
95
  var _ref3 = _slicedToArray(_ref2, 2),
@@ -98,34 +100,22 @@ var ModalBitrixForm = exports.ModalBitrixForm = function ModalBitrixForm(_ref) {
98
100
  }
99
101
  return key != 'FIELDS[TG]';
100
102
  });
101
- var queries = current === null || current === void 0 || (_current$map = current.map(function (_ref4) {
103
+ var queries = (_Object$entries = Object.entries(inputValue)) === null || _Object$entries === void 0 || (_Object$entries = _Object$entries.map(function (_ref4) {
102
104
  var _ref5 = _slicedToArray(_ref4, 2),
103
105
  key = _ref5[0],
104
106
  value = _ref5[1];
105
- if (key == 'FIELDS[TITLE]') {
106
- return "".concat(key, "=").concat(value + ' // ' + inputValue['FIELDS[NAME]']);
107
+ if (key == 'name') {
108
+ return "".concat(key, "=").concat(value + ' // ' + inputValue['f_61']);
107
109
  }
108
110
  if (key == 'FIELDS[COMMENTS]') {
109
- if (selectedValue !== null && selectedValue !== void 0 && selectedValue.label) {
110
- if (communication) {
111
- return "".concat(key, "=\u0421\u043F\u043E\u0441\u043E\u0431 \u0441\u0432\u044F\u0437\u0438: ").concat(selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label, " // ").concat(value);
112
- } else {
113
- return "".concat(key, "=\u0422\u0438\u043F \u043F\u0430\u0440\u0442\u043D\u0435\u0440\u0430: ").concat(selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label, " // ").concat(value);
114
- }
115
- }
116
-
117
- // return selectedValue?.label
118
- // ?
119
- // `${key}=Тип партнера: ${selectedValue?.label} // ${value}`
120
- // :
121
- // `${key}=${value}`
111
+ return selectedValue !== null && selectedValue !== void 0 && selectedValue.label ? "".concat(key, "=\u0422\u0438\u043F \u043F\u0430\u0440\u0442\u043D\u0435\u0440\u0430: ").concat(selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label, " // ").concat(value) : "".concat(key, "=").concat(value);
122
112
  } else return "".concat(key, "=").concat(value);
123
- })) === null || _current$map === void 0 ? void 0 : _current$map.join('&');
124
- var testUrl = "https://ecs.bitrix24.ru/rest/1/".concat(bitrixToken, "/crm.lead.add.json?").concat(queries);
113
+ })) === null || _Object$entries === void 0 ? void 0 : _Object$entries.join('&');
114
+ var testUrl = "".concat(urlFetch, "&").concat(queries);
125
115
  fetch(testUrl).then(function (res) {
126
116
  return res.json();
127
117
  }).then(function (json) {
128
- if (json !== null && json !== void 0 && json.result) {
118
+ if (json) {
129
119
  setsuccessfulResponse(true);
130
120
  }
131
121
  })["catch"](function (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecomlab-components-next",
3
- "version": "0.1.208",
3
+ "version": "0.1.210",
4
4
  "description": "A set of common and reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "files": [