@contentful/react-apps-toolkit 1.2.16 → 1.2.21-alpha.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 CHANGED
@@ -108,13 +108,33 @@ If used in the [entry sidebar location](/developers/docs/extensibility/app-frame
108
108
 
109
109
  Usage:
110
110
 
111
+ Field component:
112
+ ```tsx
113
+ import { SDKProvider, useFieldValue } from '@contentful/react-apps-toolkit';
114
+
115
+ function FieldComponentUsingFieldValue() {
116
+ const [localizedValue, setLocalizedValue] = useFieldValue(sdk.field.id, sdk.field.locale); // specifies the current field and locale
117
+
118
+ return <input value={localizedValue} onChange={(e) => setLocalizedValue(e.target.value)} />;
119
+ }
120
+
121
+ function App() {
122
+ return (
123
+ <SDKProvider>
124
+ <FieldComponentUsingFieldValue />
125
+ </SDKProvider>
126
+ );
127
+ }
128
+ ```
129
+
130
+ Sidebar or Entry Editor component:
111
131
  ```tsx
112
132
  import { SDKProvider, useFieldValue } from '@contentful/react-apps-toolkit';
113
133
 
114
134
  function ComponentUsingFieldValue() {
115
- const [value, setValue] = useFieldValue('slug', 'en-US');
135
+ const [defaultValue, setDefaultValue] = useFieldValue('slug', sdk.locales.default); // specifies the "slug" field and the environment's default locale
116
136
 
117
- return <input value={value} onChange={(e) => setValue(e.target.value)} />;
137
+ return <input value={defaultValue} onChange={(e) => setDefaultValue(e.target.value)} />;
118
138
  }
119
139
 
120
140
  function App() {
@@ -25,7 +25,7 @@ var SDKProvider = function (props) {
25
25
  var _a = (0, react_1.useState)(), sdk = _a[0], setSDK = _a[1];
26
26
  (0, react_1.useEffect)(function () {
27
27
  var timeout = window.setTimeout(function () {
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");
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.");
29
29
  }, DELAY_TIMEOUT);
30
30
  (0, app_sdk_1.init)(function (sdk) {
31
31
  setSDK(sdk);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/react-apps-toolkit",
3
- "version": "1.2.16",
3
+ "version": "1.2.21-alpha.0",
4
4
  "description": "Toolkit for building a Contentful app in React",
5
5
  "keywords": [],
6
6
  "author": "Contentful GmbH",
@@ -47,10 +47,11 @@
47
47
  "typescript": "4.9.5"
48
48
  },
49
49
  "publishConfig": {
50
- "access": "public"
50
+ "access": "public",
51
+ "registry": "https://npm.pkg.github.com/"
51
52
  },
52
53
  "dependencies": {
53
54
  "contentful-management": ">=7.30.0"
54
55
  },
55
- "gitHead": "9f69cc5e13fe10bd03949111580a3de55f5a28c7"
56
+ "gitHead": "83eea204b666977602cb680d5e5913864aa6dcc1"
56
57
  }