contentoh-components-library 21.5.94 → 21.5.96

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 (70) hide show
  1. package/dist/ai/utils/compare-strings.js +45 -0
  2. package/dist/components/atoms/GeneralButton/styles.js +1 -1
  3. package/dist/components/atoms/GeneralInput/index.js +249 -54
  4. package/dist/components/atoms/GeneralInput/styles.js +7 -3
  5. package/dist/components/atoms/InputFormatter/index.js +223 -68
  6. package/dist/components/atoms/InputFormatter/styles.js +20 -4
  7. package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
  8. package/dist/components/molecules/TabsMenu/index.js +13 -1
  9. package/dist/components/molecules/TagAndInput/index.js +364 -24
  10. package/dist/components/molecules/TagAndInput/styles.js +2 -2
  11. package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
  12. package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
  13. package/dist/components/organisms/FullProductNameHeader/index.js +6 -22
  14. package/dist/components/organisms/InputGroup/index.js +22 -18
  15. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +150 -337
  16. package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
  17. package/dist/components/pages/ProviderProductEdition/index.js +395 -361
  18. package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
  19. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +125 -211
  20. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
  21. package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +50 -38
  22. package/dist/components/pages/RetailerProductEdition/index.js +1741 -2239
  23. package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
  24. package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
  25. package/dist/contexts/AiProductEdition.js +244 -160
  26. package/dist/global-files/statusDictionary.js +103 -0
  27. package/package.json +4 -2
  28. package/src/ai/utils/compare-strings.js +45 -0
  29. package/src/assets/images/Icons/arrow.png +0 -0
  30. package/src/assets/images/Icons/cancel.png +0 -0
  31. package/src/assets/images/Icons/ia-icon.png +0 -0
  32. package/src/assets/images/Icons/loading.svg +5 -0
  33. package/src/assets/images/Icons/reload.png +0 -0
  34. package/src/components/atoms/GeneralButton/styles.js +4 -0
  35. package/src/components/atoms/GeneralInput/index.js +241 -60
  36. package/src/components/atoms/GeneralInput/styles.js +81 -0
  37. package/src/components/atoms/InputFormatter/index.js +200 -51
  38. package/src/components/atoms/InputFormatter/styles.js +284 -0
  39. package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +10 -0
  40. package/src/components/atoms/RetailerSelector/index.js +3 -0
  41. package/src/components/atoms/RetailerSelector/styles.js +0 -0
  42. package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
  43. package/src/components/molecules/TabsMenu/index.js +12 -0
  44. package/src/components/molecules/TagAndInput/index.js +294 -21
  45. package/src/components/molecules/TagAndInput/styles.js +59 -17
  46. package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
  47. package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
  48. package/src/components/organisms/FullProductNameHeader/index.js +4 -28
  49. package/src/components/organisms/FullTabsMenu/index.js +1 -1
  50. package/src/components/organisms/InputGroup/index.js +12 -4
  51. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +174 -202
  52. package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
  53. package/src/components/pages/ProviderProductEdition/index.js +497 -437
  54. package/src/components/pages/ProviderProductEdition/utils.js +2 -2
  55. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +136 -243
  56. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +575 -0
  57. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +62 -0
  58. package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +344 -0
  59. package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +155 -0
  60. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +114 -0
  61. package/src/components/pages/RetailerProductEdition/context/reducers/system.js +60 -0
  62. package/src/components/pages/RetailerProductEdition/index.js +1563 -1717
  63. package/src/components/pages/RetailerProductEdition/index_old.js +1979 -0
  64. package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +101 -0
  65. package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +115 -0
  66. package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +174 -0
  67. package/src/components/pages/RetailerProductEdition/styles.js +67 -2
  68. package/src/components/pages/RetailerProductEdition/utils.js +240 -0
  69. package/src/contexts/AiProductEdition.jsx +347 -0
  70. package/src/global-files/statusDictionary.js +103 -0
@@ -9,6 +9,8 @@ exports.productReducer = exports.productInitialState = exports.PRODUCT_ACTIONS =
9
9
 
10
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
11
 
12
+ var _statusDictionary = require("../../../../../global-files/statusDictionary");
13
+
12
14
  var productInitialState = {
13
15
  product: null,
14
16
  services: null,
@@ -20,9 +22,8 @@ var PRODUCT_ACTIONS = {
20
22
  SET_SERVICES: "SET_SERVICES",
21
23
  SET_SERVICES_DATA: "SET_SERVICES_DATA",
22
24
  SET_PRODUCT_VERSION: "SET_PRODUCT_VERSION",
23
- UPDATE_DESCRIPTION_STATUS: "UPDATE_DESCRIPTION_STATUS",
24
- UPDATE_DATASHEET_STATUS: "UPDATE_DATASHEET_STATUS",
25
- UPDATE_IMAGES_STATUS: "UPDATE_IMAGES_STATUS"
25
+ SET_PERCENTAGES: "SET_PERCENTAGES",
26
+ SET_RETAILER_STATUS: "SET_RETAILER_STATUS"
26
27
  };
27
28
  exports.PRODUCT_ACTIONS = PRODUCT_ACTIONS;
28
29
 
@@ -42,63 +43,56 @@ var productReducer = function productReducer(state, action) {
42
43
  });
43
44
  }
44
45
 
