thm-p3-configurator 0.0.242 → 0.0.243

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.
@@ -124,7 +124,8 @@ const useCreateSingleOrderMutation = () => {
124
124
  isCreateSingleOrderError: createSingleOrderMutation.isError,
125
125
  isCreateSingleOrderSuccess: createSingleOrderMutation.isSuccess,
126
126
  resetSingleOrderCreation: createSingleOrderMutation.reset,
127
- createSingleOrder: createSingleOrderMutation.mutate
127
+ createSingleOrder: createSingleOrderMutation.mutateAsync,
128
+ data: createSingleOrderMutation.data
128
129
  };
129
130
  };
130
131
 
@@ -164,7 +165,8 @@ const useCreateShopifyOrderMutation = () => {
164
165
  isCreateShopifyOrderError: createShopifyOrderMutation.isError,
165
166
  isCreateShopifyOrderSuccess: createShopifyOrderMutation.isSuccess,
166
167
  resetShopifyOrderCreation: createShopifyOrderMutation.reset,
167
- createShopifyOrder: createShopifyOrderMutation.mutate
168
+ createShopifyOrder: createShopifyOrderMutation.mutateAsync,
169
+ data: createShopifyOrderMutation.data
168
170
  };
169
171
  };
170
172
 
@@ -211,7 +213,8 @@ const useCreatePrivateQuotationMutation = () => {
211
213
  isCreateQuotationError: createQuotationMutation.isError,
212
214
  isCreateQuotationSuccess: createQuotationMutation.isSuccess,
213
215
  resetQuotationCreation: createQuotationMutation.reset,
214
- createQuotation: createQuotationMutation.mutate
216
+ createQuotation: createQuotationMutation.mutateAsync,
217
+ data: createQuotationMutation.data
215
218
  };
216
219
  };
217
220
 
@@ -262,7 +265,8 @@ const useCreatePrivateAppointmentMutation = () => {
262
265
  isCreatePlannedAppointmentError: createPlannedAppointmentMutation.isError,
263
266
  isCreatePlannedAppointmentSuccess: createPlannedAppointmentMutation.isSuccess,
264
267
  resetPlannedAppointmentCreation: createPlannedAppointmentMutation.reset,
265
- createPlannedAppointment: createPlannedAppointmentMutation.mutate
268
+ createPlannedAppointment: createPlannedAppointmentMutation.mutateAsync,
269
+ data: createPlannedAppointmentMutation.data
266
270
  };
267
271
  };
268
272
 
@@ -311,7 +315,8 @@ const useCreatePrivateAppointmentRequestMutation = () => {
311
315
  isCreateAppointmentRequestError: createAppointmentRequestMutation.isError,
312
316
  isCreateAppointmentRequestSuccess: createAppointmentRequestMutation.isSuccess,
313
317
  resetAppointmentRequestCreation: createAppointmentRequestMutation.reset,
314
- createAppointmentRequest: createAppointmentRequestMutation.mutate
318
+ createAppointmentRequest: createAppointmentRequestMutation.mutateAsync,
319
+ data: createAppointmentRequestMutation.data
315
320
  };
316
321
  };
317
322
 
@@ -365,7 +370,8 @@ const useUpdatePrivateAppointmentRequestByIdMutation = id => {
365
370
  isUpdateAppointmentRequestError: updateAppointmentRequestByIdMutation.isError,
366
371
  isUpdateAppointmentRequestSuccess: updateAppointmentRequestByIdMutation.isSuccess,
367
372
  resetAppointmentRequestUpdate: updateAppointmentRequestByIdMutation.reset,
368
- updateAppointmentRequest: updateAppointmentRequestByIdMutation.mutate
373
+ updateAppointmentRequest: updateAppointmentRequestByIdMutation.mutateAsync,
374
+ data: updateAppointmentRequestByIdMutation.data
369
375
  };
370
376
  };
371
377
 
@@ -413,7 +419,8 @@ const useUpdatePrivateQuotationByIdMutation = id => {
413
419
  isUpdateQuotationError: updateQuotationMutation.isError,
414
420
  isUpdateQuotationSuccess: updateQuotationMutation.isSuccess,
415
421
  resetQuotationUpdate: updateQuotationMutation.reset,
416
- updateQuotation: updateQuotationMutation.mutate
422
+ updateQuotation: updateQuotationMutation.mutateAsync,
423
+ data: updateQuotationMutation.data
417
424
  };
418
425
  };
419
426
 
@@ -467,7 +474,8 @@ const useUpdatePrivateAppointmentByIdMutation = id => {
467
474
  isUpdateAppointmentError: updateAppointmentByIdMutation.isError,
468
475
  isUpdateAppointmentSuccess: updateAppointmentByIdMutation.isSuccess,
469
476
  resetAppointmentUpdate: updateAppointmentByIdMutation.reset,
470
- updateAppointment: updateAppointmentByIdMutation.mutate
477
+ updateAppointment: updateAppointmentByIdMutation.mutateAsync,
478
+ data: updateAppointmentByIdMutation.data
471
479
  };
