thm-p3-configurator 0.0.174 → 0.0.176
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__/QuestionsForm.js +26 -12
- package/dist/src/shared/__containers__/internal/InternalLicenseplateModal.js +13 -3
- package/dist/src/shared/__context__/OrderSessionContext.js +0 -3
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +24 -0
- package/package.json +1 -1
|
@@ -103,7 +103,8 @@ const QuestionsForm = _ref => {
|
|
|
103
103
|
onPrev = () => {},
|
|
104
104
|
onSubmit = () => {},
|
|
105
105
|
isFilter = false,
|
|
106
|
-
initialLicensePlate = null
|
|
106
|
+
initialLicensePlate = null,
|
|
107
|
+
initialModel = null
|
|
107
108
|
} = _ref;
|
|
108
109
|
const [filterAnswers, setFilterAnswers] = (0, _react.useState)({
|
|
109
110
|
executionAnswer1: '',
|
|
@@ -145,7 +146,7 @@ const QuestionsForm = _ref => {
|
|
|
145
146
|
if (hasMultipleExecutionQuestions && (!executionAnswer1 || !executionAnswer2)) {
|
|
146
147
|
return {
|
|
147
148
|
licensePlate: initialLicensePlate !== null && initialLicensePlate !== void 0 ? initialLicensePlate : licensePlate,
|
|
148
|
-
model,
|
|
149
|
+
model: initialModel !== null && initialModel !== void 0 ? initialModel : model,
|
|
149
150
|
formula,
|
|
150
151
|
discountCode,
|
|
151
152
|
durationAnswer: durationAnswer
|
|
@@ -155,7 +156,7 @@ const QuestionsForm = _ref => {
|
|
|
155
156
|
// Otherwise include all available answers
|
|
156
157
|
return {
|
|
157
158
|
licensePlate: initialLicensePlate !== null && initialLicensePlate !== void 0 ? initialLicensePlate : licensePlate,
|
|
158
|
-
model,
|
|
159
|
+
model: initialModel !== null && initialModel !== void 0 ? initialModel : model,
|
|
159
160
|
formula,
|
|
160
161
|
discountCode,
|
|
161
162
|
executionAnswer1,
|
|
@@ -220,7 +221,7 @@ const QuestionsForm = _ref => {
|
|
|
220
221
|
const shouldPrefetchProducts = !hasMultipleExecutionQuestions || executionAnswer1 && executionAnswer2;
|
|
221
222
|
(0, _queries.useProductsQuery)(shouldPrefetchProducts ? {
|
|
222
223
|
licensePlate: initialLicensePlate !== null && initialLicensePlate !== void 0 ? initialLicensePlate : licensePlate,
|
|
223
|
-
model,
|
|
224
|
+
model: initialModel !== null && initialModel !== void 0 ? initialModel : model,
|
|
224
225
|
executionAnswer1,
|
|
225
226
|
executionAnswer2,
|
|
226
227
|
durationAnswer,
|
|
@@ -229,7 +230,7 @@ const QuestionsForm = _ref => {
|
|
|
229
230
|
priceCalculationDate
|
|
230
231
|
} : {
|
|
231
232
|
licensePlate: initialLicensePlate !== null && initialLicensePlate !== void 0 ? initialLicensePlate : licensePlate,
|
|
232
|
-
model,
|
|
233
|
+
model: initialModel !== null && initialModel !== void 0 ? initialModel : model,
|
|
233
234
|
formula,
|
|
234
235
|
discountCode,
|
|
235
236
|
priceCalculationDate
|
|
@@ -286,12 +287,19 @@ const QuestionsForm = _ref => {
|
|
|
286
287
|
type: _OrderSessionContext.orderSessionActions.CLEAR_ANSWERS
|
|
287
288
|
});
|
|
288
289
|
if (isFilter) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
290
|
+
if (!initialModel) {
|
|
291
|
+
onSubmit({
|
|
292
|
+
type: 'licensePlate',
|
|
293
|
+
value: {
|
|
294
|
+
licensePlate: initialLicensePlate
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
} else {
|
|
298
|
+
onSubmit({
|
|
299
|
+
type: 'model',
|
|
300
|
+
value: initialModel
|
|
301
|
+
});
|
|
302
|
+
}
|
|
295
303
|
return;
|
|
296
304
|
} else {
|
|
297
305
|
if (questionsError) {
|
|
@@ -423,7 +431,7 @@ const QuestionsForm = _ref => {
|
|
|
423
431
|
if (isFilter && hasMultipleExecutionQuestions && (!filterAnswers.executionAnswer1 || !filterAnswers.executionAnswer2)) {
|
|
424
432
|
return;
|
|
425
433
|
}
|
|
426
|
-
onSubmit(isFilter ? {
|
|
434
|
+
onSubmit(isFilter ? !initialModel ? {
|
|
427
435
|
type: 'licensePlate',
|
|
428
436
|
value: {
|
|
429
437
|
licensePlate: initialLicensePlate,
|
|
@@ -431,6 +439,12 @@ const QuestionsForm = _ref => {
|
|
|
431
439
|
executionAnswer2: filterAnswers.executionAnswer2,
|
|
432
440
|
durationAnswer: filterAnswers.durationAnswer
|
|
433
441
|
}
|
|
442
|
+
} : {
|
|
443
|
+
type: 'model',
|
|
444
|
+
value: initialModel,
|
|
445
|
+
executionAnswer1: filterAnswers.executionAnswer1,
|
|
446
|
+
executionAnswer2: filterAnswers.executionAnswer2,
|
|
447
|
+
durationAnswer: filterAnswers.durationAnswer
|
|
434
448
|
} : {
|
|
435
449
|
executionAnswer1,
|
|
436
450
|
executionAnswer2,
|
|
@@ -105,10 +105,20 @@ function InternalLicenseplateModal(_ref) {
|
|
|
105
105
|
}, /*#__PURE__*/_react.default.createElement(_FormSteps.default, {
|
|
106
106
|
count: 2,
|
|
107
107
|
defaultActive: activeStep
|
|
108
|
-
}))), activeModalType === 1 && /*#__PURE__*/_react.default.createElement(_ManualSelectionForm.default, {
|
|
108
|
+
}))), activeModalType === 1 && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, activeStep === 0 && /*#__PURE__*/_react.default.createElement(_ManualSelectionForm.default, {
|
|
109
109
|
filterModalChange: handleModalTypeChange,
|
|
110
110
|
handleSelectedFilterChange: handleSelectedFilterChange,
|
|
111
|
-
onSubmit:
|
|
111
|
+
onSubmit: handleNext,
|
|
112
112
|
isFilter: true
|
|
113
|
-
})
|
|
113
|
+
}), activeStep === 1 && /*#__PURE__*/_react.default.createElement(_QuestionsForm.default, {
|
|
114
|
+
isFilter: true,
|
|
115
|
+
initialModel: currentLicenseplate === null || currentLicenseplate === void 0 ? void 0 : currentLicenseplate.value,
|
|
116
|
+
onPrev: handlePrev,
|
|
117
|
+
onSubmit: onSubmit
|
|
118
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
119
|
+
className: (0, _helpers__.withStyle)('align-items-center justify-content-center text-center mt-2')
|
|
120
|
+
}, /*#__PURE__*/_react.default.createElement(_FormSteps.default, {
|
|
121
|
+
count: 2,
|
|
122
|
+
defaultActive: activeStep
|
|
123
|
+
})))));
|
|
114
124
|
}
|
|
@@ -1044,9 +1044,6 @@ const initializeOrderSession = function initializeOrderSession() {
|
|
|
1044
1044
|
// Check if we're on a single-order page by examining window.location
|
|
1045
1045
|
const storageKey = isPrivateSingleOrder ? _constants__.PRIVATE_SINGLE_ORDER_SESSION_KEY : _constants__.ORDER_SESSION_KEY;
|
|
1046
1046
|
const cachedSession = (0, _helpers__.parseJson)(window.sessionStorage.getItem(storageKey));
|
|
1047
|
-
console.log('is single order page', isPrivateSingleOrder);
|
|
1048
|
-
console.log('cachedSession', cachedSession);
|
|
1049
|
-
console.log('storageKey', storageKey);
|
|
1050
1047
|
if (!cachedSession) {
|
|
1051
1048
|
return INITIAL_ORDER_SESSION_STATE;
|
|
1052
1049
|
}
|
|
@@ -227,6 +227,30 @@ const InternalSingleOrderPage = () => {
|
|
|
227
227
|
model: filter.value
|
|
228
228
|
}
|
|
229
229
|
});
|
|
230
|
+
if (filter.executionAnswer1) {
|
|
231
|
+
dispatch({
|
|
232
|
+
type: _OrderSessionContext.orderSessionActions.SET_EXECUTION1_ANSWER,
|
|
233
|
+
payload: {
|
|
234
|
+
answer: filter.executionAnswer1
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (filter.executionAnswer2) {
|
|
239
|
+
dispatch({
|
|
240
|
+
type: _OrderSessionContext.orderSessionActions.SET_EXECUTION2_ANSWER,
|
|
241
|
+
payload: {
|
|
242
|
+
answer: filter.executionAnswer2
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
if (filter.durationAnswer) {
|
|
247
|
+
dispatch({
|
|
248
|
+
type: _OrderSessionContext.orderSessionActions.SET_DURATION_ANSWER,
|
|
249
|
+
payload: {
|
|
250
|
+
answer: filter.durationAnswer
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
230
254
|
}
|
|
231
255
|
if (filter.type === 'licensePlate') {
|
|
232
256
|
var _filter$value$executi, _filter$value$executi2, _filter$value$duratio;
|