thm-p3-configurator 0.0.233 → 0.0.235
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 +1 -1
- package/dist/src/shared/__api__/queries.js +5 -1
- package/dist/src/shared/__components__/internal/InternalCustomerDetailsForm.js +39 -5
- package/dist/src/shared/__constants__/index.js +3 -2
- package/dist/src/shared/__containers__/ProductsCartOverview.js +0 -6
- package/dist/src/shared/__containers__/VehicleData.js +3 -2
- package/dist/src/shared/__containers__/internal/InternalAppointmentForm.js +28 -6
- package/dist/src/shared/__containers__/internal/InternalQuotationForm.js +34 -10
- package/dist/src/shared/__helpers__/index.js +13 -1
- package/package.json +1 -1
package/dist/src/shared/App.js
CHANGED
|
@@ -75,6 +75,6 @@ const App = () => {
|
|
|
75
75
|
defaultCountry: APP_CONFIG.country
|
|
76
76
|
}, /*#__PURE__*/_react.default.createElement(_OrderSessionContext.OrderSessionController, null, /*#__PURE__*/_react.default.createElement(_reactQuery.QueryClientProvider, {
|
|
77
77
|
client: _queryClient.default
|
|
78
|
-
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactHotLoader.AppContainer, null, /*#__PURE__*/_react.default.createElement(_ActiveMarkerContext.ActiveMarkerProvider, null, /*#__PURE__*/_react.default.createElement(_StyleWrapper.default, null, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_Navbar.default, null), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalBranchSelectorModal.default, null), /*#__PURE__*/_react.default.createElement(
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_reactHotLoader.AppContainer, null, /*#__PURE__*/_react.default.createElement(_ActiveMarkerContext.ActiveMarkerProvider, null, /*#__PURE__*/_react.default.createElement(_StyleWrapper.default, null, !APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_Navbar.default, null), APP_CONFIG.internal && /*#__PURE__*/_react.default.createElement(_InternalBranchSelectorModal.default, null), APP_CONFIG.nodeEnv === 'development' && APP_CONFIG.internal === true && /*#__PURE__*/_react.default.createElement(_TEST_ONLY_INTERNAL_ROUTES.default, null))))))))));
|
|
79
79
|
};
|
|
80
80
|
var _default = exports.default = App;
|
|
@@ -225,7 +225,11 @@ const useModelsQuery = _ref2 => {
|
|
|
225
225
|
formula
|
|
226
226
|
}).then(res => {
|
|
227
227
|
var _res$data3;
|
|
228
|
-
|
|
228
|
+
const options = (0, _helpers__.parseArrayToInputOptions)((_res$data3 = res === null || res === void 0 ? void 0 : res.data) !== null && _res$data3 !== void 0 ? _res$data3 : []);
|
|
229
|
+
// Truncate labels to only show text before the first '|' character
|
|
230
|
+
return options.map(option => _objectSpread(_objectSpread({}, option), {}, {
|
|
231
|
+
label: (0, _helpers__.truncateAtPipe)(option.label)
|
|
232
|
+
}));
|
|
229
233
|
});
|
|
230
234
|
}
|
|
231
235
|
});
|
|
@@ -26,6 +26,7 @@ var _queries = require("../../__api__/queries");
|
|
|
26
26
|
var _constants__ = require("../../__constants__");
|
|
27
27
|
var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
28
28
|
var _helpers__ = require("../../__helpers__");
|
|
29
|
+
var _useIsTmg = require("../../__hooks__/useIsTmg");
|
|
29
30
|
var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
|
|
30
31
|
var _LinkButton = _interopRequireDefault(require("../Buttons/LinkButton"));
|
|
31
32
|
var _CardWide = _interopRequireDefault(require("../Cards/CardWide"));
|
|
@@ -121,8 +122,16 @@ const customerDetailsFormSchema = (0, _yup.object)({
|
|
|
121
122
|
date: (0, _yup.string)().nullable(),
|
|
122
123
|
time: (0, _yup.string)().nullable(),
|
|
123
124
|
internalNote: (0, _yup.string)().nullable(),
|
|
124
|
-
channelType: (0, _yup.string)().
|
|
125
|
-
|
|
125
|
+
channelType: (0, _yup.string)().when('$isTmg', {
|
|
126
|
+
is: true,
|
|
127
|
+
then: schema => schema.required('Kanaal is verplicht'),
|
|
128
|
+
otherwise: schema => schema.nullable()
|
|
129
|
+
}),
|
|
130
|
+
channelId: (0, _yup.string)().when('$isTmg', {
|
|
131
|
+
is: true,
|
|
132
|
+
then: schema => schema.required('Kanaal is verplicht'),
|
|
133
|
+
otherwise: schema => schema.nullable()
|
|
134
|
+
})
|
|
126
135
|
});
|
|
127
136
|
const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
128
137
|
var _branchTypes$byId$aut, _authSession$branch;
|
|
@@ -147,11 +156,33 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
147
156
|
branchTypes
|
|
148
157
|
} = (0, _queries.useBranchTypes)();
|
|
149
158
|
const authSession = _LocalStorageWorker.lsw.getJson(_constants__.AUTH_SESSION_KEY);
|
|
159
|
+
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
150
160
|
const branchType = branchTypes === null || branchTypes === void 0 || (_branchTypes$byId$aut = branchTypes.byId[authSession === null || authSession === void 0 || (_authSession$branch = authSession.branch) === null || _authSession$branch === void 0 || (_authSession$branch = _authSession$branch.organisatietype) === null || _authSession$branch === void 0 ? void 0 : _authSession$branch[0]]) === null || _branchTypes$byId$aut === void 0 ? void 0 : _branchTypes$byId$aut.title;
|
|
151
161
|
const {
|
|
152
162
|
marketingChannels,
|
|
153
163
|
isLoadingMarketingChannels
|
|
154
164
|
} = (0, _queries.useMarketingChannels)(branchType);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @description Auto-set Partner Portal channel for non-TMG users
|
|
168
|
+
*/
|
|
169
|
+
(0, _react.useEffect)(() => {
|
|
170
|
+
if (!isTmg && marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length && !(channel !== null && channel !== void 0 && channel.channelId)) {
|
|
171
|
+
const partnerPortalChannel = marketingChannels.find(c => c.title === _constants__.PARTNER_PORTAL_CHANNEL_TITLE);
|
|
172
|
+
if (partnerPortalChannel) {
|
|
173
|
+
var _partnerPortalChannel;
|
|
174
|
+
dispatch({
|
|
175
|
+
type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
|
|
176
|
+
payload: {
|
|
177
|
+
channel: {
|
|
178
|
+
channelType: partnerPortalChannel === null || partnerPortalChannel === void 0 || (_partnerPortalChannel = partnerPortalChannel.kanaalType) === null || _partnerPortalChannel === void 0 || (_partnerPortalChannel = _partnerPortalChannel[0]) === null || _partnerPortalChannel === void 0 ? void 0 : _partnerPortalChannel.entityId,
|
|
179
|
+
channelId: partnerPortalChannel === null || partnerPortalChannel === void 0 ? void 0 : partnerPortalChannel.entityId
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}, [isTmg, marketingChannels, channel === null || channel === void 0 ? void 0 : channel.channelId, dispatch]);
|
|
155
186
|
const initialChannel = (0, _react.useMemo)(() => {
|
|
156
187
|
if (!(channel !== null && channel !== void 0 && channel.channelId) || !(marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length)) return null;
|
|
157
188
|
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));
|
|
@@ -206,7 +237,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
206
237
|
};
|
|
207
238
|
const validateForm = async () => {
|
|
208
239
|
try {
|
|
209
|
-
let validationSchema = webshop ? customerDetailsFormSchema.omit(['channelType', 'channelId']) : customerDetailsFormSchema;
|
|
240
|
+
let validationSchema = webshop || !isTmg ? customerDetailsFormSchema.omit(['channelType', 'channelId']) : customerDetailsFormSchema;
|
|
210
241
|
|
|
211
242
|
// For webshop orders, make certain customer fields required
|
|
212
243
|
if (webshop) {
|
|
@@ -222,7 +253,10 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
222
253
|
channelId: (channel === null || channel === void 0 ? void 0 : channel.channelId) || ''
|
|
223
254
|
}), {
|
|
224
255
|
strict: false,
|
|
225
|
-
abortEarly: false
|
|
256
|
+
abortEarly: false,
|
|
257
|
+
context: {
|
|
258
|
+
isTmg
|
|
259
|
+
}
|
|
226
260
|
});
|
|
227
261
|
return true;
|
|
228
262
|
} catch (ex) {
|
|
@@ -249,7 +283,7 @@ const InternalCustomerDetailsForm = (_ref, ref) => {
|
|
|
249
283
|
label: 'Vestiginggegevens invullen?',
|
|
250
284
|
onClick: handleAutofillButtonClicked,
|
|
251
285
|
isDisabled: !branchById
|
|
252
|
-
})), !webshop && /*#__PURE__*/_react.default.createElement("div", {
|
|
286
|
+
})), !webshop && isTmg && /*#__PURE__*/_react.default.createElement("div", {
|
|
253
287
|
className: (0, _helpers__.withStyle)('col-12 mb-2')
|
|
254
288
|
}, /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
255
289
|
options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_CODING_SUBGROUP_NAME = exports.USER_GEOLOCATION_KEY = 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.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.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.DAY_NAMES = exports.CONFIGURATOR_FORMULAS = exports.BRANCH_THEME_BY_FORMULA = exports.BRANCH_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
|
|
6
|
+
exports.VESTIGING_TYPE_ID = exports.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_OWNERSHIP_TYPE = exports.VEHICLE_CODING_SUBGROUP_NAME = exports.USER_GEOLOCATION_KEY = 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.DOSSIER_TYPES = exports.DISCOUNT_TYPES = exports.DEFAULT_MAP_LONGITUDE = exports.DEFAULT_MAP_LATITUDE = exports.DEFAULT_ARTICLE_BRAND = exports.DAY_NAMES = exports.CONFIGURATOR_FORMULAS = exports.BRANCH_THEME_BY_FORMULA = exports.BRANCH_FORMULAS = exports.BOARD_COMPUTER_DISABLED_KEY = exports.AUTH_SESSION_KEY = exports.ARTICLE_SPECS_TRANSLATIONS = exports.ARTICLES_SYSTEM_FIELDS = exports.API_ERROR_CODES = exports.ANWB_DISCOUNT_CODE = exports.ALL_EXPERIMENTS = exports.ACTIVE_VARIANTS = void 0;
|
|
7
7
|
const DOSSIER_TYPES = exports.DOSSIER_TYPES = {
|
|
8
8
|
Quotation: 'quotation',
|
|
9
9
|
AppointmentRequest: 'appointment-request',
|
|
@@ -252,4 +252,5 @@ const VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE = exports.VEHICLE_SINGLE_ORDER_OWNERSH
|
|
|
252
252
|
const DISCOUNT_TYPES = exports.DISCOUNT_TYPES = {
|
|
253
253
|
Percentage: '%',
|
|
254
254
|
Amount: '€'
|
|
255
|
-
};
|
|
255
|
+
};
|
|
256
|
+
const PARTNER_PORTAL_CHANNEL_TITLE = exports.PARTNER_PORTAL_CHANNEL_TITLE = 'Partner';
|
|
@@ -181,7 +181,6 @@ const ProductCartTable = () => {
|
|
|
181
181
|
discountPercentage,
|
|
182
182
|
formula
|
|
183
183
|
});
|
|
184
|
-
console.log('Cart Input:', cartInput);
|
|
185
184
|
const marketCorrection = cart === null || cart === void 0 ? void 0 : cart.find(item => item.articleNumber === 'MC');
|
|
186
185
|
let mainProducts = [];
|
|
187
186
|
let accessoireProducts = [];
|
|
@@ -233,7 +232,6 @@ const ProductCartTable = () => {
|
|
|
233
232
|
}
|
|
234
233
|
let purchasePrice = 0;
|
|
235
234
|
let salesPrice = 0;
|
|
236
|
-
console.log('Cart Item:', cartItem);
|
|
237
235
|
const hasLocationTotal = (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== undefined && (cartItem === null || cartItem === void 0 ? void 0 : cartItem.locationTotal) !== null;
|
|
238
236
|
|
|
239
237
|
// Get prices directly from product objects
|
|
@@ -338,10 +336,6 @@ const ProductCartTable = () => {
|
|
|
338
336
|
catalogPriceExcl,
|
|
339
337
|
salesPriceIncl
|
|
340
338
|
} = product.priceInfo;
|
|
341
|
-
console.log('Product:', {
|
|
342
|
-
subgroupName: (product === null || product === void 0 ? void 0 : product.subgroupName) || (product === null || product === void 0 ? void 0 : product.groupName) || product.title,
|
|
343
|
-
priceInfo: product.priceInfo
|
|
344
|
-
});
|
|
345
339
|
return /*#__PURE__*/_react.default.createElement(_ProductTableStaticRow.default, {
|
|
346
340
|
key: product.articleNumber,
|
|
347
341
|
productTitle: (product === null || product === void 0 ? void 0 : product.subgroupName) || (product === null || product === void 0 ? void 0 : product.groupName) || product.title,
|
|
@@ -70,7 +70,7 @@ const VehicleData = _ref => {
|
|
|
70
70
|
isDefaultExpanded: true,
|
|
71
71
|
body: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, ' ', /*#__PURE__*/_react.default.createElement("div", {
|
|
72
72
|
className: (0, _helpers__.withStyle)('col-auto col-md-12 text-center')
|
|
73
|
-
}, !isFilter && /*#__PURE__*/_react.default.createElement("img", {
|
|
73
|
+
}, !isFilter && !licensePlate && /*#__PURE__*/_react.default.createElement("img", {
|
|
74
74
|
className: (0, _helpers__.withStyle)('vehicle-data__image img-fluid rounded-1 mx-0 mb-1'),
|
|
75
75
|
src: (0, _image.getImageFromHyper)({
|
|
76
76
|
imageId: vehicleLogo
|
|
@@ -96,6 +96,7 @@ const VehicleData = _ref => {
|
|
|
96
96
|
}).map(_ref3 => {
|
|
97
97
|
let [key, value] = _ref3;
|
|
98
98
|
if (!value) return null;
|
|
99
|
+
const displayValue = key === 'model' ? (0, _helpers__.truncateAtPipe)(value) : value;
|
|
99
100
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
100
101
|
key: key + value,
|
|
101
102
|
className: (0, _helpers__.withStyle)('d-flex align-items-center justify-content-between')
|
|
@@ -106,7 +107,7 @@ const VehicleData = _ref => {
|
|
|
106
107
|
fontSize: '14px'
|
|
107
108
|
},
|
|
108
109
|
className: "text-truncate"
|
|
109
|
-
},
|
|
110
|
+
}, displayValue));
|
|
110
111
|
})
|
|
111
112
|
});
|
|
112
113
|
};
|
|
@@ -130,13 +130,13 @@ const internalAppointmentFormSchema = (0, _yup.object)({
|
|
|
130
130
|
ownershipType: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
131
131
|
leaseNumber: (0, _yup.string)().nullable(),
|
|
132
132
|
firstName: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
133
|
-
channelType: (0, _yup.string)().when('$existingDossierId', {
|
|
134
|
-
is: existingDossierId => !!existingDossierId,
|
|
133
|
+
channelType: (0, _yup.string)().when(['$existingDossierId', '$isTmg'], {
|
|
134
|
+
is: (existingDossierId, isTmg) => !!existingDossierId || !isTmg,
|
|
135
135
|
then: schema => schema.nullable(),
|
|
136
136
|
otherwise: schema => schema.required(_constants__.FORM_ERROR_MESSAGES.required)
|
|
137
137
|
}),
|
|
138
|
-
channelId: (0, _yup.string)().when('$existingDossierId', {
|
|
139
|
-
is: existingDossierId => !!existingDossierId,
|
|
138
|
+
channelId: (0, _yup.string)().when(['$existingDossierId', '$isTmg'], {
|
|
139
|
+
is: (existingDossierId, isTmg) => !!existingDossierId || !isTmg,
|
|
140
140
|
then: schema => schema.nullable(),
|
|
141
141
|
otherwise: schema => schema.required(_constants__.FORM_ERROR_MESSAGES.required)
|
|
142
142
|
}),
|
|
@@ -232,6 +232,27 @@ const InternalAppointmentForm = _ref => {
|
|
|
232
232
|
marketingChannels,
|
|
233
233
|
isLoadingMarketingChannels
|
|
234
234
|
} = (0, _queries.useMarketingChannels)(branchType);
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* @description Auto-set Partner Portal channel for non-TMG users
|
|
238
|
+
*/
|
|
239
|
+
(0, _react.useEffect)(() => {
|
|
240
|
+
if (!isTmg && marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length && !(channel !== null && channel !== void 0 && channel.channelId)) {
|
|
241
|
+
const partnerPortalChannel = marketingChannels.find(c => c.title === _constants__.PARTNER_PORTAL_CHANNEL_TITLE);
|
|
242
|
+
if (partnerPortalChannel) {
|
|
243
|
+
var _partnerPortalChannel;
|
|
244
|
+
dispatch({
|
|
245
|
+
type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
|
|
246
|
+
payload: {
|
|
247
|
+
channel: {
|
|
248
|
+
channelType: partnerPortalChannel === null || partnerPortalChannel === void 0 || (_partnerPortalChannel = partnerPortalChannel.kanaalType) === null || _partnerPortalChannel === void 0 || (_partnerPortalChannel = _partnerPortalChannel[0]) === null || _partnerPortalChannel === void 0 ? void 0 : _partnerPortalChannel.entityId,
|
|
249
|
+
channelId: partnerPortalChannel === null || partnerPortalChannel === void 0 ? void 0 : partnerPortalChannel.entityId
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}, [isTmg, marketingChannels, channel === null || channel === void 0 ? void 0 : channel.channelId, dispatch]);
|
|
235
256
|
const selectedCountry = (0, _react.useMemo)(() => {
|
|
236
257
|
if (!(countryOptions !== null && countryOptions !== void 0 && countryOptions.length)) return null;
|
|
237
258
|
|
|
@@ -334,7 +355,8 @@ const InternalAppointmentForm = _ref => {
|
|
|
334
355
|
strict: false,
|
|
335
356
|
abortEarly: false,
|
|
336
357
|
context: {
|
|
337
|
-
existingDossierId: existingDossierId
|
|
358
|
+
existingDossierId: existingDossierId,
|
|
359
|
+
isTmg: isTmg
|
|
338
360
|
}
|
|
339
361
|
});
|
|
340
362
|
await onSubmit((0, _helpers__.removeNullishProps)({
|
|
@@ -637,7 +659,7 @@ const InternalAppointmentForm = _ref => {
|
|
|
637
659
|
onClick: handleClearAllCustomerFields
|
|
638
660
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
639
661
|
className: (0, _helpers__.withStyle)('col-12 mb-2')
|
|
640
|
-
}, !existingDossierId || existingDossierId && initialChannel !== null && initialChannel !== void 0 && initialChannel.value ? /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
662
|
+
}, isTmg && (!existingDossierId || existingDossierId && initialChannel !== null && initialChannel !== void 0 && initialChannel.value) ? /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
641
663
|
options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
|
|
642
664
|
label: channel === null || channel === void 0 ? void 0 : channel.title,
|
|
643
665
|
value: channel
|
|
@@ -42,6 +42,7 @@ var _OrderSessionContext = require("../../__context__/OrderSessionContext");
|
|
|
42
42
|
var _helpers__ = require("../../__helpers__");
|
|
43
43
|
var _product = require("../../__helpers__/product");
|
|
44
44
|
var _ui = require("../../__helpers__/ui");
|
|
45
|
+
var _useIsTmg = require("../../__hooks__/useIsTmg");
|
|
45
46
|
var _LicensePlateValidator = _interopRequireDefault(require("../../__services__/LicensePlateValidator"));
|
|
46
47
|
var _LocalStorageWorker = require("../../__services__/LocalStorageWorker");
|
|
47
48
|
var _InternalQuotationSuccessModal = _interopRequireDefault(require("./InternalQuotationSuccessModal"));
|
|
@@ -124,15 +125,15 @@ const internalQuotationFormSchema = (0, _yup.object)({
|
|
|
124
125
|
leaseNumber: (0, _yup.string)().nullable(),
|
|
125
126
|
firstName: (0, _yup.string)().nullable(),
|
|
126
127
|
chassisNumber: (0, _yup.string)().nullable(),
|
|
127
|
-
channelType: (0, _yup.string)().when('$existingDossierId', {
|
|
128
|
-
is:
|
|
129
|
-
then: () => (0, _yup.string)().
|
|
130
|
-
otherwise: () => (0, _yup.string)().
|
|
128
|
+
channelType: (0, _yup.string)().when(['$existingDossierId', '$isTmg'], {
|
|
129
|
+
is: (existingDossierId, isTmg) => !!existingDossierId || !isTmg,
|
|
130
|
+
then: () => (0, _yup.string)().nullable(),
|
|
131
|
+
otherwise: () => (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required)
|
|
131
132
|
}),
|
|
132
|
-
channelId: (0, _yup.string)().when('$existingDossierId', {
|
|
133
|
-
is:
|
|
134
|
-
then: () => (0, _yup.string)().
|
|
135
|
-
otherwise: () => (0, _yup.string)().
|
|
133
|
+
channelId: (0, _yup.string)().when(['$existingDossierId', '$isTmg'], {
|
|
134
|
+
is: (existingDossierId, isTmg) => !!existingDossierId || !isTmg,
|
|
135
|
+
then: () => (0, _yup.string)().nullable(),
|
|
136
|
+
otherwise: () => (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required)
|
|
136
137
|
}),
|
|
137
138
|
infix: (0, _yup.string)().nullable(),
|
|
138
139
|
lastName: (0, _yup.string)().required(_constants__.FORM_ERROR_MESSAGES.required),
|
|
@@ -184,6 +185,7 @@ const InternalQuotationForm = _ref => {
|
|
|
184
185
|
const [companySearchTerm, setCompanySearchTerm] = (0, _react.useState)('');
|
|
185
186
|
const [isCompanyInputFocused, setIsCompanyInputFocused] = (0, _react.useState)(false);
|
|
186
187
|
const [_licensePlate, _setLicensePlate] = (0, _react.useState)(licensePlate);
|
|
188
|
+
const isTmg = (0, _useIsTmg.useIsTmg)();
|
|
187
189
|
const {
|
|
188
190
|
branchTypes
|
|
189
191
|
} = (0, _queries.useBranchTypes)();
|
|
@@ -197,6 +199,27 @@ const InternalQuotationForm = _ref => {
|
|
|
197
199
|
marketingChannels,
|
|
198
200
|
isLoadingMarketingChannels
|
|
199
201
|
} = (0, _queries.useMarketingChannels)(branchType);
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @description Auto-set Partner Portal channel for non-TMG users
|
|
205
|
+
*/
|
|
206
|
+
(0, _react.useEffect)(() => {
|
|
207
|
+
if (!isTmg && marketingChannels !== null && marketingChannels !== void 0 && marketingChannels.length && !(channel !== null && channel !== void 0 && channel.channelId)) {
|
|
208
|
+
const partnerPortalChannel = marketingChannels.find(c => c.title === _constants__.PARTNER_PORTAL_CHANNEL_TITLE);
|
|
209
|
+
if (partnerPortalChannel) {
|
|
210
|
+
var _partnerPortalChannel;
|
|
211
|
+
dispatch({
|
|
212
|
+
type: _OrderSessionContext.orderSessionActions.SET_MARKETING_CHANNEL,
|
|
213
|
+
payload: {
|
|
214
|
+
channel: {
|
|
215
|
+
channelType: partnerPortalChannel === null || partnerPortalChannel === void 0 || (_partnerPortalChannel = partnerPortalChannel.kanaalType) === null || _partnerPortalChannel === void 0 || (_partnerPortalChannel = _partnerPortalChannel[0]) === null || _partnerPortalChannel === void 0 ? void 0 : _partnerPortalChannel.entityId,
|
|
216
|
+
channelId: partnerPortalChannel === null || partnerPortalChannel === void 0 ? void 0 : partnerPortalChannel.entityId
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}, [isTmg, marketingChannels, channel === null || channel === void 0 ? void 0 : channel.channelId, dispatch]);
|
|
200
223
|
const formula = (0, _FormulaContext.useFormula)();
|
|
201
224
|
const {
|
|
202
225
|
branchesByType,
|
|
@@ -310,7 +333,8 @@ const InternalQuotationForm = _ref => {
|
|
|
310
333
|
strict: false,
|
|
311
334
|
abortEarly: false,
|
|
312
335
|
context: {
|
|
313
|
-
existingDossierId
|
|
336
|
+
existingDossierId,
|
|
337
|
+
isTmg
|
|
314
338
|
}
|
|
315
339
|
});
|
|
316
340
|
await onSubmit((0, _helpers__.removeNullishProps)({
|
|
@@ -477,7 +501,7 @@ const InternalQuotationForm = _ref => {
|
|
|
477
501
|
onClick: handleClearAllCustomerFields
|
|
478
502
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
479
503
|
className: (0, _helpers__.withStyle)('col-12 mb-2')
|
|
480
|
-
}, (!existingDossierId || existingDossierId && (initialChannel === null || initialChannel === void 0 ? void 0 : initialChannel.value)) && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
504
|
+
}, isTmg && (!existingDossierId || existingDossierId && (initialChannel === null || initialChannel === void 0 ? void 0 : initialChannel.value)) && /*#__PURE__*/_react.default.createElement(_DropdownInput.default, {
|
|
481
505
|
options: marketingChannels === null || marketingChannels === void 0 ? void 0 : marketingChannels.map(channel => ({
|
|
482
506
|
label: channel === null || channel === void 0 ? void 0 : channel.title,
|
|
483
507
|
value: channel
|
|
@@ -6,6 +6,7 @@ require("core-js/modules/es.object.from-entries.js");
|
|
|
6
6
|
require("core-js/modules/es.regexp.exec.js");
|
|
7
7
|
require("core-js/modules/es.regexp.to-string.js");
|
|
8
8
|
require("core-js/modules/es.string.replace.js");
|
|
9
|
+
require("core-js/modules/es.string.trim.js");
|
|
9
10
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
10
11
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
11
12
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
@@ -15,13 +16,14 @@ require("core-js/modules/web.dom-collections.iterator.js");
|
|
|
15
16
|
Object.defineProperty(exports, "__esModule", {
|
|
16
17
|
value: true
|
|
17
18
|
});
|
|
18
|
-
exports.withStyle = exports.removeNullishProps = exports.reduceYupErrorsToObject = exports.pushToDataLayer = exports.parseJson = exports.parseDateAndTimeToTimestamp = exports.parseArrayToInputOptions = exports.normalizeArray = exports.groupByKey = exports.formatPrice = exports.formatMontageTime = exports.createSlug = void 0;
|
|
19
|
+
exports.withStyle = exports.truncateAtPipe = exports.removeNullishProps = exports.reduceYupErrorsToObject = exports.pushToDataLayer = exports.parseJson = exports.parseDateAndTimeToTimestamp = exports.parseArrayToInputOptions = exports.normalizeArray = exports.groupByKey = exports.formatPrice = exports.formatMontageTime = exports.createSlug = void 0;
|
|
19
20
|
require("core-js/modules/es.array.reduce.js");
|
|
20
21
|
require("core-js/modules/es.json.stringify.js");
|
|
21
22
|
require("core-js/modules/es.object.from-entries.js");
|
|
22
23
|
require("core-js/modules/es.regexp.exec.js");
|
|
23
24
|
require("core-js/modules/es.regexp.to-string.js");
|
|
24
25
|
require("core-js/modules/es.string.replace.js");
|
|
26
|
+
require("core-js/modules/es.string.trim.js");
|
|
25
27
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
26
28
|
require("core-js/modules/esnext.iterator.filter.js");
|
|
27
29
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
@@ -193,9 +195,19 @@ const parseArrayToInputOptions = exports.parseArrayToInputOptions = function par
|
|
|
193
195
|
}));
|
|
194
196
|
};
|
|
195
197
|
|
|
198
|
+
/**
|
|
199
|
+
* @description Truncates a string at the first '|' character
|
|
200
|
+
* Example: "Q4 (F4B) | Other text" => "Q4 (F4B)"
|
|
201
|
+
*/
|
|
202
|
+
const truncateAtPipe = value => {
|
|
203
|
+
if (!value || typeof value !== 'string') return value;
|
|
204
|
+
return value.split('|')[0].trim();
|
|
205
|
+
};
|
|
206
|
+
|
|
196
207
|
/**
|
|
197
208
|
* @description Parses a string into JSON object, returns null on error
|
|
198
209
|
*/
|
|
210
|
+
exports.truncateAtPipe = truncateAtPipe;
|
|
199
211
|
const parseJson = string => {
|
|
200
212
|
try {
|
|
201
213
|
return JSON.parse(string);
|