472
480
  };
473
481
  exports.useUpdatePrivateAppointmentByIdMutation = useUpdatePrivateAppointmentByIdMutation;
@@ -170,7 +170,8 @@ const InternalAppointmentForm = _ref => {
170
170
  onSubmit = payload => {},
171
171
  isError = false,
172
172
  isSuccess = false,
173
- isLoading = false
173
+ isLoading = false,
174
+ entityId = null
174
175
  } = _ref;
175
176
  const [order, dispatch] = (0, _OrderSessionContext.useOrderSession)();
176
177
  const [refreshKey, setRefreshKey] = (0, _react.useState)(Date.now());
@@ -1752,7 +1753,8 @@ const InternalAppointmentForm = _ref => {
1752
1753
  label: 'Afspraak wijzigen'
1753
1754
  })) : null)), /*#__PURE__*/_react.default.createElement(_InternalAppointmentSuccessModal.default, {
1754
1755
  appointmentType: appointmentType,
1755
- isOpen: isSuccess
1756
+ isOpen: isSuccess,
1757
+ entityId: entityId
1756
1758
  }));
1757
1759
  };
1758
1760
  var _default = exports.default = InternalAppointmentForm;
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.weak-map.js");
4
3
  require("core-js/modules/web.dom-collections.iterator.js");
5
- require("core-js/modules/es.weak-map.js");
6
4
  Object.defineProperty(exports, "__esModule", {
7
5
  value: true
8
6
  });
9
7
  exports.default = void 0;
10
8
  require("core-js/modules/web.dom-collections.iterator.js");
11
- var _react = _interopRequireWildcard(require("react"));
9
+ var _react = require("react");
12
10
  var _reactDom = require("react-dom");
13
11
  var _reactQuery = require("react-query");
14
12
  var _reactRouter = require("react-router");
@@ -21,35 +19,11 @@ function _interopRequireDefault(e) {
21
19
  default: e
22
20
  };
23
21
  }
24
- function _getRequireWildcardCache(e) {
25
- if ("function" != typeof WeakMap) return null;
26
- var r = new WeakMap(),
27
- t = new WeakMap();
28
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
29
- return e ? t : r;
30
- })(e);
31
- }
32
- function _interopRequireWildcard(e, r) {
33
- if (!r && e && e.__esModule) return e;
34
- if (null === e || "object" != typeof e && "function" != typeof e) return {
35
- default: e
36
- };
37
- var t = _getRequireWildcardCache(r);
38
- if (t && t.has(e)) return t.get(e);
39
- var n = {
40
- __proto__: null
41
- },
42
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
43
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
44
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
45
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
46
- }
47
- return n.default = e, t && t.set(e, n), n;
48
- }
49
22
  const InternalAppointmentSuccessModal = _ref => {
50
23
  let {
51
24
  isOpen,
52
- appointmentType
25
+ appointmentType,
26
+ entityId
53
27
  } = _ref;
54
28
  const history = (0, _reactRouter.useHistory)();
55
29
  const [anchorEl, setAnchorEl] = (0, _react.useState)();
@@ -79,7 +53,14 @@ const InternalAppointmentSuccessModal = _ref => {
79
53
  shouldForceReset: true
80
54
  }
81
55
  });
82
- history.push(isAppointmentRequest ? '/afspraak-aanvragen' : '/afspraken');
56
+
57
+ // Redirect to detail page if entityId is available, otherwise fallback to overview
58
+ if (entityId) {
59
+ history.push(isAppointmentRequest ? "/afspraak-aanvragen/".concat(entityId) : "/afspraken/".concat(entityId));
60
+ history.push(isAppointmentRequest ? "/afspraak-aanvragen/".concat(entityId) : "/afspraken/".concat(entityId));
61
+ } else {
62
+ history.push(isAppointmentRequest ? '/afspraak-aanvragen' : '/afspraken');
63
+ }
83
64
  };
