@crystaldesign/diva-core 26.12.0-beta.31 → 26.12.0-beta.33

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.
@@ -43,7 +43,7 @@ import HelpOutline from '@mui/icons-material/HelpOutline';
43
43
  import { actions } from '@storybook/addon-actions';
44
44
 
45
45
  (function() {
46
- const env = {"STAGE":"production","VERSION":"26.12.0-beta.31"};
46
+ const env = {"STAGE":"production","VERSION":"26.12.0-beta.33"};
47
47
  try {
48
48
  if (process) {
49
49
  process.env = Object.assign({}, process.env);
@@ -6319,6 +6319,8 @@ function initCookieBot(cbid, onConsentReady, onCookieBotError) {
6319
6319
  }, COOKIEBOT_LOAD_TIMEOUT_MS);
6320
6320
  }
6321
6321
 
6322
+ /** Ref ids one `getMediaItemRefsByIds` request names, so the URL stays well below the usual length limits. */
6323
+ var MEDIA_ITEM_REF_CHUNK_SIZE = 100;
6322
6324
  var MediaHandler = /*#__PURE__*/function () {
6323
6325
  function MediaHandler(root) {
6324
6326
  _classCallCheck(this, MediaHandler);
@@ -6466,18 +6468,79 @@ var MediaHandler = /*#__PURE__*/function () {
6466
6468
  return _getMediaItemByRefId.apply(this, arguments);
6467
6469
  }
6468
6470
  return getMediaItemByRefId;
6469
- }() /** Fetches the MediaItemRef document by ref id (not the parent media item). */
6471
+ }()
6472
+ /**
6473
+ * Fetches the MediaItemRef documents of many ref ids with one request per 100 ids, instead of one request per id.
6474
+ * The list endpoint answers 20 documents unless told otherwise, so each request asks for as many as it names.
6475
+ */
6470
6476
  }, {
6471
- key: "getMediaItemRefById",
6477
+ key: "getMediaItemRefsByIds",
6472
6478
  value: (function () {
6473
- var _getMediaItemRefById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id) {
6474
- var fullUrl, res, resData;
6479
+ var _getMediaItemRefsByIds = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(ids) {
6480
+ var refs, i, _resData$data, chunk, params, res, resData;
6475
6481
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
6476
6482
  while (1) switch (_context4.prev = _context4.next) {
6483
+ case 0:
6484
+ refs = [];
6485
+ i = 0;
6486
+ case 2:
6487
+ if (!(i < ids.length)) {
6488
+ _context4.next = 17;
6489
+ break;
6490
+ }
6491
+ chunk = ids.slice(i, i + MEDIA_ITEM_REF_CHUNK_SIZE);
6492
+ params = new URLSearchParams({
6493
+ filter: "[{_id,in,".concat(chunk.join(','), "}]"),
6494
+ limit: String(chunk.length)
6495
+ });
6496
+ _context4.next = 7;
6497
+ return fetch("".concat(this.mediaService, "/v1/mediaitems/refs?").concat(params.toString()), {
6498
+ headers: {
6499
+ Authorization: 'Bearer ' + this.jwt,
6500
+ 'Content-Type': 'application/json'
6501
+ }
6502
+ });
6503
+ case 7:
6504
+ res = _context4.sent;
6505
+ _context4.next = 10;
6506
+ return res.json();
6507
+ case 10:
6508
+ resData = _context4.sent;
6509
+ if (res.ok) {
6510
+ _context4.next = 13;
6511
+ break;
6512
+ }
6513
+ throw new Error(resData.error || 'Could not fetch mediaItemRefs');
6514
+ case 13:
6515
+ refs.push.apply(refs, _toConsumableArray((_resData$data = resData.data) !== null && _resData$data !== void 0 ? _resData$data : []));
6516
+ case 14:
6517
+ i += MEDIA_ITEM_REF_CHUNK_SIZE;
6518
+ _context4.next = 2;
6519
+ break;
6520
+ case 17:
6521
+ return _context4.abrupt("return", refs);
6522
+ case 18:
6523
+ case "end":
6524
+ return _context4.stop();
6525
+ }
6526
+ }, _callee4, this);
6527
+ }));
6528
+ function getMediaItemRefsByIds(_x4) {
6529
+ return _getMediaItemRefsByIds.apply(this, arguments);
6530
+ }
6531
+ return getMediaItemRefsByIds;
6532
+ }() /** Fetches the MediaItemRef document by ref id (not the parent media item). */)
6533
+ }, {
6534
+ key: "getMediaItemRefById",
6535
+ value: (function () {
6536
+ var _getMediaItemRefById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id) {
6537
+ var fullUrl, res, resData;
6538
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
6539
+ while (1) switch (_context5.prev = _context5.next) {
6477
6540
  case 0:
6478
6541
  fullUrl = this.mediaService + '/v1/mediaitems/refs';
6479
- _context4.prev = 1;
6480
- _context4.next = 4;
6542
+ _context5.prev = 1;
6543
+ _context5.next = 4;
6481
6544
  return fetch("".concat(fullUrl, "?filter=").concat(encodeURIComponent("[{_id,eq,".concat(id, "}]"))), {
6482
6545
  headers: {
6483
6546
  Authorization: 'Bearer ' + this.jwt,
@@ -6485,32 +6548,32 @@ var MediaHandler = /*#__PURE__*/function () {
6485
6548
  }
6486
6549
  });
6487
6550
  case 4:
6488
- res = _context4.sent;
6489
- _context4.next = 7;
6551
+ res = _context5.sent;
6552
+ _context5.next = 7;
6490
6553
  return res.json();
6491
6554
  case 7:
6492
- resData = _context4.sent;
6493
- _context4.next = 13;
6555
+ resData = _context5.sent;
6556
+ _context5.next = 13;
6494
6557
  break;
6495
6558
  case 10:
6496
- _context4.prev = 10;
6497
- _context4.t0 = _context4["catch"](1);
6559
+ _context5.prev = 10;
6560
+ _context5.t0 = _context5["catch"](1);
6498
6561
  throw new Error('Could not fetch mediaItemRef');
6499
6562
  case 13:
6500
6563
  if (!res.ok) {
6501
- _context4.next = 15;
6564
+ _context5.next = 15;
6502
6565
  break;
6503
6566
  }
6504
- return _context4.abrupt("return", resData);
6567
+ return _context5.abrupt("return", resData);
6505
6568
  case 15:
6506
6569
  throw new Error(resData.error);
6507
6570
  case 16:
6508
6571
  case "end":
6509
- return _context4.stop();
6572
+ return _context5.stop();
6510
6573
  }
6511
- }, _callee4, this, [[1, 10]]);
6574
+ }, _callee5, this, [[1, 10]]);
6512
6575
  }));
