@sanity/assist 5.0.0 → 5.0.2

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,7 @@
1
1
  {
2
2
  "name": "@sanity/assist",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
+ "type": "module",
4
5
  "description": "You create the instructions; Sanity AI Assist does the rest.",
5
6
  "keywords": [
6
7
  "sanity",
@@ -21,14 +22,14 @@
21
22
  "exports": {
22
23
  ".": {
23
24
  "source": "./src/index.ts",
24
- "import": "./dist/index.mjs",
25
- "require": "./dist/index.js",
25
+ "import": "./dist/index.js",
26
+ "require": "./dist/index.cjs",
26
27
  "default": "./dist/index.js"
27
28
  },
28
29
  "./package.json": "./package.json"
29
30
  },
30
- "main": "./dist/index.js",
31
- "module": "./dist/index.esm.js",
31
+ "main": "./dist/index.cjs",
32
+ "module": "./dist/index.js",
32
33
  "types": "./dist/index.d.ts",
33
34
  "files": [
34
35
  "dist",
@@ -37,7 +38,7 @@
37
38
  "v2-incompatible.js"
38
39
  ],
39
40
  "scripts": {
40
- "build": "run-s clean && pkg-utils build --strict && pkg-utils --strict",
41
+ "build": "run-s clean && pkg-utils build --strict",
41
42
  "clean": "rimraf dist",
42
43
  "format": "prettier --write --cache --ignore-unknown .",
43
44
  "link-watch": "plugin-kit link-watch",
@@ -49,9 +50,9 @@
49
50
  "release": "semantic-release"
50
51
  },
51
52
  "dependencies": {
52
- "@sanity/icons": "^3.5.2",
53
+ "@sanity/icons": "^3.7.4",
53
54
  "@sanity/incompatible-plugin": "^1.0.4",
54
- "@sanity/ui": "^3.0.6",
55
+ "@sanity/ui": "^3.1.11",
55
56
  "date-fns": "^3.6.0",
56
57
  "lodash": "^4.17.21",
57
58
  "lodash-es": "^4.17.21",
@@ -63,9 +64,9 @@
63
64
  "@commitlint/cli": "^19.2.1",
64
65
  "@commitlint/config-conventional": "^19.1.0",
65
66
  "@rollup/plugin-image": "^3.0.3",
66
- "@sanity/pkg-utils": "^6.13.4",
67
- "@sanity/plugin-kit": "^3.1.10",
68
- "@sanity/schema": "^3.93.0",
67
+ "@sanity/pkg-utils": "^8.1.25",
68
+ "@sanity/plugin-kit": "^4.0.20",
69
+ "@sanity/schema": "^4.11.0",
69
70
  "@sanity/semantic-release-preset": "^4.1.7",
70
71
  "@types/lodash": "^4.17.0",
71
72
  "@types/lodash-es": "^4.17.12",
@@ -152,6 +152,7 @@ export function DocumentForm(
152
152
  schemaType={formState.schemaType}
153
153
  validation={validation}
154
154
  value={formState.value as any}
155
+ hasUpstreamVersion={false}
155
156
  />
156
157
  )
157
158
  ) : (
@@ -1,13 +1,10 @@
1
1
  import {Box, Flex} from '@sanity/ui'
2
- import {useContext, useMemo} from 'react'
3
- import {FieldProps, isArraySchemaType, pathToString} from 'sanity'
2
+ import {useMemo} from 'react'
3
+ import {FieldProps, isArraySchemaType} from 'sanity'
4
4
 
5
5
  import {assistFormId} from '../_lib/form/constants'
6
6
  import {isAssistSupported} from '../helpers/assistSupported'
7
7
  import {isPortableTextArray, isType} from '../helpers/typeUtils'
8
- import {AssistOnboardingPopover} from '../onboarding/FieldActionsOnboarding'
9
- import {FirstAssistedPathContext} from '../onboarding/FirstAssistedPathProvider'
10
- import {fieldOnboardingKey, useOnboardingFeature} from '../onboarding/onboardingStore'
11
8
  import {AiFieldPresence} from '../presence/AiFieldPresence'
12
9
  import {useAssistPresence} from '../presence/useAssistPresence'
13
10
  import {contextDocumentTypeName} from '../types'
@@ -36,22 +33,12 @@ export function AssistFieldWrapper(props: FieldProps) {
36
33
  }
37
34
 
38
35
  export function AssistField(props: FieldProps) {
39
- const {path} = props
40
-
41
36
  const isPortableText = useMemo(
42
37
  () => !!(isArraySchemaType(props.schemaType) && isPortableTextArray(props.schemaType)),
43
38
  [props.schemaType],
44
39
  )
45
40
 
46
41
  const presence = useAssistPresence(props.path, isPortableText)
47
-
48
- const firstAssistedPath = useContext(FirstAssistedPathContext)
49
- const isFirstAssisted = useMemo(
50
- () => pathToString(path) === firstAssistedPath,
51
- [path, firstAssistedPath],
52
- )
53
-
54
- const {showOnboarding, dismissOnboarding} = useOnboardingFeature(fieldOnboardingKey)
55
42
  const singlePresence = presence[0]
56
43
 
57
44
  const actions = (
@@ -61,18 +48,15 @@ export function AssistField(props: FieldProps) {
61
48
  <AiFieldPresence presence={singlePresence} />
62
49
  </Box>
63
50
  )}
64
-
65
- {isFirstAssisted && showOnboarding && <AssistOnboardingPopover dismiss={dismissOnboarding} />}
66
51
  </Flex>
67
52
  )
68
53
 
69
54
  return props.renderDefault({
70
55
  ...props,
71
56
 
72
- // When showing the onboarding, prevent default field actions from being rendered
73
- actions: isFirstAssisted && showOnboarding ? [] : props.actions,
57
+ actions: props.actions,
74
58
 
75
- // Render presence (and possibly onboarding) in the internal slot (between presence and the field actions)
59
+ // Render presence in the internal slot (between presence and the field actions)
76
60
  // eslint-disable-next-line camelcase
77
61
  __internal_slot: actions,
78
62
  })
@@ -24,7 +24,6 @@ import {giveFeedbackUrl, pluginTitle, releaseAnnouncementUrl, salesUrl} from '..
24
24
  import {getConditionalMembers} from '../helpers/conditionalMembers'
25
25
  import {assistDocumentId} from '../helpers/ids'
26
26
  import {InspectorOnboarding} from '../onboarding/InspectorOnboarding'
27
- import {inspectorOnboardingKey, useOnboardingFeature} from '../onboarding/onboardingStore'
28
27
  import {assistDocumentTypeName, fieldPathParam, instructionParam} from '../types'
29
28
  import {FieldTitle} from './FieldAutocomplete'
30
29
  import {
@@ -35,6 +34,7 @@ import {
35
34
  useTypePath,
36
35
  } from './helpers'
37
36
  import {InstructionTaskHistoryButton} from './InstructionTaskHistoryButton'
37
+ import {inspectorOnboardingKey, useOnboardingFeature} from '../onboarding/onboardingStore'
38
38
 
39
39
  const CardWithShadowBelow = styled(Card)`
40
40
  position: relative;
@@ -1,7 +1,6 @@
1
1
  import {useCallback, useState} from 'react'
2
2
 
3
3
  export const inspectorOnboardingKey = 'sanityStudio:assist:inspector:onboarding:dismissed'
4
- export const fieldOnboardingKey = 'sanityStudio:assist:field:onboarding:dismissed'
5
4
 
6
5
  export function isFeatureOnboardingDismissed(featureKey: string): boolean {
7
6
  if (typeof localStorage === 'undefined') {
@@ -167,7 +167,7 @@ export const promptContext = defineType({
167
167
  ],
168
168
  preview: {
169
169
  select: {
170
- ref: 'reference._ref',
170
+ ref: 'reference._id',
171
171
  title: 'reference.title',
172
172
  context: 'reference.context',
173
173
  },