contentoh-components-library 21.2.46 → 21.2.48
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.
- package/dist/components/atoms/GeneralInput/index.js +4 -2
- package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +36 -0
- package/dist/components/atoms/ListCommercialRetailers/index.js +64 -0
- package/dist/components/atoms/ListCommercialRetailers/styles.js +20 -0
- package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +37 -0
- package/dist/components/atoms/MenuCommercialRetailers/index.js +25 -0
- package/dist/components/atoms/MenuCommercialRetailers/styles.js +20 -0
- package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +28 -0
- package/dist/components/atoms/MenuProductImage/index.js +88 -0
- package/dist/components/atoms/MenuProductImage/styles.js +20 -0
- package/dist/components/atoms/StatusTag/StatusTag.stories.js +48 -0
- package/dist/components/atoms/StatusTag/index.js +58 -0
- package/dist/components/atoms/StatusTag/styles.js +20 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +7 -16
- package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +25 -0
- package/dist/components/molecules/ApproveRejetPanel/index.js +49 -0
- package/dist/components/molecules/ApproveRejetPanel/styles.js +18 -0
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
- package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
- package/dist/components/molecules/CustomSelect/index.js +9 -36
- package/dist/components/molecules/CustomSelect/styles.js +1 -3
- package/dist/components/molecules/SignInLogin/index.js +22 -2
- package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +28 -0
- package/dist/components/molecules/SignInLoginCreationApp/index.js +270 -0
- package/dist/components/molecules/SignInLoginCreationApp/styles.js +20 -0
- package/dist/components/molecules/TagAndInput/index.js +4 -2
- package/dist/components/pages/Dashboard/Dashboard.stories.js +19 -19
- package/dist/components/pages/Dashboard/index.js +1 -1
- package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
- package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
- package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
- package/package.json +1 -1
- package/src/components/atoms/GeneralInput/index.js +2 -0
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +17 -15
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +11 -19
- package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
- package/src/components/molecules/CustomSelect/index.js +8 -32
- package/src/components/molecules/CustomSelect/styles.js +1 -3
- package/src/components/molecules/SignInLogin/index.js +18 -0
- package/src/components/molecules/TagAndInput/index.js +2 -0
- package/src/components/pages/Dashboard/Dashboard.stories.js +19 -19
- package/src/components/pages/Dashboard/index.js +1 -1
- package/dist/assets/images/customSelect/starIcon.svg +0 -14
- package/src/assets/images/customSelect/starIcon.svg +0 -14
|
@@ -11,8 +11,6 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/
|
|
|
11
11
|
|
|
12
12
|
var _index = require("./index");
|
|
13
13
|
|
|
14
|
-
var _starIcon = _interopRequireDefault(require("../../../assets/images/customSelect/starIcon.svg"));
|
|
15
|
-
|
|
16
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
15
|
|
|
18
16
|
var _default = {
|
|
@@ -28,26 +26,29 @@ var Template = function Template(args) {
|
|
|
28
26
|
var CustomSelectDefault = Template.bind({});
|
|
29
27
|
exports.CustomSelectDefault = CustomSelectDefault;
|
|
30
28
|
CustomSelectDefault.args = {
|
|
31
|
-
|
|
29
|
+
selectLabel: "Todos los departamentos",
|
|
32
30
|
defaultOption: "Todos los departamentos",
|
|
33
31
|
options: [{
|
|
34
|
-
id:
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
id: 1,
|
|
33
|
+
value: "Decoración",
|
|
34
|
+
subOptions: [{
|
|
35
|
+
id: 1,
|
|
36
|
+
value: "Espejos"
|
|
37
|
+
}, {
|
|
38
|
+
id: 2,
|
|
39
|
+
value: "Persianas"
|
|
40
|
+
}]
|
|
41
|
+
}, {
|
|
42
|
+
id: 2,
|
|
43
|
+
value: "Eléctrico"
|
|
44
|
+
}, {
|
|
45
|
+
id: 3,
|
|
46
|
+
value: "Ferretería"
|
|
47
|
+
}, {
|
|
48
|
+
id: 4,
|
|
49
|
+
value: "Herramientas"
|
|
37
50
|
}, {
|
|
38
|
-
id:
|
|
39
|
-
|
|
40
|
-
}]
|
|
41
|
-
onClickItem: function onClickItem(v, id) {
|
|
42
|
-
if (v) {
|
|
43
|
-
console.log("Agregar a la lista", id);
|
|
44
|
-
} else {
|
|
45
|
-
console.log("Eliminar a la lista", id);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
icon: _starIcon.default,
|
|
49
|
-
showSearchBar: true,
|
|
50
|
-
customOptions: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
51
|
-
children: "Esto es un customOptions"
|
|
52
|
-
})
|
|
51
|
+
id: 5,
|
|
52
|
+
value: "Iluminación"
|
|
53
|
+
}]
|
|
53
54
|
};
|
|
@@ -26,8 +26,7 @@ var SelecItem = function SelecItem(_ref) {
|
|
|
26
26
|
customSelectId = _ref.customSelectId,
|
|
27
27
|
setParameterArray = _ref.setParameterArray,
|
|
28
28
|
activeFilters = _ref.activeFilters,
|
|
29
|
-
setActiveFilters = _ref.setActiveFilters
|
|
30
|
-
onClickItem = _ref.onClickItem;
|
|
29
|
+
setActiveFilters = _ref.setActiveFilters;
|
|
31
30
|
|
|
32
31
|
var _useState = (0, _react.useState)(false),
|
|
33
32
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -47,10 +46,6 @@ var SelecItem = function SelecItem(_ref) {
|
|
|
47
46
|
id: "main-item-" + option.id,
|
|
48
47
|
label: option.name,
|
|
49
48
|
onChange: function onChange(e) {
|
|
50
|
-
if (onClickItem) {
|
|
51
|
-
onClickItem(e.target.checked, option.id);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
49
|
var subOptions = option.subOptions;
|
|
55
50
|
var filtersCopy = (0, _objectSpread2.default)({}, activeFilters);
|
|
56
51
|
|
|
@@ -113,10 +108,6 @@ var SelecItem = function SelecItem(_ref) {
|
|
|
113
108
|
label: sub.name,
|
|
114
109
|
defaultChecked: activeFilters[option.name] && activeFilters[option.name][sub.name],
|
|
115
110
|
onChange: function onChange(e) {
|
|
116
|
-
if (onClickItem) {
|
|
117
|
-
onClickItem(e.target.checked, sub.id);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
111
|
if (e.target.checked) {
|
|
121
112
|
setParameterArray(function (current) {
|
|
122
113
|
return [].concat((0, _toConsumableArray2.default)(current), [sub.id]).sort(function (a, b) {
|
|
@@ -35,12 +35,9 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
35
35
|
_ref$customSelectId = _ref.customSelectId,
|
|
36
36
|
customSelectId = _ref$customSelectId === void 0 ? "defaultSelectId" : _ref$customSelectId,
|
|
37
37
|
defaultOption = _ref.defaultOption,
|
|
38
|
-
setParameterArray = _ref.setParameterArray
|
|
39
|
-
onClickItem = _ref.onClickItem,
|
|
40
|
-
icon = _ref.icon,
|
|
41
|
-
customOptions = _ref.customOptions;
|
|
38
|
+
setParameterArray = _ref.setParameterArray;
|
|
42
39
|
|
|
43
|
-
var _useState = (0, _react.useState)([]),
|
|
40
|
+
var _useState = (0, _react.useState)(options || []),
|
|
44
41
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
45
42
|
filters = _useState2[0],
|
|
46
43
|
setFilters = _useState2[1];
|
|
@@ -86,25 +83,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
86
83
|
var end = new Date();
|
|
87
84
|
setStartDate(start);
|
|
88
85
|
setEndDate(end);
|
|
89
|
-
|
|
90
|
-
options.forEach(function (o) {
|
|
91
|
-
var name = o.name,
|
|
92
|
-
isSelected = o.isSelected,
|
|
93
|
-
subOptions = o.subOptions;
|
|
94
|
-
if (isSelected) obj[name] = {};
|
|
95
|
-
subOptions === null || subOptions === void 0 ? void 0 : subOptions.forEach(function (so) {
|
|
96
|
-
var nameSO = so.name,
|
|
97
|
-
isSelectedSO = so.isSelected;
|
|
98
|
-
|
|
99
|
-
if (isSelectedSO) {
|
|
100
|
-
if (!obj[name]) obj[name] = {};
|
|
101
|
-
obj[name][nameSO] = true;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
setActiveFilters(obj);
|
|
106
|
-
setFilters(options);
|
|
107
|
-
}, [options]);
|
|
86
|
+
}, []);
|
|
108
87
|
|
|
109
88
|
var onChangeDatePicker = function onChangeDatePicker(dates) {
|
|
110
89
|
var _dates = (0, _slicedToArray2.default)(dates, 2),
|
|
@@ -134,23 +113,18 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
134
113
|
}, [text]);
|
|
135
114
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
136
115
|
id: customSelectId,
|
|
137
|
-
selectLabel: selectLabel,
|
|
138
116
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
139
117
|
className: "button-list",
|
|
140
118
|
onClick: function onClick() {
|
|
141
119
|
return setShowList(!showList);
|
|
142
120
|
},
|
|
143
|
-
children: [
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
144
122
|
children: selectLabel
|
|
145
|
-
}),
|
|
146
|
-
src: icon,
|
|
147
|
-
alt: "Favorite",
|
|
148
|
-
width: "20px"
|
|
149
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
123
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
150
124
|
className: "arrow-item",
|
|
151
125
|
children: "\u25C0"
|
|
152
126
|
})]
|
|
153
|
-
}), showList &&
|
|
127
|
+
}), showList && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
154
128
|
className: "select-container",
|
|
155
129
|
children: [showSearchBar && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
156
130
|
className: "search-bar-filter",
|
|
@@ -166,7 +140,7 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
166
140
|
}), defaultOption && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
167
141
|
className: "default-option",
|
|
168
142
|
onClick: function onClick() {
|
|
169
|
-
setParameterArray
|
|
143
|
+
setParameterArray([]);
|
|
170
144
|
setActiveFilters({});
|
|
171
145
|
setShowList(false);
|
|
172
146
|
},
|
|
@@ -189,12 +163,11 @@ var CustomSelect = function CustomSelect(_ref) {
|
|
|
189
163
|
customSelectId: customSelectId,
|
|
190
164
|
setParameterArray: setParameterArray,
|
|
191
165
|
activeFilters: activeFilters,
|
|
192
|
-
setActiveFilters: setActiveFilters
|
|
193
|
-
onClickItem: onClickItem
|
|
166
|
+
setActiveFilters: setActiveFilters
|
|
194
167
|
}, customSelectId + option.id);
|
|
195
168
|
})
|
|
196
169
|
})]
|
|
197
|
-
})
|
|
170
|
+
}), showDatePicker && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Calendar.Calendar, {
|
|
198
171
|
onChange: onChangeDatePicker,
|
|
199
172
|
startDate: startDate,
|
|
200
173
|
endDate: endDate
|
|
@@ -15,8 +15,6 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n position: relative;\n\n .button-list {\n font-family: ", ";\n font-size: 13px;\n display: flex;\n padding:
|
|
19
|
-
return props.selectLabel !== "" ? "10px 15px" : "5px 5px";
|
|
20
|
-
});
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n position: relative;\n\n .button-list {\n font-family: ", ";\n font-size: 13px;\n display: flex;\n padding: 10px 15px;\n justify-content: space-between;\n border-radius: 50px;\n background-color: #fff;\n border: 1px solid #f0f0f0;\n cursor: pointer;\n\n .arrow-item {\n transform: rotate(-90deg);\n cursor: pointer;\n font-size: 10px;\n margin-left: 10px;\n }\n & + * {\n margin-top: 10px;\n }\n }\n\n .select-container {\n box-shadow: 0px 2px 4px #00000040;\n border-radius: 5px;\n background-color: #fff;\n padding-bottom: 10px;\n position: absolute;\n z-index: 10;\n .search-bar-filter {\n display: flex;\n align-items: center;\n border: 1px solid #f0f0f0;\n padding-left: 10px;\n\n img {\n width: 15px;\n height: 15px;\n }\n\n input {\n background-color: transparent;\n padding: 10px 10px;\n outline: none;\n border: none;\n }\n }\n .default-option {\n padding-top: 5px;\n cursor: pointer;\n padding: 5px 10px;\n color: #817393;\n font-family: Avenir Next;\n font-weight: 500;\n font-size: 13px;\n line-height: 21px;\n &:hover {\n background-color: #f0f0f0;\n }\n }\n .filters-container {\n overflow: auto;\n max-height: 500px;\n .option-container,\n .default-option {\n cursor: pointer;\n padding: 5px 10px;\n .main-item {\n display: flex;\n justify-content: space-between;\n\n .arrow-item {\n transform: rotate(-90deg);\n cursor: pointer;\n font-size: 10px;\n }\n }\n .sub-menu {\n padding-left: 20px;\n .sub-filter {\n & + * {\n margin-top: 10px;\n }\n }\n }\n\n &:hover {\n background-color: #f0f0f0;\n }\n label {\n white-space: nowrap;\n }\n }\n\n .dates-select-item {\n cursor: pointer;\n padding: 5px 10px;\n color: #817393;\n font-family: Avenir Next;\n font-weight: 500;\n font-size: 13px;\n line-height: 21px;\n &:hover {\n background-color: #f0f0f0;\n }\n }\n }\n }\n"])), _variables.FontFamily.Raleway);
|
|
21
19
|
|
|
22
20
|
exports.Container = Container;
|
|
@@ -228,7 +228,17 @@ var SignInLogin = function SignInLogin(props) {
|
|
|
228
228
|
inputType: "text",
|
|
229
229
|
label: "Nombre de usuario",
|
|
230
230
|
inputPlaceHolder: "username@contentoh.com",
|
|
231
|
-
inputId: "emailInput"
|
|
231
|
+
inputId: "emailInput",
|
|
232
|
+
onKeyDown: function onKeyDown(e) {
|
|
233
|
+
switch (e.key) {
|
|
234
|
+
case "Enter":
|
|
235
|
+
validate(e);
|
|
236
|
+
break;
|
|
237
|
+
|
|
238
|
+
default:
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
232
242
|
})
|
|
233
243
|
}), showErrors && emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
234
244
|
children: "Ingrese su correo"
|
|
@@ -240,7 +250,17 @@ var SignInLogin = function SignInLogin(props) {
|
|
|
240
250
|
inputType: "password",
|
|
241
251
|
label: "Contraseña",
|
|
242
252
|
inputPlaceHolder: "Escribe tu contraseña",
|
|
243
|
-
inputId: "passwordInput"
|
|
253
|
+
inputId: "passwordInput",
|
|
254
|
+
onKeyDown: function onKeyDown(e) {
|
|
255
|
+
switch (e.key) {
|
|
256
|
+
case "Enter":
|
|
257
|
+
validate(e);
|
|
258
|
+
break;
|
|
259
|
+
|
|
260
|
+
default:
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
244
264
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
245
265
|
src: _showPassword.default,
|
|
246
266
|
alt: "show password",
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.SignInLoginCreationAppDefault = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _index = require("./index");
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
var _default = {
|
|
17
|
+
title: "Components/molecules/SignInLoginCreationApp",
|
|
18
|
+
component: _index.SignInLoginCreationApp
|
|
19
|
+
};
|
|
20
|
+
exports.default = _default;
|
|
21
|
+
|
|
22
|
+
var Template = function Template(args) {
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.SignInLoginCreationApp, (0, _objectSpread2.default)({}, args));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
var SignInLoginCreationAppDefault = Template.bind({});
|
|
27
|
+
exports.SignInLoginCreationAppDefault = SignInLoginCreationAppDefault;
|
|
28
|
+
SignInLoginCreationAppDefault.args = {};
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SignInLoginCreationApp = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _styles = require("./styles");
|
|
17
|
+
|
|
18
|
+
var _index = require("../../atoms/LogoImage/index");
|
|
19
|
+
|
|
20
|
+
var _index2 = require("../../atoms/ScreenHeader/index");
|
|
21
|
+
|
|
22
|
+
var _index3 = require("../../atoms/GeneralButton/index");
|
|
23
|
+
|
|
24
|
+
var _index4 = require("../../atoms/CheckBox/index");
|
|
25
|
+
|
|
26
|
+
var _TagAndInput = require("../TagAndInput");
|
|
27
|
+
|
|
28
|
+
var _variables = require("../../../global-files/variables");
|
|
29
|
+
|
|
30
|
+
var _react = require("react");
|
|
31
|
+
|
|
32
|
+
var _Loading = require("../../atoms/Loading");
|
|
33
|
+
|
|
34
|
+
var _reactRouterDom = require("react-router-dom");
|
|
35
|
+
|
|
36
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
37
|
+
|
|
38
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
|
+
|
|
40
|
+
var SignInLoginCreationApp = function SignInLoginCreationApp(props) {
|
|
41
|
+
var _useState = (0, _react.useState)(false),
|
|
42
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
43
|
+
emptyEmail = _useState2[0],
|
|
44
|
+
setEmptyEmail = _useState2[1];
|
|
45
|
+
|
|
46
|
+
var _useState3 = (0, _react.useState)(false),
|
|
47
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
48
|
+
invalidEmail = _useState4[0],
|
|
49
|
+
setInvalidEmail = _useState4[1];
|
|
50
|
+
|
|
51
|
+
var _useState5 = (0, _react.useState)(false),
|
|
52
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
53
|
+
emptyPassword = _useState6[0],
|
|
54
|
+
setEmptyPassword = _useState6[1];
|
|
55
|
+
|
|
56
|
+
var _useState7 = (0, _react.useState)(true),
|
|
57
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
58
|
+
showErrors = _useState8[0],
|
|
59
|
+
setShowErrors = _useState8[1];
|
|
60
|
+
|
|
61
|
+
var _useState9 = (0, _react.useState)(""),
|
|
62
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
63
|
+
signInError = _useState10[0],
|
|
64
|
+
setSignInError = _useState10[1];
|
|
65
|
+
|
|
66
|
+
var _useState11 = (0, _react.useState)(false),
|
|
67
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
68
|
+
loading = _useState12[0],
|
|
69
|
+
setLoading = _useState12[1];
|
|
70
|
+
|
|
71
|
+
var _useState13 = (0, _react.useState)(false),
|
|
72
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
73
|
+
upgradePlanRedirect = _useState14[0],
|
|
74
|
+
setUpgradePlanRedirect = _useState14[1];
|
|
75
|
+
|
|
76
|
+
var validate = /*#__PURE__*/function () {
|
|
77
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
|
|
78
|
+
var valid, email, password, session, userGroup, response, userGroupValue, user, company;
|
|
79
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
80
|
+
while (1) {
|
|
81
|
+
switch (_context.prev = _context.next) {
|
|
82
|
+
case 0:
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
setSignInError("");
|
|
85
|
+
setShowErrors(true);
|
|
86
|
+
valid = true;
|
|
87
|
+
email = document.querySelector("#emailInput").value.trim();
|
|
88
|
+
password = document.querySelector("#passwordInput").value;
|
|
89
|
+
!/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(email) ? setInvalidEmail(true) : setInvalidEmail(false);
|
|
90
|
+
|
|
91
|
+
if (email === "") {
|
|
92
|
+
valid = false;
|
|
93
|
+
setEmptyEmail(true);
|
|
94
|
+
} else {
|
|
95
|
+
setEmptyEmail(false);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (password === "") {
|
|
99
|
+
valid = false;
|
|
100
|
+
setEmptyPassword(true);
|
|
101
|
+
} else {
|
|
102
|
+
setEmptyPassword(false);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!valid) {
|
|
106
|
+
_context.next = 35;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_context.prev = 10;
|
|
111
|
+
setLoading(true);
|
|
112
|
+
_context.next = 14;
|
|
113
|
+
return props.Auth.signIn(email, password);
|
|
114
|
+
|
|
115
|
+
case 14:
|
|
116
|
+
session = _context.sent;
|
|
117
|
+
|
|
118
|
+
if (!(session.challengeName === "NEW_PASSWORD_REQUIRED")) {
|
|
119
|
+
_context.next = 20;
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
props.setUser(session);
|
|
124
|
+
props.setPaso(8);
|
|
125
|
+
_context.next = 28;
|
|
126
|
+
break;
|
|
127
|
+
|
|
128
|
+
case 20:
|
|
129
|
+
userGroup = session.signInUserSession.accessToken.payload["cognito:groups"];
|
|
130
|
+
_context.next = 23;
|
|
131
|
+
return _axios.default.get(process.env.REACT_APP_USER_ENDPOINT, {
|
|
132
|
+
headers: {
|
|
133
|
+
Authorization: session.signInUserSession.idToken.jwtToken
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
case 23:
|
|
138
|
+
response = _context.sent;
|
|
139
|
+
console.log(userGroup);
|
|
140
|
+
console.log(userGroup[0]);
|
|
141
|
+
userGroupValue = typeof userGroup === "string" ? userGroup : userGroup[0];
|
|
142
|
+
|
|
143
|
+
if (userGroupValue === "colaboradores_contentoh") {
|
|
144
|
+
sessionStorage.setItem("auth", true);
|
|
145
|
+
sessionStorage.setItem("jwt", session.signInUserSession.idToken.jwtToken);
|
|
146
|
+
user = JSON.parse(response.data.body).data[0];
|
|
147
|
+
company = JSON.parse(response.data.body).data[1];
|
|
148
|
+
caches.keys().then(function (names) {
|
|
149
|
+
names.forEach(function (name) {
|
|
150
|
+
caches.delete(name);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
user.src = "https://".concat(process.env.REACT_APP_IMAGES_PROFILE_BUCKET, ".s3.amazonaws.com/id-").concat(user.id_user, "/").concat(user.id_user, ".png?").concat(new Date().getTime());
|
|
154
|
+
sessionStorage.setItem("user", JSON.stringify(user));
|
|
155
|
+
sessionStorage.setItem("company", JSON.stringify(company));
|
|
156
|
+
setUpgradePlanRedirect(true);
|
|
157
|
+
} else {
|
|
158
|
+
setSignInError("NotAuthorizedException");
|
|
159
|
+
setLoading(false);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
case 28:
|
|
163
|
+
_context.next = 35;
|
|
164
|
+
break;
|
|
165
|
+
|
|
166
|
+
case 30:
|
|
167
|
+
_context.prev = 30;
|
|
168
|
+
_context.t0 = _context["catch"](10);
|
|
169
|
+
console.log(_context.t0);
|
|
170
|
+
setLoading(false);
|
|
171
|
+
|
|
172
|
+
if (_context.t0.code === "NotAuthorizedException") {
|
|
173
|
+
setSignInError("NotAuthorizedException");
|
|
174
|
+
} else if (_context.t0.code === "UserNotConfirmedException") {
|
|
175
|
+
sessionStorage.setItem("email", JSON.stringify(document.querySelector("#usernameInput").value));
|
|
176
|
+
props.setPaso(5);
|
|
177
|
+
} else {
|
|
178
|
+
setSignInError("Error");
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
case 35:
|
|
182
|
+
case "end":
|
|
183
|
+
return _context.stop();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}, _callee, null, [[10, 30]]);
|
|
187
|
+
}));
|
|
188
|
+
|
|
189
|
+
return function validate(_x) {
|
|
190
|
+
return _ref.apply(this, arguments);
|
|
191
|
+
};
|
|
192
|
+
}();
|
|
193
|
+
|
|
194
|
+
(0, _react.useEffect)(function () {
|
|
195
|
+
sessionStorage.getItem("resetPasswordProcess") && sessionStorage.removeItem("resetPasswordProcess");
|
|
196
|
+
}, []);
|
|
197
|
+
(0, _react.useEffect)(function () {
|
|
198
|
+
if (upgradePlanRedirect) setLoading(false);
|
|
199
|
+
}, [upgradePlanRedirect]);
|
|
200
|
+
return loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
201
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
202
|
+
className: "home-login",
|
|
203
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
204
|
+
className: "main-container",
|
|
205
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.LogoImage, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
206
|
+
className: "credenciales",
|
|
207
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.ScreenHeader, {
|
|
208
|
+
fontFamily: _variables.FontFamily.AvenirNext,
|
|
209
|
+
color: _variables.GlobalColors.s5,
|
|
210
|
+
text: "Ingresa tus credenciales"
|
|
211
|
+
})
|
|
212
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
213
|
+
className: "user",
|
|
214
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
215
|
+
inputType: "text",
|
|
216
|
+
label: "Nombre de usuario",
|
|
217
|
+
inputPlaceHolder: "username@contentoh.com",
|
|
218
|
+
inputId: "emailInput"
|
|
219
|
+
})
|
|
220
|
+
}), showErrors && emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
221
|
+
children: "Ingrese su correo"
|
|
222
|
+
}), invalidEmail && !emptyEmail && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
223
|
+
children: "Ingrese un correo v\xE1lido"
|
|
224
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
225
|
+
className: "password",
|
|
226
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TagAndInput.TagAndInput, {
|
|
227
|
+
inputType: "password",
|
|
228
|
+
label: "Contraseña",
|
|
229
|
+
inputPlaceHolder: "Escribe tu contraseña",
|
|
230
|
+
inputId: "passwordInput"
|
|
231
|
+
})
|
|
232
|
+
}), showErrors && emptyPassword && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
233
|
+
children: "Ingrese su contrase\xF1a"
|
|
234
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
235
|
+
className: "select",
|
|
236
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index4.CheckBox, {
|
|
237
|
+
label: "Mantener sesión activada",
|
|
238
|
+
id: "chk-default",
|
|
239
|
+
className: "active-left"
|
|
240
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
241
|
+
onClick: function onClick() {
|
|
242
|
+
return props.setPaso(10);
|
|
243
|
+
},
|
|
244
|
+
className: "active-right",
|
|
245
|
+
children: "Olvide mi contrase\xF1a"
|
|
246
|
+
})]
|
|
247
|
+
}), showErrors && signInError === "NotAuthorizedException" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
248
|
+
children: "Correo o contrase\xF1a incorrectos"
|
|
249
|
+
}), showErrors && signInError === "Error" && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
250
|
+
children: "Ha habido un problema al iniciar sesi\xF3n"
|
|
251
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
252
|
+
className: "button-right",
|
|
253
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Button, {
|
|
254
|
+
buttonType: "general-default-button",
|
|
255
|
+
label: "Iniciar sesión",
|
|
256
|
+
onClick: function onClick(e) {
|
|
257
|
+
return validate(e);
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
})]
|
|
261
|
+
})
|
|
262
|
+
}), upgradePlanRedirect && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Redirect, {
|
|
263
|
+
to: {
|
|
264
|
+
pathname: "/dashboard"
|
|
265
|
+
}
|
|
266
|
+
})]
|
|
267
|
+
});
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
exports.SignInLoginCreationApp = SignInLoginCreationApp;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Container = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _variables = require("../../../global-files/variables");
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background: \"white\";\n display: flex;\n height: 100vh;\n width: 50%;\n justify-content: center;\n align-items: center;\n label {\n color: red;\n margin-top: 3px;\n margin-left: 15px;\n font-family: ", ";\n font-size: 11px;\n & + * {\n margin-top: 12px;\n }\n }\n\n &.home-login {\n .credenciales {\n & + * {\n margin-top: 30px;\n }\n }\n .user {\n & + * {\n margin-top: 20px;\n }\n }\n .password {\n & + * {\n margin-top: 20px;\n }\n }\n .select {\n display: flex;\n justify-content: space-between;\n .active-right {\n font-family: ", ";\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n letter-spacing: -0.015em;\n color: ", ";\n cursor: pointer;\n }\n & + * {\n margin-top: 50px;\n }\n }\n .button-right {\n text-align: right;\n & + * {\n margin-top: 55px;\n }\n }\n .new-login {\n p {\n font-family: ", ";\n text-align: right;\n font-weight: 500;\n font-size: 13px;\n line-height: 24px;\n color: ", ";\n cursor: pointer;\n span {\n color: ", ";\n }\n }\n }\n }\n .main-container {\n max-width: 80%;\n max-height: 80%;\n }\n"])), _variables.FontFamily.Raleway_700, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.secondary_magenta);
|
|
19
|
+
|
|
20
|
+
exports.Container = Container;
|
|
@@ -36,7 +36,8 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
36
36
|
description = _ref.description,
|
|
37
37
|
inputOnChange = _ref.inputOnChange,
|
|
38
38
|
color = _ref.color,
|
|
39
|
-
disabled = _ref.disabled
|
|
39
|
+
disabled = _ref.disabled,
|
|
40
|
+
onKeyDown = _ref.onKeyDown;
|
|
40
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
41
42
|
inputType: inputType,
|
|
42
43
|
className: "input-container",
|
|
@@ -71,7 +72,8 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
71
72
|
required: required,
|
|
72
73
|
optionList: optionList,
|
|
73
74
|
description: description,
|
|
74
|
-
inputOnChange: inputOnChange
|
|
75
|
+
inputOnChange: inputOnChange,
|
|
76
|
+
onKeyDown: onKeyDown
|
|
75
77
|
})]
|
|
76
78
|
}, "generalTagInput-".concat(inputType));
|
|
77
79
|
};
|
|
@@ -27,37 +27,37 @@ var DashboardDeafult = Template.bind({});
|
|
|
27
27
|
exports.DashboardDeafult = DashboardDeafult;
|
|
28
28
|
DashboardDeafult.args = {
|
|
29
29
|
user: {
|
|
30
|
-
id_user:
|
|
31
|
-
name: "
|
|
32
|
-
last_name: "
|
|
33
|
-
email: "
|
|
34
|
-
position: "
|
|
30
|
+
id_user: 59,
|
|
31
|
+
name: "The Home",
|
|
32
|
+
last_name: "Depot",
|
|
33
|
+
email: "cadena.ismael@allfreemail.net",
|
|
34
|
+
position: "Admin",
|
|
35
35
|
telephone: "+523111366336",
|
|
36
36
|
country: "México",
|
|
37
|
-
id_company:
|
|
38
|
-
id_cognito: "
|
|
37
|
+
id_company: 7,
|
|
38
|
+
id_cognito: "5884ae34-59d6-4454-b98e-821518bcc3a7",
|
|
39
39
|
birth_Date: null,
|
|
40
40
|
about_me: null,
|
|
41
41
|
zip_code: null,
|
|
42
42
|
address: null,
|
|
43
43
|
job: null,
|
|
44
|
-
id_stripe: "
|
|
44
|
+
id_stripe: "",
|
|
45
45
|
id_role: 0,
|
|
46
46
|
active: 1,
|
|
47
|
-
is_retailer:
|
|
47
|
+
is_retailer: 1,
|
|
48
48
|
email_notify: 1,
|
|
49
49
|
membership: {
|
|
50
|
-
id:
|
|
51
|
-
start_date: "
|
|
52
|
-
end_date: "
|
|
53
|
-
planID:
|
|
54
|
-
plan: "
|
|
55
|
-
name: "Plan
|
|
56
|
-
user_limit: "
|
|
57
|
-
products_limit: "
|
|
50
|
+
id: 24,
|
|
51
|
+
start_date: "2021-11-23T03:35:50.000Z",
|
|
52
|
+
end_date: "2022-11-23T03:35:50.000Z",
|
|
53
|
+
planID: 9,
|
|
54
|
+
plan: "prod_KtlkzZVGq6bRTO",
|
|
55
|
+
name: "Plan Enterprise Full",
|
|
56
|
+
user_limit: "30",
|
|
57
|
+
products_limit: "10000",
|
|
58
58
|
type: "Enterprise"
|
|
59
59
|
},
|
|
60
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
60
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-59/59.png?1663928202230"
|
|
61
61
|
},
|
|
62
|
-
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
62
|
+
jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5ZDYtNDQ1NC1iOThlLTgyMTUxOGJjYzNhNyIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJmY2IzMGVjYi1lMjc1LTQyM2UtYjQwMi05YTBjMWNjNzM2YzMiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY2MzkyODIwMCwibmFtZSI6IkNhZGVuYSBJc21hZWwiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMzY2MzM2IiwiZXhwIjoxNjYzOTMxODAwLCJpYXQiOjE2NjM5MjgyMDAsImVtYWlsIjoiY2FkZW5hLmlzbWFlbEBhbGxmcmVlbWFpbC5uZXQifQ.E5NPYa6ucsQGTij8gzihdT2zv7gmJwxCZwrbBnQSYXIBw7cMK7U0eC7z4VBEm3tFYCA9SoxIdQtfuGj_lw2-CaXqkkMu4929TtlrrK_nVHYlwsXMSGIW3bComTb2toX8bshD1kd3FnNBFujhrQ-ouuBfQjy2d4fVZA1M4sZi_eT8Lxjo1uI_LfgYxrlS8_IKgfz71NuM-Uc2vxidm2_AG0g7PboSPW24bv1R-Lv272hoR_SmjBPY-I2Pw8DTZwQxWmtoU_MOx1YnY97qx5G6zqbTsjbNYkk97xPb87tKQTo946pB80fOkipTrD2xwhc8AOZQywwKa5NT4nGayDKLdg"
|
|
63
63
|
};
|
|
@@ -174,7 +174,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
174
174
|
while (1) {
|
|
175
175
|
switch (_context2.prev = _context2.next) {
|
|
176
176
|
case 0:
|
|
177
|
-
isTHDUser =
|
|
177
|
+
isTHDUser = user.is_retailer === 1;
|
|
178
178
|
_context2.next = 3;
|
|
179
179
|
return _axios.default.get("".concat(process.env.REACT_APP_RETAILER_ENDPOINT), {
|
|
180
180
|
headers: {
|