thm-p3-configurator 0.0.216 → 0.0.217
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/src/shared/__api__/orderApi.js +11 -4
- package/dist/src/shared/__api__/queries.js +13 -8
- package/dist/src/shared/__containers__/LicensePlateForm.js +1 -1
- package/dist/src/shared/__containers__/ManualSelectionForm.js +9 -7
- package/dist/src/shared/__helpers__/singleOrderArticles.js +1 -1
- package/package.json +1 -1
|
@@ -34,13 +34,20 @@ orderClient.interceptors.request.use(config => {
|
|
|
34
34
|
});
|
|
35
35
|
const orderApi = exports.orderApi = {
|
|
36
36
|
getArticles: filters => orderClient("api/public/articles?".concat(filters)),
|
|
37
|
-
getBrands: ()
|
|
38
|
-
|
|
37
|
+
getBrands: function getBrands() {
|
|
38
|
+
let formula = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'THC';
|
|
39
|
+
return publicOrderClient("api/public/v1/configurator/makes?formula=".concat(formula));
|
|
40
|
+
},
|
|
41
|
+
getBuildYears: function getBuildYears(brand) {
|
|
42
|
+
let formula = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'THC';
|
|
43
|
+
return publicOrderClient("api/public/v1/configurator/makes/".concat(brand, "/years?formula=").concat(formula));
|
|
44
|
+
},
|
|
39
45
|
getModels: _ref => {
|
|
40
46
|
let {
|
|
41
47
|
brand,
|
|
42
|
-
year
|
|
48
|
+
year,
|
|
49
|
+
formula = 'THC'
|
|
43
50
|
} = _ref;
|
|
44
|
-
return publicOrderClient("api/public/v1/configurator/makes/".concat(brand, "/models").concat(year ? "?year=".concat(year) :
|
|
51
|
+
return publicOrderClient("api/public/v1/configurator/makes/".concat(brand, "/models").concat(year ? "?year=".concat(year, "&formula=").concat(formula) : "?formula=".concat(formula)));
|
|
45
52
|
}
|
|
46
53
|
};
|
|
@@ -82,9 +82,10 @@ function _toPrimitive(t, r) {
|
|
|
82
82
|
/**
|
|
83
83
|
* @description Retrieves the car brand options
|
|
84
84
|
*/
|
|
85
|
-
const useBrandsQuery = ()
|
|
85
|
+
const useBrandsQuery = exports.useBrandsQuery = function useBrandsQuery() {
|
|
86
|
+
let formula = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'THC';
|
|
86
87
|
const brandsQuery = (0, _reactQuery.useQuery)(['brands'], {
|
|
87
|
-
queryFn: () => _orderApi.orderApi.getBrands().then(res => {
|
|
88
|
+
queryFn: () => _orderApi.orderApi.getBrands(formula).then(res => {
|
|
88
89
|
var _res$data;
|
|
89
90
|
return (0, _helpers__.parseArrayToInputOptions)((_res$data = res === null || res === void 0 ? void 0 : res.data) !== null && _res$data !== void 0 ? _res$data : []);
|
|
90
91
|
})
|
|
@@ -99,14 +100,14 @@ const useBrandsQuery = () => {
|
|
|
99
100
|
/**
|
|
100
101
|
* @description Retrieves the car build-year option based on the provided brand
|
|
101
102
|
*/
|
|
102
|
-
exports.useBrandsQuery = useBrandsQuery;
|
|
103
103
|
const useBuildYearsQuery = _ref => {
|
|
104
104
|
let {
|
|
105
|
-
brand
|
|
105
|
+
brand,
|
|
106
|
+
formula = 'THC'
|
|
106
107
|
} = _ref;
|
|
107
108
|
const buildYearsQuery = (0, _reactQuery.useQuery)(['buildYears', brand], {
|
|
108
109
|
enabled: !!(brand !== null && brand !== void 0 && brand.length),
|
|
109
|
-
queryFn: () => _orderApi.orderApi.getBuildYears(brand).then(res => {
|
|
110
|
+
queryFn: () => _orderApi.orderApi.getBuildYears(brand, formula).then(res => {
|
|
110
111
|
var _res$data2;
|
|
111
112
|
return (0, _helpers__.parseArrayToInputOptions)((_res$data2 = res === null || res === void 0 ? void 0 : res.data) !== null && _res$data2 !== void 0 ? _res$data2 : []);
|
|
112
113
|
})
|
|
@@ -206,17 +207,20 @@ exports.useMarketingChannels = useMarketingChannels;
|
|
|
206
207
|
const useModelsQuery = _ref2 => {
|
|
207
208
|
let {
|
|
208
209
|
brand,
|
|
209
|
-
year
|
|
210
|
+
year,
|
|
211
|
+
formula = 'THC'
|
|
210
212
|
} = _ref2;
|
|
211
213
|
const modelsQuery = (0, _reactQuery.useQuery)(['models', JSON.stringify({
|
|
212
214
|
brand,
|
|
213
|
-
year
|
|
215
|
+
year,
|
|
216
|
+
formula
|
|
214
217
|
})], {
|
|
215
218
|
enabled: !!(brand !== null && brand !== void 0 && brand.length),
|
|
216
219
|
queryFn: () => {
|
|
217
220
|
return _orderApi.orderApi.getModels({
|
|
218
221
|
brand,
|
|
219
|
-
year
|
|
222
|
+
year,
|
|
223
|
+
formula
|
|
220
224
|
}).then(res => {
|
|
221
225
|
var _res$data3;
|
|
222
226
|
return (0, _helpers__.parseArrayToInputOptions)((_res$data3 = res === null || res === void 0 ? void 0 : res.data) !== null && _res$data3 !== void 0 ? _res$data3 : []);
|
|
@@ -258,6 +262,7 @@ const useSingleOrderArticles = exports.useSingleOrderArticles = function useSing
|
|
|
258
262
|
let articles = [],
|
|
259
263
|
totalCount = 0;
|
|
260
264
|
if (!articleNumber && !licensePlate && !model) {
|
|
265
|
+
filters.formula = formula;
|
|
261
266
|
({
|
|
262
267
|
articles,
|
|
263
268
|
totalCount
|
|
@@ -71,28 +71,30 @@ const ManualSelectionForm = _ref => {
|
|
|
71
71
|
discountCode,
|
|
72
72
|
singleOrderFormulaCode
|
|
73
73
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
74
|
+
let formula = (0, _FormulaContext.useFormula)();
|
|
75
|
+
if (isFilter && singleOrderFormulaCode) {
|
|
76
|
+
formula = singleOrderFormulaCode;
|
|
77
|
+
}
|
|
74
78
|
const [filterModel, setFilterModel] = (0, _react.useState)((_initialValues$model = initialValues === null || initialValues === void 0 ? void 0 : initialValues.model) !== null && _initialValues$model !== void 0 ? _initialValues$model : model);
|
|
75
79
|
const {
|
|
76
80
|
brands,
|
|
77
81
|
isLoadingBrands
|
|
78
|
-
} = (0, _queries.useBrandsQuery)();
|
|
82
|
+
} = (0, _queries.useBrandsQuery)(formula);
|
|
79
83
|
const {
|
|
80
84
|
models,
|
|
81
85
|
isLoadingModels
|
|
82
86
|
} = (0, _queries.useModelsQuery)({
|
|
83
87
|
brand,
|
|
84
|
-
year: buildYear
|
|
88
|
+
year: buildYear,
|
|
89
|
+
formula
|
|
85
90
|
});
|
|
86
91
|
const {
|
|
87
92
|
buildYears,
|
|
88
93
|
isLoadingBuildYears
|
|
89
94
|
} = (0, _queries.useBuildYearsQuery)({
|
|
90
|
-
brand
|
|
95
|
+
brand,
|
|
96
|
+
formula
|
|
91
97
|
});
|
|
92
|
-
let formula = (0, _FormulaContext.useFormula)();
|
|
93
|
-
if (isFilter && singleOrderFormulaCode) {
|
|
94
|
-
formula = singleOrderFormulaCode;
|
|
95
|
-
}
|
|
96
98
|
const handleNext = () => {
|
|
97
99
|
dispatch({
|
|
98
100
|
type: _OrderSessionContext.orderSessionActions.SET_DURATION_ANSWER,
|
|
@@ -93,7 +93,7 @@ function _toPrimitive(t, r) {
|
|
|
93
93
|
* @returns {Object} The articles
|
|
94
94
|
*/
|
|
95
95
|
const fetchArticlesByFilters = async filters => {
|
|
96
|
-
const articlesParamsString = new URLSearchParams((0, _index.removeNullishProps)(filters)).toString();
|
|
96
|
+
const articlesParamsString = new URLSearchParams((0, _index.removeNullishProps)(_objectSpread({}, filters))).toString();
|
|
97
97
|
const response = await _authenticatedProxyApi.authenticatedProxyApi.getArticles(articlesParamsString);
|
|
98
98
|
if (!(response !== null && response !== void 0 && response.data)) {
|
|
99
99
|
throw new Error('No articles found');
|