contentoh-components-library 21.4.66 → 21.4.68

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 (157) hide show
  1. package/dist/components/atoms/Avatar/index.js +2 -3
  2. package/dist/components/atoms/CheckBox/styles.js +1 -1
  3. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  4. package/dist/components/atoms/SliderToolTip/styles.js +1 -1
  5. package/dist/components/molecules/BoxAttribute/index.js +3 -3
  6. package/dist/components/molecules/BoxAttribute/styles.js +1 -1
  7. package/dist/components/molecules/BoxButtons/index.js +1 -0
  8. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  9. package/dist/components/molecules/HeaderTop/index.js +11 -68
  10. package/dist/components/molecules/SignInLogin/index.js +28 -36
  11. package/dist/components/molecules/StripeCardSelector/CardSelector.stories.js +2 -1
  12. package/dist/components/organisms/Chat/Chat.stories.js +8 -27
  13. package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
  14. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  15. package/dist/components/organisms/Chat/ContentChat/index.js +197 -350
  16. package/dist/components/organisms/Chat/Footer/index.js +39 -48
  17. package/dist/components/organisms/Chat/index.js +4 -49
  18. package/dist/components/organisms/Chat/styles.js +1 -1
  19. package/dist/components/organisms/DashboardMetric/index.js +6 -12
  20. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  21. package/dist/components/organisms/InputGroup/index.js +10 -1
  22. package/dist/components/organisms/Modal/styles.js +1 -1
  23. package/dist/components/pages/Dashboard/Dashboard.stories.js +36 -33
  24. package/dist/components/pages/Dashboard/index.js +14 -56
  25. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +3 -3
  26. package/dist/components/pages/ProviderProductEdition/index.js +144 -120
  27. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  28. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +3 -7
  29. package/dist/components/pages/RetailerProductEdition/index.js +433 -312
  30. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  31. package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
  32. package/dist/global-files/data.js +3 -11
  33. package/dist/global-files/variables.js +1 -5
  34. package/dist/index.js +58 -201
  35. package/package.json +1 -2
  36. package/src/components/atoms/Avatar/index.js +2 -8
  37. package/src/components/atoms/CheckBox/styles.js +0 -2
  38. package/src/components/atoms/InputFormatter/styles.js +1 -2
  39. package/src/components/atoms/SliderToolTip/styles.js +1 -1
  40. package/src/components/atoms/TabSection/styles.js +1 -1
  41. package/src/components/molecules/BoxAttribute/index.js +25 -32
  42. package/src/components/molecules/BoxAttribute/styles.js +1 -1
  43. package/src/components/molecules/BoxButtons/index.js +22 -23
  44. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  45. package/src/components/molecules/HeaderTop/index.js +6 -52
  46. package/src/components/molecules/SignInLogin/index.js +11 -11
  47. package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +2 -1
  48. package/src/components/molecules/TagAndInput/index.js +5 -6
  49. package/src/components/organisms/Chat/Chat.stories.js +7 -27
  50. package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
  51. package/src/components/organisms/Chat/ContainerItems/styles.js +2 -14
  52. package/src/components/organisms/Chat/ContentChat/index.js +12 -88
  53. package/src/components/organisms/Chat/Footer/index.js +0 -11
  54. package/src/components/organisms/Chat/index.js +4 -46
  55. package/src/components/organisms/Chat/styles.js +0 -4
  56. package/src/components/organisms/DashboardMetric/index.js +3 -6
  57. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  58. package/src/components/organisms/InputGroup/index.js +119 -131
  59. package/src/components/organisms/Modal/styles.js +1 -4
  60. package/src/components/organisms/OrderDetail/utils/Table/utils.js +16 -6
  61. package/src/components/pages/Dashboard/Dashboard.stories.js +38 -33
  62. package/src/components/pages/Dashboard/index.js +39 -73
  63. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +83 -100
  64. package/src/components/pages/ProviderProductEdition/index.js +131 -100
  65. package/src/components/pages/ProviderProductEdition/styles.js +1 -5
  66. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -6
  67. package/src/components/pages/RetailerProductEdition/index.js +309 -147
  68. package/src/components/pages/RetailerProductEdition/styles.js +0 -4
  69. package/src/components/pages/RetailerProductEdition/utils.js +0 -37
  70. package/src/global-files/data.js +13 -7
  71. package/src/global-files/variables.js +0 -4
  72. package/src/index.js +0 -11
  73. package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
  74. package/dist/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -90
  75. package/dist/components/atoms/ImageCarousel/index.js +0 -120
  76. package/dist/components/atoms/ImageCarousel/styles.js +0 -18
  77. package/dist/components/atoms/PercentTag/PercentTag.stories.js +0 -31
  78. package/dist/components/atoms/PercentTag/index.js +0 -23
  79. package/dist/components/atoms/PercentTag/styles.js +0 -22
  80. package/dist/components/atoms/RatingStars/RatingStars.stories.js +0 -30
  81. package/dist/components/atoms/RatingStars/index.js +0 -53
  82. package/dist/components/atoms/RatingStars/styles.js +0 -18
  83. package/dist/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -48
  84. package/dist/components/atoms/RetailerCatalog/index.js +0 -69
  85. package/dist/components/atoms/RetailerCatalog/styles.js +0 -20
  86. package/dist/components/atoms/RetailerOption/RetailerOption.stories.js +0 -33
  87. package/dist/components/atoms/RetailerOption/index.js +0 -62
  88. package/dist/components/atoms/RetailerOption/styles.js +0 -20
  89. package/dist/components/atoms/RetailersList/RetailersList.stories.js +0 -45
  90. package/dist/components/atoms/RetailersList/index.js +0 -46
  91. package/dist/components/atoms/RetailersList/styles.js +0 -18
  92. package/dist/components/atoms/UserCatalog/UserCatalog.stories.js +0 -73
  93. package/dist/components/atoms/UserCatalog/index.js +0 -101
  94. package/dist/components/atoms/UserCatalog/styles.js +0 -18
  95. package/dist/components/atoms/UserOption/UserOption.stories.js +0 -40
  96. package/dist/components/atoms/UserOption/index.js +0 -130
  97. package/dist/components/atoms/UserOption/styles.js +0 -20
  98. package/dist/components/atoms/UserSelector/UserSelector.stories.js +0 -40
  99. package/dist/components/atoms/UserSelector/index.js +0 -98
  100. package/dist/components/atoms/UserSelector/styles.js +0 -32
  101. package/dist/components/molecules/GridItem/GridItem.stories.js +0 -123
  102. package/dist/components/molecules/GridItem/index.js +0 -152
  103. package/dist/components/molecules/GridItem/styles.js +0 -20
  104. package/dist/components/molecules/HeaderItem/ColumnItem.js +0 -23
  105. package/dist/components/molecules/HeaderItem/HeaderItem.stories.js +0 -70
  106. package/dist/components/molecules/HeaderItem/index.js +0 -42
  107. package/dist/components/molecules/HeaderItem/styles.js +0 -30
  108. package/dist/components/molecules/RowItem/ColumnItem.js +0 -23
  109. package/dist/components/molecules/RowItem/RowItem.stories.js +0 -5242
  110. package/dist/components/molecules/RowItem/index.js +0 -58
  111. package/dist/components/molecules/RowItem/styles.js +0 -30
  112. package/dist/components/organisms/GridProducts/GridProducts.stories.js +0 -5097
  113. package/dist/components/organisms/GridProducts/index.js +0 -63
  114. package/dist/components/organisms/GridProducts/styles.js +0 -18
  115. package/dist/components/organisms/GridProducts/utils.js +0 -149
  116. package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -76
  117. package/src/components/atoms/ImageCarousel/index.js +0 -103
  118. package/src/components/atoms/ImageCarousel/styles.js +0 -79
  119. package/src/components/atoms/PercentTag/PercentTag.stories.js +0 -7
  120. package/src/components/atoms/PercentTag/index.js +0 -9
  121. package/src/components/atoms/PercentTag/styles.js +0 -69
  122. package/src/components/atoms/RatingStars/RatingStars.stories.js +0 -10
  123. package/src/components/atoms/RatingStars/index.js +0 -31
  124. package/src/components/atoms/RatingStars/styles.js +0 -28
  125. package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -36
  126. package/src/components/atoms/RetailerCatalog/index.js +0 -49
  127. package/src/components/atoms/RetailerCatalog/styles.js +0 -30
  128. package/src/components/atoms/RetailerOption/RetailerOption.stories.js +0 -15
  129. package/src/components/atoms/RetailerOption/index.js +0 -53
  130. package/src/components/atoms/RetailerOption/styles.js +0 -41
  131. package/src/components/atoms/RetailersList/RetailersList.stories.js +0 -33
  132. package/src/components/atoms/RetailersList/index.js +0 -20
  133. package/src/components/atoms/RetailersList/styles.js +0 -19
  134. package/src/components/atoms/UserCatalog/UserCatalog.stories.js +0 -67
  135. package/src/components/atoms/UserCatalog/index.js +0 -100
  136. package/src/components/atoms/UserCatalog/styles.js +0 -24
  137. package/src/components/atoms/UserOption/UserOption.stories.js +0 -25
  138. package/src/components/atoms/UserOption/index.js +0 -95
  139. package/src/components/atoms/UserOption/styles.js +0 -61
  140. package/src/components/atoms/UserSelector/UserSelector.stories.js +0 -25
  141. package/src/components/atoms/UserSelector/index.js +0 -86
  142. package/src/components/atoms/UserSelector/styles.js +0 -55
  143. package/src/components/molecules/GridItem/GridItem.stories.js +0 -126
  144. package/src/components/molecules/GridItem/index.js +0 -105
  145. package/src/components/molecules/GridItem/styles.js +0 -104
  146. package/src/components/molecules/HeaderItem/ColumnItem.js +0 -9
  147. package/src/components/molecules/HeaderItem/HeaderItem.stories.js +0 -24
  148. package/src/components/molecules/HeaderItem/index.js +0 -26
  149. package/src/components/molecules/HeaderItem/styles.js +0 -27
  150. package/src/components/molecules/RowItem/ColumnItem.js +0 -9
  151. package/src/components/molecules/RowItem/RowItem.stories.js +0 -5660
  152. package/src/components/molecules/RowItem/index.js +0 -45
  153. package/src/components/molecules/RowItem/styles.js +0 -40
  154. package/src/components/organisms/GridProducts/GridProducts.stories.js +0 -5485
  155. package/src/components/organisms/GridProducts/index.js +0 -50
  156. package/src/components/organisms/GridProducts/styles.js +0 -14
  157. package/src/components/organisms/GridProducts/utils.js +0 -111