6513
- function getMediaItemRefById(_x4) {
6576
+ function getMediaItemRefById(_x5) {
6514
6577
  return _getMediaItemRefById.apply(this, arguments);
6515
6578
  }
6516
6579
  return getMediaItemRefById;
@@ -6518,14 +6581,14 @@ var MediaHandler = /*#__PURE__*/function () {
6518
6581
  }, {
6519
6582
  key: "getHQRenderScriptById",
6520
6583
  value: function () {
6521
- var _getHQRenderScriptById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id) {
6584
+ var _getHQRenderScriptById = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id) {
6522
6585
  var fullUrl, res, resData;
6523
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
6524
- while (1) switch (_context5.prev = _context5.next) {
6586
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
6587
+ while (1) switch (_context6.prev = _context6.next) {
6525
6588
  case 0:
6526
6589
  fullUrl = this.mediaService + '/hqrenderscripts';
6527
- _context5.prev = 1;
6528
- _context5.next = 4;
6590
+ _context6.prev = 1;
6591
+ _context6.next = 4;
6529
6592
  return fetch("".concat(fullUrl, "/").concat(id), {
6530
6593
  headers: {
6531
6594
  Authorization: 'Bearer ' + this.jwt,
@@ -6533,32 +6596,32 @@ var MediaHandler = /*#__PURE__*/function () {
6533
6596
  }
6534
6597
  });
6535
6598
  case 4:
6536
- res = _context5.sent;
6537
- _context5.next = 7;
6599
+ res = _context6.sent;
6600
+ _context6.next = 7;
6538
6601
  return res.json();
6539
6602
  case 7:
6540
- resData = _context5.sent;
6541
- _context5.next = 13;
6603
+ resData = _context6.sent;
6604
+ _context6.next = 13;
6542
6605
  break;
6543
6606
  case 10:
6544
- _context5.prev = 10;
6545
- _context5.t0 = _context5["catch"](1);
6607
+ _context6.prev = 10;
6608
+ _context6.t0 = _context6["catch"](1);
6546
6609
  throw new Error('Could not fetch mediaItem');
6547
6610
  case 13:
6548
6611
  if (!res.ok) {
6549
- _context5.next = 15;
6612
+ _context6.next = 15;
6550
6613
  break;
6551
6614
  }
6552
- return _context5.abrupt("return", resData);
6615
+ return _context6.abrupt("return", resData);
6553
6616
  case 15:
6554
6617
  throw new Error(resData.error);
6555
6618
  case 16:
6556
6619
  case "end":
6557
- return _context5.stop();
6620
+ return _context6.stop();
6558
6621
  }
6559
- }, _callee5, this, [[1, 10]]);
6622
+ }, _callee6, this, [[1, 10]]);
6560
6623
  }));