45
- case PRODUCT_ACTIONS.SET_SERVICES_DATA:
46
+ case PRODUCT_ACTIONS.SET_RETAILER_STATUS:
46
47
  {
47
- return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
48
- services_data: action.payload
49
- });
50
- }
48
+ var _action$payload$find, _action$payload$find2, _action$payload$find3;
51
49
 
52
- case PRODUCT_ACTIONS.SET_PRODUCT_VERSION:
53
- {
54
50
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
55
51
  product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
56
- version: action.payload
52
+ status: getMinorStatus(action.payload.map(function (status) {
53
+ return status === null || status === void 0 ? void 0 : status.status;
54
+ })),
55
+ description_status: ((_action$payload$find = action.payload.find(function (status) {
56
+ var _state$active_retaile;
57
+
58
+ return (status === null || status === void 0 ? void 0 : status.service) === "description" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile = state.active_retailer) === null || _state$active_retaile === void 0 ? void 0 : _state$active_retaile.id_retailer);
59
+ })) === null || _action$payload$find === void 0 ? void 0 : _action$payload$find.status) || "NS",
60
+ datasheet_status: ((_action$payload$find2 = action.payload.find(function (status) {
61
+ var _state$active_retaile2;
62
+
63
+ return (status === null || status === void 0 ? void 0 : status.service) === "datasheet" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer);
64
+ })) === null || _action$payload$find2 === void 0 ? void 0 : _action$payload$find2.status) || "NS",
65
+ images_status: ((_action$payload$find3 = action.payload.find(function (status) {
66
+ var _state$active_retaile3;
67
+
68
+ return (status === null || status === void 0 ? void 0 : status.service) === "images" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer);
69
+ })) === null || _action$payload$find3 === void 0 ? void 0 : _action$payload$find3.status) || "NS",
70
+ statusByRetailer: action.payload
57
71
  })
58
72
  });
59
73
  }
60
74
 
61
- case PRODUCT_ACTIONS.UPDATE_DESCRIPTION_STATUS:
75
+ case PRODUCT_ACTIONS.SET_SERVICES_DATA:
62
76
  {
63
- var _state$product;
64
-
65
77
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
66
- product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
67
- statusByRetailer: (((_state$product = state.product) === null || _state$product === void 0 ? void 0 : _state$product.statusByRetailer) || []).map(function (retailerStatus) {
68
- return retailerStatus.service === "description" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
69
- status: action.payload
70
- }) : retailerStatus;
71
- })
72
- })
78
+ services_data: action.payload
73
79
  });
74
80
  }
75
81
 
76
- case PRODUCT_ACTIONS.UPDATE_DATASHEET_STATUS:
82
+ case PRODUCT_ACTIONS.SET_PRODUCT_VERSION:
77
83
  {
78
- var _state$product2;
79
-
80
84
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
81
85
  product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
82
- statusByRetailer: (((_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.statusByRetailer) || []).map(function (retailerStatus) {
83
- return retailerStatus.service === "datasheet" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
84
- status: action.payload
85
- }) : retailerStatus;
86
- })
86
+ version: action.payload
87
87
  })
88
88
  });
89
89
  }
90
90
 
91
- case PRODUCT_ACTIONS.UPDATE_IMAGES_STATUS:
91
+ case PRODUCT_ACTIONS.SET_PERCENTAGES:
92
92
  {
93
- var _state$product3;
94
-
95
93
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
96
94
  product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
97
- statusByRetailer: (((_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.statusByRetailer) || []).map(function (retailerStatus) {
98
- return retailerStatus.service === "images" ? (0, _objectSpread2.default)((0, _objectSpread2.default)({}, retailerStatus), {}, {
99
- status: action.payload
100
- }) : retailerStatus;
101
- })
95
+ percentages: action.payload
102
96
  })
103
97
  });
104
98
  }
@@ -110,4 +104,22 @@ var productReducer = function productReducer(state, action) {
110
104
  }
111
105
  };
112
106
 
113
- exports.productReducer = productReducer;
107
+ exports.productReducer = productReducer;
108
+
109
+ function getMinorStatus() {
110
+ var _STATUS_DICTIONARY$NS;
111
+
112
+ var servicesStatus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
113
+ if (!servicesStatus || servicesStatus.length === 0) return _statusDictionary.STATUS_DICTIONARY.NS.name;
114
+ console.log({
115
+ servicesStatus: servicesStatus
116
+ });
117
+ var winner = servicesStatus.reduce(function (minor, current) {
118
+ var currentObj = typeof current === "string" ? _statusDictionary.STATUS_DICTIONARY[current] : current;
119
+ var minorObj = typeof minor === "string" ? _statusDictionary.STATUS_DICTIONARY[minor] : minor;
120
+ if (!currentObj || typeof currentObj.weight === "undefined") return minor;
121
+ if (!minorObj || typeof minorObj.weight === "undefined") return current;
122
+ return currentObj.weight < minorObj.weight ? currentObj : minorObj;
123
+ }, servicesStatus[0] || _statusDictionary.STATUS_DICTIONARY.NS);
124
+ return (winner === null || winner === void 0 ? void 0 : winner.status) || ((_STATUS_DICTIONARY$NS = _statusDictionary.STATUS_DICTIONARY.NS) === null || _STATUS_DICTIONARY$NS === void 0 ? void 0 : _STATUS_DICTIONARY$NS.status);
125
+ }