thm-p3-configurator 0.0.354 → 0.0.355

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.
@@ -345,12 +345,14 @@ const InternalBranchSelectorModal = () => {
345
345
  isLoadingBranchTypes
346
346
  } = (0, _queries.useBranchTypes)();
347
347
  const [_selectedBranchId, _setSelectedBranchId] = (0, _react.useState)();
348
+ const [isDismissed, setIsDismissed] = (0, _react.useState)(false);
348
349
  const authSession = (0, _AuthSessionContext.useAuthSession)();
349
350
  const isSingleOrderPage = (0, _useIsSingleOrder.default)();
350
351
  const formula = (0, _FormulaContext.useFormula)();
351
352
  const isTMGOrganization = (0, _useIsTmg.useIsTmg)();
352
353
  (0, _react.useEffect)(() => {
353
354
  _setSelectedBranchId(undefined);
355
+ setIsDismissed(false);
354
356
  }, [isSingleOrderPage]);
355
357
  const isLocation = _react.default.useMemo(() => {
356
358
  var _authSession$branch2;
@@ -431,8 +433,8 @@ const InternalBranchSelectorModal = () => {
431
433
  }
432
434
  });
433
435
  };
434
- const shouldShowModalForSingleOrder = APP_CONFIG.internal && !selectedBranch && !existingDossierId && isSingleOrderPage;
435
- const shouldShowModalForOtherPages = APP_CONFIG.internal && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization;
436
+ const shouldShowModalForSingleOrder = APP_CONFIG.internal && !selectedBranch && !existingDossierId && isSingleOrderPage && !isDismissed;
437
+ const shouldShowModalForOtherPages = APP_CONFIG.internal && !selectedBranch && !existingDossierId && !isSingleOrderPage && !isTMGOrganization && !isDismissed;
436
438
 
437
439
  // Show loading state only when we actually need to show the modal
438
440
  const shouldShowModal = shouldShowModalForSingleOrder || shouldShowModalForOtherPages;
@@ -460,7 +462,8 @@ const InternalBranchSelectorModal = () => {
460
462
  hasSecondaryButton: false,
461
463
  isPrimaryButtonDisabled: !_selectedBranchId,
462
464
  primaryButtonText: 'Ga door',
463
- onPrimaryButtonClicked: handlePrimaryButtonClicked
465
+ onPrimaryButtonClicked: handlePrimaryButtonClicked,
466
+ onClose: () => setIsDismissed(true)
464
467
  }, isSingleOrderPage ? /*#__PURE__*/_react.default.createElement(SingleOrderModalContent, {
465
468
  setSelectedBranchId: _setSelectedBranchId,
466
469
  isLocation: isLocation,
@@ -156,10 +156,12 @@ const InternalSingleOrderPage = () => {
156
156
  anderAfleveradres,
157
157
  afhalenInWinkel
158
158
  }, dispatch] = (0, _OrderSessionContext.useOrderSession)();
159
- let formula = (0, _FormulaContext.useFormula)();
159
+ const sessionFormula = (0, _FormulaContext.useFormula)();
160
+ let formula = sessionFormula;
160
161
  if (singleOrderFormulaCode) {
161
162
  formula = singleOrderFormulaCode;
162
163
  }
164
+ const singleOrderCreationFormula = sessionFormula === _constants__.CONFIGURATOR_FORMULAS.TMG ? _constants__.CONFIGURATOR_FORMULAS.TMG : formula === _constants__.CONFIGURATOR_FORMULAS.THM ? _constants__.CONFIGURATOR_FORMULAS.TM : formula;
163
165
  const themeClass = (0, _helpers__.getConfiguratorThemeClassByFormula)(formula);
164
166
  const wrapperClass = "thm-configurator-wrapper thm-configurator-wrapper--offset ".concat(themeClass);
165
167
  const {
@@ -364,7 +366,7 @@ const InternalSingleOrderPage = () => {
364
366
  var _response$data2;
365
367
  // Regular flow for offline orders
366
368
  const preferredDateTime = appointment !== null && appointment !== void 0 && appointment.date && appointment !== null && appointment !== void 0 && appointment.time ? (0, _helpers__.parseDateAndTimeToTimestamp)(appointment === null || appointment === void 0 ? void 0 : appointment.date, appointment === null || appointment === void 0 ? void 0 : appointment.time) : null;
367
- const response = await createSingleOrder(_objectSpread(_objectSpread({
369
+ const response = await createSingleOrder({
368
370
  licensePlate: filters.licensePlate,
369
371
  model: filters.model,
370
372
  cart: singleOrderCart,
@@ -372,12 +374,8 @@ const InternalSingleOrderPage = () => {
372
374
  customer: _objectSpread(_objectSpread({}, customer), {}, {
373
375
  anderAfleveradres,
374
376
  afhalenInWinkel
375
- })
376
- }, formula === _constants__.CONFIGURATOR_FORMULAS.THM ? {
377
- formula: _constants__.CONFIGURATOR_FORMULAS.TM
378
- } : {
379
- formula
380
- }), {}, {
377
+ }),
378
+ formula: singleOrderCreationFormula,
381
379
  branchId: selectedBranch,
382
380
  channel,
383
381
  preferredDateTime,
@@ -387,7 +385,7 @@ const InternalSingleOrderPage = () => {
387
385
  zakelijkContactTelefoonnummer: vehiclePayload.ownershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactTelefoonnummer) || undefined : undefined,
388
386
  zakeiljkContactFactuuradres: vehiclePayload.ownershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakeiljkContactFactuuradres) || undefined : undefined,
389
387
  zakelijkContactEMailadres: vehiclePayload.ownershipType === _constants__.VEHICLE_SINGLE_ORDER_OWNERSHIP_TYPE.Zakelijk ? (customer === null || customer === void 0 ? void 0 : customer.zakelijkContactEMailadres) || undefined : undefined
390
- }));
388
+ });
391
389
  if (response !== null && response !== void 0 && (_response$data2 = response.data) !== null && _response$data2 !== void 0 && (_response$data2 = _response$data2.data) !== null && _response$data2 !== void 0 && _response$data2.entityId) {
392
390
  setCreatedEntityId(response.data.data.entityId);
393
391
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.354",
3
+ "version": "0.0.355",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",