@contentful/field-editor-reference 4.2.3 → 4.3.2

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.
@@ -2255,13 +2255,14 @@ function useEditorPermissions(props) {
2255
2255
 
2256
2256
  function _checkCreateAccess() {
2257
2257
  _checkCreateAccess = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2258
- var canCreate;
2258
+ var canCreate, _canCreate;
2259
+
2259
2260
  return runtime_1.wrap(function _callee$(_context) {
2260
2261
  while (1) {
2261
2262
  switch (_context.prev = _context.next) {
2262
2263
  case 0:
2263
2264
  if (!(entityType === 'Asset')) {
2264
- _context.next = 5;
2265
+ _context.next = 8;
2265
2266
  break;
2266
2267
  }
2267
2268
 
@@ -2269,15 +2270,28 @@ function useEditorPermissions(props) {
2269
2270
  return canPerformAction('create', 'Asset');
2270
2271
 
2271
2272
  case 3:
2272
- canCreate = _context.sent;
2273
+ _context.t0 = _context.sent;
2274
+
2275
+ if (_context.t0) {
2276
+ _context.next = 6;
2277
+ break;
2278
+ }
2279
+
2280
+ _context.t0 = true;
2281
+
2282
+ case 6:
2283
+ canCreate = _context.t0;
2273
2284
  setCanCreateEntity(canCreate);
2274
2285
 
2275
- case 5:
2286
+ case 8:
2276
2287
  if (entityType === 'Entry') {
2277
- setCanCreateEntity(creatableContentTypes.length > 0);
2288
+ // Hardcoded `true` value following https://contentful.atlassian.net/browse/DANTE-486
2289
+ // TODO: refine permissions check in order to account for tags in rules
2290
+ _canCreate = creatableContentTypes.length > 0 || true;
2291
+ setCanCreateEntity(_canCreate);
2278
2292
  }
2279
2293
 
2280
- case 6:
2294
+ case 9:
2281
2295
  case "end":
2282
2296
  return _context.stop();
2283
2297
  }
@@ -2421,7 +2435,8 @@ function SingleReferenceEditor(props) {
2421
2435
  });
2422
2436
  }
2423
2437
  SingleReferenceEditor.defaultProps = {
2424
- hasCardEditActions: true
2438
+ hasCardEditActions: true,
2439
+ hasCardRemoveActions: true
2425
2440
  };
2426
2441
 
2427
2442
  var getEntryTitle = entityHelpers.getEntryTitle,
@@ -2436,7 +2451,8 @@ var styles$1 = {
2436
2451
  var defaultProps = {
2437
2452
  isClickable: true,
2438
2453
  hasCardEditActions: true,
2439
- hasMoveOptions: true
2454
+ hasCardMoveActions: true,
2455
+ hasCardRemoveActions: true
2440
2456
  };
2441
2457
  function WrappedEntryCard(props) {
2442
2458
  var _props$entry;
@@ -2513,18 +2529,18 @@ function WrappedEntryCard(props) {
2513
2529
  onClick: function onClick() {
2514
2530
  props.onEdit && props.onEdit();
2515
2531
  }
2516
- }, "Edit") : null, props.onRemove ? createElement(MenuItem, {
2532
+ }, "Edit") : null, props.hasCardRemoveActions && props.onRemove ? createElement(MenuItem, {
2517
2533
  key: "delete",
2518
2534
  testId: "delete",
2519
2535
  onClick: function onClick() {
2520
2536
  props.onRemove && props.onRemove();
2521
2537
  }
2522
- }, "Remove") : null, props.hasMoveOptions && (props.onMoveTop || props.onMoveBottom) ? createElement(MenuDivider, null) : null, props.hasMoveOptions && props.onMoveTop ? createElement(MenuItem, {
2538
+ }, "Remove") : null, props.hasCardMoveActions && (props.onMoveTop || props.onMoveBottom) ? createElement(MenuDivider, null) : null, props.hasCardMoveActions && props.onMoveTop ? createElement(MenuItem, {
2523
2539
  onClick: function onClick() {
2524
2540
  return props.onMoveTop && props.onMoveTop();
2525
2541
  },
2526
2542
  testId: "move-top"
2527
- }, "Move to top") : null, props.hasMoveOptions && props.onMoveBottom ? createElement(MenuItem, {
2543
+ }, "Move to top") : null, props.hasCardMoveActions && props.onMoveBottom ? createElement(MenuItem, {
2528
2544
  onClick: function onClick() {
2529
2545
  return props.onMoveBottom && props.onMoveBottom();
2530
2546
  },
@@ -2710,11 +2726,15 @@ function FetchingWrappedEntryCard(props) {
2710
2726
  onMoveTop: props.onMoveTop,
2711
2727
  onMoveBottom: props.onMoveBottom
2712
2728
  };
2713
- var hasCardEditActions = props.hasCardEditActions;
2729
+ var hasCardEditActions = props.hasCardEditActions,
2730
+ hasCardMoveActions = props.hasCardMoveActions,
2731
+ hasCardRemoveActions = props.hasCardRemoveActions;
2714
2732
 
2715
2733
  function renderDefaultCard(props) {
2716
2734
  var builtinCardProps = _extends({}, sharedCardProps, props, {
2717
2735
  hasCardEditActions: hasCardEditActions,
2736
+ hasCardMoveActions: hasCardMoveActions,
2737
+ hasCardRemoveActions: hasCardRemoveActions,
2718
2738
  getAsset: getOrLoadAsset,
2719
2739
  getEntityScheduledActions: loadEntityScheduledActions,
2720
2740
  entry: (props == null ? void 0 : props.entity) || sharedCardProps.entity,
@@ -2746,6 +2766,7 @@ function SingleEntryReferenceEditor(props) {
2746
2766
  entityId = _ref.entityId,
2747
2767
  setValue = _ref.setValue,
2748
2768
  renderCustomCard = _ref.renderCustomCard,
2769
+ hasCardRemoveActions = _ref.hasCardRemoveActions,
2749
2770
  hasCardEditActions = _ref.hasCardEditActions;
2750
2771
  return createElement(FetchingWrappedEntryCard, Object.assign({}, props, {
2751
2772
  allContentTypes: allContentTypes,
@@ -2753,6 +2774,7 @@ function SingleEntryReferenceEditor(props) {
2753
2774
  entryId: entityId,
2754
2775
  renderCustomCard: renderCustomCard,
2755
2776
  hasCardEditActions: hasCardEditActions,
2777
+ hasCardRemoveActions: hasCardRemoveActions,
2756
2778
  onRemove: function onRemove() {
2757
2779
  setValue(null);
2758
2780
  }