@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/embeddings-index-ui",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Various Sanity Studio plugins for integrating with the embeddings index API",
5
5
  "keywords": [
6
6
  "sanity",
@@ -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={2}>
47
+ <Card tone="primary" border padding={4}>
46
48
  <Text size={1}>
47
- Embeddings index APIs are only available on the{' '}
48
- <a href="https://sanity.io/pricing">Team tier and above</a>. Please upgrade to enable
49
- access.
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' ? <FeatureDisabledNotice /> : null}
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' ? (