84
65
  const handleSecondaryButtonClicked = () => {
85
66
  dispatch({
@@ -90,7 +71,7 @@ const InternalAppointmentSuccessModal = _ref => {
90
71
  });
91
72
  history.push('/dashboard');
92
73
  };
93
- return /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react.default.createElement(_Modal.default, {
74
+ return /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/React.createElement(_Modal.default, {
94
75
  isOpen: isOpen,
95
76
  title: isAppointmentRequest ? 'De afspraakaanvraag is gemaakt!' : 'De afspraak is gemaakt!',
96
77
  size: "wide",
@@ -98,8 +79,8 @@ const InternalAppointmentSuccessModal = _ref => {
98
79
  secondaryButtonText: 'Naar dashboard',
99
80
  onPrimaryButtonClicked: handlePrimaryButtonClicked,
100
81
  onSecondaryButtonClicked: handleSecondaryButtonClicked
101
- }, /*#__PURE__*/_react.default.createElement("div", {
82
+ }, /*#__PURE__*/React.createElement("div", {
102
83
  className: (0, _helpers__.withStyle)('text-center')
103
- }, /*#__PURE__*/_react.default.createElement("p", null, isAppointmentRequest ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "U ontvangt een bevestiging per mail. De offerte en de aanvraag van de afspraak wordt ook naar uw klant gestuurd. U kunt de aanvraag terug zien in het afspraken overzicht. Mocht u vragen hebben dan kunt u altijd contact met ons opnemen.") : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "U ontvangt een bevestiging per mail. De offerte en de bevestiging van de afspraak wordt ook naar uw klant gestuurd. U kunt de afspraak terug zien in het afspraken overzicht. Mocht u vragen hebben dan kunt u altijd contact met ons opnemen.")))), anchorEl);
84
+ }, /*#__PURE__*/React.createElement("p", null, isAppointmentRequest ? /*#__PURE__*/React.createElement(React.Fragment, null, "U ontvangt een bevestiging per mail. De offerte en de aanvraag van de afspraak wordt ook naar uw klant gestuurd. U kunt de aanvraag terug zien in het afspraken overzicht. Mocht u vragen hebben dan kunt u altijd contact met ons opnemen.") : /*#__PURE__*/React.createElement(React.Fragment, null, "U ontvangt een bevestiging per mail. De offerte en de bevestiging van de afspraak wordt ook naar uw klant gestuurd. U kunt de afspraak terug zien in het afspraken overzicht. Mocht u vragen hebben dan kunt u altijd contact met ons opnemen.")))), anchorEl);
104
85
  };
105
86
  var _default = exports.default = InternalAppointmentSuccessModal;
@@ -156,7 +156,8 @@ const InternalQuotationForm = _ref => {
156
156
  onSubmit = payload => {},
157
157
  isError = false,
158
158
  isSuccess = false,
159
- isLoading = false
159
+ isLoading = false,
160
+ entityId = null
160
161
  } = _ref;
161
162
  const [{
162
163
  vehicle,
@@ -986,7 +987,8 @@ const InternalQuotationForm = _ref => {
986
987
  label: 'Offerte maken'
987
988
  })), /*#__PURE__*/_react.default.createElement(_InternalQuotationSuccessModal.default, {
988
989
  isOpen: isSuccess,
989
- email: customer === null || customer === void 0 ? void 0 : customer.email
990
+ email: customer === null || customer === void 0 ? void 0 : customer.email,
991
+ entityId: entityId
990
992
  })));
991
993
  };
992
994
  var _default = exports.default = InternalQuotationForm;
@@ -49,7 +49,8 @@ function _interopRequireWildcard(e, r) {
49
49
  const InternalQuotationSuccessModal = _ref => {
50
50
  let {
51
51
  isOpen,
52
- email
52
+ email,
53
+ entityId
53
54
  } = _ref;
54
55
  const history = (0, _reactRouter.useHistory)();
55
56
  const [anchorEl, setAnchorEl] = (0, _react.useState)();
@@ -78,7 +79,13 @@ const InternalQuotationSuccessModal = _ref => {
78
79
  shouldForceReset: true
79
80
  }
80
81
  });
81
- history.push('/offertes');
82
+
83
+ // Redirect to detail page if entityId is available, otherwise fallback to overview
84
+ if (entityId) {
85
+ history.push("/offertes/".concat(entityId));
86
+ } else {
87
+ history.push('/offertes');
88
+ }
82
89
  };