@@ -1,31 +1,41 @@
1
1
  export const servicesCodeIcon = {
2
2
  datasheet: (
3
3
  <div key="datasheet" className="tooltip">
4
- <span className="material-icons small">&#xf8ee;</span>
4
+ <span className="material-icons small">
5
+ &#xf8ee;
6
+ </span>
5
7
  <span className="tooltiptext">Ficha Técnica</span>
6
8
  </div>
7
9
  ),
8
10
  description: (
9
11
  <div key="description" className="tooltip">
10
- <span className="material-icons small">&#xe873;</span>
12
+ <span className="material-icons small">
13
+ &#xe873;
14
+ </span>
11
15
  <span className="tooltiptext">Descripción</span>
12
16
  </div>
13
17
  ),
14
18
  image: (
15
19
  <div key="image" className="tooltip">
16
- <span className="material-icons small">&#xe3f4;</span>
20
+ <span className="material-icons small">
21
+ &#xe3f4;
22
+ </span>
17
23
  <span className="tooltiptext">Imagen</span>
18
24
  </div>
19
25
  ),
20
26
  translate: (
21
27
  <div key="translate" className="tooltip">
22
- <span className="material-icons small">&#xe8e2;</span>
28
+ <span className="material-icons small">
29
+ &#xe8e2;
30
+ </span>
23
31
  <span className="tooltiptext">Traducción</span>
24
32
  </div>
25
33
  ),
26
34
  build: (
27
- <div key="build" className="tooltip">
28
- <span className="material-icons small">&#xe1bd;</span>
35
+ <div key="build" className="tooltip">
36
+ <span className="material-icons small">
37
+ &#xe1bd;
38
+ </span>
29
39
  <span className="tooltiptext">Construcción</span>
30
40
  </div>
31
41
  ),
@@ -9,54 +9,59 @@ const Template = (args) => <Dashboard {...args} />;
9
9
  export const DashboardDeafult = Template.bind({});
10
10
  DashboardDeafult.args = {
11
11
  user: {
12
- id_user: 343,
13
- name: "Jair",
14
- last_name: "León",
15
- email: "hleon@contentoh.com",
16
- position: "Test States",
17
- telephone: "+525555555555",
12
+ id_user: 37,
13
+ name: "José",
14
+ last_name: "Castañeda",
15
+ email: "ismael97lopez@gmail.com",
16
+ position: "Auditor",
17
+ telephone: "",
18
18
  country: "México",
19
- id_company: 234,
20
- id_cognito: "4512b5a5-366a-4bb5-916e-aafe05402992",
19
+ id_company: 2,
20
+ id_cognito: "9a213128-6482-4c16-a4b6-6e64f225b1bd",
21
21
  birth_Date: null,
22
22
  about_me: "",
23
23
  zip_code: "",
24
24
  address: "",
25
25
  job: "",
26
- id_stripe: "cus_KuEt6R6vwmN09f",
27
- id_role: 0,
26
+ id_stripe: "",
27
+ id_role: 6,
28
28
  active: 1,
29
29
  is_retailer: 0,
30
- email_notify: 0,
31
- is_user_tech: "ADMIN-AS",
30
+ email_notify: 1,
31
+ is_user_tech: null,
32
32
  membership: {
33
- id: 139,
34
- start_date: "2023-10-04T15:46:14.000Z",
35
- end_date: "2024-10-04T08:46:09.000Z",
36
- planID: 9,
37
- plan: "prod_KtlkzZVGq6bRTO",
38
- name: "Plan Enterprise Full",
39
- user_limit: "30",
40
- products_limit: "10000",
41
- type: "Enterprise",
33
+ id: 2,
34
+ start_date: "2021-11-05T02:35:12.000Z",
35
+ end_date: "2022-11-05T02:34:49.000Z",
36
+ planID: 1,
37
+ plan: "prod_KtkvuFFLpOdP6e",
38
+ name: "Plan Free",
39
+ user_limit: "1",
40
+ products_limit: "3",
41
+ type: "PyMES",
42
42
  },
43
- src: "https://content-management-profile.s3.amazonaws.com/id-343/343.png?1699640943284",
43
+ src: "https://content-management-profile.s3.amazonaws.com/id-37/37.png?1684953973972",
44
44
  },
45
45
  company: {
46
- id_company: 234,
47
- trade_name: "L'ORÉAL",
48
- company_name: "L'ORÉAL",
46
+ id_company: 1,
47
+ trade_name: "GRUPO BRAHMA",
48
+ company_name: "GRUPO BRAHMA",
49
49
  rfc: "XAXX010101000",
50
50
  adress: "AA",
51
- about_company: " ",
52
- telephone: " ",
53
- web_site: " ",
54
- zip_code: " ",
51
+ about_company: "",
52
+ telephone: "",
53
+ web_site: "",
54
+ zip_code: "",
55
55
  email: null,
56
- social_link: " ",
56
+ social_link: "",
57
57
  is_retailer: 0,
58
- financedRetailers: [],
59
- retailers: [],
58
+ retailers: [
59
+ {
60
+ id: null,
61
+ name: null,
62
+ country: null,
63
+ },
64
+ ],
60
65
  },
61
- jwt: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI0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rBgLnHMBU8PxU1Fcc2EqF5U8lh4fJK6Mc7kiJ4lCreKJL3kT_1ytC-7FdRAlhNXzuJW6aMQQ785ODQ8-1RtHKW6U_b9x88-WFxjltEKuw734LGBSkz9iKZSumNBJBP8HTMgwOgmRTJ6lR-hPsujvl7aF3maXhftpk2fI8S_FzjVRMsxY3T8hQHIXEYwQUv-fC5SPOgc8XDuAp18MKfi0qkU1EYHQahC0qZmvgVGWEDcu5D36Xj0as4iAiFQ",
62
67
  };
@@ -40,8 +40,6 @@ export const Dashboard = ({ jwt, user, company }) => {
40
40
  const [applicantsFilter, setApplicantsFilter] = useState([]);
41
41
  const [totalCount, setTotalCount] = useState(0);
42
42
  const [isProviderFinanced] = useState(company?.financedRetailers?.length > 0);
43
- const [trades, setTrades] = useState([]);
44
- const [tradesSelected, setTradesSelected] = useState([]);
45
43
 
46
44
  const loadProductVersions = async (queryObject) => {
47
45
  const keys = Object.keys(queryObject);
@@ -83,50 +81,42 @@ export const Dashboard = ({ jwt, user, company }) => {
83
81
  };
84
82
 
85
83
  const loadProductsByStatus = async (orderByStatus) => {
86
- try {
87
- const isRetailer = user.is_retailer && company.retailers;
88
- const isProvider = !user.is_retailer && user.id_role === 0;
89
- const isCollaborator = user.id_role > 0;
90
- const { ordersBydate, ordersByStatus, ordersByActive, companyTrades } =
91
- (await loadProductVersions(orderByStatus)) || {};
92
-
93
- if (trades.length === 0) setTrades(companyTrades);
94
- const { total = 0, R = 0, PA = 0, Ex = 0, ACA = 0 } = ordersByStatus;
95
- let productsFinished = 0;
96
- if (isRetailer) productsFinished = Ex;
97
- if (isProvider) productsFinished = ACA;
98
- if (isCollaborator) productsFinished = Ex + ACA;
84
+ const isRetailer = user.is_retailer && company.retailers;
85
+ const isProvider = !user.is_retailer && user.id_role === 0;
86
+ const isCollaborator = user.id_role > 0;
87
+ const { ordersBydate, ordersByStatus } =
88
+ (await loadProductVersions(orderByStatus)) || {};
99
89
 
100
- const inProcess = Object.keys(ordersByStatus).reduce(
101
- (prev, curr) =>
102
- !["total", "PA", "R", "Ex", "ACA"].includes(curr)
103
- ? prev + ordersByStatus[curr]
104
- : prev,
105
- 0
106
- );
90
+ const { total = 0, R = 0, PA = 0, Ex = 0, ACA = 0 } = ordersByStatus;
91
+ let productsFinished = 0;
92
+ if (isRetailer) productsFinished = Ex;
93
+ if (isProvider) productsFinished = ACA;
94
+ if (isCollaborator) productsFinished = Ex + ACA;
107
95
 
108
- const registeredProducts = ordersByActive.registered;
109
- let metricsArray = [
110
- metricsData[0]
111
- ? metricsData[0]
112
- : { label: "Productos totales", value: total },
113
- ];
96
+ const inProcess = Object.keys(ordersByStatus).reduce(
97
+ (prev, curr) =>
98
+ !["total", "PA", "R", "Ex", "ACA"].includes(curr)
99
+ ? prev + ordersByStatus[curr]
100
+ : prev,
101
+ 0
102
+ );
103
+ let metricsArray = [
104
+ metricsData[0]
105
+ ? metricsData[0]
106
+ : { label: "Productos totales", value: total },
107
+ ];
114
108
 
115
- metricsArray.push(
116
- { label: "Productos activos", value: registeredProducts },
117
- { label: "Productos filtrados", value: total },
118
- { label: "Productos sin asignar", value: PA + R },
119
- { label: "Productos en proceso", value: inProcess },
120
- { label: "Productos terminados", value: productsFinished }
121
- );
122
- setMetricsData(metricsArray);
123
- setTotalCount(total);
124
- delete ordersByStatus.total;
125
- setRequiredProducts(ordersBydate);
126
- setProductsByStatus(ordersByStatus);
127
- } catch (err) {
128
- console.log(err);
129
- }
109
+ metricsArray.push(
110
+ { label: "Productos filtrados", value: total },
111
+ { label: "Productos sin asignar", value: PA + R },
112
+ { label: "Productos en proceso", value: inProcess },
113
+ { label: "Productos terminados", value: productsFinished }
114
+ );
115
+ setMetricsData(metricsArray);
116
+ setTotalCount(total);
117
+ delete ordersByStatus.total;
118
+ setRequiredProducts(ordersBydate);
119
+ setProductsByStatus(ordersByStatus);
130
120
  };
131
121
 
132
122
  const datesSelect = () => {
@@ -227,14 +217,10 @@ export const Dashboard = ({ jwt, user, company }) => {
227
217
  }, []);
228
218
 
229
219
  useEffect(() => {
230
- console.log({ orderByRequired, orderByStatus, metricsData });
231
- if (
232
- orderByRequired?.startDate &&
220
+ orderByRequired?.startDate &&
233
221
  orderByStatus?.endDate &&
234
- metricsData.length > 0
235
- ) {
222
+ metricsData.length > 0 &&
236
223
  setLoading(false);
237
- }
238
224
  }, [orderByRequired, orderByStatus, metricsData]);
239
225
 
240
226
  useEffect(async () => {
@@ -243,23 +229,14 @@ export const Dashboard = ({ jwt, user, company }) => {
243
229
  startDate: startDate,
244
230
  endDate: endDate,
245
231
  };
246
- if (companyId.length > 0) queryObject["companyId"] = companyId.join(",");
247
- if (retailerId.length > 0) queryObject["retailerId"] = retailerId.join(",");
248
- if (categoryId.length > 0) queryObject["categoryId"] = categoryId.join(",");
249
- if (tradesSelected.length > 0)
250
- queryObject["trades"] = encodeURIComponent(tradesSelected.join(","));
232
+ companyId.length > 0 && (queryObject["companyId"] = companyId.join(","));
233
+ retailerId.length > 0 && (queryObject["retailerId"] = retailerId.join(","));
234
+ categoryId.length > 0 && (queryObject["categoryId"] = categoryId.join(","));
251
235
  applicantsFilter.length > 0 &&
252
236
  (queryObject["requestedBy"] = applicantsFilter.join(","));
253
237
 
254
238
  await loadProductsByStatus(queryObject, true);
255
- }, [
256
- companyId,
257
- retailerId,
258
- categoryId,
259
- datesRange,
260
- applicantsFilter,
261
- tradesSelected,
262
- ]);
239
+ }, [companyId, retailerId, categoryId, datesRange, applicantsFilter]);
263
240
 
264
241
  return loading ? (
265
242
  <Loading />
@@ -324,17 +301,6 @@ export const Dashboard = ({ jwt, user, company }) => {
324
301
  defaultOption="Todos los solicitantes"
325
302
  />
326
303
  )}
327
- {user.id_role === 0 && trades?.length > 0 && (
328
- <CustomSelect
329
- showSearchBar={true}
330
- options={trades}
331
- selectLabel="Todas las marcas"
332
- placeHolder="Buscar marca"
333
- customSelectId="trade-select"
334
- parameterArray={tradesSelected}
335
- setParameterArray={setTradesSelected}
336
- />
337
- )}
338
304
  </div>
339
305
  <div className="metric-cards">
340
306
  {metricsData.map((metric, index) => (
@@ -21,41 +21,39 @@ ProviderProductEditionDefault.args = {
21
21
  category: 287,
22
22
  version: 1,
23
23
  productSelected: {
24
- id_article: 39550,
25
- upc: 43654697,
26
- name: "Campana de Cocina",
27
- timestamp: "2023-08-04T22:23:40.000Z",
28
- categoryName:
29
- "Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
30
- id_category: 287,
31
- version: 1,
32
- retailersAvailable: [
33
- { name: "The Home Depot Golden", id: 58 },
34
- { name: "The Home Depot Onboarding", id: 68 },
35
- ],
36
- percentage: "89",
37
- },
24
+ id_article:39550,
25
+ upc:43654697,
26
+ name:"Campana de Cocina",
27
+ timestamp:"2023-08-04T22:23:40.000Z",
28
+ categoryName:"Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
29
+ id_category:287,
30
+ version:1,
31
+ retailersAvailable:[
32
+ {name:"The Home Depot Golden","id":58},
33
+ {name:"The Home Depot Onboarding","id":68}],
34
+ percentage:"89"
35
+ },
38
36
  productToEdit: {
39
- idCategory: 287,
40
- ArticleId: 39550,
41
- product: [
42
- {
43
- id_article: 39550,
44
- upc: 43654697,
45
- name: "Campana de Cocina",
46
- timestamp: "2023-08-04T22:23:40.000Z",
47
- categoryName:
48
- "Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
49
- id_category: 287,
50
- version: 1,
51
- retailersAvailable: [
52
- { name: "The Home Depot Golden", id: 58, percentage: 100 },
53
- { name: "The Home Depot Onboarding", id: 68, percentage: 78 },
54
- ],
55
- percentage: "89",
56
- },
57
- ],
58
- },
37
+ idCategory:287,
38
+ ArticleId:39550,
39
+ product:[{
40
+ id_article:39550,
41
+ upc:43654697,
42
+ name:"Campana de Cocina",
43
+ timestamp:"2023-08-04T22:23:40.000Z",
44
+ categoryName:"Ferretería|Ferretería General|Tornillos, Tuercas y Arandelas",
45
+ id_category:287,
46
+ version:1,
47
+ retailersAvailable:[
48
+ {name:"The Home Depot Golden",
49
+ id:58,
50
+ percentage:100},
51
+ {name:"The Home Depot Onboarding",
52
+ id:68,
53
+ percentage:78}
54
+ ],
55
+ percentage:"89"}]
56
+ },
59
57
  location: {
60
58
  pathname: "/EditProducts",
61
59
  search: "",
@@ -68,72 +66,57 @@ ProviderProductEditionDefault.args = {
68
66
  key: "24vwut",
69
67
  },
70
68
  user: {
71
- id_user: 191,
72
- name: "Demo",
73
- last_name: "Demo",
74
- email: "merchants24feb@allfreemail.net",
75
- position: "Test",
76
- telephone: "+52123456789",
77
- country: "México",
78
- id_company: 923,
79
- id_cognito: "c3cd160c-76c2-497c-9357-5ef949307e1e",
80
- birth_Date: null,
81
- about_me: null,
82
- zip_code: null,
83
- address: null,
84
- job: null,
85
- id_stripe: null,
86
- id_role: 0,
87
- active: 1,
88
- is_retailer: 0,
89
- email_notify: 1,
90
- is_user_tech: null,
91
- membership: {
92
- id: 114,
93
- start_date: "2023-02-24T18:14:43.000Z",
94
- end_date: "2024-02-24T18:14:43.000Z",
95
- planID: 8,
96
- plan: "prod_KtlhECVSFG2iro",
97
- name: "Plan Pro",
98
- user_limit: "50",
99
- products_limit: "5000",
100
- type: "Enterprise",
101
- },
102
- src: "https://content-management-profile.s3.amazonaws.com/id-191/191.png?1697171804447",
103
- },
69
+ id_user:191,
70
+ name:"Demo",
71
+ last_name:"Demo",
72
+ email:"merchants24feb@allfreemail.net",
73
+ position:"Test",
74
+ telephone:"+52123456789",
75
+ country:"México",
76
+ id_company:923,
77
+ id_cognito:"c3cd160c-76c2-497c-9357-5ef949307e1e",
78
+ birth_Date:null,
79
+ about_me:null,
80
+ zip_code:null,
81
+ address:null,
82
+ job:null,
83
+ id_stripe:null,
84
+ id_role:0,
85
+ active:1,
86
+ is_retailer:0,
87
+ email_notify:1,
88
+ is_user_tech:null,
89
+ membership:
90
+ {id:114,
91
+ start_date:"2023-02-24T18:14:43.000Z",
92
+ end_date:"2024-02-24T18:14:43.000Z",
93
+ planID:8,
94
+ plan:"prod_KtlhECVSFG2iro",
95
+ name:"Plan Pro",
96
+ user_limit:"50",
97
+ products_limit:"5000",
98
+ type:"Enterprise"},
99
+ src:"https://content-management-profile.s3.amazonaws.com/id-191/191.png?1697171804447"},
104
100
  company: {
105
- id_company: 923,
106
- trade_name: "Demo",
107
- company_name: "Demo",
108
- rfc: "Demo",
109
- adress: "Demo",
110
- about_company: null,
111
- telephone: null,
112
- web_site: null,
113
- zip_code: null,
114
- email: null,
115
- social_link: null,
116
- is_retailer: 0,
117
- financedRetailers: [
118
- {
119
- id: 68,
120
- name: "The Home Depot Onboarding",
121
- country: "México",
122
- id_region: 1,
123
- active: 1,
124
- flow: 1,
125
- },
126
- ],
127
- retailers: [
128
- {
129
- id: 68,
130
- name: "The Home Depot Onboarding",
131
- country: "México",
132
- id_region: 1,
133
- active: 1,
134
- flow: 1,
135
- },
136
- ],
137
- },
101
+ id_company:923,
102
+ trade_name:"Demo",
103
+ company_name:"Demo",
104
+ rfc:"Demo",
105
+ adress:"Demo",
106
+ about_company:null,
107
+ telephone:null,
108
+ web_site:null,
109
+ zip_code:null,
110
+ email:null,
111
+ social_link:null,
112
+ is_retailer:0,
113
+ financedRetailers:
114
+ [{id:68,
115
+ name:"The Home Depot Onboarding",
116
+ country:"México",
117
+ id_region:1,
118
+ active:1,
119
+ flow:1}],
120
+ retailers:[{id:68,name:"The Home Depot Onboarding",country:"México",id_region:1,"active":1,flow:1}]},
138
121
  showSurvey: (v) => v && alert("se muestra"),
139
122
  };