contentoh-components-library 21.2.101 → 21.2.103

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 (106) hide show
  1. package/dist/components/atoms/GeneralButton/index.js +6 -2
  2. package/dist/components/atoms/Select/VersionSelect.js +2 -1
  3. package/dist/components/organisms/CreateVersion/RenderChilds.js +11 -11
  4. package/dist/components/organisms/CreateVersion/index.js +30 -89
  5. package/dist/components/organisms/VersionSelector/index.js +28 -2
  6. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +69 -147
  7. package/dist/components/pages/ProviderProductEdition/index.js +0 -20
  8. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +77 -67
  9. package/dist/components/pages/RetailerProductEdition/index.js +3 -22
  10. package/package.json +1 -1
  11. package/src/components/atoms/GeneralButton/index.js +4 -1
  12. package/src/components/atoms/Select/VersionSelect.js +4 -2
  13. package/src/components/organisms/CreateVersion/RenderChilds.js +28 -34
  14. package/src/components/organisms/CreateVersion/index.js +16 -36
  15. package/src/components/organisms/VersionSelector/index.js +18 -3
  16. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +75 -166
  17. package/src/components/pages/ProviderProductEdition/index.js +0 -19
  18. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +79 -67
  19. package/src/components/pages/RetailerProductEdition/index.js +0 -12
  20. package/src/global-files/customHooks.js +2 -2
  21. package/dist/assets/images/chatPopup/Spinner.gif +0 -0
  22. package/dist/assets/images/chatPopup/close.svg +0 -3
  23. package/dist/assets/images/chatPopup/defaultImage.png +0 -0
  24. package/dist/assets/images/chatPopup/defaultProfile.png +0 -0
  25. package/dist/assets/images/chatPopup/doc.svg +0 -1
  26. package/dist/assets/images/chatPopup/document.svg +0 -1
  27. package/dist/assets/images/chatPopup/iconChat.svg +0 -19
  28. package/dist/assets/images/chatPopup/iconPlus.svg +0 -3
  29. package/dist/assets/images/chatPopup/pdf.svg +0 -75
  30. package/dist/assets/images/chatPopup/remove.svg +0 -4
  31. package/dist/assets/images/chatPopup/send.svg +0 -3
  32. package/dist/assets/images/chatPopup/svgIcon.svg +0 -109
  33. package/dist/assets/images/chatPopup/upload_file.svg +0 -3
  34. package/dist/assets/images/chatPopup/xls.svg +0 -53
  35. package/dist/assets/images/customSelect/starIcon.svg +0 -14
  36. package/dist/assets/images/defaultImages/Spinner.gif +0 -0
  37. package/dist/assets/images/defaultImages/notFound.svg +0 -124
  38. package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -72
  39. package/dist/components/atoms/ButtonFileChooser/index.js +0 -118
  40. package/dist/components/atoms/ButtonFileChooser/styles.js +0 -20
  41. package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +0 -66
  42. package/dist/components/atoms/ButtonV2/index.js +0 -111
  43. package/dist/components/atoms/ButtonV2/styles.js +0 -53
  44. package/dist/components/atoms/ChatPopUp/ChatPopUp.stories.js +0 -28
  45. package/dist/components/atoms/ChatPopUp/index.js +0 -841
  46. package/dist/components/atoms/ChatPopUp/styles.js +0 -27
  47. package/dist/components/atoms/ChatPopUp/utils/handlersChat.js +0 -182
  48. package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +0 -50
  49. package/dist/components/atoms/CustomIcon/index.js +0 -40
  50. package/dist/components/atoms/CustomIcon/styles.js +0 -33
  51. package/dist/components/atoms/IconFile/IconFile.stories.js +0 -48
  52. package/dist/components/atoms/IconFile/index.js +0 -249
  53. package/dist/components/atoms/IconFile/styles.js +0 -23
  54. package/dist/components/atoms/Image/Image.stories.js +0 -73
  55. package/dist/components/atoms/Image/index.js +0 -76
  56. package/dist/components/atoms/Image/styles.js +0 -43
  57. package/dist/components/atoms/ImageLink/ImageLink.stories.js +0 -63
  58. package/dist/components/atoms/ImageLink/index.js +0 -77
  59. package/dist/components/atoms/ImageLink/styles.js +0 -40
  60. package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +0 -70
  61. package/dist/components/atoms/ImagePreview/index.js +0 -222
  62. package/dist/components/atoms/ImagePreview/styles.js +0 -44
  63. package/dist/components/atoms/InputText/InputText.stories.js +0 -60
  64. package/dist/components/atoms/InputText/index.js +0 -66
  65. package/dist/components/atoms/InputText/styles.js +0 -32
  66. package/dist/components/atoms/NotFound/NotFound.stories.js +0 -36
  67. package/dist/components/atoms/NotFound/index.js +0 -75
  68. package/dist/components/atoms/NotFound/styles.js +0 -20
  69. package/dist/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -45
  70. package/dist/components/atoms/SelectItemV2/index.js +0 -46
  71. package/dist/components/atoms/SelectItemV2/styles.js +0 -23
  72. package/dist/components/atoms/Tooltip/Tooltip.stories.js +0 -66
  73. package/dist/components/atoms/Tooltip/index.js +0 -72
  74. package/dist/components/atoms/Tooltip/styles.js +0 -20
  75. package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -66
  76. package/dist/components/molecules/ButtonDownloadFile/index.js +0 -179
  77. package/dist/components/molecules/ButtonDownloadFile/styles.js +0 -23
  78. package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -72
  79. package/dist/components/molecules/ImageTooltip/index.js +0 -84
  80. package/dist/components/molecules/ImageTooltip/styles.js +0 -33
  81. package/dist/components/molecules/SelectV2/SelectV2.stories.js +0 -119
  82. package/dist/components/molecules/SelectV2/index.js +0 -298
  83. package/dist/components/molecules/SelectV2/styles.js +0 -42
  84. package/dist/components/organisms/Chat/Chat.stories.js +0 -215
  85. package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -83
  86. package/dist/components/organisms/Chat/ChatLists/index.js +0 -160
  87. package/dist/components/organisms/Chat/ChatLists/styles.js +0 -29
  88. package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -176
  89. package/dist/components/organisms/Chat/ContainerItems/index.js +0 -569
  90. package/dist/components/organisms/Chat/ContainerItems/styles.js +0 -20
  91. package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -142
  92. package/dist/components/organisms/Chat/ContentChat/index.js +0 -1422
  93. package/dist/components/organisms/Chat/ContentChat/styles.js +0 -20
  94. package/dist/components/organisms/Chat/Footer/Footer.stories.js +0 -43
  95. package/dist/components/organisms/Chat/Footer/index.js +0 -984
  96. package/dist/components/organisms/Chat/Footer/styles.js +0 -32
  97. package/dist/components/organisms/Chat/Header/Header.stories.js +0 -96
  98. package/dist/components/organisms/Chat/Header/index.js +0 -84
  99. package/dist/components/organisms/Chat/Header/styles.js +0 -20
  100. package/dist/components/organisms/Chat/index.js +0 -327
  101. package/dist/components/organisms/Chat/styles.js +0 -29
  102. package/dist/components/organisms/Modal/Modal.stories.js +0 -66
  103. package/dist/components/organisms/Modal/index.js +0 -95
  104. package/dist/components/organisms/Modal/styles.js +0 -20
  105. package/dist/global-files/handle_http.js +0 -383
  106. package/dist/global-files/utils.js +0 -472
