thm-p3-configurator 0.0.253 → 0.0.254
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/App.js
CHANGED
|
@@ -29,7 +29,6 @@ var _TEST_ONLY_INTERNAL_ROUTES = _interopRequireDefault(require("./__pages__/int
|
|
|
29
29
|
var _Experiments = _interopRequireDefault(require("./__services__/Experiments"));
|
|
30
30
|
var _mainExternal = _interopRequireDefault(require("./__style__/main-external.scss"));
|
|
31
31
|
var _main = _interopRequireDefault(require("./__style__/main.scss"));
|
|
32
|
-
var _index = _interopRequireDefault(require("./__pages__/index"));
|
|
33
32
|
function _interopRequireDefault(e) {
|
|
34
33
|
return e && e.__esModule ? e : {
|
|
35
34
|
default: e
|
|
@@ -70,7 +69,7 @@ const App = () => {
|
|
|
70
69
|
(0, _Experiments.default)();
|
|
71
70
|
});
|
|
72
71
|
return /*#__PURE__*/_react.default.createElement(_SentryWrapper.default, null, /*#__PURE__*/_react.default.createElement(_FormulaContext.FormulaController, {
|
|
73
|
-
defaultFormula: _constants__.CONFIGURATOR_FORMULAS.
|
|
72
|
+
defaultFormula: _constants__.CONFIGURATOR_FORMULAS.TOW
|
|
74
73
|
}, /*#__PURE__*/_react.default.createElement(_CountryContext.CountryController, {
|
|
75
74
|
defaultCountry: APP_CONFIG.country
|
|
76
75
|
}, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
|
|
@@ -24,12 +24,14 @@ const FORM_ERROR_MESSAGES = exports.FORM_ERROR_MESSAGES = {
|
|
|
24
24
|
const BRANCH_FORMULAS = exports.BRANCH_FORMULAS = {
|
|
25
25
|
Trekhaakcentrum: 'Trekhaakcentrum',
|
|
26
26
|
TowMotiveGroup: 'TowMotive Group',
|
|
27
|
+
TowMotive: 'TowMotive',
|
|
27
28
|
Trekhaakmontage: 'Trekhaakmontage'
|
|
28
29
|
};
|
|
29
30
|
const BRANCH_THEME_BY_FORMULA = exports.BRANCH_THEME_BY_FORMULA = {
|
|
30
31
|
Trekhaakcentrum: 'thc',
|
|
31
32
|
Trekhaakmontage: 'thm',
|
|
32
|
-
TowMotiveGroup: 'tmg'
|
|
33
|
+
TowMotiveGroup: 'tmg',
|
|
34
|
+
TowMotive: 'tmg'
|
|
33
35
|
};
|
|
34
36
|
const PARTNER_PORTAL_PAGE_TITLES_BY_THEME = exports.PARTNER_PORTAL_PAGE_TITLES_BY_THEME = {
|
|
35
37
|
[BRANCH_THEME_BY_FORMULA.Trekhaakmontage]: 'Trekhaakmontage - Partner Portal',
|
|
@@ -213,7 +215,8 @@ const CONFIGURATOR_FORMULAS = exports.CONFIGURATOR_FORMULAS = {
|
|
|
213
215
|
THM: 'THM',
|
|
214
216
|
THC: 'THC',
|
|
215
217
|
TMG: 'TMG',
|
|
216
|
-
|
|
218
|
+
TOW: 'TOW',
|
|
219
|
+
TM: 'TOW',
|
|
217
220
|
TH: 'TH',
|
|
218
221
|
TowMotive: 'TowMotive'
|
|
219
222
|
};
|
|
@@ -239,14 +242,14 @@ const NO_PRODUCTS_CONTACT_DETAILS_BY_FORMULA = exports.NO_PRODUCTS_CONTACT_DETAI
|
|
|
239
242
|
companyName: 'TowMotive Group',
|
|
240
243
|
logoAltText: 'TowMotive Group Logo'
|
|
241
244
|
},
|
|
242
|
-
[CONFIGURATOR_FORMULAS.
|
|
245
|
+
[CONFIGURATOR_FORMULAS.TOW]: {
|
|
243
246
|
email: 'order@towmotivegroup.com',
|
|
244
247
|
phoneDisplay: '+31 85 - 203 0167',
|
|
245
248
|
phoneHref: 'tel:+31852030167',
|
|
246
249
|
companyName: 'TowMotive Group',
|
|
247
250
|
logoAltText: 'TowMotive Group Logo'
|
|
248
251
|
},
|
|
249
|
-
[CONFIGURATOR_FORMULAS.
|
|
252
|
+
[CONFIGURATOR_FORMULAS.TH]: {
|
|
250
253
|
email: 'order@towmotivegroup.com',
|
|
251
254
|
phoneDisplay: '+31 85 - 203 0167',
|
|
252
255
|
phoneHref: 'tel:+31852030167',
|
|
@@ -263,10 +266,12 @@ const TMG_ORGANIZATION_TYPE = exports.TMG_ORGANIZATION_TYPE = 'TowMotive Group';
|
|
|
263
266
|
const mapBranchFormulaToConfiguratorFormula = branchFormula => {
|
|
264
267
|
if (!branchFormula) return CONFIGURATOR_FORMULAS.THM;
|
|
265
268
|
switch (branchFormula.toLowerCase()) {
|
|
266
|
-
case '
|
|
269
|
+
case 'tow':
|
|
270
|
+
case 'tm':
|
|
267
271
|
case 'th':
|
|
268
|
-
return CONFIGURATOR_FORMULAS.
|
|
272
|
+
return CONFIGURATOR_FORMULAS.TOW;
|
|
269
273
|
case 'tmg':
|
|
274
|
+
case 'towmotive group':
|
|
270
275
|
return CONFIGURATOR_FORMULAS.TMG;
|
|
271
276
|
case 'thc':
|
|
272
277
|
return CONFIGURATOR_FORMULAS.THC;
|
|
@@ -256,9 +256,21 @@ const InternalBranchSelectorModal = () => {
|
|
|
256
256
|
isLoadingMyBranches
|
|
257
257
|
} = (0, _queries.useMyBranches)(formula);
|
|
258
258
|
const shouldAutoSelect = _react.default.useMemo(() => {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
return !existingDossierId && !isTMGOrganization && !selectedBranch && (myBranches === null || myBranches === void 0 ? void 0 : myBranches.length) === 1 && !isLoadingMyBranches;
|
|
260
|
+
}, [existingDossierId, isTMGOrganization, selectedBranch, myBranches, isLoadingMyBranches]);
|
|
261
|
+
(0, _react.useEffect)(() => {
|
|
262
|
+
var _myBranches$;
|
|
263
|
+
if (!shouldAutoSelect) return;
|
|
264
|
+
const onlyBranchId = myBranches === null || myBranches === void 0 || (_myBranches$ = myBranches[0]) === null || _myBranches$ === void 0 ? void 0 : _myBranches$.entityId;
|
|
265
|
+
if (!onlyBranchId) return;
|
|
266
|
+
dispatch({
|
|
267
|
+
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
268
|
+
payload: {
|
|
269
|
+
branchId: onlyBranchId
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
_setSelectedBranchId(onlyBranchId);
|
|
273
|
+
}, [shouldAutoSelect, myBranches, dispatch]);
|
|
262
274
|
const handlePrimaryButtonClicked = () => {
|
|
263
275
|
dispatch({
|
|
264
276
|
type: _OrderSessionContext.orderSessionActions.SET_SELECTED_BRANCH,
|
|
@@ -267,13 +279,18 @@ const InternalBranchSelectorModal = () => {
|
|
|
267
279
|
}
|
|
268
280
|
});
|
|
269
281
|
};
|
|
270
|
-
const shouldShowModalForSingleOrder = APP_CONFIG.internal && !selectedBranch && !existingDossierId && isSingleOrderPage;
|
|
282
|
+
const shouldShowModalForSingleOrder = APP_CONFIG.internal && !selectedBranch && !existingDossierId && isSingleOrderPage && !shouldAutoSelect;
|
|
271
283
|
const shouldShowModalForOtherPages = APP_CONFIG.internal && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization && !shouldAutoSelect && !isLoadingMyBranches;
|
|
272
284
|
if (isLoadingBranchTypes || isLoadingMyBranches) {
|
|
273
285
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
274
286
|
className: "thm-configurator-wrapper--offset"
|
|
275
287
|
}, /*#__PURE__*/_react.default.createElement(_FullPageSpinner.default, null));
|
|
276
288
|
}
|
|
289
|
+
|
|
290
|
+
// Skip modal entirely when auto-selecting the single available branch
|
|
291
|
+
if (shouldAutoSelect) {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
277
294
|
if ((shouldShowModalForSingleOrder || shouldShowModalForOtherPages) && isTMGOrganization && formula === _constants__.CONFIGURATOR_FORMULAS.TMG && !orderType) {
|
|
278
295
|
return /*#__PURE__*/_react.default.createElement(_OrderTypeSelectorModal.default, {
|
|
279
296
|
isOpen: true
|
|
@@ -50,6 +50,7 @@ const useBranchTheme = () => {
|
|
|
50
50
|
}
|
|
51
51
|
case _constants__.BRANCH_FORMULAS.TowMotiveGroup:
|
|
52
52
|
case _constants__.CONFIGURATOR_FORMULAS.TMG:
|
|
53
|
+
case _constants__.CONFIGURATOR_FORMULAS.TOW:
|
|
53
54
|
case _constants__.CONFIGURATOR_FORMULAS.TH:
|
|
54
55
|
case _constants__.CONFIGURATOR_FORMULAS.TowMotive:
|
|
55
56
|
{
|