thm-p3-configurator 0.0.433 → 0.0.435
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__/mutations.js +4 -2
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +15 -3
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +2 -1
- package/dist/src/shared/__pages__/internal/InternalQuotationPage.js +7 -2
- package/package.json +1 -1
|
@@ -400,7 +400,8 @@ const useCreatePrivateQuotationMutation = () => {
|
|
|
400
400
|
isCreateQuotationSuccess: createQuotationMutation.isSuccess,
|
|
401
401
|
resetQuotationCreation: createQuotationMutation.reset,
|
|
402
402
|
createQuotation: createQuotationMutation.mutateAsync,
|
|
403
|
-
data: createQuotationMutation.data
|
|
403
|
+
data: createQuotationMutation.data,
|
|
404
|
+
createQuotationError: createQuotationMutation.error
|
|
404
405
|
};
|
|
405
406
|
};
|
|
406
407
|
|
|
@@ -774,7 +775,8 @@ const useUpdatePrivateQuotationByIdMutation = id => {
|
|
|
774
775
|
isUpdateQuotationSuccess: updateQuotationMutation.isSuccess,
|
|
775
776
|
resetQuotationUpdate: updateQuotationMutation.reset,
|
|
776
777
|
updateQuotation: updateQuotationMutation.mutateAsync,
|
|
777
|
-
data: updateQuotationMutation.data
|
|
778
|
+
data: updateQuotationMutation.data,
|
|
779
|
+
updateQuotationError: updateQuotationMutation.error
|
|
778
780
|
};
|
|
779
781
|
};
|
|
780
782
|
|
|
@@ -159,8 +159,19 @@ const internalAppointmentFormSchema = (0, _yup.object)({
|
|
|
159
159
|
streetName: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
160
160
|
city: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
161
161
|
countryId: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
// Note: a planned appointment cannot exist without a moment. Without this the
|
|
163
|
+
// API rejects the dossier with `"body.scheduledDateTime" is required`, which
|
|
164
|
+
// reads as a random failure to the user. An appointment *request* has no date yet.
|
|
165
|
+
date: (0, _yup.string)().when('$isPlannedAppointment', {
|
|
166
|
+
is: true,
|
|
167
|
+
then: schema => schema.required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
168
|
+
otherwise: schema => schema.nullable()
|
|
169
|
+
}),
|
|
170
|
+
time: (0, _yup.string)().when('$isPlannedAppointment', {
|
|
171
|
+
is: true,
|
|
172
|
+
then: schema => schema.required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
173
|
+
otherwise: schema => schema.nullable()
|
|
174
|
+
}),
|
|
164
175
|
customerAgreed: (0, _yup.boolean)().required(_constants__.FORM_ERROR_MESSAGES.required).isTrue(_constants__.FORM_ERROR_MESSAGES.required),
|
|
165
176
|
companyName: (0, _yup.string)().when('ownershipType', {
|
|
166
177
|
is: _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk,
|
|
@@ -629,7 +640,8 @@ const InternalAppointmentForm = _ref => {
|
|
|
629
640
|
abortEarly: false,
|
|
630
641
|
context: {
|
|
631
642
|
existingDossierId: existingDossierId,
|
|
632
|
-
isTmg: isTmg
|
|
643
|
+
isTmg: isTmg,
|
|
644
|
+
isPlannedAppointment: appointmentType === _constants__.DOSSIER_TYPES.PlannedAppointment
|
|
633
645
|
}
|
|
634
646
|
});
|
|
635
647
|
const payload = (0, _helpers__.removeNullishProps)(_objectSpread(_objectSpread({
|
|
@@ -209,6 +209,7 @@ const InternalQuotationForm = _ref => {
|
|
|
209
209
|
let {
|
|
210
210
|
onSubmit = payload => {},
|
|
211
211
|
isError = false,
|
|
212
|
+
submitErrorMessage = '',
|
|
212
213
|
isSuccess = false,
|
|
213
214
|
isLoading = false,
|
|
214
215
|
entityId = null
|
|
@@ -1031,7 +1032,7 @@ const InternalQuotationForm = _ref => {
|
|
|
1031
1032
|
}, "Geen opties gevonden..."))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
1032
1033
|
className: (0, _helpers__.withStyle)('col-12')
|
|
1033
1034
|
}, isError && /*#__PURE__*/_react.default.createElement(_ErrorMessage.default, {
|
|
1034
|
-
message: 'Er is een fout opgetreden bij het maken van de offerte, probeer het opnieuw.'
|
|
1035
|
+
message: submitErrorMessage || 'Er is een fout opgetreden bij het maken van de offerte, probeer het opnieuw.'
|
|
1035
1036
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
1036
1037
|
className: (0, _helpers__.withStyle)('d-flex align-items-center justify-content-end mt-4')
|
|
1037
1038
|
}, /*#__PURE__*/_react.default.createElement(_NavigationButton.default, {
|
|
@@ -107,6 +107,7 @@ function _toPrimitive(t, r) {
|
|
|
107
107
|
}
|
|
108
108
|
return ("string" === r ? String : Number)(t);
|
|
109
109
|
}
|
|
110
|
+
const QUOTATION_SUBMIT_ERROR_FALLBACK = 'Er is een fout opgetreden bij het maken van de offerte, probeer het opnieuw.';
|
|
110
111
|
const InternalQuotationPage = () => {
|
|
111
112
|
const themeClass = (0, _helpers__.getConfiguratorThemeClass)((0, _useBranchTheme.useBranchTheme)());
|
|
112
113
|
const [{
|
|
@@ -138,15 +139,18 @@ const InternalQuotationPage = () => {
|
|
|
138
139
|
isCreateQuotationSuccess,
|
|
139
140
|
isCreateQuotationError,
|
|
140
141
|
isCreatingQuotation,
|
|
141
|
-
data: createQuotationData
|
|
142
|
+
data: createQuotationData,
|
|
143
|
+
createQuotationError
|
|
142
144
|
} = (0, _mutations.useCreatePrivateQuotationMutation)();
|
|
143
145
|
const {
|
|
144
146
|
updateQuotation,
|
|
145
147
|
isUpdateQuotationError,
|
|
146
148
|
isUpdateQuotationSuccess,
|
|
147
149
|
isUpdatingQuotation,
|
|
148
|
-
data: updateQuotationData
|
|
150
|
+
data: updateQuotationData,
|
|
151
|
+
updateQuotationError
|
|
149
152
|
} = (0, _mutations.useUpdatePrivateQuotationByIdMutation)(existingDossierId);
|
|
153
|
+
const submitErrorMessage = (0, _react.useMemo)(() => (0, _helpers__.getProxyApiErrorMessage)(createQuotationError || updateQuotationError, QUOTATION_SUBMIT_ERROR_FALLBACK), [createQuotationError, updateQuotationError]);
|
|
150
154
|
const performSubmit = async payload => {
|
|
151
155
|
var _response$data2;
|
|
152
156
|
if (existingDossierId) {
|
|
@@ -228,6 +232,7 @@ const InternalQuotationPage = () => {
|
|
|
228
232
|
className: (0, _helpers__.withStyle)('col-12 px-0 col-xl-6')
|
|
229
233
|
}, /*#__PURE__*/_react.default.createElement(_InternalQuotationForm.default, {
|
|
230
234
|
onSubmit: handleSubmit,
|
|
235
|
+
submitErrorMessage: submitErrorMessage,
|
|
231
236
|
isError: isCreateQuotationError || isUpdateQuotationError,
|
|
232
237
|
isLoading: isUpdatingQuotation || isCreatingQuotation || isCheckingEmail,
|
|
233
238
|
isSuccess: isCreateQuotationSuccess || isUpdateQuotationSuccess,
|