@crystaldesign/diva-seller 25.4.0-beta.24 → 25.4.0-beta.25

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.
@@ -5,8 +5,8 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
5
5
  import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
6
6
  import _regeneratorRuntime from '@babel/runtime/regenerator';
7
7
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
8
- import { useDivaCore, getLogger, BasketData, useTranslation, DivaError, DivaUtils as DivaUtils$1, HelpButton, ProductHandler } from '@crystaldesign/diva-core';
9
- import DivaUtils, { nanoid } from '@crystaldesign/diva-utils';
8
+ import { useDivaCore, getLogger, BasketData, useTranslation, DivaError as DivaError$1, DivaUtils as DivaUtils$1, HelpButton, ProductHandler } from '@crystaldesign/diva-core';
9
+ import DivaUtils, { DivaError, nanoid } from '@crystaldesign/diva-utils';
10
10
  import '@mui/material/locale';
11
11
  import BasketHandler, { BASKET_SAVE_ERROR } from '@crystaldesign/basket-handler';
12
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -216,7 +216,6 @@ function useBreadcrumbs(_ref) {
216
216
  module = state.module,
217
217
  catalogs = state.catalogs,
218
218
  basketState = state.basketState;
219
- state.returnTo;
220
219
  var _useDivaCore = useDivaCore(),
221
220
  organization = _useDivaCore.state.organization;
222
221
  useEffect(function () {
@@ -462,11 +461,11 @@ function breadcrumbCollection() {
462
461
  };
463
462
  }
464
463
 
465
- function ownKeys$C(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; }
466
- function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$C(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$C(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
464
+ 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; }
465
+ 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; }
467
466
  var reducer$1 = function reducer(state, action) {
468
467
  if (action.type == 'update') {
469
- var newState = _objectSpread$C({}, state);
468
+ var newState = _objectSpread$D({}, state);
470
469
  action.payload.forEach(function (p) {
471
470
  if (p.field == 'basketState') {
472
471
  if (p.value) {
@@ -500,7 +499,9 @@ function updateBasketState(state, _ref) {
500
499
  };
501
500
  }
502
501
 
503
- getLogger('Seller', 'ApiHandler');
502
+ function ownKeys$C(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; }
503
+ function _objectSpread$C(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$C(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$C(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
504
+ var LOG$a = getLogger('Seller', 'ApiHandler');
504
505
  function apiLoadAnalyticScore(_x) {
505
506
  return _apiLoadAnalyticScore.apply(this, arguments);
506
507
  }
@@ -551,15 +552,13 @@ function _apiLoadAnalyticScore() {
551
552
  function apiLoadCollections(_x2) {
552
553
  return _apiLoadCollections.apply(this, arguments);
553
554
  }
554
-
555
- //20150430112400 -> 30.04.2015 11:24
556
555
  function _apiLoadCollections() {
557
556
  _apiLoadCollections = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
558
- var serverUrl, sessionGuid, fullUrl, response, newCollectionArray;
557
+ var serverUrl, enricherUrl, sessionGuid, settings, jwt, organizationId, language, fullUrl, response, newCollectionArray, enricherCollections;
559
558
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
560
559
  while (1) switch (_context2.prev = _context2.next) {
561
560
  case 0:
562
- serverUrl = _ref2.serverUrl, sessionGuid = _ref2.sessionGuid;
561
+ serverUrl = _ref2.serverUrl, enricherUrl = _ref2.enricherUrl, sessionGuid = _ref2.sessionGuid, settings = _ref2.settings, jwt = _ref2.jwt, organizationId = _ref2.organizationId, language = _ref2.language;
563
562
  fullUrl = serverUrl + '?function=GetJsonAccountList&noCatalogs=True&ACT=&divaModul=_&TAR=';
564
563
  _context2.next = 4;
565
564
  return fetch(fullUrl, {
@@ -576,27 +575,27 @@ function _apiLoadCollections() {
576
575
  response = _context2.sent;
577
576
  newCollectionArray = response.Accounts.map(function (data) {
578
577
  return {
579
- serverUrl: data.Api2Url ? data.Api2Url : undefined,
580
- // https://retail.diva-portal.de
581
- serverName: data.Servername ? data.Servername : undefined,
582
- // myCatalogCenter 3 Retail Server
583
578
  accountName: data.Accountname ? data.Accountname : undefined,
584
- // Ekornes Stressless IDM
585
579
  accountLogo: data.Accountlogo ? data.Accountlogo : undefined,
586
- // https://retail.diva-portal.de/files/33/aaa807ad-9473-4206-b6af-703dc9b32416/log_7ea0a4a5-7cf6-4d9d-83d7-58ce2fdd4bb6.jpg
587
- // data.RetailBrandLogo: "http://myCC3Retail.crystal-design.local/files//33/9680c4a3-fc60-4541-8738-4859d9b24e9d/LOG_75ec5e70-c701-474d-98ad-7a0f39ac24c6.jpg"
588
- // data.RetailBrandName: "Candy"
589
580
  catalogCount: data.NewCatalogCount ? data.NewCatalogCount : 0,
590
- // NewCatalogCount: 20
591
581
  accountGuid: data.AccountGUID,
592
- // a9dac143-4d52-4557-b980-1748c83ddfdf
593
582
  position: data.Position,
594
583
  id: data.AccountGUID,
595
584
  type: data.AccountType
596
585
  };
597
586
  });
587
+ if (!settings.loadIDMServiceData) {
588
+ _context2.next = 11;
589
+ break;
590
+ }
591
+ _context2.next = 9;
592
+ return apiLoadCollectionsEnricher(enricherUrl, jwt, organizationId, language);
593
+ case 9:
594
+ enricherCollections = _context2.sent;
595
+ if (enricherCollections) newCollectionArray = [].concat(_toConsumableArray(newCollectionArray), _toConsumableArray(enricherCollections));
596
+ case 11:
598
597
  return _context2.abrupt("return", newCollectionArray);
599
- case 7:
598
+ case 12:
600
599
  case "end":
601
600
  return _context2.stop();
602
601
  }
@@ -604,31 +603,97 @@ function _apiLoadCollections() {
604
603
  }));
605
604
  return _apiLoadCollections.apply(this, arguments);
606
605
  }
607
- function getDate(myDate) {
608
- var year = Number(myDate.slice(0, 4));
609
- var month = Number(myDate.slice(4, 6)) - 1; // Subtract 1 since months are zero-based
610
- var day = Number(myDate.slice(6, 8));
611
- var hour = Number(myDate.slice(8, 10));
612
- var minute = Number(myDate.slice(10, 12));
613
- var second = Number(myDate.slice(12, 14));
614
- return new Date(year, month, day, hour, minute, second);
606
+ function apiLoadCollectionsEnricher(_x3, _x4, _x5, _x6) {
607
+ return _apiLoadCollectionsEnricher.apply(this, arguments);
608
+ }
609
+ function _apiLoadCollectionsEnricher() {
610
+ _apiLoadCollectionsEnricher = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(enricherUrl, jwt, organizationId, language) {
611
+ var fullUrl, response, newCollectionArray;
612
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
613
+ while (1) switch (_context3.prev = _context3.next) {
614
+ case 0:
615
+ fullUrl = enricherUrl + '/collections?organizationId=' + organizationId;
616
+ _context3.prev = 1;
617
+ _context3.next = 4;
618
+ return fetch(fullUrl, {
619
+ headers: {
620
+ Authorization: "Bearer ".concat(jwt),
621
+ 'Content-Type': 'application/json'
622
+ }
623
+ }).then(function (res) {
624
+ if (res.status !== 200) {
625
+ throw new Error('Collections not loaded.');
626
+ }
627
+ return res.json();
628
+ });
629
+ case 4:
630
+ response = _context3.sent;
631
+ newCollectionArray = response.data.filter(function (data) {
632
+ return data.active === undefined || data.active === true;
633
+ }).map(function (data) {
634
+ var series = [];
635
+ for (var i = 0; i < ((_data$memberSeries = data.memberSeries) !== null && _data$memberSeries !== void 0 ? _data$memberSeries : []).length; i++) {
636
+ var _data$memberSeries;
637
+ var packa = data.memberSeries[i];
638
+ if (packa.active === undefined || packa.active === true) {
639
+ for (var j = 0; j < ((_packa$series$length = (_packa$series = packa.series) === null || _packa$series === void 0 ? void 0 : _packa$series.length) !== null && _packa$series$length !== void 0 ? _packa$series$length : 0); j++) {
640
+ var _packa$series$length, _packa$series;
641
+ var serie = packa.series[j];
642
+ if (serie.active === undefined || serie.active === true) {
643
+ series.push({
644
+ name: DivaUtils.getLocals(serie.name, language),
645
+ serieNo: serie.serieNo,
646
+ url: serie.url,
647
+ enricherPackageName: DivaUtils.getLocals(packa.enricherPackageName, language),
648
+ idmVersion: packa.idmVersion,
649
+ catalogId: packa.catalogId,
650
+ enricherId: packa.enricherId,
651
+ accountId: packa.catalogId
652
+ });
653
+ }
654
+ }
655
+ }
656
+ }
657
+ return _objectSpread$C(_objectSpread$C({}, data), {}, {
658
+ id: data._id,
659
+ accountLogo: data.url,
660
+ type: 'ENRICHER_PACKAGE',
661
+ enricherSeries: series,
662
+ catalogCount: series.length,
663
+ accountName: DivaUtils.getLocals(data.name, language)
664
+ });
665
+ });
666
+ return _context3.abrupt("return", newCollectionArray);
667
+ case 9:
668
+ _context3.prev = 9;
669
+ _context3.t0 = _context3["catch"](1);
670
+ LOG$a.error(new DivaError('Failed to fetch collections from enricher', {}));
671
+ case 12:
672
+ return _context3.abrupt("return", undefined);
673
+ case 13:
674
+ case "end":
675
+ return _context3.stop();
676
+ }
677
+ }, _callee3, null, [[1, 9]]);
678
+ }));
679
+ return _apiLoadCollectionsEnricher.apply(this, arguments);
615
680
  }
616
- function apiLoadCatalogs(_x3) {
681
+ function apiLoadCatalogs(_x7) {
617
682
  return _apiLoadCatalogs.apply(this, arguments);
618
683
  }
619
684
  function _apiLoadCatalogs() {
620
- _apiLoadCatalogs = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref3) {
685
+ _apiLoadCatalogs = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref3) {
621
686
  var _response$Catalogs;
622
687
  var serverUrl, sessionGuid, collectionGuid, fullUrl, response, newCatalogArray;
623
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
624
- while (1) switch (_context3.prev = _context3.next) {
688
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
689
+ while (1) switch (_context4.prev = _context4.next) {
625
690
  case 0:
626
691
  serverUrl = _ref3.serverUrl, sessionGuid = _ref3.sessionGuid, collectionGuid = _ref3.collectionGuid;
627
692
  fullUrl = serverUrl + '?function=GetJsonCatalogList&sortOrderBy=position';
628
693
  if (collectionGuid) {
629
694
  fullUrl = fullUrl + '&accountGuid=' + collectionGuid;
630
695
  }
631
- _context3.next = 5;
696
+ _context4.next = 5;
632
697
  return fetch(fullUrl, {
633
698
  headers: {
634
699
  sessionGuid: sessionGuid
@@ -640,72 +705,53 @@ function _apiLoadCatalogs() {
640
705
  return res.json();
641
706
  });
642
707
  case 5:
643
- response = _context3.sent;
708
+ response = _context4.sent;
644
709
  newCatalogArray = (_response$Catalogs = response.Catalogs) === null || _response$Catalogs === void 0 ? void 0 : _response$Catalogs.map(function (data) {
645
710
  return {
646
711
  id: data.GUID.toLowerCase(),
647
- // "d593d5f9-6587-4589-82b5-5fde4a0d19ff"
648
712
  codex: data.Codex,
649
- // "CLASSICS_PLUS"
650
713
  accountId: data.AccountGUID,
651
714
  name: data.Name,
652
- // "Classics Plus"
653
715
  description: data.ShortDesc ? data.ShortDesc : undefined,
654
716
  catalogLogo: data.Image,
655
- // "http://myCC3Retail.crystal-design.local/files/33/9680C4A3-FC60-4541-8738-4859D9B24E9D/CAT_e96a9793-b0fa-4e4e-b483-e5ee1e658a35.jpg"
656
717
  collectionName: data.RetailBrandName,
657
718
  collectionLogo: data.RetailBrandLogo,
658
719
  mainCategory: data.RetailMainCategory ? data.RetailMainCategory : data.MainCategory ? data.MainCategory : undefined,
659
- // "Johann Jakob - CLASSICS"
660
720
  subCategory: data.RetailSubCategory ? data.RetailSubCategory : data.SubCategory ? data.SubCategory : undefined,
661
721
  retailArticleNr: data.RetailArticleNr ? data.RetailArticleNr : undefined,
662
722
  nArticles: data.Articles ? Number(data.Articles) : 0,
663
- // "236"
664
- nConfigurators: data.Configurators ? Number(data.Configurators) : 0,
665
- // "236"
666
- nImages: data.ShowroomimagesNumber ? Number(data.ShowroomimagesNumber) : 0,
667
- // 20
668
- nDocuments: data.PDF ? data.PDF : 0,
669
723
  brandLogo: data.BrandLogo ? data.BrandLogo : undefined,
670
724
  supplierGuid: data.SupplierGUID ? data.SupplierGUID : undefined,
671
- // "9680c4a3-fc60-4541-8738-4859d9b24e9d"
672
725
  supplierILN: data.SupplierILN ? data.SupplierILN : undefined,
673
- // "4045604000007"
674
726
  supplierLogo: data.SupplierLogo ? data.SupplierLogo : undefined,
675
- // "http://myCC3Retail.crystal-design.local/files/33/9680c4a3-fc60-4541-8738-4859d9b24e9d/LOG_75ec5e70-c701-474d-98ad-7a0f39ac24c6.jpg"
676
727
  supplierName: data.SupplierName ? data.SupplierName : undefined,
677
- // "Candy Polstermöbel GmbH & Co. KG"
678
- hideSupplierInfo: data.HideSupplierInfo == 'True',
679
- lastUpdate: data.LastUpdate ? getDate(data.LastUpdate) : undefined,
680
- // "20200228140307"
681
- validFrom: data.ValidFrom ? getDate(data.ValidFrom) : undefined,
682
- // "20180401000000"
683
- validTo: data.ValidTo ? getDate(data.ValidTo) : undefined,
684
- // "20181231000000"
728
+ lastUpdate: data.LastUpdate ? DivaUtils.getDate(data.LastUpdate) : undefined,
729
+ validFrom: data.ValidFrom ? DivaUtils.getDate(data.ValidFrom) : undefined,
730
+ validTo: data.ValidTo ? DivaUtils.getDate(data.ValidTo) : undefined,
685
731
  has3D: data.Planer == 3 ? true : false
686
732
  };
687
733
  });
688
- return _context3.abrupt("return", newCatalogArray);
734
+ return _context4.abrupt("return", newCatalogArray);
689
735
  case 8:
690
736
  case "end":
691
- return _context3.stop();
737
+ return _context4.stop();
692
738
  }
693
- }, _callee3);
739
+ }, _callee4);
694
740
  }));
695
741
  return _apiLoadCatalogs.apply(this, arguments);
696
742
  }
697
- function apiAccountLogin(_x4) {
743
+ function apiAccountLogin(_x8) {
698
744
  return _apiAccountLogin.apply(this, arguments);
699
745
  }
700
746
  function _apiAccountLogin() {
701
- _apiAccountLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
747
+ _apiAccountLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref4) {
702
748
  var serverUrl, sessionGuid, accountId, fullUrl, response;
703
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
704
- while (1) switch (_context4.prev = _context4.next) {
749
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
750
+ while (1) switch (_context5.prev = _context5.next) {
705
751
  case 0:
706
752
  serverUrl = _ref4.serverUrl, sessionGuid = _ref4.sessionGuid, accountId = _ref4.accountId;
707
753
  fullUrl = serverUrl + '?function=JsonAccountLogin&UserRole=v&accountGuid=' + accountId;
708
- _context4.next = 4;
754
+ _context5.next = 4;
709
755
  return fetch(fullUrl, {
710
756
  headers: {
711
757
  sessionGuid: sessionGuid
@@ -717,28 +763,28 @@ function _apiAccountLogin() {
717
763
  return res.json();
718
764
  });
719
765
  case 4:
720
- response = _context4.sent;
721
- return _context4.abrupt("return", response.SessionGUID);
766
+ response = _context5.sent;
767
+ return _context5.abrupt("return", response.SessionGUID);
722
768
  case 6:
723
769
  case "end":
724
- return _context4.stop();
770
+ return _context5.stop();
725
771
  }
726
- }, _callee4);
772
+ }, _callee5);
727
773
  }));
728
774
  return _apiAccountLogin.apply(this, arguments);
729
775
  }
730
- function apiCatalogGuidLogin(_x5) {
776
+ function apiCatalogGuidLogin(_x9) {
731
777
  return _apiCatalogGuidLogin.apply(this, arguments);
732
778
  }
733
779
  function _apiCatalogGuidLogin() {
734
- _apiCatalogGuidLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref5) {
780
+ _apiCatalogGuidLogin = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref5) {
735
781
  var serverUrl, sessionGuid, catalogGuid, fullUrl, response;
736
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
737
- while (1) switch (_context5.prev = _context5.next) {
782
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
783
+ while (1) switch (_context6.prev = _context6.next) {
738
784
  case 0:
739
785
  serverUrl = _ref5.serverUrl, sessionGuid = _ref5.sessionGuid, catalogGuid = _ref5.catalogGuid;
740
786
  fullUrl = serverUrl + '?function=JsonAccountLogin&UserRole=v&catalogGuid=' + catalogGuid;
741
- _context5.next = 4;
787
+ _context6.next = 4;
742
788
  return fetch(fullUrl, {
743
789
  headers: {
744
790
  sessionGuid: sessionGuid
@@ -750,39 +796,39 @@ function _apiCatalogGuidLogin() {
750
796
  return res.json();
751
797
  });
752
798
  case 4:
753
- response = _context5.sent;
799
+ response = _context6.sent;
754
800
  if (!response.Error) {
755
- _context5.next = 7;
801
+ _context6.next = 7;
756
802
  break;
757
803
  }
758
804
  throw new Error(response.Error);
759
805
  case 7:
760
- return _context5.abrupt("return", {
806
+ return _context6.abrupt("return", {
761
807
  sessionGuid: response.SessionGUID,
762
808
  accountId: response.AccountGUID
763
809
  });
764
810
  case 8:
765
811
  case "end":
766
- return _context5.stop();
812
+ return _context6.stop();
767
813
  }
768
- }, _callee5);
814
+ }, _callee6);
769
815
  }));
770
816
  return _apiCatalogGuidLogin.apply(this, arguments);
771
817
  }
772
- function apiLoadCatalogInfo(_x6) {
818
+ function apiLoadCatalogInfo(_x10) {
773
819
  return _apiLoadCatalogInfo.apply(this, arguments);
774
820
  }
775
821
  function _apiLoadCatalogInfo() {
776
- _apiLoadCatalogInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref6) {
822
+ _apiLoadCatalogInfo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref6) {
777
823
  var _response$CollectionG, _response$Properties, _response$Properties2, _response$Properties3;
778
824
  var serverUrlAPI, catalogCodex, accountSessionId, language, serverUrl, fullUrl, response, actCatalogInfoData, i, _i, j;
779
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
780
- while (1) switch (_context6.prev = _context6.next) {
825
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
826
+ while (1) switch (_context7.prev = _context7.next) {
781
827
  case 0:
782
828
  serverUrlAPI = _ref6.serverUrlAPI, catalogCodex = _ref6.catalogCodex, accountSessionId = _ref6.accountSessionId, language = _ref6.language;
783
829
  serverUrl = new URL(serverUrlAPI).origin;
784
830
  fullUrl = serverUrlAPI + '?function=GetJsonCatalogData' + '&catalogCodex=' + catalogCodex + '&IncludeVariantValues=True&lang=' + language.toLocaleUpperCase();
785
- _context6.next = 5;
831
+ _context7.next = 5;
786
832
  return fetch(fullUrl, {
787
833
  headers: {
788
834
  sessionGuid: accountSessionId
@@ -794,9 +840,9 @@ function _apiLoadCatalogInfo() {
794
840
  return res.json();
795
841
  });
796
842
  case 5:
797
- response = _context6.sent;
843
+ response = _context7.sent;
798
844
  if (!response.Error) {
799
- _context6.next = 8;
845
+ _context7.next = 8;
800
846
  break;
801
847
  }
802
848
  throw new Error(response.Error);
@@ -865,28 +911,107 @@ function _apiLoadCatalogInfo() {
865
911
  }
866
912
  }
867
913
  }
868
- return _context6.abrupt("return", actCatalogInfoData);
914
+ return _context7.abrupt("return", actCatalogInfoData);
869
915
  case 12:
870
916
  case "end":
871
- return _context6.stop();
917
+ return _context7.stop();
872
918
  }
873
- }, _callee6);
919
+ }, _callee7);
874
920
  }));
