thm-p3-configurator 0.0.353 → 0.0.355
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__/queries.js +7 -7
- package/dist/src/shared/__containers__/BottomNavigationBar.js +3 -3
- package/dist/src/shared/__containers__/QuestionsForm.js +15 -0
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +3 -3
- package/dist/src/shared/__containers__/internal/InternalBranchSelectorModal.js +6 -3
- package/dist/src/shared/__context__/FormulaContext.js +9 -1
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +7 -9
- package/package.json +1 -1
|
@@ -480,14 +480,14 @@ const useOrderDataQuery = exports.useOrderDataQuery = function useOrderDataQuery
|
|
|
480
480
|
initialized
|
|
481
481
|
} = (0, _AuthSessionContext.useAuthSession)();
|
|
482
482
|
const isSessionContextReady = (0, _useSessionContextReady.useSessionContextReady)();
|
|
483
|
-
const orderQueryKey = (0, _queryKeyFactory.getOrderQueryKey)(normalizedOrderParams);
|
|
483
|
+
const orderQueryKey = APP_CONFIG.internal ? [...(0, _queryKeyFactory.getOrderQueryKey)(normalizedOrderParams), initialized, authenticated, isSessionContextReady] : (0, _queryKeyFactory.getOrderQueryKey)(normalizedOrderParams);
|
|
484
484
|
const serializedOrderParams = (0, _queryKeyFactory.serializeOrderParams)(normalizedOrderParams);
|
|
485
485
|
const hasOrderInput = (licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.length) > 5 || !!(model !== null && model !== void 0 && model.length);
|
|
486
|
-
const isWaitingForInternalSessionContext = APP_CONFIG.internal && hasOrderInput && (!initialized || authenticated && !isSessionContextReady);
|
|
487
486
|
const orderQuery = (0, _reactQuery.useQuery)(orderQueryKey, {
|
|
488
|
-
//
|
|
489
|
-
//
|
|
490
|
-
|
|
487
|
+
// Internal embedded routes may resolve before the session context sync
|
|
488
|
+
// finishes. Include sync state in the query key so the order refetches
|
|
489
|
+
// automatically once the session context is ready.
|
|
490
|
+
enabled: hasOrderInput && (!APP_CONFIG.internal || initialized),
|
|
491
491
|
keepPreviousData: true,
|
|
492
492
|
queryFn: async () => {
|
|
493
493
|
var _response$data;
|
|
@@ -497,8 +497,8 @@ const useOrderDataQuery = exports.useOrderDataQuery = function useOrderDataQuery
|
|
|
497
497
|
});
|
|
498
498
|
return {
|
|
499
499
|
orderData: orderQuery === null || orderQuery === void 0 ? void 0 : orderQuery.data,
|
|
500
|
-
isLoadingOrder: orderQuery.isLoading
|
|
501
|
-
isFetchingOrder: orderQuery.isFetching
|
|
500
|
+
isLoadingOrder: orderQuery.isLoading,
|
|
501
|
+
isFetchingOrder: orderQuery.isFetching,
|
|
502
502
|
isOrderError: orderQuery.isError,
|
|
503
503
|
orderError: orderQuery.error
|
|
504
504
|
};
|
|
@@ -115,7 +115,7 @@ const BottomNavigationBar = () => {
|
|
|
115
115
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
116
116
|
className: (0, _helpers__.withStyle)('row justify-content-center')
|
|
117
117
|
}, buttons.map(_ref2 => {
|
|
118
|
-
var _history$location3;
|
|
118
|
+
var _history$location3, _history$location4;
|
|
119
119
|
let {
|
|
120
120
|
to,
|
|
121
121
|
label,
|
|
@@ -137,7 +137,7 @@ const BottomNavigationBar = () => {
|
|
|
137
137
|
to = '/configurator/gegevens';
|
|
138
138
|
}
|
|
139
139
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
140
|
-
key:
|
|
140
|
+
key: "link-".concat(history === null || history === void 0 || (_history$location3 = history.location) === null || _history$location3 === void 0 ? void 0 : _history$location3.pathname, "-").concat(label, "-").concat(to, "-").concat(type),
|
|
141
141
|
className: (0, _helpers__.withStyle)("col-12 col-sm-auto d-flex order-2 order-sm-0 justify-content-".concat(buttons.length > 1 ? 'center' : 'end', " mt-1"))
|
|
142
142
|
}, /*#__PURE__*/_react.default.createElement(ButtonByType, _extends({}, setType && {
|
|
143
143
|
onClick: () => {
|
|
@@ -155,7 +155,7 @@ const BottomNavigationBar = () => {
|
|
|
155
155
|
state: {
|
|
156
156
|
prevPathName: history.location.pathname
|
|
157
157
|
},
|
|
158
|
-
isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && (history === null || history === void 0 || (_history$
|
|
158
|
+
isDisabled: (!selectedCableset || !selectedTowbar) && !selectedCombiset && type === 'next' || type === 'next' && (history === null || history === void 0 || (_history$location4 = history.location) === null || _history$location4 === void 0 ? void 0 : _history$location4.pathname) === '/configurator/montagelocatie' && !selectedBranch
|
|
159
159
|
})));
|
|
160
160
|
})))))));
|
|
161
161
|
};
|
|
@@ -30,9 +30,11 @@ var _PrimaryButton = _interopRequireDefault(require("../__components__/Buttons/P
|
|
|
30
30
|
var _RadioInput = _interopRequireDefault(require("../__components__/Form/RadioInput"));
|
|
31
31
|
var _TextSpinner = _interopRequireDefault(require("../__components__/Spinners/TextSpinner"));
|
|
32
32
|
var _constants__ = require("../__constants__");
|
|
33
|
+
var _AuthSessionContext = require("../__context__/AuthSessionContext");
|
|
33
34
|
var _FormulaContext = require("../__context__/FormulaContext");
|
|
34
35
|
var _OrderSessionContext = require("../__context__/OrderSessionContext");
|
|
35
36
|
var _helpers__ = require("../__helpers__");
|
|
37
|
+
var _useSessionContextReady = require("../__hooks__/useSessionContextReady");
|
|
36
38
|
function _interopRequireDefault(e) {
|
|
37
39
|
return e && e.__esModule ? e : {
|
|
38
40
|
default: e
|
|
@@ -142,6 +144,11 @@ const QuestionsForm = _ref => {
|
|
|
142
144
|
priceCalculationDate
|
|
143
145
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
144
146
|
let formula = (0, _FormulaContext.useFormula)();
|
|
147
|
+
const {
|
|
148
|
+
authenticated,
|
|
149
|
+
initialized
|
|
150
|
+
} = (0, _AuthSessionContext.useAuthSession)();
|
|
151
|
+
const isSessionContextReady = (0, _useSessionContextReady.useSessionContextReady)();
|
|
145
152
|
if (isFilter && singleOrderFormulaCode) {
|
|
146
153
|
formula = singleOrderFormulaCode;
|
|
147
154
|
}
|
|
@@ -332,6 +339,7 @@ const QuestionsForm = _ref => {
|
|
|
332
339
|
}
|
|
333
340
|
}, [isLoadingQuestions, durationOptions, execution1Options, execution2Options, execution2AnswerOptions, execution1AnswerOptions, durationQuestion, isFilter, questionsError]);
|
|
334
341
|
const isNotFoundQuestionError = questionsError === _constants__.API_ERROR_CODES.notFound || questionsError === _constants__.API_ERROR_CODES.notFoundAldoc;
|
|
342
|
+
const isWaitingForInternalSessionContext = APP_CONFIG.internal && initialized && authenticated && !isSessionContextReady;
|
|
335
343
|
const handlePrev = () => {
|
|
336
344
|
dispatch({
|
|
337
345
|
type: _OrderSessionContext.orderSessionActions.CLEAR_ANSWERS
|
|
@@ -345,6 +353,13 @@ const QuestionsForm = _ref => {
|
|
|
345
353
|
title: 'Zoeken naar mogelijke opties'
|
|
346
354
|
}));
|
|
347
355
|
}
|
|
356
|
+
if (isWaitingForInternalSessionContext && isNotFoundQuestionError) {
|
|
357
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
358
|
+
className: (0, _helpers__.withStyle)('card-body__loading')
|
|
359
|
+
}, /*#__PURE__*/_react.default.createElement(_TextSpinner.default, {
|
|
360
|
+
title: 'Zoeken naar mogelijke opties'
|
|
361
|
+
}));
|
|
362
|
+
}
|
|
348
363
|
if (isNotFoundQuestionError) {
|
|
349
364
|
return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
|
|
350
365
|
to: notFoundRedirectTarget
|
|
@@ -844,7 +844,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
844
844
|
form: "quotation",
|
|
845
845
|
label: "Leasemaatschappij:",
|
|
846
846
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['companyName']
|
|
847
|
-
}), isCompanyInputFocused && companySearchTerm && companySearchTerm.length >= 3 &&
|
|
847
|
+
}), isCompanyInputFocused && companySearchTerm && companySearchTerm.length >= 3 && branchesByType && branchesByType.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
848
848
|
className: (0, _helpers__.withStyle)('dropdown-results position-absolute w-100 border rounded bg-white shadow'),
|
|
849
849
|
style: {
|
|
850
850
|
maxHeight: '200px',
|
|
@@ -857,9 +857,9 @@ const InternalAppointmentForm = _ref => {
|
|
|
857
857
|
onMouseDown: e => {
|
|
858
858
|
e.preventDefault();
|
|
859
859
|
}
|
|
860
|
-
},
|
|
860
|
+
}, isLoadingBranchesByType && /*#__PURE__*/_react.default.createElement("div", {
|
|
861
861
|
className: (0, _helpers__.withStyle)('p-2 text-center')
|
|
862
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, "Zoeken...")),
|
|
862
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, "Zoeken...")), branchesByType.map(branch => /*#__PURE__*/_react.default.createElement("div", {
|
|
863
863
|
key: branch.entityId,
|
|
864
864
|
className: (0, _helpers__.withStyle)('dropdown-item p-2 border-bottom'),
|
|
865
865
|
style: {
|
|
@@ -345,12 +345,14 @@ const InternalBranchSelectorModal = () => {
|
|
|
345
345
|
isLoadingBranchTypes
|
|
346
346
|
} = (0, _queries.useBranchTypes)();
|
|
347
347
|
const [_selectedBranchId, _setSelectedBranchId] = (0, _react.useState)();
|
|
348
|
+
const [isDismissed, setIsDismissed] = (0, _react.useState)(false);
|
|
348
349
|
const authSession = (0, _AuthSessionContext.useAuthSession)();
|
|
349
350
|
const isSingleOrderPage = (0, _useIsSingleOrder.default)();
|
|
350
351
|
const formula = (0, _FormulaContext.useFormula)();
|
|
351
352
|
const isTMGOrganization = (0, _useIsTmg.useIsTmg)();
|
|
352
353
|
(0, _react.useEffect)(() => {
|
|
353
354
|
_setSelectedBranchId(undefined);
|
|
355
|
+
setIsDismissed(false);
|
|
354
356
|
}, [isSingleOrderPage]);
|
|
355
357
|
const isLocation = _react.default.useMemo(() => {
|
|
356
358
|
var _authSession$branch2;
|
|
@@ -431,8 +433,8 @@ const InternalBranchSelectorModal = () => {
|
|
|
431
433
|
}
|
|
432
434
|
});
|
|
433
435
|
};
|
|
434
|
-
const shouldShowModalForSingleOrder = APP_CONFIG.internal && !selectedBranch && !existingDossierId && isSingleOrderPage;
|
|
435
|
-
const shouldShowModalForOtherPages = APP_CONFIG.internal && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization;
|
|
436
|
+
const shouldShowModalForSingleOrder = APP_CONFIG.internal && !selectedBranch && !existingDossierId && isSingleOrderPage && !isDismissed;
|
|
437
|
+
const shouldShowModalForOtherPages = APP_CONFIG.internal && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization && !isDismissed;
|
|
436
438
|
|
|
437
439
|
// Show loading state only when we actually need to show the modal
|
|
438
440
|
const shouldShowModal = shouldShowModalForSingleOrder || shouldShowModalForOtherPages;
|
|
@@ -460,7 +462,8 @@ const InternalBranchSelectorModal = () => {
|
|
|
460
462
|
hasSecondaryButton: false,
|
|
461
463
|
isPrimaryButtonDisabled: !_selectedBranchId,
|
|
462
464
|
primaryButtonText: 'Ga door',
|
|
463
|
-
onPrimaryButtonClicked: handlePrimaryButtonClicked
|
|
465
|
+
onPrimaryButtonClicked: handlePrimaryButtonClicked,
|
|
466
|
+
onClose: () => setIsDismissed(true)
|
|
464
467
|
}, isSingleOrderPage ? /*#__PURE__*/_react.default.createElement(SingleOrderModalContent, {
|
|
465
468
|
setSelectedBranchId: _setSelectedBranchId,
|
|
466
469
|
isLocation: isLocation,
|
|
@@ -10,6 +10,7 @@ exports.useFormulaDispatch = exports.useFormula = exports.FormulaController = vo
|
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _constants__ = require("../__constants__");
|
|
13
|
+
var _AuthSessionContext = require("./AuthSessionContext");
|
|
13
14
|
function _getRequireWildcardCache(e) {
|
|
14
15
|
if ("function" != typeof WeakMap) return null;
|
|
15
16
|
var r = new WeakMap(),
|
|
@@ -58,8 +59,15 @@ const FormulaController = _ref => {
|
|
|
58
59
|
};
|
|
59
60
|
exports.FormulaController = FormulaController;
|
|
60
61
|
const useFormula = () => {
|
|
62
|
+
var _ref2, _ref3, _branch$formule$code, _branch$formule, _branch$formule2;
|
|
61
63
|
const formulaContext = (0, _react.useContext)(FormulaContext);
|
|
62
|
-
|
|
64
|
+
const {
|
|
65
|
+
branch
|
|
66
|
+
} = (0, _AuthSessionContext.useAuthSession)();
|
|
67
|
+
if (formulaContext) {
|
|
68
|
+
return formulaContext;
|
|
69
|
+
}
|
|
70
|
+
return (0, _constants__.mapBranchFormulaToConfiguratorFormula)((_ref2 = (_ref3 = (_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 : branch === null || branch === void 0 || (_branch$formule2 = branch.formule) === null || _branch$formule2 === void 0 ? void 0 : _branch$formule2.title) !== null && _ref3 !== void 0 ? _ref3 : branch === null || branch === void 0 ? void 0 : branch.formule) !== null && _ref2 !== void 0 ? _ref2 : branch === null || branch === void 0 ? void 0 : branch.formulaCode);
|
|
63
71
|
};
|
|
64
72
|
exports.useFormula = useFormula;
|
|
65
73
|
const useFormulaDispatch = () => {
|
|
@@ -156,10 +156,12 @@ const InternalSingleOrderPage = () => {
|
|
|
156
156
|
anderAfleveradres,
|
|
157
157
|
afhalenInWinkel
|
|
158
158
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
159
|
-
|
|
159
|
+
const sessionFormula = (0, _FormulaContext.useFormula)();
|
|
160
|
+
let formula = sessionFormula;
|
|
160
161
|
if (singleOrderFormulaCode) {
|
|
161
162
|
formula = singleOrderFormulaCode;
|
|
162
163
|
}
|
|
164
|
+
const singleOrderCreationFormula = sessionFormula === _constants__.CONFIGURATOR_FORMULAS.TMG ? _constants__.CONFIGURATOR_FORMULAS.TMG : formula === _constants__.CONFIGURATOR_FORMULAS.THM ? _constants__.CONFIGURATOR_FORMULAS.TM : formula;
|
|
163
165
|
const themeClass = (0, _helpers__.getConfiguratorThemeClassByFormula)(formula);
|
|
164
166
|
const wrapperClass = "thm-configurator-wrapper thm-configurator-wrapper--offset ".concat(themeClass);
|
|
165
167
|
const {
|
|
@@ -364,7 +366,7 @@ const InternalSingleOrderPage = () => {
|
|
|
364
366
|
var _response$data2;
|
|
365
367
|
// Regular flow for offline orders
|
|
366
368
|
const preferredDateTime = appointment !== null && appointment !== void 0 && appointment.date && appointment !== null && appointment !== void 0 && appointment.time ? (0, _helpers__.parseDateAndTimeToTimestamp)(appointment === null || appointment === void 0 ? void 0 : appointment.date, appointment === null || appointment === void 0 ? void 0 : appointment.time) : null;
|
|
367
|
-
const response = await createSingleOrder(
|
|
369
|
+
const response = await createSingleOrder({
|
|
368
370
|
licensePlate: filters.licensePlate,
|
|
369
371
|
model: filters.model,
|
|
370
372
|
cart: singleOrderCart,
|
|
@@ -372,12 +374,8 @@ const InternalSingleOrderPage = () => {
|
|
|
372
374
|
customer: _objectSpread(_objectSpread({}, customer), {}, {
|
|
373
375
|
anderAfleveradres,
|
|
374
376
|
afhalenInWinkel
|
|
375
|
-
})
|
|
376
|
-
|
|
377
|
-
formula: _constants__.CONFIGURATOR_FORMULAS.TM
|
|
378
|
-
} : {
|
|
379
|
-
formula
|
|
380
|
-
}), {}, {
|
|
377
|
+
}),
|
|
378
|
+
formula: singleOrderCreationFormula,
|
|
381
379
|
branchId: selectedBranch,
|
|
382
380
|
channel,
|
|
383
381
|
preferredDateTime,
|
|
@@ -387,7 +385,7 @@ const InternalSingleOrderPage = () => {
|
|
|
387
385
|
zakelijkContactTelefoonnummer: vehiclePayload.ownershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactTelefoonnummer) || undefined : undefined,
|
|
388
386
|
zakeiljkContactFactuuradres: vehiclePayload.ownershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakeiljkContactFactuuradres) || undefined : undefined,
|
|
389
387
|
zakelijkContactEMailadres: vehiclePayload.ownershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactEMailadres) || undefined : undefined
|
|
390
|
-
})
|
|
388
|
+
});
|
|
391
389
|
if (response !== null && response !== void 0 && (_response$data2 = response.data) !== null && _response$data2 !== void 0 && (_response$data2 = _response$data2.data) !== null && _response$data2 !== void 0 && _response$data2.entityId) {
|
|
392
390
|
setCreatedEntityId(response.data.data.entityId);
|
|
393
391
|
}
|