thm-p3-configurator 0.0.367 → 0.0.369
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/__components__/NavigationSteps.js +7 -5
- package/dist/src/shared/__components__/ProductCard/index.js +58 -5
- package/dist/src/shared/__components__/SingleOrderProductCard.js +100 -17
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +52 -10
- package/dist/src/shared/__containers__/AppointmentForm.js +85 -31
- package/dist/src/shared/__containers__/ExitIntentModal.js +71 -14
- package/dist/src/shared/__containers__/ExtraProductsOverview.js +2 -2
- package/dist/src/shared/__containers__/ProductsOverview.js +2 -2
- package/dist/src/shared/__containers__/QuestionsForm.js +9 -1
- package/dist/src/shared/__containers__/QuotationForm.js +85 -31
- package/dist/src/shared/__containers__/internal/InternalBranchSelectorModal.js +1 -0
- package/dist/src/shared/__context__/OrderSessionContext.js +20 -9
- package/dist/src/shared/__helpers__/singleOrderArticles.js +15 -22
- package/dist/src/shared/__pages__/LicensePlatePage.js +2 -2
- package/dist/src/shared/__pages__/ManualSelectionPage.js +2 -2
- package/package.json +1 -1
- package/dist/src/shared/__components__/Spinners/InlineSpinner.js +0 -26
- package/dist/src/shared/__components__/Spinners/TextSpinner.js +0 -31
- package/dist/src/shared/__components__/UspsList.js +0 -27
|
@@ -59,24 +59,26 @@ const NavigationSteps = _ref => {
|
|
|
59
59
|
selectedBranch
|
|
60
60
|
}] = (0, _OrderSessionContext.useOrderSession)();
|
|
61
61
|
const handleClick = _ref2 => {
|
|
62
|
+
var _steps$stepNumber;
|
|
62
63
|
let {
|
|
63
64
|
to,
|
|
64
65
|
title,
|
|
65
|
-
stepNumber
|
|
66
|
+
stepNumber: targetStepNumber
|
|
66
67
|
} = _ref2;
|
|
67
|
-
|
|
68
|
+
const currentStepTitle = ((_steps$stepNumber = steps[stepNumber]) === null || _steps$stepNumber === void 0 ? void 0 : _steps$stepNumber.title) || title;
|
|
68
69
|
(0, _Datalayer.pushToDataLayer)({
|
|
69
70
|
event: 'configurator',
|
|
70
|
-
component:
|
|
71
|
+
component: currentStepTitle,
|
|
71
72
|
element: 'progress_bar',
|
|
72
73
|
action: 'click',
|
|
73
|
-
action_value:
|
|
74
|
+
action_value: title,
|
|
74
75
|
link_url: to
|
|
75
76
|
});
|
|
77
|
+
setStepNumber(targetStepNumber);
|
|
76
78
|
onClick({
|
|
77
79
|
to,
|
|
78
80
|
title,
|
|
79
|
-
stepNumber
|
|
81
|
+
stepNumber: targetStepNumber
|
|
80
82
|
});
|
|
81
83
|
};
|
|
82
84
|
const currentType = currentDossierType || existingDossierType || _constants__.DOSSIER_TYPES.PlannedAppointment;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.weak-map.js");
|
|
4
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
5
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
6
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
4
7
|
require("core-js/modules/esnext.iterator.map.js");
|
|
5
8
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
6
9
|
require("core-js/modules/es.weak-map.js");
|
|
10
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
11
|
+
require("core-js/modules/esnext.iterator.filter.js");
|
|
12
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
7
13
|
Object.defineProperty(exports, "__esModule", {
|
|
8
14
|
value: true
|
|
9
15
|
});
|
|
@@ -14,6 +20,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
14
20
|
var _queries = require("../../__api__/queries");
|
|
15
21
|
var _constants__ = require("../../__constants__");
|
|
16
22
|
var _helpers__ = require("../../__helpers__");
|
|
23
|
+
var _singleOrderArticles = require("../../__helpers__/singleOrderArticles");
|
|
17
24
|
var _ProductCardCheckbox = _interopRequireDefault(require("./ProductCardCheckbox"));
|
|
18
25
|
var _ProductCardDescription = _interopRequireDefault(require("./ProductCardDescription"));
|
|
19
26
|
var _ProductCardDiscountAlert = _interopRequireDefault(require("./ProductCardDiscountAlert"));
|
|
@@ -52,8 +59,51 @@ function _interopRequireWildcard(e, r) {
|
|
|
52
59
|
}
|
|
53
60
|
return n.default = e, t && t.set(e, n), n;
|
|
54
61
|
}
|
|
62
|
+
function ownKeys(e, r) {
|
|
63
|
+
var t = Object.keys(e);
|
|
64
|
+
if (Object.getOwnPropertySymbols) {
|
|
65
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
66
|
+
r && (o = o.filter(function (r) {
|
|
67
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
68
|
+
})), t.push.apply(t, o);
|
|
69
|
+
}
|
|
70
|
+
return t;
|
|
71
|
+
}
|
|
72
|
+
function _objectSpread(e) {
|
|
73
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
74
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
75
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
76
|
+
_defineProperty(e, r, t[r]);
|
|
77
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
78
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return e;
|
|
82
|
+
}
|
|
83
|
+
function _defineProperty(e, r, t) {
|
|
84
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
85
|
+
value: t,
|
|
86
|
+
enumerable: !0,
|
|
87
|
+
configurable: !0,
|
|
88
|
+
writable: !0
|
|
89
|
+
}) : e[r] = t, e;
|
|
90
|
+
}
|
|
91
|
+
function _toPropertyKey(t) {
|
|
92
|
+
var i = _toPrimitive(t, "string");
|
|
93
|
+
return "symbol" == typeof i ? i : i + "";
|
|
94
|
+
}
|
|
95
|
+
function _toPrimitive(t, r) {
|
|
96
|
+
if ("object" != typeof t || !t) return t;
|
|
97
|
+
var e = t[Symbol.toPrimitive];
|
|
98
|
+
if (void 0 !== e) {
|
|
99
|
+
var i = e.call(t, r || "default");
|
|
100
|
+
if ("object" != typeof i) return i;
|
|
101
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
102
|
+
}
|
|
103
|
+
return ("string" === r ? String : Number)(t);
|
|
104
|
+
}
|
|
55
105
|
const ProductCard = _ref => {
|
|
56
|
-
var
|
|
106
|
+
var _normalizedStock$quan, _normalizedStock$quan2;
|
|
57
107
|
let {
|
|
58
108
|
hasCheckbox = true,
|
|
59
109
|
isRecommended = false,
|
|
@@ -82,6 +132,9 @@ const ProductCard = _ref => {
|
|
|
82
132
|
const {
|
|
83
133
|
productFieldLabels
|
|
84
134
|
} = (0, _queries.useProductFieldLabels)();
|
|
135
|
+
const normalizedStock = stock && stock.status ? _objectSpread(_objectSpread({}, stock), {}, {
|
|
136
|
+
status: (0, _singleOrderArticles.mapApiStockStatusToStockStatus)(stock.status)
|
|
137
|
+
}) : stock;
|
|
85
138
|
const handleSelected = isSelected => {
|
|
86
139
|
if (!canUnselect && !isSelected) {
|
|
87
140
|
// Do not update local state, only call onSelect
|
|
@@ -159,13 +212,13 @@ const ProductCard = _ref => {
|
|
|
159
212
|
className: (0, _helpers__.withStyle)('card-footer pt-2 col-12 col-md-8 col-xxl-6 pb-0 justify-content-end')
|
|
160
213
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
161
214
|
className: (0, _helpers__.withStyle)('d-flex flex-column align-items-end')
|
|
162
|
-
}, showPrice &&
|
|
215
|
+
}, showPrice && normalizedStock && /*#__PURE__*/_react.default.createElement("div", null, normalizedStock.status === _constants__.StockStatus.OutOfStock ? /*#__PURE__*/_react.default.createElement("div", {
|
|
163
216
|
className: (0, _helpers__.withStyle)('text-danger mb-1')
|
|
164
|
-
}, "Niet op voorraad") :
|
|
217
|
+
}, "Niet op voorraad") : normalizedStock.status === _constants__.StockStatus.InsufficientStock ? /*#__PURE__*/_react.default.createElement("div", {
|
|
165
218
|
className: (0, _helpers__.withStyle)('text-warning mb-1')
|
|
166
|
-
}, isTmg ? "".concat((
|
|
219
|
+
}, isTmg ? "".concat((_normalizedStock$quan = normalizedStock.quantity) !== null && _normalizedStock$quan !== void 0 ? _normalizedStock$quan : 0, " op voorraad") : 'Weinig op voorraad') : /*#__PURE__*/_react.default.createElement("div", {
|
|
167
220
|
className: (0, _helpers__.withStyle)('text-success mb-1')
|
|
168
|
-
}, isTmg ? "".concat((
|
|
221
|
+
}, isTmg ? "".concat((_normalizedStock$quan2 = normalizedStock.quantity) !== null && _normalizedStock$quan2 !== void 0 ? _normalizedStock$quan2 : 0, " op voorraad") : 'Op voorraad')), hasCheckbox && /*#__PURE__*/_react.default.createElement(_ProductCardCheckbox.default, {
|
|
169
222
|
id: productId,
|
|
170
223
|
isDisabled: isDisabled,
|
|
171
224
|
defaultChecked: isSelected,
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.promise.js");
|
|
4
|
+
require("core-js/modules/es.string.trim.js");
|
|
4
5
|
require("core-js/modules/es.weak-map.js");
|
|
5
6
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
6
7
|
require("core-js/modules/esnext.iterator.every.js");
|
|
7
8
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
8
9
|
require("core-js/modules/esnext.iterator.find.js");
|
|
10
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
9
11
|
require("core-js/modules/esnext.iterator.map.js");
|
|
10
12
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
13
|
require("core-js/modules/es.weak-map.js");
|
|
14
|
+
require("core-js/modules/esnext.iterator.for-each.js");
|
|
12
15
|
Object.defineProperty(exports, "__esModule", {
|
|
13
16
|
value: true
|
|
14
17
|
});
|
|
15
18
|
exports.default = void 0;
|
|
16
19
|
require("core-js/modules/es.promise.js");
|
|
20
|
+
require("core-js/modules/es.string.trim.js");
|
|
17
21
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
18
22
|
require("core-js/modules/esnext.iterator.every.js");
|
|
19
23
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
@@ -60,6 +64,49 @@ function _interopRequireWildcard(e, r) {
|
|
|
60
64
|
}
|
|
61
65
|
return n.default = e, t && t.set(e, n), n;
|
|
62
66
|
}
|
|
67
|
+
function ownKeys(e, r) {
|
|
68
|
+
var t = Object.keys(e);
|
|
69
|
+
if (Object.getOwnPropertySymbols) {
|
|
70
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
71
|
+
r && (o = o.filter(function (r) {
|
|
72
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
73
|
+
})), t.push.apply(t, o);
|
|
74
|
+
}
|
|
75
|
+
return t;
|
|
76
|
+
}
|
|
77
|
+
function _objectSpread(e) {
|
|
78
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
79
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
80
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
81
|
+
_defineProperty(e, r, t[r]);
|
|
82
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
83
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return e;
|
|
87
|
+
}
|
|
88
|
+
function _defineProperty(e, r, t) {
|
|
89
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
90
|
+
value: t,
|
|
91
|
+
enumerable: !0,
|
|
92
|
+
configurable: !0,
|
|
93
|
+
writable: !0
|
|
94
|
+
}) : e[r] = t, e;
|
|
95
|
+
}
|
|
96
|
+
function _toPropertyKey(t) {
|
|
97
|
+
var i = _toPrimitive(t, "string");
|
|
98
|
+
return "symbol" == typeof i ? i : i + "";
|
|
99
|
+
}
|
|
100
|
+
function _toPrimitive(t, r) {
|
|
101
|
+
if ("object" != typeof t || !t) return t;
|
|
102
|
+
var e = t[Symbol.toPrimitive];
|
|
103
|
+
if (void 0 !== e) {
|
|
104
|
+
var i = e.call(t, r || "default");
|
|
105
|
+
if ("object" != typeof i) return i;
|
|
106
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
107
|
+
}
|
|
108
|
+
return ("string" === r ? String : Number)(t);
|
|
109
|
+
}
|
|
63
110
|
const ProductImage = _ref => {
|
|
64
111
|
let {
|
|
65
112
|
productImage
|
|
@@ -87,7 +134,8 @@ const ProductActions = _ref2 => {
|
|
|
87
134
|
showPartStockLevel,
|
|
88
135
|
setShowPartStockLevel,
|
|
89
136
|
productPriceInclVat,
|
|
90
|
-
isWebshop = false
|
|
137
|
+
isWebshop = false,
|
|
138
|
+
isLoadingPartStockLevel = false
|
|
91
139
|
} = _ref2;
|
|
92
140
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
93
141
|
className: (0, _helpers__.withStyle)('d-flex justify-content-end')
|
|
@@ -102,11 +150,12 @@ const ProductActions = _ref2 => {
|
|
|
102
150
|
}, isTmg ? "".concat(stockQuantity, " op voorraad") : 'Op voorraad')), /*#__PURE__*/_react.default.createElement("div", {
|
|
103
151
|
className: (0, _helpers__.withStyle)('d-flex align-items-center')
|
|
104
152
|
}, !isWebshop && /*#__PURE__*/_react.default.createElement(_OutlinedButton.default, {
|
|
153
|
+
className: showPartStockLevel ? 'active' : '',
|
|
105
154
|
style: {
|
|
106
155
|
marginRight: '1rem'
|
|
107
156
|
},
|
|
108
157
|
onClick: () => setShowPartStockLevel(!showPartStockLevel),
|
|
109
|
-
label:
|
|
158
|
+
label: isLoadingPartStockLevel ? 'Voorkeurs voorraad laden...' : showPartStockLevel ? 'Verberg voorkeurs voorraad' : 'Voorkeurs voorraad'
|
|
110
159
|
}), /*#__PURE__*/_react.default.createElement(_NumericInput.default, {
|
|
111
160
|
className: (0, _helpers__.withStyle)('me-2 rounded'),
|
|
112
161
|
width: "100px",
|
|
@@ -129,6 +178,7 @@ const ProductCategories = _ref3 => {
|
|
|
129
178
|
preferredPart = null,
|
|
130
179
|
partStockLevels = null,
|
|
131
180
|
showPartStockLevel = false,
|
|
181
|
+
isLoadingPartStockLevel = false,
|
|
132
182
|
brandName = null,
|
|
133
183
|
isWebshop = false
|
|
134
184
|
} = _ref3;
|
|
@@ -140,7 +190,11 @@ const ProductCategories = _ref3 => {
|
|
|
140
190
|
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
141
191
|
}, /*#__PURE__*/_react.default.createElement("strong", null, "Groep:"), " ", productSubgroup), preferredPart && /*#__PURE__*/_react.default.createElement("p", {
|
|
142
192
|
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
143
|
-
}, /*#__PURE__*/_react.default.createElement("strong", null, "Voorkeur:"), " ", preferredPart.preferredPart), !isWebshop && showPartStockLevel &&
|
|
193
|
+
}, /*#__PURE__*/_react.default.createElement("strong", null, "Voorkeur:"), " ", preferredPart.preferredPart), !isWebshop && showPartStockLevel && isLoadingPartStockLevel && /*#__PURE__*/_react.default.createElement("p", {
|
|
194
|
+
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
195
|
+
}, /*#__PURE__*/_react.default.createElement("small", null, "Voorkeurs voorraad laden...")), !isWebshop && showPartStockLevel && !isLoadingPartStockLevel && !(partStockLevels !== null && partStockLevels !== void 0 && partStockLevels.status) && /*#__PURE__*/_react.default.createElement("p", {
|
|
196
|
+
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
197
|
+
}, /*#__PURE__*/_react.default.createElement("small", null, "Geen voorkeurs voorraad gevonden")), !isWebshop && showPartStockLevel && !isLoadingPartStockLevel && (partStockLevels === null || partStockLevels === void 0 ? void 0 : partStockLevels.status) && /*#__PURE__*/_react.default.createElement("p", {
|
|
144
198
|
className: (0, _helpers__.withStyle)('fst-italic mb-0')
|
|
145
199
|
}, /*#__PURE__*/_react.default.createElement("small", {
|
|
146
200
|
className: (0, _helpers__.withStyle)(partStockLevels.status === _constants__.StockStatus.OutOfStock ? 'text-danger' : partStockLevels.status === _constants__.StockStatus.InsufficientStock ? 'text-warning' : 'text-success')
|
|
@@ -177,18 +231,45 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
177
231
|
productFieldLabels
|
|
178
232
|
} = (0, _queries.useProductFieldLabels)();
|
|
179
233
|
const [preferredPart, setPreferredPart] = (0, _react.useState)(null);
|
|
180
|
-
const [partStockLevels, setPartStockLevels] = (0, _react.useState)(
|
|
234
|
+
const [partStockLevels, setPartStockLevels] = (0, _react.useState)(null);
|
|
181
235
|
const [showPartStockLevel, setShowPartStockLevel] = (0, _react.useState)(false);
|
|
236
|
+
const [isLoadingPartStockLevel, setIsLoadingPartStockLevel] = (0, _react.useState)(false);
|
|
237
|
+
const findPreferredPart = () => {
|
|
238
|
+
var _parts$find;
|
|
239
|
+
return (_parts$find = parts.find(part => part.isPreferred === true)) !== null && _parts$find !== void 0 ? _parts$find : parts.length === 1 ? parts[0] : null;
|
|
240
|
+
};
|
|
241
|
+
const getPreferredPartDisplayArticleNumber = part => {
|
|
242
|
+
var _part$preferredPart$s;
|
|
243
|
+
return typeof (part === null || part === void 0 ? void 0 : part.preferredPart) === 'string' ? (_part$preferredPart$s = part.preferredPart.split('|')[0]) === null || _part$preferredPart$s === void 0 ? void 0 : _part$preferredPart$s.trim() : null;
|
|
244
|
+
};
|
|
245
|
+
const getPreferredPartNumber = part => {
|
|
246
|
+
var _ref5, _ref6, _ref7, _part$articleNumber;
|
|
247
|
+
return (_ref5 = (_ref6 = (_ref7 = (_part$articleNumber = part === null || part === void 0 ? void 0 : part.articleNumber) !== null && _part$articleNumber !== void 0 ? _part$articleNumber : part === null || part === void 0 ? void 0 : part.partArticleNumber) !== null && _ref7 !== void 0 ? _ref7 : part === null || part === void 0 ? void 0 : part.preferredPartNumber) !== null && _ref6 !== void 0 ? _ref6 : part === null || part === void 0 ? void 0 : part.partNumber) !== null && _ref5 !== void 0 ? _ref5 : getPreferredPartDisplayArticleNumber(part);
|
|
248
|
+
};
|
|
249
|
+
const getPreferredPartBrandNumber = part => {
|
|
250
|
+
var _ref8, _ref9, _ref10, _ref11, _part$articleBrandNum;
|
|
251
|
+
return (_ref8 = (_ref9 = (_ref10 = (_ref11 = (_part$articleBrandNum = part === null || part === void 0 ? void 0 : part.articleBrandNumber) !== null && _part$articleBrandNum !== void 0 ? _part$articleBrandNum : part === null || part === void 0 ? void 0 : part.partArticleBrandNumber) !== null && _ref11 !== void 0 ? _ref11 : part === null || part === void 0 ? void 0 : part.preferredPartBrandNumber) !== null && _ref10 !== void 0 ? _ref10 : part === null || part === void 0 ? void 0 : part.partBrandNumber) !== null && _ref9 !== void 0 ? _ref9 : part === null || part === void 0 ? void 0 : part.brandNumber) !== null && _ref8 !== void 0 ? _ref8 : part === null || part === void 0 ? void 0 : part.partBrandId;
|
|
252
|
+
};
|
|
182
253
|
(0, _react.useEffect)(() => {
|
|
183
254
|
if (showPartStockLevel) {
|
|
184
255
|
const fetchStockLevels = async () => {
|
|
185
|
-
const preferredPart =
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
256
|
+
const preferredPart = findPreferredPart();
|
|
257
|
+
const preferredPartNumber = getPreferredPartNumber(preferredPart);
|
|
258
|
+
const preferredBrandNumber = getPreferredPartBrandNumber(preferredPart);
|
|
259
|
+
if (preferredPartNumber) {
|
|
260
|
+
setIsLoadingPartStockLevel(true);
|
|
261
|
+
try {
|
|
262
|
+
const partStockLevel = await (0, _singleOrderArticles.fetchPartStockLevels)(_objectSpread({
|
|
263
|
+
partNumber: preferredPartNumber
|
|
264
|
+
}, preferredBrandNumber ? {
|
|
265
|
+
brandNumber: preferredBrandNumber
|
|
266
|
+
} : {}), branchId, !isTmg ? formula : null);
|
|
267
|
+
setPartStockLevels(partStockLevel);
|
|
268
|
+
} catch (_unused) {
|
|
269
|
+
setPartStockLevels(null);
|
|
270
|
+
} finally {
|
|
271
|
+
setIsLoadingPartStockLevel(false);
|
|
272
|
+
}
|
|
192
273
|
}
|
|
193
274
|
};
|
|
194
275
|
fetchStockLevels();
|
|
@@ -196,23 +277,23 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
196
277
|
}, [showPartStockLevel, parts, branchId, isTmg, formula]);
|
|
197
278
|
(0, _react.useEffect)(() => {
|
|
198
279
|
if (parts && parts.length > 0) {
|
|
199
|
-
const preferred =
|
|
280
|
+
const preferred = findPreferredPart();
|
|
200
281
|
if (preferred) {
|
|
201
282
|
setPreferredPart(preferred);
|
|
202
283
|
}
|
|
203
284
|
}
|
|
204
285
|
}, [parts]);
|
|
205
|
-
const filteredProductSpecifications = productSpecifications.filter(
|
|
286
|
+
const filteredProductSpecifications = productSpecifications.filter(_ref12 => {
|
|
206
287
|
let {
|
|
207
288
|
key,
|
|
208
289
|
value
|
|
209
|
-
} =
|
|
290
|
+
} = _ref12;
|
|
210
291
|
return (productFieldLabels === null || productFieldLabels === void 0 ? void 0 : productFieldLabels[key]) && (value !== 'kg' || key !== 'weight');
|
|
211
|
-
}).map(
|
|
292
|
+
}).map(_ref13 => {
|
|
212
293
|
let {
|
|
213
294
|
key,
|
|
214
295
|
value
|
|
215
|
-
} =
|
|
296
|
+
} = _ref13;
|
|
216
297
|
return {
|
|
217
298
|
key: productFieldLabels[key],
|
|
218
299
|
value
|
|
@@ -242,6 +323,7 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
242
323
|
preferredPart: preferredPart,
|
|
243
324
|
partStockLevels: partStockLevels,
|
|
244
325
|
showPartStockLevel: showPartStockLevel,
|
|
326
|
+
isLoadingPartStockLevel: isLoadingPartStockLevel,
|
|
245
327
|
isWebshop: isWebshop
|
|
246
328
|
}), (filteredProductSpecifications === null || filteredProductSpecifications === void 0 ? void 0 : filteredProductSpecifications.length) > 0 && /*#__PURE__*/_react.default.createElement(_ProductCardSpecifications.default, {
|
|
247
329
|
specifications: filteredProductSpecifications,
|
|
@@ -263,7 +345,8 @@ const SingleOrderProductCard = _ref4 => {
|
|
|
263
345
|
removeFromCart: removeFromCart,
|
|
264
346
|
productPrice: productPrice,
|
|
265
347
|
productPriceInclVat: productPriceInclVat,
|
|
266
|
-
isWebshop: isWebshop
|
|
348
|
+
isWebshop: isWebshop,
|
|
349
|
+
isLoadingPartStockLevel: isLoadingPartStockLevel
|
|
267
350
|
})))));
|
|
268
351
|
};
|
|
269
352
|
var _default = exports.default = SingleOrderProductCard;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.array.reduce.js");
|
|
4
4
|
require("core-js/modules/es.promise.js");
|
|
5
|
+
require("core-js/modules/es.string.trim.js");
|
|
5
6
|
require("core-js/modules/es.weak-map.js");
|
|
6
7
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
7
8
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
@@ -18,6 +19,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
18
19
|
exports.default = void 0;
|
|
19
20
|
require("core-js/modules/es.array.reduce.js");
|
|
20
21
|
require("core-js/modules/es.promise.js");
|
|
22
|
+
require("core-js/modules/es.string.trim.js");
|
|
21
23
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
22
24
|
require("core-js/modules/esnext.iterator.find.js");
|
|
23
25
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
@@ -159,7 +161,7 @@ const customerDetailsFormSchema = (0, _yup.object)({
|
|
|
159
161
|
})
|
|
160
162
|
});
|
|
161
163
|
const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
162
|
-
var _branchTypes$byId$aut, _authSession$branch;
|
|
164
|
+
var _customer$vatNumber, _customer$kvkNumber, _branchTypes$byId$aut, _authSession$branch;
|
|
163
165
|
let {
|
|
164
166
|
errors = {},
|
|
165
167
|
onValidationError,
|
|
@@ -249,6 +251,21 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
249
251
|
|
|
250
252
|
// Get customer data for the active ownership type
|
|
251
253
|
const customer = customerDataPerType[activeOwnershipType] || (0, _helpers__.getEmptySingleOrderCustomer)();
|
|
254
|
+
const selectedCountry = (0, _react.useMemo)(() => {
|
|
255
|
+
if (!(countryOptions !== null && countryOptions !== void 0 && countryOptions.length)) return null;
|
|
256
|
+
if (customer !== null && customer !== void 0 && customer.countryId) {
|
|
257
|
+
return countryOptions.find(option => option.value === customer.countryId) || null;
|
|
258
|
+
}
|
|
259
|
+
const defaultCountry = countryOptions.find(option => option.label === 'NEDERLAND');
|
|
260
|
+
return defaultCountry || null;
|
|
261
|
+
}, [customer === null || customer === void 0 ? void 0 : customer.countryId, countryOptions]);
|
|
262
|
+
const isBusinessOwnership = activeOwnershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk;
|
|
263
|
+
const isNetherlandsSelected = (0, _react.useMemo)(() => {
|
|
264
|
+
if (!(selectedCountry !== null && selectedCountry !== void 0 && selectedCountry.label)) return false;
|
|
265
|
+
return selectedCountry.label.toUpperCase() === 'NEDERLAND';
|
|
266
|
+
}, [selectedCountry === null || selectedCountry === void 0 ? void 0 : selectedCountry.label]);
|
|
267
|
+
const shouldRequireKvkNumber = isBusinessOwnership && (isNetherlandsSelected || !(customer !== null && customer !== void 0 && (_customer$vatNumber = customer.vatNumber) !== null && _customer$vatNumber !== void 0 && _customer$vatNumber.trim()));
|
|
268
|
+
const shouldRequireVatNumber = isBusinessOwnership && !isNetherlandsSelected && !(customer !== null && customer !== void 0 && (_customer$kvkNumber = customer.kvkNumber) !== null && _customer$kvkNumber !== void 0 && _customer$kvkNumber.trim());
|
|
252
269
|
|
|
253
270
|
// Helper to update customer data for the active ownership type
|
|
254
271
|
const updateCustomerField = (0, _react.useCallback)((field, value) => {
|
|
@@ -491,6 +508,24 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
491
508
|
}, [addressLookupTimeoutId]);
|
|
492
509
|
const validateForm = async () => {
|
|
493
510
|
try {
|
|
511
|
+
var _customer$kvkNumber2, _customer$vatNumber2;
|
|
512
|
+
const hasKvkNumber = !!(customer !== null && customer !== void 0 && (_customer$kvkNumber2 = customer.kvkNumber) !== null && _customer$kvkNumber2 !== void 0 && _customer$kvkNumber2.trim());
|
|
513
|
+
const hasVatNumber = !!(customer !== null && customer !== void 0 && (_customer$vatNumber2 = customer.vatNumber) !== null && _customer$vatNumber2 !== void 0 && _customer$vatNumber2.trim());
|
|
514
|
+
if (isBusinessOwnership) {
|
|
515
|
+
if (isNetherlandsSelected && !hasKvkNumber) {
|
|
516
|
+
onValidationError === null || onValidationError === void 0 || onValidationError({
|
|
517
|
+
kvkNumber: 'KVK-nummer is verplicht voor zakelijke dossiers in Nederland'
|
|
518
|
+
});
|
|
519
|
+
return false;
|
|
520
|
+
}
|
|
521
|
+
if (!isNetherlandsSelected && !hasKvkNumber && !hasVatNumber) {
|
|
522
|
+
onValidationError === null || onValidationError === void 0 || onValidationError({
|
|
523
|
+
kvkNumber: 'Vul een KVK- of BTW-nummer in',
|
|
524
|
+
vatNumber: 'Vul een KVK- of BTW-nummer in'
|
|
525
|
+
});
|
|
526
|
+
return false;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
494
529
|
let validationSchema = webshop || !isTmg ? customerDetailsFormSchema.omit(['channelType', 'channelId']) : customerDetailsFormSchema;
|
|
495
530
|
const requiredFields = (0, _helpers__.getSingleOrderRequiredFields)({
|
|
496
531
|
webshop,
|
|
@@ -779,19 +814,21 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
779
814
|
}
|
|
780
815
|
}, branch.name)))), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
781
816
|
placeholder: "",
|
|
782
|
-
|
|
817
|
+
value: customer.kvkNumber,
|
|
783
818
|
name: "kvkNumber",
|
|
784
819
|
onChange: value => updateCustomerField('kvkNumber', value),
|
|
785
|
-
|
|
820
|
+
key: "kvkNumber-".concat(refreshKey),
|
|
821
|
+
isRequired: shouldRequireKvkNumber,
|
|
786
822
|
form: form,
|
|
787
823
|
label: "KVK-nummer:",
|
|
788
824
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['kvkNumber']
|
|
789
825
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
790
826
|
placeholder: "",
|
|
791
|
-
|
|
827
|
+
value: customer.vatNumber,
|
|
792
828
|
name: "vatNumber",
|
|
793
829
|
onChange: value => updateCustomerField('vatNumber', value),
|
|
794
|
-
|
|
830
|
+
key: "vatNumber-".concat(refreshKey),
|
|
831
|
+
isRequired: shouldRequireVatNumber,
|
|
795
832
|
form: form,
|
|
796
833
|
label: "BTW-nummer:",
|
|
797
834
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['vatNumber']
|
|
@@ -829,7 +866,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
829
866
|
label: "Contact e-mailadres:"
|
|
830
867
|
})) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("br", null)), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
831
868
|
placeholder: "",
|
|
832
|
-
|
|
869
|
+
value: customer.zipCode,
|
|
833
870
|
name: "zipCode",
|
|
834
871
|
onChange: value => {
|
|
835
872
|
updateCustomerField('zipCode', value);
|
|
@@ -839,12 +876,13 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
839
876
|
}
|
|
840
877
|
},
|
|
841
878
|
isRequired: webshop || anderAfleveradres,
|
|
879
|
+
key: "zipCode-".concat(refreshKey),
|
|
842
880
|
form: form,
|
|
843
881
|
label: "Postcode:",
|
|
844
882
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['zipCode']
|
|
845
883
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
846
884
|
placeholder: "",
|
|
847
|
-
|
|
885
|
+
value: customer.houseNumber,
|
|
848
886
|
name: "houseNumber",
|
|
849
887
|
onChange: value => {
|
|
850
888
|
updateCustomerField('houseNumber', value);
|
|
@@ -854,33 +892,37 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
854
892
|
}
|
|
855
893
|
},
|
|
856
894
|
isRequired: webshop || anderAfleveradres,
|
|
895
|
+
key: "houseNumber-".concat(refreshKey),
|
|
857
896
|
form: form,
|
|
858
897
|
label: "Huisnummer:",
|
|
859
898
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumber']
|
|
860
899
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
861
900
|
placeholder: "",
|
|
862
|
-
|
|
901
|
+
value: customer.houseNumberAddition,
|
|
863
902
|
name: "houseNumberAddition",
|
|
864
903
|
onChange: value => updateCustomerField('houseNumberAddition', value),
|
|
865
904
|
isRequired: false,
|
|
905
|
+
key: "houseNumberAddition-".concat(refreshKey),
|
|
866
906
|
form: form,
|
|
867
907
|
label: "Huisnummer toevoeging:",
|
|
868
908
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['houseNumberAddition']
|
|
869
909
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
870
910
|
placeholder: addressLookupLoading ? 'Adres wordt opgezocht...' : '',
|
|
871
|
-
|
|
911
|
+
value: customer.streetName,
|
|
872
912
|
name: "streetName",
|
|
873
913
|
onChange: value => updateCustomerField('streetName', value),
|
|
874
914
|
isRequired: webshop || anderAfleveradres,
|
|
915
|
+
key: "streetName-".concat(refreshKey),
|
|
875
916
|
form: form,
|
|
876
917
|
label: "Straat:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
877
918
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['streetName']
|
|
878
919
|
}), /*#__PURE__*/_react.default.createElement(_TextInput.default, {
|
|
879
920
|
placeholder: addressLookupLoading ? 'Stad wordt opgezocht...' : '',
|
|
880
|
-
|
|
921
|
+
value: customer.city,
|
|
881
922
|
name: "city",
|
|
882
923
|
onChange: value => updateCustomerField('city', value),
|
|
883
924
|
isRequired: webshop || anderAfleveradres,
|
|
925
|
+
key: "city-".concat(refreshKey),
|
|
884
926
|
form: form,
|
|
885
927
|
label: "Stad:".concat(addressLookupLoading ? ' (wordt opgezocht...)' : ''),
|
|
886
928
|
errorMessage: errors === null || errors === void 0 ? void 0 : errors['city']
|