83
90
  const handleSecondaryButtonClicked = () => {
84
91
  dispatch({
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
7
  var _reactRouter = require("react-router");
9
8
  var _Modal = _interopRequireDefault(require("../../__components__/Modal"));
10
9
  var _helpers__ = require("../../__helpers__");
@@ -15,18 +14,27 @@ function _interopRequireDefault(e) {
15
14
  }
16
15
  const InternalSingleOrderSuccessModal = _ref => {
17
16
  let {
18
- isOpen
17
+ isOpen,
18
+ entityId
19
19
  } = _ref;
20
20
  const history = (0, _reactRouter.useHistory)();
21
- return /*#__PURE__*/_react.default.createElement(_Modal.default, {
21
+ const handlePrimaryButtonClicked = () => {
22
+ // Redirect to detail page if entityId is available, otherwise fallback to overview
23
+ if (entityId) {
24
+ history.push("/losse-orders/".concat(entityId));
25
+ } else {
26
+ history.push('/losse-orders');
27
+ }
28
+ };
29
+ return /*#__PURE__*/React.createElement(_Modal.default, {
22
30
  isOpen: isOpen,
23
31
  title: 'Bestelling succesvol',
24
32
  size: "wide",
25
33
  onSecondaryButtonClicked: () => history.push('/dashboard'),
26
34
  secondaryButtonText: 'Naar dashboard',
27
35
  primaryButtonText: 'Naar losse orders',
28
- onPrimaryButtonClicked: () => history.push('/losse-orders')
29
- }, /*#__PURE__*/_react.default.createElement("p", null, "De bestelling is succesvol gemaakt."), /*#__PURE__*/_react.default.createElement("p", {
36
+ onPrimaryButtonClicked: handlePrimaryButtonClicked
37
+ }, /*#__PURE__*/React.createElement("p", null, "De bestelling is succesvol gemaakt."), /*#__PURE__*/React.createElement("p", {
30
38
  className: (0, _helpers__.withStyle)('mb-0')
31
39
  }, "Deze bestelling is nu terug te vinden in uw overzicht met uitstaande losse orders. U kunt de status van deze bestelling daar bijhouden.."));
32
40
  };
@@ -73,11 +73,12 @@ const LicensePlatePage = () => {
73
73
  const [activeStep, setActiveStep] = (0, _react.useState)(0);
74
74
  const [orderSession, dispatch] = (0, _OrderSessionContext.useOrderSession)();
75
75
  const formula = (0, _FormulaContext.useFormula)();
76
- const [licensePlateURL, widgetOrEntityId, discountCode, franchiseName, notFound] = (0, _useSearchParam.default)(['licensePlate', 'vestigingRecId', 'discountCode', 'naamKeten', 'notFound']);
76
+ const [licensePlateURL, widgetOrEntityId, discountCode, franchiseName, notFound, vestigingRecId] = (0, _useSearchParam.default)(['licensePlate', 'branch', 'discountCode', 'naamKeten', 'notFound', 'vestigingRecId']);
77
+ const branchIdOrVestigingRecId = widgetOrEntityId || vestigingRecId;
77
78
  const {
78
79
  branchById,
79
80
  isLoadingBranchById
80
- } = (0, _queries.useBranchByIdOrWidgetId)(widgetOrEntityId);
81
+ } = (0, _queries.useBranchByIdOrWidgetId)(branchIdOrVestigingRecId);
81
82
  const history = (0, _reactRouter.useHistory)();
82
83
  (0, _queries.useProductFieldLabels)(); // Prefetch
83
84
 
@@ -92,7 +93,7 @@ const LicensePlatePage = () => {
92
93
  };
93
94
  (0, _react.useEffect)(() => {
94
95
  // Note: If an id in url was found and the branch is still being loaded, exit early
95
- if (isLoadingBranchById && widgetOrEntityId) {
96
+ if (isLoadingBranchById && branchIdOrVestigingRecId) {
96
97
  return;
97
98
  }
98
99
 
@@ -108,7 +109,7 @@ const LicensePlatePage = () => {
108
109
  return;
109
110
  }
110
111
  handleNext();
111
- }, [licensePlateURL, isLoadingBranchById, widgetOrEntityId]);
112
+ }, [licensePlateURL, isLoadingBranchById, branchIdOrVestigingRecId]);
112
113
  (0, _react.useEffect)(() => {
113
114
  if (branchById) {
114
115
  dispatch({
@@ -162,7 +163,7 @@ const LicensePlatePage = () => {
162
163
  isCentered: true,
163
164
  isScrollable: true,
164
165
  title: 'Wij zoeken naar de beste oplossing'
165
- }, widgetOrEntityId && isLoadingBranchById && /*#__PURE__*/_react.default.createElement(_TextSpinner.default, null), notFound === 'true' && /*#__PURE__*/_react.default.createElement("div", {
166
+ }, branchIdOrVestigingRecId && isLoadingBranchById && /*#__PURE__*/_react.default.createElement(_TextSpinner.default, null), notFound === 'true' && /*#__PURE__*/_react.default.createElement("div", {
166
167
  className: (0, _helpers__.withStyle)('alert alert-danger mb-3')
167
168
  }, /*#__PURE__*/_react.default.createElement("small", null, "Het opgegeven kenteken kon niet worden gevonden. Probeer een ander kenteken of zoek via merk.")), Steps[activeStep], /*#__PURE__*/_react.default.createElement("div", {
168
169
  className: (0, _helpers__.withStyle)('align-items-center justify-content-center text-center mt-2')
@@ -9,10 +9,10 @@ exports.default = void 0;
9
9
  require("core-js/modules/es.promise.js");
10
10
  require("core-js/modules/web.dom-collections.iterator.js");
11
11
  var _react = _interopRequireDefault(require("react"));
12
+ var _reactQuery = require("react-query");
12
13
  var _mutations = require("../../__api__/mutations");
13
14
  var _Header = _interopRequireDefault(require("../../__components__/Header"));
14
15
  var _NavigationSteps = _interopRequireDefault(require("../../__components__/NavigationSteps"));
15
- var _reactQuery = require("react-query");
16
16
  var _constants__ = require("../../__constants__");
17
17
  var _internal = require("../../__containers__/internal");
18
18
  var _InternalAppointmentForm = _interopRequireDefault(require("../../__containers__/internal/InternalAppointmentForm"));
@@ -31,43 +31,64 @@ const InternalAppointmentPage = () => {
31
31
  existingDossierId
32
32
  }] = (0, _OrderSessionContext.useOrderSession)();
33
33
  const queryClient = (0, _reactQuery.useQueryClient)();
34
+ const [createdEntityId, setCreatedEntityId] = _react.default.useState(null);
34
35
  const {
35
36
  createPlannedAppointment,
36
37
  isCreatePlannedAppointmentError,
37
38
  isCreatePlannedAppointmentSuccess,
38
- isCreatingPlannedAppointment
39
+ isCreatingPlannedAppointment,
40
+ data: createPlannedAppointmentData
39
41
  } = (0, _mutations.useCreatePrivateAppointmentMutation)();
40
42
  const {
41
43
  createAppointmentRequest,
42
44
  isCreateAppointmentRequestError,
43
45
  isCreateAppointmentRequestSuccess,
44
- isCreatingAppointmentRequest
46
+ isCreatingAppointmentRequest,
47
+ data: createAppointmentRequestData
45
48
  } = (0, _mutations.useCreatePrivateAppointmentRequestMutation)();
46
49
  const {
47
50
  updateAppointment,
48
51
  isUpdateAppointmentError,
49
52
  isUpdateAppointmentSuccess,
50
- isUpdatingAppointment
53
+ isUpdatingAppointment,
54
+ data: updateAppointmentData
51
55
  } = (0, _mutations.useUpdatePrivateAppointmentByIdMutation)(existingDossierId);
52
56
  const {
53
57
  updateAppointmentRequest,
54
58
  isUpdateAppointmentRequestError,
55
59
  isUpdateAppointmentRequestSuccess,
56
- isUpdatingAppointmentRequest
60
+ isUpdatingAppointmentRequest,
61
+ data: updateAppointmentRequestData
57
62
  } = (0, _mutations.useUpdatePrivateAppointmentRequestByIdMutation)(existingDossierId);
58
63
  const handleSubmit = async payload => {
59
64
  if (payload !== null && payload !== void 0 && payload.appointmentType && payload.appointmentType === _constants__.DOSSIER_TYPES.PlannedAppointment) {
65
+ var _response$data2;
60
66
  if (existingDossierId) {
61
- await updateAppointment(payload);
67
+ var _response$data;
68
+ const response = await updateAppointment(payload);
69
+ if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && (_response$data = _response$data.data) !== null && _response$data !== void 0 && _response$data.entityId) {
70
+ setCreatedEntityId(response.data.data.entityId);
71
+ }
62
72
  return;
63
73
  }
64
- await createPlannedAppointment(payload);
74
+ const response = await createPlannedAppointment(payload);
75
+ 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) {
76
+ setCreatedEntityId(response.data.data.entityId);
77
+ }
65
78
  } else {
79
+ var _response$data4;
66
80
  if (existingDossierId) {
67
- await updateAppointmentRequest(payload);
81
+ var _response$data3;
82
+ const response = await updateAppointmentRequest(payload);
83
+ if (response !== null && response !== void 0 && (_response$data3 = response.data) !== null && _response$data3 !== void 0 && (_response$data3 = _response$data3.data) !== null && _response$data3 !== void 0 && _response$data3.entityId) {
84
+ setCreatedEntityId(response.data.data.entityId);
85
+ }
68
86
  return;
69
87
  }
70
- await createAppointmentRequest(payload);
88
+ const response = await createAppointmentRequest(payload);
89
+ if (response !== null && response !== void 0 && (_response$data4 = response.data) !== null && _response$data4 !== void 0 && (_response$data4 = _response$data4.data) !== null && _response$data4 !== void 0 && _response$data4.entityId) {
90
+ setCreatedEntityId(response.data.data.entityId);
91
+ }
71
92
  }
72
93
  };
73
94
  return /*#__PURE__*/_react.default.createElement("div", {
@@ -97,7 +118,8 @@ const InternalAppointmentPage = () => {
97
118
  onSubmit: handleSubmit,
98
119
  isError: isCreatePlannedAppointmentError || isUpdateAppointmentError || isCreateAppointmentRequestError || isUpdateAppointmentRequestError,
99
120
  isLoading: isUpdatingAppointment || isCreatingPlannedAppointment || isCreatingAppointmentRequest || isUpdatingAppointmentRequest,
100
- isSuccess: isCreatePlannedAppointmentSuccess || isCreateAppointmentRequestSuccess || isUpdateAppointmentSuccess || isUpdateAppointmentRequestSuccess
121
+ isSuccess: isCreatePlannedAppointmentSuccess || isCreateAppointmentRequestSuccess || isUpdateAppointmentSuccess || isUpdateAppointmentRequestSuccess,
122
+ entityId: createdEntityId || existingDossierId
101
123
  })), /*#__PURE__*/_react.default.createElement("div", {
102
124
  className: (0, _helpers__.withStyle)("sidebar col col-xxl-4 pt-5")
103
125
  }, /*#__PURE__*/_react.default.createElement(_ProductCartSide.default, null))))));
@@ -29,24 +29,35 @@ const InternalQuotationPage = () => {
29
29
  const [{
30
30
  existingDossierId
31
31
  }] = (0, _OrderSessionContext.useOrderSession)();
32
+ const [createdEntityId, setCreatedEntityId] = _react.default.useState(null);
32
33
  const {
33
34
  createQuotation,
34
35
  isCreateQuotationSuccess,
35
36
  isCreateQuotationError,
36
- isCreatingQuotation
37
+ isCreatingQuotation,
38
+ data: createQuotationData
37
39
  } = (0, _mutations.useCreatePrivateQuotationMutation)();
38
40
  const {
39
41
  updateQuotation,
40
42
  isUpdateQuotationError,
41
43
  isUpdateQuotationSuccess,
42
- isUpdatingQuotation
44
+ isUpdatingQuotation,
45
+ data: updateQuotationData
43
46
  } = (0, _mutations.useUpdatePrivateQuotationByIdMutation)(existingDossierId);
44
47
  const handleSubmit = async payload => {
48
+ var _response$data2;
45
49
  if (existingDossierId) {
46
- await updateQuotation(payload);
50
+ var _response$data;
51
+ const response = await updateQuotation(payload);
52
+ if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && (_response$data = _response$data.data) !== null && _response$data !== void 0 && _response$data.entityId) {
53
+ setCreatedEntityId(response.data.data.entityId);
54
+ }
47
55
  return;
48
56
  }
49
- await createQuotation(payload);
57
+ const response = await createQuotation(payload);
58
+ 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) {
59
+ setCreatedEntityId(response.data.data.entityId);
60
+ }
50
61
  };
51
62
  return /*#__PURE__*/_react.default.createElement("div", {
52
63
  className: (0, _helpers__.withStyle)('vh-100')
@@ -76,7 +87,8 @@ const InternalQuotationPage = () => {
76
87
  onSubmit: handleSubmit,
77
88
  isError: isCreateQuotationError || isUpdateQuotationError,
78
89
  isLoading: isUpdatingQuotation || isCreatingQuotation,
79
- isSuccess: isCreateQuotationSuccess || isUpdateQuotationSuccess
90
+ isSuccess: isCreateQuotationSuccess || isUpdateQuotationSuccess,
91
+ entityId: createdEntityId || existingDossierId
80
92
  }))))));
81
93
  };
