contentoh-components-library 21.3.5 → 21.3.7

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 (186) hide show
  1. package/.env.development +3 -0
  2. package/dist/assets/images/customSelect/starIcon.svg +14 -0
  3. package/dist/assets/images/defaultImages/Spinner.gif +0 -0
  4. package/dist/assets/images/defaultImages/notFound.svg +124 -0
  5. package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +72 -0
  6. package/dist/components/atoms/ButtonFileChooser/index.js +118 -0
  7. package/dist/components/atoms/ButtonFileChooser/styles.js +20 -0
  8. package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +66 -0
  9. package/dist/components/atoms/ButtonV2/index.js +110 -0
  10. package/dist/components/atoms/ButtonV2/styles.js +53 -0
  11. package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +50 -0
  12. package/dist/components/atoms/CustomIcon/index.js +40 -0
  13. package/dist/components/atoms/CustomIcon/styles.js +33 -0
  14. package/dist/components/atoms/IconFile/IconFile.stories.js +48 -0
  15. package/dist/components/atoms/IconFile/index.js +249 -0
  16. package/dist/components/atoms/IconFile/styles.js +23 -0
  17. package/dist/components/atoms/Image/Image.stories.js +73 -0
  18. package/dist/components/atoms/Image/index.js +76 -0
  19. package/dist/components/atoms/Image/styles.js +43 -0
  20. package/dist/components/atoms/ImageLink/ImageLink.stories.js +63 -0
  21. package/dist/components/atoms/ImageLink/index.js +77 -0
  22. package/dist/components/atoms/ImageLink/styles.js +40 -0
  23. package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +70 -0
  24. package/dist/components/atoms/ImagePreview/index.js +222 -0
  25. package/dist/components/atoms/ImagePreview/styles.js +44 -0
  26. package/dist/components/atoms/InputText/InputText.stories.js +60 -0
  27. package/dist/components/atoms/InputText/index.js +66 -0
  28. package/dist/components/atoms/InputText/styles.js +32 -0
  29. package/dist/components/atoms/NotFound/NotFound.stories.js +36 -0
  30. package/dist/components/atoms/NotFound/index.js +75 -0
  31. package/dist/components/atoms/NotFound/styles.js +20 -0
  32. package/dist/components/atoms/ProgressBar/index.js +36 -6
  33. package/dist/components/atoms/ProgressBar/styles.js +11 -3
  34. package/dist/components/atoms/SelectItemV2/SelectItemV2.stories.js +45 -0
  35. package/dist/components/atoms/SelectItemV2/index.js +57 -0
  36. package/dist/components/atoms/SelectItemV2/styles.js +30 -0
  37. package/dist/components/atoms/Tooltip/Tooltip.stories.js +66 -0
  38. package/dist/components/atoms/Tooltip/index.js +72 -0
  39. package/dist/components/atoms/Tooltip/styles.js +20 -0
  40. package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +66 -0
  41. package/dist/components/molecules/ButtonDownloadFile/index.js +179 -0
  42. package/dist/components/molecules/ButtonDownloadFile/styles.js +23 -0
  43. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
  44. package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
  45. package/dist/components/molecules/Dropdown/Dropdown.stories.js +98 -0
  46. package/dist/components/molecules/Dropdown/index.js +150 -0
  47. package/dist/components/molecules/Dropdown/styles.js +26 -0
  48. package/dist/components/molecules/HeaderTop/index.js +10 -5
  49. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  50. package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +82 -0
  51. package/dist/components/molecules/ImageTooltip/index.js +85 -0
  52. package/dist/components/molecules/ImageTooltip/styles.js +33 -0
  53. package/dist/components/molecules/ProductNameHeader/index.js +5 -3
  54. package/dist/components/molecules/SelectV2/SelectV2.stories.js +119 -0
  55. package/dist/components/molecules/SelectV2/index.js +306 -0
  56. package/dist/components/molecules/SelectV2/styles.js +42 -0
  57. package/dist/components/molecules/SelectV2/test.js +95 -0
  58. package/dist/components/molecules/SelectV2/test.stories.js +27 -0
  59. package/dist/components/organisms/Chat/Chat.stories.js +215 -0
  60. package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +83 -0
  61. package/dist/components/organisms/Chat/ChatLists/index.js +160 -0
  62. package/dist/components/organisms/Chat/ChatLists/styles.js +29 -0
  63. package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +176 -0
  64. package/dist/components/organisms/Chat/ContainerItems/index.js +569 -0
  65. package/dist/components/organisms/Chat/ContainerItems/styles.js +20 -0
  66. package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +142 -0
  67. package/dist/components/organisms/Chat/ContentChat/index.js +1422 -0
  68. package/dist/components/organisms/Chat/ContentChat/styles.js +20 -0
  69. package/dist/components/organisms/Chat/Footer/Footer.stories.js +43 -0
  70. package/dist/components/organisms/Chat/Footer/index.js +984 -0
  71. package/dist/components/organisms/Chat/Footer/styles.js +32 -0
  72. package/dist/components/organisms/Chat/Header/Header.stories.js +96 -0
  73. package/dist/components/organisms/Chat/Header/index.js +84 -0
  74. package/dist/components/organisms/Chat/Header/styles.js +20 -0
  75. package/dist/components/organisms/Chat/index.js +327 -0
  76. package/dist/components/organisms/Chat/styles.js +29 -0
  77. package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
  78. package/dist/components/organisms/Modal/Modal.stories.js +66 -0
  79. package/dist/components/organisms/Modal/index.js +95 -0
  80. package/dist/components/organisms/Modal/styles.js +20 -0
  81. package/dist/components/organisms/RangeCalendar/RangeCalendar.stories.js +33 -0
  82. package/dist/components/organisms/RangeCalendar/index.js +148 -0
  83. package/dist/components/organisms/RangeCalendar/styles.js +27 -0
  84. package/dist/components/pages/ProviderProductEdition/index.js +8 -8
  85. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +60 -86
  86. package/dist/components/pages/RetailerProductEdition/index.js +13 -12
  87. package/dist/global-files/fonts.css +6 -0
  88. package/dist/global-files/handle_http.js +383 -0
  89. package/dist/global-files/utils.js +484 -0
  90. package/dist/global-files/variables.js +2 -0
  91. package/dist/index.js +267 -46
  92. package/package.json +12 -1
  93. package/src/assets/images/customSelect/starIcon.svg +14 -0
  94. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  95. package/src/assets/images/defaultImages/notFound.svg +124 -0
  96. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
  97. package/src/components/atoms/ButtonFileChooser/index.js +69 -0
  98. package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
  99. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +53 -0
  100. package/src/components/atoms/ButtonV2/index.js +85 -0
  101. package/src/components/atoms/ButtonV2/styles.js +217 -0
  102. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
  103. package/src/components/atoms/CustomIcon/index.js +41 -0
  104. package/src/components/atoms/CustomIcon/styles.js +85 -0
  105. package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
  106. package/src/components/atoms/IconFile/index.js +119 -0
  107. package/src/components/atoms/IconFile/styles.js +67 -0
  108. package/src/components/atoms/Image/Image.stories.js +51 -0
  109. package/src/components/atoms/Image/index.js +55 -0
  110. package/src/components/atoms/Image/styles.js +34 -0
  111. package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
  112. package/src/components/atoms/ImageLink/index.js +57 -0
  113. package/src/components/atoms/ImageLink/styles.js +30 -0
  114. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
  115. package/src/components/atoms/ImagePreview/index.js +191 -0
  116. package/src/components/atoms/ImagePreview/styles.js +77 -0
  117. package/src/components/atoms/InputText/InputText.stories.js +39 -0
  118. package/src/components/atoms/InputText/index.js +61 -0
  119. package/src/components/atoms/InputText/styles.js +89 -0
  120. package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
  121. package/src/components/atoms/NotFound/index.js +52 -0
  122. package/src/components/atoms/NotFound/styles.js +55 -0
  123. package/src/components/atoms/ProgressBar/index.js +40 -5
  124. package/src/components/atoms/ProgressBar/styles.js +24 -0
  125. package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +26 -0
  126. package/src/components/atoms/SelectItemV2/index.js +61 -0
  127. package/src/components/atoms/SelectItemV2/styles.js +90 -0
  128. package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
  129. package/src/components/atoms/Tooltip/index.js +59 -0
  130. package/src/components/atoms/Tooltip/styles.js +42 -0
  131. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
  132. package/src/components/molecules/ButtonDownloadFile/index.js +111 -0
  133. package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
  134. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
  135. package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
  136. package/src/components/molecules/Dropdown/Dropdown.stories.js +103 -0
  137. package/src/components/molecules/Dropdown/index.js +150 -0
  138. package/src/components/molecules/Dropdown/styles.js +75 -0
  139. package/src/components/molecules/HeaderTop/index.js +11 -6
  140. package/src/components/molecules/HeaderTop/styles.js +4 -0
  141. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +68 -0
  142. package/src/components/molecules/ImageTooltip/index.js +63 -0
  143. package/src/components/molecules/ImageTooltip/styles.js +18 -0
  144. package/src/components/molecules/ProductNameHeader/index.js +6 -1
  145. package/src/components/molecules/SelectV2/SelectV2.stories.js +114 -0
  146. package/src/components/molecules/SelectV2/index.js +350 -0
  147. package/src/components/molecules/SelectV2/styles.js +105 -0
  148. package/src/components/molecules/SelectV2/test.js +61 -0
  149. package/src/components/molecules/SelectV2/test.stories.js +10 -0
  150. package/src/components/organisms/Chat/Chat.stories.js +199 -0
  151. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
  152. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  153. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  154. package/src/components/organisms/Chat/ChatLists/index.js +141 -0
  155. package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
  156. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
  157. package/src/components/organisms/Chat/ContainerItems/index.js +549 -0
  158. package/src/components/organisms/Chat/ContainerItems/styles.js +328 -0
  159. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
  160. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  161. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  162. package/src/components/organisms/Chat/ContentChat/index.js +900 -0
  163. package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
  164. package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
  165. package/src/components/organisms/Chat/Footer/index.js +669 -0
  166. package/src/components/organisms/Chat/Footer/styles.js +286 -0
  167. package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
  168. package/src/components/organisms/Chat/Header/index.js +94 -0
  169. package/src/components/organisms/Chat/Header/styles.js +49 -0
  170. package/src/components/organisms/Chat/index.js +294 -0
  171. package/src/components/organisms/Chat/styles.js +42 -0
  172. package/src/components/organisms/FullProductNameHeader/index.js +1 -0
  173. package/src/components/organisms/Modal/Modal.stories.js +55 -0
  174. package/src/components/organisms/Modal/index.js +97 -0
  175. package/src/components/organisms/Modal/styles.js +103 -0
  176. package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +16 -0
  177. package/src/components/organisms/RangeCalendar/index.js +121 -0
  178. package/src/components/organisms/RangeCalendar/styles.js +883 -0
  179. package/src/components/pages/ProviderProductEdition/index.js +9 -6
  180. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +62 -85
  181. package/src/components/pages/RetailerProductEdition/index.js +12 -10
  182. package/src/global-files/fonts.css +6 -0
  183. package/src/global-files/handle_http.js +231 -0
  184. package/src/global-files/utils.js +309 -0
  185. package/src/global-files/variables.js +2 -0
  186. package/src/index.js +17 -0
