thm-p3-configurator 0.0.110 → 0.0.112
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.
|
@@ -127,8 +127,16 @@ const internalAppointmentFormSchema = (0, _yup.object)({
|
|
|
127
127
|
ownershipType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
128
128
|
leaseNumber: (0, _yup.string)().nullable(),
|
|
129
129
|
firstName: (0, _yup.string)().nullable(),
|
|
130
|
-
channelType: (0, _yup.string)().
|
|
131
|
-
|
|
130
|
+
channelType: (0, _yup.string)().when('$existingDossierId', {
|
|
131
|
+
is: existingDossierId => !!existingDossierId,
|
|
132
|
+
then: schema => schema.nullable(),
|
|
133
|
+
otherwise: schema => schema.required(_constants__.FORM_ERROR_MESSAGES.required)
|
|
134
|
+
}),
|
|
135
|
+
channelId: (0, _yup.string)().when('$existingDossierId', {
|
|
136
|
+
is: existingDossierId => !!existingDossierId,
|
|
137
|
+
then: schema => schema.nullable(),
|
|
138
|
+
otherwise: schema => schema.required(_constants__.FORM_ERROR_MESSAGES.required)
|
|
139
|
+
}),
|
|
132
140
|
infix: (0, _yup.string)().nullable(),
|
|
133
141
|
lastName: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
134
142
|
email: (0, _yup.string)().email(_constants__.FORM_ERROR_MESSAGES.email).required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
@@ -220,18 +228,20 @@ const InternalAppointmentForm = _ref => {
|
|
|
220
228
|
|
|
221
229
|
// Otherwise, default to Nederland
|
|
222
230
|
const defaultCountry = countryOptions.find(option => option.label === 'NEDERLAND');
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
return defaultCountry || null;
|
|
232
|
+
}, [customer === null || customer === void 0 ? void 0 : customer.countryId, countryOptions]);
|
|
233
|
+
(0, _react.useEffect)(() => {
|
|
234
|
+
if (!(customer !== null && customer !== void 0 && customer.countryId) && countryOptions !== null && countryOptions !== void 0 && countryOptions.length) {
|
|
235
|
+
const defaultCountry = countryOptions.find(option => option.label === 'NEDERLAND');
|
|
236
|
+
if (defaultCountry) {
|
|
237
|
+
dispatch({
|
|
238
|
+
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_COUNTRY_ID,
|
|
239
|
+
payload: {
|
|
240
|
+
countryId: defaultCountry.value
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
233
244
|
}
|
|
234
|
-
return null;
|
|
235
245
|
}, [customer === null || customer === void 0 ? void 0 : customer.countryId, countryOptions, dispatch]);
|
|
236
246
|
const {
|
|
237
247
|
branchById
|
|
@@ -307,7 +317,10 @@ const InternalAppointmentForm = _ref => {
|
|
|
307
317
|
customerAgreed: productSpecifications !== null && productSpecifications !== void 0 && productSpecifications.length ? customerAgreed : true // Note: this skips validation if no productSpecifications are found
|
|
308
318
|
}), {
|
|
309
319
|
strict: false,
|
|
310
|
-
abortEarly: false
|
|
320
|
+
abortEarly: false,
|
|
321
|
+
context: {
|
|
322
|
+
existingDossierId: existingDossierId
|
|
323
|
+
}
|
|
311
324
|
});
|
|
312
325
|
await onSubmit((0, _helpers__.removeNullishProps)({
|
|
313
326
|
vehicle,
|