82
94
  var _default = exports.default = InternalQuotationPage;
@@ -2,12 +2,10 @@
2
2
 
3
3
  require("core-js/modules/es.array.includes.js");
4
4
  require("core-js/modules/es.promise.js");
5
- require("core-js/modules/es.weak-map.js");
6
5
  require("core-js/modules/esnext.iterator.constructor.js");
7
6
  require("core-js/modules/esnext.iterator.filter.js");
8
7
  require("core-js/modules/esnext.iterator.for-each.js");
9
8
  require("core-js/modules/web.dom-collections.iterator.js");
10
- require("core-js/modules/es.weak-map.js");
11
9
  require("core-js/modules/esnext.iterator.constructor.js");
12
10
  require("core-js/modules/esnext.iterator.filter.js");
13
11
  require("core-js/modules/esnext.iterator.for-each.js");
@@ -18,7 +16,7 @@ exports.default = void 0;
18
16
  require("core-js/modules/es.array.includes.js");
19
17
  require("core-js/modules/es.promise.js");
20
18
  require("core-js/modules/web.dom-collections.iterator.js");
21
- var _react = _interopRequireWildcard(require("react"));
19
+ var _react = require("react");
22
20
  var _mutations = require("../../__api__/mutations");
23
21
  var _queries = require("../../__api__/queries");