875
921
  return _apiLoadCatalogInfo.apply(this, arguments);
876
922
  }
877
- function apiLoadArticles(_x7) {
923
+ function apiLoadCatalogInfoEnricher(_x11) {
924
+ return _apiLoadCatalogInfoEnricher.apply(this, arguments);
925
+ }
926
+ function _apiLoadCatalogInfoEnricher() {
927
+ _apiLoadCatalogInfoEnricher = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref7) {
928
+ var _cat$Properties;
929
+ var enricherUrl, serieNo, catalogId, language, jwt, fullUrl, response, cat, actCatalogInfoData;
930
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
931
+ while (1) switch (_context8.prev = _context8.next) {
932
+ case 0:
933
+ enricherUrl = _ref7.enricherUrl, serieNo = _ref7.serieNo, catalogId = _ref7.catalogId, language = _ref7.language, jwt = _ref7.jwt;
934
+ fullUrl = enricherUrl + '/live/v3.0/catalogs/' + catalogId + '/series' + '?filter=' + encodeURIComponent('serieNo==' + serieNo);
935
+ _context8.next = 4;
936
+ return fetch(fullUrl, {
937
+ headers: {
938
+ Authorization: "Bearer ".concat(jwt),
939
+ 'Content-Type': 'application/json'
940
+ }
941
+ }).then(function (res) {
942
+ if (res.status !== 200) {
943
+ throw new Error('Collections not loaded.');
944
+ }
945
+ return res.json();
946
+ });
947
+ case 4:
948
+ response = _context8.sent;
949
+ if (!response.Error) {
950
+ _context8.next = 7;
951
+ break;
952
+ }
953
+ throw new Error(response.Error);
954
+ case 7:
955
+ cat = response.data[0];
956
+ if (cat) {
957
+ _context8.next = 10;
958
+ break;
959
+ }
960
+ throw new Error('serieNo: ' + serieNo + ' not found');
961
+ case 10:
962
+ actCatalogInfoData = {
963
+ lang: language,
964
+ guid: cat._id,
965
+ disable3DExport: false,
966
+ name: DivaUtils.getLocals(cat.seriesName, language),
967
+ name_locales: cat.seriesName,
968
+ codex: serieNo,
969
+ isIDMData: true,
970
+ //accountLogo: cat.AccountLogo,
971
+ description: DivaUtils.getLocals(cat.seriesFullText, language),
972
+ description_locales: cat.seriesFullText,
973
+ hasPlanner: true,
974
+ accountGuid: catalogId,
975
+ //brand: cat.Brandname,
976
+ supplierGuid: catalogId,
977
+ //retailCatalogNr: cat.RetailCatalogNr,
978
+ options: cat.Options,
979
+ optionValues: cat.Optionvalues,
980
+ //currency: cat.currency,
981
+ has3D: !!((_cat$Properties = cat.Properties) !== null && _cat$Properties !== void 0 && (_cat$Properties = _cat$Properties.find(function (p) {
982
+ return p.Codex == 'DIVA3D_RENDERING';
983
+ })) !== null && _cat$Properties !== void 0 && _cat$Properties.Value),
984
+ images: [],
985
+ documents: []
986
+ //accountSessionId: cat.AccountSessionGuid,
987
+ //arReady: !!cat.Properties?.find((p: any) => p.Codex == 'DIVA3D_AR_READY')?.Value,
988
+ }; //Schauraumbilder
989
+
990
+ if (cat.ShowroomImages) ;
991
+ //Documente
992
+ if (cat.Docs) ;
993
+ return _context8.abrupt("return", actCatalogInfoData);
994
+ case 14:
995
+ case "end":
996
+ return _context8.stop();
997
+ }
998
+ }, _callee8);
999
+ }));
1000
+ return _apiLoadCatalogInfoEnricher.apply(this, arguments);
1001
+ }
1002
+ function apiLoadArticles(_x12) {
878
1003
  return _apiLoadArticles.apply(this, arguments);
879
1004
  }
880
1005
  function _apiLoadArticles() {
881
- _apiLoadArticles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref7) {
1006
+ _apiLoadArticles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref8) {
882
1007
  var serverUrlAPI, catalogCodex, accountSessionId, lang, serverUrl, fullUrl, response, articleList, i, jsonArticle;
883
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
884
- while (1) switch (_context7.prev = _context7.next) {
1008
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
1009
+ while (1) switch (_context9.prev = _context9.next) {
885
1010
  case 0:
886
- serverUrlAPI = _ref7.serverUrlAPI, catalogCodex = _ref7.catalogCodex, accountSessionId = _ref7.accountSessionId, lang = _ref7.lang;
1011
+ serverUrlAPI = _ref8.serverUrlAPI, catalogCodex = _ref8.catalogCodex, accountSessionId = _ref8.accountSessionId, lang = _ref8.lang;
887
1012
  serverUrl = new URL(serverUrlAPI).origin;
888
1013
  fullUrl = serverUrlAPI + '?function=GetJsonArticleList' + '&Lang=' + lang.toUpperCase() + '&catalogCodex=' + catalogCodex;
889
- _context7.next = 5;
1014
+ _context9.next = 5;
890
1015
  return fetch(fullUrl, {
891
1016
  headers: {
892
1017
  sessionGuid: accountSessionId
@@ -898,7 +1023,7 @@ function _apiLoadArticles() {
898
1023
  return res.json();
899
1024
  });
900
1025
  case 5:
901
- response = _context7.sent;
1026
+ response = _context9.sent;
902
1027
  articleList = [];
903
1028
  for (i = 0; i < response.Articles.length; i++) {
904
1029
  jsonArticle = response.Articles[i];
@@ -918,8 +1043,6 @@ function _apiLoadArticles() {
918
1043
  properties: jsonArticle.Metadatas ? jsonArticle.Metadatas : [],
919
1044
  divaNr: jsonArticle.DivaNr && jsonArticle.DivaNr != '' ? jsonArticle.DivaNr : undefined,
920
1045
  image: jsonArticle.Image && jsonArticle.Image != '' ? serverUrl + '/files/33/' + jsonArticle.SubFolder + '/' + jsonArticle.Image : undefined,
921
- imageWidth: jsonArticle.ImageWidth ? jsonArticle.ImageWidth : undefined,
922
- imageHeight: jsonArticle.ImageHeight ? jsonArticle.ImageHeight : undefined,
923
1046
  groupName: jsonArticle.GroupName && jsonArticle.GroupName != '' ? jsonArticle.GroupName : undefined,
924
1047
  mainCategory: jsonArticle.MainCategory && jsonArticle.MainCategory != '' ? jsonArticle.MainCategory : undefined,
925
1048
  width: jsonArticle.Width && jsonArticle.Width != '' ? Number(jsonArticle.Width.replace('cm', '').replace(',', '.')) : undefined,
@@ -959,34 +1082,96 @@ function _apiLoadArticles() {
959
1082
  hasArticleRelations: false
960
1083
  });
961
1084
  }
962
- return _context7.abrupt("return", articleList);
1085
+ return _context9.abrupt("return", articleList);
963
1086
  case 9:
964
1087
  case "end":
965
- return _context7.stop();
1088
+ return _context9.stop();
966
1089
  }
967
- }, _callee7);
1090
+ }, _callee9);
968
1091
  }));
969
1092
  return _apiLoadArticles.apply(this, arguments);
970
1093
  }
