contentoh-components-library 21.5.93 → 21.5.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/utils/compare-strings.js +45 -0
- package/dist/components/atoms/GeneralButton/styles.js +1 -1
- package/dist/components/atoms/GeneralInput/index.js +245 -54
- package/dist/components/atoms/GeneralInput/styles.js +7 -3
- package/dist/components/atoms/InputFormatter/index.js +223 -68
- package/dist/components/atoms/InputFormatter/styles.js +20 -4
- package/dist/components/molecules/StatusAsignationInfo/index.js +11 -1
- package/dist/components/molecules/TabsMenu/index.js +13 -12
- package/dist/components/molecules/TagAndInput/index.js +361 -24
- package/dist/components/molecules/TagAndInput/styles.js +2 -2
- package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
- package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +6 -22
- package/dist/components/organisms/InputGroup/index.js +22 -18
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +150 -337
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +15 -15
- package/dist/components/pages/ProviderProductEdition/index.js +408 -381
- package/dist/components/pages/ProviderProductEdition/utils.js +1 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +179 -196
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +59 -260
- package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +50 -38
- package/dist/components/pages/RetailerProductEdition/index.js +1719 -2237
- package/dist/components/pages/RetailerProductEdition/styles.js +4 -2
- package/dist/components/pages/RetailerProductEdition/utils.js +251 -2
- package/dist/contexts/AiProductEdition.js +230 -158
- package/dist/global-files/statusDictionary.js +103 -0
- package/package.json +4 -2
- package/src/ai/utils/compare-strings.js +45 -0
- package/src/assets/images/Icons/arrow.png +0 -0
- package/src/assets/images/Icons/cancel.png +0 -0
- package/src/assets/images/Icons/ia-icon.png +0 -0
- package/src/assets/images/Icons/loading.svg +5 -0
- package/src/assets/images/Icons/reload.png +0 -0
- package/src/components/atoms/GeneralButton/styles.js +4 -0
- package/src/components/atoms/GeneralInput/index.js +237 -60
- package/src/components/atoms/GeneralInput/styles.js +81 -0
- package/src/components/atoms/InputFormatter/index.js +200 -51
- package/src/components/atoms/InputFormatter/styles.js +284 -0
- package/src/components/atoms/RetailerSelector/RetailerSelector.stories.js +10 -0
- package/src/components/atoms/RetailerSelector/index.js +3 -0
- package/src/components/atoms/RetailerSelector/styles.js +0 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +9 -1
- package/src/components/molecules/TabsMenu/index.js +12 -11
- package/src/components/molecules/TagAndInput/index.js +286 -21
- package/src/components/molecules/TagAndInput/styles.js +59 -17
- package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
- package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
- package/src/components/organisms/FullProductNameHeader/index.js +4 -28
- package/src/components/organisms/FullTabsMenu/index.js +1 -1
- package/src/components/organisms/InputGroup/index.js +12 -4
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +174 -202
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -14
- package/src/components/pages/ProviderProductEdition/index.js +489 -457
- package/src/components/pages/ProviderProductEdition/utils.js +2 -2
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +201 -224
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +575 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.reducer.js +62 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/active-state.js +344 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/inputs.js +155 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/product.js +114 -0
- package/src/components/pages/RetailerProductEdition/context/reducers/system.js +60 -0
- package/src/components/pages/RetailerProductEdition/index.js +1545 -1718
- package/src/components/pages/RetailerProductEdition/index_old.js +1979 -0
- package/src/components/pages/RetailerProductEdition/stories/Auditor.stories.js +101 -0
- package/src/components/pages/RetailerProductEdition/stories/ImageEditor.stories.js +115 -0
- package/src/components/pages/RetailerProductEdition/stories/TextEditor.stories.js +174 -0
- package/src/components/pages/RetailerProductEdition/styles.js +67 -2
- package/src/components/pages/RetailerProductEdition/utils.js +240 -0
- package/src/contexts/AiProductEdition.jsx +339 -0
- 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
|
-
|
|
24
|
-
|
|
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.
|
|
46
|
+
case PRODUCT_ACTIONS.SET_RETAILER_STATUS:
|
|
46
47
|
{
|
|
47
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
+
}
|