@@ -42,6 +42,7 @@ import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
42
42
  import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
43
43
  import { VersionSelector } from "../../organisms/VersionSelector";
44
44
  import { useCloseModal } from "../../../global-files/customHooks";
45
+ import { number } from "prop-types";
45
46
 
46
47
  const reducerImages = (state, action) => {
47
48
  let { values, attrForImgs, inputsByRetailer } = state;
@@ -273,7 +274,7 @@ export const ProviderProductEdition = ({
273
274
  setImages({ action: "init", init: services[2] });
274
275
  if (services[2]?.values?.length > 0) setActiveImage(0);
275
276
 
276
- getPercentage({ data: [product] }).then((res) => setPercentages(res));
277
+ getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
277
278
  setLoading(false);
278
279
  };
279
280
 
@@ -363,11 +364,13 @@ export const ProviderProductEdition = ({
363
364
  useEffect(() => {
364
365
  const productTemp = product;
365
366
  const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
366
- retailers?.forEach((retailer) => {
367
- retailer["percentage"] = percentages?.find(
368
- (percent) => retailer?.id === percent?.id_retailer
369
- )?.percentage;
370
- });
367
+ if (Object.keys(percentages?.retailers ?? {})?.length > 0) {
368
+ retailers?.forEach((retailer) => {
369
+ retailer["percentage"] = Number(
370
+ percentages?.retailers[retailer.id].percentageRequired
371
+ );
372
+ });
373
+ }
371
374
 
372
375
  setProduct(productTemp);
373
376
  setActivePercentage(retailers[0]?.percentage);
@@ -12,120 +12,97 @@ export const RetailerProductEditionDefault = Template.bind({});
12
12
  RetailerProductEditionDefault.args = {
13
13
  tabsSections: {
14
14
  Descripción: true,
15
- "Ficha técnica": false,
16
- Imágenes: false,
15
+ "Ficha técnica": true,
16
+ Imágenes: true,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91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productSelected: {
21
- services: {
22
- datasheets: 1,
23
- descriptions: 1,
24
- images: 1,
25
- },
26
- orderId: 123,
27
- status: "PA",
28
- datasheet_status: "PA",
29
- prio: "none",
21
+ articleStatus: "AA",
30
22
  version: 3,
31
- description_status: "PA",
32
- images_status: "PA",
33
- statusByRetailer: {
34
- 4: {
35
- datasheet: "PA",
36
- description: "PA",
37
- images: "PA",
38
- },
39
- 5: {
40
- datasheet: "PA",
41
- description: "PA",
42
- images: "PA",
43
- },
44
- 6: {
45
- datasheet: "PA",
46
- description: "PA",
47
- images: "PA",
48
- },
49
- },
23
+ missing: {},
50
24
  article: {
51
- id_article: 127,
52
- id_category: "700",
53
- name: "prueba prod flujo",
54
- upc: "34234353324",
55
- timestamp: "2022-11-23T23:12:30.000Z",
56
- id_user: 28,
57
- status: "NULL",
58
- active: 1,
59
- company_id: 1,
60
- company_name: "GRUPO BRAHMA",
61
- country: "México",
62
- id_order: 123,
63
- id_datasheet_especialist: 54,
64
- id_datasheet_facilitator: 52,
65
- id_description_especialist: 54,
66
- id_description_facilitator: 52,
67
- id_images_especialist: 55,
68
- id_images_facilitator: 53,
69
- id_auditor: 37,
70
- id_recepcionist: null,
71
25
  category:
72
- "Salud y Belleza|Cuidado Facial|Cremas, Mascarillas y Tratamientos",
73
- missingAttributes: 0,
74
- missingDescriptions: 0,
75
- missingImages: 0,
26
+ "Ventilación y Calefacción|Ventiladores de Techo|Ventiladores de Techo",
27
+ company_name: "GRUPO BRAHMA",
28
+ company_id: 1,
29
+ id_category: "2416",
30
+ id_article: 221,
31
+ name: 'DEMO VENTILADOR DE TECHO TRIBECA 52"',
32
+ upc: "147259",
76
33
  },
34
+ asignations: [],
77
35
  retailers: [
78
36
  {
79
- id: 4,
80
- name: "Walmart Super y Superama",
37
+ id: 59,
38
+ name: "The Home Depot Platinum",
39
+ country: "México",
40
+ id_region: 1,
41
+ active: 1,
81
42
  },
43
+ ],
44
+ retailersAvailable: [
82
45
  {
83
- id: 5,
84
- name: "Chedraui",
46
+ id: 59,
47
+ name: "The Home Depot Platinum",
48
+ country: "México",
49
+ id_region: 1,
50
+ active: 1,
85
51
  },
52
+ ],
53
+ upc: "147259",
54
+ name: 'DEMO VENTILADOR DE TECHO TRIBECA 52"',
55
+ categoryName:
56
+ "Ventilación y Calefacción|Ventiladores de Techo|Ventiladores de Techo",
57
+ id_category: "2416",
58
+ id_article: 221,
59
+ services: [
86
60
  {
87
- id: 6,
88
- name: "HEB",
61
+ id_article: 221,
62
+ service: "datasheet",
63
+ quantity: 1,
64
+ price: 0,
65
+ id_user: 59,
66
+ datasheet_common: null,
67
+ discount: null,
89
68
  },
90
69
  ],
91
- country: "México",
92
- upc: "34234353324",
93
70
  },
94
71
  location: {
95
- product: { articleId: 109485, versionId: 3 },
72
+ product: { articleId: 221, versionId: 3 },
96
73
  },
97
74
  user: {
98
- id_user: 51,
99
- name: "ADMIN PRUEBA",
100
- last_name: "",
101
- email: "etc@contentoh.com",
102
- position: "",
103
- telephone: "",
104
- country: "",
105
- id_company: 2,
106
- id_cognito: "a6c4d3d6-24a4-41d4-ad0f-d087438ab5b6",
75
+ id_user: 59,
76
+ name: "The Home",
77
+ last_name: "Depot",
78
+ email: "cadena.ismael@allfreemail.net",
79
+ position: "Admin",
80
+ telephone: "+523111366336",
81
+ country: "México",
82
+ id_company: 817,
83
+ id_cognito: "5884ae34-59d6-4454-b98e-821518bcc3a7",
107
84
  birth_Date: null,
108
85
  about_me: "",
109
86
  zip_code: "",
110
87
  address: "",
111
88
  job: "",
112
89
  id_stripe: "",
113
- id_role: 1,
90
+ id_role: 0,
114
91
  active: 1,
115
- is_retailer: 0,
116
- email_notify: 1,
92
+ is_retailer: 1,
93
+ email_notify: 0,
117
94
  is_user_tech: null,
118
95
  membership: {
119
- id: 2,
120
- start_date: "2021-11-05T02:35:12.000Z",
121
- end_date: "2022-11-05T02:34:49.000Z",
122
- planID: 1,
123
- plan: "prod_KtkvuFFLpOdP6e",
124
- name: "Plan Free",
125
- user_limit: "1",
126
- products_limit: "3",
96
+ id: 47,
97
+ start_date: "2022-05-25T14:31:12.000Z",
98
+ end_date: "2023-05-25T14:31:12.000Z",
99
+ planID: 5,
100
+ plan: "prod_Ktl6B5Ou2gqTB2",
101
+ name: "Plan Pro",
102
+ user_limit: "5",
103
+ products_limit: "500",
127
104
  type: "PyMES",
128
105
  },
129
- src: "https://content-management-profile.s3.amazonaws.com/id-51/51.png?1669928511679",
106
+ src: "https://content-management-profile.s3.amazonaws.com/id-59/59.png?1671735033010",
130
107
  },
131
108
  };
@@ -175,6 +175,7 @@ export const RetailerProductEdition = ({
175
175
  const [percentages, setPercentages] = useState(
176
176
  new Array(product?.retailers?.length).fill({ percentage: 0 })
177
177
  );
178
+ // const [percentages, setPercentages] = useState([{ retailers: {} }]);
178
179
  const [activePercentage, setActivePercentage] = useState(0);
179
180
  const [activeRetailer, setActiveRetailer] = useState({});
180
181
  const [services, setServices] = useState([]);
@@ -225,12 +226,9 @@ export const RetailerProductEdition = ({
225
226
  //Converts the data inside the datasheets object to array
226
227
  setServices(services);
227
228
  getServices();
228
-
229
- // setActiveRetailer(product?.retailers[0]);
230
229
  setImages({ action: "init", init: services[2] });
231
230
  if (services[2]?.values?.length > 0) setActiveImage(0);
232
-
233
- getPercentage({ data: [product] }).then((res) => setPercentages(res));
231
+ getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
234
232
  setLoading(false);
235
233
  } catch (error) {
236
234
  console.log(error);
@@ -371,12 +369,16 @@ export const RetailerProductEdition = ({
371
369
  }, [userGroups]);
372
370
 
373
371
  useEffect(() => {
374
- product?.retailers?.forEach((retailer) => {
375
- retailer["percentage"] = percentages?.filter(
376
- (percent) => retailer?.id === percent?.id_retailer
377
- )[0]?.percentage;
378
- });
379
- setActivePercentage(product?.retailers[0]?.percentage);
372
+ const retailers = product?.retailersAvailable || product?.retailers;
373
+ if (Object.keys(percentages?.retailers ?? {})?.length > 0) {
374
+ retailers?.forEach((retailer) => {
375
+ retailer["percentage"] = Number(
376
+ percentages?.retailers[retailer.id].percentageRequired
377
+ );
378
+ });
379
+ }
380
+
381
+ setActivePercentage(retailers[0]?.percentage);
380
382
  }, [percentages]);
381
383
 
382
384
  useEffect(() => {
@@ -61,3 +61,9 @@
61
61
  src: url("../assets/fonts/roboto/Roboto-Regular.ttf");
62
62
  font-weight: 400;
63
63
  }
64
+
65
+ .prueba {
66
+ color: #9e3e26;
67
+ color: #b42983;
68
+ color: #e7e7e7;
69
+ }
@@ -0,0 +1,231 @@
1
+ import axios from "axios";
2
+
3
+ //============================================================
4
+ /**
5
+ * funcion que realiza un axios GET
6
+ *
7
+ * Si <body> es undefined significa que hubo error
8
+
9
+ * @returns { Promise<{
10
+ * body: {} | undefined ,
11
+ * message: string,
12
+ * errorDetail: string
13
+ * }> }
14
+ *
15
+ */
16
+ //============================================================
17
+ export const fetchGET = (
18
+ endpoint = "",
19
+ paramsQuery = {},
20
+ paramsHeaders = {}
21
+ ) => {
22
+ return new Promise(async (response) => {
23
+ //console.log("======= fetchGET =========");
24
+ try {
25
+ let URL = endpoint;
26
+ const keysParamsQuery = Object.keys(paramsQuery);
27
+ // agregar cada param query a la URL
28
+ keysParamsQuery.forEach((key, index) => {
29
+ if (index == 0) {
30
+ URL += `?${key}=${paramsQuery[key]}`;
31
+ } else {
32
+ URL += `&${key}=${paramsQuery[key]}`;
33
+ }
34
+ });
35
+ //console.log("URL:", URL);
36
+ const respHTTPjson = await axios.get(URL, { headers: paramsHeaders });
37
+ // verificar si existe un error en la peticion realizada
38
+ if (respHTTPjson.status !== 200) {
39
+ return response({
40
+ message: "No fue posible llevar a cabo la operación",
41
+ errorDetail: respHTTPjson.statusText,
42
+ });
43
+ }
44
+ // obtener body backend
45
+ const body = JSON.parse(respHTTPjson.data.body);
46
+
47
+ // verificar si existe error desde el backend
48
+ if (respHTTPjson.data.statusCode !== 200) {
49
+ return response({
50
+ message: body.message ?? "",
51
+ errorDetail: body.errorDetail ?? "",
52
+ });
53
+ }
54
+ // success
55
+ return response({ body });
56
+ } catch (err) {
57
+ return response({
58
+ message: "Error al obtener los datos",
59
+ errorDetail: err.message,
60
+ });
61
+ }
62
+ });
63
+ };
64
+
65
+ //============================================================
66
+ /**
67
+ * funcion que realiza un axios POST
68
+ *
69
+ * Si <body> es undefined significa que hubo error
70
+
71
+ * @returns { Promise<{
72
+ * body: {} | undefined ,
73
+ * message: string,
74
+ * errorDetail: string
75
+ * }> }
76
+ *
77
+ */
78
+ //============================================================
79
+ export const fetchPOST = (
80
+ endpoint = "",
81
+ paramsBody = {},
82
+ paramsHeaders = {}
83
+ ) => {
84
+ return new Promise(async (response) => {
85
+ //console.log("======= fetchPOST =========");
86
+ try {
87
+ const respHTTPjson = await axios.post(endpoint, paramsBody, {
88
+ headers: paramsHeaders,
89
+ });
90
+
91
+ // verificar si existe un error en la peticion realizada
92
+ if (respHTTPjson.status !== 200) {
93
+ return response({
94
+ message: "No fue posible llevar a cabo la operación",
95
+ errorDetail: respHTTPjson.statusText,
96
+ });
97
+ }
98
+ // obtener body backend
99
+ const body = JSON.parse(respHTTPjson.data.body);
100
+
101
+ // verificar si existe error desde el backend
102
+ if (respHTTPjson.data.statusCode !== 200) {
103
+ console.log(body);
104
+ return response({
105
+ message: body.message ?? "",
106
+ errorDetail: body.errorDetail ?? "",
107
+ });
108
+ }
109
+ // success
110
+ return response({ body });
111
+ } catch (err) {
112
+ return response({
113
+ message: "Error al guardar los datos",
114
+ errorDetail: err.message,
115
+ });
116
+ }
117
+ });
118
+ };
119
+
120
+ //============================================================
121
+ /**
122
+ * funcion que realiza un axios GET
123
+ *
124
+ * Si <body> es undefined significa que hubo error
125
+
126
+ * @returns { Promise<{
127
+ * body: {} | undefined ,
128
+ * message: string,
129
+ * errorDetail: string
130
+ * }> }
131
+ *
132
+ */
133
+ //============================================================
134
+ export const fetchPUT = (
135
+ endpoint = "",
136
+ paramsBody = {},
137
+ paramsHeaders = {}
138
+ ) => {
139
+ return new Promise(async (response) => {
140
+ //console.log("======= fetchPUT =========");
141
+ try {
142
+ const respHTTPjson = await axios.put(endpoint, paramsBody, {
143
+ headers: paramsHeaders,
144
+ });
145
+
146
+ // verificar si existe un error en la peticion realizada
147
+ if (respHTTPjson.status !== 200) {
148
+ return response({
149
+ message: "No fue posible llevar a cabo la operación",
150
+ errorDetail: respHTTPjson.statusText,
151
+ });
152
+ }
153
+
154
+ // obtener body backend
155
+ const body = JSON.parse(respHTTPjson.data.body);
156
+
157
+ // verificar si existe error desde el backend
158
+ if (respHTTPjson.data.statusCode !== 200) {
159
+ return response({
160
+ message: body.message ?? "",
161
+ errorDetail: body.errorDetail ?? "",
162
+ });
163
+ }
164
+
165
+ // success
166
+ return response({ body });
167
+ } catch (err) {
168
+ return response({
169
+ message: "Error al actualizar los datos",
170
+ errorDetail: err.message,
171
+ });
172
+ }
173
+ });
174
+ };
175
+
176
+ //============================================================
177
+ /**
178
+ * funcion que realiza un axios GET
179
+ *
180
+ * Si <body> es undefined significa que hubo error
181
+
182
+ * @returns { Promise<{
183
+ * body: {} | undefined ,
184
+ * message: string,
185
+ * errorDetail: string
186
+ * }> }
187
+ *
188
+ */
189
+ //============================================================
190
+ export const fetchDELETE = (
191
+ endpoint = "",
192
+ paramsBody = {},
193
+ paramsHeaders = {}
194
+ ) => {
195
+ return new Promise(async (response) => {
196
+ //console.log("======= fetchDELETE =========");
197
+ try {
198
+ const respHTTPjson = await axios.delete(endpoint, {
199
+ data: paramsBody,
200
+ headers: paramsHeaders,
201
+ });
202
+
203
+ // verificar si existe un error en la peticion realizada
204
+ if (respHTTPjson.status !== 200) {
205
+ return response({
206
+ message: "No fue posible llevar a cabo la operación",
207
+ errorDetail: respHTTPjson.statusText,
208
+ });
209
+ }
210
+
211
+ // obtener body backend
212
+ const body = JSON.parse(respHTTPjson.data.body);
213
+
214
+ // verificar si existe error desde el backend
215
+ if (respHTTPjson.data.statusCode !== 200) {
216
+ return response({
217
+ message: body.message ?? "",
218
+ errorDetail: body.errorDetail ?? "",
219
+ });
220
+ }
221
+
222
+ // success
223
+ return response({ body });
224
+ } catch (err) {
225
+ return response({
226
+ message: "Error al actualizar los datos",
227
+ errorDetail: err.message,
228
+ });
229
+ }
230
+ });
231
+ };