thm-p3-configurator 0.0.445 → 0.0.448
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/logo-th-icon.png +0 -0
- package/dist/public/assets/images/logo-th-primary.png +0 -0
- package/dist/public/assets/images/logo-thl-icon.png +0 -0
- package/dist/public/assets/images/logo-thl-primary.png +0 -0
- package/dist/public/assets/images/logo-wb-icon.png +0 -0
- package/dist/public/assets/images/logo-wb-primary.png +0 -0
- package/dist/src/shared/__components__/Header.js +47 -3
- package/dist/src/shared/__components__/Navbar.js +5 -2
- package/dist/src/shared/__components__/ProductCard/index.js +4 -1
- package/dist/src/shared/__components__/Spinners/FullPageSpinner.js +4 -1
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +8 -3
- package/dist/src/shared/__constants__/__tests__/index.test.js +15 -0
- package/dist/src/shared/__constants__/index.js +48 -7
- package/dist/src/shared/__containers__/ProductCartSide.js +5 -2
- package/dist/src/shared/__containers__/ProductsCartOverview.js +5 -5
- package/dist/src/shared/__containers__/ProductsOverview.js +3 -1
- package/dist/src/shared/__containers__/internal/InternalBranchSelectorModal.js +99 -16
- package/dist/src/shared/__containers__/internal/OrderTypeSelectorModal.js +8 -0
- package/dist/src/shared/__helpers__/__tests__/product.test.js +11 -0
- package/dist/src/shared/__helpers__/__tests__/singleOrderBranchSelector.test.js +64 -0
- package/dist/src/shared/__helpers__/__tests__/singleOrderWebshop.test.js +17 -0
- package/dist/src/shared/__helpers__/index.js +18 -1
- package/dist/src/shared/__helpers__/product.js +30 -14
- package/dist/src/shared/__helpers__/singleOrderArticles.js +27 -15
- package/dist/src/shared/__helpers__/singleOrderBranchSelector.js +57 -2
- package/dist/src/shared/__helpers__/singleOrderCustomerDetails.js +1 -1
- package/dist/src/shared/__helpers__/singleOrderWebshop.js +46 -0
- package/dist/src/shared/__hooks__/useBranchTheme.js +12 -1
- package/dist/src/shared/__pages__/internal/InternalSingleOrderPage.js +5 -4
- package/dist/src/shared/__style__/_variables-external.scss +6 -0
- package/dist/src/shared/__style__/_variables.scss +6 -0
- package/dist/src/shared/__style__/components/card/_card-horizontal.scss +6 -0
- package/dist/src/shared/__style__/configurator/_configurator.scss +100 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -9,6 +9,9 @@ var _logoPrimaryIcon = _interopRequireDefault(require("../../../public/assets/im
|
|
|
9
9
|
var _logoThcWhite = _interopRequireDefault(require("../../../public/assets/images/logo-thc-white.svg"));
|
|
10
10
|
var _logoTmgPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-tmg-primary.png"));
|
|
11
11
|
var _tmLogo = _interopRequireDefault(require("../../../public/assets/images/tm-logo.png"));
|
|
12
|
+
var _logoWbPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-wb-primary.png"));
|
|
13
|
+
var _logoThlPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-thl-primary.png"));
|
|
14
|
+
var _logoThPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-th-primary.png"));
|
|
12
15
|
var _constants__ = require("../__constants__");
|
|
13
16
|
var _helpers__ = require("../__helpers__");
|
|
14
17
|
var _useBranchTheme = require("../__hooks__/useBranchTheme");
|
|
@@ -17,12 +20,53 @@ function _interopRequireDefault(e) {
|
|
|
17
20
|
default: e
|
|
18
21
|
};
|
|
19
22
|
}
|
|
23
|
+
const getHeaderLogo = theme => {
|
|
24
|
+
switch (theme) {
|
|
25
|
+
case _constants__.BRANCH_THEME_BY_FORMULA.TowMotive:
|
|
26
|
+
return {
|
|
27
|
+
src: _tmLogo.default,
|
|
28
|
+
alt: 'TowMotive'
|
|
29
|
+
};
|
|
30
|
+
case _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakcentrum:
|
|
31
|
+
return {
|
|
32
|
+
src: _logoThcWhite.default,
|
|
33
|
+
alt: 'Trekhaakcentrum'
|
|
34
|
+
};
|
|
35
|
+
case _constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup:
|
|
36
|
+
return {
|
|
37
|
+
src: _logoTmgPrimary.default,
|
|
38
|
+
alt: 'TowMotive Group'
|
|
39
|
+
};
|
|
40
|
+
case _constants__.BRANCH_THEME_BY_FORMULA.WestfaliaBenelux:
|
|
41
|
+
return {
|
|
42
|
+
src: _logoWbPrimary.default,
|
|
43
|
+
alt: 'Westfalia Benelux'
|
|
44
|
+
};
|
|
45
|
+
case _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakland:
|
|
46
|
+
return {
|
|
47
|
+
src: _logoThlPrimary.default,
|
|
48
|
+
alt: 'Trekhaakland'
|
|
49
|
+
};
|
|
50
|
+
case _constants__.BRANCH_THEME_BY_FORMULA.Trekhaken:
|
|
51
|
+
return {
|
|
52
|
+
src: _logoThPrimary.default,
|
|
53
|
+
alt: 'Trekhaken.nl'
|
|
54
|
+
};
|
|
55
|
+
default:
|
|
56
|
+
return {
|
|
57
|
+
src: _logoPrimaryIcon.default,
|
|
58
|
+
alt: 'Trekhaak Montage'
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
};
|
|
20
62
|
const Header = _ref => {
|
|
21
63
|
let {
|
|
22
64
|
title,
|
|
23
65
|
subtitle = ''
|
|
24
66
|
} = _ref;
|
|
25
67
|
const theme = (0, _useBranchTheme.useBranchTheme)();
|
|
68
|
+
const headerLogo = getHeaderLogo(theme);
|
|
69
|
+
const isWebshopTheme = theme === _constants__.BRANCH_THEME_BY_FORMULA.WestfaliaBenelux || theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakland || theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaken;
|
|
26
70
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
71
|
className: (0, _helpers__.withStyle)("hero hero--offset")
|
|
28
72
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -32,9 +76,9 @@ const Header = _ref => {
|
|
|
32
76
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
33
77
|
className: (0, _helpers__.withStyle)('col hero__logo-container')
|
|
34
78
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
35
|
-
className: (0, _helpers__.withStyle)("hero__logo ".concat(theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup ? 'hero__logo--tmg' : '')),
|
|
36
|
-
src:
|
|
37
|
-
alt:
|
|
79
|
+
className: (0, _helpers__.withStyle)("hero__logo ".concat(theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup ? 'hero__logo--tmg' : '', " ").concat(isWebshopTheme ? 'hero__logo--webshop' : '')),
|
|
80
|
+
src: headerLogo.src,
|
|
81
|
+
alt: headerLogo.alt
|
|
38
82
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
39
83
|
className: (0, _helpers__.withStyle)('hero__inner d-none d-lg-block')
|
|
40
84
|
}, /*#__PURE__*/_react.default.createElement("h2", null, (title === null || title === void 0 ? void 0 : title.length) > 0 ? title : 'Trekhaak offerte opstellen'), (subtitle === null || subtitle === void 0 ? void 0 : subtitle.length) > 0 && /*#__PURE__*/_react.default.createElement("p", {
|
|
@@ -9,6 +9,9 @@ var _logoThcWhite = _interopRequireDefault(require("../../../public/assets/image
|
|
|
9
9
|
var _logoTmgPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-tmg-primary.png"));
|
|
10
10
|
var _logoWhite = _interopRequireDefault(require("../../../public/assets/images/logo-white.svg"));
|
|
11
11
|
var _tmLogo = _interopRequireDefault(require("../../../public/assets/images/tm-logo.png"));
|
|
12
|
+
var _logoWbPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-wb-primary.png"));
|
|
13
|
+
var _logoThlPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-thl-primary.png"));
|
|
14
|
+
var _logoThPrimary = _interopRequireDefault(require("../../../public/assets/images/logo-th-primary.png"));
|
|
12
15
|
var _constants__ = require("../__constants__");
|
|
13
16
|
var _helpers__ = require("../__helpers__");
|
|
14
17
|
var _Datalayer = require("../__services__/Datalayer");
|
|
@@ -40,8 +43,8 @@ const Navbar = _ref => {
|
|
|
40
43
|
})
|
|
41
44
|
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
42
45
|
className: (0, _helpers__.withStyle)('img-fluid'),
|
|
43
|
-
src: theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotive ? _tmLogo.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakcentrum ? _logoThcWhite.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup ? _logoTmgPrimary.default : _logoWhite.default,
|
|
44
|
-
alt: "
|
|
46
|
+
src: theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotive ? _tmLogo.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakcentrum ? _logoThcWhite.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup ? _logoTmgPrimary.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.WestfaliaBenelux ? _logoWbPrimary.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakland ? _logoThlPrimary.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaken ? _logoThPrimary.default : _logoWhite.default,
|
|
47
|
+
alt: "Logo"
|
|
45
48
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
46
49
|
className: (0, _helpers__.withStyle)('navbar__phone ms-10 d-none d-sm-flex')
|
|
47
50
|
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
@@ -109,6 +109,7 @@ const ProductCard = _ref => {
|
|
|
109
109
|
isRecommended = false,
|
|
110
110
|
productId,
|
|
111
111
|
productTitle,
|
|
112
|
+
productOrientation,
|
|
112
113
|
productDescription,
|
|
113
114
|
stock = null,
|
|
114
115
|
productUsps = [],
|
|
@@ -186,7 +187,9 @@ const ProductCard = _ref => {
|
|
|
186
187
|
}, /*#__PURE__*/_react.default.createElement(_ProductCardPrice.default, {
|
|
187
188
|
price: productDiscountedPrice < productPrice ? productPrice : productDiscountedPrice,
|
|
188
189
|
discountedPrice: productDiscountedPrice < productPrice ? productDiscountedPrice : productPrice
|
|
189
|
-
}))), /*#__PURE__*/_react.default.createElement("
|
|
190
|
+
}))), productOrientation && /*#__PURE__*/_react.default.createElement("p", {
|
|
191
|
+
className: (0, _helpers__.withStyle)('card-title__orientation')
|
|
192
|
+
}, /*#__PURE__*/_react.default.createElement("strong", null, productOrientation)), /*#__PURE__*/_react.default.createElement("div", {
|
|
190
193
|
className: (0, _helpers__.withStyle)('card-text row no-gutters flex-wrap align-items-bottom justify-content-start')
|
|
191
194
|
}, /*#__PURE__*/_react.default.createElement(_ProductCardUsps.default, {
|
|
192
195
|
usps: productUsps
|
|
@@ -13,6 +13,9 @@ var _logoThcWhite = _interopRequireDefault(require("../../../../public/assets/im
|
|
|
13
13
|
var _logoTmgPrimary = _interopRequireDefault(require("../../../../public/assets/images/logo-tmg-primary.png"));
|
|
14
14
|
var _tmLogo = _interopRequireDefault(require("../../../../public/assets/images/tm-logo.png"));
|
|
15
15
|
var _logoWhite = _interopRequireDefault(require("../../../../public/assets/images/logo-white.png"));
|
|
16
|
+
var _logoWbPrimary = _interopRequireDefault(require("../../../../public/assets/images/logo-wb-primary.png"));
|
|
17
|
+
var _logoThlPrimary = _interopRequireDefault(require("../../../../public/assets/images/logo-thl-primary.png"));
|
|
18
|
+
var _logoThPrimary = _interopRequireDefault(require("../../../../public/assets/images/logo-th-primary.png"));
|
|
16
19
|
var _constants__ = require("../../__constants__");
|
|
17
20
|
var _helpers__ = require("../../__helpers__");
|
|
18
21
|
var _useBranchTheme = require("../../__hooks__/useBranchTheme");
|
|
@@ -66,7 +69,7 @@ const FullPageSpinner = _ref => {
|
|
|
66
69
|
className: "fas fa-cog fa-spin"
|
|
67
70
|
}), ' '), children ? children : /*#__PURE__*/_react.default.createElement("img", {
|
|
68
71
|
className: (0, _helpers__.withStyle)('loader__logo'),
|
|
69
|
-
src: theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotive ? _tmLogo.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakcentrum ? _logoThcWhite.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup ? _logoTmgPrimary.default : _logoWhite.default,
|
|
72
|
+
src: theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotive ? _tmLogo.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakcentrum ? _logoThcWhite.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.TowMotiveGroup ? _logoTmgPrimary.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.WestfaliaBenelux ? _logoWbPrimary.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaakland ? _logoThlPrimary.default : theme === _constants__.BRANCH_THEME_BY_FORMULA.Trekhaken ? _logoThPrimary.default : _logoWhite.default,
|
|
70
73
|
alt: "Trekhaak Montage - Configurator"
|
|
71
74
|
}));
|
|
72
75
|
};
|
|
@@ -32,6 +32,7 @@ var _queries = require("../../__api__/queries");
|
|
|
32
32
|
var _constants__ = require("../../__constants__");
|
|
33
33
|
var _AuthSessionContext = require("../../__context__/AuthSessionContext");
|
|
34
34
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
35
|
+
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
35
36
|
var _openingHours = require("../../__helpers__/openingHours");
|
|
36
37
|
var _helpers__ = require("../../__helpers__");
|
|
37
38
|
var _countryOptions = require("../../__helpers__/countryOptions");
|
|
@@ -162,7 +163,7 @@ const customerDetailsFormSchema = (0, _yup.object)({
|
|
|
162
163
|
})
|
|
163
164
|
});
|
|
164
165
|
const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
165
|
-
var _appointment$time$get, _appointment$time, _appointment$time$get2, _appointment$date$get, _appointment$date, _appointment$date$get2, _customer$vatNumber, _customer$kvkNumber, _branchTypes$byId$aut, _authSession$branch,
|
|
166
|
+
var _appointment$time$get, _appointment$time, _appointment$time$get2, _appointment$date$get, _appointment$date, _appointment$date$get2, _customer$vatNumber, _customer$kvkNumber, _branchTypes$byId$aut, _authSession$branch, _ref5, _appointment$date$get3, _appointment$date2, _appointment$date2$ge;
|
|
166
167
|
let {
|
|
167
168
|
errors = {},
|
|
168
169
|
onValidationError,
|
|
@@ -176,6 +177,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
176
177
|
internalNote,
|
|
177
178
|
vehicle,
|
|
178
179
|
webshop,
|
|
180
|
+
singleOrderFormulaCode,
|
|
179
181
|
isTowCenterBranch,
|
|
180
182
|
anderAfleveradres
|
|
181
183
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
@@ -246,6 +248,9 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
246
248
|
}
|
|
247
249
|
}, [openingstijden, appointment === null || appointment === void 0 ? void 0 : appointment.date, dispatch]);
|
|
248
250
|
const authSession = (0, _AuthSessionContext.useAuthSession)();
|
|
251
|
+
const orderFormula = (0, _FormulaContext.useFormula)();
|
|
252
|
+
const activeOrderFormula = singleOrderFormulaCode || orderFormula;
|
|
253
|
+
const isLooseOrderOnly = (0, _constants__.isLooseOrderOnlyFormula)(activeOrderFormula);
|
|
249
254
|
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
250
255
|
const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
|
|
251
256
|
const [isCompanyInputFocused, setIsCompanyInputFocused] = (0, _react.useState)(false);
|
|
@@ -392,7 +397,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
392
397
|
isLoadingBusinessBranches
|
|
393
398
|
} = (0, _queries.useBusinessBranches)({
|
|
394
399
|
searchTerm: companySearchTerm,
|
|
395
|
-
formula:
|
|
400
|
+
formula: activeOrderFormula,
|
|
396
401
|
enabled: isBusinessOwnership
|
|
397
402
|
});
|
|
398
403
|
(0, _react.useEffect)(() => {
|
|
@@ -1019,7 +1024,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
1019
1024
|
isRequired: false,
|
|
1020
1025
|
form: form,
|
|
1021
1026
|
label: "Contact e-mailadres:"
|
|
1022
|
-
}))))))), !webshop && /*#__PURE__*/_react.default.createElement("div", {
|
|
1027
|
+
}))))))), !webshop && !isLooseOrderOnly && /*#__PURE__*/_react.default.createElement("div", {
|
|
1023
1028
|
className: (0, _helpers__.withStyle)('col-12')
|
|
1024
1029
|
}, /*#__PURE__*/_react.default.createElement(_CardWide.default, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
1025
1030
|
className: (0, _helpers__.withStyle)('row')
|
|
@@ -16,6 +16,21 @@ describe('__constants__/formula helpers', () => {
|
|
|
16
16
|
expect((0, _index.getConfiguratorFormulaCode)('tbe')).toBe(_index.CONFIGURATOR_FORMULAS.TBE);
|
|
17
17
|
expect((0, _index.getConfiguratorFormulaCode)('abc')).toBe('ABC');
|
|
18
18
|
});
|
|
19
|
+
it.each([['WB', _index.CONFIGURATOR_FORMULAS.WB], ['Westfalia Benelux', _index.CONFIGURATOR_FORMULAS.WB], ['AzVoLXTpISqiGtVvntWIO', _index.CONFIGURATOR_FORMULAS.WB], ['THL', _index.CONFIGURATOR_FORMULAS.THL], ['Trekhaakland', _index.CONFIGURATOR_FORMULAS.THL], ['FDvtPDAYzUM_kUtlPAhoH', _index.CONFIGURATOR_FORMULAS.THL], ['TH', _index.CONFIGURATOR_FORMULAS.TH], ['Trekhaken.nl', _index.CONFIGURATOR_FORMULAS.TH], ['dRnsTvJGhmmkTrkgmivap', _index.CONFIGURATOR_FORMULAS.TH]])('normalizes %s to %s', (formula, expectedCode) => {
|
|
20
|
+
expect((0, _index.getConfiguratorFormulaCode)(formula)).toBe(expectedCode);
|
|
21
|
+
expect((0, _index.getConfiguratorFormulaCode)({
|
|
22
|
+
entityId: formula
|
|
23
|
+
})).toBe(expectedCode);
|
|
24
|
+
});
|
|
25
|
+
it.each([[_index.CONFIGURATOR_FORMULAS.WB, 'Westfalia Benelux'], [_index.CONFIGURATOR_FORMULAS.THL, 'Trekhaakland'], [_index.CONFIGURATOR_FORMULAS.TH, 'Trekhaken.nl']])('normalizes the %s title and marks it loose-order-only', (formula, title) => {
|
|
26
|
+
expect((0, _index.getConfiguratorFormulaTitle)(formula)).toBe(title);
|
|
27
|
+
expect((0, _index.isLooseOrderOnlyFormula)(formula)).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
it('does not change existing formula normalization', () => {
|
|
30
|
+
expect((0, _index.getConfiguratorFormulaCode)('TM')).toBe(_index.CONFIGURATOR_FORMULAS.TOW);
|
|
31
|
+
expect((0, _index.getConfiguratorFormulaCode)('TowMotive Group')).toBe(_index.CONFIGURATOR_FORMULAS.TMG);
|
|
32
|
+
expect((0, _index.isLooseOrderOnlyFormula)(_index.CONFIGURATOR_FORMULAS.TMG)).toBe(false);
|
|
33
|
+
});
|
|
19
34
|
it('treats TBE as THC-family for theme decisions only', () => {
|
|
20
35
|
expect((0, _index.isThcFamilyFormula)(_index.CONFIGURATOR_FORMULAS.THC)).toBe(true);
|
|
21
36
|
expect((0, _index.isThcFamilyFormula)(_index.CONFIGURATOR_FORMULAS.TBE)).toBe(true);
|
|
@@ -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.normalizeFormulaForOrderApi = 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;
|
|
9
|
+
exports.normalizeFormulaForOrderApi = exports.mapBranchFormulaToConfiguratorFormula = exports.isThcFamilyFormula = exports.isLooseOrderOnlyFormula = exports.getThemeFormulaForConfiguratorFormula = exports.getConfiguratorFormulaTitle = 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.LOOSE_ORDER_ONLY_FORMULAS = 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_FORMULA_TITLES = exports.CONFIGURATOR_FORMULA_ENTITY_IDS = 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");
|
|
@@ -36,19 +36,28 @@ const BRANCH_FORMULAS = exports.BRANCH_FORMULAS = {
|
|
|
36
36
|
Trekhaakcentrum: 'Trekhaakcentrum',
|
|
37
37
|
TowMotiveGroup: 'TowMotive Group',
|
|
38
38
|
TowMotive: 'TowMotive',
|
|
39
|
-
Trekhaakmontage: 'Trekhaakmontage'
|
|
39
|
+
Trekhaakmontage: 'Trekhaakmontage',
|
|
40
|
+
WestfaliaBenelux: 'Westfalia Benelux',
|
|
41
|
+
Trekhaakland: 'Trekhaakland',
|
|
42
|
+
Trekhaken: 'Trekhaken.nl'
|
|
40
43
|
};
|
|
41
44
|
const BRANCH_THEME_BY_FORMULA = exports.BRANCH_THEME_BY_FORMULA = {
|
|
42
45
|
Trekhaakcentrum: 'thc',
|
|
43
46
|
Trekhaakmontage: 'thm',
|
|
44
47
|
TowMotiveGroup: 'tmg',
|
|
45
|
-
TowMotive: 'tm'
|
|
48
|
+
TowMotive: 'tm',
|
|
49
|
+
WestfaliaBenelux: 'wb',
|
|
50
|
+
Trekhaakland: 'thl',
|
|
51
|
+
Trekhaken: 'th'
|
|
46
52
|
};
|
|
47
53
|
const PARTNER_PORTAL_PAGE_TITLES_BY_THEME = exports.PARTNER_PORTAL_PAGE_TITLES_BY_THEME = {
|
|
48
54
|
[BRANCH_THEME_BY_FORMULA.Trekhaakmontage]: 'Trekhaakmontage - Partner Portal',
|
|
49
55
|
[BRANCH_THEME_BY_FORMULA.Trekhaakcentrum]: 'Trekhaakcentrum - Partner Portal',
|
|
50
56
|
[BRANCH_THEME_BY_FORMULA.TowMotiveGroup]: 'TowMotive Group - Partner Portal',
|
|
51
|
-
[BRANCH_THEME_BY_FORMULA.TowMotive]: 'TowMotive - Partner Portal'
|
|
57
|
+
[BRANCH_THEME_BY_FORMULA.TowMotive]: 'TowMotive - Partner Portal',
|
|
58
|
+
[BRANCH_THEME_BY_FORMULA.WestfaliaBenelux]: 'Westfalia Benelux - Partner Portal',
|
|
59
|
+
[BRANCH_THEME_BY_FORMULA.Trekhaakland]: 'Trekhaakland - Partner Portal',
|
|
60
|
+
[BRANCH_THEME_BY_FORMULA.Trekhaken]: 'Trekhaken.nl - Partner Portal'
|
|
52
61
|
};
|
|
53
62
|
const DAY_NAMES = exports.DAY_NAMES = {
|
|
54
63
|
monday: 'Maandag',
|
|
@@ -237,17 +246,29 @@ const CONFIGURATOR_FORMULAS = exports.CONFIGURATOR_FORMULAS = {
|
|
|
237
246
|
TMG: 'TMG',
|
|
238
247
|
TOW: 'TOW',
|
|
239
248
|
TM: 'TOW',
|
|
249
|
+
WB: 'WB',
|
|
240
250
|
THL: 'THL',
|
|
241
251
|
TH: 'TH',
|
|
242
252
|
TowMotive: 'TowMotive'
|
|
243
253
|
};
|
|
254
|
+
const CONFIGURATOR_FORMULA_ENTITY_IDS = exports.CONFIGURATOR_FORMULA_ENTITY_IDS = {
|
|
255
|
+
WB: 'AzVoLXTpISqiGtVvntWIO',
|
|
256
|
+
THL: 'FDvtPDAYzUM_kUtlPAhoH',
|
|
257
|
+
TH: 'dRnsTvJGhmmkTrkgmivap'
|
|
258
|
+
};
|
|
259
|
+
const CONFIGURATOR_FORMULA_TITLES = exports.CONFIGURATOR_FORMULA_TITLES = {
|
|
260
|
+
[CONFIGURATOR_FORMULAS.WB]: 'Westfalia Benelux',
|
|
261
|
+
[CONFIGURATOR_FORMULAS.THL]: 'Trekhaakland',
|
|
262
|
+
[CONFIGURATOR_FORMULAS.TH]: 'Trekhaken.nl'
|
|
263
|
+
};
|
|
264
|
+
const LOOSE_ORDER_ONLY_FORMULAS = exports.LOOSE_ORDER_ONLY_FORMULAS = [CONFIGURATOR_FORMULAS.WB, CONFIGURATOR_FORMULAS.THL, CONFIGURATOR_FORMULAS.TH];
|
|
244
265
|
const normalizeFormulaInput = formula => {
|
|
245
266
|
if (formula == null) {
|
|
246
267
|
return null;
|
|
247
268
|
}
|
|
248
269
|
if (typeof formula === 'object') {
|
|
249
|
-
var _ref, _ref2, _ref3, _formula$code;
|
|
250
|
-
return normalizeFormulaInput((_ref = (_ref2 = (_ref3 = (_formula$code = formula === null || formula === void 0 ? void 0 : formula.code) !== null && _formula$code !== void 0 ? _formula$code : formula === null || formula === void 0 ? void 0 : formula.title) !== null && _ref3 !== void 0 ? _ref3 : formula === null || formula === void 0 ? void 0 : formula.formulaCode) !== null && _ref2 !== void 0 ? _ref2 : formula === null || formula === void 0 ? void 0 : formula.formule) !== null && _ref !== void 0 ? _ref : null);
|
|
270
|
+
var _ref, _ref2, _ref3, _ref4, _formula$code;
|
|
271
|
+
return normalizeFormulaInput((_ref = (_ref2 = (_ref3 = (_ref4 = (_formula$code = formula === null || formula === void 0 ? void 0 : formula.code) !== null && _formula$code !== void 0 ? _formula$code : formula === null || formula === void 0 ? void 0 : formula.title) !== null && _ref4 !== void 0 ? _ref4 : formula === null || formula === void 0 ? void 0 : formula.entityId) !== null && _ref3 !== void 0 ? _ref3 : formula === null || formula === void 0 ? void 0 : formula.formulaCode) !== null && _ref2 !== void 0 ? _ref2 : formula === null || formula === void 0 ? void 0 : formula.formule) !== null && _ref !== void 0 ? _ref : null);
|
|
251
272
|
}
|
|
252
273
|
if (typeof formula !== 'string') {
|
|
253
274
|
return null;
|
|
@@ -279,7 +300,6 @@ const getConfiguratorFormulaCode = formula => {
|
|
|
279
300
|
switch (normalizedFormula.toLowerCase()) {
|
|
280
301
|
case 'tow':
|
|
281
302
|
case 'tm':
|
|
282
|
-
case 'th':
|
|
283
303
|
case 'towmotive':
|
|
284
304
|
return CONFIGURATOR_FORMULAS.TOW;
|
|
285
305
|
case 'tmg':
|
|
@@ -295,11 +315,32 @@ const getConfiguratorFormulaCode = formula => {
|
|
|
295
315
|
case 'thm':
|
|
296
316
|
case 'trekhaakmontage':
|
|
297
317
|
return CONFIGURATOR_FORMULAS.THM;
|
|
318
|
+
case 'wb':
|
|
319
|
+
case 'westfalia benelux':
|
|
320
|
+
case 'azvolxtpisqigtvvntwio':
|
|
321
|
+
return CONFIGURATOR_FORMULAS.WB;
|
|
322
|
+
case 'thl':
|
|
323
|
+
case 'trekhaakland':
|
|
324
|
+
case 'fdvtpdayzum_kutlpahoh':
|
|
325
|
+
return CONFIGURATOR_FORMULAS.THL;
|
|
326
|
+
case 'th':
|
|
327
|
+
case 'trekhaken':
|
|
328
|
+
case 'trekhaken.nl':
|
|
329
|
+
case 'drnstvjghmmktrkgmivap':
|
|
330
|
+
return CONFIGURATOR_FORMULAS.TH;
|
|
298
331
|
default:
|
|
299
332
|
return normalizedFormula.includes(' ') ? normalizedFormula : normalizedFormula.toUpperCase();
|
|
300
333
|
}
|
|
301
334
|
};
|
|
302
335
|
exports.getConfiguratorFormulaCode = getConfiguratorFormulaCode;
|
|
336
|
+
const getConfiguratorFormulaTitle = formula => {
|
|
337
|
+
var _CONFIGURATOR_FORMULA;
|
|
338
|
+
const normalizedFormula = getConfiguratorFormulaCode(formula);
|
|
339
|
+
return (_CONFIGURATOR_FORMULA = CONFIGURATOR_FORMULA_TITLES[normalizedFormula]) !== null && _CONFIGURATOR_FORMULA !== void 0 ? _CONFIGURATOR_FORMULA : normalizedFormula;
|
|
340
|
+
};
|
|
341
|
+
exports.getConfiguratorFormulaTitle = getConfiguratorFormulaTitle;
|
|
342
|
+
const isLooseOrderOnlyFormula = formula => LOOSE_ORDER_ONLY_FORMULAS.includes(getConfiguratorFormulaCode(formula));
|
|
343
|
+
exports.isLooseOrderOnlyFormula = isLooseOrderOnlyFormula;
|
|
303
344
|
const isThcFamilyFormula = formula => {
|
|
304
345
|
const normalizedFormula = getConfiguratorFormulaCode(formula);
|
|
305
346
|
return normalizedFormula === CONFIGURATOR_FORMULAS.THC || normalizedFormula === CONFIGURATOR_FORMULAS.TBE;
|
|
@@ -109,7 +109,8 @@ const ProductCartSide = () => {
|
|
|
109
109
|
montageRate,
|
|
110
110
|
extraPriceAmount,
|
|
111
111
|
discountCode,
|
|
112
|
-
priceCalculationDate
|
|
112
|
+
priceCalculationDate,
|
|
113
|
+
skipFilters
|
|
113
114
|
} = order;
|
|
114
115
|
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
115
116
|
const isTowmotive = (0, _useIsTowmotive.useIsTowmotive)();
|
|
@@ -128,7 +129,9 @@ const ProductCartSide = () => {
|
|
|
128
129
|
consumerDiscounts,
|
|
129
130
|
touchedConsumerDiscounts
|
|
130
131
|
});
|
|
131
|
-
|
|
132
|
+
// Use the session skipFilters so this query matches the product page's;
|
|
133
|
+
// an unfiltered request can return a different catalogue than the page.
|
|
134
|
+
const shouldRequestUnfilteredProducts = skipFilters || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
|
|
132
135
|
const {
|
|
133
136
|
cart,
|
|
134
137
|
totals,
|
|
@@ -280,7 +280,8 @@ const ProductCartTable = () => {
|
|
|
280
280
|
touchedConsumerDiscounts,
|
|
281
281
|
montageRate,
|
|
282
282
|
isMontageTariffFixed,
|
|
283
|
-
extraPriceAmount
|
|
283
|
+
extraPriceAmount,
|
|
284
|
+
skipFilters
|
|
284
285
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
285
286
|
|
|
286
287
|
// Determine display mode
|
|
@@ -354,10 +355,9 @@ const ProductCartTable = () => {
|
|
|
354
355
|
consumerDiscounts,
|
|
355
356
|
touchedConsumerDiscounts
|
|
356
357
|
});
|
|
357
|
-
//
|
|
358
|
-
//
|
|
359
|
-
|
|
360
|
-
const shouldRequestUnfilteredProducts = (0, _product.shouldRequestUnfilteredProductsForCart)(cartInput) || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
|
|
358
|
+
// Use the session skipFilters so this query matches the product page's;
|
|
359
|
+
// an unfiltered request can return a different catalogue than the page.
|
|
360
|
+
const shouldRequestUnfilteredProducts = skipFilters || Boolean(existingDossierId && (allArticleNumbers === null || allArticleNumbers === void 0 ? void 0 : allArticleNumbers.length) > 0);
|
|
361
361
|
const durationAnswerForQuery = durationAnswerIsPrefilled ? undefined : durationAnswer;
|
|
362
362
|
const {
|
|
363
363
|
cart,
|
|
@@ -456,6 +456,7 @@ const ProductsOverview = () => {
|
|
|
456
456
|
})
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
|
+
const towbarOrientation = !APP_CONFIG.internal && (productCategory === _constants__.PRODUCT_CATEGORIES.TOWBAR || productCategory === _constants__.PRODUCT_CATEGORIES.COMBISET) ? (0, _product.getDetachableTowbarOrientation)(product === null || product === void 0 ? void 0 : product.subgroupName) : null;
|
|
459
460
|
return /*#__PURE__*/_react.default.createElement(_ProductCard.default, {
|
|
460
461
|
isTmg: isTmg,
|
|
461
462
|
stock: (_product$consumerPric = product === null || product === void 0 || (_product$consumerPric2 = product.consumerPrices) === null || _product$consumerPric2 === void 0 ? void 0 : _product$consumerPric2.stock) !== null && _product$consumerPric !== void 0 ? _product$consumerPric : product === null || product === void 0 || (_product$locationPric = product.locationPrices) === null || _product$locationPric === void 0 ? void 0 : _product$locationPric.stock,
|
|
@@ -463,7 +464,8 @@ const ProductsOverview = () => {
|
|
|
463
464
|
hasCheckbox: (productsPerCategory === null || productsPerCategory === void 0 ? void 0 : productsPerCategory.length) > 1,
|
|
464
465
|
isRecommended: isRecommended,
|
|
465
466
|
productId: product === null || product === void 0 ? void 0 : product.articleNumber,
|
|
466
|
-
productTitle: product === null || product === void 0 ? void 0 : product.subgroupName,
|
|
467
|
+
productTitle: towbarOrientation ? (0, _product.getTowbarInfoTitle)(product === null || product === void 0 ? void 0 : product.subgroupName) : product === null || product === void 0 ? void 0 : product.subgroupName,
|
|
468
|
+
productOrientation: towbarOrientation,
|
|
467
469
|
productDescription: product === null || product === void 0 ? void 0 : product.productDescription,
|
|
468
470
|
productUsps: [{
|
|
469
471
|
type: 'excl',
|
|
@@ -30,6 +30,7 @@ var _DropdownInput = _interopRequireDefault(require("../../__components__/Form/D
|
|
|
30
30
|
var _Modal = _interopRequireDefault(require("../../__components__/Modal"));
|
|
31
31
|
var _FullPageSpinner = _interopRequireDefault(require("../../__components__/Spinners/FullPageSpinner"));
|
|
32
32
|
var _constants__ = require("../../__constants__");
|
|
33
|
+
var _singleOrderWebshop = require("../../__helpers__/singleOrderWebshop");
|
|
33
34
|
var _FormulaContext = require("../../__context__/FormulaContext");
|
|
34
35
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
35
36
|
var _helpers__ = require("../../__helpers__");
|
|
@@ -209,6 +210,15 @@ const SingleOrderModalContent = _ref6 => {
|
|
|
209
210
|
} = (0, _queries.useBranchTypes)();
|
|
210
211
|
const [singleOrderBranchType, setSingleOrderBranchType] = (0, _react.useState)();
|
|
211
212
|
const [selectedBranchId, setLocalBranchId] = (0, _react.useState)();
|
|
213
|
+
const normalizedFormula = (0, _constants__.getConfiguratorFormulaCode)(formula);
|
|
214
|
+
const shouldShowBranchTypeSelector = (0, _singleOrderBranchSelector.shouldShowSingleOrderBranchTypeSelector)({
|
|
215
|
+
isTmgOrganization: isTMGOrganization,
|
|
216
|
+
formula: normalizedFormula
|
|
217
|
+
});
|
|
218
|
+
const previousDependenciesRef = (0, _react.useRef)({
|
|
219
|
+
formula: normalizedFormula,
|
|
220
|
+
branchTypeId: singleOrderBranchType
|
|
221
|
+
});
|
|
212
222
|
const {
|
|
213
223
|
singleOrderBranchTypes,
|
|
214
224
|
isLoadingSingleOrderBranchTypes
|
|
@@ -217,17 +227,41 @@ const SingleOrderModalContent = _ref6 => {
|
|
|
217
227
|
singleOrderBranches,
|
|
218
228
|
isLoadingSingleOrderBranches
|
|
219
229
|
} = (0, _queries.useSingleOrderBranchesQuery)({
|
|
220
|
-
branchTypeId:
|
|
221
|
-
|
|
230
|
+
branchTypeId: (0, _singleOrderBranchSelector.getSingleOrderBranchTypeId)({
|
|
231
|
+
isTmgOrganization: isTMGOrganization,
|
|
232
|
+
formula: normalizedFormula,
|
|
233
|
+
selectedBranchTypeId: singleOrderBranchType
|
|
234
|
+
}),
|
|
235
|
+
formula: normalizedFormula,
|
|
222
236
|
limit: 500,
|
|
223
237
|
offset: 0
|
|
224
238
|
});
|
|
225
|
-
|
|
239
|
+
(0, _react.useEffect)(() => {
|
|
240
|
+
const previousDependencies = previousDependenciesRef.current;
|
|
241
|
+
if ((0, _singleOrderBranchSelector.shouldResetSingleOrderBranchSelection)({
|
|
242
|
+
previousFormula: previousDependencies.formula,
|
|
243
|
+
formula: normalizedFormula,
|
|
244
|
+
previousBranchTypeId: previousDependencies.branchTypeId,
|
|
245
|
+
branchTypeId: singleOrderBranchType
|
|
246
|
+
})) {
|
|
247
|
+
setSelectedBranchId(undefined);
|
|
248
|
+
setLocalBranchId(undefined);
|
|
249
|
+
dispatch({
|
|
250
|
+
type: _OrderSessionContext.orderSessionActions.SET_SINGLE_ORDER_FORMULA_CODE,
|
|
251
|
+
payload: {
|
|
252
|
+
formulaCode: null
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
previousDependenciesRef.current = {
|
|
257
|
+
formula: normalizedFormula,
|
|
258
|
+
branchTypeId: singleOrderBranchType
|
|
259
|
+
};
|
|
260
|
+
}, [dispatch, normalizedFormula, setSelectedBranchId, singleOrderBranchType]);
|
|
226
261
|
const filteredBranches = _react.default.useMemo(() => {
|
|
227
|
-
if (
|
|
262
|
+
if (normalizedFormula === _constants__.CONFIGURATOR_FORMULAS.TMG || !singleOrderBranches) {
|
|
228
263
|
return singleOrderBranches;
|
|
229
264
|
}
|
|
230
|
-
const normalizedFormula = (0, _constants__.getConfiguratorFormulaCode)(formula);
|
|
231
265
|
return singleOrderBranches.filter(branch => {
|
|
232
266
|
var _ref7, _branch$formulaCode, _branch$formule;
|
|
233
267
|
const branchFormula = (0, _constants__.getConfiguratorFormulaCode)((_ref7 = (_branch$formulaCode = branch === null || branch === void 0 ? void 0 : branch.formulaCode) !== null && _branch$formulaCode !== void 0 ? _branch$formulaCode : branch === null || branch === void 0 || (_branch$formule = branch.formule) === null || _branch$formule === void 0 ? void 0 : _branch$formule.code) !== null && _ref7 !== void 0 ? _ref7 : branch === null || branch === void 0 ? void 0 : branch.formule);
|
|
@@ -236,23 +270,23 @@ const SingleOrderModalContent = _ref6 => {
|
|
|
236
270
|
}
|
|
237
271
|
return branchFormula === normalizedFormula;
|
|
238
272
|
});
|
|
239
|
-
}, [singleOrderBranches,
|
|
273
|
+
}, [singleOrderBranches, normalizedFormula]);
|
|
240
274
|
const branchIdWithFormulaCode = new Map();
|
|
241
275
|
filteredBranches === null || filteredBranches === void 0 || filteredBranches.forEach(branch => {
|
|
242
276
|
var _getConfiguratorFormu, _ref8, _branch$formulaCode2, _branch$formule2;
|
|
243
|
-
branchIdWithFormulaCode.set(branch === null || branch === void 0 ? void 0 : branch.entityId, (_getConfiguratorFormu = (0, _constants__.getConfiguratorFormulaCode)((_ref8 = (_branch$formulaCode2 = branch === null || branch === void 0 ? void 0 : branch.formulaCode) !== null && _branch$formulaCode2 !== void 0 ? _branch$formulaCode2 : branch === null || branch === void 0 || (_branch$formule2 = branch.formule) === null || _branch$formule2 === void 0 ? void 0 : _branch$formule2.code) !== null && _ref8 !== void 0 ? _ref8 : branch === null || branch === void 0 ? void 0 : branch.formule)) !== null && _getConfiguratorFormu !== void 0 ? _getConfiguratorFormu :
|
|
277
|
+
branchIdWithFormulaCode.set(branch === null || branch === void 0 ? void 0 : branch.entityId, (_getConfiguratorFormu = (0, _constants__.getConfiguratorFormulaCode)((_ref8 = (_branch$formulaCode2 = branch === null || branch === void 0 ? void 0 : branch.formulaCode) !== null && _branch$formulaCode2 !== void 0 ? _branch$formulaCode2 : branch === null || branch === void 0 || (_branch$formule2 = branch.formule) === null || _branch$formule2 === void 0 ? void 0 : _branch$formule2.code) !== null && _ref8 !== void 0 ? _ref8 : branch === null || branch === void 0 ? void 0 : branch.formule)) !== null && _getConfiguratorFormu !== void 0 ? _getConfiguratorFormu : normalizedFormula);
|
|
244
278
|
});
|
|
245
279
|
const branchOptions = filteredBranches === null || filteredBranches === void 0 ? void 0 : filteredBranches.map(branch => ({
|
|
246
|
-
label:
|
|
280
|
+
label: (0, _singleOrderBranchSelector.getSingleOrderBranchOptionLabel)(branch),
|
|
247
281
|
value: branch === null || branch === void 0 ? void 0 : branch.entityId
|
|
248
282
|
}));
|
|
249
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null,
|
|
283
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, shouldShowBranchTypeSelector && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
250
284
|
options: singleOrderBranchTypes === null || singleOrderBranchTypes === void 0 ? void 0 : singleOrderBranchTypes.map(branchType => ({
|
|
251
285
|
label: branchType === null || branchType === void 0 ? void 0 : branchType.title,
|
|
252
286
|
value: branchType === null || branchType === void 0 ? void 0 : branchType.entityId
|
|
253
287
|
})),
|
|
254
|
-
name: "
|
|
255
|
-
label: "
|
|
288
|
+
name: "branchType",
|
|
289
|
+
label: "Organisatietype:",
|
|
256
290
|
isRequired: true,
|
|
257
291
|
isLoading: isLoadingSingleOrderBranchTypes,
|
|
258
292
|
noOptionsMessage: "Geen opties beschikbaar",
|
|
@@ -260,14 +294,13 @@ const SingleOrderModalContent = _ref6 => {
|
|
|
260
294
|
initialValue: singleOrderBranchType,
|
|
261
295
|
onChange: _ref9 => {
|
|
262
296
|
let {
|
|
263
|
-
label,
|
|
264
297
|
value
|
|
265
298
|
} = _ref9;
|
|
266
299
|
setSingleOrderBranchType(value);
|
|
267
300
|
setSelectedBranchId(undefined);
|
|
268
301
|
setLocalBranchId(undefined);
|
|
269
302
|
}
|
|
270
|
-
}), (
|
|
303
|
+
}), (!shouldShowBranchTypeSelector || singleOrderBranchType) && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
271
304
|
options: branchOptions,
|
|
272
305
|
name: "branch",
|
|
273
306
|
label: "Vestiging:",
|
|
@@ -312,6 +345,7 @@ const InternalBranchSelectorModal = () => {
|
|
|
312
345
|
const [isDismissed, setIsDismissed] = (0, _react.useState)(false);
|
|
313
346
|
const isSingleOrderPage = (0, _useIsSingleOrder.default)();
|
|
314
347
|
const formula = (0, _FormulaContext.useFormula)();
|
|
348
|
+
const previousFormulaRef = (0, _react.useRef)(formula);
|
|
315
349
|
const isTMGOrganization = (0, _useIsTmg.useIsTmg)();
|
|
316
350
|
(0, _react.useEffect)(() => {
|
|
317
351
|
_setSelectedBranchId(undefined);
|
|
@@ -321,12 +355,36 @@ const InternalBranchSelectorModal = () => {
|
|
|
321
355
|
selectedBranch,
|
|
322
356
|
existingDossierId,
|
|
323
357
|
orderType,
|
|
358
|
+
webshop,
|
|
324
359
|
licensePlate,
|
|
325
360
|
model,
|
|
326
361
|
singleOrderFlowRevision
|
|
327
362
|
}, dispatch] = (0, _OrderSessionContext.useOrderSession)();
|
|
363
|
+
const defaultWebshop = (0, _singleOrderWebshop.getWebshopForFormula)(formula);
|
|
328
364
|
const previousSelectedBranchRef = (0, _react.useRef)(selectedBranch);
|
|
329
365
|
const previousLocationKeyRef = (0, _react.useRef)(location.key);
|
|
366
|
+
(0, _react.useEffect)(() => {
|
|
367
|
+
if ((0, _singleOrderBranchSelector.shouldResetSingleOrderBranchSelection)({
|
|
368
|
+
previousFormula: previousFormulaRef.current,
|
|
369
|
+
formula
|
|
370
|
+
})) {
|
|
371
|
+
_setSelectedBranchId(undefined);
|
|
372
|
+
setIsDismissed(false);
|
|
373
|
+
dispatch({
|
|
374
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
375
|
+
payload: {
|
|
376
|
+
branchId: null
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
dispatch({
|
|
380
|
+
type: _OrderSessionContext.orderSessionActions.SET_SINGLE_ORDER_FORMULA_CODE,
|
|
381
|
+
payload: {
|
|
382
|
+
formulaCode: null
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
previousFormulaRef.current = formula;
|
|
387
|
+
}, [dispatch, formula]);
|
|
330
388
|
const {
|
|
331
389
|
myBranches,
|
|
332
390
|
isLoadingMyBranches
|
|
@@ -334,6 +392,26 @@ const InternalBranchSelectorModal = () => {
|
|
|
334
392
|
const {
|
|
335
393
|
branchById
|
|
336
394
|
} = (0, _queries.useBranchByIdOrWidgetId)(selectedBranch);
|
|
395
|
+
(0, _react.useEffect)(() => {
|
|
396
|
+
if (!isSingleOrderPage || !defaultWebshop) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (webshop === defaultWebshop && orderType === _OrderTypeSelectorModal.ORDER_TYPES.ONLINE) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
dispatch({
|
|
403
|
+
type: _OrderSessionContext.orderSessionActions.SET_WEBSHOP,
|
|
404
|
+
payload: {
|
|
405
|
+
webshop: defaultWebshop
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
dispatch({
|
|
409
|
+
type: _OrderSessionContext.orderSessionActions.SET_ORDER_TYPE,
|
|
410
|
+
payload: {
|
|
411
|
+
orderType: _OrderTypeSelectorModal.ORDER_TYPES.ONLINE
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
}, [defaultWebshop, dispatch, isSingleOrderPage, orderType, webshop]);
|
|
337
415
|
const shouldResolveMyBranchesBeforeOpening = APP_CONFIG.internal && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization && !isDismissed;
|
|
338
416
|
const shouldAutoSelectSingleMyBranch = shouldResolveMyBranchesBeforeOpening && !isLoadingMyBranches && (myBranches === null || myBranches === void 0 ? void 0 : myBranches.length) === 1;
|
|
339
417
|
const shouldWaitForMyBranchResolution = shouldResolveMyBranchesBeforeOpening && (isLoadingMyBranches || shouldAutoSelectSingleMyBranch);
|
|
@@ -391,7 +469,12 @@ const InternalBranchSelectorModal = () => {
|
|
|
391
469
|
}
|
|
392
470
|
});
|
|
393
471
|
};
|
|
394
|
-
const shouldShowModalForSingleOrder = APP_CONFIG.internal &&
|
|
472
|
+
const shouldShowModalForSingleOrder = APP_CONFIG.internal && (0, _singleOrderBranchSelector.shouldOpenSingleOrderCustomerSelector)({
|
|
473
|
+
isSingleOrderPage,
|
|
474
|
+
selectedBranch,
|
|
475
|
+
existingDossierId,
|
|
476
|
+
isDismissed
|
|
477
|
+
});
|
|
395
478
|
const shouldShowModalForOtherPages = APP_CONFIG.internal && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization && !shouldWaitForMyBranchResolution && !isDismissed;
|
|
396
479
|
|
|
397
480
|
// Show loading state only when we actually need to show the modal
|
|
@@ -418,13 +501,13 @@ const InternalBranchSelectorModal = () => {
|
|
|
418
501
|
className: "ms-3"
|
|
419
502
|
}, "Vestigingen laden..."));
|
|
420
503
|
}
|
|
421
|
-
if ((shouldShowModalForSingleOrder || shouldShowModalForOtherPages) && isTMGOrganization && formula === _constants__.CONFIGURATOR_FORMULAS.TMG && !orderType) {
|
|
504
|
+
if ((shouldShowModalForSingleOrder || shouldShowModalForOtherPages) && isTMGOrganization && formula === _constants__.CONFIGURATOR_FORMULAS.TMG && !orderType && !defaultWebshop) {
|
|
422
505
|
return /*#__PURE__*/_react.default.createElement(_OrderTypeSelectorModal.default, {
|
|
423
506
|
isOpen: true
|
|
424
507
|
});
|
|
425
508
|
}
|
|
426
509
|
return /*#__PURE__*/_react.default.createElement(_Modal.default, {
|
|
427
|
-
isOpen:
|
|
510
|
+
isOpen: shouldShowModalForSingleOrder || shouldShowModalForOtherPages,
|
|
428
511
|
title: 'Kies een vestiging:',
|
|
429
512
|
size: "wide",
|
|
430
513
|
hasSecondaryButton: false,
|