@sanity/embeddings-index-ui 1.1.3 → 1.1.4
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 +9 -12
- package/dist/index.esm.js +21 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +20 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/isEnabled.tsx +10 -6
- package/src/embeddingsIndexDashboard/EmbeddingsIndexTool.tsx +6 -3
- package/src/referenceInput/SemanticSearchReferenceInput.tsx +3 -1
package/package.json
CHANGED
package/src/api/isEnabled.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useClient} from 'sanity'
|
|
1
|
+
import {useClient, useProjectId} from 'sanity'
|
|
2
2
|
import {createContext, PropsWithChildren, useContext, useEffect, useState} from 'react'
|
|
3
3
|
import {Card, Text} from '@sanity/ui'
|
|
4
4
|
|
|
@@ -40,13 +40,17 @@ export function useIsFeatureEnabledContext(): FeatureStatus {
|
|
|
40
40
|
return useContext(FeatureEnabledContext)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export function FeatureDisabledNotice() {
|
|
43
|
+
export function FeatureDisabledNotice(props: {urlSuffix?: string}) {
|
|
44
|
+
const projectId = useProjectId()
|
|
45
|
+
|
|
44
46
|
return (
|
|
45
|
-
<Card tone="primary" border padding={
|
|
47
|
+
<Card tone="primary" border padding={4}>
|
|
46
48
|
<Text size={1}>
|
|
47
|
-
Embeddings
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
💎 Unlock semantic search with Embeddings Index APIs — available on Team, Business, and
|
|
50
|
+
Enterprise plans.{' '}
|
|
51
|
+
<a href={`https://www.sanity.io/manage/project/${projectId}/plan${props.urlSuffix ?? ''}`}>
|
|
52
|
+
Upgrade now →
|
|
53
|
+
</a>
|
|
50
54
|
</Text>
|
|
51
55
|
</Card>
|
|
52
56
|
)
|
|
@@ -13,15 +13,18 @@ export function EmbeddingsIndexTool() {
|
|
|
13
13
|
return (
|
|
14
14
|
<Card>
|
|
15
15
|
<Flex justify="center" flex={1}>
|
|
16
|
+
{featureState == 'disabled' ? (
|
|
17
|
+
<Box padding={4}>
|
|
18
|
+
<FeatureDisabledNotice urlSuffix="?ref=embeddings-tab" />
|
|
19
|
+
</Box>
|
|
20
|
+
) : null}
|
|
21
|
+
|
|
16
22
|
<Card flex={1} style={{maxWidth: 1200}} padding={5}>
|
|
17
23
|
{featureState == 'loading' ? (
|
|
18
24
|
<Box padding={2}>
|
|
19
25
|
<Spinner />
|
|
20
26
|
</Box>
|
|
21
27
|
) : null}
|
|
22
|
-
|
|
23
|
-
{featureState == 'disabled' ? <FeatureDisabledNotice /> : null}
|
|
24
|
-
|
|
25
28
|
{featureState == 'enabled' ? <Indexes /> : null}
|
|
26
29
|
</Card>
|
|
27
30
|
</Flex>
|
|
@@ -67,7 +67,9 @@ export function SemanticSearchReferenceInput(
|
|
|
67
67
|
</Box>
|
|
68
68
|
) : null}
|
|
69
69
|
|
|
70
|
-
{semantic && featureState == 'disabled' ?
|
|
70
|
+
{semantic && featureState == 'disabled' ? (
|
|
71
|
+
<FeatureDisabledNotice urlSuffix="?ref=embeddings-ref" />
|
|
72
|
+
) : null}
|
|
71
73
|
|
|
72
74
|
<Box flex={1} style={{maxHeight: 36, overflow: 'hidden'}}>
|
|
73
75
|
{semantic && featureState == 'enabled' ? (
|