1094
+ function apiLoadEnricherArticles(_x13) {
1095
+ return _apiLoadEnricherArticles.apply(this, arguments);
1096
+ }
1097
+ function _apiLoadEnricherArticles() {
1098
+ _apiLoadEnricherArticles = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(_ref9) {
1099
+ var serieId, catalogId, enricherUrl, jwt, language, fullUrl, response, articleList, i, jsonArticle;
1100
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
1101
+ while (1) switch (_context10.prev = _context10.next) {
1102
+ case 0:
1103
+ serieId = _ref9.serieId, catalogId = _ref9.catalogId, enricherUrl = _ref9.enricherUrl, jwt = _ref9.jwt, language = _ref9.language;
1104
+ fullUrl = enricherUrl + '/live/v3.0/catalogs/' + catalogId + '/series/' + serieId + '/items';
1105
+ _context10.next = 4;
1106
+ return fetch(fullUrl, {
1107
+ headers: {
1108
+ Authorization: "Bearer ".concat(jwt),
1109
+ 'Content-Type': 'application/json'
1110
+ }
1111
+ }).then(function (res) {
1112
+ if (res.status !== 200) {
1113
+ throw new Error('Collections not loaded.');
1114
+ }
1115
+ return res.json();
1116
+ });
1117
+ case 4:
1118
+ response = _context10.sent;
1119
+ articleList = [];
1120
+ for (i = 0; i < response.data.length; i++) {
1121
+ jsonArticle = response.data[i];
1122
+ if (!jsonArticle.partListExclusive) articleList.push({
1123
+ articleCodex: jsonArticle.typeNo,
1124
+ catalogCodex: jsonArticle.serieNo,
1125
+ typeNr: jsonArticle.TypeNr,
1126
+ guid: jsonArticle.GUID,
1127
+ name: DivaUtils.getLocals(jsonArticle.shortText, language),
1128
+ longDescription: DivaUtils.getLocals(jsonArticle.fullText, language),
1129
+ articleType: jsonArticle.featureClassRefNo === undefined ? 'FLAT' : 'OPTIONTREE',
1130
+ width: jsonArticle.depthBasicShapeNominalValue,
1131
+ height: jsonArticle.heightBasicShapeNominalValue,
1132
+ depth: jsonArticle.depthBasicShapeNominalValue,
1133
+ image: jsonArticle.image,
1134
+ templateCodex: jsonArticle.featureClassRefNo,
1135
+ price: 0,
1136
+ priceGroup: jsonArticle.priceTypeRef
1137
+
1138
+ //edpNumber: 'BKDD501020',
1139
+ //salesNumber: 'BKDD501020',
1140
+
1141
+ //properties: jsonArticle.Metadatas ? jsonArticle.Metadatas : [],
1142
+ //retailArticleNr: jsonArticle.RetailArticleNr && jsonArticle.RetailArticleNr != '' ? jsonArticle.RetailArticleNr : undefined,
1143
+ //retailPrefix: jsonArticle.RetailPrefix && jsonArticle.RetailPrefix != '' ? jsonArticle.RetailPrefix : undefined,
1144
+ //retailTypeNr: jsonArticle.RetailTypeNr && jsonArticle.RetailTypeNr != '' ? jsonArticle.RetailTypeNr : undefined,
1145
+ });
1146
+ }
1147
+ return _context10.abrupt("return", articleList);
1148
+ case 8:
1149
+ case "end":
1150
+ return _context10.stop();
1151
+ }
1152
+ }, _callee10);
1153
+ }));
1154
+ return _apiLoadEnricherArticles.apply(this, arguments);
1155
+ }
971
1156
  //Basket API functions
972
1157
 
973
- function apiLoadBasket(_x8) {
1158
+ function apiLoadBasket(_x14) {
974
1159
  return _apiLoadBasket.apply(this, arguments);
975
1160
  }
976
1161
  function _apiLoadBasket() {
977
- _apiLoadBasket = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref8) {
1162
+ _apiLoadBasket = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref10) {
978
1163
  var divaNr, apiConfig, customProductId, jwt, fullUrl, _divaNr$split, _divaNr$split2, onlyDivaNr, version, response, basket, key, value, _response, result, _basket;
979
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
980
- while (1) switch (_context8.prev = _context8.next) {
1164
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
1165
+ while (1) switch (_context11.prev = _context11.next) {
981
1166
  case 0:
982
- divaNr = _ref8.divaNr, apiConfig = _ref8.apiConfig, customProductId = _ref8.customProductId, jwt = _ref8.jwt;
1167
+ divaNr = _ref10.divaNr, apiConfig = _ref10.apiConfig, customProductId = _ref10.customProductId, jwt = _ref10.jwt;
983
1168
  if (!divaNr) {
984
- _context8.next = 11;
1169
+ _context11.next = 11;
985
1170
  break;
986
1171
  }
987
1172
  _divaNr$split = divaNr.split('-'), _divaNr$split2 = _slicedToArray(_divaNr$split, 3), onlyDivaNr = _divaNr$split2[1], version = _divaNr$split2[2];
988
1173
  fullUrl = apiConfig.basketService + '/baskets/configuration?divaNr=' + 'DIVA-' + onlyDivaNr + (version ? '&version=' + version : '');
989
- _context8.next = 6;
1174
+ _context11.next = 6;
990
1175
  return fetch(fullUrl, {
991
1176
  headers: {
992
1177
  Authorization: 'Bearer ' + jwt,
@@ -996,22 +1181,22 @@ function _apiLoadBasket() {
996
1181
  return res.json();
997
1182
  });
998
1183
  case 6:
999
- response = _context8.sent;
1184
+ response = _context11.sent;
1000
1185
  basket = new BasketData(response.basket);
1001
- return _context8.abrupt("return", {
1186
+ return _context11.abrupt("return", {
1002
1187
  basket: basket,
1003
1188
  newestDocumentVersion: Number(response.newestDocumentVersion),
1004
1189
  sourceOrganization: response.sourceOrganization
1005
1190
  });
1006
1191
  case 11:
1007
1192
  if (!customProductId) {
1008
- _context8.next = 25;
1193
+ _context11.next = 25;
1009
1194
  break;
1010
1195
  }
1011
1196
  key = 'customData.SAP_MARA_MATNR.value';
1012
1197
  value = customProductId;
1013
1198
  fullUrl = apiConfig.catalogService + "/v1/products/basket?key=".concat(key, "&value=").concat(value, "&repair=true");
1014
- _context8.next = 17;
1199
+ _context11.next = 17;
1015
1200
  return fetch(fullUrl, {
1016
1201
  method: 'POST',
1017
1202
  headers: {
@@ -1021,13 +1206,13 @@ function _apiLoadBasket() {
1021
1206
  body: JSON.stringify({})
1022
1207
  });
1023
1208
  case 17:
1024
- _response = _context8.sent;
1025
- _context8.next = 20;
1209
+ _response = _context11.sent;
1210
+ _context11.next = 20;
1026
1211
  return _response.json();
1027
1212
  case 20:
1028
- result = _context8.sent;
1213
+ result = _context11.sent;
1029
1214
  _basket = new BasketData(result.basket);
1030
- return _context8.abrupt("return", {
1215
+ return _context11.abrupt("return", {
1031
1216
  basket: _basket,
1032
1217
  newestDocumentVersion: Number(result.newestDocumentVersion),
1033
1218
  sourceOrganization: result.sourceOrganization
@@ -1036,24 +1221,24 @@ function _apiLoadBasket() {
1036
1221
  throw new Error('apiLoadBasket was called without any information to load basket');
1037
1222
  case 26:
1038
1223
  case "end":
1039
- return _context8.stop();
1224
+ return _context11.stop();
1040
1225
  }
1041
- }, _callee8);
1226
+ }, _callee11);
1042
1227
  }));
1043
1228
  return _apiLoadBasket.apply(this, arguments);
1044
1229
  }
1045
- function apiLoadUniqueDivaNr(_x9) {
1230
+ function apiLoadUniqueDivaNr(_x15) {
1046
1231
  return _apiLoadUniqueDivaNr.apply(this, arguments);
1047
1232
  }
1048
1233
  function _apiLoadUniqueDivaNr() {
1049
- _apiLoadUniqueDivaNr = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref9) {
1234
+ _apiLoadUniqueDivaNr = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref11) {
1050
1235
  var basketUrl, jwt, fullUrl, returnDivaNr, response;
1051
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
1052
- while (1) switch (_context9.prev = _context9.next) {
1236
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
1237
+ while (1) switch (_context12.prev = _context12.next) {
1053
1238
  case 0:
1054
- basketUrl = _ref9.basketUrl, jwt = _ref9.jwt;
1239
+ basketUrl = _ref11.basketUrl, jwt = _ref11.jwt;
1055
1240
  fullUrl = "".concat(basketUrl, "/baskets/uniqueDivaNr");
1056
- _context9.next = 4;
1241
+ _context12.next = 4;
1057
1242
  return fetch(fullUrl, {
1058
1243
  headers: {
1059
1244
  Authorization: 'Bearer ' + jwt
@@ -1065,139 +1250,139 @@ function _apiLoadUniqueDivaNr() {
1065
1250
  return res.json();
1066
1251
  });
1067
1252
  case 4:
1068
- response = _context9.sent;
1253
+ response = _context12.sent;
1069
1254
  returnDivaNr = response.divaNr;
1070
1255
  if (!returnDivaNr) returnDivaNr = 'DIVA-' + Math.floor(Math.random() * 1000000);
1071
- return _context9.abrupt("return", returnDivaNr);
1256
+ return _context12.abrupt("return", returnDivaNr);
1072
1257
  case 8:
1073
1258
  case "end":
1074
- return _context9.stop();
1259
+ return _context12.stop();
1075
1260
  }
1076
- }, _callee9);
1261
+ }, _callee12);
1077
1262
  }));
1078
1263
  return _apiLoadUniqueDivaNr.apply(this, arguments);
1079
1264
  }
1080
- function apiGetClassification(_x11) {
1265
+ function apiGetClassification(_x17) {
1081
1266
  return _apiGetClassification.apply(this, arguments);
1082
1267
  }
1083
1268
  function _apiGetClassification() {
1084
- _apiGetClassification = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(_ref11) {
1269
+ _apiGetClassification = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref13) {
1085
1270
  var serviceUrl, res, resData;
1086
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
1087
- while (1) switch (_context11.prev = _context11.next) {
1271
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1272
+ while (1) switch (_context14.prev = _context14.next) {
1088
1273
  case 0:
1089
- serviceUrl = _ref11.serviceUrl;
1090
- _context11.prev = 1;
1091
- _context11.next = 4;
1274
+ serviceUrl = _ref13.serviceUrl;
1275
+ _context14.prev = 1;
1276
+ _context14.next = 4;
1092
1277
  return fetch("".concat(serviceUrl, "/v2/views/configs/load?type=CLASSIFICATION&identifier=DEFAULT"), {
1093
1278
  headers: {
1094
1279
  'Content-Type': 'application/json'
1095
1280
  }
1096
1281
  });
1097
1282
  case 4:
1098
- res = _context11.sent;
1099
- _context11.next = 7;
1283
+ res = _context14.sent;
1284
+ _context14.next = 7;
1100
1285
  return res.json();
1101
1286
  case 7:
1102
- resData = _context11.sent;
1103
- return _context11.abrupt("return", resData.configParams);
1287
+ resData = _context14.sent;
1288
+ return _context14.abrupt("return", resData.configParams);
1104
1289
  case 11:
1105
- _context11.prev = 11;
1106
- _context11.t0 = _context11["catch"](1);
1290
+ _context14.prev = 11;
1291
+ _context14.t0 = _context14["catch"](1);
1107
1292
  throw new Error('Could not fetch classification');
1108
1293
  case 14:
1109
1294
  case "end":
1110
- return _context11.stop();
1295
+ return _context14.stop();
1111
1296
  }
1112
- }, _callee11, null, [[1, 11]]);
1297
+ }, _callee14, null, [[1, 11]]);
1113
1298
  }));
1114
1299
  return _apiGetClassification.apply(this, arguments);
1115
1300
  }
1116
- function apiGetProductCreator(_x12) {
1301
+ function apiGetProductCreator(_x18) {
1117
1302
  return _apiGetProductCreator.apply(this, arguments);
1118
1303
  }
1119
1304
  function _apiGetProductCreator() {
1120
- _apiGetProductCreator = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(_ref12) {
1305
+ _apiGetProductCreator = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref14) {
1121
1306
  var serviceUrl, res, resData;
1122
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
1123
- while (1) switch (_context12.prev = _context12.next) {
1307
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
1308
+ while (1) switch (_context15.prev = _context15.next) {
1124
1309
  case 0:
1125
- serviceUrl = _ref12.serviceUrl;
1126
- _context12.prev = 1;
1127
- _context12.next = 4;
1310
+ serviceUrl = _ref14.serviceUrl;
1311
+ _context15.prev = 1;
1312
+ _context15.next = 4;
1128
1313
  return fetch("".concat(serviceUrl, "/v2/views/configs/load?type=PRODUCT_CREATOR&identifier=Default"), {
1129
1314
  headers: {
1130
1315
  'Content-Type': 'application/json'
1131
1316
  }
1132
1317
  });
1133
1318
  case 4:
1134
- res = _context12.sent;
1135
- _context12.next = 7;
1319
+ res = _context15.sent;
1320
+ _context15.next = 7;
1136
1321
  return res.json();
1137
1322
  case 7:
1138
- resData = _context12.sent;
1139
- return _context12.abrupt("return", resData.configParams);
1323
+ resData = _context15.sent;
1324
+ return _context15.abrupt("return", resData.configParams);
1140
1325
  case 11:
1141
- _context12.prev = 11;
1142
- _context12.t0 = _context12["catch"](1);
1326
+ _context15.prev = 11;
1327
+ _context15.t0 = _context15["catch"](1);
1143
1328
  throw new Error('Could not fetch ProductCreator Config');
1144
1329
  case 14:
1145
1330
  case "end":
1146
- return _context12.stop();
1331
+ return _context15.stop();
1147
1332
  }
1148
- }, _callee12, null, [[1, 11]]);
1333
+ }, _callee15, null, [[1, 11]]);
1149
1334
  }));
1150
1335
  return _apiGetProductCreator.apply(this, arguments);
1151
1336
  }
1152
- function apiGetManualCustomDataFields(_x13) {
1337
+ function apiGetManualCustomDataFields(_x19) {
1153
1338
  return _apiGetManualCustomDataFields.apply(this, arguments);
1154
1339
  }
1155
1340
  function _apiGetManualCustomDataFields() {
1156
- _apiGetManualCustomDataFields = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref13) {
1341
+ _apiGetManualCustomDataFields = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref15) {
1157
1342
  var serviceUrl, res, resData;
1158
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
1159
- while (1) switch (_context13.prev = _context13.next) {
1343
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
1344
+ while (1) switch (_context16.prev = _context16.next) {
1160
1345
  case 0:
1161
- serviceUrl = _ref13.serviceUrl;
1162
- _context13.prev = 1;
1163
- _context13.next = 4;
1346
+ serviceUrl = _ref15.serviceUrl;
1347
+ _context16.prev = 1;
1348
+ _context16.next = 4;
1164
1349
  return fetch("".concat(serviceUrl, "/v1/customdata/fields"), {
1165
1350
  headers: {
1166
1351
  'Content-Type': 'application/json'
1167
1352
  }
1168
1353
  });
1169
1354
  case 4:
1170
- res = _context13.sent;
1171
- _context13.next = 7;
1355
+ res = _context16.sent;
1356
+ _context16.next = 7;
1172
1357
  return res.json();
1173
1358
  case 7:
1174
- resData = _context13.sent;
1175
- return _context13.abrupt("return", resData);
1359
+ resData = _context16.sent;
1360
+ return _context16.abrupt("return", resData);
1176
1361
  case 11:
1177
- _context13.prev = 11;
1178
- _context13.t0 = _context13["catch"](1);
1362
+ _context16.prev = 11;
1363
+ _context16.t0 = _context16["catch"](1);
1179
1364
  throw new Error('Could not custom data field keys');
1180
1365
  case 14:
1181
1366
  case "end":
1182
- return _context13.stop();
1367
+ return _context16.stop();
1183
1368
  }
1184
- }, _callee13, null, [[1, 11]]);
1369
+ }, _callee16, null, [[1, 11]]);
1185
1370
  }));
