@crystaldesign/diva-seller 25.10.0 → 25.11.0-beta.10

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.
Files changed (22) hide show
  1. package/build/esm/index.js +630 -268
  2. package/build/types/seller/src/components/Basket/Step3Checkout.d.ts +1 -1
  3. package/build/types/seller/src/components/Basket/Step3Checkout.d.ts.map +1 -1
  4. package/build/types/seller/src/components/Basket/defaultSchema/step3.d.ts +86 -66
  5. package/build/types/seller/src/components/Basket/defaultSchema/step3.d.ts.map +1 -1
  6. package/build/types/seller/src/components/Basket/index.d.ts.map +1 -1
  7. package/build/types/seller/src/components/Basket/types.d.ts +11 -0
  8. package/build/types/seller/src/components/Basket/types.d.ts.map +1 -1
  9. package/build/types/seller/src/provider/context.d.ts +1 -0
  10. package/build/types/seller/src/provider/context.d.ts.map +1 -1
  11. package/build/types/seller/src/provider/hooks/useSellerStateData/index.d.ts +1 -0
  12. package/build/types/seller/src/provider/hooks/useSellerStateData/index.d.ts.map +1 -1
  13. package/build/types/seller/src/types.d.ts +1 -0
  14. package/build/types/seller/src/types.d.ts.map +1 -1
  15. package/build/types/seller/src/ui/Basket/CheckOut/SaveButtonsGroup.d.ts +2 -2
  16. package/build/types/seller/src/ui/Basket/CheckOut/SaveButtonsGroup.d.ts.map +1 -1
  17. package/build/types/seller/src/ui/Basket/CheckOut/index.d.ts +4 -2
  18. package/build/types/seller/src/ui/Basket/CheckOut/index.d.ts.map +1 -1
  19. package/build/types/seller/src/ui/Basket/CheckOut/statusMenu.d.ts.map +1 -1
  20. package/build/types/seller/src/ui/Basket/CheckOut/useCheckoutStep3.d.ts +19 -0
  21. package/build/types/seller/src/ui/Basket/CheckOut/useCheckoutStep3.d.ts.map +1 -0
  22. package/package.json +5 -5
@@ -45,6 +45,7 @@ import Divider from '@mui/material/Divider';
45
45
  import Alert from '@mui/material/Alert';
46
46
  import AlertTitle from '@mui/material/AlertTitle/AlertTitle';
47
47
  import Form from '@crystaldesign/forms';
48
+ import classnames from 'classnames';
48
49
  import _typeof from '@babel/runtime/helpers/typeof';
49
50
  import InputLabel from '@mui/material/InputLabel';
50
51
  import Checkbox from '@mui/material/Checkbox';
@@ -60,8 +61,8 @@ import _toArray from '@babel/runtime/helpers/toArray';
60
61
  import Box from '@mui/material/Box';
61
62
  import StarBorderIcon from '@mui/icons-material/StarBorder';
62
63
  import EditIcon from '@mui/icons-material/Edit';
64
+ import { useSellerState as useSellerState$1 } from '@crystaldesign/diva-seller/provider/SellerStateProvider';
63
65
  import OrderEntry, { apiSaveRenderJobs, VariantSelector } from '@crystaldesign/order-entry';
64
- import classnames from 'classnames';
65
66
  import { InfoRounded, Remove, Add, Delete } from '@mui/icons-material';
66
67
  import { Swiper, SwiperSlide } from 'swiper/react';
67
68
  import { Autoplay, Thumbs, Pagination, FreeMode, Mousewheel } from 'swiper/modules';
@@ -195,7 +196,10 @@ var SellerContext = /*#__PURE__*/createContext({
195
196
  loadAnalyticScore: function loadAnalyticScore() {
196
197
  return Promise.resolve({});
197
198
  },
198
- loadManualCustomDataFields: function loadManualCustomDataFields() {}
199
+ loadManualCustomDataFields: function loadManualCustomDataFields() {},
200
+ setOrdered: function setOrdered() {
201
+ return Promise.resolve({});
202
+ }
199
203
  }
200
204
  });
201
205
 
@@ -1434,9 +1438,9 @@ function _apiGetAffiliates() {
1434
1438
  return _apiGetAffiliates.apply(this, arguments);
1435
1439
  }
1436
1440
 
