@contentful/field-editor-shared 2.18.1-canary.16 → 2.18.1-canary.19
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/dist/cjs/index.js +0 -11
- package/dist/cjs/queryClient.js +4 -18
- package/dist/cjs/react-query.js +36 -0
- package/dist/esm/index.js +0 -2
- package/dist/esm/queryClient.js +2 -16
- package/dist/esm/react-query.js +2 -0
- package/dist/types/hooks/useLocalePublishStatus.d.ts +1 -1
- package/dist/types/hooks/useReleaseStatus.d.ts +1 -1
- package/dist/types/index.d.ts +0 -2
- package/dist/types/queryClient.d.ts +1 -1
- package/dist/types/react-query.d.ts +2 -0
- package/dist/types/types.d.ts +2 -2
- package/dist/types/utils/getEntityReleaseStatus.d.ts +1 -1
- package/package.json +10 -4
package/dist/cjs/index.js
CHANGED
|
@@ -75,9 +75,6 @@ _export(exports, {
|
|
|
75
75
|
PredefinedValuesError: function() {
|
|
76
76
|
return _PredefinedValuesError.PredefinedValuesError;
|
|
77
77
|
},
|
|
78
|
-
SharedQueryClientProvider: function() {
|
|
79
|
-
return _queryClient.SharedQueryClientProvider;
|
|
80
|
-
},
|
|
81
78
|
SpaceAPI: function() {
|
|
82
79
|
return _appsdk.SpaceAPI;
|
|
83
80
|
},
|
|
@@ -95,12 +92,6 @@ _export(exports, {
|
|
|
95
92
|
},
|
|
96
93
|
toLocaleString: function() {
|
|
97
94
|
return _shortenStorageUnit.toLocaleString;
|
|
98
|
-
},
|
|
99
|
-
useQuery: function() {
|
|
100
|
-
return _queryClient.useQuery;
|
|
101
|
-
},
|
|
102
|
-
useQueryClient: function() {
|
|
103
|
-
return _queryClient.useQueryClient;
|
|
104
95
|
}
|
|
105
96
|
});
|
|
106
97
|
const _ModalDialogLauncher = /*#__PURE__*/ _interop_require_wildcard(require("./ModalDialogLauncher"));
|
|
@@ -117,13 +108,11 @@ _export_star(require("./types"), exports);
|
|
|
117
108
|
_export_star(require("./hooks/useActiveLocales"), exports);
|
|
118
109
|
_export_star(require("./hooks/useReleaseStatus"), exports);
|
|
119
110
|
_export_star(require("./hooks/useLocalePublishStatus"), exports);
|
|
120
|
-
_export_star(require("./hooks/useContentTypes"), exports);
|
|
121
111
|
_export_star(require("./LocalePublishingEntityStatusBadge"), exports);
|
|
122
112
|
_export_star(require("./ReleaseEntityStatusBadge"), exports);
|
|
123
113
|
_export_star(require("./utils/determineReleaseAction"), exports);
|
|
124
114
|
_export_star(require("./utils/getEntityReleaseStatus"), exports);
|
|
125
115
|
_export_star(require("./utils/getReleaseStatusBadgeConfig"), exports);
|
|
126
|
-
const _queryClient = require("./queryClient");
|
|
127
116
|
_export_star(require("./queryKeys"), exports);
|
|
128
117
|
function _export_star(from, to) {
|
|
129
118
|
Object.keys(from).forEach(function(k) {
|
package/dist/cjs/queryClient.js
CHANGED
|
@@ -20,6 +20,7 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
23
|
+
const _reactquery = require("@tanstack/react-query");
|
|
23
24
|
function _getRequireWildcardCache(nodeInterop) {
|
|
24
25
|
if (typeof WeakMap !== "function") return null;
|
|
25
26
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -61,20 +62,11 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
61
62
|
}
|
|
62
63
|
return newObj;
|
|
63
64
|
}
|
|
64
|
-
let RQQueryClient;
|
|
65
|
-
let useRQ;
|
|
66
|
-
let useHostQueryClient = ()=>undefined;
|
|
67
|
-
try {
|
|
68
|
-
const rq = require('@tanstack/react-query');
|
|
69
|
-
RQQueryClient = rq.QueryClient;
|
|
70
|
-
useRQ = rq.useQuery;
|
|
71
|
-
useHostQueryClient = rq.useQueryClient;
|
|
72
|
-
} catch {}
|
|
73
65
|
const clientContext = /*#__PURE__*/ _react.createContext(undefined);
|
|
74
66
|
let sharedQueryClientInstance;
|
|
75
67
|
function useMaybeHostQueryClient() {
|
|
76
68
|
try {
|
|
77
|
-
return
|
|
69
|
+
return (0, _reactquery.useQueryClient)();
|
|
78
70
|
} catch {
|
|
79
71
|
return undefined;
|
|
80
72
|
}
|
|
@@ -87,11 +79,8 @@ function useQueryClient() {
|
|
|
87
79
|
return client;
|
|
88
80
|
}
|
|
89
81
|
if (hostClient) return hostClient;
|
|
90
|
-
if (!RQQueryClient) {
|
|
91
|
-
throw new Error('@tanstack/react-query is required to use QueryClient. Please install it as a dependency: npm install @tanstack/react-query');
|
|
92
|
-
}
|
|
93
82
|
if (!sharedQueryClientInstance) {
|
|
94
|
-
sharedQueryClientInstance = new
|
|
83
|
+
sharedQueryClientInstance = new _reactquery.QueryClient({
|
|
95
84
|
defaultOptions: {
|
|
96
85
|
queries: {
|
|
97
86
|
useErrorBoundary: false,
|
|
@@ -111,10 +100,7 @@ function useQueryClient() {
|
|
|
111
100
|
]);
|
|
112
101
|
}
|
|
113
102
|
function useQuery(queryKey, queryFn, options) {
|
|
114
|
-
|
|
115
|
-
throw new Error('@tanstack/react-query is required to use useQuery. Please install it as a dependency: npm install @tanstack/react-query');
|
|
116
|
-
}
|
|
117
|
-
return useRQ(queryKey, queryFn, {
|
|
103
|
+
return (0, _reactquery.useQuery)(queryKey, queryFn, {
|
|
118
104
|
...options,
|
|
119
105
|
context: clientContext
|
|
120
106
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
SharedQueryClientProvider: function() {
|
|
13
|
+
return _queryClient.SharedQueryClientProvider;
|
|
14
|
+
},
|
|
15
|
+
useQuery: function() {
|
|
16
|
+
return _queryClient.useQuery;
|
|
17
|
+
},
|
|
18
|
+
useQueryClient: function() {
|
|
19
|
+
return _queryClient.useQueryClient;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _queryClient = require("./queryClient");
|
|
23
|
+
_export_star(require("./hooks/useContentTypes"), exports);
|
|
24
|
+
function _export_star(from, to) {
|
|
25
|
+
Object.keys(from).forEach(function(k) {
|
|
26
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
27
|
+
Object.defineProperty(to, k, {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function() {
|
|
30
|
+
return from[k];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return from;
|
|
36
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -12,11 +12,9 @@ export * from './types';
|
|
|
12
12
|
export * from './hooks/useActiveLocales';
|
|
13
13
|
export * from './hooks/useReleaseStatus';
|
|
14
14
|
export * from './hooks/useLocalePublishStatus';
|
|
15
|
-
export * from './hooks/useContentTypes';
|
|
16
15
|
export * from './LocalePublishingEntityStatusBadge';
|
|
17
16
|
export * from './ReleaseEntityStatusBadge';
|
|
18
17
|
export * from './utils/determineReleaseAction';
|
|
19
18
|
export * from './utils/getEntityReleaseStatus';
|
|
20
19
|
export * from './utils/getReleaseStatusBadgeConfig';
|
|
21
|
-
export { SharedQueryClientProvider, useQueryClient, useQuery } from './queryClient';
|
|
22
20
|
export * from './queryKeys';
|
package/dist/esm/queryClient.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
let useRQ;
|
|
4
|
-
let useHostQueryClient = ()=>undefined;
|
|
5
|
-
try {
|
|
6
|
-
const rq = require('@tanstack/react-query');
|
|
7
|
-
RQQueryClient = rq.QueryClient;
|
|
8
|
-
useRQ = rq.useQuery;
|
|
9
|
-
useHostQueryClient = rq.useQueryClient;
|
|
10
|
-
} catch {}
|
|
2
|
+
import { QueryClient, useQuery as useRQ, useQueryClient as useHostQueryClient } from '@tanstack/react-query';
|
|
11
3
|
const clientContext = /*#__PURE__*/ React.createContext(undefined);
|
|
12
4
|
let sharedQueryClientInstance;
|
|
13
5
|
function useMaybeHostQueryClient() {
|
|
@@ -25,11 +17,8 @@ export function useQueryClient() {
|
|
|
25
17
|
return client;
|
|
26
18
|
}
|
|
27
19
|
if (hostClient) return hostClient;
|
|
28
|
-
if (!RQQueryClient) {
|
|
29
|
-
throw new Error('@tanstack/react-query is required to use QueryClient. Please install it as a dependency: npm install @tanstack/react-query');
|
|
30
|
-
}
|
|
31
20
|
if (!sharedQueryClientInstance) {
|
|
32
|
-
sharedQueryClientInstance = new
|
|
21
|
+
sharedQueryClientInstance = new QueryClient({
|
|
33
22
|
defaultOptions: {
|
|
34
23
|
queries: {
|
|
35
24
|
useErrorBoundary: false,
|
|
@@ -49,9 +38,6 @@ export function useQueryClient() {
|
|
|
49
38
|
]);
|
|
50
39
|
}
|
|
51
40
|
export function useQuery(queryKey, queryFn, options) {
|
|
52
|
-
if (!useRQ) {
|
|
53
|
-
throw new Error('@tanstack/react-query is required to use useQuery. Please install it as a dependency: npm install @tanstack/react-query');
|
|
54
|
-
}
|
|
55
41
|
return useRQ(queryKey, queryFn, {
|
|
56
42
|
...options,
|
|
57
43
|
context: clientContext
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LocalesAPI } from '@contentful/app-sdk';
|
|
2
|
-
import type { AssetProps, EntryProps, LocaleProps } from 'contentful-management';
|
|
2
|
+
import type { AssetProps, EntryProps, LocaleProps } from 'contentful-management/types';
|
|
3
3
|
import { type SanitizedLocale } from '../utils/sanitizeLocales';
|
|
4
4
|
export type PublishStatus = 'draft' | 'published' | 'changed';
|
|
5
5
|
export type LocalePublishStatus = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { LocalesAPI } from '@contentful/app-sdk';
|
|
2
|
-
import type { AssetProps, EntryProps, LocaleProps, ReleaseProps } from 'contentful-management';
|
|
2
|
+
import type { AssetProps, EntryProps, LocaleProps, ReleaseProps } from 'contentful-management/types';
|
|
3
3
|
import type { ReleaseEntityStatus, ReleaseStatusMap, ReleaseV2Props } from '../types';
|
|
4
4
|
type UseActiveReleaseLocalesStatuses = {
|
|
5
5
|
entity?: EntryProps | AssetProps;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,11 +14,9 @@ export * from './types';
|
|
|
14
14
|
export * from './hooks/useActiveLocales';
|
|
15
15
|
export * from './hooks/useReleaseStatus';
|
|
16
16
|
export * from './hooks/useLocalePublishStatus';
|
|
17
|
-
export * from './hooks/useContentTypes';
|
|
18
17
|
export * from './LocalePublishingEntityStatusBadge';
|
|
19
18
|
export * from './ReleaseEntityStatusBadge';
|
|
20
19
|
export * from './utils/determineReleaseAction';
|
|
21
20
|
export * from './utils/getEntityReleaseStatus';
|
|
22
21
|
export * from './utils/getReleaseStatusBadgeConfig';
|
|
23
|
-
export { SharedQueryClientProvider, useQueryClient, useQuery } from './queryClient';
|
|
24
22
|
export * from './queryKeys';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { QueryClient, type UseQueryOptions, type UseQueryResult, type QueryKey, type QueryFunction } from '@tanstack/react-query';
|
|
3
3
|
export declare function useQueryClient(): QueryClient;
|
|
4
4
|
export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>(queryKey: TQueryKey, queryFn: QueryFunction<TQueryFnData, TQueryKey>, options?: Omit<UseQueryOptions<TQueryFnData, TError, TData, TQueryKey>, 'queryKey' | 'queryFn'>): UseQueryResult<TData, TError>;
|
|
5
5
|
/**
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BadgeVariant } from '@contentful/f36-components';
|
|
2
|
-
import type { CollectionProp, ReleaseProps } from 'contentful-management';
|
|
3
|
-
import type { LocaleProps } from 'contentful-management';
|
|
2
|
+
import type { CollectionProp, ReleaseProps } from 'contentful-management/types';
|
|
3
|
+
import type { LocaleProps } from 'contentful-management/types';
|
|
4
4
|
export type ValidationType = {
|
|
5
5
|
type: 'max';
|
|
6
6
|
max: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LocaleProps } from 'contentful-management';
|
|
1
|
+
import type { LocaleProps } from 'contentful-management/types';
|
|
2
2
|
import type { ReleaseAction, ReleaseV2Entity, ReleaseV2EntityWithLocales, ReleaseV2Props } from '../types';
|
|
3
3
|
type GetEntityReleaseStatusResult = {
|
|
4
4
|
releaseAction: ReleaseAction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-shared",
|
|
3
|
-
"version": "2.18.1-canary.
|
|
3
|
+
"version": "2.18.1-canary.19+e61c9c06",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"import": "./dist/esm/index.js",
|
|
12
12
|
"default": "./dist/cjs/index.js"
|
|
13
13
|
},
|
|
14
|
+
"./react-query": {
|
|
15
|
+
"types": "./dist/types/react-query.d.ts",
|
|
16
|
+
"require": "./dist/cjs/react-query.js",
|
|
17
|
+
"import": "./dist/esm/react-query.js",
|
|
18
|
+
"default": "./dist/cjs/react-query.js"
|
|
19
|
+
},
|
|
14
20
|
"./package.json": "./package.json"
|
|
15
21
|
},
|
|
16
22
|
"files": [
|
|
@@ -36,7 +42,7 @@
|
|
|
36
42
|
"tsc": "tsc -p ./ --noEmit"
|
|
37
43
|
},
|
|
38
44
|
"devDependencies": {
|
|
39
|
-
"@contentful/app-sdk": "4.
|
|
45
|
+
"@contentful/app-sdk": "^4.42.0",
|
|
40
46
|
"@contentful/field-editor-test-utils": "^1.8.0",
|
|
41
47
|
"@lingui/core": "5.3.0",
|
|
42
48
|
"@tanstack/react-query": "^4.3.9",
|
|
@@ -53,7 +59,7 @@
|
|
|
53
59
|
"lodash": "^4.17.15"
|
|
54
60
|
},
|
|
55
61
|
"peerDependencies": {
|
|
56
|
-
"@contentful/app-sdk": "4.
|
|
62
|
+
"@contentful/app-sdk": "^4.29.0",
|
|
57
63
|
"@lingui/core": "^5.3.0",
|
|
58
64
|
"@tanstack/react-query": "^4.3.9",
|
|
59
65
|
"react": ">=16.8.0",
|
|
@@ -67,5 +73,5 @@
|
|
|
67
73
|
"publishConfig": {
|
|
68
74
|
"registry": "https://npm.pkg.github.com/"
|
|
69
75
|
},
|
|
70
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "e61c9c06570d672a3eeef5d455dd0a1dee9cfcd1"
|
|
71
77
|
}
|