@contentful/react-apps-toolkit 0.6.1 → 0.7.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/README.md +0 -4
- package/dist/SDKProvider.d.ts +2 -2
- package/dist/SDKProvider.js +4 -7
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
# In development
|
|
2
|
-
|
|
3
|
-
This library is still in development and should not be used in production.
|
|
4
|
-
|
|
5
1
|
# React Toolkit for Contentful Apps
|
|
6
2
|
|
|
7
3
|
React Hooks for the App Framework offer a simple way to bring frequently needed functionality into your react based [Contentful apps](/developers/docs/extensibility/app-framework/).
|
package/dist/SDKProvider.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { FC, ReactElement } from 'react';
|
|
2
1
|
import { KnownSDK } from '@contentful/app-sdk';
|
|
3
|
-
|
|
2
|
+
import { FC, ReactElement } from 'react';
|
|
3
|
+
export declare const SDKContext: import("react").Context<{
|
|
4
4
|
sdk: KnownSDK | null;
|
|
5
5
|
}>;
|
|
6
6
|
interface SDKProviderProps {
|
package/dist/SDKProvider.js
CHANGED
|
@@ -10,23 +10,20 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
14
|
exports.SDKProvider = exports.SDKContext = void 0;
|
|
18
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
var react_1 = __importDefault(require("react"));
|
|
20
16
|
var app_sdk_1 = require("@contentful/app-sdk");
|
|
21
|
-
|
|
17
|
+
var react_1 = require("react");
|
|
18
|
+
exports.SDKContext = (0, react_1.createContext)({ sdk: null });
|
|
22
19
|
var DELAY_TIMEOUT = 4 * 1000;
|
|
23
20
|
/**
|
|
24
21
|
* The Component providing the AppSdk, the useSDK hook can only be used within this Provider
|
|
25
22
|
* @param props.loading an optional loading element that gets rendered while initializing the app
|
|
26
23
|
*/
|
|
27
24
|
var SDKProvider = function (props) {
|
|
28
|
-
var _a = react_1.
|
|
29
|
-
react_1.
|
|
25
|
+
var _a = (0, react_1.useState)(), sdk = _a[0], setSDK = _a[1];
|
|
26
|
+
(0, react_1.useEffect)(function () {
|
|
30
27
|
var timeout = window.setTimeout(function () {
|
|
31
28
|
console.warn("Your app is taking longer than expected to initialize. If you think this is an error with Contentful's App SDK, let us know: https://github.com/contentful/ui-extensions-sdk/issues");
|
|
32
29
|
}, DELAY_TIMEOUT);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/react-apps-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Toolkit for building a Contentful app in React",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Contentful GmbH",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/react": "^17.0.39",
|
|
41
41
|
"jest": "^27.5.0",
|
|
42
42
|
"react": "^17.0.2",
|
|
43
|
-
"react-
|
|
43
|
+
"react-dom": "17.0.2",
|
|
44
44
|
"ts-jest": "^27.1.3",
|
|
45
45
|
"typescript": "^4.5.5"
|
|
46
46
|
},
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"@contentful/app-sdk": "^4.0.0",
|
|
52
52
|
"contentful-management": ">=7.30.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "9b4d1a392a1018d6f11dd6b9589a313854173fd3"
|
|
55
55
|
}
|