1437
- function _createForOfIteratorHelper$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1438
- function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
1439
- function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1441
+ function _createForOfIteratorHelper$4(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$4(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1442
+ function _unsupportedIterableToArray$4(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$4(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$4(r, a) : void 0; } }
1443
+ function _arrayLikeToArray$4(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1440
1444
  function processData(_ref) {
1441
1445
  var top = _ref.top,
1442
1446
  skip = _ref.skip,
@@ -1502,7 +1506,7 @@ function isGlobalFiltered(d, filter) {
1502
1506
  });
1503
1507
  }
1504
1508
  function orderFn(a, b, orderBy) {
1505
- var _iterator = _createForOfIteratorHelper$3(orderBy),
1509
+ var _iterator = _createForOfIteratorHelper$4(orderBy),
1506
1510
  _step;
1507
1511
  try {
1508
1512
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
@@ -1536,9 +1540,9 @@ function orderFn(a, b, orderBy) {
1536
1540
  var _excluded$a = ["collectionId"],
1537
1541
  _excluded2$2 = ["basetId"],
1538
1542
  _excluded3$1 = ["catalogCodex", "accountId", "collectionId"];
1539
- function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1540
- function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
1541
- function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1543
+ function _createForOfIteratorHelper$3(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$3(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
1544
+ function _unsupportedIterableToArray$3(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$3(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$3(r, a) : void 0; } }
1545
+ function _arrayLikeToArray$3(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
1542
1546
  function ownKeys$D(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1543
1547
  function _objectSpread$D(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$D(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$D(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1544
1548
  var LOG$9 = getLogger('Seller', 'SellerStateData');
@@ -1562,7 +1566,8 @@ function useSellerStateData(_ref) {
1562
1566
  toggleLoading = _useDivaCore$actions.toggleLoading,
1563
1567
  getSessionGuid = _useDivaCore$actions.getSessionGuid,
1564
1568
  updateCustomLogo = _useDivaCore$actions.updateCustomLogo,
1565
- openModal = _useDivaCore$actions.openModal;
1569
+ openModal = _useDivaCore$actions.openModal,
1570
+ sendEmail = _useDivaCore$actions.sendEmail;
1566
1571
  var _useTranslation = useTranslation(),
1567
1572
  i18n = _useTranslation.i18n,
1568
1573
  t = _useTranslation.t;
@@ -1900,7 +1905,7 @@ function useSellerStateData(_ref) {
1900
1905
  break;
1901
1906
  }
1902
1907
  catalogData = [];
1903
- _iterator = _createForOfIteratorHelper$2(catalog);
1908
+ _iterator = _createForOfIteratorHelper$3(catalog);
1904
1909
  _context5.prev = 12;
1905
1910
  _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
1906
1911
  var _collection$enricherS3;
@@ -2745,6 +2750,100 @@ function useSellerStateData(_ref) {
2745
2750
  });
2746
2751
  }
2747
2752
  };
2753
+ var setOrdered = /*#__PURE__*/function () {
2754
+ var _ref19 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(basket, sendOrderEmail) {
2755
+ var to, emails, _iterator2, _step2, mail, _basket$Client;
2756
+ return _regeneratorRuntime.wrap(function _callee10$(_context11) {
2757
+ while (1) switch (_context11.prev = _context11.next) {
2758
+ case 0:
2759
+ if (!jwt) {
2760
+ _context11.next = 8;
2761
+ break;
2762
+ }
2763
+ if (!(sendOrderEmail && organization.settings.sendOrdersEmail)) {
2764
+ _context11.next = 6;
2765
+ break;
2766
+ }
2767
+ to = [organization.settings.sendOrdersEmail];
2768
+ if (configData !== null && configData !== void 0 && configData.sendOrderEmails) {
2769
+ emails = configData.sendOrderEmails.split(',');
2770
+ _iterator2 = _createForOfIteratorHelper$3(emails);
2771
+ try {
2772
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
2773
+ mail = _step2.value;
2774
+ if (mail == 'CLIENT') {
2775
+ if ((_basket$Client = basket.Client) !== null && _basket$Client !== void 0 && _basket$Client.email) to.push(basket.Client.email);
2776
+ } else if (mail == 'SELLER') {
2777
+ if (basket.SalespersonEmail) to.push(basket.SalespersonEmail);
2778
+ } else if (mail == 'ORGANIZATION') {
2779
+ if (organization !== null && organization !== void 0 && organization.email) to.push(organization.email);
2780
+ } else if (mail == 'USER') {
2781
+ if (currentUser !== null && currentUser !== void 0 && currentUser.mainEmail) to.push(currentUser.mainEmail);
2782
+ }
2783
+ }
2784
+ } catch (err) {
2785
+ _iterator2.e(err);
2786
+ } finally {
2787
+ _iterator2.f();
2788
+ }
2789
+ }
2790
+ try {
2791
+ toggleLoading('setOrdered');
2792
+ sendEmail({
2793
+ showDialog: false,
2794
+ callback: function callback(success) {
2795
+ if (success) {
2796
+ basketHandler.setOrdered({
2797
+ serviceUrl: apiConfig.basketService,
2798
+ organizationId: currentOrganization === null || currentOrganization === void 0 ? void 0 : currentOrganization._id,
2799
+ jwt: jwt,
2800
+ divaNr: basket.DivaNr,
2801
+ documentVersion: basket.DocumentVersion - 1 //actual document version
2802
+ });
2803
+ toggleLoading('setOrdered');
2804
+ openModal({
2805
+ title: t('basket.checkout.modals.ordered'),
2806
+ accept: true
2807
+ });
2808
+ } else {
2809
+ toggleLoading('setOrdered');
2810
+ openModal({
2811
+ title: t('basket.checkout.modals.orderederror'),
2812
+ accept: true
2813
+ });
2814
+ }
2815
+ },
2816
+ content: {
2817
+ to: to.join(','),
2818
+ type: 'basket',
2819
+ variant: 'SEND',
2820
+ divaNr: basket.DivaNr,
2821
+ version: basket.DocumentVersion
2822
+ }
2823
+ });
2824
+ } catch (e) {
2825
+ console.error(e);
2826
+ }
2827
+ return _context11.abrupt("return");
2828
+ case 6:
2829
+ _context11.next = 8;
2830
+ return basketHandler.setOrdered({
2831
+ serviceUrl: apiConfig.basketService,
2832
+ organizationId: currentOrganization === null || currentOrganization === void 0 ? void 0 : currentOrganization._id,
2833
+ jwt: jwt,
2834
+ divaNr: basket.DivaNr,
2835
+ documentVersion: basket.DocumentVersion - 1
2836
+ });
2837
+ case 8:
2838
+ case "end":
2839
+ return _context11.stop();
2840
+ }
2841
+ }, _callee10);
2842
+ }));
2843
+ return function setOrdered(_x17, _x18) {
2844
+ return _ref19.apply(this, arguments);
2845
+ };
2846
+ }();
2748
2847
  return {
2749
2848
  state: state,
2750
2849
  setFirstLoginApiUrl: setFirstLoginApiUrl,
@@ -2770,7 +2869,8 @@ function useSellerStateData(_ref) {
2770
2869
  resetForCache: resetForCache,
2771
2870
  loadAnalyticScore: loadAnalyticScore,
2772
2871
  setManualCustomDataFields: setManualCustomDataFields,
2773
- setCloseOnSave: setCloseOnSave
2872
+ setCloseOnSave: setCloseOnSave,
2873
+ setOrdered: setOrdered
2774
2874
  };
2775
2875
  }
2776
2876
 
@@ -6028,8 +6128,8 @@ function styleInject(css, ref) {
6028
6128
 
6029
6129
  var infocontainer$1 = "infocontainer-ir9gv";
6030
6130
  var stepsContent = "steps-content-jDbLc";
6031
- var css_248z$c = ".infocontainer-ir9gv {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.steps-content-jDbLc {\n margin-left: 10px;\n padding-top: 10px;\n padding-right: 10px;\n height: 100%;\n overflow-y: auto;\n}\n\n.steps-content-jDbLc #diva-order-entry-footer > span > div {\n width: 500px;\n}\n\n.steps-content-jDbLc #diva-order-entry-footer > span > div > span {\n margin-left: 110px;\n}\n";
6032
- styleInject(css_248z$c);
6131
+ var css_248z$d = ".infocontainer-ir9gv {\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n.steps-content-jDbLc {\n margin-left: 10px;\n padding-top: 10px;\n padding-right: 10px;\n height: 100%;\n overflow-y: auto;\n}\n\n.steps-content-jDbLc #diva-order-entry-footer > span > div {\n width: 500px;\n}\n\n.steps-content-jDbLc #diva-order-entry-footer > span > div > span {\n margin-left: 110px;\n}\n";
6132
+ styleInject(css_248z$d);
6033
6133
 
6034
6134
  function Step2ClientData(_ref) {
6035
6135
  var _config$clientData, _config$clientData2;
@@ -6058,6 +6158,19 @@ function Step2ClientData(_ref) {
6058
6158
  });
6059
6159
  }
6060
6160
 
6161
+ var saveButton = "saveButton-vFkgp";
6162
+ var newPlanningButton = "newPlanningButton-rpBS2";
6163
+ var saveButtonGroup = "saveButtonGroup-r-Uwi";
6164
+ var checkoutButtonGroupWrapper = "checkoutButtonGroupWrapper-KU9eI";
6165
+ var checkout3Container = "checkout3Container-efdnR";
6166
+ var checkout3Header = "checkout3Header-Kph7T";
6167
+ var checkoutHeaderButtonGroup = "checkoutHeaderButtonGroup-ao8TM";
6168
+ var gdprCheckbox = "gdprCheckbox-jqVEK";
6169
+ var checkoutForm = "checkoutForm-wZEGN";
6170
+ var checkoutStatusButton = "checkoutStatusButton-aTyfj";
6171
+ var css_248z$c = ".saveButton-vFkgp {\n width: 25%;\n}\n\n.newPlanningButton-rpBS2 {\n width: 20%;\n}\n.saveButtonGroup-r-Uwi {\n text-align: right !important;\n}\n\n.checkoutButtonGroupWrapper-KU9eI {\n margin-top: 0.4rem;\n}\n\n.checkout3Container-efdnR {\n display: flex;\n flex-direction: column;\n width: 95%;\n max-width: 1600px;\n margin: 1rem;\n}\n\n.checkout3Header-Kph7T {\n display: flex;\n flex-direction: row;\n width: 50%;\n}\n\n.checkoutHeaderButtonGroup-ao8TM {\n margin-top: 0.4rem;\n margin-bottom: 1rem;\n margin-left: 1rem;\n width: 100%;\n}\n.gdprCheckbox-jqVEK {\n margin-left: 40px;\n}\n\n.checkoutForm-wZEGN {\n width: 100%;\n max-height: 630px;\n}\n.checkoutStatusButton-aTyfj {\n min-width: 100px !important;\n}\n\n@media (max-width: 600px) {\n .checkout3Header-Kph7T {\n justify-content: center;\n flex-direction: column;\n width: 100%;\n }\n .checkoutStatusButton-aTyfj {\n min-width: 70px !important;\n }\n .checkoutHeaderButtonGroup-ao8TM {\n margin-top: 0.4rem;\n margin-bottom: 1rem;\n margin-left: 0;\n width: 100%;\n }\n .checkoutButtonGroupWrapper-KU9eI {\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n }\n .saveButton-vFkgp {\n width: auto;\n width: initial;\n }\n\n .newPlanningButton-rpBS2 {\n width: auto;\n width: initial;\n }\n .checkoutForm-wZEGN {\n width: 100%;\n max-height: none;\n max-height: initial;\n }\n}\n";
6172
+ styleInject(css_248z$c);
6173
+
6061
6174
  function StatusMenu(_ref) {
6062
6175
  var visibleStatus = _ref.visibleStatus,
6063
6176
  status = _ref.status,
@@ -6069,19 +6182,17 @@ function StatusMenu(_ref) {
6069
6182
  var _useTranslation = useTranslation(),
6070
6183
  t = _useTranslation.t;
6071
6184
  return /*#__PURE__*/jsx("div", {
6072
- style: {
6073
- "float": 'left',
6074
- marginTop: '0.4rem',
6075
- marginLeft: '1rem'
6076
- },
6185
+ className: checkoutHeaderButtonGroup,
6077
6186
  children: /*#__PURE__*/jsx(ButtonGroup$1, {
6078
6187
  color: "primary",
6079
6188
  "aria-label": "outlined primary button group",
6189
+ fullWidth: true,
6080
6190
  children: visibleStatus.filter(function (item) {
6081
6191
  return typeof item == 'string';
6082
6192
  }) //filter out old configuration,where it was an object
6083
6193
  .map(function (item) {
6084
6194
  return /*#__PURE__*/jsx(Button, {
6195
+ className: checkoutStatusButton,
6085
6196
  variant: status == item ? 'contained' : 'outlined',
6086
6197
  size: "small",
6087
6198
  onClick: function onClick() {
@@ -6111,80 +6222,55 @@ function SaveButtonsGroup(_ref) {
6111
6222
  orderEmpty = _ref.orderEmpty,
6112
6223
  status = _ref.status,
6113
6224
  configSaveButtons = _ref.configSaveButtons,
6114
- userInfoPresent = _ref.userInfoPresent;
6225
+ validData = _ref.validData;
6115
6226
  var _useTranslation = useTranslation(),
6116
6227
  t = _useTranslation.t;
6117
6228
  var classes = useStyles$1();
6118
6229
  return /*#__PURE__*/jsxs("div", {
6119
- style: {
6120
- marginTop: '0.4rem',
6121
- marginLeft: '2.5rem'
6122
- },
6230
+ className: checkoutButtonGroupWrapper,
6123
6231
  children: [(configSaveButtons === null || configSaveButtons === void 0 ? void 0 : configSaveButtons.includes('SAVE')) && /*#__PURE__*/jsx(Button$1, {
6124
6232
  variant: "contained",
6125
6233
  size: "medium",
6126
6234
  color: "primary",
6127
- disabled: orderEmpty,
6235
+ disabled: orderEmpty || !validData,
6128
6236
  onClick: function onClick() {
6129
6237
  onClickSave();
6130
6238
  },
6131
- className: classes.margin,
6239
+ className: classnames(classes.margin, saveButton),
6132
6240
  children: t('basket.checkout.actions.save')
6133
- }), (configSaveButtons === null || configSaveButtons === void 0 ? void 0 : configSaveButtons.includes('SAVE_AND_SEND')) && status !== 'BASE_CONFIGURATION' && /*#__PURE__*/jsx(Button$1, {
6134
- variant: "outlined",
6135
- size: "medium",
6136
- color: "primary",
6137
- disabled: orderEmpty || !userInfoPresent,
6138
- onClick: function onClick() {
6139
- onClickSave('generate', true);
6140
- },
6141
- className: classes.margin,
6142
- children: t('basket.checkout.actions.saveAndSendMail', {
6143
- type: t('data.' + status)
6144
- })
6145
- }), (configSaveButtons === null || configSaveButtons === void 0 ? void 0 : configSaveButtons.includes('SAVE_AND_OPEN')) && status !== 'BASE_CONFIGURATION' && /*#__PURE__*/jsx(Button$1, {
6146
- variant: "outlined",
6147
- size: "medium",
6148
- color: "primary",
6149
- disabled: orderEmpty,
6150
- onClick: function onClick() {
6151
- onClickSave('open');
6152
- },
6153
- className: classes.margin,
6154
- children: t('basket.checkout.actions.saveAndOpenNote', {
6155
- type: t('data.' + status)
6156
- })
6157
- }), status == 'BASE_CONFIGURATION' && /*#__PURE__*/jsx(Tooltip, {
6158
- title: t('checkout.product.asfavbuttontooltip'),
6159
- placement: "bottom",
6160
- arrow: true,
6161
- children: /*#__PURE__*/jsx(Button$1, {
6241
+ }), status == 'BASE_CONFIGURATION' && /*#__PURE__*/jsxs(Fragment, {
6242
+ children: [/*#__PURE__*/jsx(Tooltip, {
6243
+ title: t('checkout.product.asfavbuttontooltip'),
6244
+ placement: "bottom",
6245
+ arrow: true,
6246
+ children: /*#__PURE__*/jsx(Button$1, {
6247
+ variant: "outlined",
6248
+ size: "medium",
6249
+ color: "primary",
6250
+ disabled: orderEmpty,
6251
+ onClick: function onClick() {
6252
+ onClickSave(undefined, false, true);
6253
+ },
6254
+ className: classes.margin,
6255
+ children: t('basket.checkout.actions.saveAsFavorite')
6256
+ })
6257
+ }), /*#__PURE__*/jsx(Button$1, {
6162
6258
  variant: "outlined",
6163
6259
  size: "medium",
6164
6260
  color: "primary",
6165
6261
  disabled: orderEmpty,
6166
6262
  onClick: function onClick() {
6167
- onClickSave(undefined, false, true);
6263
+ onClickSave(undefined, false, true, true);
6168
6264
  },
6169
6265
  className: classes.margin,
6170
- children: t('basket.checkout.actions.saveAsFavorite')
6171
- })
6172
- }), status == 'BASE_CONFIGURATION' && /*#__PURE__*/jsx(Button$1, {
6173
- variant: "outlined",
6174
- size: "medium",
6175
- color: "primary",
6176
- disabled: orderEmpty,
6177
- onClick: function onClick() {
6178
- onClickSave(undefined, false, true, true);
6179
- },
6180
- className: classes.margin,
6181
- children: t('basket.checkout.actions.saveAndOrderMedia')
6266
+ children: t('basket.checkout.actions.saveAndOrderMedia')
6267
+ })]
6182
6268
  }), (configSaveButtons === null || configSaveButtons === void 0 ? void 0 : configSaveButtons.includes('NEW')) && /*#__PURE__*/jsx(Button$1, {
6183
6269
  variant: "outlined",
6184
6270
  size: "medium",
6185
6271
  color: "primary",
6186
6272
  onClick: startWithEmptyBasket,
6187
- className: classes.margin,
6273
+ className: classnames(classes.margin, newPlanningButton),
6188
6274
  children: t('basket.checkout.actions.newOrder')
6189
6275
  })]
6190
6276
  });
@@ -6736,10 +6822,145 @@ function InfoAlert(_ref2) {
6736
6822
  });
6737
6823
  }
6738
6824
 
6825
+ function _createForOfIteratorHelper$2(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray$2(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
6826
+ function _unsupportedIterableToArray$2(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$2(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$2(r, a) : void 0; } }
6827
+ function _arrayLikeToArray$2(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
6828
+ var useCheckoutStep3 = function useCheckoutStep3(schema) {
6829
+ var _useState = useState(false),
6830
+ _useState2 = _slicedToArray(_useState, 2),
6831
+ basket3DExportChecked = _useState2[0],
6832
+ setBasket3DExportChecked = _useState2[1];
6833
+ var _useState3 = useState(false),
6834
+ _useState4 = _slicedToArray(_useState3, 2),
6835
+ basketSendMailChecked = _useState4[0],
6836
+ setBasketSendMailChecked = _useState4[1];
6837
+ var _useState5 = useState(false),
6838
+ _useState6 = _slicedToArray(_useState5, 2),
6839
+ basketSendOrderChecked = _useState6[0],
6840
+ setBasketSendOrderChecked = _useState6[1];
6841
+ var setVirtualFields = useCallback(function (key, value) {
6842
+ switch (key) {
6843
+ case 'Order3DExport':
6844
+ setBasket3DExportChecked(value);
6845
+ break;
6846
+ case 'SendMail':
6847
+ setBasketSendMailChecked(value);
6848
+ break;
6849
+ case 'SendOrder':
6850
+ setBasketSendOrderChecked(value);
6851
+ break;
6852
+ }
6853
+ }, []);
6854
+ var getVirtualFields = useCallback(function (key) {
6855
+ switch (key) {
6856
+ case 'Order3DExport':
6857
+ return basket3DExportChecked;
6858
+ case 'SendMail':
6859
+ return basketSendMailChecked;
6860
+ case 'SendOrder':
6861
+ return basketSendOrderChecked;
6862
+ default:
6863
+ return undefined;
6864
+ }
6865
+ }, [basket3DExportChecked, basketSendMailChecked, basketSendOrderChecked]);
6866
+ var getVirtualFieldsObject = useCallback(function () {
6867
+ var virtualFields = {};
6868
+ for (var key in schema.properties) {
6869
+ var _schema$properties;
6870
+ if ((_schema$properties = schema.properties) !== null && _schema$properties !== void 0 && (_schema$properties = _schema$properties[key]) !== null && _schema$properties !== void 0 && (_schema$properties = _schema$properties.properties) !== null && _schema$properties !== void 0 && _schema$properties.virtual) {
6871
+ virtualFields[key] = getVirtualFields(key);
6872
+ }
6873
+ }
6874
+ return virtualFields;
6875
+ }, [getVirtualFields, schema]);
6876
+ function validateRequiredFieldsFromSchema(schema, data) {
6877
+ var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
6878
+ try {
6879
+ var requiredFields = schema.required || [];
6880
+ var _iterator = _createForOfIteratorHelper$2(requiredFields),
6881
+ _step;
6882
+ try {
6883
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6884
+ var field = _step.value;
6885
+ var value = data === null || data === void 0 ? void 0 : data[field];
6886
+ if (value === undefined || value === null || typeof value === 'string' && value.trim() === '') {
6887
+ return false;
6888
+ }
6889
+ }
6890
+ // Recursive through nested objects
6891
+ } catch (err) {
6892
+ _iterator.e(err);
6893
+ } finally {
6894
+ _iterator.f();
6895
+ }
6896
+ for (var _i = 0, _Object$entries = Object.entries(schema.properties || {}); _i < _Object$entries.length; _i++) {
6897
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
6898
+ key = _Object$entries$_i[0],
6899
+ propSchema = _Object$entries$_i[1];
6900
+ if (propSchema.type === 'object' && data !== null && data !== void 0 && data[key]) {
6901
+ var isValid = validateRequiredFieldsFromSchema(propSchema, data[key], path ? "".concat(path, ".").concat(key) : key);
6902
+ if (!isValid) {
6903
+ return false;
6904
+ }
6905
+ }
6906
+ }
6907
+ return true;
6908
+ } catch (error) {
6909
+ return false;
6910
+ }
6911
+ }
6912
+ function removeElementByKey(schema, key) {
6913
+ var parentElement = findElementByKey(schema, 'AdditionalOptions');
6914
+ if (parentElement && Array.isArray(parentElement.elements)) {
6915
+ var index = parentElement.elements.findIndex(function (e) {
6916
+ return e.key === key;
6917
+ });
6918
+ if (index >= 0) {
6919
+ parentElement.elements.splice(index, 1);
6920
+ }
6921
+ }
6922
+ }
6923
+ function findElementByKey(schema, targetKey) {
6924
+ if (Array.isArray(schema)) {
6925
+ var _iterator2 = _createForOfIteratorHelper$2(schema),
6926
+ _step2;
6927
+ try {
6928
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
6929
+ var item = _step2.value;
6930
+ var found = findElementByKey(item, targetKey);
6931
+ if (found) return found;
6932
+ }
6933
+ } catch (err) {
6934
+ _iterator2.e(err);
6935
+ } finally {
6936
+ _iterator2.f();
6937
+ }
6938
+ } else {
6939
+ if (schema.key === targetKey) {
6940
+ return schema;
6941
+ }
6942
+ if (schema.elements && Array.isArray(schema.elements)) {
6943
+ var foundInChildren = findElementByKey(schema.elements, targetKey);
6944
+ if (foundInChildren) return foundInChildren;
6945
+ }
6946
+ }
6947
+ return null;
6948
+ }
6949
+ return {
6950
+ setVirtualFields: setVirtualFields,
6951
+ getVirtualFields: getVirtualFields,
6952
+ getVirtualFieldsObject: getVirtualFieldsObject,
6953
+ basket3DExportChecked: basket3DExportChecked,
6954
+ basketSendMailChecked: basketSendMailChecked,
6955
+ basketSendOrderChecked: basketSendOrderChecked,
6956
+ validateRequiredFieldsFromSchema: validateRequiredFieldsFromSchema,
6957
+ removeElementByKey: removeElementByKey
6958
+ };
6959
+ };
6960
+
6739
6961
  function ownKeys$v(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6740
6962
  function _objectSpread$v(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$v(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$v(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6741
6963
  function CheckOut(_ref) {
6742
- var _basket$Client;
6743
6964
  var schema = _ref.schema,
6744
6965
  uiSchema = _ref.uiSchema,
6745
6966
  renderService = _ref.renderService,
@@ -6755,19 +6976,28 @@ function CheckOut(_ref) {
6755
6976
  productIsLoading = _ref.productIsLoading,
6756
6977
  saveProduct = _ref.saveProduct,
6757
6978
  updateProductData = _ref.updateProductData,
6758
- gdpr = _ref.gdpr;
6979
+ gdpr = _ref.gdpr,
6980
+ schemaSettings = _ref.schemaSettings;
6981
+ var _useCheckoutStep = useCheckoutStep3(schema),
6982
+ setVirtualFields = _useCheckoutStep.setVirtualFields,
6983
+ getVirtualFieldsObject = _useCheckoutStep.getVirtualFieldsObject,
6984
+ basket3DExportChecked = _useCheckoutStep.basket3DExportChecked,
6985
+ basketSendMailChecked = _useCheckoutStep.basketSendMailChecked,
6986
+ basketSendOrderChecked = _useCheckoutStep.basketSendOrderChecked,
6987
+ validateRequiredFieldsFromSchema = _useCheckoutStep.validateRequiredFieldsFromSchema,
6988
+ removeElementByKey = _useCheckoutStep.removeElementByKey;
6759
6989
  var _useState = useState(false),
6760
6990
  _useState2 = _slicedToArray(_useState, 2),
6761
6991
  isSaving = _useState2[0],
6762
6992
  setIsSaving = _useState2[1];
6763
6993
  var _useState3 = useState(false),
6764
6994
  _useState4 = _slicedToArray(_useState3, 2),
6765
- basket3DExportChecked = _useState4[0],
6766
- setBasket3DExportChecked = _useState4[1];
6995
+ productSaved = _useState4[0],
6996
+ setProductSaved = _useState4[1];
6767
6997
  var _useState5 = useState(false),
6768
6998
  _useState6 = _slicedToArray(_useState5, 2),
6769
- productSaved = _useState6[0],
6770
- setProductSaved = _useState6[1];
6999
+ validData = _useState6[0],
7000
+ setValidData = _useState6[1];
6771
7001
  var _useTranslation = useTranslation(),
6772
7002
  t = _useTranslation.t;
6773
7003
  var _useSellerState = useSellerState(),
@@ -6776,8 +7006,10 @@ function CheckOut(_ref) {
6776
7006
  _useDivaCore$actions = _useDivaCore.actions,
6777
7007
  userHasPermission = _useDivaCore$actions.userHasPermission,
6778
7008
  toggleLoading = _useDivaCore$actions.toggleLoading,
6779
- openModal = _useDivaCore$actions.openModal,
6780
- organization = _useDivaCore.state.organization;
7009
+ openModal = _useDivaCore$actions.openModal;
7010
+ useEffect(function () {
7011
+ setValidData(validateRequiredFieldsFromSchema(schema, basket));
7012
+ }, []);
6781
7013
  var handleSave = useCallback(/*#__PURE__*/function () {
6782
7014
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(openPDF, sendMail, isFav) {
6783
7015
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -6815,8 +7047,12 @@ function CheckOut(_ref) {
6815
7047
  return _context.abrupt("return");
6816
7048
  case 17:
6817
7049
  if (!isSaving) {
7050
+ openPDF = 'open';
6818
7051
  setIsSaving(true);
6819
- onClickSave(openPDF, sendMail, basket3DExportChecked)["finally"](function () {
7052
+ if (basketSendMailChecked) {
7053
+ sendMail = true;
7054
+ }
7055
+ onClickSave(openPDF, sendMail, basket3DExportChecked, basketSendOrderChecked)["finally"](function () {
6820
7056
  return setIsSaving(false);
6821
7057
  });
6822
7058
  }
@@ -6829,12 +7065,18 @@ function CheckOut(_ref) {
6829
7065
  return function (_x, _x2, _x3) {
6830
7066
  return _ref2.apply(this, arguments);
6831
7067
  };
6832
- }(), [isSaving, onClickSave, basket3DExportChecked]);
7068
+ }(), [isSaving, onClickSave, basket3DExportChecked, basketSendMailChecked, basketSendOrderChecked, toggleLoading, saveProduct, status, openModal, t]);
6833
7069
  var onChangeForm = function onChangeForm(_ref3) {
6834
7070
  var data = _ref3.data;
6835
7071
  for (var key in data) {
7072
+ var _schema$properties;
7073
+ if ((_schema$properties = schema.properties) !== null && _schema$properties !== void 0 && (_schema$properties = _schema$properties[key]) !== null && _schema$properties !== void 0 && (_schema$properties = _schema$properties.properties) !== null && _schema$properties !== void 0 && _schema$properties.virtual) {
7074
+ setVirtualFields(key, data[key]);
7075
+ continue;
7076
+ }
6836
7077
  basket[key] = data[key];
6837
7078
  }
7079
+ setValidData(validateRequiredFieldsFromSchema(schema, data));
6838
7080
  };
6839
7081
 
6840
7082
  // for LEAFLET don't show printOptions, if there are any configured.
@@ -6849,22 +7091,23 @@ function CheckOut(_ref) {
6849
7091
  finalSchema.elements.splice(index, 1);
6850
7092
  }
6851
7093
  }
7094
+ if (status !== 'ORDER' || !schemaSettings.showSendOrder) {
7095
+ removeElementByKey(finalSchema, 'SendOrder');
7096
+ }
7097
+ if (!schemaSettings.show3dExport) {
7098
+ removeElementByKey(finalSchema, 'Order3DExport');
7099
+ }
7100
+ if (schemaSettings.hideWWSButton) {
7101
+ removeElementByKey(finalSchema, 'SendIWOBasket');
7102
+ }
6852
7103
  var permissionAnyHqRenderBox = userHasPermission('anyhqrenderbox');
6853
- var handleCheckBoxChange = function handleCheckBoxChange(event) {
6854
- setBasket3DExportChecked(event.target.checked);
6855
- };
6856
7104
  return /*#__PURE__*/jsxs("div", {
6857
- style: {
6858
- display: 'flex',
6859
- flexDirection: 'column'
6860
- },
7105
+ id: "checkout3Container",
7106
+ className: checkout3Container,
6861
7107
  children: [/*#__PURE__*/jsxs("div", {
7108
+ id: "checkout3Header",
7109
+ className: checkout3Header,
6862
7110
  children: [/*#__PURE__*/jsx(Typography, {
6863
- style: {
6864
- "float": 'left',
6865
- marginLeft: '50px',
6866
- width: 'fit-content'
6867
- },
6868
7111
  variant: "h4",
6869
7112
  children: "Checkout"
6870
7113
  }), /*#__PURE__*/jsx(StatusMenu, {
@@ -6881,45 +7124,19 @@ function CheckOut(_ref) {
6881
7124
  handleSave: handleSave,
6882
7125
  updateProductData: updateProductData,
6883
7126
  disabled: basket.OrderSets.length > 1
6884
- }), status !== 'BASE_CONFIGURATION' && /*#__PURE__*/jsxs(Fragment, {
6885
- children: [/*#__PURE__*/jsx("div", {
6886
- style: {
6887
- margin: '1rem',
6888
- marginLeft: '50px',
6889
- width: '700px'
6890
- },
6891
- children: /*#__PURE__*/jsx(Form, {
6892
- data: basket,
6893
- onChange: onChangeForm,
6894
- schema: schema,
6895
- uischema: finalSchema,
6896
- renderer: "material"
6897
- })
7127
+ }), status !== 'BASE_CONFIGURATION' && /*#__PURE__*/jsxs("div", {
7128
+ className: checkoutForm,
7129
+ children: [/*#__PURE__*/jsx(Form, {
7130
+ data: _objectSpread$v(_objectSpread$v({}, basket), getVirtualFieldsObject()),
7131
+ onChange: onChangeForm,
7132
+ schema: schema,
7133
+ uischema: finalSchema,
7134
+ renderer: "material"
6898
7135
  }), !!renderService && permissionAnyHqRenderBox && (catalogData === null || catalogData === void 0 ? void 0 : catalogData[0].has3D) && /*#__PURE__*/jsx(HqRenderBox, {
6899
7136
  basket: basket,
6900
7137
  config: renderService
6901
- }), (catalogData === null || catalogData === void 0 ? void 0 : catalogData.find(function (c) {
6902
- return !c.disable3DExport;
6903
- })) && (catalogData === null || catalogData === void 0 ? void 0 : catalogData.find(function (c) {
6904
- return c.has3D;
6905
- })) && organization.settings.enable3DExport && /*#__PURE__*/jsxs("div", {
6906
- style: {
6907
- marginLeft: '50px',
6908
- width: '700px'
6909
- },
6910
- children: [/*#__PURE__*/jsx(FormControlLabel$1, {
6911
- control: /*#__PURE__*/jsx(Checkbox$1, {
6912
- onChange: handleCheckBoxChange
6913
- }),
6914
- label: t('basket.checkout.order3dexport')
6915
- }), /*#__PURE__*/jsxs(Typography, {
6916
- variant: "caption",
6917
- children: ["(", t('basket.checkout.3dexport'), ")"]
6918
- })]
6919
- }), gdpr && !isEmpty(basket === null || basket === void 0 ? void 0 : basket.Client) && /*#__PURE__*/jsx(FormControlLabel$1, {
6920
- style: {
6921
- marginLeft: '40px'
6922
- },
7138
+ }), gdpr && !isEmpty$1(basket === null || basket === void 0 ? void 0 : basket.Client) && /*#__PURE__*/jsx(FormControlLabel$1, {
7139
+ className: gdprCheckbox,
6923
7140
  label: t('basket.checkout.gdpr'),
6924
7141
  control: /*#__PURE__*/jsx(Checkbox$1, {
6925
7142
  checked: basket === null || basket === void 0 ? void 0 : basket.Gdpr,
@@ -6930,17 +7147,20 @@ function CheckOut(_ref) {
6930
7147
  })
6931
7148
  })]
6932
7149
  })]
6933
- }), status !== 'BASE_CONFIGURATION' && /*#__PURE__*/jsx(SaveButtonsGroup, {
6934
- orderEmpty: !basket.OrderSets || basket.OrderSets.length == 0 || gdpr && !isEmpty(basket === null || basket === void 0 ? void 0 : basket.Client) && !basket.Gdpr,
6935
- onClickSave: handleSave,
6936
- startWithEmptyBasket: startWithEmptyBasket,
6937
- status: status,
6938
- configSaveButtons: configSaveButtons,
6939
- userInfoPresent: !!((_basket$Client = basket.Client) !== null && _basket$Client !== void 0 && _basket$Client.email)
7150
+ }), status !== 'BASE_CONFIGURATION' && /*#__PURE__*/jsx("div", {
7151
+ className: saveButtonGroup,
7152
+ children: /*#__PURE__*/jsx(SaveButtonsGroup, {
7153
+ orderEmpty: !basket.OrderSets || basket.OrderSets.length == 0 || gdpr && !isEmpty$1(basket === null || basket === void 0 ? void 0 : basket.Client) && !basket.Gdpr,
7154
+ onClickSave: handleSave,
7155
+ startWithEmptyBasket: startWithEmptyBasket,
7156
+ status: status,
7157
+ configSaveButtons: configSaveButtons,
7158
+ validData: validData
7159
+ })
6940
7160
  })]
6941
7161
  });
6942
7162
  }
6943
- function isEmpty(data) {
7163
+ function isEmpty$1(data) {
6944
7164
  if (!data) {
6945
7165
  return true;
6946
7166
  }
@@ -6950,13 +7170,14 @@ function isEmpty(data) {
6950
7170
  return false;
6951
7171
  }
6952
7172
  return Object.keys(data).every(function (k) {
6953
- return isEmpty(data[k]);
7173
+ return isEmpty$1(data[k]);
6954
7174
  });
6955
7175
  }
6956
7176
 
6957
7177
  function ownKeys$u(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6958
7178
  function _objectSpread$u(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$u(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$u(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6959
- var schema = function schema(hideWWSButton) {
7179
+ var schema = function schema(settings) {
7180
+ var _settings$sendMail;
6960
7181
  return {
6961
7182
  type: 'object',
6962
7183
  properties: _objectSpread$u(_objectSpread$u({
@@ -6988,12 +7209,35 @@ var schema = function schema(hideWWSButton) {
6988
7209
  type: ['string', 'null'],
6989
7210
  title: 'basket.checkout.form.sellerNr'
6990
7211
  }
6991
- }, !hideWWSButton ? {
7212
+ }, !settings.hideWWSButton ? {
6992
7213
  SendIWOBasket: {
6993
7214
  type: 'boolean',
6994
7215
  title: 'basket.checkout.form.sendIwoBasket'
6995
7216
  }
6996
7217
  } : {}), {}, {
7218
+ Order3DExport: {
7219
+ type: 'boolean',
7220
+ title: 'basket.checkout.order3dexport',
7221
+ description: 'basket.checkout.3dexport',
7222
+ properties: {
7223
+ virtual: true
7224
+ }
7225
+ },
7226
+ SendMail: {
7227
+ type: 'boolean',
7228
+ title: 'basket.checkout.form.sendMail',
7229
+ readOnly: (_settings$sendMail = settings.sendMail) === null || _settings$sendMail === void 0 ? void 0 : _settings$sendMail.disabled,
7230
+ properties: {
7231
+ virtual: true
7232
+ }
7233
+ },
7234
+ SendOrder: {
7235
+ type: 'boolean',
7236
+ title: 'basket.checkout.form.sendOrder',
7237
+ properties: {
7238
+ virtual: true
7239
+ }
7240
+ },
6997
7241
  PrintOptions: {
6998
7242
  type: 'object',
6999
7243
  properties: {
@@ -7046,154 +7290,222 @@ var schema = function schema(hideWWSButton) {
7046
7290
  })
7047
7291
  };
7048
7292
  };
7049
- var uiSchema = function uiSchema(hideWWSButton, enableSellerInfos) {
7293
+ var uiSchema = function uiSchema(settings) {
7050
7294
  return {
7051
7295
  type: 'VerticalLayout',
7052
7296
  elements: [{
7053
- type: 'HorizontalLayout',
7297
+ key: 'BasicData',
7298
+ type: 'Group',
7299
+ label: 'basket.checkout.form.basicData',
7054
7300
  elements: [{
7055
- type: 'Control',
7056
- scope: '#/properties/RetailerOfferNum'
7057
- }, {
7058
- type: 'Control',
7059
- scope: '#/properties/RetailerName',
7060
- rule: {
7061
- effect: 'ENABLE',
7062
- condition: {
7063
- scope: '#/properties/RetailerName',
7064
- schema: {
7065
- "const": '----'
7066
- }
7067
- }
7068
- }
7069
- }, {
7070
- type: 'Control',
7071
- scope: '#/properties/RetailerNr',
7072
- rule: {
7073
- effect: 'ENABLE',
7074
- condition: {
7075
- scope: '#/properties/RetailerName',
7076
- schema: {
7077
- "const": '----'
7301
+ type: 'HorizontalLayout',
7302
+ elements: [{
7303
+ type: 'Control',
7304
+ scope: '#/properties/RetailerOfferNum'
7305
+ }, {
7306
+ type: 'Control',
7307
+ scope: '#/properties/RetailerName',
7308
+ rule: {
7309
+ effect: 'ENABLE',
7310
+ condition: {
7311
+ scope: '#/properties/RetailerName',
7312
+ schema: {
7313
+ "const": '----'
7314
+ }
7078
7315
  }
7079
7316
  }
7080
- }
7081
- }]
7082
- }, {
7083
- type: 'HorizontalLayout',
7084
- elements: [{
7085
- type: 'Control',
7086
- scope: '#/properties/Salesperson',
7087
- rule: !enableSellerInfos ? {
7088
- effect: 'ENABLE',
7089
- condition: {
7090
- scope: '#/properties/RetailerName',
7091
- schema: {
7092
- "const": '----'
7317
+ }, {
7318
+ type: 'Control',
7319
+ scope: '#/properties/RetailerNr',
7320
+ rule: {
7321
+ effect: 'ENABLE',
7322
+ condition: {
7323
+ scope: '#/properties/RetailerName',
7324
+ schema: {
7325
+ "const": '----'
7326
+ }
7093
7327
  }
7094
7328
  }
7095
- } : undefined
7329
+ }]
7096
7330
  }, {
7097
- type: 'Control',
7098
- scope: '#/properties/SalespersonEmail',
7099
- rule: !enableSellerInfos ? {
7100
- effect: 'ENABLE',
7101
- condition: {
7102
- scope: '#/properties/RetailerName',
7103
- schema: {
7104
- "const": '----'
7331
+ type: 'HorizontalLayout',
7332
+ elements: [{
7333
+ type: 'Control',
7334
+ scope: '#/properties/Salesperson',
7335
+ rule: !settings.enableSellerInfos ? {
7336
+ effect: 'ENABLE',
7337
+ condition: {
7338
+ scope: '#/properties/RetailerName',
7339
+ schema: {
7340
+ "const": '----'
7341
+ }
7105
7342
  }
7106
- }
7107
- } : undefined
7343
+ } : undefined
7344
+ }, {
7345
+ type: 'Control',
7346
+ scope: '#/properties/SalespersonEmail',
7347
+ rule: !settings.enableSellerInfos ? {
7348
+ effect: 'ENABLE',
7349
+ condition: {
7350
+ scope: '#/properties/RetailerName',
7351
+ schema: {
7352
+ "const": '----'
7353
+ }
7354
+ }
7355
+ } : undefined
7356
+ }, {
7357
+ type: 'Control',
7358
+ scope: '#/properties/SalespersonNr',
7359
+ rule: !settings.enableSellerInfos ? {
7360
+ effect: 'ENABLE',
7361
+ condition: {
7362
+ scope: '#/properties/RetailerName',
7363
+ schema: {
7364
+ "const": '----'
7365
+ }
7366
+ }
7367
+ } : undefined
7368
+ }]
7108
7369
  }, {
7109
7370
  type: 'Control',
7110
- scope: '#/properties/SalespersonNr',
7111
- rule: !enableSellerInfos ? {
7112
- effect: 'ENABLE',
7113
- condition: {
7114
- scope: '#/properties/RetailerName',
7115
- schema: {
7116
- "const": '----'
7117
- }
7118
- }
7119
- } : undefined
7371
+ scope: '#/properties/ClientRemark',
7372
+ options: {
7373
+ multi: true
7374
+ }
7120
7375
  }]
7121
7376
  }, {
7122
- type: 'Control',
7123
- scope: '#/properties/ClientRemark',
7124
- options: {
7125
- multi: true
7126
- }
7127
- }, {
7128
- key: 'PrintOptions',
7129
- type: 'Group',
7130
- label: 'basket.checkout.form.printOptions',
7377
+ type: 'HorizontalLayout',
7131
7378
  elements: [{
7132
- type: 'HorizontalLayout',
7379
+ key: 'PrintOptions',
7380
+ type: 'Group',
7381
+ label: 'basket.checkout.form.printOptions',
7133
7382
  elements: [{
7134
- type: 'VerticalLayout',
7383
+ type: 'HorizontalLayout',
7135
7384
  elements: [{
7136
- type: 'Control',
7137
- scope: '#/properties/PrintOptions/properties/PlanningSketch'
7138
- }, {
7139
- type: 'Control',
7140
- scope: '#/properties/PrintOptions/properties/Remark'
7385
+ type: 'VerticalLayout',
7386
+ elements: [{
7387
+ type: 'Control',
7388
+ scope: '#/properties/PrintOptions/properties/PlanningSketch'
7389
+ }]
7141
7390
  }, {
7142
- type: 'Control',
7143
- scope: '#/properties/PrintOptions/properties/Signature'
7144
- }, {
7145
- type: 'Control',
7146
- scope: '#/properties/PrintOptions/properties/SalespersonData'
7391
+ type: 'VerticalLayout',
7392
+ elements: [{
7393
+ type: 'Control',
7394
+ scope: '#/properties/PrintOptions/properties/ModelName'
7395
+ }]
7147
7396
  }]
7148
7397
  }, {
7149
- type: 'VerticalLayout',
7398
+ type: 'HorizontalLayout',
7150
7399
  elements: [{
7151
- type: 'Control',
7152
- scope: '#/properties/PrintOptions/properties/ModelName'
7153
- }, {
7154
- type: 'Control',
7155
- scope: '#/properties/PrintOptions/properties/Gdpr'
7400
+ type: 'VerticalLayout',
7401
+ elements: [{
7402
+ type: 'Control',
7403
+ scope: '#/properties/PrintOptions/properties/CollectionLogo'
7404
+ }]
7156
7405
  }, {
7157
- type: 'Control',
7158
- scope: '#/properties/PrintOptions/properties/Prices'
7406
+ type: 'VerticalLayout',
7407
+ elements: [{
7408
+ type: 'Control',
7409
+ scope: '#/properties/PrintOptions/properties/Remark'
7410
+ }]
7411
+ }]
7412
+ }, {
7413
+ type: 'HorizontalLayout',
7414
+ elements: [{
7415
+ type: 'VerticalLayout',
7416
+ elements: [{
7417
+ type: 'Control',
7418
+ scope: '#/properties/PrintOptions/properties/ClientpersonData'
7419
+ }]
7159
7420
  }, {
7160
- type: 'Control',
7161
- scope: '#/properties/PrintOptions/properties/OpvCodices'
7421
+ type: 'VerticalLayout',
7422
+ elements: [{
7423
+ type: 'Control',
7424
+ scope: '#/properties/PrintOptions/properties/Signature'
7425
+ }]
7162
7426
  }]
7163
7427
  }, {
7164
- type: 'VerticalLayout',
7428
+ type: 'HorizontalLayout',
7165
7429
  elements: [{
7166
- type: 'Control',
7167
- scope: '#/properties/PrintOptions/properties/CollectionLogo'
7430
+ type: 'VerticalLayout',
7431
+ elements: [{
7432
+ type: 'Control',
7433
+ scope: '#/properties/PrintOptions/properties/Gdpr'
7434
+ }]
7168
7435
  }, {
7169
- type: 'Control',
7170
- scope: '#/properties/PrintOptions/properties/ClientpersonData'
7436
+ type: 'VerticalLayout',
7437
+ elements: []
7438
+ }]
7439
+ }, {
7440
+ type: 'HorizontalLayout',
7441
+ elements: [{
7442
+ type: 'VerticalLayout',
7443
+ elements: [{
7444
+ type: 'Control',
7445
+ scope: '#/properties/PrintOptions/properties/Prices'
7446
+ }]
7171
7447
  }, {
7172
- type: 'Control',
7173
- scope: '#/properties/PrintOptions/properties/AllPrices',
7174
- rule: {
7175
- effect: 'HIDE',
7176
- condition: {
7177
- scope: '#/properties/PrintOptions/properties/Prices',
7178
- schema: {
7179
- not: {
7180
- "const": true
7448
+ type: 'VerticalLayout',
7449
+ elements: [{
7450
+ type: 'Control',
7451
+ scope: '#/properties/PrintOptions/properties/AllPrices',
7452
+ rule: {
7453
+ effect: 'HIDE',
7454
+ condition: {
7455
+ scope: '#/properties/PrintOptions/properties/Prices',
7456
+ schema: {
7457
+ not: {
7458
+ "const": true
7459
+ }
7181
7460
  }
7182
7461
  }
7183
7462
  }
7184
- }
7463
+ }]
7464
+ }]
7465
+ }, {
7466
+ type: 'HorizontalLayout',
7467
+ elements: [{
7468
+ type: 'VerticalLayout',
7469
+ elements: [{
7470
+ type: 'Control',
7471
+ scope: '#/properties/PrintOptions/properties/SalespersonData'
7472
+ }]
7473
+ }, {
7474
+ type: 'VerticalLayout',
7475
+ elements: [{
7476
+ type: 'Control',
7477
+ scope: '#/properties/PrintOptions/properties/OpvCodices'
7478
+ }]
7185
7479
  }]
7186
7480
  }]
7481
+ }, {
7482
+ key: 'AdditionalOptions',
7483
+ type: 'Group',
7484
+ label: 'basket.checkout.form.additionalOptions',
7485
+ elements: [].concat(_toConsumableArray(!settings.hideWWSButton ? [{
7486
+ type: 'Control',
7487
+ scope: '#/properties/SendIWOBasket'
7488
+ }] : []), [{
7489
+ key: 'SendOrder',
7490
+ type: 'Control',
7491
+ scope: '#/properties/SendOrder'
7492
+ }, {
7493
+ type: 'Control',
7494
+ scope: '#/properties/Order3DExport',
7495
+ options: {
7496
+ showUnfocusedDescription: true
7497
+ }
7498
+ }, {
7499
+ type: 'Control',
7500
+ scope: '#/properties/SendMail'
7501
+ }])
7187
7502
  }]
7188
- }].concat(_toConsumableArray(!hideWWSButton ? [{
7189
- type: 'Control',
7190
- scope: '#/properties/SendIWOBasket'
7191
- }] : []))
7503
+ }]
7192
7504
  };
7193
7505
  };
7194
7506
 
7195
7507
  function Step3Checkout(_ref) {
7196
- var _config$checkout, _config$checkout2, _config$checkout3, _config$checkout4, _config$checkout5;
7508
+ var _config$checkout, _config$checkout2, _basket$Client, _config$checkout3, _config$checkout4, _config$checkout5, _config$checkout6;
7197
7509
  var updateBasket = _ref.updateBasket,
7198
7510
  startWithEmptyBasket = _ref.startWithEmptyBasket,
7199
7511
  onClickSave = _ref.onClickSave,
@@ -7208,6 +7520,25 @@ function Step3Checkout(_ref) {
7208
7520
  updateProductData = _ref.updateProductData;
7209
7521
  var _useDivaCore = useDivaCore(),
7210
7522
  organization = _useDivaCore.state.organization;
7523
+ var _useSellerState = useSellerState$1(),
7524
+ catalogData = _useSellerState.state.catalogData;
7525
+ var configSaveButtons = (config === null || config === void 0 || (_config$checkout = config.checkout) === null || _config$checkout === void 0 ? void 0 : _config$checkout.saveButtons) || ['SAVE', 'SAVE_AND_SEND', 'NEW'];
7526
+ var orderEmpty = !basket.OrderSets || basket.OrderSets.length == 0 || (config === null || config === void 0 || (_config$checkout2 = config.checkout) === null || _config$checkout2 === void 0 ? void 0 : _config$checkout2.checkGdpr) && !isEmpty(basket === null || basket === void 0 ? void 0 : basket.Client) && !basket.Gdpr;
7527
+ var userInfoPresent = !!((_basket$Client = basket.Client) !== null && _basket$Client !== void 0 && _basket$Client.email);
7528
+ var schemaSettings = {
7529
+ hideWWSButton: !organization.hasIwoFurn,
7530
+ enableSellerInfos: config === null || config === void 0 ? void 0 : config.enableSellerInfos,
7531
+ show3dExport: (catalogData === null || catalogData === void 0 ? void 0 : catalogData.find(function (c) {
7532
+ return !c.disable3DExport;
7533
+ })) && (catalogData === null || catalogData === void 0 ? void 0 : catalogData.find(function (c) {
7534
+ return c.has3D;
7535
+ })) && organization.settings.enable3DExport,
7536
+ showSendOrder: organization.settings.sendOrders ? true : false,
7537
+ sendMail: {
7538
+ show: configSaveButtons.includes('SAVE_AND_SEND'),
7539
+ disabled: orderEmpty || !userInfoPresent
7540
+ }
7541
+ };
7211
7542
  return /*#__PURE__*/jsx(CheckOut, {
7212
7543
  startWithEmptyBasket: startWithEmptyBasket,
7213
7544
  onClickSave: onClickSave,
@@ -7215,18 +7546,32 @@ function Step3Checkout(_ref) {
7215
7546
  setStatus: setStatus,
7216
7547
  basket: basket,
7217
7548
  statusArray: statusArray,
7218
- schema: (config === null || config === void 0 || (_config$checkout = config.checkout) === null || _config$checkout === void 0 ? void 0 : _config$checkout.schema) || schema(!organization.hasIwoFurn),
7219
- uiSchema: (config === null || config === void 0 || (_config$checkout2 = config.checkout) === null || _config$checkout2 === void 0 ? void 0 : _config$checkout2.uiSchema) || uiSchema(!organization.hasIwoFurn, config === null || config === void 0 ? void 0 : config.enableSellerInfos),
7549
+ schema: (config === null || config === void 0 || (_config$checkout3 = config.checkout) === null || _config$checkout3 === void 0 ? void 0 : _config$checkout3.schema) || schema(schemaSettings),
7550
+ uiSchema: (config === null || config === void 0 || (_config$checkout4 = config.checkout) === null || _config$checkout4 === void 0 ? void 0 : _config$checkout4.uiSchema) || uiSchema(schemaSettings),
7551
+ schemaSettings: schemaSettings,
7220
7552
  updateBasket: updateBasket,
7221
- renderService: config === null || config === void 0 || (_config$checkout3 = config.checkout) === null || _config$checkout3 === void 0 ? void 0 : _config$checkout3.renderService,
7222
- configSaveButtons: (config === null || config === void 0 || (_config$checkout4 = config.checkout) === null || _config$checkout4 === void 0 ? void 0 : _config$checkout4.saveButtons) || ['SAVE', 'SAVE_AND_OPEN', 'SAVE_AND_SEND', 'NEW'],
7223
- gdpr: config === null || config === void 0 || (_config$checkout5 = config.checkout) === null || _config$checkout5 === void 0 ? void 0 : _config$checkout5.checkGdpr,
7553
+ renderService: config === null || config === void 0 || (_config$checkout5 = config.checkout) === null || _config$checkout5 === void 0 ? void 0 : _config$checkout5.renderService,
7554
+ configSaveButtons: configSaveButtons,
7555
+ gdpr: config === null || config === void 0 || (_config$checkout6 = config.checkout) === null || _config$checkout6 === void 0 ? void 0 : _config$checkout6.checkGdpr,
7224
7556
  currentProduct: currentProduct,
7225
7557
  productIsLoading: productIsLoading,
7226
7558
  saveProduct: saveProduct,
7227
7559
  updateProductData: updateProductData
7228
7560
  });
7229
7561
  }
7562
+ function isEmpty(data) {
7563
+ if (!data) {
7564
+ return true;
7565
+ }
7566
+ if (Object.keys(data).length === 0 && data.constructor === Object) {
7567
+ return true;
7568
+ } else if (data.constructor !== Object) {
7569
+ return false;
7570
+ }
7571
+ return Object.keys(data).every(function (k) {
7572
+ return isEmpty(data[k]);
7573
+ });
7574
+ }
7230
7575
 
7231
7576
  function Step4Checkout(_ref) {
7232
7577
  var currentProduct = _ref.currentProduct,
@@ -7483,7 +7828,8 @@ function Basket(_ref) {
7483
7828
  openBasket = _useSellerState$actio.openBasket,
7484
7829
  openModal = _useSellerState$actio.openModal,
7485
7830
  sendEmail = _useSellerState$actio.sendEmail,
7486
- resetBasketState = _useSellerState$actio.resetBasketState;
7831
+ resetBasketState = _useSellerState$actio.resetBasketState,
7832
+ setOrdered = _useSellerState$actio.setOrdered;
7487
7833
  var _useProduct = useProduct(currentBasketState === null || currentBasketState === void 0 ? void 0 : currentBasketState.basket),
7488
7834
  currentProduct = _useProduct.currentProduct,
7489
7835
  saveProduct = _useProduct.saveProduct,
@@ -7639,7 +7985,7 @@ function Basket(_ref) {
7639
7985
  }
7640
7986
  };
7641
7987
  var onClickSave = /*#__PURE__*/function () {
7642
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(pdf, doSendEmail, export3D) {
7988
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(pdf, doSendEmail, export3D, sendOrder) {
7643
7989
  var _configurationData$Ch, _configurationData$re;
7644
7990
  var getPdf, response, _configurationData$Ch2, _ref3, pdfUrl, idx, o, d3dp, newRenderJob, _configurationData$Ch3, _configurationData$Ch4, _currentBasket$Client, _opener;
7645
7991
  return _regeneratorRuntime.wrap(function _callee$(_context) {
@@ -7663,7 +8009,7 @@ function Basket(_ref) {
7663
8009
  break;
7664
8010
  }
7665
8011
  errorOnSaving(response);
7666
- _context.next = 41;
8012
+ _context.next = 44;
7667
8013
  break;
7668
8014
  case 12:
7669
8015
  _ref3 = response, pdfUrl = _ref3.pdfUrl;
@@ -7741,11 +8087,25 @@ function Basket(_ref) {
7741
8087
  autoHideDuration: (_configurationData$Ch3 = configurationData === null || configurationData === void 0 || (_configurationData$Ch4 = configurationData.Checkout) === null || _configurationData$Ch4 === void 0 ? void 0 : _configurationData$Ch4.pdfQRAutoHideDuration) !== null && _configurationData$Ch3 !== void 0 ? _configurationData$Ch3 : 1000 * 60 * 2
7742
8088
  });
7743
8089
  }
8090
+ if (!sendOrder) {
8091
+ _context.next = 40;
8092
+ break;
8093
+ }
8094
+ _context.next = 40;
8095
+ return setOrdered(currentBasket, true);
8096
+ case 40:
7744
8097
  if (doSendEmail) {
7745
8098
  sendEmail({
7746
8099
  dialogText: t('basket.modals.email.text', {
7747
8100
  divaNr: currentBasket.DivaNr + '-' + currentBasket.getDocumentVersion()
7748
8101
  }),
8102
+ showDialog: true,
8103
+ dialogAcceptMailSend: pdf == 'open' ? t('modals.open_pdf_now') : undefined,
8104
+ mailSendCallback: function mailSendCallback() {
8105
+ if (pdf == 'open') {
8106
+ window.open(pdfUrl, '_blank');
8107
+ }
8108
+ },
7749
8109
  content: {
7750
8110
  type: 'basket',
7751
8111
  to: ((_currentBasket$Client = currentBasket.Client) === null || _currentBasket$Client === void 0 ? void 0 : _currentBasket$Client.email) || '',
@@ -7762,17 +8122,19 @@ function Basket(_ref) {
7762
8122
  }, '*');
7763
8123
  window.close();
7764
8124
  } else {
7765
- openModal({
7766
- title: t('modals.saving'),
7767
- reject: false,
7768
- accept: pdf == 'open' ? t('modals.open_now') : true,
7769
- text: t('modals.saving_successful').replace('%1', currentBasket.DivaNr + '-' + currentBasket.getDocumentVersion()),
7770
- callback: function callback() {
7771
- if (pdf == 'open') {
7772
- window.open(pdfUrl, '_blank');
8125
+ if (!sendOrder) {
8126
+ openModal({
8127
+ title: t('modals.saving'),
8128
+ reject: t('modals.close'),
8129
+ accept: pdf == 'open' ? t('modals.open_now') : true,
8130
+ text: t('modals.saving_successful').replace('%1', currentBasket.DivaNr + '-' + currentBasket.getDocumentVersion()),
8131
+ callback: function callback(accepted) {
8132
+ if (accepted && pdf == 'open') {
8133
+ window.open(pdfUrl, '_blank');
8134
+ }
7773
8135
  }
7774
- }
7775
- });
8136
+ });
8137
+ }
7776
8138
  }
7777
8139
  /* TODO used with SM integration in divaProtal
7778
8140
  openModal({
@@ -7796,13 +8158,13 @@ function Basket(_ref) {
7796
8158
  });
7797
8159
  currentBasket.setDocumentVersion(currentBasket.getDocumentVersion() + 1);
7798
8160
  setActBasketPage('Step1');
7799
- case 41:
8161
+ case 44:
7800
8162
  case "end":
7801
8163
  return _context.stop();
7802
8164
  }
7803
8165
  }, _callee, null, [[14, 32]]);
7804
8166
  }));
7805
- return function onClickSave(_x, _x2, _x3) {
8167
+ return function onClickSave(_x, _x2, _x3, _x4) {
7806
8168
  return _ref2.apply(this, arguments);
7807
8169
  };
7808
8170
  }();