@contentful/field-editor-reference 5.1.2 → 5.1.5
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 +16 -0
- package/dist/field-editor-reference.cjs.development.js +40 -7
- 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 +40 -7
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/dist/resources/Cards/ResourceCard.d.ts +1 -1
- package/package.json +2 -2
|
@@ -679,7 +679,8 @@ var squareCard = /*#__PURE__*/css({
|
|
|
679
679
|
|
|
680
680
|
function MissingEntityCard(props) {
|
|
681
681
|
return React__default.createElement(Card, {
|
|
682
|
-
className: card
|
|
682
|
+
className: card,
|
|
683
|
+
testId: "cf-ui-missing-entry-card"
|
|
683
684
|
}, React__default.createElement(Flex, {
|
|
684
685
|
alignItems: "center",
|
|
685
686
|
justifyContent: "space-between"
|
|
@@ -1837,7 +1838,7 @@ var formatDateAndTime = function formatDateAndTime(date, _short2) {
|
|
|
1837
1838
|
var getScheduleTooltipContent = function getScheduleTooltipContent(_ref) {
|
|
1838
1839
|
var job = _ref.job,
|
|
1839
1840
|
jobsCount = _ref.jobsCount;
|
|
1840
|
-
return "Will " + job.action.toLowerCase() + " " + formatDateAndTime(job.scheduledFor.datetime).toLowerCase() + "\n " + (jobsCount > 1
|
|
1841
|
+
return "Will " + job.action.toLowerCase() + " " + formatDateAndTime(job.scheduledFor.datetime).toLowerCase() + "\n " + (jobsCount > 1 ? "+ " + (jobsCount - 1) + " more" : '');
|
|
1841
1842
|
};
|
|
1842
1843
|
var ScheduleTooltip = function ScheduleTooltip(_ref2) {
|
|
1843
1844
|
var job = _ref2.job,
|
|
@@ -2047,8 +2048,10 @@ function _fetchContentfulEntry() {
|
|
|
2047
2048
|
}
|
|
2048
2049
|
|
|
2049
2050
|
var _constate = /*#__PURE__*/constate(function useInitServices(props) {
|
|
2051
|
+
var _props$sdk$ids$enviro;
|
|
2052
|
+
|
|
2050
2053
|
var currentSpaceId = props.sdk.ids.space;
|
|
2051
|
-
var currentEnvironmentId = props.sdk.ids.environment;
|
|
2054
|
+
var currentEnvironmentId = (_props$sdk$ids$enviro = props.sdk.ids.environmentAlias) != null ? _props$sdk$ids$enviro : props.sdk.ids.environment;
|
|
2052
2055
|
var queryClient = useQueryClient();
|
|
2053
2056
|
var queryCache = queryClient.getQueryCache();
|
|
2054
2057
|
var entityChangeUnsubscribers = useRef({});
|
|
@@ -2115,12 +2118,38 @@ var _constate = /*#__PURE__*/constate(function useInitServices(props) {
|
|
|
2115
2118
|
throw new UnsupportedError('Unsupported entity type');
|
|
2116
2119
|
}, options);
|
|
2117
2120
|
}, [fetch, currentSpaceId, currentEnvironmentId]);
|
|
2121
|
+
/**
|
|
2122
|
+
* Fetch all scheduled actions for a given entity.
|
|
2123
|
+
* This function fetches all schedules for all entries and then returns
|
|
2124
|
+
* a filtered result based on the entityID provided.
|
|
2125
|
+
*
|
|
2126
|
+
* The result is then reused/cached for subsequent calls to this function.
|
|
2127
|
+
*/
|
|
2128
|
+
|
|
2129
|
+
/**
|
|
2130
|
+
* Fetch all scheduled actions for a given entity.
|
|
2131
|
+
* This function fetches all schedules for all entries and then returns
|
|
2132
|
+
* a filtered result based on the entityID provided.
|
|
2133
|
+
*
|
|
2134
|
+
* The result is then reused/cached for subsequent calls to this function.
|
|
2135
|
+
*/
|
|
2118
2136
|
var getEntityScheduledActions = useCallback(function getEntityScheduledActions(entityType, entityId, options) {
|
|
2119
2137
|
var _options$spaceId2, _options$environmentI2;
|
|
2120
2138
|
|
|
2139
|
+
// This is fixed to force the cache to reuse previous results
|
|
2140
|
+
var fixedEntityCacheId = 'scheduledActionEntityId'; // A space+environment combo can only have up to 500 scheduled actions
|
|
2141
|
+
// With this request we fetch all schedules and can reuse the results.
|
|
2142
|
+
// See https://www.contentful.com/developers/docs/references/content-management-api/#/reference/scheduled-actions/limitations
|
|
2143
|
+
|
|
2144
|
+
// A space+environment combo can only have up to 500 scheduled actions
|
|
2145
|
+
// With this request we fetch all schedules and can reuse the results.
|
|
2146
|
+
// See https://www.contentful.com/developers/docs/references/content-management-api/#/reference/scheduled-actions/limitations
|
|
2147
|
+
var maxScheduledActions = 500;
|
|
2121
2148
|
var spaceId = (_options$spaceId2 = options == null ? void 0 : options.spaceId) != null ? _options$spaceId2 : currentSpaceId;
|
|
2122
2149
|
var environmentId = (_options$environmentI2 = options == null ? void 0 : options.environmentId) != null ? _options$environmentI2 : currentEnvironmentId;
|
|
2123
|
-
var queryKey = ['scheduled-actions', entityType,
|
|
2150
|
+
var queryKey = ['scheduled-actions', entityType, fixedEntityCacheId, spaceId, environmentId]; // Fetch + Filter by entity ID in the end
|
|
2151
|
+
|
|
2152
|
+
// Fetch + Filter by entity ID in the end
|
|
2124
2153
|
return fetch(queryKey, /*#__PURE__*/function () {
|
|
2125
2154
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(_ref2) {
|
|
2126
2155
|
var cmaClient, response;
|
|
@@ -2134,9 +2163,9 @@ var _constate = /*#__PURE__*/constate(function useInitServices(props) {
|
|
|
2134
2163
|
spaceId: spaceId,
|
|
2135
2164
|
query: {
|
|
2136
2165
|
'environment.sys.id': environmentId,
|
|
2137
|
-
'entity.sys.id': entityId,
|
|
2138
2166
|
'sys.status[in]': 'scheduled',
|
|
2139
|
-
order: 'scheduledFor.datetime'
|
|
2167
|
+
order: 'scheduledFor.datetime',
|
|
2168
|
+
limit: maxScheduledActions
|
|
2140
2169
|
}
|
|
2141
2170
|
});
|
|
2142
2171
|
|
|
@@ -2155,7 +2184,11 @@ var _constate = /*#__PURE__*/constate(function useInitServices(props) {
|
|
|
2155
2184
|
return function (_x2) {
|
|
2156
2185
|
return _ref3.apply(this, arguments);
|
|
2157
2186
|
};
|
|
2158
|
-
}(), options)
|
|
2187
|
+
}(), options).then(function (items) {
|
|
2188
|
+
return items.filter(function (action) {
|
|
2189
|
+
return action.entity.sys.id === entityId;
|
|
2190
|
+
});
|
|
2191
|
+
});
|
|
2159
2192
|
}, [fetch, currentSpaceId, currentEnvironmentId]);
|
|
2160
2193
|
var getResource = useCallback(function getResource(resourceType, urn, options) {
|
|
2161
2194
|
var queryKey = ['Resource', resourceType, urn];
|