@crystaldesign/diva-archive 26.4.0-beta.3 → 26.4.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/esm/index.js
CHANGED
|
@@ -225,6 +225,7 @@ function useActions(_ref) {
|
|
|
225
225
|
openModal = _useDivaCore$actions.openModal,
|
|
226
226
|
userHasPermission = _useDivaCore$actions.userHasPermission,
|
|
227
227
|
openSnackBar = _useDivaCore$actions.openSnackBar,
|
|
228
|
+
canAccessOrganization = _useDivaCore$actions.canAccessOrganization,
|
|
228
229
|
_useDivaCore$handler = _useDivaCore.handler,
|
|
229
230
|
reportHandler = _useDivaCore$handler.reportHandler,
|
|
230
231
|
organizationHandler = _useDivaCore$handler.organizationHandler;
|
|
@@ -253,6 +254,9 @@ function useActions(_ref) {
|
|
|
253
254
|
trashed: trashed
|
|
254
255
|
}),
|
|
255
256
|
hide: function hide(item, rowId) {
|
|
257
|
+
if (item.OrganizationId && !canAccessOrganization(item.OrganizationId)) {
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
256
260
|
//irreverseble delete is visible if the user owns that basket
|
|
257
261
|
if (item.SalespersonID === (user === null || user === void 0 ? void 0 : user._id)) {
|
|
258
262
|
return false;
|
|
@@ -299,7 +303,8 @@ function useActions(_ref) {
|
|
|
299
303
|
jwt: jwt,
|
|
300
304
|
reportHandler: reportHandler,
|
|
301
305
|
user: user,
|
|
302
|
-
organizationHandler: organizationHandler
|
|
306
|
+
organizationHandler: organizationHandler,
|
|
307
|
+
canAccessOrganization: canAccessOrganization
|
|
303
308
|
})
|
|
304
309
|
};
|
|
305
310
|
});
|
|
@@ -313,7 +318,10 @@ function useActions(_ref) {
|
|
|
313
318
|
t: t,
|
|
314
319
|
trashed: trashed
|
|
315
320
|
}),
|
|
316
|
-
disabled: false
|
|
321
|
+
disabled: false,
|
|
322
|
+
hide: function hide(item) {
|
|
323
|
+
return !!item.OrganizationId && !canAccessOrganization(item.OrganizationId);
|
|
324
|
+
}
|
|
317
325
|
});
|
|
318
326
|
return gridActions;
|
|
319
327
|
}
|
|
@@ -332,14 +340,15 @@ function getAction(_ref2) {
|
|
|
332
340
|
jwt = _ref2.jwt,
|
|
333
341
|
reportHandler = _ref2.reportHandler,
|
|
334
342
|
user = _ref2.user,
|
|
335
|
-
organizationHandler = _ref2.organizationHandler
|
|
343
|
+
organizationHandler = _ref2.organizationHandler,
|
|
344
|
+
canAccessOrganization = _ref2.canAccessOrganization;
|
|
336
345
|
switch (action.type) {
|
|
337
346
|
case 'basket':
|
|
338
|
-
return openBasketAction(openComponent, organizationHandler, openModal, organization, t);
|
|
347
|
+
return openBasketAction(openComponent, organizationHandler, openModal, organization, canAccessOrganization, t);
|
|
339
348
|
case 'pdf':
|
|
340
349
|
return openPdfAction(openComponent, openSnackBar, toggleLoading, openModal, t, action, reportHandler);
|
|
341
350
|
case 'planner':
|
|
342
|
-
return openPlannerAction(openComponent, updateBreadcrumbs);
|
|
351
|
+
return openPlannerAction(openComponent, updateBreadcrumbs, openModal, organization, canAccessOrganization, t);
|
|
343
352
|
case 'sendToIwoFurn':
|
|
344
353
|
return sendToIwoFurnAction(apiConfig, jwt, toggleLoading, setReloadPage, openModal, t);
|
|
345
354
|
case 'order':
|
|
@@ -359,7 +368,7 @@ function getAction(_ref2) {
|
|
|
359
368
|
throw Error("".concat(action.type, " is not a valid action type"));
|
|
360
369
|
}
|
|
361
370
|
}
|
|
362
|
-
function openBasketAction(openComponent, organizationHandler, openModal, organization, t) {
|
|
371
|
+
function openBasketAction(openComponent, organizationHandler, openModal, organization, canAccessOrganization, t) {
|
|
363
372
|
var openInCurrentOrg = function openInCurrentOrg(item) {
|
|
364
373
|
var params = {
|
|
365
374
|
module: 'Basket',
|
|
@@ -380,25 +389,42 @@ function openBasketAction(openComponent, organizationHandler, openModal, organiz
|
|
|
380
389
|
});
|
|
381
390
|
};
|
|
382
391
|
var openInTargetOrg = function openInTargetOrg(item) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
392
|
+
if (item.OrderStatus === 'SEND') {
|
|
393
|
+
var url = window.location.origin + '/seller?lang=de' + '&organizationId=' + item.OrganizationId + '&module=Basket&divaNr=' + item.DivaNr + '&assignNewDivaNr=true';
|
|
394
|
+
openComponent({
|
|
395
|
+
url: url,
|
|
396
|
+
openInNewTab: true
|
|
397
|
+
});
|
|
398
|
+
} else {
|
|
399
|
+
var _url = window.location.origin + '/seller?lang=de' + '&organizationId=' + item.OrganizationId + '&module=Basket&divaNr=' + item.DivaNr + '&check=1';
|
|
400
|
+
openComponent({
|
|
401
|
+
url: _url,
|
|
402
|
+
openInNewTab: true
|
|
403
|
+
});
|
|
404
|
+
}
|
|
388
405
|
};
|
|
389
406
|
return /*#__PURE__*/function () {
|
|
390
407
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
391
|
-
var modaltitle;
|
|
408
|
+
var _organization$type, _organization$type$to, modaltitle, hasAccessToTargetOrg, organizationType, isWrapperLikeOrganization;
|
|
392
409
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
393
410
|
while (1) switch (_context.prev = _context.next) {
|
|
394
411
|
case 0:
|
|
395
412
|
if (!(item.OrganizationId && item.OrganizationId !== organization._id)) {
|
|
396
|
-
_context.next =
|
|
413
|
+
_context.next = 10;
|
|
397
414
|
break;
|
|
398
415
|
}
|
|
399
416
|
modaltitle = t('action.archive.edit.cannotopen');
|
|
400
|
-
|
|
401
|
-
|
|
417
|
+
hasAccessToTargetOrg = canAccessOrganization(item.OrganizationId);
|
|
418
|
+
if (hasAccessToTargetOrg) {
|
|
419
|
+
_context.next = 5;
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
return _context.abrupt("return", openInCurrentOrg(item));
|
|
423
|
+
case 5:
|
|
424
|
+
organizationType = organization === null || organization === void 0 || (_organization$type = organization.type) === null || _organization$type === void 0 || (_organization$type$to = _organization$type.toUpperCase) === null || _organization$type$to === void 0 ? void 0 : _organization$type$to.call(_organization$type);
|
|
425
|
+
isWrapperLikeOrganization = !(organization !== null && organization !== void 0 && organization.type) && !(organization !== null && organization !== void 0 && organization.parentType) || organizationType === 'SUPPLIER' || organizationType === 'SUPLIER';
|
|
426
|
+
if (!isWrapperLikeOrganization) {
|
|
427
|
+
_context.next = 9;
|
|
402
428
|
break;
|
|
403
429
|
}
|
|
404
430
|
return _context.abrupt("return", openModal({
|
|
@@ -414,7 +440,7 @@ function openBasketAction(openComponent, organizationHandler, openModal, organiz
|
|
|
414
440
|
}
|
|
415
441
|
}
|
|
416
442
|
}));
|
|
417
|
-
case
|
|
443
|
+
case 9:
|
|
418
444
|
return _context.abrupt("return", openModal({
|
|
419
445
|
title: modaltitle,
|
|
420
446
|
rejectByIcon: true,
|
|
@@ -441,9 +467,9 @@ function openBasketAction(openComponent, organizationHandler, openModal, organiz
|
|
|
441
467
|
}
|
|
442
468
|
}
|
|
443
469
|
}));
|
|
444
|
-
case
|
|
470
|
+
case 10:
|
|
445
471
|
return _context.abrupt("return", openInCurrentOrg(item));
|
|
446
|
-
case
|
|
472
|
+
case 11:
|
|
447
473
|
case "end":
|
|
448
474
|
return _context.stop();
|
|
449
475
|
}
|
|
@@ -510,8 +536,8 @@ function openPdfAction(openComponent, openSnackBar, toggleLoading, openModal, t,
|
|
|
510
536
|
}
|
|
511
537
|
};
|
|
512
538
|
}
|
|
513
|
-
function openPlannerAction(openComponent, updateBreadcrumbs) {
|
|
514
|
-
|
|
539
|
+
function openPlannerAction(openComponent, updateBreadcrumbs, openModal, organization, canAccessOrganization, t) {
|
|
540
|
+
var openInCurrentOrg = function openInCurrentOrg(item) {
|
|
515
541
|
updateBreadcrumbs({
|
|
516
542
|
type: 'replace',
|
|
517
543
|
groupId: 'ARCHIVE',
|
|
@@ -550,6 +576,88 @@ function openPlannerAction(openComponent, updateBreadcrumbs) {
|
|
|
550
576
|
});
|
|
551
577
|
}
|
|
552
578
|
};
|
|
579
|
+
var openInTargetOrg = function openInTargetOrg(item) {
|
|
580
|
+
var url = window.location.origin + '/planner?lang=de' + '&organizationId=' + item.OrganizationId + '&divaNr=' + item.DivaNr + '&assignNewDivaNr=' + (item.OrderStatus === 'SEND' ? 'true' : 'false');
|
|
581
|
+
openComponent({
|
|
582
|
+
url: url
|
|
583
|
+
});
|
|
584
|
+
};
|
|
585
|
+
return /*#__PURE__*/function () {
|
|
586
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(item) {
|
|
587
|
+
var _organization$type2, _organization$type2$t, modalTitle, hasAccessToTargetOrg, organizationType, isWrapperLikeOrganization;
|
|
588
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
589
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
590
|
+
case 0:
|
|
591
|
+
if (!(item.OrganizationId && item.OrganizationId !== organization._id)) {
|
|
592
|
+
_context2.next = 10;
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
modalTitle = t('action.archive.edit.cannotopen');
|
|
596
|
+
hasAccessToTargetOrg = canAccessOrganization(item.OrganizationId);
|
|
597
|
+
if (hasAccessToTargetOrg) {
|
|
598
|
+
_context2.next = 5;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
return _context2.abrupt("return", openInCurrentOrg(item));
|
|
602
|
+
case 5:
|
|
603
|
+
organizationType = organization === null || organization === void 0 || (_organization$type2 = organization.type) === null || _organization$type2 === void 0 || (_organization$type2$t = _organization$type2.toUpperCase) === null || _organization$type2$t === void 0 ? void 0 : _organization$type2$t.call(_organization$type2);
|
|
604
|
+
isWrapperLikeOrganization = !(organization !== null && organization !== void 0 && organization.type) && !(organization !== null && organization !== void 0 && organization.parentType) || organizationType === 'SUPPLIER' || organizationType === 'SUPLIER';
|
|
605
|
+
if (!isWrapperLikeOrganization) {
|
|
606
|
+
_context2.next = 9;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
return _context2.abrupt("return", openModal({
|
|
610
|
+
title: modalTitle,
|
|
611
|
+
text: t('action.archive.edit.otherorganizationdetail', {
|
|
612
|
+
suborganization: item === null || item === void 0 ? void 0 : item.OrganizationId_displayText
|
|
613
|
+
}),
|
|
614
|
+
reject: true,
|
|
615
|
+
accept: true,
|
|
616
|
+
callback: function callback(accept) {
|
|
617
|
+
if (accept) {
|
|
618
|
+
openInTargetOrg(item);
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}));
|
|
622
|
+
case 9:
|
|
623
|
+
return _context2.abrupt("return", openModal({
|
|
624
|
+
title: modalTitle,
|
|
625
|
+
rejectByIcon: true,
|
|
626
|
+
text: t('action.archive.edit.otherorganizationdetail', {
|
|
627
|
+
suborganization: item === null || item === void 0 ? void 0 : item.OrganizationId_displayText
|
|
628
|
+
}),
|
|
629
|
+
actions: [{
|
|
630
|
+
text: t('action.archive.edit.openincurrentorg'),
|
|
631
|
+
id: 'currentOrg',
|
|
632
|
+
variant: 'outlined',
|
|
633
|
+
closeable: true
|
|
634
|
+
}, {
|
|
635
|
+
text: t('action.archive.edit.openintargetorg', {
|
|
636
|
+
suborganization: item === null || item === void 0 ? void 0 : item.OrganizationId_displayText
|
|
637
|
+
}),
|
|
638
|
+
id: 'targetOrg',
|
|
639
|
+
variant: 'contained'
|
|
640
|
+
}],
|
|
641
|
+
callback: function callback(result) {
|
|
642
|
+
if (result === 'currentOrg') {
|
|
643
|
+
openInCurrentOrg(item);
|
|
644
|
+
} else if (result === 'targetOrg') {
|
|
645
|
+
openInTargetOrg(item);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
}));
|
|
649
|
+
case 10:
|
|
650
|
+
return _context2.abrupt("return", openInCurrentOrg(item));
|
|
651
|
+
case 11:
|
|
652
|
+
case "end":
|
|
653
|
+
return _context2.stop();
|
|
654
|
+
}
|
|
655
|
+
}, _callee2);
|
|
656
|
+
}));
|
|
657
|
+
return function (_x2) {
|
|
658
|
+
return _ref4.apply(this, arguments);
|
|
659
|
+
};
|
|
660
|
+
}();
|
|
553
661
|
}
|
|
554
662
|
function openEmailAction(sendEmail, t, action, organization, user) {
|
|
555
663
|
return function (item) {
|
|
@@ -565,15 +673,15 @@ function openEmailAction(sendEmail, t, action, organization, user) {
|
|
|
565
673
|
}
|
|
566
674
|
function sendToIwoFurnAction(apiConfig, jwt, toggleLoading, setReloadPage, openModal, t) {
|
|
567
675
|
return /*#__PURE__*/function () {
|
|
568
|
-
var
|
|
676
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(item) {
|
|
569
677
|
var result;
|
|
570
|
-
return _regeneratorRuntime.wrap(function
|
|
571
|
-
while (1) switch (
|
|
678
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
679
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
572
680
|
case 0:
|
|
573
|
-
|
|
681
|
+
_context3.next = 2;
|
|
574
682
|
return sendToIwofurn(apiConfig, jwt, item.DivaNr, Number(item.DocumentVersion), toggleLoading);
|
|
575
683
|
case 2:
|
|
576
|
-
result =
|
|
684
|
+
result = _context3.sent;
|
|
577
685
|
if (result === true) {
|
|
578
686
|
openModal({
|
|
579
687
|
accept: true,
|
|
@@ -592,34 +700,34 @@ function sendToIwoFurnAction(apiConfig, jwt, toggleLoading, setReloadPage, openM
|
|
|
592
700
|
}
|
|
593
701
|
case 4:
|
|
594
702
|
case "end":
|
|
595
|
-
return
|
|
703
|
+
return _context3.stop();
|
|
596
704
|
}
|
|
597
|
-
},
|
|
705
|
+
}, _callee3);
|
|
598
706
|
}));
|
|
599
|
-
return function (
|
|
600
|
-
return
|
|
707
|
+
return function (_x3) {
|
|
708
|
+
return _ref5.apply(this, arguments);
|
|
601
709
|
};
|
|
602
710
|
}();
|
|
603
711
|
}
|
|
604
|
-
function placeOrderAction(
|
|
605
|
-
var apiConfig =
|
|
606
|
-
jwt =
|
|
607
|
-
organization =
|
|
608
|
-
sendEmail =
|
|
609
|
-
openModal =
|
|
610
|
-
t =
|
|
611
|
-
action =
|
|
612
|
-
setReloadPage =
|
|
712
|
+
function placeOrderAction(_ref6) {
|
|
713
|
+
var apiConfig = _ref6.apiConfig,
|
|
714
|
+
jwt = _ref6.jwt,
|
|
715
|
+
organization = _ref6.organization,
|
|
716
|
+
sendEmail = _ref6.sendEmail,
|
|
717
|
+
openModal = _ref6.openModal,
|
|
718
|
+
t = _ref6.t,
|
|
719
|
+
action = _ref6.action,
|
|
720
|
+
setReloadPage = _ref6.setReloadPage;
|
|
613
721
|
return /*#__PURE__*/function () {
|
|
614
|
-
var
|
|
615
|
-
return _regeneratorRuntime.wrap(function
|
|
616
|
-
while (1) switch (
|
|
722
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(item, id, updateOne) {
|
|
723
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
724
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
617
725
|
case 0:
|
|
618
726
|
if (jwt) {
|
|
619
|
-
|
|
727
|
+
_context5.next = 2;
|
|
620
728
|
break;
|
|
621
729
|
}
|
|
622
|
-
return
|
|
730
|
+
return _context5.abrupt("return");
|
|
623
731
|
case 2:
|
|
624
732
|
triggerSendEmail({
|
|
625
733
|
sendEmail: sendEmail,
|
|
@@ -628,12 +736,12 @@ function placeOrderAction(_ref5) {
|
|
|
628
736
|
action: action,
|
|
629
737
|
item: item,
|
|
630
738
|
callback: function () {
|
|
631
|
-
var _callback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
632
|
-
return _regeneratorRuntime.wrap(function
|
|
633
|
-
while (1) switch (
|
|
739
|
+
var _callback = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(success) {
|
|
740
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
741
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
634
742
|
case 0:
|
|
635
743
|
if (!(success == 'SUCCESS')) {
|
|
636
|
-
|
|
744
|
+
_context4.next = 7;
|
|
637
745
|
break;
|
|
638
746
|
}
|
|
639
747
|
openModal({
|
|
@@ -643,13 +751,13 @@ function placeOrderAction(_ref5) {
|
|
|
643
751
|
return setReloadPage(1);
|
|
644
752
|
}
|
|
645
753
|
});
|
|
646
|
-
|
|
754
|
+
_context4.next = 4;
|
|
647
755
|
return setOrdered(apiConfig, item.OrganizationId, jwt, item.DivaNr, parseInt(item.DocumentVersion));
|
|
648
756
|
case 4:
|
|
649
757
|
updateOne(_objectSpread$2(_objectSpread$2({}, item), {}, {
|
|
650
758
|
OrderStatus: 'SEND'
|
|
651
759
|
}));
|
|
652
|
-
|
|
760
|
+
_context4.next = 8;
|
|
653
761
|
break;
|
|
654
762
|
case 7:
|
|
655
763
|
openModal({
|
|
@@ -659,11 +767,11 @@ function placeOrderAction(_ref5) {
|
|
|
659
767
|
});
|
|
660
768
|
case 8:
|
|
661
769
|
case "end":
|
|
662
|
-
return
|
|
770
|
+
return _context4.stop();
|
|
663
771
|
}
|
|
664
|
-
},
|
|
772
|
+
}, _callee4);
|
|
665
773
|
}));
|
|
666
|
-
function callback(
|
|
774
|
+
function callback(_x7) {
|
|
667
775
|
return _callback.apply(this, arguments);
|
|
668
776
|
}
|
|
669
777
|
return callback;
|
|
@@ -671,56 +779,56 @@ function placeOrderAction(_ref5) {
|
|
|
671
779
|
});
|
|
672
780
|
case 3:
|
|
673
781
|
case "end":
|
|
674
|
-
return
|
|
782
|
+
return _context5.stop();
|
|
675
783
|
}
|
|
676
|
-
},
|
|
784
|
+
}, _callee5);
|
|
677
785
|
}));
|
|
678
|
-
return function (
|
|
679
|
-
return
|
|
786
|
+
return function (_x4, _x5, _x6) {
|
|
787
|
+
return _ref7.apply(this, arguments);
|
|
680
788
|
};
|
|
681
789
|
}();
|
|
682
790
|
}
|
|
683
|
-
function setArchivedAction(
|
|
684
|
-
var apiConfig =
|
|
685
|
-
jwt =
|
|
686
|
-
openModal =
|
|
687
|
-
t =
|
|
688
|
-
trashed =
|
|
791
|
+
function setArchivedAction(_ref8) {
|
|
792
|
+
var apiConfig = _ref8.apiConfig,
|
|
793
|
+
jwt = _ref8.jwt,
|
|
794
|
+
openModal = _ref8.openModal,
|
|
795
|
+
t = _ref8.t,
|
|
796
|
+
trashed = _ref8.trashed;
|
|
689
797
|
return /*#__PURE__*/function () {
|
|
690
|
-
var
|
|
691
|
-
return _regeneratorRuntime.wrap(function
|
|
692
|
-
while (1) switch (
|
|
798
|
+
var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(item, id, updateOne, deleteOne) {
|
|
799
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
800
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
693
801
|
case 0:
|
|
694
802
|
if (jwt) {
|
|
695
|
-
|
|
803
|
+
_context7.next = 2;
|
|
696
804
|
break;
|
|
697
805
|
}
|
|
698
|
-
return
|
|
806
|
+
return _context7.abrupt("return");
|
|
699
807
|
case 2:
|
|
700
808
|
openModal({
|
|
701
809
|
accept: true,
|
|
702
810
|
reject: true,
|
|
703
811
|
title: t(trashed ? 'order.restore' : 'order.delete'),
|
|
704
812
|
callback: function () {
|
|
705
|
-
var _callback2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
706
|
-
return _regeneratorRuntime.wrap(function
|
|
707
|
-
while (1) switch (
|
|
813
|
+
var _callback2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(accepted) {
|
|
814
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
815
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
708
816
|
case 0:
|
|
709
817
|
if (!accepted) {
|
|
710
|
-
|
|
818
|
+
_context6.next = 4;
|
|
711
819
|
break;
|
|
712
820
|
}
|
|
713
|
-
|
|
821
|
+
_context6.next = 3;
|
|
714
822
|
return setArchived(apiConfig, jwt, item.DivaNr, !trashed);
|
|
715
823
|
case 3:
|
|
716
824
|
deleteOne();
|
|
717
825
|
case 4:
|
|
718
826
|
case "end":
|
|
719
|
-
return
|
|
827
|
+
return _context6.stop();
|
|
720
828
|
}
|
|
721
|
-
},
|
|
829
|
+
}, _callee6);
|
|
722
830
|
}));
|
|
723
|
-
function callback(
|
|
831
|
+
function callback(_x12) {
|
|
724
832
|
return _callback2.apply(this, arguments);
|
|
725
833
|
}
|
|
726
834
|
return callback;
|
|
@@ -728,31 +836,31 @@ function setArchivedAction(_ref7) {
|
|
|
728
836
|
});
|
|
729
837
|
case 3:
|
|
730
838
|
case "end":
|
|
731
|
-
return
|
|
839
|
+
return _context7.stop();
|
|
732
840
|
}
|
|
733
|
-
},
|
|
841
|
+
}, _callee7);
|
|
734
842
|
}));
|
|
735
|
-
return function (
|
|
736
|
-
return
|
|
843
|
+
return function (_x8, _x9, _x10, _x11) {
|
|
844
|
+
return _ref9.apply(this, arguments);
|
|
737
845
|
};
|
|
738
846
|
}();
|
|
739
847
|
}
|
|
740
|
-
function deleteAction(
|
|
741
|
-
var apiConfig =
|
|
742
|
-
jwt =
|
|
743
|
-
openModal =
|
|
744
|
-
t =
|
|
745
|
-
trashed =
|
|
848
|
+
function deleteAction(_ref10) {
|
|
849
|
+
var apiConfig = _ref10.apiConfig,
|
|
850
|
+
jwt = _ref10.jwt,
|
|
851
|
+
openModal = _ref10.openModal,
|
|
852
|
+
t = _ref10.t,
|
|
853
|
+
trashed = _ref10.trashed;
|
|
746
854
|
return /*#__PURE__*/function () {
|
|
747
|
-
var
|
|
748
|
-
return _regeneratorRuntime.wrap(function
|
|
749
|
-
while (1) switch (
|
|
855
|
+
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(item, id, updateOne, deleteOne) {
|
|
856
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
857
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
750
858
|
case 0:
|
|
751
859
|
if (jwt) {
|
|
752
|
-
|
|
860
|
+
_context9.next = 2;
|
|
753
861
|
break;
|
|
754
862
|
}
|
|
755
|
-
return
|
|
863
|
+
return _context9.abrupt("return");
|
|
756
864
|
case 2:
|
|
757
865
|
openModal({
|
|
758
866
|
accept: true,
|
|
@@ -761,25 +869,25 @@ function deleteAction(_ref9) {
|
|
|
761
869
|
divaNr: item.DivaNr
|
|
762
870
|
}),
|
|
763
871
|
callback: function () {
|
|
764
|
-
var _callback3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
765
|
-
return _regeneratorRuntime.wrap(function
|
|
766
|
-
while (1) switch (
|
|
872
|
+
var _callback3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(accepted) {
|
|
873
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
874
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
767
875
|
case 0:
|
|
768
876
|
if (!accepted) {
|
|
769
|
-
|
|
877
|
+
_context8.next = 4;
|
|
770
878
|
break;
|
|
771
879
|
}
|
|
772
|
-
|
|
880
|
+
_context8.next = 3;
|
|
773
881
|
return deleteBasket(apiConfig, jwt, item.DivaNr, !trashed);
|
|
774
882
|
case 3:
|
|
775
883
|
deleteOne();
|
|
776
884
|
case 4:
|
|
777
885
|
case "end":
|
|
778
|
-
return
|
|
886
|
+
return _context8.stop();
|
|
779
887
|
}
|
|
780
|
-
},
|
|
888
|
+
}, _callee8);
|
|
781
889
|
}));
|
|
782
|
-
function callback(
|
|
890
|
+
function callback(_x17) {
|
|
783
891
|
return _callback3.apply(this, arguments);
|
|
784
892
|
}
|
|
785
893
|
return callback;
|
|
@@ -787,23 +895,23 @@ function deleteAction(_ref9) {
|
|
|
787
895
|
});
|
|
788
896
|
case 3:
|
|
789
897
|
case "end":
|
|
790
|
-
return
|
|
898
|
+
return _context9.stop();
|
|
791
899
|
}
|
|
792
|
-
},
|
|
900
|
+
}, _callee9);
|
|
793
901
|
}));
|
|
794
|
-
return function (
|
|
795
|
-
return
|
|
902
|
+
return function (_x13, _x14, _x15, _x16) {
|
|
903
|
+
return _ref11.apply(this, arguments);
|
|
796
904
|
};
|
|
797
905
|
}();
|
|
798
906
|
}
|
|
799
|
-
function triggerSendEmail(
|
|
800
|
-
var sendEmail =
|
|
801
|
-
|
|
802
|
-
var action =
|
|
803
|
-
|
|
804
|
-
user =
|
|
805
|
-
item =
|
|
806
|
-
callback =
|
|
907
|
+
function triggerSendEmail(_ref12) {
|
|
908
|
+
var sendEmail = _ref12.sendEmail;
|
|
909
|
+
_ref12.t;
|
|
910
|
+
var action = _ref12.action;
|
|
911
|
+
_ref12.organization;
|
|
912
|
+
var user = _ref12.user,
|
|
913
|
+
item = _ref12.item,
|
|
914
|
+
callback = _ref12.callback;
|
|
807
915
|
var to;
|
|
808
916
|
try {
|
|
809
917
|
var _action$to;
|
|
@@ -817,8 +925,6 @@ function triggerSendEmail(_ref11) {
|
|
|
817
925
|
return getMailAddress(item.ClientEmail, required);
|
|
818
926
|
} else if (mail == 'SELLER') {
|
|
819
927
|
return getMailAddress(item.SalespersonEmail, required);
|
|
820
|
-
} else if (mail == 'ORGANIZATION') {
|
|
821
|
-
return getMailAddress(organization === null || organization === void 0 ? void 0 : organization.email, required);
|
|
822
928
|
} else if (mail == 'USER') {
|
|
823
929
|
return getMailAddress(user === null || user === void 0 ? void 0 : user.mainEmail, required);
|
|
824
930
|
} else {
|
|
@@ -859,17 +965,17 @@ function getMailAddress(string, required) {
|
|
|
859
965
|
}
|
|
860
966
|
throw new Error('Required mail address is missing');
|
|
861
967
|
}
|
|
862
|
-
function sendToIwofurn(
|
|
968
|
+
function sendToIwofurn(_x18, _x19, _x20, _x21, _x22) {
|
|
863
969
|
return _sendToIwofurn.apply(this, arguments);
|
|
864
970
|
}
|
|
865
971
|
function _sendToIwofurn() {
|
|
866
|
-
_sendToIwofurn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
972
|
+
_sendToIwofurn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(apiConfig, jwt, divaNr, version, toggleLoading) {
|
|
867
973
|
var result;
|
|
868
|
-
return _regeneratorRuntime.wrap(function
|
|
869
|
-
while (1) switch (
|
|
974
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
975
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
870
976
|
case 0:
|
|
871
977
|
toggleLoading('iwofurn');
|
|
872
|
-
|
|
978
|
+
_context10.next = 3;
|
|
873
979
|
return fetch("".concat(apiConfig.basketService, "/iwofurn/send?divaNr=").concat(divaNr, "&version=").concat(version), {
|
|
874
980
|
method: 'POST',
|
|
875
981
|
body: undefined,
|
|
@@ -881,38 +987,38 @@ function _sendToIwofurn() {
|
|
|
881
987
|
return r.json();
|
|
882
988
|
});
|
|
883
989
|
case 3:
|
|
884
|
-
result =
|
|
990
|
+
result = _context10.sent;
|
|
885
991
|
toggleLoading('iwofurn');
|
|
886
992
|
if (!(result.result !== 'Success')) {
|
|
887
|
-
|
|
993
|
+
_context10.next = 7;
|
|
888
994
|
break;
|
|
889
995
|
}
|
|
890
|
-
return
|
|
996
|
+
return _context10.abrupt("return", result.error);
|
|
891
997
|
case 7:
|
|
892
|
-
return
|
|
998
|
+
return _context10.abrupt("return", true);
|
|
893
999
|
case 8:
|
|
894
1000
|
case "end":
|
|
895
|
-
return
|
|
1001
|
+
return _context10.stop();
|
|
896
1002
|
}
|
|
897
|
-
},
|
|
1003
|
+
}, _callee10);
|
|
898
1004
|
}));
|
|
899
1005
|
return _sendToIwofurn.apply(this, arguments);
|
|
900
1006
|
}
|
|
901
|
-
function setOrdered(
|
|
1007
|
+
function setOrdered(_x23, _x24, _x25, _x26, _x27) {
|
|
902
1008
|
return _setOrdered.apply(this, arguments);
|
|
903
1009
|
}
|
|
904
1010
|
function _setOrdered() {
|
|
905
|
-
_setOrdered = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1011
|
+
_setOrdered = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(apiConfig, organizationId, jwt, divaNr, documentVersion) {
|
|
906
1012
|
var body;
|
|
907
|
-
return _regeneratorRuntime.wrap(function
|
|
908
|
-
while (1) switch (
|
|
1013
|
+
return _regeneratorRuntime.wrap(function _callee11$(_context11) {
|
|
1014
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
909
1015
|
case 0:
|
|
910
|
-
|
|
1016
|
+
_context11.prev = 0;
|
|
911
1017
|
body = {
|
|
912
1018
|
divaNr: divaNr,
|
|
913
1019
|
version: documentVersion
|
|
914
1020
|
};
|
|
915
|
-
|
|
1021
|
+
_context11.next = 4;
|
|
916
1022
|
return fetch("".concat(apiConfig.basketService, "/orders?organizationId=").concat(organizationId), {
|
|
917
1023
|
method: 'POST',
|
|
918
1024
|
headers: {
|
|
@@ -924,33 +1030,33 @@ function _setOrdered() {
|
|
|
924
1030
|
return r.json();
|
|
925
1031
|
});
|
|
926
1032
|
case 4:
|
|
927
|
-
|
|
1033
|
+
_context11.next = 10;
|
|
928
1034
|
break;
|
|
929
1035
|
case 6:
|
|
930
|
-
|
|
931
|
-
|
|
1036
|
+
_context11.prev = 6;
|
|
1037
|
+
_context11.t0 = _context11["catch"](0);
|
|
932
1038
|
LOG.error(new DivaError('Could not set OrderStatus', {
|
|
933
|
-
cause:
|
|
1039
|
+
cause: _context11.t0
|
|
934
1040
|
}));
|
|
935
1041
|
throw new Error('DivaNr not found');
|
|
936
1042
|
case 10:
|
|
937
1043
|
case "end":
|
|
938
|
-
return
|
|
1044
|
+
return _context11.stop();
|
|
939
1045
|
}
|
|
940
|
-
},
|
|
1046
|
+
}, _callee11, null, [[0, 6]]);
|
|
941
1047
|
}));
|
|
942
1048
|
return _setOrdered.apply(this, arguments);
|
|
943
1049
|
}
|
|
944
|
-
function setArchived(
|
|
1050
|
+
function setArchived(_x28, _x29, _x30, _x31) {
|
|
945
1051
|
return _setArchived.apply(this, arguments);
|
|
946
1052
|
}
|
|
947
1053
|
function _setArchived() {
|
|
948
|
-
_setArchived = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1054
|
+
_setArchived = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12(apiConfig, jwt, divaNr, archived) {
|
|
949
1055
|
var result;
|
|
950
|
-
return _regeneratorRuntime.wrap(function
|
|
951
|
-
while (1) switch (
|
|
1056
|
+
return _regeneratorRuntime.wrap(function _callee12$(_context12) {
|
|
1057
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
952
1058
|
case 0:
|
|
953
|
-
|
|
1059
|
+
_context12.next = 2;
|
|
954
1060
|
return fetch("".concat(apiConfig.basketService, "/baskets/") + divaNr + (archived ? '/archive' : '/restore'), {
|
|
955
1061
|
method: archived ? 'DELETE' : 'PATCH',
|
|
956
1062
|
headers: {
|
|
@@ -961,32 +1067,32 @@ function _setArchived() {
|
|
|
961
1067
|
return r.json();
|
|
962
1068
|
});
|
|
963
1069
|
case 2:
|
|
964
|
-
result =
|
|
1070
|
+
result = _context12.sent;
|
|
965
1071
|
if (!result) {
|
|
966
|
-
|
|
1072
|
+
_context12.next = 5;
|
|
967
1073
|
break;
|
|
968
1074
|
}
|
|
969
|
-
return
|
|
1075
|
+
return _context12.abrupt("return", result);
|
|
970
1076
|
case 5:
|
|
971
1077
|
throw new Error('DivaNr not found.');
|
|
972
1078
|
case 6:
|
|
973
1079
|
case "end":
|
|
974
|
-
return
|
|
1080
|
+
return _context12.stop();
|
|
975
1081
|
}
|
|
976
|
-
},
|
|
1082
|
+
}, _callee12);
|
|
977
1083
|
}));
|
|
978
1084
|
return _setArchived.apply(this, arguments);
|
|
979
1085
|
}
|
|
980
|
-
function deleteBasket(
|
|
1086
|
+
function deleteBasket(_x32, _x33, _x34, _x35) {
|
|
981
1087
|
return _deleteBasket.apply(this, arguments);
|
|
982
1088
|
}
|
|
983
1089
|
function _deleteBasket() {
|
|
984
|
-
_deleteBasket = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function
|
|
1090
|
+
_deleteBasket = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(apiConfig, jwt, divaNr, archived) {
|
|
985
1091
|
var result;
|
|
986
|
-
return _regeneratorRuntime.wrap(function
|
|
987
|
-
while (1) switch (
|
|
1092
|
+
return _regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
1093
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
988
1094
|
case 0:
|
|
989
|
-
|
|
1095
|
+
_context13.next = 2;
|
|
990
1096
|
return fetch("".concat(apiConfig.basketService, "/baskets/") + divaNr, {
|
|
991
1097
|
method: 'DELETE',
|
|
992
1098
|
headers: {
|
|
@@ -997,19 +1103,19 @@ function _deleteBasket() {
|
|
|
997
1103
|
return r.json();
|
|
998
1104
|
});
|
|
999
1105
|
case 2:
|
|
1000
|
-
result =
|
|
1106
|
+
result = _context13.sent;
|
|
1001
1107
|
if (!result) {
|
|
1002
|
-
|
|
1108
|
+
_context13.next = 5;
|
|
1003
1109
|
break;
|
|
1004
1110
|
}
|
|
1005
|
-
return
|
|
1111
|
+
return _context13.abrupt("return", result);
|
|
1006
1112
|
case 5:
|
|
1007
1113
|
throw new Error('DivaNr not found.');
|
|
1008
1114
|
case 6:
|
|
1009
1115
|
case "end":
|
|
1010
|
-
return
|
|
1116
|
+
return _context13.stop();
|
|
1011
1117
|
}
|
|
1012
|
-
},
|
|
1118
|
+
}, _callee13);
|
|
1013
1119
|
}));
|
|
1014
1120
|
return _deleteBasket.apply(this, arguments);
|
|
1015
1121
|
}
|
|
@@ -1100,8 +1206,8 @@ function useArchive(_ref) {
|
|
|
1100
1206
|
if (!config.prefilter || config.prefilter.hideBaseConfiguration) {
|
|
1101
1207
|
prefilterRaw.push({
|
|
1102
1208
|
field: 'Status',
|
|
1103
|
-
value: '
|
|
1104
|
-
operator: '
|
|
1209
|
+
value: ['LEAFLET', 'OFFER', 'ORDER', 'CAMPAIGN'],
|
|
1210
|
+
operator: 'in'
|
|
1105
1211
|
});
|
|
1106
1212
|
}
|
|
1107
1213
|
addMandatoryFields(configOptions, hirarchy);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActions.d.ts","sourceRoot":"","sources":["../../../../src/useActions.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAiB,WAAW,EAAE,aAAa,EAA0B,MAAM,SAAS,CAAC;AAI5F,UAAU,KAAK;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CAC7D;AAID,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"useActions.d.ts","sourceRoot":"","sources":["../../../../src/useActions.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAiB,WAAW,EAAE,aAAa,EAA0B,MAAM,SAAS,CAAC;AAI5F,UAAU,KAAK;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CAC7D;AAID,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,KAAK,iEAiF3E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/diva-archive",
|
|
3
|
-
"version": "26.4.0-beta.
|
|
3
|
+
"version": "26.4.0-beta.30",
|
|
4
4
|
"license": "COMMERCIAL",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@testing-library/jest-dom": "^6.5.0",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"react-dom": "^18.3.1"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@crystaldesign/grid": "26.4.0-beta.
|
|
18
|
+
"@crystaldesign/grid": "26.4.0-beta.30",
|
|
19
19
|
"flat": "^5.0.2"
|
|
20
20
|
},
|
|
21
21
|
"module": "build/esm/index.js",
|
|
22
22
|
"types": "./build/types/archive/src/index.d.ts",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "ab5b273e886bdaa870abf1f74a2df0c481eda8b6"
|
|
24
24
|
}
|