6561
- function getHQRenderScriptById(_x5) {
6624
+ function getHQRenderScriptById(_x6) {
6562
6625
  return _getHQRenderScriptById.apply(this, arguments);
6563
6626
  }
6564
6627
  return getHQRenderScriptById;
@@ -6566,10 +6629,10 @@ var MediaHandler = /*#__PURE__*/function () {
6566
6629
  }, {
6567
6630
  key: "getRooms",
6568
6631
  value: function () {
6569
- var _getRooms = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(id, mainCategory, style, name) {
6632
+ var _getRooms = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, mainCategory, style, name) {
6570
6633
  var fullUrl, filterParts, filter, res, resData;
6571
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
6572
- while (1) switch (_context6.prev = _context6.next) {
6634
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
6635
+ while (1) switch (_context7.prev = _context7.next) {
6573
6636
  case 0:
6574
6637
  fullUrl = new URL(this.mediaService + '/rooms');
6575
6638
  fullUrl.searchParams.append('limit', '20');
@@ -6592,8 +6655,8 @@ var MediaHandler = /*#__PURE__*/function () {
6592
6655
  if (filter) {
6593
6656
  fullUrl.searchParams.append('filter', encodeURIComponent(filter));
6594
6657
  }
6595
- _context6.prev = 7;
6596
- _context6.next = 10;
6658
+ _context7.prev = 7;
6659
+ _context7.next = 10;
6597
6660
  return fetch(fullUrl.toString(), {
6598
6661
  headers: {
6599
6662
  Authorization: 'Bearer ' + this.jwt,
@@ -6601,32 +6664,32 @@ var MediaHandler = /*#__PURE__*/function () {
6601
6664
  }
6602
6665
  });
6603
6666
  case 10:
6604
- res = _context6.sent;
6605
- _context6.next = 13;
6667
+ res = _context7.sent;
6668
+ _context7.next = 13;
6606
6669
  return res.json();
6607
6670
  case 13:
6608
- resData = _context6.sent;
6609
- _context6.next = 19;
6671
+ resData = _context7.sent;
6672
+ _context7.next = 19;
6610
6673
  break;
6611
6674
  case 16:
6612
- _context6.prev = 16;
6613
- _context6.t0 = _context6["catch"](7);
6675
+ _context7.prev = 16;
6676
+ _context7.t0 = _context7["catch"](7);
6614
6677
  throw new Error('Could not get rooms');
6615
6678
  case 19:
6616
6679
  if (!res.ok) {
6617
- _context6.next = 21;
6680
+ _context7.next = 21;
6618
6681
  break;
6619
6682
  }
6620
- return _context6.abrupt("return", resData.data);
6683
+ return _context7.abrupt("return", resData.data);
6621
6684
  case 21:
6622
6685
  throw new Error(resData.error);
6623
6686
  case 22:
6624
6687
  case "end":
6625
- return _context6.stop();
6688
+ return _context7.stop();
6626
6689
  }
6627
- }, _callee6, this, [[7, 16]]);
6690
+ }, _callee7, this, [[7, 16]]);
6628
6691
  }));