1186
1371
  return _apiGetManualCustomDataFields.apply(this, arguments);
1187
1372
  }
1188
- function apiGetAffiliates(_x14) {
1373
+ function apiGetAffiliates(_x20) {
1189
1374
  return _apiGetAffiliates.apply(this, arguments);
1190
1375
  }
1191
1376
  function _apiGetAffiliates() {
1192
- _apiGetAffiliates = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref14) {
1377
+ _apiGetAffiliates = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref16) {
1193
1378
  var serviceUrl, organizationId, jwt, fullUrl, res, resOrg;
1194
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
1195
- while (1) switch (_context14.prev = _context14.next) {
1379
+ return _regeneratorRuntime.wrap(function _callee17$(_context17) {
1380
+ while (1) switch (_context17.prev = _context17.next) {
1196
1381
  case 0:
1197
- serviceUrl = _ref14.serviceUrl, organizationId = _ref14.organizationId, jwt = _ref14.jwt;
1382
+ serviceUrl = _ref16.serviceUrl, organizationId = _ref16.organizationId, jwt = _ref16.jwt;
1198
1383
  fullUrl = serviceUrl + '/v2/organizations/' + organizationId + '/affiliate?inherit=true';
1199
- _context14.prev = 2;
1200
- _context14.next = 5;
1384
+ _context17.prev = 2;
1385
+ _context17.next = 5;
1201
1386
  return fetch(fullUrl, {
1202
1387
  headers: {
1203
1388
  Authorization: 'Bearer ' + jwt,
@@ -1205,24 +1390,24 @@ function _apiGetAffiliates() {
1205
1390
  }
1206
1391
  });
1207
1392
  case 5:
1208
- res = _context14.sent;
1209
- _context14.next = 8;
1393
+ res = _context17.sent;
1394
+ _context17.next = 8;
1210
1395
  return res.json();
1211
1396
  case 8:
1212
- resOrg = _context14.sent;
1213
- _context14.next = 14;
1397
+ resOrg = _context17.sent;
1398
+ _context17.next = 14;
1214
1399
  break;
1215
1400
  case 11:
1216
- _context14.prev = 11;
1217
- _context14.t0 = _context14["catch"](2);
1401
+ _context17.prev = 11;
1402
+ _context17.t0 = _context17["catch"](2);
1218
1403
  throw new Error('Could not fetch existing affiliates for organization');
1219
1404
  case 14:
1220
- return _context14.abrupt("return", resOrg.data);
1405
+ return _context17.abrupt("return", resOrg.data);
1221
1406
  case 15:
1222
1407
  case "end":
1223
- return _context14.stop();
1408
+ return _context17.stop();
1224
1409
  }
1225
- }, _callee14, null, [[2, 11]]);
1410
+ }, _callee17, null, [[2, 11]]);
1226
1411
  }));
1227
1412
  return _apiGetAffiliates.apply(this, arguments);
1228
1413
  }