@@ -1,95 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Modal = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _styles = require("./styles");
13
-
14
- var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
15
-
16
- var _reactFontawesome = require("@fortawesome/react-fontawesome");
17
-
18
- var _material = require("@mui/material");
19
-
20
- var _ButtonV = require("../../atoms/ButtonV2");
21
-
22
- var _CustomIcon = require("../../atoms/CustomIcon");
23
-
24
- var _jsxRuntime = require("react/jsx-runtime");
25
-
26
- var Modal = function Modal(props) {
27
- var className = props.className,
28
- show = props.show,
29
- title = props.title,
30
- message = props.message,
31
- icon = props.icon,
32
- customComponent = props.customComponent,
33
- buttons = props.buttons,
34
- onClickModal = props.onClickModal,
35
- onClickBtnDefault = props.onClickBtnDefault;
36
- var icons = {
37
- error: _freeSolidSvgIcons.faClose,
38
- warning: _freeSolidSvgIcons.faExclamationTriangle,
39
- info: _freeSolidSvgIcons.faExclamation,
40
- success: _freeSolidSvgIcons.faCheck
41
- };
42
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Backdrop, {
43
- open: show,
44
- className: "container-backgroundModal",
45
- timeout: 400,
46
- style: {
47
- backgroundColor: "transparent",
48
- zIndex: 10
49
- },
50
- onClick: function onClick(event) {
51
- return onClickModal && onClickModal(event);
52
- },
53
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
54
- in: show,
55
- timeout: 400,
56
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ContainerModal, {
57
- className: className ? className : "",
58
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
59
- className: "contentModal",
60
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("header", {
61
- children: ![null, undefined, ""].includes(title === null || title === void 0 ? void 0 : title.trim()) && /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
62
- className: "label-title",
63
- children: title.trim()
64
- })
65
- }), icons[icon === null || icon === void 0 ? void 0 : icon.toLowerCase()] && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomIcon.CustomIcon, {
66
- type: "white",
67
- className: "iconModal " + "iconModal-" + icon.toLowerCase(),
68
- size: 35,
69
- borderType: "circle",
70
- icon: icons[icon.toLowerCase()]
71
- }), ![null, undefined, ""].includes(message === null || message === void 0 ? void 0 : message.trim()) && /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
72
- className: "label-message",
73
- children: [" ", message.trim(), " "]
74
- }), customComponent && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
75
- className: "container-customComponent",
76
- children: customComponent
77
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
78
- className: "container-buttons",
79
- children: buttons !== null && buttons !== void 0 && buttons.length ? buttons : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
80
- type: "white",
81
- borderType: "oval",
82
- label: "Aceptar",
83
- size: 12,
84
- onClick: function onClick(event) {
85
- return onClickBtnDefault && onClickBtnDefault(event);
86
- }
87
- }, "btn-Aceptar")
88
- })]
89
- })
90
- })
91
- })
92
- });
93
- };
94
-
95
- exports.Modal = Modal;
@@ -1,20 +0,0 @@
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.ContainerModal = 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 ContainerModal = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n height: 100%;\n overflow: auto;\n display: grid;\n place-items: center;\n background-color: rgba(0, 0, 0, 0.4);\n\n .contentModal {\n width: fit-content;\n max-width: 80%;\n min-width: 80px;\n height: fit-content;\n max-height: 90%;\n min-height: 120px;\n display: flex;\n flex-direction: column;\n align-items: center;\n background-color: white;\n border-radius: 10px;\n padding: 25px 25px 20px 25px;\n box-shadow: 0px 2px 4px 0px #00000040;\n\n header {\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n gap: 6px;\n margin-bottom: 20px;\n\n .label-title {\n width: 100%;\n text-align: center;\n font-family: ", ", sans-serif;\n font-size: 17px;\n line-height: 1.2;\n color: #262626;\n white-space: pre-wrap;\n }\n }\n\n .iconModal {\n width: 50px;\n height: 50px;\n font-size: 30px;\n border-width: 4px;\n margin-bottom: 20px;\n overflow: hidden;\n\n &.iconModal-error {\n background-color: #953737;\n border-color: #953737;\n color: white;\n }\n &.iconModal-warning {\n font-size: 27px;\n padding-bottom: 8px;\n color: #af9647;\n border-color: #af9647;\n }\n &.iconModal-info {\n border-color: #9e3e26;\n color: #9e3e26;\n }\n &.iconModal-success {\n }\n }\n\n .label-message {\n width: 100%;\n text-align: center;\n font-family: ", ", sans-serif;\n font-size: 13px;\n color: #707070;\n white-space: pre-wrap;\n }\n\n .container-customComponent {\n width: 100%;\n max-height: 50vh;\n display: flex;\n flex-direction: column;\n margin-top: 20px;\n padding: 0px 0px;\n //border: 1px solid red;\n }\n\n .container-buttons {\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: center;\n gap: 12px;\n margin-top: 20px;\n //border: 1px solid red;\n }\n }\n"])), _variables.FontFamily.RobotoMedium, _variables.FontFamily.RobotoRegular);
19
-
20
- exports.ContainerModal = ContainerModal;
@@ -1,383 +0,0 @@
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.fetchPUT = exports.fetchPOST = exports.fetchGET = exports.fetchDELETE = 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 _axios = _interopRequireDefault(require("axios"));
15
-
16
- //============================================================
17
-
18
- /**
19
- * funcion que realiza un axios GET
20
- *
21
- * Si <body> es undefined significa que hubo error
22
-
23
- * @returns { Promise<{
24
- * body: {} | undefined ,
25
- * message: string,
26
- * errorDetail: string
27
- * }> }
28
- *
29
- */
30
- //============================================================
31
- var fetchGET = function fetchGET() {
32
- var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
33
- var paramsQuery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34
- var paramsHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
35
- return new Promise( /*#__PURE__*/function () {
36
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(response) {
37
- var URL, keysParamsQuery, respHTTPjson, body, _body$message, _body$errorDetail;
38
-
39
- return _regenerator.default.wrap(function _callee$(_context) {
40
- while (1) {
41
- switch (_context.prev = _context.next) {
42
- case 0:
43
- _context.prev = 0;
44
- URL = endpoint;
45
- keysParamsQuery = Object.keys(paramsQuery); // agregar cada param query a la URL
46
-
47
- keysParamsQuery.forEach(function (key, index) {
48
- if (index == 0) {
49
- URL += "?".concat(key, "=").concat(paramsQuery[key]);
50
- } else {
51
- URL += "&".concat(key, "=").concat(paramsQuery[key]);
52
- }
53
- }); //console.log("URL:", URL);
54
-
55
- _context.next = 6;
56
- return _axios.default.get(URL, {
57
- headers: paramsHeaders
58
- });
59
-
60
- case 6:
61
- respHTTPjson = _context.sent;
62
-
63
- if (!(respHTTPjson.status !== 200)) {
64
- _context.next = 9;
65
- break;
66
- }
67
-
68
- return _context.abrupt("return", response({
69
- message: "No fue posible llevar a cabo la operación",
70
- errorDetail: respHTTPjson.statusText
71
- }));
72
-
73
- case 9:
74
- // obtener body backend
75
- body = JSON.parse(respHTTPjson.data.body); // verificar si existe error desde el backend
76
-
77
- if (!(respHTTPjson.data.statusCode !== 200)) {
78
- _context.next = 12;
79
- break;
80
- }
81
-
82
- return _context.abrupt("return", response({
83
- message: (_body$message = body.message) !== null && _body$message !== void 0 ? _body$message : "",
84
- errorDetail: (_body$errorDetail = body.errorDetail) !== null && _body$errorDetail !== void 0 ? _body$errorDetail : ""
85
- }));
86
-
87
- case 12:
88
- return _context.abrupt("return", response({
89
- body: body
90
- }));
91
-
92
- case 15:
93
- _context.prev = 15;
94
- _context.t0 = _context["catch"](0);
95
- return _context.abrupt("return", response({
96
- message: "Error al obtener los datos",
97
- errorDetail: _context.t0.message
98
- }));
99
-
100
- case 18:
101
- case "end":
102
- return _context.stop();
103
- }
104
- }
105
- }, _callee, null, [[0, 15]]);
106
- }));
107
-
108
- return function (_x) {
109
- return _ref.apply(this, arguments);
110
- };
111
- }());
112
- }; //============================================================
113
-
114
- /**
115
- * funcion que realiza un axios POST
116
- *
117
- * Si <body> es undefined significa que hubo error
118
-
119
- * @returns { Promise<{
120
- * body: {} | undefined ,
121
- * message: string,
122
- * errorDetail: string
123
- * }> }
124
- *
125
- */
126
- //============================================================
127
-
128
-
129
- exports.fetchGET = fetchGET;
130
-
131
- var fetchPOST = function fetchPOST() {
132
- var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
133
- var paramsBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
134
- var paramsHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
135
- return new Promise( /*#__PURE__*/function () {
136
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(response) {
137
- var respHTTPjson, body, _body$message2, _body$errorDetail2;
138
-
139
- return _regenerator.default.wrap(function _callee2$(_context2) {
140
- while (1) {
141
- switch (_context2.prev = _context2.next) {
142
- case 0:
143
- _context2.prev = 0;
144
- _context2.next = 3;
145
- return _axios.default.post(endpoint, paramsBody, {
146
- headers: paramsHeaders
147
- });
148
-
149
- case 3:
150
- respHTTPjson = _context2.sent;
151
-
152
- if (!(respHTTPjson.status !== 200)) {
153
- _context2.next = 6;
154
- break;
155
- }
156
-
157
- return _context2.abrupt("return", response({
158
- message: "No fue posible llevar a cabo la operación",
159
- errorDetail: respHTTPjson.statusText
160
- }));
161
-
162
- case 6:
163
- // obtener body backend
164
- body = JSON.parse(respHTTPjson.data.body); // verificar si existe error desde el backend
165
-
166
- if (!(respHTTPjson.data.statusCode !== 200)) {
167
- _context2.next = 10;
168
- break;
169
- }
170
-
171
- console.log(body);
172
- return _context2.abrupt("return", response({
173
- message: (_body$message2 = body.message) !== null && _body$message2 !== void 0 ? _body$message2 : "",
174
- errorDetail: (_body$errorDetail2 = body.errorDetail) !== null && _body$errorDetail2 !== void 0 ? _body$errorDetail2 : ""
175
- }));
176
-
177
- case 10:
178
- return _context2.abrupt("return", response({
179
- body: body
180
- }));
181
-
182
- case 13:
183
- _context2.prev = 13;
184
- _context2.t0 = _context2["catch"](0);
185
- return _context2.abrupt("return", response({
186
- message: "Error al guardar los datos",
187
- errorDetail: _context2.t0.message
188
- }));
189
-
190
- case 16:
191
- case "end":
192
- return _context2.stop();
193
- }
194
- }
195
- }, _callee2, null, [[0, 13]]);
196
- }));
197
-
198
- return function (_x2) {
199
- return _ref2.apply(this, arguments);
200
- };
201
- }());
202
- }; //============================================================
203
-
204
- /**
205
- * funcion que realiza un axios GET
206
- *
207
- * Si <body> es undefined significa que hubo error
208
-
209
- * @returns { Promise<{
210
- * body: {} | undefined ,
211
- * message: string,
212
- * errorDetail: string
213
- * }> }
214
- *
215
- */
216
- //============================================================
217
-
218
-
219
- exports.fetchPOST = fetchPOST;
220
-
221
- var fetchPUT = function fetchPUT() {
222
- var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
223
- var paramsBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
224
- var paramsHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
225
- return new Promise( /*#__PURE__*/function () {
226
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(response) {
227
- var respHTTPjson, body, _body$message3, _body$errorDetail3;
228
-
229
- return _regenerator.default.wrap(function _callee3$(_context3) {
230
- while (1) {
231
- switch (_context3.prev = _context3.next) {
232
- case 0:
233
- _context3.prev = 0;
234
- _context3.next = 3;
235
- return _axios.default.put(endpoint, paramsBody, {
236
- headers: paramsHeaders
237
- });
238
-
239
- case 3:
240
- respHTTPjson = _context3.sent;
241
-
242
- if (!(respHTTPjson.status !== 200)) {
243
- _context3.next = 6;
244
- break;
245
- }
246
-
247
- return _context3.abrupt("return", response({
248
- message: "No fue posible llevar a cabo la operación",
249
- errorDetail: respHTTPjson.statusText
250
- }));
251
-
252
- case 6:
253
- // obtener body backend
254
- body = JSON.parse(respHTTPjson.data.body); // verificar si existe error desde el backend
255
-
256
- if (!(respHTTPjson.data.statusCode !== 200)) {
257
- _context3.next = 9;
258
- break;
259
- }
260
-
261
- return _context3.abrupt("return", response({
262
- message: (_body$message3 = body.message) !== null && _body$message3 !== void 0 ? _body$message3 : "",
263
- errorDetail: (_body$errorDetail3 = body.errorDetail) !== null && _body$errorDetail3 !== void 0 ? _body$errorDetail3 : ""
264
- }));
265
-
266
- case 9:
267
- return _context3.abrupt("return", response({
268
- body: body
269
- }));
270
-
271
- case 12:
272
- _context3.prev = 12;
273
- _context3.t0 = _context3["catch"](0);
274
- return _context3.abrupt("return", response({
275
- message: "Error al actualizar los datos",
276
- errorDetail: _context3.t0.message
277
- }));
278
-
279
- case 15:
280
- case "end":
281
- return _context3.stop();
282
- }
283
- }
284
- }, _callee3, null, [[0, 12]]);
285
- }));
286
-
287
- return function (_x3) {
288
- return _ref3.apply(this, arguments);
289
- };
290
- }());
291
- }; //============================================================
292
-
293
- /**
294
- * funcion que realiza un axios GET
295
- *
296
- * Si <body> es undefined significa que hubo error
297
-
298
- * @returns { Promise<{
299
- * body: {} | undefined ,
300
- * message: string,
301
- * errorDetail: string
302
- * }> }
303
- *
304
- */
305
- //============================================================
306
-
307
-
308
- exports.fetchPUT = fetchPUT;
309
-
310
- var fetchDELETE = function fetchDELETE() {
311
- var endpoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
312
- var paramsBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
313
- var paramsHeaders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
314
- return new Promise( /*#__PURE__*/function () {
315
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(response) {
316
- var respHTTPjson, body, _body$message4, _body$errorDetail4;
317
-
318
- return _regenerator.default.wrap(function _callee4$(_context4) {
319
- while (1) {
320
- switch (_context4.prev = _context4.next) {
321
- case 0:
322
- _context4.prev = 0;
323
- _context4.next = 3;
324
- return _axios.default.delete(endpoint, {
325
- data: paramsBody,
326
- headers: paramsHeaders
327
- });
328
-
329
- case 3:
330
- respHTTPjson = _context4.sent;
331
-
332
- if (!(respHTTPjson.status !== 200)) {
333
- _context4.next = 6;
334
- break;
335
- }
336
-
337
- return _context4.abrupt("return", response({
338
- message: "No fue posible llevar a cabo la operación",
339
- errorDetail: respHTTPjson.statusText
340
- }));
341
-
342
- case 6:
343
- // obtener body backend
344
- body = JSON.parse(respHTTPjson.data.body); // verificar si existe error desde el backend
345
-
346
- if (!(respHTTPjson.data.statusCode !== 200)) {
347
- _context4.next = 9;
348
- break;
349
- }
350
-
351
- return _context4.abrupt("return", response({
352
- message: (_body$message4 = body.message) !== null && _body$message4 !== void 0 ? _body$message4 : "",
353
- errorDetail: (_body$errorDetail4 = body.errorDetail) !== null && _body$errorDetail4 !== void 0 ? _body$errorDetail4 : ""
354
- }));
355
-
356
- case 9:
357
- return _context4.abrupt("return", response({
358
- body: body
359
- }));
360
-
361
- case 12:
362
- _context4.prev = 12;
363
- _context4.t0 = _context4["catch"](0);
364
- return _context4.abrupt("return", response({
365
- message: "Error al actualizar los datos",
366
- errorDetail: _context4.t0.message
367
- }));
368
-
369
- case 15:
370
- case "end":
371
- return _context4.stop();
372
- }
373
- }
374
- }, _callee4, null, [[0, 12]]);
375
- }));
376
-
377
- return function (_x4) {
378
- return _ref4.apply(this, arguments);
379
- };
380
- }());
381
- };
382
-
383
- exports.fetchDELETE = fetchDELETE;