thm-p3-configurator 0.0.387 → 0.0.388
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/__containers__/internal/InternalBranchSelectorModal.js +36 -1
- package/dist/src/shared/__context__/OrderSessionContext.js +8 -4
- package/dist/src/shared/__helpers__/singleOrderBranchSelector.js +14 -0
- package/dist/src/shared/__hooks__/useIsSingleOrder.js +1 -4
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.array.includes.js");
|
|
4
|
+
require("core-js/modules/es.string.includes.js");
|
|
3
5
|
require("core-js/modules/es.weak-map.js");
|
|
4
6
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
5
7
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
@@ -13,6 +15,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
13
15
|
value: true
|
|
14
16
|
});
|
|
15
17
|
exports.default = void 0;
|
|
18
|
+
require("core-js/modules/es.array.includes.js");
|
|
19
|
+
require("core-js/modules/es.string.includes.js");
|
|
16
20
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
17
21
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
18
22
|
require("core-js/modules/esnext.iterator.find.js");
|
|
@@ -29,9 +33,11 @@ var _constants__ = require("../../__constants__");
|
|
|
29
33
|
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
30
34
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
31
35
|
var _helpers__ = require("../../__helpers__");
|
|
36
|
+
var _singleOrderBranchSelector = require("../../__helpers__/singleOrderBranchSelector");
|
|
32
37
|
var _useIsSingleOrder = _interopRequireDefault(require("../../__hooks__/useIsSingleOrder"));
|
|
33
38
|
var _useIsTmg = require("../../__hooks__/useIsTmg");
|
|
34
39
|
var _OrderTypeSelectorModal = _interopRequireWildcard(require("./OrderTypeSelectorModal"));
|
|
40
|
+
var _reactRouterDom = require("react-router-dom");
|
|
35
41
|
function _interopRequireDefault(e) {
|
|
36
42
|
return e && e.__esModule ? e : {
|
|
37
43
|
default: e
|
|
@@ -297,6 +303,7 @@ const SingleOrderModalContent = _ref6 => {
|
|
|
297
303
|
}));
|
|
298
304
|
};
|
|
299
305
|
const InternalBranchSelectorModal = () => {
|
|
306
|
+
const location = (0, _reactRouterDom.useLocation)();
|
|
300
307
|
const {
|
|
301
308
|
branchTypes,
|
|
302
309
|
isLoadingBranchTypes
|
|
@@ -315,8 +322,11 @@ const InternalBranchSelectorModal = () => {
|
|
|
315
322
|
existingDossierId,
|
|
316
323
|
orderType,
|
|
317
324
|
licensePlate,
|
|
318
|
-
model
|
|
325
|
+
model,
|
|
326
|
+
singleOrderFlowRevision
|
|
319
327
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
328
|
+
const previousSelectedBranchRef = (0, _react.useRef)(selectedBranch);
|
|
329
|
+
const previousLocationKeyRef = (0, _react.useRef)(location.key);
|
|
320
330
|
const {
|
|
321
331
|
myBranches,
|
|
322
332
|
isLoadingMyBranches
|
|
@@ -348,6 +358,31 @@ const InternalBranchSelectorModal = () => {
|
|
|
348
358
|
branchTypes
|
|
349
359
|
});
|
|
350
360
|
}, [selectedBranch, branchById, isTMGOrganization, branchTypes, dispatch]);
|
|
361
|
+
(0, _react.useEffect)(() => {
|
|
362
|
+
if ((0, _singleOrderBranchSelector.shouldResetDismissedBranchSelectorState)({
|
|
363
|
+
previousSelectedBranch: previousSelectedBranchRef.current,
|
|
364
|
+
selectedBranch
|
|
365
|
+
})) {
|
|
366
|
+
setIsDismissed(false);
|
|
367
|
+
_setSelectedBranchId(undefined);
|
|
368
|
+
}
|
|
369
|
+
previousSelectedBranchRef.current = selectedBranch;
|
|
370
|
+
}, [selectedBranch]);
|
|
371
|
+
(0, _react.useEffect)(() => {
|
|
372
|
+
const isSingleOrderPath = location.pathname.includes('configurator/single-order') || location.pathname.includes('configurator/losse-order');
|
|
373
|
+
const didLocationEntryChange = previousLocationKeyRef.current !== location.key;
|
|
374
|
+
if (isSingleOrderPath && didLocationEntryChange) {
|
|
375
|
+
setIsDismissed(false);
|
|
376
|
+
_setSelectedBranchId(undefined);
|
|
377
|
+
}
|
|
378
|
+
previousLocationKeyRef.current = location.key;
|
|
379
|
+
}, [location.key, location.pathname]);
|
|
380
|
+
(0, _react.useEffect)(() => {
|
|
381
|
+
if (isSingleOrderPage && !selectedBranch) {
|
|
382
|
+
setIsDismissed(false);
|
|
383
|
+
_setSelectedBranchId(undefined);
|
|
384
|
+
}
|
|
385
|
+
}, [singleOrderFlowRevision, isSingleOrderPage, selectedBranch]);
|
|
351
386
|
const handlePrimaryButtonClicked = () => {
|
|
352
387
|
dispatch({
|
|
353
388
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
@@ -204,7 +204,8 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
204
204
|
isTowCenterBranch: false,
|
|
205
205
|
anderAfleveradres: false,
|
|
206
206
|
afhalenInWinkel: false,
|
|
207
|
-
hasGoedkeuringsnummerActivity: false
|
|
207
|
+
hasGoedkeuringsnummerActivity: false,
|
|
208
|
+
singleOrderFlowRevision: 0
|
|
208
209
|
};
|
|
209
210
|
const orderSessionActions = exports.orderSessionActions = {
|
|
210
211
|
INITIALIZE_NEW_ORDER: 'INITIALIZE_NEW_ORDER',
|
|
@@ -334,13 +335,15 @@ const orderSessionReducer = (state, action) => {
|
|
|
334
335
|
selectedBoardComputer: null,
|
|
335
336
|
isBoardComputerDeselected: false,
|
|
336
337
|
singleOrderCart: singleOrderCart || INITIAL_ORDER_SESSION_STATE.singleOrderCart,
|
|
337
|
-
discountCode: discountCode || INITIAL_ORDER_SESSION_STATE.discountCode
|
|
338
|
+
discountCode: discountCode || INITIAL_ORDER_SESSION_STATE.discountCode,
|
|
339
|
+
singleOrderFlowRevision: state.singleOrderFlowRevision + 1
|
|
338
340
|
});
|
|
339
341
|
}
|
|
340
342
|
return _objectSpread(_objectSpread({}, INITIAL_ORDER_SESSION_STATE), {}, {
|
|
341
343
|
selectedBranch: branchId || INITIAL_ORDER_SESSION_STATE.selectedBranch,
|
|
342
344
|
discountCode: discountCode || INITIAL_ORDER_SESSION_STATE.discountCode,
|
|
343
|
-
singleOrderCart: singleOrderCart || INITIAL_ORDER_SESSION_STATE.singleOrderCart
|
|
345
|
+
singleOrderCart: singleOrderCart || INITIAL_ORDER_SESSION_STATE.singleOrderCart,
|
|
346
|
+
singleOrderFlowRevision: state.singleOrderFlowRevision + 1
|
|
344
347
|
});
|
|
345
348
|
}
|
|
346
349
|
case orderSessionActions.INITIALIZE_EXISTING_ORDER:
|
|
@@ -376,7 +379,8 @@ const orderSessionReducer = (state, action) => {
|
|
|
376
379
|
window.sessionStorage.removeItem(_constants__.PRIVATE_SINGLE_ORDER_SESSION_KEY);
|
|
377
380
|
return _objectSpread(_objectSpread({}, INITIAL_ORDER_SESSION_STATE), {}, {
|
|
378
381
|
selectedBranch: null,
|
|
379
|
-
singleOrderCart: []
|
|
382
|
+
singleOrderCart: [],
|
|
383
|
+
singleOrderFlowRevision: state.singleOrderFlowRevision + 1
|
|
380
384
|
});
|
|
381
385
|
}
|
|
382
386
|
case orderSessionActions.EMPTY_SINGLE_ORDER_CART:
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.shouldResetDismissedBranchSelectorState = void 0;
|
|
7
|
+
const shouldResetDismissedBranchSelectorState = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
previousSelectedBranch,
|
|
10
|
+
selectedBranch
|
|
11
|
+
} = _ref;
|
|
12
|
+
return Boolean(previousSelectedBranch) && !selectedBranch;
|
|
13
|
+
};
|
|
14
|
+
exports.shouldResetDismissedBranchSelectorState = shouldResetDismissedBranchSelectorState;
|
|
@@ -8,11 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useIsSingleOrder = exports.default = void 0;
|
|
9
9
|
require("core-js/modules/es.array.includes.js");
|
|
10
10
|
require("core-js/modules/es.string.includes.js");
|
|
11
|
-
var _react = require("react");
|
|
12
11
|
const useIsSingleOrder = () => {
|
|
13
|
-
return (
|
|
14
|
-
return typeof window !== 'undefined' && (window.location.pathname.includes('configurator/single-order') || window.location.pathname.includes('configurator/losse-order'));
|
|
15
|
-
}, []);
|
|
12
|
+
return typeof window !== 'undefined' && (window.location.pathname.includes('configurator/single-order') || window.location.pathname.includes('configurator/losse-order'));
|
|
16
13
|
};
|
|
17
14
|
exports.useIsSingleOrder = useIsSingleOrder;
|
|
18
15
|
var _default = exports.default = useIsSingleOrder;
|