6629
- function getRooms(_x6, _x7, _x8, _x9) {
6692
+ function getRooms(_x7, _x8, _x9, _x10) {
6630
6693
  return _getRooms.apply(this, arguments);
6631
6694
  }
6632
6695
  return getRooms;
@@ -6634,10 +6697,10 @@ var MediaHandler = /*#__PURE__*/function () {
6634
6697
  }, {
6635
6698
  key: "getRoomsNew",
6636
6699
  value: function () {
6637
- var _getRoomsNew = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(id, mainCategory, organizationId) {
6700
+ var _getRoomsNew = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id, mainCategory, organizationId) {
6638
6701
  var fullUrl, filterParts, filter, res, resData;
6639
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
6640
- while (1) switch (_context7.prev = _context7.next) {
6702
+ return _regeneratorRuntime.wrap(function _callee8$(_context8) {
6703
+ while (1) switch (_context8.prev = _context8.next) {
6641
6704
  case 0:
6642
6705
  fullUrl = new URL(this.mediaService + '/rooms');
6643
6706
  fullUrl.searchParams.append('limit', '1000');
@@ -6657,8 +6720,8 @@ var MediaHandler = /*#__PURE__*/function () {
6657
6720
  if (filter) {
6658
6721
  fullUrl.searchParams.append('filter', encodeURIComponent(filter));
6659
6722
  }
6660
- _context7.prev = 8;
6661
- _context7.next = 11;
6723
+ _context8.prev = 8;
6724
+ _context8.next = 11;
6662
6725
  return fetch(fullUrl.toString(), {
6663
6726
  headers: {
6664
6727
  Authorization: 'Bearer ' + this.jwt,
@@ -6666,32 +6729,32 @@ var MediaHandler = /*#__PURE__*/function () {
6666
6729
  }
6667
6730
  });
6668
6731
  case 11:
6669
- res = _context7.sent;
6670
- _context7.next = 14;
6732
+ res = _context8.sent;
6733
+ _context8.next = 14;
6671
6734
  return res.json();
6672
6735
  case 14:
6673
- resData = _context7.sent;
6674
- _context7.next = 20;
6736
+ resData = _context8.sent;
6737
+ _context8.next = 20;
6675
6738
  break;
6676
6739
  case 17:
6677
- _context7.prev = 17;
6678
- _context7.t0 = _context7["catch"](8);
6740
+ _context8.prev = 17;
6741
+ _context8.t0 = _context8["catch"](8);
6679
6742
  throw new Error('Could not get rooms');
6680
6743
  case 20:
6681
6744
  if (!res.ok) {
6682
- _context7.next = 22;
6745
+ _context8.next = 22;
6683
6746
  break;
6684
6747
  }
6685
- return _context7.abrupt("return", resData.data);
6748
+ return _context8.abrupt("return", resData.data);
6686
6749
  case 22:
6687
6750
  throw new Error(resData.error);
6688
6751
  case 23:
6689
6752
  case "end":
6690
- return _context7.stop();
6753
+ return _context8.stop();
6691
6754
  }
6692
- }, _callee7, this, [[8, 17]]);
6755
+ }, _callee8, this, [[8, 17]]);
6693
6756
  }));
6694
- function getRoomsNew(_x10, _x11, _x12) {
6757
+ function getRoomsNew(_x11, _x12, _x13) {
6695
6758
  return _getRoomsNew.apply(this, arguments);
6696
6759
  }
6697
6760
  return getRoomsNew;
@@ -6699,10 +6762,10 @@ var MediaHandler = /*#__PURE__*/function () {
6699
6762
  }, {
6700
6763
  key: "getRoomsGrouped",
6701
6764
  value: function () {
6702
- var _getRoomsGrouped = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(id, mainCategory, style, organizationId) {
6765
+ var _getRoomsGrouped = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(id, mainCategory, style, organizationId) {
6703
6766
  var fullUrl, filterParts, filter, res, resData;
6704
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
6705
- while (1) switch (_context8.prev = _context8.next) {
6767
+ return _regeneratorRuntime.wrap(function _callee9$(_context9) {
6768
+ while (1) switch (_context9.prev = _context9.next) {
6706
6769
  case 0:
6707
6770
  fullUrl = new URL(this.mediaService + '/rooms');
6708
6771
  if (organizationId) {
@@ -6725,8 +6788,8 @@ var MediaHandler = /*#__PURE__*/function () {
6725
6788
  if (filter) {
6726
6789
  fullUrl.searchParams.append('filter', encodeURIComponent(filter));
6727
6790
  }
6728
- _context8.prev = 8;
6729
- _context8.next = 11;
6791
+ _context9.prev = 8;
6792
+ _context9.next = 11;
6730
6793
  return fetch(fullUrl.toString(), {
6731
6794
  headers: {
6732
6795
  Authorization: 'Bearer ' + this.jwt,
@@ -6734,32 +6797,32 @@ var MediaHandler = /*#__PURE__*/function () {
6734
6797
  }
6735
6798
  });
6736
6799
  case 11:
6737
- res = _context8.sent;
6738
- _context8.next = 14;
6800
+ res = _context9.sent;
6801
+ _context9.next = 14;
6739
6802
  return res.json();
6740
6803
  case 14:
6741
- resData = _context8.sent;
6742
- _context8.next = 20;
6804
+ resData = _context9.sent;
6805
+ _context9.next = 20;
6743
6806
  break;
6744
6807
  case 17:
6745
- _context8.prev = 17;
6746
- _context8.t0 = _context8["catch"](8);
6808
+ _context9.prev = 17;
6809
+ _context9.t0 = _context9["catch"](8);
6747
6810
  throw new Error('Could not get rooms');
6748
6811
  case 20:
6749
6812
  if (!res.ok) {
6750
- _context8.next = 22;
6813
+ _context9.next = 22;
6751
6814
  break;
6752
6815
  }
6753
- return _context8.abrupt("return", organizationId ? resData : resData.data);
6816
+ return _context9.abrupt("return", organizationId ? resData : resData.data);
6754
6817
  case 22:
6755
6818
  throw new Error(resData.error);
6756
6819
  case 23:
6757
6820
  case "end":
6758
- return _context8.stop();
6821
+ return _context9.stop();
6759
6822
  }
6760
- }, _callee8, this, [[8, 17]]);
6823
+ }, _callee9, this, [[8, 17]]);
6761
6824
  }));
6762
- function getRoomsGrouped(_x13, _x14, _x15, _x16) {
6825
+ function getRoomsGrouped(_x14, _x15, _x16, _x17) {
6763
6826
  return _getRoomsGrouped.apply(this, arguments);
6764
6827
  }
6765
6828
  return getRoomsGrouped;
@@ -6767,15 +6830,15 @@ var MediaHandler = /*#__PURE__*/function () {
6767
6830
  }, {
6768
6831
  key: "getRoomColors",
6769
6832
  value: function () {
6770
- var _getRoomColors = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee9(name) {
6833
+ var _getRoomColors = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(name) {
6771
6834
  var fullUrl, res, resData;
6772
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
6773
- while (1) switch (_context9.prev = _context9.next) {
6835
+ return _regeneratorRuntime.wrap(function _callee10$(_context10) {
6836
+ while (1) switch (_context10.prev = _context10.next) {
6774
6837
  case 0:
6775
6838
  fullUrl = this.mediaService + '/rooms/' + name + '/colors';
6776
6839
  resData = [];
6777
- _context9.prev = 2;
6778
- _context9.next = 5;
6840
+ _context10.prev = 2;
6841
+ _context10.next = 5;
6779
6842
  return fetch(fullUrl, {
6780
6843
  headers: {
6781
6844
  Authorization: 'Bearer ' + this.jwt,
@@ -6783,32 +6846,32 @@ var MediaHandler = /*#__PURE__*/function () {
6783
6846
  }
6784
6847
  });
6785
6848
  case 5:
6786
- res = _context9.sent;
6787
- _context9.next = 8;
6849
+ res = _context10.sent;
6850
+ _context10.next = 8;
6788
6851
  return res.json();
6789
6852
  case 8:
6790
- resData = _context9.sent;
6791
- _context9.next = 14;
6853
+ resData = _context10.sent;
6854
+ _context10.next = 14;
6792
6855
  break;
6793
6856
  case 11:
6794
- _context9.prev = 11;
6795
- _context9.t0 = _context9["catch"](2);
6857
+ _context10.prev = 11;
6858
+ _context10.t0 = _context10["catch"](2);
6796
6859
  throw new Error('Could not get room variants');
6797
6860
  case 14:
6798
6861
  if (!res.ok) {
6799
- _context9.next = 16;
6862
+ _context10.next = 16;
6800
6863
  break;
6801
6864
  }
6802
- return _context9.abrupt("return", resData);
6865
+ return _context10.abrupt("return", resData);
6803
6866
  case 16:
6804
6867
  throw new Error(resData.error);
6805
6868
  case 17:
6806
6869
  case "end":
6807
- return _context9.stop();
6870
+ return _context10.stop();
6808
6871
  }
6809
- }, _callee9, this, [[2, 11]]);
6872
+ }, _callee10, this, [[2, 11]]);
6810
6873
  }));
6811
- function getRoomColors(_x17) {
6874
+ function getRoomColors(_x18) {
6812
6875
  return _getRoomColors.apply(this, arguments);
6813
6876
  }
6814
6877
  return getRoomColors;
@@ -6816,15 +6879,15 @@ var MediaHandler = /*#__PURE__*/function () {
6816
6879
  }, {
6817
6880
  key: "getRoomVariants",
6818
6881
  value: function () {
6819
- var _getRoomVariants = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id) {
6882
+ var _getRoomVariants = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11(id) {
6820
6883
  var fullUrl, res, resData;
6821
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
6822
- while (1) switch (_context10.prev = _context10.next) {
6884
+ return _regeneratorRuntime.wrap(function _callee11$(_context11) {
6885
+ while (1) switch (_context11.prev = _context11.next) {
6823
6886
  case 0:
6824
6887
  fullUrl = this.mediaService + '/rooms/' + id + '/variants';
6825
6888
  resData = [];
6826
- _context10.prev = 2;
6827
- _context10.next = 5;
6889
+ _context11.prev = 2;
6890
+ _context11.next = 5;
6828
6891
  return fetch(fullUrl, {
6829
6892
  headers: {
6830
6893
  Authorization: 'Bearer ' + this.jwt,
@@ -6832,32 +6895,32 @@ var MediaHandler = /*#__PURE__*/function () {
6832
6895
  }
6833
6896
  });
6834
6897
  case 5:
6835
- res = _context10.sent;
6836
- _context10.next = 8;
6898
+ res = _context11.sent;
6899
+ _context11.next = 8;
6837
6900
  return res.json();
6838
6901
  case 8:
6839
- resData = _context10.sent;
6840
- _context10.next = 14;
6902
+ resData = _context11.sent;
6903
+ _context11.next = 14;
6841
6904
  break;
6842
6905
  case 11:
6843
- _context10.prev = 11;
6844
- _context10.t0 = _context10["catch"](2);
6906
+ _context11.prev = 11;
6907
+ _context11.t0 = _context11["catch"](2);
6845
6908
  throw new Error('Could not get room variants');
6846
6909
  case 14:
6847
6910
  if (!res.ok) {
6848
- _context10.next = 16;
6911
+ _context11.next = 16;
6849
6912
  break;
6850
6913
  }
6851
- return _context10.abrupt("return", resData);
6914
+ return _context11.abrupt("return", resData);
6852
6915
  case 16:
6853
6916
  throw new Error(resData.error);
6854
6917
  case 17:
6855
6918
  case "end":
6856
- return _context10.stop();
6919
+ return _context11.stop();
6857
6920
  }
6858
- }, _callee10, this, [[2, 11]]);
6921
+ }, _callee11, this, [[2, 11]]);
6859
6922
  }));
6860
- function getRoomVariants(_x18) {
6923
+ function getRoomVariants(_x19) {
6861
6924
  return _getRoomVariants.apply(this, arguments);
6862
6925
  }
6863
6926
  return getRoomVariants;
@@ -6865,25 +6928,25 @@ var MediaHandler = /*#__PURE__*/function () {
6865
6928
  }, {
6866
6929
  key: "getRenderJobs",
6867
6930
  value: function () {
6868
- var _getRenderJobs = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
6931
+ var _getRenderJobs = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
6869
6932
  var query,
6870
6933
  fullUrl,
6871
6934
  res,
6872
6935
  resData,
6873
6936
  err,
6874
- _args11 = arguments;
6875
- return _regeneratorRuntime.wrap(function _callee11$(_context11) {
6876
- while (1) switch (_context11.prev = _context11.next) {
6937
+ _args12 = arguments;
6938
+ return _regeneratorRuntime.wrap(function _callee12$(_context12) {
6939
+ while (1) switch (_context12.prev = _context12.next) {
6877
6940
  case 0:
6878
- query = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
6941
+ query = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
6879
6942
  fullUrl = new URL(this.mediaService + '/renderjobs');
6880
6943
  if (this.organizationId) fullUrl.searchParams.append('organizationId', this.organizationId);
6881
6944
  if (query.limit) fullUrl.searchParams.append('limit', String(query.limit));
6882
6945
  if (query.skip) fullUrl.searchParams.append('skip', String(query.skip));
6883
6946
  if (query.filter) fullUrl.searchParams.append('filter', encodeURIComponent(query.filter));
6884
6947
  if (query.sort) fullUrl.searchParams.append('sort', encodeURIComponent(query.sort));
6885
- _context11.prev = 7;
6886
- _context11.next = 10;
6948
+ _context12.prev = 7;
6949
+ _context12.next = 10;
6887
6950
  return fetch(fullUrl.toString(), {
6888
6951
  headers: {
6889
6952
  Authorization: 'Bearer ' + this.jwt,
@@ -6891,32 +6954,32 @@ var MediaHandler = /*#__PURE__*/function () {
6891
6954
  }
6892
6955
  });
6893
6956
  case 10:
6894
- res = _context11.sent;
6895
- _context11.next = 13;
6957
+ res = _context12.sent;
6958
+ _context12.next = 13;
6896
6959
  return res.json();
6897
6960
  case 13:
6898
- resData = _context11.sent;
6899
- _context11.next = 19;
6961
+ resData = _context12.sent;
6962
+ _context12.next = 19;
6900
6963
  break;
6901
6964
  case 16:
6902
- _context11.prev = 16;
6903
- _context11.t0 = _context11["catch"](7);
6965
+ _context12.prev = 16;
6966
+ _context12.t0 = _context12["catch"](7);
6904
6967
  throw new Error('Could not get render jobs');
6905
6968
  case 19:
6906
6969
  if (!res.ok) {
6907
- _context11.next = 21;
6970
+ _context12.next = 21;
6908
6971
  break;
6909
6972
  }
6910
- return _context11.abrupt("return", resData);
6973
+ return _context12.abrupt("return", resData);
6911
6974
  case 21:
6912
6975
  err = new Error(resData.error);
6913
6976
  err.status = res.status;
6914
6977
  throw err;
6915
6978
  case 24:
6916
6979
  case "end":
6917
- return _context11.stop();
6980
+ return _context12.stop();
6918
6981
  }
6919
- }, _callee11, this, [[7, 16]]);
6982
+ }, _callee12, this, [[7, 16]]);
6920
6983
  }));
6921
6984
  function getRenderJobs() {
6922
6985
  return _getRenderJobs.apply(this, arguments);
@@ -6926,24 +6989,24 @@ var MediaHandler = /*#__PURE__*/function () {
6926
6989
  }, {
6927
6990
  key: "getAiProductPhotoCampaignSummaries",
6928
6991
  value: (function () {
6929
- var _getAiProductPhotoCampaignSummaries = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
6992
+ var _getAiProductPhotoCampaignSummaries = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13() {
6930
6993
  var query,
6931
6994
  fullUrl,
6932
6995
  res,
6933
6996
  resData,
6934
- _args12 = arguments;
6935
- return _regeneratorRuntime.wrap(function _callee12$(_context12) {
6936
- while (1) switch (_context12.prev = _context12.next) {
6997
+ _args13 = arguments;
6998
+ return _regeneratorRuntime.wrap(function _callee13$(_context13) {
6999
+ while (1) switch (_context13.prev = _context13.next) {
6937
7000
  case 0:
6938
- query = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
7001
+ query = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
6939
7002
  fullUrl = new URL(this.mediaService + '/renderjobs/aiproductphoto/campaigns/summary');
6940
7003
  if (this.organizationId) fullUrl.searchParams.append('organizationId', this.organizationId);
6941
7004
  if (query.search) fullUrl.searchParams.append('search', query.search);
6942
7005
  if (query.sort) fullUrl.searchParams.append('sort', query.sort);
6943
7006
  if (query.skip) fullUrl.searchParams.append('skip', String(query.skip));
6944
7007
  if (query.limit) fullUrl.searchParams.append('limit', String(query.limit));
6945
- _context12.prev = 7;
6946
- _context12.next = 10;
7008
+ _context13.prev = 7;
7009
+ _context13.next = 10;
6947
7010
  return fetch(fullUrl.toString(), {
6948
7011
  headers: {
6949
7012
  Authorization: 'Bearer ' + this.jwt,
@@ -6951,30 +7014,30 @@ var MediaHandler = /*#__PURE__*/function () {
6951
7014
  }
6952
7015
  });
6953
7016
  case 10:
6954
- res = _context12.sent;
6955
- _context12.next = 13;
7017
+ res = _context13.sent;
7018
+ _context13.next = 13;
6956
7019
  return res.json();
6957
7020
  case 13:
6958
- resData = _context12.sent;
6959
- _context12.next = 19;
7021
+ resData = _context13.sent;
7022
+ _context13.next = 19;
6960
7023
  break;
6961
7024
  case 16:
6962
- _context12.prev = 16;
6963
- _context12.t0 = _context12["catch"](7);
7025
+ _context13.prev = 16;
7026
+ _context13.t0 = _context13["catch"](7);
6964
7027
  throw new Error('Could not get AI product photo campaign summaries');
6965
7028
  case 19:
6966
7029
  if (!res.ok) {
6967
- _context12.next = 21;
7030
+ _context13.next = 21;
6968
7031
  break;
6969
7032
  }
6970
- return _context12.abrupt("return", resData);
7033
+ return _context13.abrupt("return", resData);
6971
7034
  case 21:
6972
7035
  throw new Error(resData.error);
6973
7036
  case 22:
6974
7037
  case "end":
6975
- return _context12.stop();
7038
+ return _context13.stop();
6976
7039
  }
6977
- }, _callee12, this, [[7, 16]]);
7040
+ }, _callee13, this, [[7, 16]]);
6978
7041
  }));
6979
7042
  function getAiProductPhotoCampaignSummaries() {
6980
7043
  return _getAiProductPhotoCampaignSummaries.apply(this, arguments);
@@ -6984,13 +7047,13 @@ var MediaHandler = /*#__PURE__*/function () {
6984
7047
  }, {
6985
7048
  key: "archiveRenderJob",
6986
7049
  value: (function () {
6987
- var _archiveRenderJob = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, archived) {
7050
+ var _archiveRenderJob = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(id, archived) {
6988
7051
  var res, resData;
6989
- return _regeneratorRuntime.wrap(function _callee13$(_context13) {
6990
- while (1) switch (_context13.prev = _context13.next) {
7052
+ return _regeneratorRuntime.wrap(function _callee14$(_context14) {
7053
+ while (1) switch (_context14.prev = _context14.next) {
6991
7054
  case 0:
6992
- _context13.prev = 0;
6993
- _context13.next = 3;
7055
+ _context14.prev = 0;
7056
+ _context14.next = 3;
6994
7057
  return fetch("".concat(this.mediaService, "/renderjobs/").concat(id, "/archive"), {
6995
7058
  method: 'PATCH',
6996
7059
  headers: {
@@ -7002,32 +7065,32 @@ var MediaHandler = /*#__PURE__*/function () {
7002
7065
  })
7003
7066
  });
7004
7067
  case 3:
7005
- res = _context13.sent;
7006
- _context13.next = 6;
7068
+ res = _context14.sent;
7069
+ _context14.next = 6;
7007
7070
  return res.json();
7008
7071
  case 6:
7009
- resData = _context13.sent;
7010
- _context13.next = 12;
7072
+ resData = _context14.sent;
7073
+ _context14.next = 12;
7011
7074
  break;
7012
7075
  case 9:
7013
- _context13.prev = 9;
7014
- _context13.t0 = _context13["catch"](0);
7076
+ _context14.prev = 9;
7077
+ _context14.t0 = _context14["catch"](0);
7015
7078
  throw new Error('Could not archive render job');
7016
7079
  case 12:
7017
7080
  if (res.ok) {
7018
- _context13.next = 14;
7081
+ _context14.next = 14;
7019
7082
  break;
7020
7083
  }
7021
7084
  throw new Error(resData.error);
7022
7085
  case 14:
7023
- return _context13.abrupt("return");
7086
+ return _context14.abrupt("return");
7024
7087
  case 15:
7025
7088
  case "end":
7026
- return _context13.stop();
7089
+ return _context14.stop();
7027
7090
  }
7028
- }, _callee13, this, [[0, 9]]);
7091
+ }, _callee14, this, [[0, 9]]);
7029
7092
  }));
7030
- function archiveRenderJob(_x19, _x20) {
7093
+ function archiveRenderJob(_x20, _x21) {
7031
7094
  return _archiveRenderJob.apply(this, arguments);
7032
7095
  }
7033
7096
  return archiveRenderJob;
@@ -7035,13 +7098,13 @@ var MediaHandler = /*#__PURE__*/function () {
7035
7098
  }, {
7036
7099
  key: "getRenderJob",
7037
7100
  value: function () {
7038
- var _getRenderJob = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee14(id) {
7101
+ var _getRenderJob = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(id) {
7039
7102
  var res, resData;
7040
- return _regeneratorRuntime.wrap(function _callee14$(_context14) {
7041
- while (1) switch (_context14.prev = _context14.next) {
7103
+ return _regeneratorRuntime.wrap(function _callee15$(_context15) {
7104
+ while (1) switch (_context15.prev = _context15.next) {
7042
7105
  case 0:
7043
- _context14.prev = 0;
7044
- _context14.next = 3;
7106
+ _context15.prev = 0;
7107
+ _context15.next = 3;
7045
7108
  return fetch("".concat(this.mediaService, "/renderjobs/").concat(id), {
7046
7109
  headers: {
7047
7110
  Authorization: 'Bearer ' + this.jwt,
@@ -7049,32 +7112,32 @@ var MediaHandler = /*#__PURE__*/function () {
7049
7112
  }
7050
7113
  });
7051
7114
  case 3:
7052
- res = _context14.sent;
7053
- _context14.next = 6;
7115
+ res = _context15.sent;
7116
+ _context15.next = 6;
7054
7117
  return res.json();
7055
7118
  case 6:
7056
- resData = _context14.sent;
7057
- _context14.next = 12;
7119
+ resData = _context15.sent;
7120
+ _context15.next = 12;
7058
7121
  break;
7059
7122
  case 9:
7060
- _context14.prev = 9;
7061
- _context14.t0 = _context14["catch"](0);
7123
+ _context15.prev = 9;
7124
+ _context15.t0 = _context15["catch"](0);
7062
7125
  throw new Error('Could not get render job');
7063
7126
  case 12:
7064
7127
  if (!res.ok) {
7065
- _context14.next = 14;
7128
+ _context15.next = 14;
7066
7129
  break;
7067
7130
  }
7068
- return _context14.abrupt("return", resData);
7131
+ return _context15.abrupt("return", resData);
7069
7132
  case 14:
7070
7133
  throw new Error(resData.error);
7071
7134
  case 15:
7072
7135
  case "end":
7073
- return _context14.stop();
7136
+ return _context15.stop();
7074
7137
  }
7075
- }, _callee14, this, [[0, 9]]);
7138
+ }, _callee15, this, [[0, 9]]);
7076
7139
  }));
7077
- function getRenderJob(_x21) {
7140
+ function getRenderJob(_x22) {
7078
7141
  return _getRenderJob.apply(this, arguments);
7079
7142
  }
7080
7143
  return getRenderJob;
@@ -7082,16 +7145,16 @@ var MediaHandler = /*#__PURE__*/function () {
7082
7145
  }, {
7083
7146
  key: "getRenderPackages",
7084
7147
  value: function () {
7085
- var _getRenderPackages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee15(organizationId) {
7148
+ var _getRenderPackages = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee16(organizationId) {
7086
7149
  var fullUrl, res, resData;
7087
- return _regeneratorRuntime.wrap(function _callee15$(_context15) {
7088
- while (1) switch (_context15.prev = _context15.next) {
7150
+ return _regeneratorRuntime.wrap(function _callee16$(_context16) {
7151
+ while (1) switch (_context16.prev = _context16.next) {
7089
7152
  case 0:
7090
7153
  fullUrl = new URL(this.mediaService + '/renderpackages');
7091
7154
  if (organizationId) fullUrl.searchParams.append('organizationId', organizationId);
7092
7155
  fullUrl.searchParams.append('sort', encodeURIComponent('{position}'));
7093
- _context15.prev = 3;
7094
- _context15.next = 6;
7156
+ _context16.prev = 3;
7157
+ _context16.next = 6;
7095
7158
  return fetch(fullUrl, {
7096
7159
  headers: {
7097
7160
  Authorization: 'Bearer ' + this.jwt,
@@ -7099,32 +7162,32 @@ var MediaHandler = /*#__PURE__*/function () {
7099
7162
  }
7100
7163
  });
7101
7164
  case 6:
7102
- res = _context15.sent;
7103
- _context15.next = 9;
7165
+ res = _context16.sent;
7166
+ _context16.next = 9;
7104
7167
  return res.json();
7105
7168
  case 9:
7106
- resData = _context15.sent;
7107
- _context15.next = 15;
7169
+ resData = _context16.sent;
7170
+ _context16.next = 15;
7108
7171
  break;
7109
7172
  case 12:
7110
- _context15.prev = 12;
7111
- _context15.t0 = _context15["catch"](3);
7173
+ _context16.prev = 12;
7174
+ _context16.t0 = _context16["catch"](3);
7112
7175
  throw new Error('Could not get render packages');
7113
7176
  case 15:
7114
7177
  if (!res.ok) {
7115
- _context15.next = 17;
7178
+ _context16.next = 17;
7116
7179
  break;
7117
7180
  }
7118
- return _context15.abrupt("return", resData);
7181
+ return _context16.abrupt("return", resData);
7119
7182
  case 17:
7120
7183
  throw new Error(resData.error);
7121
7184
  case 18:
7122
7185
  case "end":
7123
- return _context15.stop();
7186
+ return _context16.stop();
7124
7187
  }
7125
- }, _callee15, this, [[3, 12]]);
7188
+ }, _callee16, this, [[3, 12]]);
7126
7189
  }));
7127
- function getRenderPackages(_x22) {
7190
+ function getRenderPackages(_x23) {
7128
7191
  return _getRenderPackages.apply(this, arguments);
7129
7192
  }
7130
7193
  return getRenderPackages;
@@ -9048,18 +9111,21 @@ var AIHandler = /*#__PURE__*/function () {
9048
9111
  }
9049
9112
  return _context3.abrupt("return", resData);
9050
9113
  case 9:
9114
+ // The services carry an `errorCode` alongside the message for cases a caller has to tell apart
9115
+ // (e.g. a product that cannot be named for the MAM). Drop it here and the caller only sees a bare 400.
9051
9116
  err = new Error(resData === null || resData === void 0 ? void 0 : resData.error);
9052
9117
  err.status = response.status;
9118
+ err.errorCode = resData === null || resData === void 0 ? void 0 : resData.errorCode;
9053
9119
  return _context3.abrupt("return", Promise.reject(err));
9054
- case 14:
9055
- _context3.prev = 14;
9120
+ case 15:
9121
+ _context3.prev = 15;
9056
9122
  _context3.t0 = _context3["catch"](0);
9057
9123
  return _context3.abrupt("return", Promise.reject(_context3.t0));
9058
- case 17:
9124
+ case 18:
9059
9125
  case "end":
9060
9126
  return _context3.stop();
9061
9127
  }
9062
- }, _callee3, this, [[0, 14]]);
9128
+ }, _callee3, this, [[0, 15]]);
9063
9129
  }));
9064
9130
  function generateProductPhoto(_x4) {
9065
9131
  return _generateProductPhoto.apply(this, arguments);
@@ -11194,7 +11260,7 @@ var DrawerMenu$1 = observer(DrawerMenu);
11194
11260
  function ownKeys$4(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; }
11195
11261
  function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11196
11262
  var LazyModals$1 = /*#__PURE__*/React.lazy(function () {
11197
- return import('./ModalsWrapper-3c168293.js');
11263
+ return import('./ModalsWrapper-37951988.js');
11198
11264
  });
11199
11265
  function Fullscreen(_ref) {
11200
11266
  var inAbsoluteFullscreen = _ref.inAbsoluteFullscreen;
@@ -11656,10 +11722,10 @@ function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymb
11656
11722
  function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11657
11723
  var LOG$2 = getLogger('Framework', 'Root');
11658
11724
  var LazyAuth = /*#__PURE__*/React.lazy(function () {
11659
- return import('./index-6f14124a.js');
11725
+ return import('./index-7be5e649.js');
11660
11726
  });
11661
11727
  var LazyModals = /*#__PURE__*/React.lazy(function () {
11662
- return import('./ModalsWrapper-3c168293.js');
11728
+ return import('./ModalsWrapper-37951988.js');
11663
11729
  });
11664
11730
  function ContentComponent() {
11665
11731
  var context = useDivaCoreContext();