24
22
  var _LinkButton = _interopRequireDefault(require("../../__components__/Buttons/LinkButton"));
@@ -41,31 +39,6 @@ function _interopRequireDefault(e) {
41
39
  default: e
42
40
  };
43
41
  }
44
- function _getRequireWildcardCache(e) {
45
- if ("function" != typeof WeakMap) return null;
46
- var r = new WeakMap(),
47
- t = new WeakMap();
48
- return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
49
- return e ? t : r;
50
- })(e);
51
- }
52
- function _interopRequireWildcard(e, r) {
53
- if (!r && e && e.__esModule) return e;
54
- if (null === e || "object" != typeof e && "function" != typeof e) return {
55
- default: e
56
- };
57
- var t = _getRequireWildcardCache(r);
58
- if (t && t.has(e)) return t.get(e);
59
- var n = {
60
- __proto__: null
61
- },
62
- a = Object.defineProperty && Object.getOwnPropertyDescriptor;
63
- for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
64
- var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
65
- i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
66
- }
67
- return n.default = e, t && t.set(e, n), n;
68
- }
69
42
  function ownKeys(e, r) {
70
43
  var t = Object.keys(e);
71
44
  if (Object.getOwnPropertySymbols) {
@@ -114,6 +87,7 @@ const InternalSingleOrderPage = () => {
114
87
  const [customerErrors, setCustomerErrors] = (0, _react.useState)({});
115
88
  const [isDirectSelectorModalOpen, setIsDirectSelectorModalOpen] = (0, _react.useState)(false);
116
89
  const [hasUserDismissedModal, setHasUserDismissedModal] = (0, _react.useState)(false);
90
+ const [createdEntityId, setCreatedEntityId] = (0, _react.useState)(null);
117
91
  const [filters, setFilters] = (0, _react.useState)({
118
92
  type: null,
119
93
  group: null,
@@ -129,13 +103,15 @@ const InternalSingleOrderPage = () => {
129
103
  createSingleOrder,
130
104
  isCreatingSingleOrder,
131
105
  isCreateSingleOrderError,
132
- isCreateSingleOrderSuccess
106
+ isCreateSingleOrderSuccess,
107
+ data: createSingleOrderData
133
108
  } = (0, _mutations.useCreateSingleOrderMutation)();
134
109
  const {
135
110
  createShopifyOrder,
136
111
  isCreatingShopifyOrder,
137
112
  isCreateShopifyOrderError,
138
- isCreateShopifyOrderSuccess
113
+ isCreateShopifyOrderSuccess,
114
+ data: createShopifyOrderData
139
115
  } = (0, _mutations.useCreateShopifyOrderMutation)();
140
116
  const [{
141
117
  singleOrderCart,
@@ -326,7 +302,8 @@ const InternalSingleOrderPage = () => {
326
302
 
327
303
  // If webshop is selected, create Shopify order instead
328
304
  if (webshop) {
329
- createShopifyOrder({
305
+ var _response$data;
306
+ const response = await createShopifyOrder({
330
307
  licensePlate: filters.licensePlate,
331
308
  model: filters.model,
332
309
  cart: singleOrderCart,
@@ -338,10 +315,14 @@ const InternalSingleOrderPage = () => {
338
315
  channel,
339
316
  internalNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
340
317
  });
318
+ if (response !== null && response !== void 0 && (_response$data = response.data) !== null && _response$data !== void 0 && (_response$data = _response$data.data) !== null && _response$data !== void 0 && _response$data.entityId) {
319
+ setCreatedEntityId(response.data.data.entityId);
320
+ }
341
321
  } else {
322
+ var _response$data2;
342
323
  // Regular flow for offline orders
343
324
  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;
344
- createSingleOrder({
325
+ const response = await createSingleOrder({
345
326
  licensePlate: filters.licensePlate,
346
327
  model: filters.model,
347
328
  cart: singleOrderCart,
@@ -353,17 +334,21 @@ const InternalSingleOrderPage = () => {
353
334
  preferredDateTime,
354
335
  internalNote: internalNote === null || internalNote === void 0 ? void 0 : internalNote.internalNote
355
336
  });
337
+ 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) {
338
+ setCreatedEntityId(response.data.data.entityId);
339
+ }
356
340
  }
357
341
  }
358
342
  };
359
- return /*#__PURE__*/_react.default.createElement("div", {
343
+ return /*#__PURE__*/React.createElement("div", {
360
344
  className: (0, _helpers__.withStyle)('vh-100')
361
- }, (isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess) && /*#__PURE__*/_react.default.createElement(_InternalSingleOrderSuccessModal.default, {
362
- isOpen: isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess
363
- }), /*#__PURE__*/_react.default.createElement(_Header.default, {
345
+ }, (isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess) && /*#__PURE__*/React.createElement(_InternalSingleOrderSuccessModal.default, {
346
+ isOpen: isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess,
347
+ entityId: createdEntityId
348
+ }), /*#__PURE__*/React.createElement(_Header.default, {
364
349
  title: "Losse producten bestellen",
365
350
  subtitle: branchById !== null && branchById !== void 0 && branchById.name ? "Vestiging: ".concat(branchById === null || branchById === void 0 ? void 0 : branchById.name) : ''
366
- }), showProductOverview && !isCreateSingleOrderSuccess && !isCreateShopifyOrderSuccess && /*#__PURE__*/_react.default.createElement(_DirectVehicleSelectorModal.default, {
351
+ }), showProductOverview && !isCreateSingleOrderSuccess && !isCreateShopifyOrderSuccess && /*#__PURE__*/React.createElement(_DirectVehicleSelectorModal.default, {
367
352
  isOpen: isDirectSelectorModalOpen,
368
353
  onSubmit: filterModelOrLicenseplate,
369
354
  handleSelectedFilterChange: handleSelectedFilterChange,
@@ -371,11 +356,11 @@ const InternalSingleOrderPage = () => {
371
356
  setIsDirectSelectorModalOpen(false);
372
357
  setHasUserDismissedModal(true);
373
358
  }
374
- }), /*#__PURE__*/_react.default.createElement("section", {
359
+ }), /*#__PURE__*/React.createElement("section", {
375
360
  className: (0, _helpers__.withStyle)(wrapperClass)
376
- }, /*#__PURE__*/_react.default.createElement("div", {
361
+ }, /*#__PURE__*/React.createElement("div", {
377
362
  className: (0, _helpers__.withStyle)('container page-content')
378
- }, showProductOverview && /*#__PURE__*/_react.default.createElement(_InternalSingleOrderFilters.default, {
363
+ }, showProductOverview && /*#__PURE__*/React.createElement(_InternalSingleOrderFilters.default, {
379
364
  ref: filtersRef,
380
365
  resetFilters: resetFilters,
381
366
  onFilterChange: handleSelectedFilterChange,
@@ -383,32 +368,32 @@ const InternalSingleOrderPage = () => {
383
368
  setIsDirectSelectorModalOpen(true);
384
369
  setHasUserDismissedModal(false);
385
370
  }
386
- }), /*#__PURE__*/_react.default.createElement("div", {
371
+ }), /*#__PURE__*/React.createElement("div", {
387
372
  className: (0, _helpers__.withStyle)('row gx-5 mt-3 mt-lg-5')
388
- }, /*#__PURE__*/_react.default.createElement("div", {
373
+ }, /*#__PURE__*/React.createElement("div", {
389
374
  className: (0, _helpers__.withStyle)("col-xxl")
390
- }, showProductOverview ? /*#__PURE__*/_react.default.createElement(_InternalSingleOrderProductOverview.default, {
375
+ }, showProductOverview ? /*#__PURE__*/React.createElement(_InternalSingleOrderProductOverview.default, {
391
376
  removeFromCart: removeFromCart,
392
377
  filters: filters,
393
378
  paginationChange: handleSelectedFilterChange,
394
379
  handleQuantityChange: handleQuantityChange,
395
380
  cart: singleOrderCart
396
- }) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_LinkButton.default, {
381
+ }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_LinkButton.default, {
397
382
  label: "Terug naar producten",
398
383
  onClick: () => setShowProductOverview(true)
399
- }), !(isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess) && (isCreateSingleOrderError || isCreateShopifyOrderError) && /*#__PURE__*/_react.default.createElement(_DangerAlert.default, {
384
+ }), !(isCreateSingleOrderSuccess || isCreateShopifyOrderSuccess) && (isCreateSingleOrderError || isCreateShopifyOrderError) && /*#__PURE__*/React.createElement(_DangerAlert.default, {
400
385
  className: "mt-2 mx-0",
401
386
  message: "Er is iets fout gegaan bij het bestellen. Probeer het opnieuw. Momenteel kunnen in hyper alleen losse orders worden gemaakt als een kenteken of model is geselecteerd in de filters."
402
- }), /*#__PURE__*/_react.default.createElement(_InternalCustomerDetailsForm.default, {
387
+ }), /*#__PURE__*/React.createElement(_InternalCustomerDetailsForm.default, {
403
388
  ref: customerFormRef,
404
389
  errors: customerErrors,
405
390
  onValidationError: handleCustomerValidationError
406
- }))), /*#__PURE__*/_react.default.createElement("div", {
391
+ }))), /*#__PURE__*/React.createElement("div", {
407
392
  className: (0, _helpers__.withStyle)("sidebar col-xxl-auto col-lg-12 pt-3")
408
- }, (licensePlate || model) && /*#__PURE__*/_react.default.createElement(_VehicleData.default, {
393
+ }, (licensePlate || model) && /*#__PURE__*/React.createElement(_VehicleData.default, {
409
394
  key: "single-order-vehicle-data",
410
395
  isFilter: true
411
- }), /*#__PURE__*/_react.default.createElement(_InternalSingleOrderCart.default, {
396
+ }), /*#__PURE__*/React.createElement(_InternalSingleOrderCart.default, {
412
397
  resetOrderSession: resetOrderSession,
413
398
  removeFromCart: removeFromCart,
414
399
  handleQuantityChange: handleQuantityChange,
@@ -416,6 +401,6 @@ const InternalSingleOrderPage = () => {
416
401
  handleSubmit: handleSubmit,
417
402
  disabledCreateOrder: !singleOrderCart.length || isCreatingSingleOrder || isCreatingShopifyOrder,
418
403
  toggleOverview: () => setShowProductOverview(false)
419
- })))), /*#__PURE__*/_react.default.createElement(_BottomNavigationBar.default, null)));
404
+ })))), /*#__PURE__*/React.createElement(_BottomNavigationBar.default, null)));
420
405
  };
421
406
  var _default = exports.default = InternalSingleOrderPage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thm-p3-configurator",
3
- "version": "0.0.242",
3
+ "version": "0.0.243",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "author": "EnoRm.",