thm-p3-configurator 0.0.35 → 0.0.37
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 +14 -8
- package/dist/src/shared/__containers__/AppointmentForm.js +3 -3
- package/dist/src/shared/__containers__/ExitIntentModal.js +1 -1
- package/dist/src/shared/__containers__/ManualSelectionForm.js +57 -5
- package/dist/src/shared/__containers__/QuestionsForm.js +14 -0
- package/dist/src/shared/__containers__/QuotationForm.js +2 -2
- package/dist/src/shared/__containers__/VehicleData.js +3 -2
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +1 -1
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +1 -1
- package/dist/src/shared/__context__/OrderSessionContext.js +3 -3
- package/dist/src/shared/__helpers__/index.js +1 -1
- package/dist/src/shared/__pages__/internal/InternalLicensePlatePage.js +10 -4
- package/dist/src/shared/__pages__/internal/InternalManualSelectionPage.js +26 -5
- package/package.json +1 -1
|
@@ -171,7 +171,7 @@ const useProductsQuery = orderParameters => {
|
|
|
171
171
|
*/
|
|
172
172
|
exports.useProductsQuery = useProductsQuery;
|
|
173
173
|
const useQuestionsQuery = questionParams => {
|
|
174
|
-
var _questionsQuery$error, _questionsQuery$data$, _questionsQuery$
|
|
174
|
+
var _questionsQuery$data, _questionsQuery$data2, _questionsQuery$data3, _questionsQuery$error, _questionsQuery$data$, _questionsQuery$data4, _questionsQuery$data$2, _questionsQuery$data5, _questionsQuery$data$3, _questionsQuery$data6;
|
|
175
175
|
const {
|
|
176
176
|
licensePlate,
|
|
177
177
|
model
|
|
@@ -180,21 +180,27 @@ const useQuestionsQuery = questionParams => {
|
|
|
180
180
|
const questionsQuery = (0, _reactQuery.useQuery)(['questions', questionsParamsString], {
|
|
181
181
|
enabled: (licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.length) > 5 || !!(model !== null && model !== void 0 && model.length),
|
|
182
182
|
queryFn: () => _orderApi.orderApi.getOrder(questionsParamsString).then(res => {
|
|
183
|
-
var _res$data5, _res$data6, _res$data7;
|
|
183
|
+
var _res$data5, _res$data6, _res$data7, _res$data8, _res$data9, _res$data10;
|
|
184
184
|
return {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
execution1Answer: res === null || res === void 0 || (_res$data5 = res.data) === null || _res$data5 === void 0 || (_res$data5 = _res$data5.data) === null || _res$data5 === void 0 || (_res$data5 = _res$data5.answers) === null || _res$data5 === void 0 ? void 0 : _res$data5.execution1,
|
|
186
|
+
execution2Answer: res === null || res === void 0 || (_res$data6 = res.data) === null || _res$data6 === void 0 || (_res$data6 = _res$data6.data) === null || _res$data6 === void 0 || (_res$data6 = _res$data6.answers) === null || _res$data6 === void 0 ? void 0 : _res$data6.execution2,
|
|
187
|
+
durationAnswer: res === null || res === void 0 || (_res$data7 = res.data) === null || _res$data7 === void 0 || (_res$data7 = _res$data7.data) === null || _res$data7 === void 0 || (_res$data7 = _res$data7.answers) === null || _res$data7 === void 0 ? void 0 : _res$data7.duration,
|
|
188
|
+
durationQuestion: (0, _helpers__.parseArrayToInputOptions)(res === null || res === void 0 || (_res$data8 = res.data) === null || _res$data8 === void 0 || (_res$data8 = _res$data8.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.durationAnswerOptions),
|
|
189
|
+
execution1AnswerOptions: (0, _helpers__.parseArrayToInputOptions)(res === null || res === void 0 || (_res$data9 = res.data) === null || _res$data9 === void 0 || (_res$data9 = _res$data9.data) === null || _res$data9 === void 0 || (_res$data9 = _res$data9.executionAnswerOptions) === null || _res$data9 === void 0 ? void 0 : _res$data9.execution1AnswerOptions),
|
|
190
|
+
execution2AnswerOptions: (0, _helpers__.parseArrayToInputOptions)(res === null || res === void 0 || (_res$data10 = res.data) === null || _res$data10 === void 0 || (_res$data10 = _res$data10.data) === null || _res$data10 === void 0 || (_res$data10 = _res$data10.executionAnswerOptions) === null || _res$data10 === void 0 ? void 0 : _res$data10.execution2AnswerOptions)
|
|
188
191
|
};
|
|
189
192
|
})
|
|
190
193
|
});
|
|
191
194
|
return {
|
|
192
195
|
isLoadingQuestions: questionsQuery.isFetching,
|
|
193
196
|
isQuestionsError: questionsQuery.isError,
|
|
197
|
+
execution1Answer: questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data = questionsQuery.data) === null || _questionsQuery$data === void 0 ? void 0 : _questionsQuery$data.execution1Answer,
|
|
198
|
+
execution2Answer: questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data2 = questionsQuery.data) === null || _questionsQuery$data2 === void 0 ? void 0 : _questionsQuery$data2.execution2Answer,
|
|
199
|
+
durationAnswer: questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data3 = questionsQuery.data) === null || _questionsQuery$data3 === void 0 ? void 0 : _questionsQuery$data3.durationAnswer,
|
|
194
200
|
questionsError: ((_questionsQuery$error = questionsQuery.error) === null || _questionsQuery$error === void 0 || (_questionsQuery$error = _questionsQuery$error.response) === null || _questionsQuery$error === void 0 || (_questionsQuery$error = _questionsQuery$error.data) === null || _questionsQuery$error === void 0 ? void 0 : _questionsQuery$error.code) || questionsQuery.error,
|
|
195
|
-
execution1AnswerOptions: (_questionsQuery$data$ = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$
|
|
196
|
-
execution2AnswerOptions: (_questionsQuery$data$2 = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$
|
|
197
|
-
durationQuestion: (_questionsQuery$data$3 = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$
|
|
201
|
+
execution1AnswerOptions: (_questionsQuery$data$ = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data4 = questionsQuery.data) === null || _questionsQuery$data4 === void 0 ? void 0 : _questionsQuery$data4.execution1AnswerOptions) !== null && _questionsQuery$data$ !== void 0 ? _questionsQuery$data$ : [],
|
|
202
|
+
execution2AnswerOptions: (_questionsQuery$data$2 = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data5 = questionsQuery.data) === null || _questionsQuery$data5 === void 0 ? void 0 : _questionsQuery$data5.execution2AnswerOptions) !== null && _questionsQuery$data$2 !== void 0 ? _questionsQuery$data$2 : [],
|
|
203
|
+
durationQuestion: (_questionsQuery$data$3 = questionsQuery === null || questionsQuery === void 0 || (_questionsQuery$data6 = questionsQuery.data) === null || _questionsQuery$data6 === void 0 ? void 0 : _questionsQuery$data6.durationQuestion) !== null && _questionsQuery$data$3 !== void 0 ? _questionsQuery$data$3 : []
|
|
198
204
|
};
|
|
199
205
|
};
|
|
200
206
|
|
|
@@ -171,14 +171,14 @@ const AppointmentForm = () => {
|
|
|
171
171
|
licensePlate: licensePlate === null || licensePlate === void 0 ? void 0 : licensePlate.replace(/-/g, ''),
|
|
172
172
|
model,
|
|
173
173
|
answers: (0, _helpers__.removeNullishProps)({
|
|
174
|
-
duration: durationAnswer
|
|
174
|
+
duration: durationAnswer,
|
|
175
175
|
execution1: executionAnswer1,
|
|
176
176
|
execution2: executionAnswer2
|
|
177
177
|
}),
|
|
178
|
-
customer: _objectSpread(_objectSpread({}, customer), {}, {
|
|
178
|
+
customer: (0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({}, customer), {}, {
|
|
179
179
|
firstName: (customer === null || customer === void 0 ? void 0 : customer.firstName) || '(Onbekend)',
|
|
180
180
|
lastName: (customer === null || customer === void 0 ? void 0 : customer.lastName) || '(Onbekend)'
|
|
181
|
-
}),
|
|
181
|
+
})),
|
|
182
182
|
formula,
|
|
183
183
|
branchId: selectedBranch,
|
|
184
184
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
@@ -183,7 +183,7 @@ const ExitIntentModal = () => {
|
|
|
183
183
|
licensePlate,
|
|
184
184
|
model,
|
|
185
185
|
answers: (0, _helpers__.removeNullishProps)({
|
|
186
|
-
duration: durationAnswer
|
|
186
|
+
duration: durationAnswer,
|
|
187
187
|
execution1: executionAnswer1,
|
|
188
188
|
execution2: executionAnswer2
|
|
189
189
|
}),
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
require("core-js/modules/es.regexp.exec.js");
|
|
4
4
|
require("core-js/modules/es.regexp.to-string.js");
|
|
5
5
|
require("core-js/modules/es.string.search.js");
|
|
6
|
+
require("core-js/modules/es.weak-map.js");
|
|
6
7
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
7
8
|
require("core-js/modules/web.url-search-params.js");
|
|
9
|
+
require("core-js/modules/es.weak-map.js");
|
|
8
10
|
Object.defineProperty(exports, "__esModule", {
|
|
9
11
|
value: true
|
|
10
12
|
});
|
|
@@ -14,7 +16,7 @@ require("core-js/modules/es.regexp.to-string.js");
|
|
|
14
16
|
require("core-js/modules/es.string.search.js");
|
|
15
17
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
16
18
|
require("core-js/modules/web.url-search-params.js");
|
|
17
|
-
var _react =
|
|
19
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
18
20
|
var _reactRouter = require("react-router");
|
|
19
21
|
var _queries = require("../__api__/queries");
|
|
20
22
|
var _LinkButton = _interopRequireDefault(require("../__components__/Buttons/LinkButton"));
|
|
@@ -28,9 +30,39 @@ function _interopRequireDefault(e) {
|
|
|
28
30
|
default: e
|
|
29
31
|
};
|
|
30
32
|
}
|
|
33
|
+
function _getRequireWildcardCache(e) {
|
|
34
|
+
if ("function" != typeof WeakMap) return null;
|
|
35
|
+
var r = new WeakMap(),
|
|
36
|
+
t = new WeakMap();
|
|
37
|
+
return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
|
|
38
|
+
return e ? t : r;
|
|
39
|
+
})(e);
|
|
40
|
+
}
|
|
41
|
+
function _interopRequireWildcard(e, r) {
|
|
42
|
+
if (!r && e && e.__esModule) return e;
|
|
43
|
+
if (null === e || "object" != typeof e && "function" != typeof e) return {
|
|
44
|
+
default: e
|
|
45
|
+
};
|
|
46
|
+
var t = _getRequireWildcardCache(r);
|
|
47
|
+
if (t && t.has(e)) return t.get(e);
|
|
48
|
+
var n = {
|
|
49
|
+
__proto__: null
|
|
50
|
+
},
|
|
51
|
+
a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
52
|
+
for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
|
53
|
+
var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
|
54
|
+
i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
|
55
|
+
}
|
|
56
|
+
return n.default = e, t && t.set(e, n), n;
|
|
57
|
+
}
|
|
31
58
|
const ManualSelectionForm = _ref => {
|
|
32
59
|
let {
|
|
33
|
-
onSubmit
|
|
60
|
+
onSubmit,
|
|
61
|
+
initialValues = {
|
|
62
|
+
brand: null,
|
|
63
|
+
model: null,
|
|
64
|
+
buildYear: null
|
|
65
|
+
}
|
|
34
66
|
} = _ref;
|
|
35
67
|
const [{
|
|
36
68
|
brand,
|
|
@@ -71,6 +103,17 @@ const ManualSelectionForm = _ref => {
|
|
|
71
103
|
history.push("/configurator".concat(searchParams !== null && searchParams !== void 0 && searchParams.size ? "?".concat(searchParams.toString()) : '') // append search params if found
|
|
72
104
|
);
|
|
73
105
|
};
|
|
106
|
+
(0, _react.useEffect)(() => {
|
|
107
|
+
handleBrandChange({
|
|
108
|
+
value: initialValues.brand
|
|
109
|
+
});
|
|
110
|
+
handleBuildYearChange({
|
|
111
|
+
value: initialValues.buildYear
|
|
112
|
+
});
|
|
113
|
+
handleModelChange({
|
|
114
|
+
value: initialValues.model
|
|
115
|
+
});
|
|
116
|
+
}, [initialValues]);
|
|
74
117
|
const handleBrandChange = brandOption => {
|
|
75
118
|
dispatch({
|
|
76
119
|
type: _OrderSessionContext.orderSessionActions.SET_BRAND,
|
|
@@ -106,7 +149,10 @@ const ManualSelectionForm = _ref => {
|
|
|
106
149
|
noOptionsMessage: "Geen opties beschikbaar",
|
|
107
150
|
placeholder: "Maak een keuze",
|
|
108
151
|
onChange: handleBrandChange,
|
|
109
|
-
initialValue: !brand ?
|
|
152
|
+
initialValue: !brand ? {
|
|
153
|
+
value: initialValues === null || initialValues === void 0 ? void 0 : initialValues.brand,
|
|
154
|
+
label: initialValues === null || initialValues === void 0 ? void 0 : initialValues.brand
|
|
155
|
+
} : {
|
|
110
156
|
value: brand,
|
|
111
157
|
label: brand
|
|
112
158
|
}
|
|
@@ -119,7 +165,10 @@ const ManualSelectionForm = _ref => {
|
|
|
119
165
|
noOptionsMessage: "Geen opties beschikbaar",
|
|
120
166
|
placeholder: "Maak een keuze",
|
|
121
167
|
onChange: handleBuildYearChange,
|
|
122
|
-
initialValue: !buildYear ?
|
|
168
|
+
initialValue: !buildYear ? {
|
|
169
|
+
value: initialValues === null || initialValues === void 0 ? void 0 : initialValues.buildYear,
|
|
170
|
+
label: initialValues === null || initialValues === void 0 ? void 0 : initialValues.buildYear
|
|
171
|
+
} : {
|
|
123
172
|
value: buildYear,
|
|
124
173
|
label: buildYear
|
|
125
174
|
}
|
|
@@ -132,7 +181,10 @@ const ManualSelectionForm = _ref => {
|
|
|
132
181
|
noOptionsMessage: "Geen opties beschikbaar",
|
|
133
182
|
placeholder: "Maak een keuze",
|
|
134
183
|
onChange: handleModelChange,
|
|
135
|
-
initialValue: !model ?
|
|
184
|
+
initialValue: !model ? {
|
|
185
|
+
value: initialValues === null || initialValues === void 0 ? void 0 : initialValues.model,
|
|
186
|
+
label: initialValues === null || initialValues === void 0 ? void 0 : initialValues.model
|
|
187
|
+
} : {
|
|
136
188
|
value: model,
|
|
137
189
|
label: model
|
|
138
190
|
}
|
|
@@ -71,6 +71,7 @@ const QuestionsForm = _ref => {
|
|
|
71
71
|
isLoadingQuestions,
|
|
72
72
|
execution1AnswerOptions,
|
|
73
73
|
execution2AnswerOptions,
|
|
74
|
+
durationAnswer: durationAnswerPrefilled,
|
|
74
75
|
questionsError,
|
|
75
76
|
durationQuestion
|
|
76
77
|
} = (0, _queries.useQuestionsQuery)({
|
|
@@ -93,6 +94,19 @@ const QuestionsForm = _ref => {
|
|
|
93
94
|
priceCalculationDate
|
|
94
95
|
}); // Prefetch
|
|
95
96
|
|
|
97
|
+
/**
|
|
98
|
+
* @description This hook pre-fills the duration answer, only if it comes pre-filled from the API, and it's not set manually by the user.
|
|
99
|
+
*/
|
|
100
|
+
(0, _react.useEffect)(() => {
|
|
101
|
+
if (!durationAnswer && durationAnswerPrefilled && !(durationOptions !== null && durationOptions !== void 0 && durationOptions.length) && !(durationQuestion !== null && durationQuestion !== void 0 && durationQuestion.length)) {
|
|
102
|
+
dispatch({
|
|
103
|
+
type: _OrderSessionContext.orderSessionActions.SET_DURATION_ANSWER,
|
|
104
|
+
payload: {
|
|
105
|
+
answer: durationAnswerPrefilled
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}, [durationOptions, durationAnswerPrefilled, durationQuestion, durationAnswer]);
|
|
96
110
|
(0, _react.useEffect)(() => {
|
|
97
111
|
if (durationQuestion !== null && durationQuestion !== void 0 && durationQuestion.length) {
|
|
98
112
|
dispatch({
|
|
@@ -164,7 +164,7 @@ const QuotationForm = () => {
|
|
|
164
164
|
licensePlate,
|
|
165
165
|
model,
|
|
166
166
|
answers: (0, _helpers__.removeNullishProps)({
|
|
167
|
-
duration: durationAnswer
|
|
167
|
+
duration: durationAnswer,
|
|
168
168
|
execution1: executionAnswer1,
|
|
169
169
|
execution2: executionAnswer2
|
|
170
170
|
}),
|
|
@@ -172,7 +172,7 @@ const QuotationForm = () => {
|
|
|
172
172
|
code: discountCode
|
|
173
173
|
} : null,
|
|
174
174
|
formula,
|
|
175
|
-
customer,
|
|
175
|
+
customer: (0, _helpers__.removeNullishProps)(customer),
|
|
176
176
|
branchId: selectedBranch,
|
|
177
177
|
selectBoardComputerUpdate: selectedBoardComputer != null,
|
|
178
178
|
cart: (0, _product.validateCartInput)([{
|
|
@@ -32,7 +32,8 @@ const VehicleData = () => {
|
|
|
32
32
|
executionAnswer2,
|
|
33
33
|
durationAnswer,
|
|
34
34
|
discountCode,
|
|
35
|
-
priceCalculationDate
|
|
35
|
+
priceCalculationDate,
|
|
36
|
+
existingDossierId
|
|
36
37
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
37
38
|
const formula = (0, _FormulaContext.useFormula)();
|
|
38
39
|
const {
|
|
@@ -71,7 +72,7 @@ const VehicleData = () => {
|
|
|
71
72
|
isDisabled: false,
|
|
72
73
|
label: 'Wijzig voertuig',
|
|
73
74
|
onClick: () => {
|
|
74
|
-
history.push("/configurator".concat(licensePlate ? '' : '/manual'));
|
|
75
|
+
history.push("/configurator".concat(licensePlate ? '' : '/manual', "?persistSession=true"));
|
|
75
76
|
},
|
|
76
77
|
className: (0, _helpers__.withStyle)('license-plate__edit link-primary col-12'),
|
|
77
78
|
type: "button"
|
|
@@ -250,7 +250,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
250
250
|
model,
|
|
251
251
|
priceCalculationDate,
|
|
252
252
|
answers: (0, _helpers__.removeNullishProps)({
|
|
253
|
-
duration: durationAnswer
|
|
253
|
+
duration: durationAnswer,
|
|
254
254
|
execution1: executionAnswer1,
|
|
255
255
|
execution2: executionAnswer2
|
|
256
256
|
}),
|
|
@@ -235,7 +235,7 @@ const InternalQuotationForm = _ref => {
|
|
|
235
235
|
licensePlate: (_ref2 = licensePlate || _licensePlate) === null || _ref2 === void 0 ? void 0 : _ref2.replace(/-/g, ''),
|
|
236
236
|
model,
|
|
237
237
|
answers: (0, _helpers__.removeNullishProps)({
|
|
238
|
-
duration: durationAnswer
|
|
238
|
+
duration: durationAnswer,
|
|
239
239
|
execution1: executionAnswer1,
|
|
240
240
|
execution2: executionAnswer2
|
|
241
241
|
}),
|
|
@@ -102,7 +102,7 @@ const INITIAL_ORDER_SESSION_STATE = {
|
|
|
102
102
|
model: null,
|
|
103
103
|
brand: null,
|
|
104
104
|
channel: null,
|
|
105
|
-
durationAnswer:
|
|
105
|
+
durationAnswer: undefined,
|
|
106
106
|
executionAnswer1: null,
|
|
107
107
|
executionAnswer2: null,
|
|
108
108
|
priceCalculationDate: new Date().getTime(),
|
|
@@ -211,7 +211,7 @@ const orderSessionReducer = (state, action) => {
|
|
|
211
211
|
buildYear: null,
|
|
212
212
|
model: null,
|
|
213
213
|
brand: null,
|
|
214
|
-
durationAnswer:
|
|
214
|
+
durationAnswer: undefined,
|
|
215
215
|
executionAnswer1: null,
|
|
216
216
|
executionAnswer2: null,
|
|
217
217
|
durationOptions: [],
|
|
@@ -765,7 +765,7 @@ const orderSessionReducer = (state, action) => {
|
|
|
765
765
|
{
|
|
766
766
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
767
767
|
answers: {},
|
|
768
|
-
durationAnswer:
|
|
768
|
+
durationAnswer: undefined
|
|
769
769
|
});
|
|
770
770
|
}
|
|
771
771
|
case orderSessionActions.SET_PRICE_CALCULATION_DATE:
|
|
@@ -202,7 +202,7 @@ const removeNullishProps = exports.removeNullishProps = function removeNullishPr
|
|
|
202
202
|
let object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
203
203
|
return Object.fromEntries(Object.entries(object).filter(_ref3 => {
|
|
204
204
|
let [key, value] = _ref3;
|
|
205
|
-
return value
|
|
205
|
+
return !!value;
|
|
206
206
|
}));
|
|
207
207
|
};
|
|
208
208
|
|
|
@@ -70,9 +70,10 @@ const getSteps = _ref => {
|
|
|
70
70
|
const licensePlateValidator = new _LicensePlateValidator.default();
|
|
71
71
|
const InternalLicensePlatePage = () => {
|
|
72
72
|
const [activeStep, setActiveStep] = (0, _react.useState)(0);
|
|
73
|
-
const [
|
|
73
|
+
const [session, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
74
|
+
const originalLicensePlate = (0, _react.useRef)();
|
|
74
75
|
const formula = (0, _FormulaContext.useFormula)();
|
|
75
|
-
const [licensePlateURL, discountCode] = (0, _useSearchParam.default)(['licensePlate', 'discountCode']);
|
|
76
|
+
const [licensePlateURL, discountCode, persistSession] = (0, _useSearchParam.default)(['licensePlate', 'discountCode', 'persistSession']);
|
|
76
77
|
const history = (0, _reactRouter.useHistory)();
|
|
77
78
|
(0, _queries.useProductFieldLabels)(); // Prefetch
|
|
78
79
|
|
|
@@ -85,6 +86,11 @@ const InternalLicensePlatePage = () => {
|
|
|
85
86
|
const handleSubmit = () => {
|
|
86
87
|
history.push('/configurator/trekhaakpakket');
|
|
87
88
|
};
|
|
89
|
+
(0, _react.useEffect)(() => {
|
|
90
|
+
if (!originalLicensePlate.current && session !== null && session !== void 0 && session.licensePlate) {
|
|
91
|
+
originalLicensePlate.current = session.licensePlate;
|
|
92
|
+
}
|
|
93
|
+
}, [session]);
|
|
88
94
|
(0, _react.useEffect)(() => {
|
|
89
95
|
// If no license plate was found: initialize a new order
|
|
90
96
|
if (!licensePlateURL) {
|
|
@@ -109,11 +115,11 @@ const InternalLicensePlatePage = () => {
|
|
|
109
115
|
}
|
|
110
116
|
}, [discountCode]);
|
|
111
117
|
const Steps = (0, _react.useMemo)(() => getSteps({
|
|
112
|
-
initialLicensePlate: licensePlateValidator.init(licensePlateURL),
|
|
118
|
+
initialLicensePlate: persistSession === 'true' ? originalLicensePlate.current : licensePlateValidator.init(licensePlateURL),
|
|
113
119
|
onNext: handleNext,
|
|
114
120
|
onPrev: handlePrev,
|
|
115
121
|
onSubmit: handleSubmit
|
|
116
|
-
}), []);
|
|
122
|
+
}), [persistSession, originalLicensePlate.current]);
|
|
117
123
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
118
124
|
className: (0, _helpers__.withStyle)('vh-100')
|
|
119
125
|
}, /*#__PURE__*/_react.default.createElement(_internal.InternalCancelDossierEdit, null), /*#__PURE__*/_react.default.createElement("section", {
|
|
@@ -55,23 +55,39 @@ const getSteps = _ref => {
|
|
|
55
55
|
let {
|
|
56
56
|
onNext,
|
|
57
57
|
onPrev,
|
|
58
|
-
onSubmit
|
|
58
|
+
onSubmit,
|
|
59
|
+
initialValues
|
|
59
60
|
} = _ref;
|
|
60
61
|
return [/*#__PURE__*/_react.default.createElement(_ManualSelectionForm.default, {
|
|
61
|
-
onSubmit: onNext
|
|
62
|
+
onSubmit: onNext,
|
|
63
|
+
initialValues: initialValues
|
|
62
64
|
}), /*#__PURE__*/_react.default.createElement(_QuestionsForm.default, {
|
|
63
65
|
onPrev: onPrev,
|
|
64
66
|
onSubmit: onSubmit
|
|
65
67
|
})];
|
|
66
68
|
};
|
|
67
69
|
const InternalManualSelectionPage = () => {
|
|
68
|
-
const [
|
|
70
|
+
const [{
|
|
71
|
+
brand,
|
|
72
|
+
model,
|
|
73
|
+
buildYear
|
|
74
|
+
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
69
75
|
const [activeStep, setActiveStep] = (0, _react.useState)(0);
|
|
76
|
+
const originalVehicle = (0, _react.useRef)();
|
|
70
77
|
const history = (0, _reactRouter.useHistory)();
|
|
71
78
|
const formula = (0, _FormulaContext.useFormula)();
|
|
72
|
-
const [discountCode] = (0, _useSearchParam.default)(['discountCode']);
|
|
79
|
+
const [discountCode, persistSession] = (0, _useSearchParam.default)(['discountCode', 'persistSession']);
|
|
73
80
|
(0, _queries.useProductFieldLabels)(); // Prefetch
|
|
74
81
|
|
|
82
|
+
(0, _react.useEffect)(() => {
|
|
83
|
+
if (!(originalVehicle !== null && originalVehicle !== void 0 && originalVehicle.current)) {
|
|
84
|
+
originalVehicle.current = {
|
|
85
|
+
brand,
|
|
86
|
+
model,
|
|
87
|
+
buildYear
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}, [brand, model, buildYear]);
|
|
75
91
|
(0, _react.useEffect)(() => {
|
|
76
92
|
dispatch({
|
|
77
93
|
type: _OrderSessionContext.orderSessionActions.INITIALIZE_NEW_ORDER,
|
|
@@ -100,10 +116,15 @@ const InternalManualSelectionPage = () => {
|
|
|
100
116
|
history.push('/configurator/trekhaakpakket');
|
|
101
117
|
};
|
|
102
118
|
const Steps = (0, _react.useMemo)(() => getSteps({
|
|
119
|
+
initialValues: persistSession ? originalVehicle.current : {
|
|
120
|
+
brand: null,
|
|
121
|
+
model: null,
|
|
122
|
+
buildYear: null
|
|
123
|
+
},
|
|
103
124
|
onNext: handleNext,
|
|
104
125
|
onPrev: handlePrev,
|
|
105
126
|
onSubmit: handleSubmit
|
|
106
|
-
}), []);
|
|
127
|
+
}), [persistSession, originalVehicle.current]);
|
|
107
128
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
108
129
|
className: (0, _helpers__.withStyle)('vh-100')
|
|
109
130
|
}, /*#__PURE__*/_react.default.createElement(_internal.InternalCancelDossierEdit, null), /*#__PURE__*/_react.default.createElement("section", {
|