thm-p3-configurator 0.0.61 → 0.0.62
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 +1 -11
- package/dist/src/shared/__containers__/internal/InternalBranchSelectorModal.js +13 -0
- package/dist/src/shared/__containers__/internal/InternalSingleOrderProductOverview.js +5 -1
- package/dist/src/shared/__context__/OrderSessionContext.js +11 -0
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +7 -3
- package/package.json +1 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.promise.js");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.orderApi = void 0;
|
|
8
|
-
require("core-js/modules/es.promise.js");
|
|
9
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
10
8
|
var _index = require("../__constants__/index.js");
|
|
11
9
|
var _LocalStorageWorker = require("../__services__/LocalStorageWorker.js");
|
|
@@ -33,15 +31,7 @@ orderClient.interceptors.request.use(config => {
|
|
|
33
31
|
});
|
|
34
32
|
|
|
35
33
|
// Add response interceptor to handle 4xx errors
|
|
36
|
-
|
|
37
|
-
if (error.response && error.response.status >= 400 && error.response.status < 500) {
|
|
38
|
-
var _error$response$data;
|
|
39
|
-
// Handle client errors (4xx)
|
|
40
|
-
const errorMessage = ((_error$response$data = error.response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) || 'Client request error';
|
|
41
|
-
console.error("API Error ".concat(error.response.status, ": ").concat(errorMessage));
|
|
42
|
-
}
|
|
43
|
-
return Promise.reject(error);
|
|
44
|
-
});
|
|
34
|
+
|
|
45
35
|
const orderApi = exports.orderApi = {
|
|
46
36
|
getOrder: orderParameters => orderClient("api".concat(APP_CONFIG.internal ? '' : '/public', "/order?").concat(orderParameters) // Remove the `/public` param if the configurator is internal,
|
|
47
37
|
),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.weak-map.js");
|
|
4
4
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
5
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
6
|
require("core-js/modules/esnext.iterator.map.js");
|
|
6
7
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
7
8
|
require("core-js/modules/es.weak-map.js");
|
|
@@ -10,6 +11,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
11
|
});
|
|
11
12
|
exports.default = void 0;
|
|
12
13
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
14
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
13
15
|
require("core-js/modules/esnext.iterator.map.js");
|
|
14
16
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
15
17
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -139,6 +141,11 @@ const SingleOrderModalContent = _ref3 => {
|
|
|
139
141
|
limit: 500,
|
|
140
142
|
offset: 0
|
|
141
143
|
});
|
|
144
|
+
const branchIdWithFormulaCode = new Map();
|
|
145
|
+
singleOrderBranches === null || singleOrderBranches === void 0 || singleOrderBranches.forEach(branch => {
|
|
146
|
+
var _branch$formule$code, _branch$formule;
|
|
147
|
+
branchIdWithFormulaCode.set(branch === null || branch === void 0 ? void 0 : branch.entityId, (_branch$formule$code = branch === null || branch === void 0 || (_branch$formule = branch.formule) === null || _branch$formule === void 0 ? void 0 : _branch$formule.code) !== null && _branch$formule$code !== void 0 ? _branch$formule$code : _constants__.CONFIGURATOR_FORMULAS.THC);
|
|
148
|
+
});
|
|
142
149
|
(0, _react.useEffect)(() => {
|
|
143
150
|
if (isLocation && !selectedBranch && !isTMGOrganization) {
|
|
144
151
|
var _authSession$branch;
|
|
@@ -190,6 +197,12 @@ const SingleOrderModalContent = _ref3 => {
|
|
|
190
197
|
} = _ref5;
|
|
191
198
|
setSelectedBranchId(value);
|
|
192
199
|
setLocalBranchId(value);
|
|
200
|
+
dispatch({
|
|
201
|
+
type: _OrderSessionContext.orderSessionActions.SET_SINGLE_ORDER_FORMULA_CODE,
|
|
202
|
+
payload: {
|
|
203
|
+
formulaCode: branchIdWithFormulaCode.get(value)
|
|
204
|
+
}
|
|
205
|
+
});
|
|
193
206
|
}
|
|
194
207
|
}));
|
|
195
208
|
};
|
|
@@ -93,9 +93,13 @@ const InternalSingleOrderProductOverview = _ref => {
|
|
|
93
93
|
selectedBranch,
|
|
94
94
|
durationAnswer,
|
|
95
95
|
executionAnswer1,
|
|
96
|
+
singleOrderFormulaCode,
|
|
96
97
|
executionAnswer2
|
|
97
98
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
98
|
-
|
|
99
|
+
let formula = (0, _FormulaContext.useFormula)();
|
|
100
|
+
if (singleOrderFormulaCode) {
|
|
101
|
+
formula = singleOrderFormulaCode;
|
|
102
|
+
}
|
|
99
103
|
const mergedFilters = _objectSpread(_objectSpread({}, filters), {}, {
|
|
100
104
|
licensePlate,
|
|
101
105
|
model,
|
|
@@ -127,6 +127,7 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
127
127
|
isBoardComputerDeselected: false,
|
|
128
128
|
selectedBranch: null,
|
|
129
129
|
discountCode: null,
|
|
130
|
+
singleOrderFormulaCode: null,
|
|
130
131
|
franchiseName: null,
|
|
131
132
|
customerAgreed: undefined,
|
|
132
133
|
vehicle: {
|
|
@@ -178,6 +179,7 @@ const orderSessionActions = exports.orderSessionActions = {
|
|
|
178
179
|
DISCOUNTS_INITIALIZED: 'DISCOUNTS_INITIALIZED',
|
|
179
180
|
RESET_SINGLE_ORDER: 'RESET_SINGLE_ORDER',
|
|
180
181
|
EMPTY_SINGLE_ORDER_CART: 'EMPTY_SINGLE_ORDER_CART',
|
|
182
|
+
SET_SINGLE_ORDER_FORMULA_CODE: 'SET_SINGLE_ORDER_FORMULA_CODE',
|
|
181
183
|
DISCOUNTS_REMOVED: 'DISCOUNTS_REMOVED',
|
|
182
184
|
REMOVE_DISCOUNTED_PRODUCT: 'REMOVE_DISCOUNTED_PRODUCT',
|
|
183
185
|
ADD_EXTRA: 'ADD_EXTRA',
|
|
@@ -283,6 +285,15 @@ const orderSessionReducer = (state, action) => {
|
|
|
283
285
|
isTouched: true
|
|
284
286
|
});
|
|
285
287
|
}
|
|
288
|
+
case orderSessionActions.SET_SINGLE_ORDER_FORMULA_CODE:
|
|
289
|
+
{
|
|
290
|
+
const {
|
|
291
|
+
formulaCode
|
|
292
|
+
} = action.payload;
|
|
293
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
294
|
+
singleOrderFormulaCode: formulaCode
|
|
295
|
+
});
|
|
296
|
+
}
|
|
286
297
|
case orderSessionActions.SET_LICENSEPLATE_FILTERS:
|
|
287
298
|
{
|
|
288
299
|
const {
|
|
@@ -135,16 +135,20 @@ const InternalSingleOrderPage = () => {
|
|
|
135
135
|
setShowProductOverview(true);
|
|
136
136
|
}
|
|
137
137
|
}, [isCreateSingleOrderSuccess]);
|
|
138
|
-
const formula = (0, _FormulaContext.useFormula)();
|
|
139
|
-
const wrapperClass = "thm-configurator-wrapper thm-configurator-wrapper--offset ".concat(formula === _constants__.CONFIGURATOR_FORMULAS.THC ? 'thc' : '');
|
|
140
138
|
const [{
|
|
141
139
|
singleOrderCart,
|
|
142
140
|
channel,
|
|
143
141
|
customer,
|
|
144
142
|
selectedBranch,
|
|
145
143
|
appointment,
|
|
146
|
-
internalNote
|
|
144
|
+
internalNote,
|
|
145
|
+
singleOrderFormulaCode
|
|
147
146
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
147
|
+
let formula = (0, _FormulaContext.useFormula)();
|
|
148
|
+
if (singleOrderFormulaCode) {
|
|
149
|
+
formula = singleOrderFormulaCode;
|
|
150
|
+
}
|
|
151
|
+
const wrapperClass = "thm-configurator-wrapper thm-configurator-wrapper--offset ".concat(formula === _constants__.CONFIGURATOR_FORMULAS.THC ? 'thc' : '');
|
|
148
152
|
const {
|
|
149
153
|
branchById
|
|
150
154
|
} = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
|