sanity-plugin-mux-input 2.2.3 → 2.2.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-plugin-mux-input",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "An input component that integrates Sanity Studio with Mux video encoding/hosting service.",
5
5
  "keywords": [
6
6
  "sanity",
@@ -61,8 +61,8 @@
61
61
  "watch": "pkg-utils watch --strict"
62
62
  },
63
63
  "dependencies": {
64
- "@mux/mux-player-react": "1.11.4",
65
- "@mux/upchunk": "^3",
64
+ "@mux/mux-player-react": "1.15.0",
65
+ "@mux/upchunk": "^3.2.0",
66
66
  "@sanity/icons": "^2",
67
67
  "@sanity/incompatible-plugin": "^1",
68
68
  "@sanity/ui": "^1",
@@ -78,40 +78,40 @@
78
78
  "use-error-boundary": "^2.0.6"
79
79
  },
80
80
  "devDependencies": {
81
- "@commitlint/cli": "^17.7.1",
82
- "@commitlint/config-conventional": "^17.7.0",
83
- "@sanity/pkg-utils": "^2.4.6",
81
+ "@commitlint/cli": "^17.8.1",
82
+ "@commitlint/config-conventional": "^17.8.1",
83
+ "@sanity/pkg-utils": "^2.4.10",
84
84
  "@sanity/plugin-kit": "^3.1.10",
85
- "@sanity/semantic-release-preset": "^4.1.3",
86
- "@sanity/vision": "^3.15.1",
87
- "@types/react": "^18.2.20",
88
- "@types/styled-components": "^5.1.26",
85
+ "@sanity/semantic-release-preset": "^4.1.6",
86
+ "@sanity/vision": "^3.19.2",
87
+ "@types/react": "^18.2.37",
88
+ "@types/styled-components": "^5.1.30",
89
89
  "@typescript-eslint/eslint-plugin": "^5.62.0",
90
90
  "@typescript-eslint/parser": "^5.62.0",
91
91
  "cz-conventional-changelog": "^3.3.0",
92
- "eslint": "^8.47.0",
93
- "eslint-config-prettier": "^8.10.0",
92
+ "eslint": "^8.53.0",
93
+ "eslint-config-prettier": "^9.0.0",
94
94
  "eslint-config-react-app": "^7.0.1",
95
95
  "eslint-config-sanity": "^6.0.0",
96
- "eslint-plugin-import": "^2.28.1",
97
- "eslint-plugin-prettier": "^5.0.0",
96
+ "eslint-plugin-import": "^2.29.0",
97
+ "eslint-plugin-prettier": "^5.0.1",
98
98
  "eslint-plugin-react": "^7.33.2",
99
99
  "eslint-plugin-react-hooks": "^4.6.0",
100
100
  "eslint-plugin-simple-import-sort": "^10.0.0",
101
101
  "husky": "^8.0.3",
102
102
  "lint-staged": "^13.3.0",
103
- "next": "^13.4.19",
104
- "next-sanity": "^5.4.4",
103
+ "next": "^13.5.6",
104
+ "next-sanity": "^5.5.10",
105
105
  "npm-run-all": "^4.1.5",
106
- "prettier": "^3.0.2",
107
- "prettier-plugin-packagejson": "^2.4.5",
106
+ "prettier": "^3.1.0",
107
+ "prettier-plugin-packagejson": "^2.4.6",
108
108
  "react": "^18.2.0",
109
109
  "react-dom": "^18.2.0",
110
110
  "react-is": "^18.2.0",
111
111
  "rimraf": "^5.0.0",
112
- "sanity": "^3.15.1",
112
+ "sanity": "^3.19.2",
113
113
  "styled-components": "^5.3.11",
114
- "typescript": "^5.1.6"
114
+ "typescript": "^5.2.2"
115
115
  },