@@ -1349,9 +1534,9 @@ function useSellerStateData(_ref) {
1349
1534
  _useDivaCore$state = _useDivaCore.state,
1350
1535
  apiConfig = _useDivaCore$state.apiConfig,
1351
1536
  loginMode = _useDivaCore$state.loginMode,
1352
- jwt = _useDivaCore$state.jwt;
1353
- _useDivaCore$state.organizationHierarchy;
1354
- var _useDivaCore$actions = _useDivaCore.actions,
1537
+ jwt = _useDivaCore$state.jwt,
1538
+ organization = _useDivaCore$state.organization,
1539
+ _useDivaCore$actions = _useDivaCore.actions,
1355
1540
  toggleLoading = _useDivaCore$actions.toggleLoading,
1356
1541
  getSessionGuid = _useDivaCore$actions.getSessionGuid,
1357
1542
  updateCustomLogo = _useDivaCore$actions.updateCustomLogo,
@@ -1439,7 +1624,7 @@ function useSellerStateData(_ref) {
1439
1624
  return _regeneratorRuntime.wrap(function _callee$(_context) {
1440
1625
  while (1) switch (_context.prev = _context.next) {
1441
1626
  case 0:
1442
- if (!(state.firstLoginApiUrl && sessionGuid)) {
1627
+ if (!(state.firstLoginApiUrl && sessionGuid && configData)) {
1443
1628
  _context.next = 10;
1444
1629
  break;
1445
1630
  }
@@ -1451,7 +1636,12 @@ function useSellerStateData(_ref) {
1451
1636
  _context.next = 5;
1452
1637
  return apiLoadCollections({
1453
1638
  serverUrl: state.firstLoginApiUrl,
1454
- sessionGuid: sessionGuid
1639
+ enricherUrl: apiConfig.enricherService,
1640
+ sessionGuid: sessionGuid,
1641
+ organizationId: organization === null || organization === void 0 ? void 0 : organization._id,
1642
+ jwt: jwt,
1643
+ settings: configData,
1644
+ language: i18n.language
1455
1645
  });
1456
1646
  case 5:
1457
1647
  collections = _context.sent;
@@ -1483,27 +1673,90 @@ function useSellerStateData(_ref) {
1483
1673
  }();
1484
1674
  var loadCatalogs = /*#__PURE__*/function () {
1485
1675
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
1486
- var collectionId, props, _state$collections, catalogs, newCatalogCodex;
1676
+ var collectionId, props, _state$collections, catalogs, collections, collection, _collection$enricherS, _collection$enricherS2, series, newCatalogCodex;
1487
1677
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1488
1678
  while (1) switch (_context2.prev = _context2.next) {
1489
1679
  case 0:
1490
1680
  collectionId = _ref3.collectionId, props = _objectWithoutProperties(_ref3, _excluded$a);
1491
1681
  if (!(state.firstLoginApiUrl && sessionGuid)) {
1492
- _context2.next = 14;
1682
+ _context2.next = 28;
1493
1683
  break;
1494
1684
  }
1495
1685
  catalogs = state.catalogs;
1686
+ collections = state.collections;
1687
+ if (collections) {
1688
+ _context2.next = 8;
1689
+ break;
1690
+ }
1691
+ _context2.next = 7;
1692
+ return loadCollections({});
1693
+ case 7:
1694
+ collections = _context2.sent.data;
1695
+ case 8:
1696
+ collection = collections.find(function (c) {
1697
+ return c.id == collectionId;
1698
+ });
1699
+ if (!((collection === null || collection === void 0 ? void 0 : collection.type) === 'ENRICHER_PACKAGE')) {
1700
+ _context2.next = 17;
1701
+ break;
1702
+ }
1703
+ if ((_collection$enricherS = collection.enricherSeries) !== null && _collection$enricherS !== void 0 && _collection$enricherS.length) {
1704
+ _context2.next = 12;
1705
+ break;
1706
+ }
1707
+ throw new Error('collection ' + collection.accountName + ' has no series ' + collection.id + '');
1708
+ case 12:
1709
+ series = (_collection$enricherS2 = collection.enricherSeries) === null || _collection$enricherS2 === void 0 ? void 0 : _collection$enricherS2.map(function (data) {
1710
+ return {
1711
+ id: data.catalogId,
1712
+ codex: data.serieNo,
1713
+ accountId: data.accountId,
1714
+ name: data.name,
1715
+ catalogLogo: data.url,
1716
+ supplierGuid: data.catalogId,
1717
+ collectionName: data.enricherPackageName
1718
+ //description: data.ShortDesc ? data.ShortDesc : undefined,
1719
+ //collectionLogo: ,
1720
+ //mainCategory: data.RetailMainCategory ? data.RetailMainCategory : data.MainCategory ? data.MainCategory : undefined,
1721
+ //subCategory: data.RetailSubCategory ? data.RetailSubCategory : data.SubCategory ? data.SubCategory : undefined,
1722
+ //retailArticleNr: data.RetailArticleNr ? data.RetailArticleNr : undefined,
1723
+ //nArticles: 0,
1724
+ // brandLogo: data.BrandLogo ? data.BrandLogo : undefined,
1725
+ //supplierGuid: data.SupplierGUID ? data.SupplierGUID : undefined,
1726
+ //supplierILN: data.SupplierILN ? data.SupplierILN : undefined,
1727
+ //supplierLogo: data.SupplierLogo ? data.SupplierLogo : undefined,
1728
+ //supplierName: data.SupplierName ? data.SupplierName : undefined,
1729
+ //lastUpdate: data. ? DivaUtils.getDate(data.LastUpdate) : undefined,
1730
+ //validFrom: data.ValidFrom ? DivaUtils.getDate(data.ValidFrom) : undefined,
1731
+ //validTo: data.ValidTo ? DivaUtils.getDate(data.ValidTo) : undefined,
1732
+ //has3D: data.Planer == 3 ? true : false,
1733
+ };
1734
+ });
1735
+ dispatch({
1736
+ type: 'update',
1737
+ payload: [{
1738
+ field: 'currentCollectionId',
1739
+ value: collectionId
1740
+ }, {
1741
+ field: 'catalogs',
1742
+ value: series
1743
+ }]
1744
+ });
1745
+ return _context2.abrupt("return", processData(_objectSpread$B(_objectSpread$B({}, props), {}, {
1746
+ data: series || []
1747
+ })));
1748
+ case 17:
1496
1749
  if (!(!catalogs || collectionId != state.currentCollectionId)) {
1497
- _context2.next = 10;
1750
+ _context2.next = 24;
1498
1751
  break;
1499
1752
  }
1500
- _context2.next = 6;
1753
+ _context2.next = 20;
1501
1754
  return apiLoadCatalogs({
1502
1755
  serverUrl: state.firstLoginApiUrl,
1503
1756
  sessionGuid: sessionGuid,
1504
1757
  collectionGuid: collectionId
1505
1758
  });
1506
- case 6:
1759
+ case 20:
1507
1760
  catalogs = _context2.sent;
1508
1761
  // reset catalogCodex only if a different collection is loaded, not if "all" catalogs are shown
1509
1762
  newCatalogCodex = state.currentCatalogCodex;
@@ -1523,19 +1776,19 @@ function useSellerStateData(_ref) {
1523
1776
  value: catalogs
1524
1777
  }]
1525
1778
  });
1526
- case 10:
1779
+ case 24:
1527
1780
  updateAcountLogo((_state$collections = state.collections) === null || _state$collections === void 0 || (_state$collections = _state$collections.find(function (c) {
1528
1781
  return c.id == collectionId;
1529
1782
  })) === null || _state$collections === void 0 ? void 0 : _state$collections.accountLogo);
1530
1783
  return _context2.abrupt("return", processData(_objectSpread$B(_objectSpread$B({}, props), {}, {
1531
1784
  data: catalogs || []
1532
1785
  })));
1533
- case 14:
1786
+ case 28:
1534
1787
  return _context2.abrupt("return", {
1535
1788
  data: [],
1536
1789
  total: 0
1537
1790
  });
1538
- case 15:
1791
+ case 29:
1539
1792
  case "end":
1540
1793
  return _context2.stop();
1541
1794
  }
@@ -1586,150 +1839,232 @@ function useSellerStateData(_ref) {
1586
1839
  var _len,
1587
1840
  catalog,
1588
1841
  _key,
1842
+ collections,
1843
+ collection,
1589
1844
  catalogData,
1590
1845
  _iterator,
1591
1846
  _step,
1592
- _c$accountSessionId,
1593
- c,
1594
- currentAccountSessionId,
1595
- cData,
1596
- _args4 = arguments;
1597
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
1598
- while (1) switch (_context4.prev = _context4.next) {
1847
+ _loop,
1848
+ _ret,
1849
+ _args5 = arguments;
1850
+ return _regeneratorRuntime.wrap(function _callee4$(_context5) {
1851
+ while (1) switch (_context5.prev = _context5.next) {
1599
1852
  case 0:
1600
- for (_len = _args4.length, catalog = new Array(_len), _key = 0; _key < _len; _key++) {
1601
- catalog[_key] = _args4[_key];
1853
+ for (_len = _args5.length, catalog = new Array(_len), _key = 0; _key < _len; _key++) {
1854
+ catalog[_key] = _args5[_key];
1602
1855
  }
1856
+ collections = state.collections;
1857
+ if (collections) {
1858
+ _context5.next = 6;
1859
+ break;
1860
+ }
1861
+ _context5.next = 5;
1862
+ return loadCollections({});
1863
+ case 5:
1864
+ collections = _context5.sent.data;
1865
+ case 6:
1866
+ collection = collections.find(function (c) {
1867
+ var _state$currentCollect, _catalog$;
1868
+ return c.id == ((_state$currentCollect = state.currentCollectionId) !== null && _state$currentCollect !== void 0 ? _state$currentCollect : (_catalog$ = catalog[0]) === null || _catalog$ === void 0 ? void 0 : _catalog$.accountId);
1869
+ });
1603
1870
  if (!(catalog.length != 0 && state.firstLoginApiUrl)) {
1604
- _context4.next = 52;
1871
+ _context5.next = 31;
1605
1872
  break;
1606
1873
  }
1607
1874
  catalogData = state.catalogData ? _toConsumableArray(state.catalogData) : [];
1608
1875
  if (!(!catalogData.length || catalogData.length != catalog.length || catalog[0].catalogCodex != state.currentCatalogCodex || catalog[0].language != catalogData[0].lang)) {
1609
- _context4.next = 51;
1876
+ _context5.next = 30;
1610
1877
  break;
1611
1878
  }
1612
1879
  catalogData = [];
1613
1880
  _iterator = _createForOfIteratorHelper$2(catalog);
1614
- _context4.prev = 6;
1881
+ _context5.prev = 12;
1882
+ _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
1883
+ var _collection$enricherS3;
1884
+ var c, isIDMData, cData, _c$accountSessionId, currentAccountSessionId, _cData;
1885
+ return _regeneratorRuntime.wrap(function _loop$(_context4) {
1886
+ while (1) switch (_context4.prev = _context4.next) {
1887
+ case 0:
1888
+ c = _step.value;
1889
+ isIDMData = collection === null || collection === void 0 || (_collection$enricherS3 = collection.enricherSeries) === null || _collection$enricherS3 === void 0 ? void 0 : _collection$enricherS3.find(function (s) {
1890
+ return s.serieNo === c.catalogCodex;
1891
+ });
1892
+ if (!isIDMData) {
1893
+ _context4.next = 11;
1894
+ break;
1895
+ }
1896
+ _context4.next = 5;
1897
+ return apiLoadCatalogInfoEnricher({
1898
+ catalogId: isIDMData.catalogId,
1899
+ enricherUrl: apiConfig.enricherService,
1900
+ jwt: jwt,
1901
+ language: c.language,
1902
+ serieNo: isIDMData.serieNo
1903
+ });
1904
+ case 5:
1905
+ cData = _context4.sent;
1906
+ catalogData.push(cData);
1907
+ dispatch({
1908
+ type: 'update',
1909
+ payload: [{
1910
+ field: 'catalogData',
1911
+ value: catalogData
1912
+ }, {
1913
+ field: 'currentCatalogCodex',
1914
+ value: catalog[0].catalogCodex
1915
+ }, {
1916
+ field: 'currentPlannerParams',
1917
+ value: undefined
1918
+ }, {
1919
+ field: 'currentAccountLoginId',
1920
+ value: catalog[0].accountSessionId || catalogData[0].accountSessionId
1921
+ }, {
1922
+ field: 'currentAccountId',
1923
+ value: catalog[0].accountId
1924
+ }, {
1925
+ field: 'currentCatalogGuid',
1926
+ value: catalogData[0].guid
1927
+ }]
1928
+ });
1929
+ updateAcountLogo(catalogData[0].accountLogo);
1930
+ _context4.next = 42;
1931
+ break;
1932
+ case 11:
1933
+ if (!((_c$accountSessionId = c.accountSessionId) !== null && _c$accountSessionId !== void 0)) {
1934
+ _context4.next = 15;
1935
+ break;
1936
+ }
1937
+ _context4.t0 = _c$accountSessionId;
1938
+ _context4.next = 23;
1939
+ break;
1940
+ case 15:
1941
+ if (!c.accountId) {
1942
+ _context4.next = 21;
1943
+ break;
1944
+ }
1945
+ _context4.next = 18;
1946
+ return checkAccountLogin({
1947
+ accountId: c.accountId
1948
+ });
1949
+ case 18:
1950
+ _context4.t1 = _context4.sent;
1951
+ _context4.next = 22;
1952
+ break;
1953
+ case 21:
1954
+ _context4.t1 = sessionGuid;
1955
+ case 22:
1956
+ _context4.t0 = _context4.t1;
1957
+ case 23:
1958
+ currentAccountSessionId = _context4.t0;
1959
+ if (currentAccountSessionId) {
1960
+ _context4.next = 27;
1961
+ break;
1962
+ }
1963
+ LOG$9.error(new DivaError$1('AccountSessionId is undefined', {
1964
+ code: 'SELLER_0001'
1965
+ }));
1966
+ return _context4.abrupt("return", {
1967
+ v: void 0
1968
+ });
1969
+ case 27:
1970
+ _context4.prev = 27;
1971
+ _context4.next = 30;
1972
+ return apiLoadCatalogInfo({
1973
+ serverUrlAPI: state.firstLoginApiUrl,
1974
+ catalogCodex: c.catalogCodex,
1975
+ accountSessionId: currentAccountSessionId,
1976
+ language: c.language
1977
+ });
1978
+ case 30:
1979
+ _cData = _context4.sent;
1980
+ catalogData.push(_cData);
1981
+ dispatch({
1982
+ type: 'update',
1983
+ payload: [{
1984
+ field: 'catalogData',
1985
+ value: catalogData
1986
+ }, {
1987
+ field: 'currentCatalogCodex',
1988
+ value: catalog[0].catalogCodex
1989
+ }, {
1990
+ field: 'currentPlannerParams',
1991
+ value: undefined
1992
+ }, {
1993
+ field: 'currentAccountLoginId',
1994
+ value: catalog[0].accountSessionId || catalogData[0].accountSessionId
1995
+ }, {
1996
+ field: 'currentAccountId',
1997
+ value: catalog[0].accountId
1998
+ }, {
1999
+ field: 'currentCatalogGuid',
2000
+ value: catalogData[0].guid
2001
+ }]
2002
+ });
2003
+ updateAcountLogo(catalogData[0].accountLogo);
2004
+ _context4.next = 42;
2005
+ break;
2006
+ case 36:
2007
+ _context4.prev = 36;
2008
+ _context4.t2 = _context4["catch"](27);
2009
+ if (!((_context4.t2 === null || _context4.t2 === void 0 ? void 0 : _context4.t2.message) == 'Es trat ein technischer Fehler auf, probieren Sie es später erneut nochmal und melden Sie sich neu an.')) {
2010
+ _context4.next = 41;
2011
+ break;
2012
+ }
2013
+ LOG$9.error(new DivaError$1('Error on Loading CatalogData', {
2014
+ code: 'SELLER_0001',
2015
+ cause: _context4.t2
2016
+ }));
2017
+ return _context4.abrupt("return", {
2018
+ v: void 0
2019
+ });
2020
+ case 41:
2021
+ openModal({
2022
+ title: t('modals.error_accured') + ': ' + (_context4.t2 === null || _context4.t2 === void 0 ? void 0 : _context4.t2.message),
2023
+ accept: true
2024
+ });
2025
+ case 42:
2026
+ case "end":
2027
+ return _context4.stop();
2028
+ }
2029
+ }, _loop, null, [[27, 36]]);
2030
+ });
1615
2031
  _iterator.s();
1616
- case 8:
2032
+ case 15:
1617
2033
  if ((_step = _iterator.n()).done) {
1618
- _context4.next = 43;
1619
- break;
1620
- }
1621
- c = _step.value;
1622
- if (!((_c$accountSessionId = c.accountSessionId) !== null && _c$accountSessionId !== void 0)) {
1623
- _context4.next = 14;
1624
- break;
1625
- }
1626
- _context4.t0 = _c$accountSessionId;
1627
- _context4.next = 22;
1628
- break;
1629
- case 14:
1630
- if (!c.accountId) {
1631
- _context4.next = 20;
2034
+ _context5.next = 22;
1632
2035
  break;
1633
2036
  }
1634
- _context4.next = 17;
1635
- return checkAccountLogin({
1636
- accountId: c.accountId
1637
- });
2037
+ return _context5.delegateYield(_loop(), "t0", 17);
1638
2038
  case 17:
1639
- _context4.t1 = _context4.sent;
1640
- _context4.next = 21;
1641
- break;
1642
- case 20:
1643
- _context4.t1 = sessionGuid;
1644
- case 21:
1645
- _context4.t0 = _context4.t1;
1646
- case 22:
1647
- currentAccountSessionId = _context4.t0;
1648
- if (currentAccountSessionId) {
1649
- _context4.next = 26;
2039
+ _ret = _context5.t0;
2040
+ if (!_ret) {
2041
+ _context5.next = 20;
1650
2042
  break;
1651
2043
  }
1652
- LOG$9.error(new DivaError('AccountSessionId is undefined', {
1653
- code: 'SELLER_0001'
1654
- }));
1655
- return _context4.abrupt("return");
1656
- case 26:
1657
- _context4.prev = 26;
1658
- _context4.next = 29;
1659
- return apiLoadCatalogInfo({
1660
- serverUrlAPI: state.firstLoginApiUrl,
1661
- catalogCodex: c.catalogCodex,
1662
- accountSessionId: currentAccountSessionId,
1663
- language: c.language
1664
- });
1665
- case 29:
1666
- cData = _context4.sent;
1667
- catalogData.push(cData);
1668
- dispatch({
1669
- type: 'update',
1670
- payload: [{
1671
- field: 'catalogData',
1672
- value: catalogData
1673
- }, {
1674
- field: 'currentCatalogCodex',
1675
- value: catalog[0].catalogCodex
1676
- }, {
1677
- field: 'currentPlannerParams',
1678
- value: undefined
1679
- }, {
1680
- field: 'currentAccountLoginId',
1681
- value: catalog[0].accountSessionId || catalogData[0].accountSessionId
1682
- }, {
1683
- field: 'currentAccountId',
1684
- value: catalog[0].accountId
1685
- }, {
1686
- field: 'currentCatalogGuid',
1687
- value: catalogData[0].guid
1688
- }]
1689
- });
1690
- updateAcountLogo(catalogData[0].accountLogo);
1691
- _context4.next = 41;
1692
- break;
1693
- case 35:
1694
- _context4.prev = 35;
1695
- _context4.t2 = _context4["catch"](26);
1696
- if (!((_context4.t2 === null || _context4.t2 === void 0 ? void 0 : _context4.t2.message) == 'Es trat ein technischer Fehler auf, probieren Sie es später erneut nochmal und melden Sie sich neu an.')) {
1697
- _context4.next = 40;
1698
- break;
1699
- }
1700
- LOG$9.error(new DivaError('Error on Loading CatalogData', {
1701
- code: 'SELLER_0001',
1702
- cause: _context4.t2
1703
- }));
1704
- return _context4.abrupt("return");
1705
- case 40:
1706
- openModal({
1707
- title: t('modals.error_accured') + ': ' + (_context4.t2 === null || _context4.t2 === void 0 ? void 0 : _context4.t2.message),
1708
- accept: true
1709
- });
1710
- case 41:
1711
- _context4.next = 8;
2044
+ return _context5.abrupt("return", _ret.v);
2045
+ case 20:
2046
+ _context5.next = 15;
1712
2047
  break;
1713
- case 43:
1714
- _context4.next = 48;
2048
+ case 22:
2049
+ _context5.next = 27;
1715
2050
  break;
1716
- case 45:
1717
- _context4.prev = 45;
1718
- _context4.t3 = _context4["catch"](6);
1719
- _iterator.e(_context4.t3);
1720
- case 48:
1721
- _context4.prev = 48;
2051
+ case 24:
2052
+ _context5.prev = 24;
2053
+ _context5.t1 = _context5["catch"](12);
2054
+ _iterator.e(_context5.t1);
2055
+ case 27:
2056
+ _context5.prev = 27;
1722
2057
  _iterator.f();
1723
- return _context4.finish(48);
1724
- case 51:
1725
- return _context4.abrupt("return", catalogData);
1726
- case 52:
1727
- return _context4.abrupt("return", undefined);
1728
- case 53:
2058
+ return _context5.finish(27);
2059
+ case 30:
2060
+ return _context5.abrupt("return", catalogData);
2061
+ case 31:
2062
+ return _context5.abrupt("return", undefined);
2063
+ case 32:
1729
2064
  case "end":
1730
- return _context4.stop();
2065
+ return _context5.stop();
1731
2066
  }
1732
- }, _callee4, null, [[6, 45, 48, 51], [26, 35]]);
2067
+ }, _callee4, null, [[12, 24, 27, 30]]);
1733
2068
  }));
1734
2069
  return function loadCatalogInfo() {
1735
2070
  return _ref7.apply(this, arguments);
@@ -1738,34 +2073,34 @@ function useSellerStateData(_ref) {
1738
2073
  var checkAccountLogin = /*#__PURE__*/function () {
1739
2074
  var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) {
1740
2075
  var accountId, accountLoginId;
1741
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
1742
- while (1) switch (_context5.prev = _context5.next) {
2076
+ return _regeneratorRuntime.wrap(function _callee5$(_context6) {
2077
+ while (1) switch (_context6.prev = _context6.next) {
1743
2078
  case 0:
1744
2079
  accountId = _ref8.accountId;
1745
2080
  if (!(state.firstLoginApiUrl && sessionGuid)) {
1746
- _context5.next = 10;
2081
+ _context6.next = 10;
1747
2082
  break;
1748
2083
  }
1749
2084
  accountLoginId = state.currentAccountLoginId;
1750
2085
  if (!(!accountLoginId || accountId != state.currentAccountId)) {
1751
- _context5.next = 7;
2086
+ _context6.next = 7;
1752
2087
  break;
1753
2088
  }
1754
- _context5.next = 6;
2089
+ _context6.next = 6;
1755
2090
  return apiAccountLogin({
1756
2091
  serverUrl: state.firstLoginApiUrl,
1757
2092
  sessionGuid: sessionGuid,
1758
2093
  accountId: accountId
1759
2094
  });
1760
2095
  case 6:
1761
- accountLoginId = _context5.sent;
2096
+ accountLoginId = _context6.sent;
1762
2097
  case 7:
1763
- return _context5.abrupt("return", accountLoginId);
2098
+ return _context6.abrupt("return", accountLoginId);
1764
2099
  case 10:
1765
- return _context5.abrupt("return", undefined);
2100
+ return _context6.abrupt("return", undefined);
1766
2101
  case 11:
1767
2102
  case "end":
1768
- return _context5.stop();
2103
+ return _context6.stop();
1769
2104
  }
1770
2105
  }, _callee5);
1771
2106
  }));
@@ -1776,27 +2111,27 @@ function useSellerStateData(_ref) {
1776
2111
  var catalogGuidLogin = /*#__PURE__*/function () {
1777
2112
  var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref10) {
1778
2113
  var catalogGuid, accountSessionGuid, accountId, accountLoginId, _yield$apiCatalogGuid, s, a;
1779
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
1780
- while (1) switch (_context6.prev = _context6.next) {
2114
+ return _regeneratorRuntime.wrap(function _callee6$(_context7) {
2115
+ while (1) switch (_context7.prev = _context7.next) {
1781
2116
  case 0:
1782
2117
  catalogGuid = _ref10.catalogGuid;
1783
2118
  if (!(state.firstLoginApiUrl && sessionGuid)) {
1784
- _context6.next = 15;
2119
+ _context7.next = 15;
1785
2120
  break;
1786
2121
  }
1787
2122
  accountLoginId = state.currentAccountLoginId;
1788
2123
  if (!(!accountLoginId || catalogGuid != state.currentAccountId)) {
1789
- _context6.next = 11;
2124
+ _context7.next = 11;
1790
2125
  break;
1791
2126
  }
1792
- _context6.next = 6;
2127
+ _context7.next = 6;
1793
2128
  return apiCatalogGuidLogin({
1794
2129
  serverUrl: state.firstLoginApiUrl,
1795
2130
  sessionGuid: sessionGuid,
1796
2131
  catalogGuid: catalogGuid
1797
2132
  });
1798
2133
  case 6:
1799
- _yield$apiCatalogGuid = _context6.sent;
2134
+ _yield$apiCatalogGuid = _context7.sent;
1800
2135
  s = _yield$apiCatalogGuid.sessionGuid;
1801
2136
  a = _yield$apiCatalogGuid.accountId;
1802
2137
  accountSessionGuid = s;
@@ -1812,15 +2147,15 @@ function useSellerStateData(_ref) {
1812
2147
  value: accountSessionGuid
1813
2148
  }]
1814
2149
  });
1815
- return _context6.abrupt("return", {
2150
+ return _context7.abrupt("return", {
1816
2151
  accountSessionGuid: accountSessionGuid,
1817
2152
  accountId: accountId
1818
2153
  });
1819
2154
  case 15:
1820
- return _context6.abrupt("return", undefined);
2155
+ return _context7.abrupt("return", undefined);
1821
2156
  case 16:
1822
2157
  case "end":
1823
- return _context6.stop();
2158
+ return _context7.stop();
1824
2159
  }
1825
2160
  }, _callee6);
1826
2161
  }));
@@ -1854,11 +2189,11 @@ function useSellerStateData(_ref) {
1854
2189
  var updateBasket = /*#__PURE__*/function () {
1855
2190
  var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(divaNr, basket, customProductId, organizationId, assignNewDivaNr, jwt) {
1856
2191
  var _state$basketState, _currentBasket, _state$basketState2, _currentBasket2, currentBasket, basketIsAlreadySaved, oldSetIds, newSetIds, doReallyConcat, _state$basketState5, _state$basketState6, _state$basketState3, _divaNr, _state$basketState4, _state$basketState7, ret, _getBasketStatusArr, _divaNr2, catalogData;
1857
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
1858
- while (1) switch (_context7.prev = _context7.next) {
2192
+ return _regeneratorRuntime.wrap(function _callee7$(_context8) {
2193
+ while (1) switch (_context8.prev = _context8.next) {
1859
2194
  case 0:
1860
2195
  if (!(state.firstLoginApiUrl && sessionGuid)) {
1861
- _context7.next = 53;
2196
+ _context8.next = 53;
1862
2197
  break;
1863
2198
  }
1864
2199
  currentBasket = basket;
@@ -1873,29 +2208,29 @@ function useSellerStateData(_ref) {
1873
2208
  return newSetIds.includes(x);
1874
2209
  }).length == 0 : false;
1875
2210
  if (!(divaNr && divaNr == state.currentDivaNr && (_state$basketState2 = state.basketState) !== null && _state$basketState2 !== void 0 && _state$basketState2.basket)) {
1876
- _context7.next = 19;
2211
+ _context8.next = 19;
1877
2212
  break;
1878
2213
  }
1879
2214
  if (currentBasket) {
1880
- _context7.next = 16;
2215
+ _context8.next = 16;
1881
2216
  break;
1882
2217
  }
1883
2218
  //if no new basket object is passed in, update the divaNr on the current basket
1884
2219
  currentBasket = (_state$basketState3 = state.basketState) === null || _state$basketState3 === void 0 ? void 0 : _state$basketState3.basket;
1885
2220
  if (!(!((_divaNr = divaNr) !== null && _divaNr !== void 0 && _divaNr.startsWith(currentBasket.DivaNr)) || (_state$basketState4 = state.basketState) !== null && _state$basketState4 !== void 0 && _state$basketState4.assignNewDivaNr)) {
1886
- _context7.next = 14;
2221
+ _context8.next = 14;
1887
2222
  break;
1888
2223
  }
1889
- _context7.next = 12;
2224
+ _context8.next = 12;
1890
2225
  return apiLoadUniqueDivaNr({
1891
2226
  basketUrl: apiConfig.basketService,
1892
2227
  jwt: jwt
1893
2228
  });
1894
2229
  case 12:
1895
- divaNr = _context7.sent;
2230
+ divaNr = _context8.sent;
1896
2231
  currentBasket.DivaNr = divaNr;
1897
2232
  case 14:
1898
- _context7.next = 17;
2233
+ _context8.next = 17;
1899
2234
  break;
1900
2235
  case 16:
1901
2236
  if ((_state$basketState5 = state.basketState) !== null && _state$basketState5 !== void 0 && _state$basketState5.concat && doReallyConcat && state !== null && state !== void 0 && (_state$basketState6 = state.basketState) !== null && _state$basketState6 !== void 0 && _state$basketState6.basket && basket) {
@@ -1904,14 +2239,14 @@ function useSellerStateData(_ref) {
1904
2239
  currentBasket = state.basketState.basket;
1905
2240
  }
1906
2241
  case 17:
1907
- _context7.next = 40;
2242
+ _context8.next = 40;
1908
2243
  break;
1909
2244
  case 19:
1910
2245
  if (!(!currentBasket || divaNr != currentBasket.DivaNr || customProductId)) {
1911
- _context7.next = 40;
2246
+ _context8.next = 40;
1912
2247
  break;
1913
2248
  }
1914
- _context7.next = 22;
2249
+ _context8.next = 22;
1915
2250
  return apiLoadBasket({
1916
2251
  divaNr: divaNr,
1917
2252
  apiConfig: _objectSpread$B(_objectSpread$B({}, apiConfig), {}, {
@@ -1928,31 +2263,31 @@ function useSellerStateData(_ref) {
1928
2263
  jwt: jwt
1929
2264
  });
1930
2265
  case 22:
1931
- ret = _context7.sent;
2266
+ ret = _context8.sent;
1932
2267
  if (ret) {
1933
- _context7.next = 25;
2268
+ _context8.next = 25;
1934
2269
  break;
1935
2270
  }
1936
- return _context7.abrupt("return");
2271
+ return _context8.abrupt("return");
1937
2272
  case 25:
1938
2273
  currentBasket = ret.basket;
1939
2274
  if (!((_state$basketState7 = state.basketState) !== null && _state$basketState7 !== void 0 && _state$basketState7.assignNewDivaNr || assignNewDivaNr || !divaNr && customProductId)) {
1940
- _context7.next = 36;
2275
+ _context8.next = 36;
1941
2276
  break;
1942
2277
  }
1943
- _context7.next = 29;
2278
+ _context8.next = 29;
1944
2279
  return apiLoadUniqueDivaNr({
1945
2280
  basketUrl: apiConfig.basketService,
1946
2281
  jwt: jwt
1947
2282
  });
1948
2283
  case 29:
1949
- divaNr = _context7.sent;
2284
+ divaNr = _context8.sent;
1950
2285
  currentBasket.DivaNr = divaNr;
1951
2286
  //reset status basket gets new DivaNr
1952
2287
  if ((_getBasketStatusArr = getBasketStatusArr()) !== null && _getBasketStatusArr !== void 0 && _getBasketStatusArr[0]) currentBasket.Status = getBasketStatusArr()[0];
1953
2288
  currentBasket.setDocumentVersion(1);
1954
2289
  divaNr = divaNr + '-1';
1955
- _context7.next = 39;
2290
+ _context8.next = 39;
1956
2291
  break;
1957
2292
  case 36:
1958
2293
  currentBasket.setDocumentVersion(ret.newestDocumentVersion);
@@ -1965,10 +2300,10 @@ function useSellerStateData(_ref) {
1965
2300
  case 40:
1966
2301
  catalogData = undefined;
1967
2302
  if (!currentBasket) {
1968
- _context7.next = 45;
2303
+ _context8.next = 45;
1969
2304
  break;
1970
2305
  }
1971
- _context7.next = 44;
2306
+ _context8.next = 44;
1972
2307
  return loadCatalogInfo.apply(void 0, _toConsumableArray(currentBasket.OrderSets.map(function (os) {
1973
2308
  return {
1974
2309
  catalogCodex: os.CatalogCodex,
@@ -1978,16 +2313,16 @@ function useSellerStateData(_ref) {
1978
2313
  };
1979
2314
  })));
1980
2315
  case 44:
1981
- catalogData = _context7.sent;
2316
+ catalogData = _context8.sent;
1982
2317
  case 45:
1983
2318
  if (!currentBasket) {
1984
- _context7.next = 51;
2319
+ _context8.next = 51;
1985
2320
  break;
1986
2321
  }
1987
2322
  currentBasket.PrintOptions = getPrintOptions(currentBasket.PrintOptions);
1988
2323
  currentBasket.UserLanguage = i18n.language;
1989
2324
  currentBasket.ClientLanguage = i18n.language;
1990
- _context7.next = 51;
2325
+ _context8.next = 51;
1991
2326
  return DivaUtils$1.updateBasketOrgInfo(currentBasket, currentOrganization, currentUser, false);
1992
2327
  case 51:
1993
2328
  dispatch({
@@ -2010,7 +2345,7 @@ function useSellerStateData(_ref) {
2010
2345
  value: undefined
2011
2346
  }]
2012
2347
  });
2013
- return _context7.abrupt("return", {
2348
+ return _context8.abrupt("return", {
2014
2349
  currentBasket: currentBasket,
2015
2350
  catalogData: catalogData,
2016
2351
  saved: basketIsAlreadySaved
@@ -2019,7 +2354,7 @@ function useSellerStateData(_ref) {
2019
2354
  throw new Error('Function: updateBasket was called bevor state.firstLoginApiUrl is initialized!');
2020
2355
  case 54:
2021
2356
  case "end":
2022
- return _context7.stop();
2357
+ return _context8.stop();
2023
2358
  }
2024
2359
  }, _callee7);
2025
2360
  }));
@@ -2030,17 +2365,17 @@ function useSellerStateData(_ref) {
2030
2365
  var saveBasket = /*#__PURE__*/function () {
2031
2366
  var _ref14 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(basket, openPDF, saveToApi2, toggleEvent) {
2032
2367
  var response;
2033
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
2034
- while (1) switch (_context8.prev = _context8.next) {
2368
+ return _regeneratorRuntime.wrap(function _callee8$(_context9) {
2369
+ while (1) switch (_context9.prev = _context9.next) {
2035
2370
  case 0:
2036
2371
  if (!(configData && jwt)) {
2037
- _context8.next = 13;
2372
+ _context9.next = 13;
2038
2373
  break;
2039
2374
  }
2040
2375
  if (toggleEvent) toggleLoading(toggleEvent);
2041
2376
  basket.ApplicationEnvironment = 'SELLER';
2042
2377
  basket.ReportConfigIdentifier = configData.reportConfigIdentifier;
2043
- _context8.next = 6;
2378
+ _context9.next = 6;
2044
2379
  return basketHandler.saveBasket({
2045
2380
  basket: basket,
2046
2381
  jwt: jwt,
@@ -2049,20 +2384,20 @@ function useSellerStateData(_ref) {
2049
2384
  sessionGuid: sessionGuid
2050
2385
  });
2051
2386
  case 6:
2052
- response = _context8.sent;
2387
+ response = _context9.sent;
2053
2388
  if (!Object.values(BASKET_SAVE_ERROR).includes(response)) {
2054
- _context8.next = 10;
2389
+ _context9.next = 10;
2055
2390
  break;
2056
2391
  }
2057
2392
  if (toggleEvent) toggleLoading(toggleEvent);
2058
- return _context8.abrupt("return", response);
2393
+ return _context9.abrupt("return", response);
2059
2394
  case 10:
2060
2395
  updateBasketState({
2061
2396
  saved: true,
2062
2397
  basetId: response.MongoDBId
2063
2398
  });
2064
2399
  if (toggleEvent) toggleLoading(toggleEvent);
2065
- return _context8.abrupt("return", {
2400
+ return _context9.abrupt("return", {
2066
2401
  mongodbId: response._id,
2067
2402
  pdfUrl: response.PDFDocumentURL
2068
2403
  });
@@ -2070,7 +2405,7 @@ function useSellerStateData(_ref) {
2070
2405
  throw new Error('Function: saveBasket was called bevor state.firstLoginApiUrl is initialized!');
2071
2406
  case 14:
2072
2407
  case "end":
2073
- return _context8.stop();
2408
+ return _context9.stop();
2074
2409
  }
2075
2410
  }, _callee8);
2076
2411
  }));
@@ -2173,67 +2508,155 @@ function useSellerStateData(_ref) {
2173
2508
  };
2174
2509
  var loadArticles = /*#__PURE__*/function () {
2175
2510
  var _ref16 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(_ref15) {
2176
- var catalogCodex, accountId, props, _state$currentAccount, _state$catalogData2, articles, accountSessionId;
2177
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
2178
- while (1) switch (_context9.prev = _context9.next) {
2511
+ var catalogCodex, accountId, props, _state$catalogData2, _collection$enricherS4, articles, catalogs, collections, collection, accountSessionId, isIDMData, _catalogs, _catalog, _catalog2, catalog, _yield$loadCatalogInf, _state$currentCollect3;
2512
+ return _regeneratorRuntime.wrap(function _callee9$(_context10) {
2513
+ while (1) switch (_context10.prev = _context10.next) {
2179
2514
  case 0:
2180
2515
  catalogCodex = _ref15.catalogCodex, accountId = _ref15.accountId, props = _objectWithoutProperties(_ref15, _excluded3$1);
2181
2516
  if (!state.firstLoginApiUrl) {
2182
- _context9.next = 27;
2517
+ _context10.next = 58;
2183
2518
  break;
2184
2519
  }
2185
2520
  articles = state.articles;
2186
- if (!((_state$currentAccount = state.currentAccountLoginId) !== null && _state$currentAccount !== void 0)) {
2187
- _context9.next = 7;
2521
+ catalogs = state.catalogData;
2522
+ collections = state.collections;
2523
+ if (collections) {
2524
+ _context10.next = 9;
2525
+ break;
2526
+ }
2527
+ _context10.next = 8;
2528
+ return loadCollections({});
2529
+ case 8:
2530
+ collections = _context10.sent.data;
2531
+ case 9:
2532
+ collection = collections.find(function (c) {
2533
+ var _state$currentCollect2;
2534
+ return c.id == ((_state$currentCollect2 = state.currentCollectionId) !== null && _state$currentCollect2 !== void 0 ? _state$currentCollect2 : accountId);
2535
+ });
2536
+ if (!(!state.currentAccountLoginId && (collection === null || collection === void 0 ? void 0 : collection.type) !== 'ENRICHER_PACKAGE')) {
2537
+ _context10.next = 21;
2188
2538
  break;
2189
2539
  }
2190
- _context9.t0 = _state$currentAccount;
2191
- _context9.next = 15;
2192
- break;
2193
- case 7:
2194
2540
  if (!accountId) {
2195
- _context9.next = 13;
2541
+ _context10.next = 17;
2196
2542
  break;
2197
2543
  }
2198
- _context9.next = 10;
2544
+ _context10.next = 14;
2199
2545
  return checkAccountLogin({
2200
2546
  accountId: accountId
2201
2547
  });
2202
- case 10:
2203
- _context9.t1 = _context9.sent;
2204
- _context9.next = 14;
2205
- break;
2206
- case 13:
2207
- _context9.t1 = sessionGuid;
2208
2548
  case 14:
2209
- _context9.t0 = _context9.t1;
2210
- case 15:
2211
- accountSessionId = _context9.t0;
2549
+ _context10.t1 = _context10.sent;
2550
+ _context10.next = 18;
2551
+ break;
2552
+ case 17:
2553
+ _context10.t1 = sessionGuid;
2554
+ case 18:
2555
+ _context10.t0 = _context10.t1;
2556
+ _context10.next = 22;
2557
+ break;
2558
+ case 21:
2559
+ _context10.t0 = state.currentAccountLoginId;
2560
+ case 22:
2561
+ accountSessionId = _context10.t0;
2212
2562
  if (!(!state.catalogs || !((_state$catalogData2 = state.catalogData) !== null && _state$catalogData2 !== void 0 && _state$catalogData2.length))) {
2213
- _context9.next = 19;
2563
+ _context10.next = 27;
2214
2564
  break;
2215
2565
  }
2216
- _context9.next = 19;
2566
+ _context10.next = 26;
2217
2567
  return loadCatalogInfo({
2218
2568
  catalogCodex: catalogCodex,
2219
2569
  accountId: accountId,
2220
2570
  accountSessionId: accountSessionId,
2221
2571
  language: 'en'
2222
2572
  });
2223
- case 19:
2573
+ case 26:
2574
+ catalogs = _context10.sent;
2575
+ case 27:
2576
+ isIDMData = collection === null || collection === void 0 || (_collection$enricherS4 = collection.enricherSeries) === null || _collection$enricherS4 === void 0 ? void 0 : _collection$enricherS4.find(function (s) {
2577
+ return s.serieNo === catalogCodex;
2578
+ });
2579
+ if (!isIDMData) {
2580
+ _context10.next = 50;
2581
+ break;
2582
+ }
2583
+ catalog = (_catalogs = catalogs) === null || _catalogs === void 0 ? void 0 : _catalogs.find(function (c) {
2584
+ return c.codex == isIDMData.serieNo;
2585
+ });
2586
+ if (catalog) {
2587
+ _context10.next = 43;
2588
+ break;
2589
+ }
2590
+ _context10.next = 33;
2591
+ return loadCatalogInfo({
2592
+ catalogCodex: isIDMData.serieNo,
2593
+ language: i18n.language,
2594
+ accountId: (_state$currentCollect3 = state.currentCollectionId) !== null && _state$currentCollect3 !== void 0 ? _state$currentCollect3 : accountId
2595
+ });
2596
+ case 33:
2597
+ _context10.t3 = _yield$loadCatalogInf = _context10.sent;
2598
+ _context10.t2 = _context10.t3 === null;
2599
+ if (_context10.t2) {
2600
+ _context10.next = 37;
2601
+ break;
2602
+ }
2603
+ _context10.t2 = _yield$loadCatalogInf === void 0;
2604
+ case 37:
2605
+ if (!_context10.t2) {
2606
+ _context10.next = 41;
2607
+ break;
2608
+ }
2609
+ _context10.t4 = void 0;
2610
+ _context10.next = 42;
2611
+ break;
2612
+ case 41:
2613
+ _context10.t4 = _yield$loadCatalogInf[0];
2614
+ case 42:
2615
+ catalog = _context10.t4;
2616
+ case 43:
2617
+ _context10.next = 45;
2618
+ return apiLoadEnricherArticles({
2619
+ catalogId: (_catalog = catalog) === null || _catalog === void 0 ? void 0 : _catalog.supplierGuid,
2620
+ enricherUrl: apiConfig.enricherService,
2621
+ jwt: jwt,
2622
+ language: i18n.language,
2623
+ serieId: (_catalog2 = catalog) === null || _catalog2 === void 0 ? void 0 : _catalog2.guid
2624
+ });
2625
+ case 45:
2626
+ articles = _context10.sent;
2627
+ dispatch({
2628
+ type: 'update',
2629
+ payload: [{
2630
+ field: 'articles',
2631
+ value: articles
2632
+ }, {
2633
+ field: 'currentCatalogCodex',
2634
+ value: catalogCodex
2635
+ }, {
2636
+ field: 'currentAccountLoginId',
2637
+ value: accountSessionId
2638
+ }, {
2639
+ field: 'currentAccountId',
2640
+ value: accountId
2641
+ }]
2642
+ });
2643
+ return _context10.abrupt("return", processData(_objectSpread$B(_objectSpread$B({}, props), {}, {
2644
+ data: articles || []
2645
+ })));
2646
+ case 50:
2224
2647
  if (!(catalogCodex && accountSessionId && (!articles || articles.length == 0 || articles[0].catalogCodex != catalogCodex))) {
2225
- _context9.next = 24;
2648
+ _context10.next = 55;
2226
2649
  break;
2227
2650
  }
2228
- _context9.next = 22;
2651
+ _context10.next = 53;
2229
2652
  return apiLoadArticles({
2230
2653
  serverUrlAPI: state.firstLoginApiUrl,
2231
2654
  catalogCodex: catalogCodex,
2232
2655
  accountSessionId: accountSessionId,
2233
2656
  lang: i18n.language
2234
2657
  });
2235
- case 22:
2236
- articles = _context9.sent;
2658
+ case 53:
2659
+ articles = _context10.sent;
2237
2660
  dispatch({
2238
2661
  type: 'update',
2239
2662
  payload: [{
@@ -2250,18 +2673,18 @@ function useSellerStateData(_ref) {
2250
2673
  value: accountId
2251
2674
  }]
2252
2675
  });
2253
- case 24:
2254
- return _context9.abrupt("return", processData(_objectSpread$B(_objectSpread$B({}, props), {}, {
2676
+ case 55:
2677
+ return _context10.abrupt("return", processData(_objectSpread$B(_objectSpread$B({}, props), {}, {
2255
2678
  data: articles || []
2256
2679
  })));
2257
- case 27:
2258
- return _context9.abrupt("return", {
2680
+ case 58:
2681
+ return _context10.abrupt("return", {
2259
2682
  data: [],
2260
2683
  total: 0
2261
2684
  });
2262
- case 28:
2685
+ case 59:
2263
2686
  case "end":
2264
- return _context9.stop();
2687
+ return _context10.stop();
2265
2688
  }
2266
2689
  }, _callee9);
2267
2690
  }));
@@ -2634,7 +3057,7 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2634
3057
  case 37:
2635
3058
  _context3.prev = 37;
2636
3059
  _context3.t0 = _context3["catch"](0);
2637
- LOG$8.error(new DivaError('Could not open divaNr', {
3060
+ LOG$8.error(new DivaError$1('Could not open divaNr', {
2638
3061
  cause: _context3.t0,
2639
3062
  code: 'SELLER_0001'
2640
3063
  }));
@@ -2666,16 +3089,25 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2666
3089
  }();
2667
3090
  var openPlanner = /*#__PURE__*/function () {
2668
3091
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref4) {
2669
- var catalogCodex, articleCodexes, forceReload, accountSessionGuid, accountId, retailArticleNr, setId, divaNr, productId, basketData, returnTo, productName, params, internal, _state$basketState4, _params2, _internal2, orderSet, _params3, _basketData$OrderSets, _basketData$OrderSets2;
3092
+ var _state$collections, _state$catalogData;
3093
+ var catalogCodex, articleCodexes, forceReload, accountSessionGuid, accountId, retailArticleNr, setId, divaNr, productId, basketData, returnTo, productName, coll, isIDMData, serieId, params, internal, _state$basketState4, _params2, _internal2, orderSet, _params3, _basketData$OrderSets, _basketData$OrderSets2;
2670
3094
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
2671
3095
  while (1) switch (_context4.prev = _context4.next) {
2672
3096
  case 0:
2673
3097
  catalogCodex = _ref4.catalogCodex, articleCodexes = _ref4.articleCodexes, forceReload = _ref4.forceReload, accountSessionGuid = _ref4.accountSessionGuid, accountId = _ref4.accountId, retailArticleNr = _ref4.retailArticleNr, setId = _ref4.setId, divaNr = _ref4.divaNr, productId = _ref4.productId, basketData = _ref4.basketData, returnTo = _ref4.returnTo, productName = _ref4.productName;
2674
- if (!(catalogCodex && (accountSessionGuid && accountId || organization.parentType === 'SUPPLIER') && returnTo === 'SETPLANNER_OPEN_SELLER_BASKET' && basketData)) {
2675
- _context4.next = 8;
3098
+ coll = (_state$collections = state.collections) === null || _state$collections === void 0 ? void 0 : _state$collections.find(function (c) {
3099
+ var _state$currentCollect;
3100
+ return c.id == ((_state$currentCollect = state.currentCollectionId) !== null && _state$currentCollect !== void 0 ? _state$currentCollect : accountId);
3101
+ });
3102
+ isIDMData = (coll === null || coll === void 0 ? void 0 : coll.type) == 'ENRICHER_PACKAGE';
3103
+ serieId = isIDMData ? (_state$catalogData = state.catalogData) === null || _state$catalogData === void 0 || (_state$catalogData = _state$catalogData.find(function (c) {
3104
+ return c.codex == state.currentCatalogCodex;
3105
+ })) === null || _state$catalogData === void 0 ? void 0 : _state$catalogData.guid : undefined;
3106
+ if (!(catalogCodex && (accountSessionGuid && accountId || isIDMData || organization.parentType === 'SUPPLIER') && returnTo === 'SETPLANNER_OPEN_SELLER_BASKET' && basketData)) {
3107
+ _context4.next = 11;
2676
3108
  break;
2677
3109
  }
2678
- params = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({
3110
+ params = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({
2679
3111
  catalogCodex: catalogCodex
2680
3112
  }, accountId ? {
2681
3113
  accountId: accountId
@@ -2687,6 +3119,10 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2687
3119
  productName: productName
2688
3120
  } : {}), articleCodexes ? {
2689
3121
  articleCodexes: articleCodexes
3122
+ } : {}), isIDMData ? {
3123
+ isIDMData: '1'
3124
+ } : {}), serieId ? {
3125
+ serieId: serieId
2690
3126
  } : {}), retailArticleNr ? {
2691
3127
  retailArticleNr: retailArticleNr
2692
3128
  } : {});
@@ -2704,18 +3140,18 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2704
3140
  parameters: params,
2705
3141
  internal: internal
2706
3142
  });
2707
- _context4.next = 23;
3143
+ _context4.next = 26;
2708
3144
  break;
2709
- case 8:
2710
- if (!(catalogCodex && (accountSessionGuid && accountId || organization.parentType === 'SUPPLIER') && returnTo || productId)) {
2711
- _context4.next = 12;
3145
+ case 11:
3146
+ if (!(catalogCodex && (accountSessionGuid && accountId || isIDMData || organization.parentType === 'SUPPLIER') && returnTo || productId)) {
3147
+ _context4.next = 15;
2712
3148
  break;
2713
3149
  }
2714
3150
  if ((_state$basketState4 = state.basketState) !== null && _state$basketState4 !== void 0 && _state$basketState4.basket && state.currentDivaNr) {
2715
3151
  //if a basket already exists ask if the user wants to add the new planning to the existing Basket
2716
3152
  //if originProductId is set, always create new planning
2717
3153
  if (state.originProductId) {
2718
- prepareNewPlanning(catalogCodex, accountId, productId, productName, articleCodexes, retailArticleNr, accountSessionGuid, forceReload, returnTo);
3154
+ prepareNewPlanning(catalogCodex, accountId, productId, productName, articleCodexes, isIDMData, serieId, retailArticleNr, accountSessionGuid, forceReload, returnTo);
2719
3155
  } else {
2720
3156
  openModal({
2721
3157
  title: t('modals.add_to_order'),
@@ -2728,7 +3164,7 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2728
3164
  updateBasketState({
2729
3165
  concat: true
2730
3166
  });
2731
- var _params = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({}, catalogCodex ? {
3167
+ var _params = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({}, catalogCodex ? {
2732
3168
  catalogCodex: catalogCodex
2733
3169
  } : {}), accountId ? {
2734
3170
  accountId: accountId
@@ -2740,6 +3176,8 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2740
3176
  productName: productName
2741
3177
  } : {}), articleCodexes ? {
2742
3178
  articleCodexes: articleCodexes
3179
+ } : {}), isIDMData ? {
3180
+ isIDMData: '1'
2743
3181
  } : {}), retailArticleNr ? {
2744
3182
  retailArticleNr: retailArticleNr
2745
3183
  } : {}), productId ? {
@@ -2765,6 +3203,7 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2765
3203
  askSavePlanning('toPlanner', state.currentDivaNr, {
2766
3204
  catalogCodex: catalogCodex,
2767
3205
  articleCodexes: articleCodexes,
3206
+ isIDMData: isIDMData,
2768
3207
  forceReload: forceReload,
2769
3208
  accountId: accountId,
2770
3209
  accountSessionGuid: accountSessionGuid,
@@ -2776,14 +3215,14 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2776
3215
  returnTo: returnTo
2777
3216
  });
2778
3217
  } else {
2779
- prepareNewPlanning(catalogCodex, accountId, productId, productName, articleCodexes, retailArticleNr, accountSessionGuid, forceReload, returnTo);
3218
+ prepareNewPlanning(catalogCodex, accountId, productId, productName, articleCodexes, isIDMData, serieId, retailArticleNr, accountSessionGuid, forceReload, returnTo);
2780
3219
  }
2781
3220
  }
2782
3221
  }
2783
3222
  });
2784
3223
  }
2785
3224
  } else {
2786
- _params2 = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({}, catalogCodex ? {
3225
+ _params2 = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({}, catalogCodex ? {
2787
3226
  catalogCodex: catalogCodex
2788
3227
  } : {}), accountId ? {
2789
3228
  accountId: accountId
@@ -2795,6 +3234,10 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2795
3234
  productName: productName
2796
3235
  } : {}), articleCodexes ? {
2797
3236
  articleCodexes: articleCodexes
3237
+ } : {}), isIDMData ? {
3238
+ isIDMData: '1'
3239
+ } : {}), serieId ? {
3240
+ serieId: serieId
2798
3241
  } : {}), retailArticleNr ? {
2799
3242
  retailArticleNr: retailArticleNr
2800
3243
  } : {});
@@ -2812,28 +3255,28 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2812
3255
  internal: _internal2
2813
3256
  });
2814
3257
  }
2815
- _context4.next = 23;
3258
+ _context4.next = 26;
2816
3259
  break;
2817
- case 12:
3260
+ case 15:
2818
3261
  if (!(divaNr && basketData && returnTo)) {
2819
- _context4.next = 22;
3262
+ _context4.next = 25;
2820
3263
  break;
2821
3264
  }
2822
3265
  orderSet = basketData.OrderSets.find(function (s) {
2823
3266
  return s.SetID == setId;
2824
3267
  });
2825
3268
  if (!(orderSet && orderSet.CatalogCodex != state.currentCatalogCodex)) {
2826
- _context4.next = 17;
3269
+ _context4.next = 20;
2827
3270
  break;
2828
3271
  }
2829
- _context4.next = 17;
3272
+ _context4.next = 20;
2830
3273
  return stateFunctions.loadCatalogInfo({
2831
3274
  catalogCodex: orderSet.CatalogCodex,
2832
3275
  accountId: orderSet.AccountGUID,
2833
3276
  accountSessionId: accountSessionGuid,
2834
3277
  language: 'de'
2835
3278
  });
2836
- case 17:
3279
+ case 20:
2837
3280
  _params3 = {
2838
3281
  setId: setId,
2839
3282
  divaNr: divaNr,
@@ -2853,13 +3296,13 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2853
3296
  forceReload: forceReload
2854
3297
  }
2855
3298
  });
2856
- _context4.next = 23;
3299
+ _context4.next = 26;
2857
3300
  break;
2858
- case 22:
2859
- LOG$8.error(new DivaError('openPlanner got called with non all required params', {
3301
+ case 25:
3302
+ LOG$8.error(new DivaError$1('openPlanner got called with non all required params', {
2860
3303
  code: 'SELLER_0001'
2861
3304
  }));
2862
- case 23:
3305
+ case 26:
2863
3306
  if (DivaUtils$1.bridge) {
2864
3307
  DivaUtils$1.bridge.sendMessage({
2865
3308
  type: 'ABN',
@@ -2869,7 +3312,7 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2869
3312
  catalogName: (_basketData$OrderSets2 = basketData === null || basketData === void 0 ? void 0 : basketData.OrderSets[0].CatalogName) !== null && _basketData$OrderSets2 !== void 0 ? _basketData$OrderSets2 : undefined
2870
3313
  });
2871
3314
  }
2872
- case 24:
3315
+ case 27:
2873
3316
  case "end":
2874
3317
  return _context4.stop();
2875
3318
  }
@@ -2879,7 +3322,7 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2879
3322
  return _ref5.apply(this, arguments);
2880
3323
  };
2881
3324
  }();
2882
- var prepareNewPlanning = function prepareNewPlanning(catalogCodex, accountId, productId, productName, articleCodexes, retailArticleNr, accountSessionGuid, forceReload, returnToParam) {
3325
+ var prepareNewPlanning = function prepareNewPlanning(catalogCodex, accountId, productId, productName, articleCodexes, isIDMData, serieId, retailArticleNr, accountSessionGuid, forceReload, returnToParam) {
2883
3326
  updateBasketState({
2884
3327
  saved: false,
2885
3328
  concat: false,
@@ -2887,7 +3330,7 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2887
3330
  step: null,
2888
3331
  assignNewDivaNr: false
2889
3332
  });
2890
- var params = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({}, catalogCodex ? {
3333
+ var params = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({}, catalogCodex ? {
2891
3334
  catalogCodex: catalogCodex
2892
3335
  } : {}), accountId ? {
2893
3336
  accountId: accountId
@@ -2899,6 +3342,10 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2899
3342
  productName: productName
2900
3343
  } : {}), articleCodexes ? {
2901
3344
  articleCodexes: articleCodexes
3345
+ } : {}), isIDMData ? {
3346
+ isIDMData: '1'
3347
+ } : {}), serieId ? {
3348
+ serieId: serieId
2902
3349
  } : {}), retailArticleNr ? {
2903
3350
  retailArticleNr: retailArticleNr
2904
3351
  } : {});
@@ -2956,7 +3403,7 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2956
3403
  case 'toPlanner':
2957
3404
  {
2958
3405
  if (plannerParams) {
2959
- var params = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({}, plannerParams.catalogCodex ? {
3406
+ var params = _objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A(_objectSpread$A({}, plannerParams.catalogCodex ? {
2960
3407
  catalogCodex: plannerParams.catalogCodex
2961
3408
  } : {}), plannerParams.accountId ? {
2962
3409
  accountId: plannerParams.accountId
@@ -2964,6 +3411,10 @@ var SellerStateProvider = function SellerStateProvider(_ref) {
2964
3411
  returnTo: plannerParams.returnTo
2965
3412
  } : {}), plannerParams.articleCodexes ? {
2966
3413
  articleCodexes: plannerParams.articleCodexes
3414
+ } : {}), plannerParams.isIDMData ? {
3415
+ isIDMData: '1'
3416
+ } : {}), plannerParams.serieId ? {
3417
+ serieId: plannerParams.serieId
2967
3418
  } : {}), plannerParams.productId ? {
2968
3419
  productId: plannerParams.productId
2969
3420
  } : {}), plannerParams.retailArticleNr ? {
@@ -3209,7 +3660,7 @@ function Catalogs(_ref) {
3209
3660
  var enableModelAnalytics = !!(configurationData !== null && configurationData !== void 0 && (_configurationData$an = configurationData.analyticsHistogramConfig) !== null && _configurationData$an !== void 0 && _configurationData$an.enableModelAnalytics);
3210
3661
  var load = useCallback(/*#__PURE__*/function () {
3211
3662
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(collectionId) {
3212
- var collections, _configurationData$an2, pastMonths, catalogCodex, analytics;
3663
+ var catalogs, _configurationData$an2, pastMonths, catalogCodex, analytics;
3213
3664
  return _regeneratorRuntime.wrap(function _callee$(_context) {
3214
3665
  while (1) switch (_context.prev = _context.next) {
3215
3666
  case 0:
@@ -3220,14 +3671,14 @@ function Catalogs(_ref) {
3220
3671
  collectionId: collectionId
3221
3672
  });
3222
3673
  case 4:
3223
- collections = _context.sent;
3224
- setData(collections.data);
3674
+ catalogs = _context.sent;
3675
+ setData(catalogs.data);
3225
3676
  if (!(enableModelAnalytics && userHasPermission('analyticsmodel'))) {
3226
3677
  _context.next = 17;
3227
3678
  break;
3228
3679
  }
3229
3680
  pastMonths = configurationData === null || configurationData === void 0 || (_configurationData$an2 = configurationData.analyticsHistogramConfig) === null || _configurationData$an2 === void 0 ? void 0 : _configurationData$an2.pastAnalyticsMonths;
3230
- catalogCodex = collections.data.map(function (catalog) {
3681
+ catalogCodex = catalogs.data.map(function (catalog) {
3231
3682
  return catalog.codex;
3232
3683
  });
3233
3684
  _context.next = 11;
@@ -3240,7 +3691,7 @@ function Catalogs(_ref) {
3240
3691
  analytics = _context.sent;
3241
3692
  _context.t0 = setData;
3242
3693
  _context.next = 15;
3243
- return mergeModelsAndScore(collections, analytics);
3694
+ return mergeModelsAndScore(catalogs, analytics);
3244
3695
  case 15:
3245
3696
  _context.t1 = _context.sent.data;
3246
3697
  (0, _context.t0)(_context.t1);
@@ -3822,6 +4273,9 @@ function Articles(_ref) {
3822
4273
  currentAccountLoginId = _useSellerState$state.currentAccountLoginId,
3823
4274
  sessionGuid = _useSellerState$state.sessionGuid,
3824
4275
  returnTo = _useSellerState$state.returnTo;
4276
+ _useSellerState$state.collections;
4277
+ _useSellerState$state.currentCollectionId;
4278
+ _useSellerState$state.catalogData;
3825
4279
  var _useDivaCore = useDivaCore(),
3826
4280
  organization = _useDivaCore.state.organization;
3827
4281
  useEffect(function () {
@@ -7866,6 +8320,8 @@ function useModelInfoPage (_ref) {
7866
8320
  returnTo = _useSellerState$state.returnTo,
7867
8321
  sessionGuid = _useSellerState$state.sessionGuid,
7868
8322
  originProductId = _useSellerState$state.originProductId;
8323
+ _useSellerState$state.collections;
8324
+ _useSellerState$state.currentCollectionId;
7869
8325
  var _useDivaCore = useDivaCore(),
7870
8326
  organization = _useDivaCore.state.organization,
7871
8327
  _useDivaCore$actions = _useDivaCore.actions,
@@ -7974,7 +8430,7 @@ function useModelInfoPage (_ref) {
7974
8430
  load();
7975
8431
  }, [accountId, catalogCodex, i18n.language, sessionGuid]);
7976
8432
  var onOpenPlanner = useCallback(function (accountLoginId, returnToPlanner) {
7977
- if (accountLoginId || currentAccountLoginId || organization.parentType === 'SUPPLIER') {
8433
+ if (accountLoginId || currentAccountLoginId || organization.parentType === 'SUPPLIER' || catalogData !== null && catalogData !== void 0 && catalogData.isIDMData) {
7978
8434
  var plannerReturn = returnToPlanner || (configurationData === null || configurationData === void 0 ? void 0 : configurationData.defaultWebPlannerReturnTo) || 'OPEN_SELLER_BASKET';
7979
8435
  if (checkDoReturnToProductCreator(plannerReturn, returnTo)) {
7980
8436
  plannerReturn = 'OPEN_SELLER_PRODUCTCREATOR';
@@ -7988,11 +8444,11 @@ function useModelInfoPage (_ref) {
7988
8444
  returnTo: plannerReturn
7989
8445
  });
7990
8446
  } else {
7991
- LOG$3.error(new DivaError('Missing account login ID', {
8447
+ LOG$3.error(new DivaError$1('Missing account login ID', {
7992
8448
  code: 'SELLER_0001'
7993
8449
  }));
7994
8450
  }
7995
- }, [currentAccountLoginId, organization.parentType, accountId, catalogCodex, configurationData === null || configurationData === void 0 ? void 0 : configurationData.defaultWebPlannerReturnTo, currentBasketState === null || currentBasketState === void 0 ? void 0 : currentBasketState.basket]);
8451
+ }, [currentAccountLoginId, organization.parentType, accountId, catalogData, catalogCodex, configurationData === null || configurationData === void 0 ? void 0 : configurationData.defaultWebPlannerReturnTo, currentBasketState === null || currentBasketState === void 0 ? void 0 : currentBasketState.basket]);
7996
8452
  var onOpenArticles = useCallback(function () {
7997
8453
  if ((accountId || organization.parentType === 'SUPPLIER') && catalogCodex) {
7998
8454
  openComponent({
@@ -8004,7 +8460,7 @@ function useModelInfoPage (_ref) {
8004
8460
  }
8005
8461
  });
8006
8462
  } else {
8007
- LOG$3.error(new DivaError('Missing account ID or catalog', {
8463
+ LOG$3.error(new DivaError$1('Missing account ID or catalog', {
8008
8464
  code: 'SELLER_0001'
8009
8465
  }));
8010
8466
  }
@@ -8027,7 +8483,7 @@ function useModelInfoPage (_ref) {
8027
8483
  }
8028
8484
  });
8029
8485
  } else {
8030
- LOG$3.error(new DivaError('Missing account ID or catalog', {
8486
+ LOG$3.error(new DivaError$1('Missing account ID or catalog', {
8031
8487
  code: 'SELLER_0001'
8032
8488
  }));
8033
8489
  }
@@ -8041,7 +8497,7 @@ function useModelInfoPage (_ref) {
8041
8497
  return onNavigateBack();
8042
8498
  }
8043
8499
  };
8044
- if ((!!currentAccountLoginId || organization.parentType === 'SUPPLIER') && !!catalogCodex && catalogData !== null && catalogData !== void 0 && catalogData.hasPlanner) {
8500
+ if ((!!currentAccountLoginId || organization.parentType === 'SUPPLIER' || catalogData !== null && catalogData !== void 0 && catalogData.isIDMData) && !!catalogCodex && catalogData !== null && catalogData !== void 0 && catalogData.hasPlanner) {
8045
8501
  buttons.planner = function () {
8046
8502
  return onOpenPlanner(currentAccountLoginId);
8047
8503
  };
@@ -11430,7 +11886,7 @@ function useProductState (basket, divaNr) {
11430
11886
  case 30:
11431
11887
  (_productHandler$close3 = productHandler.closeModal) === null || _productHandler$close3 === void 0 || _productHandler$close3.call(productHandler);
11432
11888
  if (originProductId) clearOriginProductId();
11433
- LOG$2.error(new DivaError("Articles cannot be saved - ClientArticleService or JWT not set"));
11889
+ LOG$2.error(new DivaError$1("Articles cannot be saved - ClientArticleService or JWT not set"));
11434
11890
  setError(t('modal.general_error') + ' ' + t('modal.errorcode') + ':' + DivaUtils.getCurrentTraceId() + ' ' + DivaUtils.formatDate(new Date(), true, undefined, true));
11435
11891
  return _context2.abrupt("return", false);
11436
11892
  case 35:
@@ -11447,7 +11903,7 @@ function useProductState (basket, divaNr) {
11447
11903
  case 43:
11448
11904
  _context2.prev = 43;
11449
11905
  _context2.t1 = _context2["catch"](2);
11450
- LOG$2.error(new DivaError("Error saving product", {
11906
+ LOG$2.error(new DivaError$1("Error saving product", {
11451
11907
  code: 'PROD_0002',
11452
11908
  cause: _context2.t1
11453
11909
  }));
@@ -11587,7 +12043,7 @@ function useProductState (basket, divaNr) {
11587
12043
  case 26:
11588
12044
  _context4.prev = 26;
11589
12045
  _context4.t1 = _context4["catch"](19);
11590
- LOG$2.error(new DivaError("Error loading affiliates", {
12046
+ LOG$2.error(new DivaError$1("Error loading affiliates", {
11591
12047
  code: 'SELLER_0002',
11592
12048
  cause: _context4.t1
11593
12049
  }));
@@ -11710,7 +12166,7 @@ function useProductState (basket, divaNr) {
11710
12166
  case 63:
11711
12167
  _context4.prev = 63;
11712
12168
  _context4.t2 = _context4["catch"](29);
11713
- LOG$2.error(new DivaError("Error initalization", {
12169
+ LOG$2.error(new DivaError$1("Error initalization", {
11714
12170
  code: 'SELLER_0002',
11715
12171
  cause: _context4.t2
11716
12172
  }));
@@ -13314,7 +13770,7 @@ var ModelAnalytics = function ModelAnalytics(_ref) {
13314
13770
  _context.next = 9;
13315
13771
  break;
13316
13772
  }
13317
- LOG$1.error(new DivaError('Missing account ID', {
13773
+ LOG$1.error(new DivaError$1('Missing account ID', {
13318
13774
  code: 'SELLER_0001'
13319
13775
  }));
13320
13776
  setLoading(false);
@@ -13442,7 +13898,7 @@ function Seller(props) {
13442
13898
  toggleLoading('SellerLoading', false, isLoading);
13443
13899
  }, [props.activeModule, error, isLoading]);
13444
13900
  if (error) {
13445
- LOG.error(new DivaError(error, {
13901
+ LOG.error(new DivaError$1(error, {
13446
13902
  code: 'SELLER_0001'
13447
13903
  }));
13448
13904
  return /*#__PURE__*/jsx("div", {