thm-p3-configurator 0.0.155 → 0.0.157
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 +2 -0
- package/dist/src/shared/__components__/ProductCard/ProductCardImage.js +3 -2
- package/dist/src/shared/__components__/ProductCard/index.js +4 -2
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +48 -2
- package/dist/src/shared/__containers__/BoardComputerCard.js +4 -2
- package/dist/src/shared/__containers__/ProductsOverview.js +9 -5
- package/package.json +1 -1
|
@@ -99,6 +99,7 @@ const useCreateSingleOrderMutation = () => {
|
|
|
99
99
|
model,
|
|
100
100
|
cart,
|
|
101
101
|
customer,
|
|
102
|
+
channel,
|
|
102
103
|
formula,
|
|
103
104
|
branchId,
|
|
104
105
|
vehicle,
|
|
@@ -110,6 +111,7 @@ const useCreateSingleOrderMutation = () => {
|
|
|
110
111
|
model,
|
|
111
112
|
cart,
|
|
112
113
|
customer,
|
|
114
|
+
channel,
|
|
113
115
|
formula,
|
|
114
116
|
branchId,
|
|
115
117
|
vehicle,
|
|
@@ -13,14 +13,15 @@ function _interopRequireDefault(e) {
|
|
|
13
13
|
}
|
|
14
14
|
const ProductCardImage = _ref => {
|
|
15
15
|
let {
|
|
16
|
-
image
|
|
16
|
+
image,
|
|
17
|
+
isBoardComputer
|
|
17
18
|
} = _ref;
|
|
18
19
|
if (!image) {
|
|
19
20
|
return null;
|
|
20
21
|
}
|
|
21
22
|
return /*#__PURE__*/_react.default.createElement("img", {
|
|
22
23
|
src: image,
|
|
23
|
-
className: (0, _helpers__.withStyle)(
|
|
24
|
+
className: (0, _helpers__.withStyle)("card__image img-fluid ".concat(isBoardComputer ? 'mb-2' : '')),
|
|
24
25
|
alt: "product afbeelding"
|
|
25
26
|
});
|
|
26
27
|
};
|
|
@@ -74,7 +74,8 @@ const ProductCard = _ref => {
|
|
|
74
74
|
onSelect = () => {},
|
|
75
75
|
isOnlyProductInCategory = false,
|
|
76
76
|
isAnotherProductSelected = true,
|
|
77
|
-
isTmg = false
|
|
77
|
+
isTmg = false,
|
|
78
|
+
isBoardComputer = false
|
|
78
79
|
} = _ref;
|
|
79
80
|
const [isSelected, setIsSelected] = (0, _react.useState)(defaultSelected);
|
|
80
81
|
const {
|
|
@@ -114,7 +115,8 @@ const ProductCard = _ref => {
|
|
|
114
115
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
115
116
|
className: (0, _helpers__.withStyle)('col-md-4 d-flex justify-content-center position-relative')
|
|
116
117
|
}, /*#__PURE__*/_react.default.createElement(_ProductCardImage.default, {
|
|
117
|
-
image: productImage
|
|
118
|
+
image: productImage,
|
|
119
|
+
isBoardComputer: isBoardComputer
|
|
118
120
|
}), /*#__PURE__*/_react.default.createElement(_ProductCardDiscountAlert.default, {
|
|
119
121
|
label: productDiscountedLabel,
|
|
120
122
|
price: productPrice,
|
|
@@ -4,10 +4,11 @@ require("core-js/modules/es.promise.js");
|
|
|
4
4
|
require("core-js/modules/es.weak-map.js");
|
|
5
5
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
6
6
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
7
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
7
8
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
9
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
8
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
9
11
|
require("core-js/modules/es.weak-map.js");
|
|
10
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
11
12
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
12
13
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
13
14
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -15,6 +16,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
15
16
|
});
|
|
16
17
|
exports.default = void 0;
|
|
17
18
|
require("core-js/modules/es.promise.js");
|
|
19
|
+
require("core-js/modules/esnext.iterator.constructor.js");
|
|
20
|
+
require("core-js/modules/esnext.iterator.find.js");
|
|
21
|
+
require("core-js/modules/esnext.iterator.map.js");
|
|
18
22
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
19
23
|
var _react = _interopRequireWildcard(require("react"));
|
|
20
24
|
var _yup = require("yup");
|
|
@@ -26,6 +30,7 @@ var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
|
|
|
26
30
|
var _LinkButton = _interopRequireDefault(require("../Buttons/LinkButton"));
|
|
27
31
|
var _CardWide = _interopRequireDefault(require("../Cards/CardWide"));
|
|
28
32
|
var _DatePickerInput = _interopRequireDefault(require("../Form/DatePickerInput"));
|
|
33
|
+
var _DropdownInput = _interopRequireDefault(require("../Form/DropdownInput"));
|
|
29
34
|
var _RadioButtons = _interopRequireDefault(require("../Form/RadioButtons"));
|
|
30
35
|
var _TextAreaInput = _interopRequireDefault(require("../Form/TextAreaInput"));
|
|
31
36
|
var _TextInput = _interopRequireDefault(require("../Form/TextInput"));
|
|
@@ -115,7 +120,9 @@ const customerDetailsFormSchema = (0, _yup.object)({
|
|
|
115
120
|
city: (0, _yup.string)().nullable(),
|
|
116
121
|
date: (0, _yup.string)().nullable(),
|
|
117
122
|
time: (0, _yup.string)().nullable(),
|
|
118
|
-
internalNote: (0, _yup.string)().nullable()
|
|
123
|
+
internalNote: (0, _yup.string)().nullable(),
|
|
124
|
+
channelType: (0, _yup.string)().required('Kanaal is verplicht'),
|
|
125
|
+
channelId: (0, _yup.string)().required('Kanaal is verplicht')
|
|
119
126
|
});
|
|
120
127
|
const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
121
128
|
var _branchTypes$byId$aut, _authSession$branch;
|
|
@@ -144,6 +151,14 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
144
151
|
marketingChannels,
|
|
145
152
|
isLoadingMarketingChannels
|
|
146
153
|
} = (0, _queries.useMarketingChannels)(branchType);
|
|
154
|
+
const initialChannel = (0, _react.useMemo)(() => {
|
|
155
|
+
if (!(channel !== null && channel !== void 0 && channel.channelId) || !(marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length)) return null;
|
|
156
|
+
const selectedChannel = marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.find(marketingC => (marketingC === null || marketingC === void 0 ? void 0 : marketingC.entityId) === (channel === null || channel === void 0 ? void 0 : channel.channelId));
|
|
157
|
+
return selectedChannel ? {
|
|
158
|
+
label: selectedChannel === null || selectedChannel === void 0 ? void 0 : selectedChannel.title,
|
|
159
|
+
value: selectedChannel
|
|
160
|
+
} : null;
|
|
161
|
+
}, [channel, marketingChannels]);
|
|
147
162
|
const handleAutofillButtonClicked = () => {
|
|
148
163
|
dispatch({
|
|
149
164
|
type: _OrderSessionContext.orderSessionActions.SET_CUSTOMER_LAST_NAME,
|
|
@@ -222,6 +237,37 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
222
237
|
label: 'Vestiginggegevens invullen?',
|
|
223
238
|
onClick: handleAutofillButtonClicked,
|
|
224
239
|
isDisabled: !branchById
|
|
240
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
241
|
+
className: (0, _helpers__.withStyle)('col-12 mb-2')
|
|
242
|
+
}, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
243
|
+
options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
|
|
244
|
+
label: channel === null || channel === void 0 ? void 0 : channel.title,
|
|
245
|
+
value: channel
|
|
246
|
+
})),
|
|
247
|
+
name: "channel",
|
|
248
|
+
label: "Kanaal:",
|
|
249
|
+
isRequired: true,
|
|
250
|
+
isLoading: isLoadingMarketingChannels,
|
|
251
|
+
noOptionsMessage: "Geen opties beschikbaar",
|
|
252
|
+
placeholder: "Maak een keuze",
|
|
253
|
+
errorMessage: (errors === null || errors === void 0 ? void 0 : errors['channelType']) || (errors === null || errors === void 0 ? void 0 : errors['channelId']),
|
|
254
|
+
initialValue: initialChannel,
|
|
255
|
+
onChange: _ref2 => {
|
|
256
|
+
var _value$kanaalType;
|
|
257
|
+
let {
|
|
258
|
+
label,
|
|
259
|
+
value
|
|
260
|
+
} = _ref2;
|
|
261
|
+
return dispatch({
|
|
262
|
+
type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
|
|
263
|
+
payload: {
|
|
264
|
+
channel: {
|
|
265
|
+
channelType: value === null || value === void 0 || (_value$kanaalType = value.kanaalType) === null || _value$kanaalType === void 0 || (_value$kanaalType = _value$kanaalType[0]) === null || _value$kanaalType === void 0 ? void 0 : _value$kanaalType.entityId,
|
|
266
|
+
channelId: value === null || value === void 0 ? void 0 : value.entityId
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
225
271
|
})), /*#__PURE__*/_react.default.createElement(_RadioButtons.default, {
|
|
226
272
|
name: "singleOrderOwnershipType",
|
|
227
273
|
label: "Type:",
|
|
@@ -51,6 +51,7 @@ const BoardComputerCard = _ref => {
|
|
|
51
51
|
description,
|
|
52
52
|
title,
|
|
53
53
|
price,
|
|
54
|
+
productImage,
|
|
54
55
|
onSelect = _ref2 => {
|
|
55
56
|
let {
|
|
56
57
|
isSelected,
|
|
@@ -102,7 +103,7 @@ const BoardComputerCard = _ref => {
|
|
|
102
103
|
productTitle: title,
|
|
103
104
|
productDescription: description,
|
|
104
105
|
productUsps: [],
|
|
105
|
-
productImage:
|
|
106
|
+
productImage: productImage,
|
|
106
107
|
isDisabled: false,
|
|
107
108
|
defaultSelected: isSelected,
|
|
108
109
|
onSelect: handleSelect,
|
|
@@ -111,7 +112,8 @@ const BoardComputerCard = _ref => {
|
|
|
111
112
|
productSpecifications: [],
|
|
112
113
|
showPrice: APP_CONFIG.internal,
|
|
113
114
|
canUnselect: canUnselect,
|
|
114
|
-
isOnlyProductInCategory: isSelected
|
|
115
|
+
isOnlyProductInCategory: isSelected,
|
|
116
|
+
isBoardComputer: true
|
|
115
117
|
}), anchorEl && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement(_Modal.default, {
|
|
116
118
|
isOpen: isModalOpen,
|
|
117
119
|
size: "large",
|
|
@@ -276,11 +276,16 @@ const ProductsOverview = () => {
|
|
|
276
276
|
product: a,
|
|
277
277
|
category: productCategory
|
|
278
278
|
}) ? -1 : 0).map(product => {
|
|
279
|
-
var _product$
|
|
279
|
+
var _product$images, _product$images2, _product$locationPric;
|
|
280
280
|
const isRecommended = (0, _product.checkIfTowbarIsRecommended)({
|
|
281
281
|
product,
|
|
282
282
|
category: productCategory
|
|
283
283
|
});
|
|
284
|
+
|
|
285
|
+
// Generate the product image URL
|
|
286
|
+
const productImageUrl = product !== null && product !== void 0 && (_product$images = product.images) !== null && _product$images !== void 0 && _product$images[0] ? (0, _image.getImageFromHyper)({
|
|
287
|
+
imageId: product === null || product === void 0 || (_product$images2 = product.images) === null || _product$images2 === void 0 ? void 0 : _product$images2[0]
|
|
288
|
+
}) : _logoPrimary.default;
|
|
284
289
|
if (productCategory === _constants__.PRODUCT_CATEGORIES.BOARD_COMPUTER && selectedCableset) {
|
|
285
290
|
return /*#__PURE__*/_react.default.createElement(_BoardComputerCard.default, {
|
|
286
291
|
defaultSelected: selectedBoardComputer === product.articleNumber,
|
|
@@ -299,7 +304,8 @@ const ProductsOverview = () => {
|
|
|
299
304
|
id: product.articleNumber,
|
|
300
305
|
description: (0, _product.formatHyperDescription)(product === null || product === void 0 ? void 0 : product.description),
|
|
301
306
|
title: product === null || product === void 0 ? void 0 : product.subgroupName,
|
|
302
|
-
price: product === null || product === void 0 ? void 0 : product.price
|
|
307
|
+
price: product === null || product === void 0 ? void 0 : product.price,
|
|
308
|
+
productImage: productImageUrl
|
|
303
309
|
});
|
|
304
310
|
}
|
|
305
311
|
return /*#__PURE__*/_react.default.createElement(_ProductCard.default, {
|
|
@@ -321,9 +327,7 @@ const ProductsOverview = () => {
|
|
|
321
327
|
type: 'remark',
|
|
322
328
|
text: product === null || product === void 0 ? void 0 : product.remark
|
|
323
329
|
}],
|
|
324
|
-
productImage:
|
|
325
|
-
imageId: product === null || product === void 0 || (_product$images2 = product.images) === null || _product$images2 === void 0 ? void 0 : _product$images2[0]
|
|
326
|
-
}) : _logoPrimary.default,
|
|
330
|
+
productImage: productImageUrl,
|
|
327
331
|
isDisabled: false,
|
|
328
332
|
defaultSelected: productCategory === _constants__.PRODUCT_CATEGORIES.TOWBAR && selectedTowbar === product.articleNumber || productCategory === _constants__.PRODUCT_CATEGORIES.CABLESET && selectedCableset === product.articleNumber || productCategory === _constants__.PRODUCT_CATEGORIES.COMBISET && selectedCombiset === product.articleNumber
|
|
329
333
|
// Set both to false to prevent auto-selection when navigating back
|