116
116
  "peerDependencies": {
117
117
  "react": "^18",
@@ -8,6 +8,7 @@ import {
8
8
  RevertIcon,
9
9
  SearchIcon,
10
10
  TrashIcon,
11
+ TagIcon,
11
12
  } from '@sanity/icons'
12
13
  import {
13
14
  Button,
@@ -221,7 +222,12 @@ const VideoDetails: React.FC<VideoDetailsProps> = (props) => {
221
222
  selected={tab === 'references'}
222
223
  />
223
224
  </TabList>
224
- <TabPanel aria-labelledby="details-tab" id="details-panel" hidden={tab !== 'details'}>
225
+ <TabPanel
226
+ aria-labelledby="details-tab"
227
+ id="details-panel"
228
+ hidden={tab !== 'details'}
229
+ style={{wordBreak: 'break-word'}}
230
+ >
225
231
  <Stack space={4}>
226
232
  <AssetInput
227
233
  label="Video title or file name"
@@ -271,6 +277,7 @@ const VideoDetails: React.FC<VideoDetailsProps> = (props) => {
271
277
  icon={CalendarIcon}
272
278
  size={2}
273
279
  />
280
+ <IconInfo text={`Mux ID: \n${displayInfo.id}`} icon={TagIcon} size={2} />
274
281
  </Stack>
275
282
  </Stack>
276
283
  </TabPanel>
@@ -1,4 +1,4 @@
1
- import {CalendarIcon, ClockIcon} from '@sanity/icons'
1
+ import {CalendarIcon, ClockIcon, TagIcon} from '@sanity/icons'
2
2
  import {Inline, Stack, Text} from '@sanity/ui'
3
3
  import React from 'react'
4
4
 
@@ -35,6 +35,9 @@ const VideoMetadata = (props: {asset: VideoAssetDocument}) => {
35
35
  size={1}
36
36
  muted
37
37
  />
38
+ {displayInfo.title != displayInfo.id.slice(0, 12) && (
39
+ <IconInfo text={displayInfo.id.slice(0, 12)} icon={TagIcon} size={1} muted />
40
+ )}
38
41
  </Inline>
39
42
  </Stack>
40
43
  )
@@ -229,8 +229,8 @@ class MuxVideoInputUploader extends Component<Props, State> {
229
229
  this.state.isDraggingOver && (this.state.invalidPaste || this.state.invalidFile)
230
230
  ? 'critical'
231
231
  : this.state.isDraggingOver
232
- ? 'positive'
233
- : undefined
232
+ ? 'positive'
233
+ : undefined
234
234
  }
235
235
  onDrop={this.handleDrop}
236
236
  onDragOver={this.handleDragOver}
@@ -12,7 +12,7 @@ function tokenize(string: string): string[] {
12
12
  function toGroqParams(terms: string[]): Record<string, string> {
13
13
  const params: Record<string, string> = {}
14
14
  return terms.reduce((acc, term, i) => {
15
- acc[`t${i}`] = `${term}*` // "t" is short for term
15
+ acc[`t${i}`] = `*${term}*` // "t" is short for term
16
16
  return acc
17
17
  }, params)
18
18
  }
@@ -51,16 +51,14 @@ function extractTermsFromQuery(query: string): string[] {
51
51
  return [...quotedTerms, ...remainingTerms]
52
52
  }
53
53
 
54
- /** Which properties of the video asset document should we match users' queries against */
55
- const SEARCH_PATHS = ['filename']
56
-
57
54
  /**
58
55
  * Create GROQ constraints, given search terms and the full spec of available document types and fields.
59
56
  * Essentially a large list of all possible fields (joined by logical OR) to match our search terms against.
60
57
  */
61
- function createConstraints(terms: string[]) {
58
+ function createConstraints(terms: string[], includeAssetId: Boolean) {
59
+ const searchPaths = includeAssetId ? ['filename', 'assetId'] : ['filename']
62
60
  const constraints = terms
63
- .map((_term, i) => SEARCH_PATHS.map((joinedPath) => `${joinedPath} match $t${i}`))
61
+ .map((_term, i) => searchPaths.map((joinedPath) => `${joinedPath} match $t${i}`))
64
62
  .filter((constraint) => constraint.length > 0)
65
63
 
66
64
  return constraints.map((constraint) => `(${constraint.join(' || ')})`)
@@ -70,7 +68,7 @@ export function createSearchFilter(query: string) {
70
68
  const terms = extractTermsFromQuery(query)
71
69
 
72
70
  return {
73
- filter: createConstraints(terms),
71
+ filter: createConstraints(terms, query.length >= 8), // if the search is big enough, include the assetId (mux id) in the results
74
72
  params: {
75
73
  ...toGroqParams(terms),
76
74
  },
@@ -9,12 +9,12 @@ export type Audience = 'g' | 's' | 't' | 'v'
9
9
  export type Payload<T extends Audience> = T extends 'g'
10
10
  ? AnimatedThumbnailOptions
11
11
  : T extends 's'
12
- ? never
13
- : T extends 't'
14
- ? ThumbnailOptions
15
- : T extends 'v'
16
- ? never
17
- : never
12
+ ? never
13
+ : T extends 't'
14
+ ? ThumbnailOptions
15
+ : T extends 'v'
16
+ ? never
17
+ : never
18
18
 
19
19
  export function generateJwt<T extends Audience>(
20
20
  client: SanityClient,
@@ -8,7 +8,8 @@ export default function getVideoMetadata(doc: VideoAssetDocument) {
8
8
  : new Date(doc._createdAt || doc._updatedAt || Date.now())
9
9
 
10
10
  return {
11
- title: doc.filename || id.slice(0, 10),
11
+ title: doc.filename || id.slice(0, 12),
12
+ id: id,
12
13
  createdAt: date,
13
14
  duration: doc.data?.duration ? formatSeconds(doc.data?.duration) : undefined,
14
15
  aspect_ratio: doc.data?.aspect_ratio,