thm-p3-configurator 0.0.400 → 0.0.401
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/public/assets/images/tm-logo-old.png +0 -0
- package/dist/public/assets/images/tm-logo.png +0 -0
- package/dist/src/shared/__api__/queries.js +6 -2
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +15 -4
- package/dist/src/shared/__constants__/index.js +6 -1
- package/dist/src/shared/__containers__/LicensePlateForm.js +11 -3
- package/dist/src/shared/__containers__/QuestionsForm.js +30 -21
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +23 -12
- package/dist/src/shared/__pages__/LicensePlatePage.js +2 -4
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -684,7 +684,7 @@ const useProductsQuery = exports.useProductsQuery = function useProductsQuery()
|
|
|
684
684
|
* @description Retrieves the order questions based on the provided license plate or brand/build-year/model
|
|
685
685
|
*/
|
|
686
686
|
const useQuestionsQuery = exports.useQuestionsQuery = function useQuestionsQuery() {
|
|
687
|
-
var _orderData$executionA2, _orderData$executionA4, _orderData$answers, _orderData$answers2, _orderData$answers3
|
|
687
|
+
var _orderError$response$, _orderError$response, _orderError$response$2, _orderError$response2, _orderData$executionA2, _orderData$executionA4, _orderData$answers, _orderData$answers2, _orderData$answers3;
|
|
688
688
|
let questionParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
689
689
|
const normalizedQuestionParams = (0, _queryKeyFactory.normalizeOrderParams)(questionParams);
|
|
690
690
|
const {
|
|
@@ -693,6 +693,8 @@ const useQuestionsQuery = exports.useQuestionsQuery = function useQuestionsQuery
|
|
|
693
693
|
isOrderError,
|
|
694
694
|
orderError
|
|
695
695
|
} = useOrderDataQuery(normalizedQuestionParams);
|
|
696
|
+
const questionsErrorCode = (_orderError$response$ = orderError === null || orderError === void 0 || (_orderError$response = orderError.response) === null || _orderError$response === void 0 || (_orderError$response = _orderError$response.data) === null || _orderError$response === void 0 ? void 0 : _orderError$response.code) !== null && _orderError$response$ !== void 0 ? _orderError$response$ : null;
|
|
697
|
+
const questionsErrorStatus = (_orderError$response$2 = orderError === null || orderError === void 0 || (_orderError$response2 = orderError.response) === null || _orderError$response2 === void 0 ? void 0 : _orderError$response2.status) !== null && _orderError$response$2 !== void 0 ? _orderError$response$2 : null;
|
|
696
698
|
const execution1AnswerOptions = (0, _react.useMemo)(() => {
|
|
697
699
|
var _orderData$executionA;
|
|
698
700
|
return (0, _helpers__.parseArrayToInputOptions)(orderData === null || orderData === void 0 || (_orderData$executionA = orderData.executionAnswerOptions) === null || _orderData$executionA === void 0 ? void 0 : _orderData$executionA.execution1AnswerOptions);
|
|
@@ -708,7 +710,9 @@ const useQuestionsQuery = exports.useQuestionsQuery = function useQuestionsQuery
|
|
|
708
710
|
execution1Answer: orderData === null || orderData === void 0 || (_orderData$answers = orderData.answers) === null || _orderData$answers === void 0 ? void 0 : _orderData$answers.execution1,
|
|
709
711
|
execution2Answer: orderData === null || orderData === void 0 || (_orderData$answers2 = orderData.answers) === null || _orderData$answers2 === void 0 ? void 0 : _orderData$answers2.execution2,
|
|
710
712
|
durationAnswer: orderData === null || orderData === void 0 || (_orderData$answers3 = orderData.answers) === null || _orderData$answers3 === void 0 ? void 0 : _orderData$answers3.duration,
|
|
711
|
-
questionsError:
|
|
713
|
+
questionsError: questionsErrorCode || orderError,
|
|
714
|
+
questionsErrorCode,
|
|
715
|
+
questionsErrorStatus,
|
|
712
716
|
execution1AnswerOptions,
|
|
713
717
|
execution2AnswerOptions,
|
|
714
718
|
durationQuestion
|
|
@@ -263,10 +263,15 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
263
263
|
const needsCustomerDeliveryIdentity = isDirectDeliveryEnabled;
|
|
264
264
|
const isNetherlandsSelected = (0, _react.useMemo)(() => {
|
|
265
265
|
if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
|
|
266
|
-
return selectedCountry.label.toUpperCase() ===
|
|
266
|
+
return selectedCountry.label.toUpperCase() === _constants__.COUNTRY_NAMES.NETHERLANDS;
|
|
267
267
|
}, [selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.label]);
|
|
268
|
-
const
|
|
269
|
-
|
|
268
|
+
const isBelgiumSelected = (0, _react.useMemo)(() => {
|
|
269
|
+
if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
|
|
270
|
+
const normalizedCountryLabel = selectedCountry.label.trim().toUpperCase();
|
|
271
|
+
return normalizedCountryLabel === _constants__.COUNTRY_NAMES.BELGIUM || normalizedCountryLabel === _constants__.COUNTRY_NAMES.BELGIUM_FALLBACK;
|
|
272
|
+
}, [selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.label]);
|
|
273
|
+
const shouldRequireKvkNumber = needsCustomerDeliveryIdentity && isBusinessOwnership && (isNetherlandsSelected || !isNetherlandsSelected && !isBelgiumSelected && !(customer !== null && customer !== void 0 && (_customer$vatNumber = customer.vatNumber) !== null && _customer$vatNumber !== void 0 && _customer$vatNumber.trim()));
|
|
274
|
+
const shouldRequireVatNumber = needsCustomerDeliveryIdentity && isBusinessOwnership && (isBelgiumSelected || !isNetherlandsSelected && !isBelgiumSelected && !(customer !== null && customer !== void 0 && (_customer$kvkNumber = customer.kvkNumber) !== null && _customer$kvkNumber !== void 0 && _customer$kvkNumber.trim()));
|
|
270
275
|
|
|
271
276
|
// Helper to update customer data for the active ownership type
|
|
272
277
|
const updateCustomerField = (0, _react.useCallback)((field, value) => {
|
|
@@ -526,7 +531,13 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
526
531
|
});
|
|
527
532
|
return false;
|
|
528
533
|
}
|
|
529
|
-
if (
|
|
534
|
+
if (isBelgiumSelected && !hasVatNumber) {
|
|
535
|
+
onValidationError === null || onValidationError === void 0 || onValidationError({
|
|
536
|
+
vatNumber: 'BTW-nummer is verplicht voor zakelijke dossiers in België'
|
|
537
|
+
});
|
|
538
|
+
return false;
|
|
539
|
+
}
|
|
540
|
+
if (!isNetherlandsSelected && !isBelgiumSelected && !hasKvkNumber && !hasVatNumber) {
|
|
530
541
|
onValidationError === null || onValidationError === void 0 || onValidationError({
|
|
531
542
|
kvkNumber: 'Vul een KVK- of BTW-nummer in',
|
|
532
543
|
vatNumber: 'Vul een KVK- of BTW-nummer in'
|
|
@@ -6,7 +6,7 @@ require("core-js/modules/es.string.trim.js");
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.mapBranchFormulaToConfiguratorFormula = exports.isThcFamilyFormula = exports.getThemeFormulaForConfiguratorFormula = exports.getConfiguratorFormulaCode = exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_CODING_SUBGROUP_NAME = exports.USER_GEOLOCATION_KEY = exports.TOWMOTIVE_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.STATUS_ASSESSMENT = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.PARTNER_PORTAL_PAGE_TITLES_BY_THEME = exports.PARTNER_PORTAL_CHANNEL_TITLE = exports.ORDER_SESSION_KEY = exports.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.LEASE_TYPE_ID = exports.FORM_ERROR_MESSAGES = exports.EXECUTION_HELP_CONTACT_DETAILS_BY_FORMULA = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.DAY_NAMES = exports.CONFIGURATOR_FORMULAS = exports.BRANCH_THEME_BY_FORMULA = exports.BRANCH_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.ApiStockStatus = exports.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
|
|
9
|
+
exports.mapBranchFormulaToConfiguratorFormula = exports.isThcFamilyFormula = exports.getThemeFormulaForConfiguratorFormula = exports.getConfiguratorFormulaCode = exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_CODING_SUBGROUP_NAME = exports.USER_GEOLOCATION_KEY = exports.TOWMOTIVE_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = exports.StockStatus = exports.STATUS_ASSESSMENT = exports.PRODUCT_CATEGORIES = exports.PRIVATE_SINGLE_ORDER_SESSION_KEY = exports.PARTNER_PORTAL_PAGE_TITLES_BY_THEME = exports.PARTNER_PORTAL_CHANNEL_TITLE = exports.ORDER_SESSION_KEY = exports.NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NAVIGATION_STEPS_INTERNAL = exports.NAVIGATION_STEPS_EXTERNAL = exports.NAVIGATION_BUTTONS = exports.MOUSE_EXIT_INTENT_THROTTLE = exports.MOUSE_EXIT_INTENT_OFFSET = exports.LOCATION_TYPE = exports.LOCATION_CHANGE_BUTTON_LABEL = exports.LOCALE = exports.LEASE_TYPE_ID = exports.FORM_ERROR_MESSAGES = exports.EXECUTION_HELP_CONTACT_DETAILS_BY_FORMULA = exports.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.DAY_NAMES = exports.COUNTRY_NAMES = exports.CONFIGURATOR_FORMULAS = exports.BRANCH_THEME_BY_FORMULA = exports.BRANCH_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.ApiStockStatus = exports.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
|
|
10
10
|
require("core-js/modules/es.array.includes.js");
|
|
11
11
|
require("core-js/modules/es.string.includes.js");
|
|
12
12
|
require("core-js/modules/es.string.trim.js");
|
|
@@ -27,6 +27,11 @@ const FORM_ERROR_MESSAGES = exports.FORM_ERROR_MESSAGES = {
|
|
|
27
27
|
licensePlateMin: 'Kenteken moet minimaal 6 characters bevatten',
|
|
28
28
|
licensePlateMax: 'Kenteken mag maximaal 8 characters bevatten'
|
|
29
29
|
};
|
|
30
|
+
const COUNTRY_NAMES = exports.COUNTRY_NAMES = {
|
|
31
|
+
NETHERLANDS: 'NEDERLAND',
|
|
32
|
+
BELGIUM: 'BELGIË',
|
|
33
|
+
BELGIUM_FALLBACK: 'BELGIE'
|
|
34
|
+
};
|
|
30
35
|
const BRANCH_FORMULAS = exports.BRANCH_FORMULAS = {
|
|
31
36
|
Trekhaakcentrum: 'Trekhaakcentrum',
|
|
32
37
|
TowMotiveGroup: 'TowMotive Group',
|
|
@@ -58,6 +58,12 @@ function _interopRequireWildcard(e, r) {
|
|
|
58
58
|
return n.default = e, t && t.set(e, n), n;
|
|
59
59
|
}
|
|
60
60
|
const licensePlateValidator = new _LicensePlateValidator.default();
|
|
61
|
+
const isValidLicensePlate = function isValidLicensePlate() {
|
|
62
|
+
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
63
|
+
const normalizedValue = String(value !== null && value !== void 0 ? value : '');
|
|
64
|
+
const stripped = normalizedValue.replace(/-/g, '').toUpperCase();
|
|
65
|
+
return stripped.length === 6 && licensePlateValidator.getSideCode(stripped) > 0;
|
|
66
|
+
};
|
|
61
67
|
const LicensePlateForm = _ref => {
|
|
62
68
|
var _ref2;
|
|
63
69
|
let {
|
|
@@ -109,8 +115,7 @@ const LicensePlateForm = _ref => {
|
|
|
109
115
|
action: 'submit',
|
|
110
116
|
action_value: buttonLabel
|
|
111
117
|
});
|
|
112
|
-
const
|
|
113
|
-
const isValid = stripped.length === 6 && licensePlateValidator.getSideCode(stripped) > 0;
|
|
118
|
+
const isValid = isValidLicensePlate(plate !== null && plate !== void 0 ? plate : '');
|
|
114
119
|
(0, _Datalayer.pushToDataLayer)({
|
|
115
120
|
event: 'configurator',
|
|
116
121
|
component: trackingComponent,
|
|
@@ -119,6 +124,9 @@ const LicensePlateForm = _ref => {
|
|
|
119
124
|
action: 'submit',
|
|
120
125
|
action_value: isValid ? 'valid' : 'invalid - Uw kenteken staat (nog) niet in onze database. Kies uw voertuig via de merk/model selectie.'
|
|
121
126
|
});
|
|
127
|
+
if (!isValid) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
122
130
|
onSubmit(isFilter ? overridePlate : undefined);
|
|
123
131
|
};
|
|
124
132
|
const handleLicensePlateChange = value => {
|
|
@@ -162,7 +170,7 @@ const LicensePlateForm = _ref => {
|
|
|
162
170
|
onClick: () => {
|
|
163
171
|
handleSubmitWithTracking(isFilter ? filterLicensePlate : undefined);
|
|
164
172
|
},
|
|
165
|
-
isDisabled: !isFilter ?
|
|
173
|
+
isDisabled: !isValidLicensePlate(isFilter ? filterLicensePlate : licensePlate),
|
|
166
174
|
label: isFilter ? 'Filteren' : 'Volgende'
|
|
167
175
|
})))));
|
|
168
176
|
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.
|
|
4
|
-
require("core-js/modules/es.
|
|
5
|
-
require("core-js/modules/es.string.search.js");
|
|
3
|
+
require("core-js/modules/es.array.includes.js");
|
|
4
|
+
require("core-js/modules/es.string.includes.js");
|
|
6
5
|
require("core-js/modules/es.weak-map.js");
|
|
7
6
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
8
7
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
9
8
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
10
9
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
-
require("core-js/modules/web.url-search-params.js");
|
|
12
10
|
require("core-js/modules/es.weak-map.js");
|
|
13
11
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
14
12
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
@@ -17,11 +15,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
17
15
|
value: true
|
|
18
16
|
});
|
|
19
17
|
exports.default = void 0;
|
|
20
|
-
require("core-js/modules/es.
|
|
21
|
-
require("core-js/modules/es.
|
|
22
|
-
require("core-js/modules/es.string.search.js");
|
|
18
|
+
require("core-js/modules/es.array.includes.js");
|
|
19
|
+
require("core-js/modules/es.string.includes.js");
|
|
23
20
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
24
|
-
require("core-js/modules/web.url-search-params.js");
|
|
25
21
|
var _react = _interopRequireWildcard(require("react"));
|
|
26
22
|
var _reactRouter = require("react-router");
|
|
27
23
|
var _queries = require("../__api__/queries");
|
|
@@ -163,14 +159,6 @@ const QuestionsForm = _ref => {
|
|
|
163
159
|
formula = singleOrderFormulaCode;
|
|
164
160
|
}
|
|
165
161
|
const history = (0, _reactRouter.useHistory)();
|
|
166
|
-
const {
|
|
167
|
-
search
|
|
168
|
-
} = (0, _reactRouter.useLocation)();
|
|
169
|
-
const notFoundRedirectTarget = (0, _react.useMemo)(() => {
|
|
170
|
-
const searchParams = new URLSearchParams(search);
|
|
171
|
-
searchParams.set('notFound', 'true');
|
|
172
|
-
return "/configurator".concat(searchParams.size ? "?".concat(searchParams.toString()) : '');
|
|
173
|
-
}, [search]);
|
|
174
162
|
|
|
175
163
|
// Create a modified version of execution answers for the query
|
|
176
164
|
// Only include both execution answers if both are provided
|
|
@@ -209,6 +197,8 @@ const QuestionsForm = _ref => {
|
|
|
209
197
|
execution2AnswerOptions,
|
|
210
198
|
durationAnswer: durationAnswerPrefilled,
|
|
211
199
|
questionsError,
|
|
200
|
+
questionsErrorCode,
|
|
201
|
+
questionsErrorStatus,
|
|
212
202
|
durationQuestion
|
|
213
203
|
} = questionsObject;
|
|
214
204
|
|
|
@@ -278,6 +268,9 @@ const QuestionsForm = _ref => {
|
|
|
278
268
|
type: _OrderSessionContext.orderSessionActions.CLEAR_ANSWERS
|
|
279
269
|
});
|
|
280
270
|
if (isFilter) {
|
|
271
|
+
if (questionsError) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
281
274
|
if (!initialModel) {
|
|
282
275
|
onSubmit({
|
|
283
276
|
type: 'licensePlate',
|
|
@@ -293,16 +286,14 @@ const QuestionsForm = _ref => {
|
|
|
293
286
|
}
|
|
294
287
|
return;
|
|
295
288
|
} else {
|
|
296
|
-
if (questionsError) {
|
|
297
|
-
onPrev(1);
|
|
298
|
-
} else {
|
|
289
|
+
if (!questionsError) {
|
|
299
290
|
history.push('/configurator/trekhaakpakket');
|
|
300
291
|
}
|
|
301
292
|
}
|
|
302
293
|
}
|
|
303
294
|
}
|
|
304
295
|
}, [isLoadingQuestions, durationOptions, execution1Options, execution2Options, execution2AnswerOptions, execution1AnswerOptions, durationQuestion, isFilter, questionsError]);
|
|
305
|
-
const isNotFoundQuestionError =
|
|
296
|
+
const isNotFoundQuestionError = questionsErrorCode === _constants__.API_ERROR_CODES.notFound || questionsErrorCode === _constants__.API_ERROR_CODES.notFoundAldoc || questionsErrorStatus === 404 || typeof questionsErrorCode === 'string' && questionsErrorCode.includes('NOT_FOUND');
|
|
306
297
|
const isWaitingForInternalSessionContext = APP_CONFIG.internal && initialized && authenticated && !isSessionContextReady;
|
|
307
298
|
const handlePrev = () => {
|
|
308
299
|
(0, _Datalayer.pushToDataLayer)({
|
|
@@ -333,8 +324,26 @@ const QuestionsForm = _ref => {
|
|
|
333
324
|
}));
|
|
334
325
|
}
|
|
335
326
|
if (isNotFoundQuestionError) {
|
|
327
|
+
if (isFilter) {
|
|
328
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
329
|
+
className: (0, _helpers__.withStyle)('card-body')
|
|
330
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
331
|
+
className: (0, _helpers__.withStyle)('alert alert-danger mb-3')
|
|
332
|
+
}, /*#__PURE__*/_react.default.createElement("small", null, "Het opgegeven kenteken kon niet worden gevonden. Probeer een ander kenteken of zoek via merk.")), /*#__PURE__*/_react.default.createElement("div", {
|
|
333
|
+
className: (0, _helpers__.withStyle)('row align-items-center justify-content-end')
|
|
334
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
335
|
+
className: (0, _helpers__.withStyle)("col col-sm-auto mt-1")
|
|
336
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
337
|
+
className: (0, _helpers__.withStyle)('d-grid gap-2')
|
|
338
|
+
}, /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
|
|
339
|
+
type: "button",
|
|
340
|
+
isDisabled: false,
|
|
341
|
+
onClick: handlePrev,
|
|
342
|
+
label: 'Ga terug'
|
|
343
|
+
})))));
|
|
344
|
+
}
|
|
336
345
|
return /*#__PURE__*/_react.default.createElement(_reactRouter.Redirect, {
|
|
337
|
-
to:
|
|
346
|
+
to: "/configurator/geen-producten"
|
|
338
347
|
});
|
|
339
348
|
}
|
|
340
349
|
if (questionsError) {
|
|
@@ -217,7 +217,7 @@ const getBranchCity = function getBranchCity() {
|
|
|
217
217
|
return (branch === null || branch === void 0 ? void 0 : branch.city) || (branch === null || branch === void 0 ? void 0 : branch.gemeente) || '';
|
|
218
218
|
};
|
|
219
219
|
const InternalAppointmentForm = _ref => {
|
|
220
|
-
var _branchTypes$byId$aut, _authSession$branch, _authSession$branch2, _contextCustomer$note2;
|
|
220
|
+
var _branchTypes$byId$aut, _authSession$branch, _customer$vatNumber, _customer$kvkNumber, _authSession$branch2, _contextCustomer$note2;
|
|
221
221
|
let {
|
|
222
222
|
onSubmit = payload => {},
|
|
223
223
|
isError = false,
|
|
@@ -456,10 +456,15 @@ const InternalAppointmentForm = _ref => {
|
|
|
456
456
|
const isLeaseOwnership = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij;
|
|
457
457
|
const isNetherlandsSelected = (0, _react.useMemo)(() => {
|
|
458
458
|
if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
|
|
459
|
-
return selectedCountry.label.toUpperCase() ===
|
|
459
|
+
return selectedCountry.label.toUpperCase() === _constants__.COUNTRY_NAMES.NETHERLANDS;
|
|
460
460
|
}, [selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.label]);
|
|
461
|
-
const
|
|
462
|
-
|
|
461
|
+
const isBelgiumSelected = (0, _react.useMemo)(() => {
|
|
462
|
+
if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
|
|
463
|
+
const normalizedCountryLabel = selectedCountry.label.trim().toUpperCase();
|
|
464
|
+
return normalizedCountryLabel === _constants__.COUNTRY_NAMES.BELGIUM || normalizedCountryLabel === _constants__.COUNTRY_NAMES.BELGIUM_FALLBACK;
|
|
465
|
+
}, [selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.label]);
|
|
466
|
+
const shouldRequireKvkNumber = isBusinessOwnership && (isNetherlandsSelected || !isNetherlandsSelected && !isBelgiumSelected && !(customer !== null && customer !== void 0 && (_customer$vatNumber = customer.vatNumber) !== null && _customer$vatNumber !== void 0 && _customer$vatNumber.trim()));
|
|
467
|
+
const shouldRequireVatNumber = isBusinessOwnership && (isBelgiumSelected || !isNetherlandsSelected && !isBelgiumSelected && !(customer !== null && customer !== void 0 && (_customer$kvkNumber = customer.kvkNumber) !== null && _customer$kvkNumber !== void 0 && _customer$kvkNumber.trim()));
|
|
463
468
|
const {
|
|
464
469
|
branchById
|
|
465
470
|
} = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
|
|
@@ -502,7 +507,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
502
507
|
const handleSubmit = async function handleSubmit() {
|
|
503
508
|
let appointmentType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _constants__.DOSSIER_TYPES.PlannedAppointment;
|
|
504
509
|
try {
|
|
505
|
-
var _customer$
|
|
510
|
+
var _customer$kvkNumber2, _customer$vatNumber2, _customer$firstName, _customer$lastName, _customer$phoneNumber, _customer$houseNumber, _customer$houseNumber2, _customer$streetName, _customer$countryId, _customer$city, _customer$email, _ref3, _contextCustomer$anwb, _contextCustomer$note, _customer$zipCode, _customer$companyName, _customer$kvkNumber3, _customer$vatNumber3, _ref4, _vehicle$leaseNumber, _vehicle$leaseNumberU, _customer$companyName2, _customer$kvkNumber4, _customer$vatNumber4;
|
|
506
511
|
setErrors({});
|
|
507
512
|
if (!model) {
|
|
508
513
|
// Note: this does not throw on error.
|
|
@@ -524,8 +529,8 @@ const InternalAppointmentForm = _ref => {
|
|
|
524
529
|
return;
|
|
525
530
|
}
|
|
526
531
|
}
|
|
527
|
-
const hasKvkNumber = !!(customer !== null && customer !== void 0 && (_customer$
|
|
528
|
-
const hasVatNumber = !!(customer !== null && customer !== void 0 && (_customer$
|
|
532
|
+
const hasKvkNumber = !!(customer !== null && customer !== void 0 && (_customer$kvkNumber2 = customer.kvkNumber) !== null && _customer$kvkNumber2 !== void 0 && _customer$kvkNumber2.trim());
|
|
533
|
+
const hasVatNumber = !!(customer !== null && customer !== void 0 && (_customer$vatNumber2 = customer.vatNumber) !== null && _customer$vatNumber2 !== void 0 && _customer$vatNumber2.trim());
|
|
529
534
|
if (isBusinessOwnership) {
|
|
530
535
|
if (isNetherlandsSelected && !hasKvkNumber) {
|
|
531
536
|
setErrors({
|
|
@@ -533,7 +538,13 @@ const InternalAppointmentForm = _ref => {
|
|
|
533
538
|
});
|
|
534
539
|
return;
|
|
535
540
|
}
|
|
536
|
-
if (
|
|
541
|
+
if (isBelgiumSelected && !hasVatNumber) {
|
|
542
|
+
setErrors({
|
|
543
|
+
vatNumber: 'BTW-nummer is verplicht voor zakelijke dossiers in België'
|
|
544
|
+
});
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (!isNetherlandsSelected && !isBelgiumSelected && !hasKvkNumber && !hasVatNumber) {
|
|
537
548
|
setErrors({
|
|
538
549
|
kvkNumber: 'Vul een KVK- of BTW-nummer in',
|
|
539
550
|
vatNumber: 'Vul een KVK- of BTW-nummer in'
|
|
@@ -577,8 +588,8 @@ const InternalAppointmentForm = _ref => {
|
|
|
577
588
|
note: (_contextCustomer$note = contextCustomer === null || contextCustomer === void 0 ? void 0 : contextCustomer.note) !== null && _contextCustomer$note !== void 0 ? _contextCustomer$note : undefined,
|
|
578
589
|
zipCode: (_customer$zipCode = customer === null || customer === void 0 ? void 0 : customer.zipCode) !== null && _customer$zipCode !== void 0 ? _customer$zipCode : undefined,
|
|
579
590
|
companyName: activeOwnershipType !== _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? (_customer$companyName = customer === null || customer === void 0 ? void 0 : customer.companyName) !== null && _customer$companyName !== void 0 ? _customer$companyName : undefined : undefined,
|
|
580
|
-
kvkNumber: (_customer$
|
|
581
|
-
vatNumber: (_customer$
|
|
591
|
+
kvkNumber: (_customer$kvkNumber3 = customer === null || customer === void 0 ? void 0 : customer.kvkNumber) !== null && _customer$kvkNumber3 !== void 0 ? _customer$kvkNumber3 : undefined,
|
|
592
|
+
vatNumber: (_customer$vatNumber3 = customer === null || customer === void 0 ? void 0 : customer.vatNumber) !== null && _customer$vatNumber3 !== void 0 ? _customer$vatNumber3 : undefined
|
|
582
593
|
})),
|
|
583
594
|
customerAgreed,
|
|
584
595
|
appointment,
|
|
@@ -630,8 +641,8 @@ const InternalAppointmentForm = _ref => {
|
|
|
630
641
|
});
|
|
631
642
|
payload.customer = _objectSpread(_objectSpread({}, payload.customer || {}), {}, {
|
|
632
643
|
companyName: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$companyName2 = customer === null || customer === void 0 ? void 0 : customer.companyName) !== null && _customer$companyName2 !== void 0 ? _customer$companyName2 : '' : '',
|
|
633
|
-
kvkNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$
|
|
634
|
-
vatNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$
|
|
644
|
+
kvkNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$kvkNumber4 = customer === null || customer === void 0 ? void 0 : customer.kvkNumber) !== null && _customer$kvkNumber4 !== void 0 ? _customer$kvkNumber4 : '' : '',
|
|
645
|
+
vatNumber: activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Zakelijk ? (_customer$vatNumber4 = customer === null || customer === void 0 ? void 0 : customer.vatNumber) !== null && _customer$vatNumber4 !== void 0 ? _customer$vatNumber4 : '' : ''
|
|
635
646
|
});
|
|
636
647
|
if (existingDossierId && appointmentType === _constants__.DOSSIER_TYPES.PlannedAppointment && typeof invoicePaymentByLeaseCompany === 'boolean') {
|
|
637
648
|
payload.invoicePaymentByLeaseCompany = activeOwnershipType === _constants__.VEHICLE_OWNERSHIP_TYPE.Leasemaatschappij ? invoicePaymentByLeaseCompany : false;
|
|
@@ -77,7 +77,7 @@ const LicensePlatePage = () => {
|
|
|
77
77
|
const [activeStep, setActiveStep] = (0, _react.useState)(0);
|
|
78
78
|
const [, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
79
79
|
const themeClass = (0, _helpers__.getConfiguratorThemeClass)((0, _useBranchTheme.useBranchTheme)());
|
|
80
|
-
const [licensePlateURL, widgetOrEntityId, discountCode, franchiseName,
|
|
80
|
+
const [licensePlateURL, widgetOrEntityId, discountCode, franchiseName, vestigingRecId] = (0, _useSearchParam.default)(['licensePlate', 'branch', 'discountCode', 'naamKeten', 'vestigingRecId']);
|
|
81
81
|
const branchIdOrVestigingRecId = widgetOrEntityId || vestigingRecId;
|
|
82
82
|
const {
|
|
83
83
|
branchById,
|
|
@@ -173,9 +173,7 @@ const LicensePlatePage = () => {
|
|
|
173
173
|
isCentered: true,
|
|
174
174
|
isScrollable: true,
|
|
175
175
|
title: 'Wij zoeken naar de beste oplossing'
|
|
176
|
-
}, branchIdOrVestigingRecId && isLoadingBranchById && /*#__PURE__*/_react.default.createElement(_TextSpinner.default, null),
|
|
177
|
-
className: (0, _helpers__.withStyle)('alert alert-danger mb-3')
|
|
178
|
-
}, /*#__PURE__*/_react.default.createElement("small", null, "Het opgegeven kenteken kon niet worden gevonden. Probeer een ander kenteken of zoek via merk.")), Steps[activeStep], /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
+
}, branchIdOrVestigingRecId && isLoadingBranchById && /*#__PURE__*/_react.default.createElement(_TextSpinner.default, null), Steps[activeStep], /*#__PURE__*/_react.default.createElement("div", {
|
|
179
177
|
className: (0, _helpers__.withStyle)('align-items-center justify-content-center text-center mt-2')
|
|
180
178
|
}, /*#__PURE__*/_react.default.createElement(_FormSteps.default, {
|
|
181
179
|
count: Steps.length,
|