@sanity/sdk-react 0.0.0-rc.6 → 0.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/README.md +5 -57
- package/dist/index.d.ts +1000 -438
- package/dist/index.js +324 -258
- package/dist/index.js.map +1 -1
- package/package.json +17 -16
- package/src/_exports/sdk-react.ts +4 -1
- package/src/components/SDKProvider.tsx +6 -1
- package/src/components/SanityApp.test.tsx +29 -47
- package/src/components/SanityApp.tsx +12 -11
- package/src/components/auth/AuthBoundary.test.tsx +177 -7
- package/src/components/auth/AuthBoundary.tsx +32 -2
- package/src/components/auth/ConfigurationError.ts +22 -0
- package/src/components/auth/LoginError.tsx +9 -3
- package/src/hooks/auth/useVerifyOrgProjects.test.tsx +136 -0
- package/src/hooks/auth/useVerifyOrgProjects.tsx +48 -0
- package/src/hooks/client/useClient.ts +3 -3
- package/src/hooks/comlink/useManageFavorite.test.ts +276 -27
- package/src/hooks/comlink/useManageFavorite.ts +102 -51
- package/src/hooks/comlink/useWindowConnection.ts +3 -2
- package/src/hooks/document/useApplyDocumentActions.ts +105 -31
- package/src/hooks/document/useDocument.test.ts +41 -4
- package/src/hooks/document/useDocument.ts +198 -114
- package/src/hooks/document/useDocumentEvent.test.ts +5 -5
- package/src/hooks/document/useDocumentEvent.ts +67 -23
- package/src/hooks/document/useDocumentPermissions.ts +47 -8
- package/src/hooks/document/useDocumentSyncStatus.test.ts +12 -5
- package/src/hooks/document/useDocumentSyncStatus.ts +41 -14
- package/src/hooks/document/useEditDocument.test.ts +24 -6
- package/src/hooks/document/useEditDocument.ts +238 -133
- package/src/hooks/documents/useDocuments.test.tsx +1 -1
- package/src/hooks/documents/useDocuments.ts +153 -44
- package/src/hooks/paginatedDocuments/usePaginatedDocuments.test.tsx +1 -1
- package/src/hooks/paginatedDocuments/usePaginatedDocuments.ts +120 -47
- package/src/hooks/projection/useProjection.ts +134 -46
- package/src/hooks/query/useQuery.test.tsx +4 -4
- package/src/hooks/query/useQuery.ts +115 -43
- package/src/hooks/releases/useActiveReleases.test.tsx +84 -0
- package/src/hooks/releases/useActiveReleases.ts +39 -0
- package/src/hooks/releases/usePerspective.test.tsx +120 -0
- package/src/hooks/releases/usePerspective.ts +50 -0
package/README.md
CHANGED
|
@@ -2,68 +2,16 @@
|
|
|
2
2
|
<a href="https://sanity.io">
|
|
3
3
|
<img src="https://cdn.sanity.io/images/3do82whm/next/1dfce9dde7a62ccaa8e8377254a1e919f6c07ad3-128x128.svg" />
|
|
4
4
|
</a>
|
|
5
|
-
<h1 align="center">Sanity
|
|
5
|
+
<h1 align="center">Sanity React App SDK</h1>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
React hooks for creating Sanity applications.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Documentation
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
> 💡 Looking to build a Sanity application? Check out the [Quick Start](#quick-start) section.
|
|
17
|
-
|
|
18
|
-
## 📚 SDK Documentation
|
|
19
|
-
|
|
20
|
-
See the [SDK Documentation](https://sdk-docs.sanity.dev) for more information.
|
|
21
|
-
|
|
22
|
-
## 🚀 Quick Start
|
|
23
|
-
|
|
24
|
-
Here's how to implement your Sanity application:
|
|
25
|
-
|
|
26
|
-
1. Create a new React TypeScript project using the Sanity template
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
pnpx sanity@latest init --template app-quickstart
|
|
30
|
-
cd my-content-os-app
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
2. Install dependencies
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
npm i
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
3. Run the app
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
npm run dev
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
4. Open the App in Sanity Dashboard with your organization ID
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
https://core.sanity.io/<your-organization-id>?dev=http://localhost:3333
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
5. Update the `src/App.tsx` file with your Sanity project and dataset
|
|
52
|
-
|
|
53
|
-
```tsx
|
|
54
|
-
// src/App.tsx
|
|
55
|
-
import {createSanityInstance} from '@sanity/sdk'
|
|
56
|
-
...
|
|
57
|
-
|
|
58
|
-
const sanityConfig: SanityConfigs = [
|
|
59
|
-
{
|
|
60
|
-
projectId: 'abc123',
|
|
61
|
-
dataset: 'production',
|
|
62
|
-
},
|
|
63
|
-
]
|
|
64
|
-
|
|
65
|
-
...
|
|
66
|
-
```
|
|
12
|
+
- Familiarize yourself with the App SDK via a conceptual overview, a quickstart guide, and a step by step walkthrough on **[the Sanity Docs site](https://sanity.io/docs/app-sdk)**
|
|
13
|
+
- Go in depth with the **[App SDK reference docs](https://sdk-docs.sanity.dev)**
|
|
14
|
+
- View example implementations on the **[SDK Explorer](https://sdk-examples.sanity.dev)**
|
|
67
15
|
|
|
68
16
|
## License
|
|
69
17
|
|