@contentful/field-editor-reference 4.6.10 → 5.0.0
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/CHANGELOG.md +12 -0
- package/dist/assets/WrappedAssetCard/AssetCardActions.d.ts +1 -1
- package/dist/common/EntityStore.d.ts +55 -5
- package/dist/common/ReferenceEditor.d.ts +1 -1
- package/dist/common/useAccessApi.d.ts +1 -1
- package/dist/components/LinkActions/helpers.d.ts +3 -3
- package/dist/field-editor-reference.cjs.development.js +527 -540
- package/dist/field-editor-reference.cjs.development.js.map +1 -1
- package/dist/field-editor-reference.cjs.production.min.js +1 -1
- package/dist/field-editor-reference.cjs.production.min.js.map +1 -1
- package/dist/field-editor-reference.esm.js +526 -541
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +3 -2
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import React__default, { useState, useRef, useEffect, createElement, Fragment, useMemo, useCallback
|
|
1
|
+
import React__default, { useState, useRef, useEffect, createElement, Fragment, useMemo, useCallback } from 'react';
|
|
2
2
|
import { css, cx } from 'emotion';
|
|
3
3
|
import tokens from '@contentful/f36-tokens';
|
|
4
4
|
import get from 'lodash-es/get';
|
|
5
5
|
import { Menu, TextInput, Button, Paragraph, Card, Flex, SectionHeading, IconButton, Tooltip, Text, EntryCard, MenuItem, MenuDivider, AssetCard } from '@contentful/f36-components';
|
|
6
6
|
import { SearchIcon, PlusIcon, ChevronDownIcon, LinkIcon, CloseIcon, FolderOpenTrimmedIcon, ClockIcon } from '@contentful/f36-icons';
|
|
7
7
|
import moment from 'moment';
|
|
8
|
-
import deepEqual from 'deep-equal';
|
|
9
8
|
import { FieldConnector, isValidImage, entityHelpers, shortenStorageUnit } from '@contentful/field-editor-shared';
|
|
9
|
+
import deepEqual from 'deep-equal';
|
|
10
|
+
import { useQuery, QueryCache, QueryClient, QueryClientProvider, useQueryClient } from '@tanstack/react-query';
|
|
10
11
|
import constate from 'constate';
|
|
11
12
|
import { createClient } from 'contentful-management';
|
|
13
|
+
import PQueue from 'p-queue';
|
|
12
14
|
import isNumber from 'lodash-es/isNumber';
|
|
13
15
|
import arrayMove from 'array-move';
|
|
14
16
|
import { SortableContainer, SortableHandle, SortableElement } from 'react-sortable-hoc';
|
|
@@ -68,57 +70,110 @@ function _extends() {
|
|
|
68
70
|
return _extends.apply(this, arguments);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var sourceKeys = Object.keys(source);
|
|
75
|
-
var key, i;
|
|
73
|
+
function _inheritsLoose(subClass, superClass) {
|
|
74
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
75
|
+
subClass.prototype.constructor = subClass;
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
_setPrototypeOf(subClass, superClass);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function _getPrototypeOf(o) {
|
|
81
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
82
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
83
|
+
};
|
|
84
|
+
return _getPrototypeOf(o);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function _setPrototypeOf(o, p) {
|
|
88
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
89
|
+
o.__proto__ = p;
|
|
90
|
+
return o;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return _setPrototypeOf(o, p);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function _isNativeReflectConstruct() {
|
|
97
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
98
|
+
if (Reflect.construct.sham) return false;
|
|
99
|
+
if (typeof Proxy === "function") return true;
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
103
|
+
return true;
|
|
104
|
+
} catch (e) {
|
|
105
|
+
return false;
|
|
81
106
|
}
|
|
107
|
+
}
|
|
82
108
|
|
|
83
|
-
|
|
109
|
+
function _construct(Parent, args, Class) {
|
|
110
|
+
if (_isNativeReflectConstruct()) {
|
|
111
|
+
_construct = Reflect.construct;
|
|
112
|
+
} else {
|
|
113
|
+
_construct = function _construct(Parent, args, Class) {
|
|
114
|
+
var a = [null];
|
|
115
|
+
a.push.apply(a, args);
|
|
116
|
+
var Constructor = Function.bind.apply(Parent, a);
|
|
117
|
+
var instance = new Constructor();
|
|
118
|
+
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
119
|
+
return instance;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return _construct.apply(null, arguments);
|
|
84
124
|
}
|
|
85
125
|
|
|
86
|
-
function
|
|
87
|
-
|
|
88
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
89
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
90
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
91
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
92
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
126
|
+
function _isNativeFunction(fn) {
|
|
127
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
93
128
|
}
|
|
94
129
|
|
|
95
|
-
function
|
|
96
|
-
|
|
130
|
+
function _wrapNativeSuper(Class) {
|
|
131
|
+
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
132
|
+
|
|
133
|
+
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
134
|
+
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
135
|
+
|
|
136
|
+
if (typeof Class !== "function") {
|
|
137
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (typeof _cache !== "undefined") {
|
|
141
|
+
if (_cache.has(Class)) return _cache.get(Class);
|
|
142
|
+
|
|
143
|
+
_cache.set(Class, Wrapper);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function Wrapper() {
|
|
147
|
+
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
148
|
+
}
|
|
97
149
|
|
|
98
|
-
|
|
150
|
+
Wrapper.prototype = Object.create(Class.prototype, {
|
|
151
|
+
constructor: {
|
|
152
|
+
value: Wrapper,
|
|
153
|
+
enumerable: false,
|
|
154
|
+
writable: true,
|
|
155
|
+
configurable: true
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return _setPrototypeOf(Wrapper, Class);
|
|
159
|
+
};
|
|
99
160
|
|
|
100
|
-
return
|
|
161
|
+
return _wrapNativeSuper(Class);
|
|
101
162
|
}
|
|
102
163
|
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
164
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
165
|
+
if (source == null) return {};
|
|
166
|
+
var target = {};
|
|
167
|
+
var sourceKeys = Object.keys(source);
|
|
168
|
+
var key, i;
|
|
106
169
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (i >= o.length) return {
|
|
112
|
-
done: true
|
|
113
|
-
};
|
|
114
|
-
return {
|
|
115
|
-
done: false,
|
|
116
|
-
value: o[i++]
|
|
117
|
-
};
|
|
118
|
-
};
|
|
170
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
171
|
+
key = sourceKeys[i];
|
|
172
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
173
|
+
target[key] = source[key];
|
|
119
174
|
}
|
|
120
175
|
|
|
121
|
-
|
|
176
|
+
return target;
|
|
122
177
|
}
|
|
123
178
|
|
|
124
179
|
var container = /*#__PURE__*/css({
|
|
@@ -498,7 +553,7 @@ function CombinedLinkActions(props) {
|
|
|
498
553
|
var hideEmptyCard = props.entityType === 'Asset' && !props.isEmpty;
|
|
499
554
|
return createElement("div", {
|
|
500
555
|
className: hideEmptyCard ? '' : container
|
|
501
|
-
}, !props.canCreateEntity && !props.canLinkEntity && createElement(NoLinkPermissionsInfo, null), props.entityType === 'Entry' && createElement(CombinedEntryLinkActions,
|
|
556
|
+
}, !props.canCreateEntity && !props.canLinkEntity && createElement(NoLinkPermissionsInfo, null), props.entityType === 'Entry' && createElement(CombinedEntryLinkActions, _extends({}, props)), props.entityType === 'Asset' && createElement(CombinedAssetLinkActions, _extends({}, props)));
|
|
502
557
|
}
|
|
503
558
|
|
|
504
559
|
function CombinedEntryLinkActions(props) {
|
|
@@ -1738,7 +1793,7 @@ function LinkEntityActions(_ref4) {
|
|
|
1738
1793
|
props = _objectWithoutPropertiesLoose(_ref4, _excluded);
|
|
1739
1794
|
|
|
1740
1795
|
var renderLinkActions = renderCustomActions ? renderCustomActions : function (props) {
|
|
1741
|
-
return createElement(LinkActions,
|
|
1796
|
+
return createElement(LinkActions, _extends({}, props));
|
|
1742
1797
|
};
|
|
1743
1798
|
return renderLinkActions(props);
|
|
1744
1799
|
}
|
|
@@ -1799,6 +1854,8 @@ var ScheduleTooltip = function ScheduleTooltip(_ref2) {
|
|
|
1799
1854
|
};
|
|
1800
1855
|
|
|
1801
1856
|
var ScheduledIconWithTooltip = function ScheduledIconWithTooltip(_ref) {
|
|
1857
|
+
var _status$jobs;
|
|
1858
|
+
|
|
1802
1859
|
var entityType = _ref.entityType,
|
|
1803
1860
|
entityId = _ref.entityId,
|
|
1804
1861
|
getEntityScheduledActions = _ref.getEntityScheduledActions,
|
|
@@ -1830,7 +1887,7 @@ var ScheduledIconWithTooltip = function ScheduledIconWithTooltip(_ref) {
|
|
|
1830
1887
|
return null;
|
|
1831
1888
|
}
|
|
1832
1889
|
|
|
1833
|
-
var jobs = status.jobs ?
|
|
1890
|
+
var jobs = (_status$jobs = status.jobs) != null ? _status$jobs : [];
|
|
1834
1891
|
|
|
1835
1892
|
if (jobs.length === 0) {
|
|
1836
1893
|
return null;
|
|
@@ -1856,502 +1913,426 @@ function AssetThumbnail(props) {
|
|
|
1856
1913
|
});
|
|
1857
1914
|
}
|
|
1858
1915
|
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
switch (action.type) {
|
|
1863
|
-
case 'set_entry':
|
|
1864
|
-
return _extends({}, state, {
|
|
1865
|
-
entries: _extends({}, state.entries, (_extends2 = {}, _extends2[action.id] = action.entry, _extends2))
|
|
1866
|
-
});
|
|
1867
|
-
|
|
1868
|
-
case 'set_entry_failed':
|
|
1869
|
-
return _extends({}, state, {
|
|
1870
|
-
entries: _extends({}, state.entries, (_extends3 = {}, _extends3[action.id] = 'failed', _extends3))
|
|
1871
|
-
});
|
|
1916
|
+
var _excluded$1 = ["priority"],
|
|
1917
|
+
_excluded2 = ["children"];
|
|
1872
1918
|
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
case 'set_asset_failed':
|
|
1879
|
-
return _extends({}, state, {
|
|
1880
|
-
assets: _extends({}, state.assets, (_extends5 = {}, _extends5[action.id] = 'failed', _extends5))
|
|
1881
|
-
});
|
|
1882
|
-
|
|
1883
|
-
case 'set_scheduled_actions':
|
|
1884
|
-
return _extends({}, state, {
|
|
1885
|
-
scheduledActions: _extends({}, state.scheduledActions, (_extends6 = {}, _extends6[action.key] = action.actions, _extends6))
|
|
1886
|
-
});
|
|
1919
|
+
var globalQueue = /*#__PURE__*/new PQueue({
|
|
1920
|
+
concurrency: 20
|
|
1921
|
+
});
|
|
1922
|
+
var UnsupportedError = /*#__PURE__*/function (_Error) {
|
|
1923
|
+
_inheritsLoose(UnsupportedError, _Error);
|
|
1887
1924
|
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
resources: _extends({}, state.resources, (_extends7 = {}, _extends7[action.resourceType + "." + action.urn] = action.resourceInfo, _extends7))
|
|
1891
|
-
});
|
|
1925
|
+
function UnsupportedError(message) {
|
|
1926
|
+
var _this;
|
|
1892
1927
|
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
default:
|
|
1899
|
-
return state;
|
|
1928
|
+
_this = _Error.call(this, message) || this;
|
|
1929
|
+
_this.isUnsupportedError = void 0;
|
|
1930
|
+
_this.isUnsupportedError = true;
|
|
1931
|
+
return _this;
|
|
1900
1932
|
}
|
|
1901
|
-
}
|
|
1902
1933
|
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
assets: {},
|
|
1906
|
-
scheduledActions: {},
|
|
1907
|
-
resources: {}
|
|
1908
|
-
};
|
|
1934
|
+
return UnsupportedError;
|
|
1935
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
1909
1936
|
|
|
1910
|
-
var
|
|
1911
|
-
return
|
|
1912
|
-
};
|
|
1913
|
-
|
|
1914
|
-
var nonNilResources = function nonNilResources(map) {
|
|
1915
|
-
return Object.entries(map).filter(function (_ref) {
|
|
1916
|
-
var value = _ref[1];
|
|
1917
|
-
return isNotNil(value);
|
|
1918
|
-
});
|
|
1937
|
+
var isEntityQueryKey = function isEntityQueryKey(queryKey) {
|
|
1938
|
+
return Array.isArray(queryKey) && (queryKey[0] === 'Entry' || queryKey[0] === 'Asset') && queryKey.length === 4;
|
|
1919
1939
|
};
|
|
1920
1940
|
|
|
1921
|
-
function
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
var _React$useState = useState(function () {
|
|
1926
|
-
return createClient({
|
|
1927
|
-
apiAdapter: props.sdk.cmaAdapter
|
|
1928
|
-
}, {
|
|
1929
|
-
type: 'plain'
|
|
1930
|
-
});
|
|
1931
|
-
}),
|
|
1932
|
-
cmaClient = _React$useState[0];
|
|
1933
|
-
|
|
1934
|
-
var _React$useReducer = useReducer(reducer, initialState),
|
|
1935
|
-
state = _React$useReducer[0],
|
|
1936
|
-
dispatch = _React$useReducer[1];
|
|
1937
|
-
|
|
1938
|
-
var loadEntityScheduledActions = useCallback(function (entityType, id) {
|
|
1939
|
-
var key = entityType + ":" + id;
|
|
1940
|
-
|
|
1941
|
-
if (state.scheduledActions[key]) {
|
|
1942
|
-
return Promise.resolve(state.scheduledActions[key]);
|
|
1943
|
-
}
|
|
1944
|
-
|
|
1945
|
-
return props.sdk.space.getEntityScheduledActions(entityType, id).then(function (data) {
|
|
1946
|
-
dispatch({
|
|
1947
|
-
type: 'set_scheduled_actions',
|
|
1948
|
-
key: key,
|
|
1949
|
-
actions: data
|
|
1950
|
-
});
|
|
1951
|
-
return data;
|
|
1952
|
-
})["catch"](function () {
|
|
1953
|
-
dispatch({
|
|
1954
|
-
type: 'set_scheduled_actions',
|
|
1955
|
-
key: key,
|
|
1956
|
-
actions: undefined
|
|
1957
|
-
});
|
|
1958
|
-
return [];
|
|
1959
|
-
});
|
|
1960
|
-
}, [props.sdk.space, state.scheduledActions]);
|
|
1961
|
-
var loadEntry = useCallback( /*#__PURE__*/function () {
|
|
1962
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(entryId) {
|
|
1963
|
-
var entry;
|
|
1964
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1965
|
-
while (1) {
|
|
1966
|
-
switch (_context.prev = _context.next) {
|
|
1967
|
-
case 0:
|
|
1968
|
-
_context.prev = 0;
|
|
1969
|
-
_context.next = 3;
|
|
1970
|
-
return cmaClient.entry.get({
|
|
1971
|
-
spaceId: spaceId,
|
|
1972
|
-
environmentId: environmentId,
|
|
1973
|
-
entryId: entryId
|
|
1974
|
-
});
|
|
1975
|
-
|
|
1976
|
-
case 3:
|
|
1977
|
-
entry = _context.sent;
|
|
1978
|
-
dispatch({
|
|
1979
|
-
type: 'set_entry',
|
|
1980
|
-
id: entryId,
|
|
1981
|
-
entry: entry
|
|
1982
|
-
});
|
|
1983
|
-
return _context.abrupt("return", entry);
|
|
1984
|
-
|
|
1985
|
-
case 8:
|
|
1986
|
-
_context.prev = 8;
|
|
1987
|
-
_context.t0 = _context["catch"](0);
|
|
1988
|
-
dispatch({
|
|
1989
|
-
type: 'set_entry_failed',
|
|
1990
|
-
id: entryId
|
|
1991
|
-
});
|
|
1992
|
-
return _context.abrupt("return");
|
|
1993
|
-
|
|
1994
|
-
case 12:
|
|
1995
|
-
case "end":
|
|
1996
|
-
return _context.stop();
|
|
1997
|
-
}
|
|
1998
|
-
}
|
|
1999
|
-
}, _callee, null, [[0, 8]]);
|
|
2000
|
-
}));
|
|
2001
|
-
|
|
2002
|
-
return function (_x) {
|
|
2003
|
-
return _ref2.apply(this, arguments);
|
|
2004
|
-
};
|
|
2005
|
-
}(), [cmaClient, spaceId, environmentId]);
|
|
2006
|
-
var getEntry = useCallback( /*#__PURE__*/function () {
|
|
2007
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(entryId) {
|
|
2008
|
-
var cachedEntry;
|
|
2009
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2010
|
-
while (1) {
|
|
2011
|
-
switch (_context2.prev = _context2.next) {
|
|
2012
|
-
case 0:
|
|
2013
|
-
cachedEntry = state.entries[entryId];
|
|
2014
|
-
|
|
2015
|
-
if (!isNotNil(cachedEntry)) {
|
|
2016
|
-
_context2.next = 3;
|
|
2017
|
-
break;
|
|
2018
|
-
}
|
|
2019
|
-
|
|
2020
|
-
return _context2.abrupt("return", cachedEntry);
|
|
2021
|
-
|
|
2022
|
-
case 3:
|
|
2023
|
-
return _context2.abrupt("return", loadEntry(entryId));
|
|
2024
|
-
|
|
2025
|
-
case 4:
|
|
2026
|
-
case "end":
|
|
2027
|
-
return _context2.stop();
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
}, _callee2);
|
|
2031
|
-
}));
|
|
2032
|
-
|
|
2033
|
-
return function (_x2) {
|
|
2034
|
-
return _ref3.apply(this, arguments);
|
|
2035
|
-
};
|
|
2036
|
-
}(), [loadEntry, state.entries]);
|
|
2037
|
-
var loadAsset = useCallback( /*#__PURE__*/function () {
|
|
2038
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(assetId) {
|
|
2039
|
-
var asset;
|
|
2040
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2041
|
-
while (1) {
|
|
2042
|
-
switch (_context3.prev = _context3.next) {
|
|
2043
|
-
case 0:
|
|
2044
|
-
_context3.prev = 0;
|
|
2045
|
-
_context3.next = 3;
|
|
2046
|
-
return cmaClient.asset.get({
|
|
2047
|
-
spaceId: spaceId,
|
|
2048
|
-
environmentId: environmentId,
|
|
2049
|
-
assetId: assetId
|
|
2050
|
-
});
|
|
2051
|
-
|
|
2052
|
-
case 3:
|
|
2053
|
-
asset = _context3.sent;
|
|
2054
|
-
dispatch({
|
|
2055
|
-
type: 'set_asset',
|
|
2056
|
-
id: assetId,
|
|
2057
|
-
asset: asset
|
|
2058
|
-
});
|
|
2059
|
-
return _context3.abrupt("return", asset);
|
|
2060
|
-
|
|
2061
|
-
case 8:
|
|
2062
|
-
_context3.prev = 8;
|
|
2063
|
-
_context3.t0 = _context3["catch"](0);
|
|
2064
|
-
dispatch({
|
|
2065
|
-
type: 'set_asset_failed',
|
|
2066
|
-
id: assetId
|
|
2067
|
-
});
|
|
2068
|
-
return _context3.abrupt("return");
|
|
2069
|
-
|
|
2070
|
-
case 12:
|
|
2071
|
-
case "end":
|
|
2072
|
-
return _context3.stop();
|
|
2073
|
-
}
|
|
2074
|
-
}
|
|
2075
|
-
}, _callee3, null, [[0, 8]]);
|
|
2076
|
-
}));
|
|
2077
|
-
|
|
2078
|
-
return function (_x3) {
|
|
2079
|
-
return _ref4.apply(this, arguments);
|
|
2080
|
-
};
|
|
2081
|
-
}(), [cmaClient, spaceId, environmentId]);
|
|
2082
|
-
var getAsset = useCallback( /*#__PURE__*/function () {
|
|
2083
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(assetId) {
|
|
2084
|
-
var cachedAsset;
|
|
2085
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2086
|
-
while (1) {
|
|
2087
|
-
switch (_context4.prev = _context4.next) {
|
|
2088
|
-
case 0:
|
|
2089
|
-
cachedAsset = state.assets[assetId];
|
|
2090
|
-
|
|
2091
|
-
if (!isNotNil(cachedAsset)) {
|
|
2092
|
-
_context4.next = 3;
|
|
2093
|
-
break;
|
|
2094
|
-
}
|
|
2095
|
-
|
|
2096
|
-
return _context4.abrupt("return", cachedAsset);
|
|
2097
|
-
|
|
2098
|
-
case 3:
|
|
2099
|
-
return _context4.abrupt("return", loadAsset(assetId));
|
|
2100
|
-
|
|
2101
|
-
case 4:
|
|
2102
|
-
case "end":
|
|
2103
|
-
return _context4.stop();
|
|
2104
|
-
}
|
|
2105
|
-
}
|
|
2106
|
-
}, _callee4);
|
|
2107
|
-
}));
|
|
2108
|
-
|
|
2109
|
-
return function (_x4) {
|
|
2110
|
-
return _ref5.apply(this, arguments);
|
|
2111
|
-
};
|
|
2112
|
-
}(), [loadAsset, state.assets]);
|
|
2113
|
-
var loadContentfulEntry = useCallback( /*#__PURE__*/function () {
|
|
2114
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(urn) {
|
|
2115
|
-
var _locales$items$find;
|
|
1941
|
+
function fetchContentfulEntry(_x) {
|
|
1942
|
+
return _fetchContentfulEntry.apply(this, arguments);
|
|
1943
|
+
}
|
|
2116
1944
|
|
|
2117
|
-
|
|
1945
|
+
function _fetchContentfulEntry() {
|
|
1946
|
+
_fetchContentfulEntry = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(params) {
|
|
1947
|
+
var urn, fetch, options, resourceId, _resourceId$split, spaceId, entryId, environmentId, _yield$Promise$all, space, entry, contentTypeId, _yield$Promise$all2, contentType, defaultLocaleCode;
|
|
2118
1948
|
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
1949
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1950
|
+
while (1) {
|
|
1951
|
+
switch (_context3.prev = _context3.next) {
|
|
1952
|
+
case 0:
|
|
1953
|
+
urn = params.urn, fetch = params.fetch, options = params.options;
|
|
1954
|
+
resourceId = urn.split(':', 6)[5];
|
|
1955
|
+
_resourceId$split = resourceId.split('/'), spaceId = _resourceId$split[1], entryId = _resourceId$split[3];
|
|
1956
|
+
environmentId = 'master';
|
|
1957
|
+
_context3.next = 6;
|
|
1958
|
+
return Promise.all([fetch(['space', spaceId], function (_ref9) {
|
|
1959
|
+
var cmaClient = _ref9.cmaClient;
|
|
2128
1960
|
return cmaClient.space.get({
|
|
2129
1961
|
spaceId: spaceId
|
|
2130
1962
|
});
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
_context5.t1 = _context5.sent;
|
|
2134
|
-
_context5.next = 9;
|
|
1963
|
+
}, options), fetch(['entry', spaceId, environmentId, entryId], function (_ref10) {
|
|
1964
|
+
var cmaClient = _ref10.cmaClient;
|
|
2135
1965
|
return cmaClient.entry.get({
|
|
2136
1966
|
spaceId: spaceId,
|
|
2137
1967
|
environmentId: environmentId,
|
|
2138
1968
|
entryId: entryId
|
|
2139
1969
|
});
|
|
1970
|
+
}, options)]);
|
|
2140
1971
|
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
space = _yield$Promise$all[0];
|
|
2150
|
-
entry = _yield$Promise$all[1];
|
|
2151
|
-
contentTypeId = entry.sys.contentType.sys.id;
|
|
2152
|
-
_context5.t4 = Promise;
|
|
2153
|
-
_context5.next = 20;
|
|
1972
|
+
case 6:
|
|
1973
|
+
_yield$Promise$all = _context3.sent;
|
|
1974
|
+
space = _yield$Promise$all[0];
|
|
1975
|
+
entry = _yield$Promise$all[1];
|
|
1976
|
+
contentTypeId = entry.sys.contentType.sys.id;
|
|
1977
|
+
_context3.next = 12;
|
|
1978
|
+
return Promise.all([fetch(['contentType', spaceId, environmentId, contentTypeId], function (_ref11) {
|
|
1979
|
+
var cmaClient = _ref11.cmaClient;
|
|
2154
1980
|
return cmaClient.contentType.get({
|
|
2155
1981
|
contentTypeId: contentTypeId,
|
|
2156
1982
|
spaceId: spaceId,
|
|
2157
1983
|
environmentId: environmentId
|
|
2158
1984
|
});
|
|
1985
|
+
}, options), fetch(['defaultLocale', spaceId, environmentId], /*#__PURE__*/function () {
|
|
1986
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(_ref12) {
|
|
1987
|
+
var _locales$items$find;
|
|
2159
1988
|
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
1989
|
+
var cmaClient, locales, defaultLocaleCode;
|
|
1990
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1991
|
+
while (1) {
|
|
1992
|
+
switch (_context2.prev = _context2.next) {
|
|
1993
|
+
case 0:
|
|
1994
|
+
cmaClient = _ref12.cmaClient;
|
|
1995
|
+
_context2.next = 3;
|
|
1996
|
+
return cmaClient.locale.getMany({
|
|
1997
|
+
spaceId: spaceId,
|
|
1998
|
+
environmentId: environmentId,
|
|
1999
|
+
query: {
|
|
2000
|
+
limit: 100
|
|
2001
|
+
}
|
|
2002
|
+
});
|
|
2003
|
+
|
|
2004
|
+
case 3:
|
|
2005
|
+
locales = _context2.sent;
|
|
2006
|
+
defaultLocaleCode = (_locales$items$find = locales.items.find(function (locale) {
|
|
2007
|
+
return locale["default"];
|
|
2008
|
+
})) == null ? void 0 : _locales$items$find.code;
|
|
2009
|
+
return _context2.abrupt("return", defaultLocaleCode);
|
|
2170
2010
|
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
_yield$Promise$all2 = _context5.sent;
|
|
2179
|
-
contentType = _yield$Promise$all2[0];
|
|
2180
|
-
locales = _yield$Promise$all2[1];
|
|
2181
|
-
defaultLocaleCode = (_locales$items$find = locales.items.find(function (locale) {
|
|
2182
|
-
return locale["default"];
|
|
2183
|
-
})) == null ? void 0 : _locales$items$find.code;
|
|
2184
|
-
return _context5.abrupt("return", {
|
|
2185
|
-
resource: entry,
|
|
2186
|
-
defaultLocaleCode: defaultLocaleCode,
|
|
2187
|
-
space: space,
|
|
2188
|
-
contentType: contentType
|
|
2189
|
-
});
|
|
2011
|
+
case 6:
|
|
2012
|
+
case "end":
|
|
2013
|
+
return _context2.stop();
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
}, _callee2);
|
|
2017
|
+
}));
|
|
2190
2018
|
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2019
|
+
return function (_x3) {
|
|
2020
|
+
return _ref13.apply(this, arguments);
|
|
2021
|
+
};
|
|
2022
|
+
}(), options)]);
|
|
2023
|
+
|
|
2024
|
+
case 12:
|
|
2025
|
+
_yield$Promise$all2 = _context3.sent;
|
|
2026
|
+
contentType = _yield$Promise$all2[0];
|
|
2027
|
+
defaultLocaleCode = _yield$Promise$all2[1];
|
|
2028
|
+
return _context3.abrupt("return", {
|
|
2029
|
+
defaultLocaleCode: defaultLocaleCode,
|
|
2030
|
+
resource: entry,
|
|
2031
|
+
space: space,
|
|
2032
|
+
contentType: contentType
|
|
2033
|
+
});
|
|
2198
2034
|
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
switch (_context6.prev = _context6.next) {
|
|
2209
|
-
case 0:
|
|
2210
|
-
cachedResource = state.resources[resourceType + "." + urn];
|
|
2035
|
+
case 16:
|
|
2036
|
+
case "end":
|
|
2037
|
+
return _context3.stop();
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
}, _callee3);
|
|
2041
|
+
}));
|
|
2042
|
+
return _fetchContentfulEntry.apply(this, arguments);
|
|
2043
|
+
}
|
|
2211
2044
|
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2045
|
+
var _constate = /*#__PURE__*/constate(function useInitServices(props) {
|
|
2046
|
+
var currentSpaceId = props.sdk.ids.space;
|
|
2047
|
+
var currentEnvironmentId = props.sdk.ids.environment;
|
|
2048
|
+
var queryClient = useQueryClient();
|
|
2049
|
+
var queryCache = queryClient.getQueryCache();
|
|
2050
|
+
var entityChangeUnsubscribers = useRef({});
|
|
2051
|
+
var cmaClient = useMemo(function () {
|
|
2052
|
+
return createClient({
|
|
2053
|
+
apiAdapter: props.sdk.cmaAdapter
|
|
2054
|
+
}, {
|
|
2055
|
+
type: 'plain'
|
|
2056
|
+
});
|
|
2057
|
+
}, [props.sdk.cmaAdapter]);
|
|
2058
|
+
var queryQueue = useMemo(function () {
|
|
2059
|
+
if (props.queryConcurrency) {
|
|
2060
|
+
return new PQueue({
|
|
2061
|
+
concurrency: props.queryConcurrency
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2216
2064
|
|
|
2217
|
-
|
|
2065
|
+
return globalQueue;
|
|
2066
|
+
}, [props.queryConcurrency]);
|
|
2067
|
+
var fetch = useCallback(function fetch(queryKey, fn, options) {
|
|
2068
|
+
if (options === void 0) {
|
|
2069
|
+
options = {};
|
|
2070
|
+
}
|
|
2218
2071
|
|
|
2219
|
-
|
|
2220
|
-
|
|
2072
|
+
var _options = options,
|
|
2073
|
+
priority = _options.priority,
|
|
2074
|
+
queryOptions = _objectWithoutPropertiesLoose(_options, _excluded$1);
|
|
2221
2075
|
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2076
|
+
return queryClient.fetchQuery(queryKey, function () {
|
|
2077
|
+
return queryQueue.add(function () {
|
|
2078
|
+
return fn({
|
|
2079
|
+
cmaClient: cmaClient
|
|
2080
|
+
});
|
|
2081
|
+
}, {
|
|
2082
|
+
priority: priority
|
|
2083
|
+
});
|
|
2084
|
+
}, queryOptions);
|
|
2085
|
+
}, [queryClient, queryQueue, cmaClient]);
|
|
2086
|
+
var getEntity = useCallback(function getEntity(entityType, entityId, options) {
|
|
2087
|
+
var _options$spaceId, _options$environmentI;
|
|
2088
|
+
|
|
2089
|
+
var spaceId = (_options$spaceId = options == null ? void 0 : options.spaceId) != null ? _options$spaceId : currentSpaceId;
|
|
2090
|
+
var environmentId = (_options$environmentI = options == null ? void 0 : options.environmentId) != null ? _options$environmentI : currentEnvironmentId;
|
|
2091
|
+
var queryKey = [entityType, entityId, spaceId, environmentId];
|
|
2092
|
+
return fetch(queryKey, function (_ref) {
|
|
2093
|
+
var cmaClient = _ref.cmaClient;
|
|
2094
|
+
|
|
2095
|
+
if (entityType === 'Entry') {
|
|
2096
|
+
return cmaClient.entry.get({
|
|
2097
|
+
entryId: entityId,
|
|
2098
|
+
spaceId: spaceId,
|
|
2099
|
+
environmentId: environmentId
|
|
2100
|
+
});
|
|
2101
|
+
}
|
|
2226
2102
|
|
|
2227
|
-
|
|
2228
|
-
|
|
2103
|
+
if (entityType === 'Asset') {
|
|
2104
|
+
return cmaClient.asset.get({
|
|
2105
|
+
assetId: entityId,
|
|
2106
|
+
spaceId: spaceId,
|
|
2107
|
+
environmentId: environmentId
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2229
2110
|
|
|
2230
|
-
|
|
2231
|
-
|
|
2111
|
+
throw new UnsupportedError('Unsupported entity type');
|
|
2112
|
+
}, options);
|
|
2113
|
+
}, [fetch, currentSpaceId, currentEnvironmentId]);
|
|
2114
|
+
var getEntityScheduledActions = useCallback(function getEntityScheduledActions(entityType, entityId, options) {
|
|
2115
|
+
var _options$spaceId2, _options$environmentI2;
|
|
2116
|
+
|
|
2117
|
+
var spaceId = (_options$spaceId2 = options == null ? void 0 : options.spaceId) != null ? _options$spaceId2 : currentSpaceId;
|
|
2118
|
+
var environmentId = (_options$environmentI2 = options == null ? void 0 : options.environmentId) != null ? _options$environmentI2 : currentEnvironmentId;
|
|
2119
|
+
var queryKey = ['scheduled-actions', entityType, entityId, spaceId, environmentId];
|
|
2120
|
+
return fetch(queryKey, /*#__PURE__*/function () {
|
|
2121
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
|
|
2122
|
+
var cmaClient, response;
|
|
2123
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
2124
|
+
while (1) {
|
|
2125
|
+
switch (_context.prev = _context.next) {
|
|
2126
|
+
case 0:
|
|
2127
|
+
cmaClient = _ref2.cmaClient;
|
|
2128
|
+
_context.next = 3;
|
|
2129
|
+
return cmaClient.scheduledActions.getMany({
|
|
2130
|
+
spaceId: spaceId,
|
|
2131
|
+
query: {
|
|
2132
|
+
'environment.sys.id': environmentId,
|
|
2133
|
+
'entity.sys.id': entityId,
|
|
2134
|
+
'sys.status[in]': 'scheduled',
|
|
2135
|
+
order: 'scheduledFor.datetime'
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
2232
2138
|
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
resourceType: resourceType,
|
|
2237
|
-
urn: urn,
|
|
2238
|
-
resourceInfo: resourceInfo
|
|
2239
|
-
});
|
|
2240
|
-
return _context6.abrupt("return", resourceInfo);
|
|
2241
|
-
|
|
2242
|
-
case 12:
|
|
2243
|
-
_context6.prev = 12;
|
|
2244
|
-
_context6.t0 = _context6["catch"](3);
|
|
2245
|
-
dispatch({
|
|
2246
|
-
type: 'set_resource_failed',
|
|
2247
|
-
resourceType: resourceType,
|
|
2248
|
-
urn: urn
|
|
2249
|
-
});
|
|
2250
|
-
return _context6.abrupt("return");
|
|
2139
|
+
case 3:
|
|
2140
|
+
response = _context.sent;
|
|
2141
|
+
return _context.abrupt("return", response.items);
|
|
2251
2142
|
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2143
|
+
case 5:
|
|
2144
|
+
case "end":
|
|
2145
|
+
return _context.stop();
|
|
2146
|
+
}
|
|
2255
2147
|
}
|
|
2256
|
-
}
|
|
2257
|
-
}
|
|
2258
|
-
}));
|
|
2148
|
+
}, _callee);
|
|
2149
|
+
}));
|
|
2259
2150
|
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
};
|
|
2263
|
-
}(), [loadContentfulEntry, state.resources]);
|
|
2264
|
-
useEffect(function () {
|
|
2265
|
-
// @ts-expect-error
|
|
2266
|
-
if (typeof props.sdk.space.onEntityChanged !== 'undefined') {
|
|
2267
|
-
// @ts-expect-error
|
|
2268
|
-
var onEntityChanged = props.sdk.space.onEntityChanged;
|
|
2269
|
-
var listeners = [];
|
|
2270
|
-
|
|
2271
|
-
var _loop = function _loop() {
|
|
2272
|
-
var _step$value = _step.value,
|
|
2273
|
-
id = _step$value[0];
|
|
2274
|
-
listeners.push(onEntityChanged('Entry', id, function (entry) {
|
|
2275
|
-
return dispatch({
|
|
2276
|
-
type: 'set_entry',
|
|
2277
|
-
id: id,
|
|
2278
|
-
entry: entry
|
|
2279
|
-
});
|
|
2280
|
-
}));
|
|
2151
|
+
return function (_x2) {
|
|
2152
|
+
return _ref3.apply(this, arguments);
|
|
2281
2153
|
};
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2154
|
+
}(), options);
|
|
2155
|
+
}, [fetch, currentSpaceId, currentEnvironmentId]);
|
|
2156
|
+
var getResource = useCallback(function getResource(resourceType, urn, options) {
|
|
2157
|
+
var queryKey = ['Resource', resourceType, urn];
|
|
2158
|
+
return fetch(queryKey, function () {
|
|
2159
|
+
if (resourceType === 'Contentful:Entry') {
|
|
2160
|
+
return fetchContentfulEntry({
|
|
2161
|
+
fetch: fetch,
|
|
2162
|
+
urn: urn,
|
|
2163
|
+
options: options
|
|
2164
|
+
});
|
|
2285
2165
|
}
|
|
2286
2166
|
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2167
|
+
throw new UnsupportedError('Unsupported resource type');
|
|
2168
|
+
}, options);
|
|
2169
|
+
}, [fetch]);
|
|
2170
|
+
var isSameSpaceEntityQueryKey = useCallback(function (queryKey) {
|
|
2171
|
+
var isEntityKey = isEntityQueryKey(queryKey);
|
|
2172
|
+
var isSameSpaceEntityKey = isEntityKey && queryKey[2] === currentSpaceId && queryKey[3] === currentEnvironmentId;
|
|
2173
|
+
return isSameSpaceEntityKey;
|
|
2174
|
+
}, [currentSpaceId, currentEnvironmentId]); // @ts-expect-error ...
|
|
2175
|
+
|
|
2176
|
+
// @ts-expect-error ...
|
|
2177
|
+
var onEntityChanged = props.sdk.space.onEntityChanged;
|
|
2178
|
+
useEffect(function () {
|
|
2179
|
+
if (typeof onEntityChanged !== 'function') {
|
|
2180
|
+
return;
|
|
2181
|
+
}
|
|
2298
2182
|
|
|
2299
|
-
|
|
2300
|
-
|
|
2183
|
+
var subscribeQuery = function subscribeQuery(_ref4) {
|
|
2184
|
+
var queryKey = _ref4.queryKey,
|
|
2185
|
+
queryHash = _ref4.queryHash;
|
|
2186
|
+
var entityType = queryKey[0],
|
|
2187
|
+
entityId = queryKey[1];
|
|
2188
|
+
entityChangeUnsubscribers.current[queryHash] = onEntityChanged(entityType, entityId, function (data) {
|
|
2189
|
+
queryClient.setQueryData(queryKey, data);
|
|
2190
|
+
});
|
|
2191
|
+
};
|
|
2192
|
+
|
|
2193
|
+
var queries = queryCache.findAll({
|
|
2194
|
+
type: 'active',
|
|
2195
|
+
predicate: function predicate(query) {
|
|
2196
|
+
return isSameSpaceEntityQueryKey(query.queryKey);
|
|
2197
|
+
}
|
|
2198
|
+
});
|
|
2199
|
+
queries.forEach(subscribeQuery);
|
|
2200
|
+
var unsubscribe = queryCache.subscribe(function (event) {
|
|
2201
|
+
if (!event) {
|
|
2202
|
+
return;
|
|
2301
2203
|
}
|
|
2302
2204
|
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
};
|
|
2308
|
-
}
|
|
2205
|
+
var type = event.type,
|
|
2206
|
+
query = event.query;
|
|
2207
|
+
var queryKey = query.queryKey,
|
|
2208
|
+
queryHash = query.queryHash;
|
|
2309
2209
|
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2210
|
+
if (!isSameSpaceEntityQueryKey(queryKey)) {
|
|
2211
|
+
return;
|
|
2212
|
+
}
|
|
2313
2213
|
|
|
2314
|
-
if (
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
id = _step3$value[0];
|
|
2318
|
-
loadEntry(id);
|
|
2319
|
-
}
|
|
2214
|
+
if (type === 'added') {
|
|
2215
|
+
subscribeQuery(query);
|
|
2216
|
+
}
|
|
2320
2217
|
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2218
|
+
if (type === 'removed') {
|
|
2219
|
+
var _entityChangeUnsubscr, _entityChangeUnsubscr2;
|
|
2220
|
+
|
|
2221
|
+
// calling unsubscribe
|
|
2222
|
+
(_entityChangeUnsubscr = (_entityChangeUnsubscr2 = entityChangeUnsubscribers.current)[queryHash]) == null ? void 0 : _entityChangeUnsubscr.call(_entityChangeUnsubscr2);
|
|
2326
2223
|
}
|
|
2327
|
-
});
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
getOrLoadEntry: getEntry,
|
|
2335
|
-
|
|
2336
|
-
/**
|
|
2337
|
-
* @deprecated use `getAsset` instead
|
|
2338
|
-
*/
|
|
2339
|
-
getOrLoadAsset: getAsset,
|
|
2340
|
-
getResource: getResource,
|
|
2341
|
-
getEntry: getEntry,
|
|
2342
|
-
getAsset: getAsset,
|
|
2343
|
-
loadEntityScheduledActions: loadEntityScheduledActions,
|
|
2344
|
-
entries: state.entries,
|
|
2345
|
-
assets: state.assets,
|
|
2346
|
-
scheduledActions: state.scheduledActions,
|
|
2347
|
-
resources: state.resources
|
|
2224
|
+
});
|
|
2225
|
+
return function () {
|
|
2226
|
+
unsubscribe();
|
|
2227
|
+
Object.values(entityChangeUnsubscribers.current).forEach(function (off) {
|
|
2228
|
+
return off();
|
|
2229
|
+
});
|
|
2230
|
+
entityChangeUnsubscribers.current = {};
|
|
2348
2231
|
};
|
|
2349
|
-
}, [
|
|
2232
|
+
}, [onEntityChanged, queryCache, isSameSpaceEntityQueryKey, queryClient]);
|
|
2233
|
+
return {
|
|
2234
|
+
cmaClient: cmaClient,
|
|
2235
|
+
fetch: fetch,
|
|
2236
|
+
getResource: getResource,
|
|
2237
|
+
getEntity: getEntity,
|
|
2238
|
+
ids: props.sdk.ids,
|
|
2239
|
+
getEntityScheduledActions: getEntityScheduledActions
|
|
2240
|
+
};
|
|
2241
|
+
}, function (_ref5) {
|
|
2242
|
+
var fetch = _ref5.fetch;
|
|
2243
|
+
return fetch;
|
|
2244
|
+
}, function (_ref6) {
|
|
2245
|
+
var getResource = _ref6.getResource,
|
|
2246
|
+
getEntity = _ref6.getEntity,
|
|
2247
|
+
getEntityScheduledActions = _ref6.getEntityScheduledActions;
|
|
2248
|
+
return {
|
|
2249
|
+
getResource: getResource,
|
|
2250
|
+
getEntity: getEntity,
|
|
2251
|
+
getEntityScheduledActions: getEntityScheduledActions
|
|
2252
|
+
};
|
|
2253
|
+
}, function (_ref7) {
|
|
2254
|
+
var ids = _ref7.ids;
|
|
2255
|
+
return ids;
|
|
2256
|
+
}),
|
|
2257
|
+
InternalServiceProvider = _constate[0],
|
|
2258
|
+
useEntityLoader = _constate[2],
|
|
2259
|
+
useCurrentIds = _constate[3];
|
|
2260
|
+
|
|
2261
|
+
function useEntity(entityType, entityId, options) {
|
|
2262
|
+
var _options$spaceId3, _options$environmentI3;
|
|
2263
|
+
|
|
2264
|
+
var _useCurrentIds = useCurrentIds(),
|
|
2265
|
+
space = _useCurrentIds.space,
|
|
2266
|
+
environment = _useCurrentIds.environment;
|
|
2267
|
+
|
|
2268
|
+
var _useEntityLoader = useEntityLoader(),
|
|
2269
|
+
getEntity = _useEntityLoader.getEntity;
|
|
2270
|
+
|
|
2271
|
+
var queryKey = [entityType, entityId, (_options$spaceId3 = options == null ? void 0 : options.spaceId) != null ? _options$spaceId3 : space, (_options$environmentI3 = options == null ? void 0 : options.environmentId) != null ? _options$environmentI3 : environment];
|
|
2272
|
+
|
|
2273
|
+
var _useQuery = useQuery(queryKey, function () {
|
|
2274
|
+
return getEntity(entityType, entityId, options);
|
|
2275
|
+
}, {
|
|
2276
|
+
enabled: options == null ? void 0 : options.enabled,
|
|
2277
|
+
useErrorBoundary: false
|
|
2278
|
+
}),
|
|
2279
|
+
status = _useQuery.status,
|
|
2280
|
+
data = _useQuery.data;
|
|
2281
|
+
|
|
2282
|
+
return {
|
|
2283
|
+
status: status,
|
|
2284
|
+
data: data
|
|
2285
|
+
};
|
|
2350
2286
|
}
|
|
2287
|
+
function useResource(resourceType, urn, options) {
|
|
2288
|
+
var queryKey = ['Resource', resourceType, urn];
|
|
2289
|
+
|
|
2290
|
+
var _useEntityLoader2 = useEntityLoader(),
|
|
2291
|
+
getResource = _useEntityLoader2.getResource;
|
|
2292
|
+
|
|
2293
|
+
var _useQuery2 = useQuery(queryKey, function () {
|
|
2294
|
+
return getResource(resourceType, urn, options);
|
|
2295
|
+
}, {
|
|
2296
|
+
enabled: options == null ? void 0 : options.enabled,
|
|
2297
|
+
// TODO: check if this is ok for all errors
|
|
2298
|
+
useErrorBoundary: false
|
|
2299
|
+
}),
|
|
2300
|
+
status = _useQuery2.status,
|
|
2301
|
+
data = _useQuery2.data,
|
|
2302
|
+
error = _useQuery2.error;
|
|
2351
2303
|
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2304
|
+
return {
|
|
2305
|
+
status: status,
|
|
2306
|
+
data: data,
|
|
2307
|
+
error: error
|
|
2308
|
+
};
|
|
2309
|
+
}
|
|
2310
|
+
|
|
2311
|
+
function EntityProvider(_ref8) {
|
|
2312
|
+
var children = _ref8.children,
|
|
2313
|
+
props = _objectWithoutPropertiesLoose(_ref8, _excluded2);
|
|
2314
|
+
|
|
2315
|
+
var reactQueryClient = useMemo(function () {
|
|
2316
|
+
var queryCache = new QueryCache();
|
|
2317
|
+
var queryClient = new QueryClient({
|
|
2318
|
+
queryCache: queryCache,
|
|
2319
|
+
defaultOptions: {
|
|
2320
|
+
queries: {
|
|
2321
|
+
useErrorBoundary: true,
|
|
2322
|
+
refetchOnWindowFocus: false,
|
|
2323
|
+
refetchOnReconnect: true,
|
|
2324
|
+
refetchOnMount: false,
|
|
2325
|
+
staleTime: Infinity,
|
|
2326
|
+
retry: false
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
});
|
|
2330
|
+
return queryClient;
|
|
2331
|
+
}, []);
|
|
2332
|
+
return React__default.createElement(QueryClientProvider, {
|
|
2333
|
+
client: reactQueryClient
|
|
2334
|
+
}, React__default.createElement(InternalServiceProvider, _extends({}, props), children));
|
|
2335
|
+
}
|
|
2355
2336
|
|
|
2356
2337
|
function ReferenceEditor(props) {
|
|
2357
2338
|
return createElement(EntityProvider, {
|
|
@@ -2573,7 +2554,10 @@ function fromFieldValidations(field) {
|
|
|
2573
2554
|
var result = {
|
|
2574
2555
|
contentTypes: (_linkContentTypeValid = linkContentTypeValidations == null ? void 0 : linkContentTypeValidations.linkContentType) != null ? _linkContentTypeValid : undefined,
|
|
2575
2556
|
mimetypeGroups: (_linkMimetypeGroupVal = linkMimetypeGroupValidations == null ? void 0 : linkMimetypeGroupValidations.linkMimetypeGroup) != null ? _linkMimetypeGroupVal : undefined,
|
|
2576
|
-
numberOfLinks: numberOfLinks
|
|
2557
|
+
numberOfLinks: numberOfLinks // todo: there are multiple BE problems that need to be solved first, for now we don't want to apply size constraints
|
|
2558
|
+
// linkedFileSize: findValidation(field, 'assetFileSize', {}),
|
|
2559
|
+
// linkedImageDimensions: findValidation(field, 'assetImageDimensions', {})
|
|
2560
|
+
|
|
2577
2561
|
};
|
|
2578
2562
|
return result;
|
|
2579
2563
|
}
|
|
@@ -2772,7 +2756,7 @@ function Editor(props) {
|
|
|
2772
2756
|
[linkActionsProps]);
|
|
2773
2757
|
|
|
2774
2758
|
if (!props.entityId) {
|
|
2775
|
-
return createElement(LinkEntityActions,
|
|
2759
|
+
return createElement(LinkEntityActions, _extends({
|
|
2776
2760
|
renderCustomActions: props.renderCustomActions
|
|
2777
2761
|
}, linkActionsProps));
|
|
2778
2762
|
}
|
|
@@ -2784,12 +2768,12 @@ function Editor(props) {
|
|
|
2784
2768
|
|
|
2785
2769
|
function SingleReferenceEditor(props) {
|
|
2786
2770
|
var allContentTypes = props.sdk.space.getCachedContentTypes();
|
|
2787
|
-
return createElement(ReferenceEditor,
|
|
2771
|
+
return createElement(ReferenceEditor, _extends({}, props), function (_ref) {
|
|
2788
2772
|
var value = _ref.value,
|
|
2789
2773
|
setValue = _ref.setValue,
|
|
2790
2774
|
disabled = _ref.disabled,
|
|
2791
2775
|
externalReset = _ref.externalReset;
|
|
2792
|
-
return createElement(Editor,
|
|
2776
|
+
return createElement(Editor, _extends({}, props, {
|
|
2793
2777
|
key: externalReset + "-reference",
|
|
2794
2778
|
entityId: value ? value.sys.id : '',
|
|
2795
2779
|
isDisabled: disabled,
|
|
@@ -3019,18 +3003,24 @@ function _openEntry() {
|
|
|
3019
3003
|
}
|
|
3020
3004
|
|
|
3021
3005
|
function FetchingWrappedEntryCard(props) {
|
|
3022
|
-
var
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions,
|
|
3026
|
-
entries = _useEntities.entries;
|
|
3006
|
+
var _useEntity = useEntity('Entry', props.entryId),
|
|
3007
|
+
entry = _useEntity.data,
|
|
3008
|
+
status = _useEntity.status;
|
|
3027
3009
|
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3010
|
+
var _useEntityLoader = useEntityLoader(),
|
|
3011
|
+
getEntityScheduledActions = _useEntityLoader.getEntityScheduledActions;
|
|
3012
|
+
|
|
3013
|
+
var loadEntityScheduledActions = useCallback(function () {
|
|
3014
|
+
return getEntityScheduledActions('Entry', props.entryId);
|
|
3015
|
+
}, [getEntityScheduledActions, props.entryId]);
|
|
3031
3016
|
var size = props.viewType === 'link' ? 'small' : 'default';
|
|
3032
|
-
|
|
3033
|
-
var
|
|
3017
|
+
|
|
3018
|
+
var _useEntityLoader2 = useEntityLoader(),
|
|
3019
|
+
getEntity = _useEntityLoader2.getEntity;
|
|
3020
|
+
|
|
3021
|
+
var getAsset = function getAsset(assetId) {
|
|
3022
|
+
return getEntity('Asset', assetId);
|
|
3023
|
+
};
|
|
3034
3024
|
|
|
3035
3025
|
var onEdit = /*#__PURE__*/function () {
|
|
3036
3026
|
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
@@ -3088,7 +3078,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
3088
3078
|
|
|
3089
3079
|
}, [entry]);
|
|
3090
3080
|
return useMemo(function () {
|
|
3091
|
-
if (
|
|
3081
|
+
if (status === 'error') {
|
|
3092
3082
|
var card = createElement(MissingEntityCard, {
|
|
3093
3083
|
entityType: "Entry",
|
|
3094
3084
|
isDisabled: props.isDisabled,
|
|
@@ -3108,7 +3098,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
3108
3098
|
return card;
|
|
3109
3099
|
}
|
|
3110
3100
|
|
|
3111
|
-
if (
|
|
3101
|
+
if (status === 'loading') {
|
|
3112
3102
|
return createElement(EntryCard, {
|
|
3113
3103
|
size: size,
|
|
3114
3104
|
isLoading: true
|
|
@@ -3147,7 +3137,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
3147
3137
|
entryUrl: (props == null ? void 0 : props.entityUrl) || sharedCardProps.entityUrl
|
|
3148
3138
|
});
|
|
3149
3139
|
|
|
3150
|
-
return createElement(WrappedEntryCard,
|
|
3140
|
+
return createElement(WrappedEntryCard, _extends({}, builtinCardProps));
|
|
3151
3141
|
}
|
|
3152
3142
|
|
|
3153
3143
|
if (props.renderCustomCard) {
|
|
@@ -3160,11 +3150,11 @@ function FetchingWrappedEntryCard(props) {
|
|
|
3160
3150
|
}
|
|
3161
3151
|
|
|
3162
3152
|
return renderDefaultCard(); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
3163
|
-
}, [props,
|
|
3153
|
+
}, [props, status, entry]);
|
|
3164
3154
|
}
|
|
3165
3155
|
|
|
3166
3156
|
function SingleEntryReferenceEditor(props) {
|
|
3167
|
-
return createElement(SingleReferenceEditor,
|
|
3157
|
+
return createElement(SingleReferenceEditor, _extends({}, props, {
|
|
3168
3158
|
entityType: "Entry"
|
|
3169
3159
|
}), function (_ref) {
|
|
3170
3160
|
var allContentTypes = _ref.allContentTypes,
|
|
@@ -3174,7 +3164,7 @@ function SingleEntryReferenceEditor(props) {
|
|
|
3174
3164
|
renderCustomCard = _ref.renderCustomCard,
|
|
3175
3165
|
hasCardRemoveActions = _ref.hasCardRemoveActions,
|
|
3176
3166
|
hasCardEditActions = _ref.hasCardEditActions;
|
|
3177
|
-
return createElement(FetchingWrappedEntryCard,
|
|
3167
|
+
return createElement(FetchingWrappedEntryCard, _extends({}, props, {
|
|
3178
3168
|
allContentTypes: allContentTypes,
|
|
3179
3169
|
isDisabled: isDisabled,
|
|
3180
3170
|
entryId: entityId,
|
|
@@ -3265,19 +3255,19 @@ function Editor$1(props) {
|
|
|
3265
3255
|
onSortEnd: onSortEnd,
|
|
3266
3256
|
onMove: onMove,
|
|
3267
3257
|
renderCustomCard: props.renderCustomCard && customCardRenderer
|
|
3268
|
-
})), createElement(LinkEntityActions,
|
|
3258
|
+
})), createElement(LinkEntityActions, _extends({
|
|
3269
3259
|
renderCustomActions: props.renderCustomActions
|
|
3270
3260
|
}, linkActionsProps)));
|
|
3271
3261
|
}
|
|
3272
3262
|
|
|
3273
3263
|
function MultipleReferenceEditor(props) {
|
|
3274
3264
|
var allContentTypes = props.sdk.space.getCachedContentTypes();
|
|
3275
|
-
return createElement(ReferenceEditor,
|
|
3265
|
+
return createElement(ReferenceEditor, _extends({}, props), function (_ref2) {
|
|
3276
3266
|
var value = _ref2.value,
|
|
3277
3267
|
disabled = _ref2.disabled,
|
|
3278
3268
|
setValue = _ref2.setValue,
|
|
3279
3269
|
externalReset = _ref2.externalReset;
|
|
3280
|
-
return createElement(Editor$1,
|
|
3270
|
+
return createElement(Editor$1, _extends({}, props, {
|
|
3281
3271
|
items: value || emptyArray,
|
|
3282
3272
|
isDisabled: disabled,
|
|
3283
3273
|
setValue: setValue,
|
|
@@ -3334,16 +3324,16 @@ var SortableLinkListInternal = /*#__PURE__*/SortableContainer(function (props) {
|
|
|
3334
3324
|
function SortableLinkList(props) {
|
|
3335
3325
|
// with the default distance of 0 the drag start event is "confused" with the click event,
|
|
3336
3326
|
// so the latter one isn't fired and click handlers on child elements don't work
|
|
3337
|
-
return React__default.createElement(SortableLinkListInternal,
|
|
3327
|
+
return React__default.createElement(SortableLinkListInternal, _extends({
|
|
3338
3328
|
distance: 1
|
|
3339
3329
|
}, props), props.children);
|
|
3340
3330
|
}
|
|
3341
3331
|
|
|
3342
3332
|
function MultipleEntryReferenceEditor(props) {
|
|
3343
|
-
return createElement(MultipleReferenceEditor,
|
|
3333
|
+
return createElement(MultipleReferenceEditor, _extends({}, props, {
|
|
3344
3334
|
entityType: "Entry"
|
|
3345
3335
|
}), function (childrenProps) {
|
|
3346
|
-
return createElement(SortableLinkList,
|
|
3336
|
+
return createElement(SortableLinkList, _extends({}, childrenProps, {
|
|
3347
3337
|
axis: "y",
|
|
3348
3338
|
useDragHandle: true
|
|
3349
3339
|
}), function (_ref) {
|
|
@@ -3353,7 +3343,7 @@ function MultipleEntryReferenceEditor(props) {
|
|
|
3353
3343
|
isDisabled = _ref.isDisabled,
|
|
3354
3344
|
DragHandle = _ref.DragHandle;
|
|
3355
3345
|
var lastIndex = items.length - 1;
|
|
3356
|
-
return createElement(FetchingWrappedEntryCard,
|
|
3346
|
+
return createElement(FetchingWrappedEntryCard, _extends({}, childrenProps, {
|
|
3357
3347
|
key: item.sys.id + "-" + index,
|
|
3358
3348
|
index: index,
|
|
3359
3349
|
allContentTypes: childrenProps.allContentTypes,
|
|
@@ -3608,20 +3598,16 @@ var WrappedAssetLink = function WrappedAssetLink(props) {
|
|
|
3608
3598
|
};
|
|
3609
3599
|
|
|
3610
3600
|
function FetchingWrappedAssetCard(props) {
|
|
3611
|
-
var
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
assets = _useEntities.assets;
|
|
3601
|
+
var _useEntity = useEntity('Asset', props.assetId),
|
|
3602
|
+
asset = _useEntity.data,
|
|
3603
|
+
status = _useEntity.status;
|
|
3615
3604
|
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
return;
|
|
3619
|
-
}
|
|
3605
|
+
var _useEntityLoader = useEntityLoader(),
|
|
3606
|
+
getEntityScheduledActions = _useEntityLoader.getEntityScheduledActions;
|
|
3620
3607
|
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
var entityKey = asset === 'failed' ? 'failed' : asset === undefined ? 'undefined' : ":" + asset.sys.id + ":" + asset.sys.version;
|
|
3608
|
+
var loadEntityScheduledActions = useCallback(function () {
|
|
3609
|
+
return getEntityScheduledActions('Asset', props.assetId);
|
|
3610
|
+
}, [getEntityScheduledActions, props.assetId]);
|
|
3625
3611
|
useEffect(function () {
|
|
3626
3612
|
if (asset) {
|
|
3627
3613
|
props.onAction && props.onAction({
|
|
@@ -3680,7 +3666,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3680
3666
|
};
|
|
3681
3667
|
|
|
3682
3668
|
return useMemo(function () {
|
|
3683
|
-
if (
|
|
3669
|
+
if (status === 'error') {
|
|
3684
3670
|
var card = createElement(MissingEntityCard, {
|
|
3685
3671
|
entityType: "Asset",
|
|
3686
3672
|
asSquare: props.viewType !== 'link',
|
|
@@ -3701,8 +3687,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3701
3687
|
return card;
|
|
3702
3688
|
}
|
|
3703
3689
|
|
|
3704
|
-
var getEntityUrl = props.getEntityUrl
|
|
3705
|
-
sdk = props.sdk;
|
|
3690
|
+
var getEntityUrl = props.getEntityUrl;
|
|
3706
3691
|
var size = props.viewType === 'big_card' ? 'default' : 'small';
|
|
3707
3692
|
var commonProps = {
|
|
3708
3693
|
asset: asset,
|
|
@@ -3717,20 +3702,20 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3717
3702
|
};
|
|
3718
3703
|
|
|
3719
3704
|
if (props.viewType === 'link') {
|
|
3720
|
-
if (
|
|
3705
|
+
if (status === 'loading') {
|
|
3721
3706
|
return createElement(EntryCard, {
|
|
3722
3707
|
size: "small",
|
|
3723
3708
|
isLoading: true
|
|
3724
3709
|
});
|
|
3725
3710
|
}
|
|
3726
3711
|
|
|
3727
|
-
return createElement(WrappedAssetLink,
|
|
3712
|
+
return createElement(WrappedAssetLink, _extends({}, commonProps, {
|
|
3728
3713
|
href: commonProps.entityUrl,
|
|
3729
|
-
getEntityScheduledActions:
|
|
3714
|
+
getEntityScheduledActions: loadEntityScheduledActions
|
|
3730
3715
|
}));
|
|
3731
3716
|
}
|
|
3732
3717
|
|
|
3733
|
-
if (
|
|
3718
|
+
if (status === 'loading') {
|
|
3734
3719
|
return createElement(AssetCard, {
|
|
3735
3720
|
size: size,
|
|
3736
3721
|
isLoading: true
|
|
@@ -3745,7 +3730,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3745
3730
|
getAssetUrl: getEntityUrl
|
|
3746
3731
|
});
|
|
3747
3732
|
|
|
3748
|
-
return createElement(WrappedAssetCard,
|
|
3733
|
+
return createElement(WrappedAssetCard, _extends({}, builtinCardProps));
|
|
3749
3734
|
}
|
|
3750
3735
|
|
|
3751
3736
|
if (props.renderCustomCard) {
|
|
@@ -3762,17 +3747,17 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3762
3747
|
}
|
|
3763
3748
|
|
|
3764
3749
|
return renderDefaultCard(); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
|
|
3765
|
-
}, [props,
|
|
3750
|
+
}, [props, status, asset]);
|
|
3766
3751
|
}
|
|
3767
3752
|
|
|
3768
3753
|
function SingleMediaEditor(props) {
|
|
3769
|
-
return createElement(SingleReferenceEditor,
|
|
3754
|
+
return createElement(SingleReferenceEditor, _extends({}, props, {
|
|
3770
3755
|
entityType: "Asset"
|
|
3771
3756
|
}), function (_ref) {
|
|
3772
3757
|
var entityId = _ref.entityId,
|
|
3773
3758
|
isDisabled = _ref.isDisabled,
|
|
3774
3759
|
setValue = _ref.setValue;
|
|
3775
|
-
return createElement(FetchingWrappedAssetCard,
|
|
3760
|
+
return createElement(FetchingWrappedAssetCard, _extends({}, props, {
|
|
3776
3761
|
viewType: "big_card",
|
|
3777
3762
|
assetId: entityId,
|
|
3778
3763
|
isDisabled: isDisabled,
|
|
@@ -3794,12 +3779,12 @@ var styles$6 = {
|
|
|
3794
3779
|
})
|
|
3795
3780
|
};
|
|
3796
3781
|
function MultipleMediaEditor(props) {
|
|
3797
|
-
return createElement(MultipleReferenceEditor,
|
|
3782
|
+
return createElement(MultipleReferenceEditor, _extends({}, props, {
|
|
3798
3783
|
entityType: "Asset"
|
|
3799
3784
|
}), function (childrenProps) {
|
|
3800
3785
|
var _cx;
|
|
3801
3786
|
|
|
3802
|
-
return createElement(SortableLinkList,
|
|
3787
|
+
return createElement(SortableLinkList, _extends({}, childrenProps, {
|
|
3803
3788
|
className: cx((_cx = {}, _cx[styles$6.gridContainer] = childrenProps.viewType === 'card', _cx)),
|
|
3804
3789
|
axis: childrenProps.viewType === 'card' ? 'xy' : 'y',
|
|
3805
3790
|
useDragHandle: true
|
|
@@ -3809,7 +3794,7 @@ function MultipleMediaEditor(props) {
|
|
|
3809
3794
|
index = _ref.index,
|
|
3810
3795
|
isDisabled = _ref.isDisabled,
|
|
3811
3796
|
DragHandle = _ref.DragHandle;
|
|
3812
|
-
return createElement(FetchingWrappedAssetCard,
|
|
3797
|
+
return createElement(FetchingWrappedAssetCard, _extends({}, childrenProps, {
|
|
3813
3798
|
isDisabled: isDisabled,
|
|
3814
3799
|
key: item.sys.id + "-" + index,
|
|
3815
3800
|
assetId: item.sys.id,
|
|
@@ -3827,5 +3812,5 @@ MultipleMediaEditor.defaultProps = {
|
|
|
3827
3812
|
isInitiallyDisabled: true
|
|
3828
3813
|
};
|
|
3829
3814
|
|
|
3830
|
-
export { AssetThumbnail, CombinedLinkActions, CreateEntryLinkButton, CreateEntryMenuTrigger, EntityProvider, MissingEntityCard, MultipleEntryReferenceEditor, MultipleMediaEditor, ScheduledIconWithTooltip, SingleEntryReferenceEditor, SingleMediaEditor, SortableLinkList, WrappedAssetCard, WrappedEntryCard, getScheduleTooltipContent,
|
|
3815
|
+
export { AssetThumbnail, CombinedLinkActions, CreateEntryLinkButton, CreateEntryMenuTrigger, EntityProvider, MissingEntityCard, MultipleEntryReferenceEditor, MultipleMediaEditor, ScheduledIconWithTooltip, SingleEntryReferenceEditor, SingleMediaEditor, SortableLinkList, WrappedAssetCard, WrappedEntryCard, getScheduleTooltipContent, useEntity, useEntityLoader, useResource };
|
|
3831
3816
|
//# sourceMappingURL=field-editor-reference.esm.js.map
|