sanity-plugin-mux-input 2.2.2 → 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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Sanity.io
3
+ Copyright (c) 2024 Sanity.io
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -3,11 +3,11 @@
3
3
  > This is a **Sanity Studio v3** plugin.
4
4
  > For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/sanity-plugin-mux-input/tree/studio-v2).
5
5
 
6
- This is a plugin that let you use [Mux](https://www.mux.com) video assets in your Sanity studio.
6
+ This plugin lets you use [Mux](https://www.mux.com) video assets in your Sanity studio.
7
7
 
8
- The Mux plugin for Sanity gives you a way to upload and preview videos easily.
8
+ The Mux plugin for Sanity allows you to easily upload and preview videos.
9
9
 
10
- [Read our blog post](https://www.sanity.io/blog/first-class-responsive-video-support-with-the-new-mux-plugin) about this plugin.
10
+ [Read our blog post](https://www.sanity.io/blog/video-management-with-mux) about this plugin.
11
11
 
12
12
  Not familiar with Sanity? [Visit www.sanity.io](https://www.sanity.io/)
13
13
 
@@ -16,18 +16,18 @@ Not familiar with Sanity? [Visit www.sanity.io](https://www.sanity.io/)
16
16
  ## Installation
17
17
 
18
18
  ```
19
- npm install --save-exact sanity-plugin-mux-input
19
+ npm install sanity-plugin-mux-input
20
20
  ```
21
21
 
22
22
  or
23
23
 
24
24
  ```
25
- yarn add --exact sanity-plugin-mux-input
25
+ yarn add sanity-plugin-mux-input
26
26
  ```
27
27
 
28
28
  ## Quick start
29
29
 
30
- - While in your project folder, run `npm i sanity-plugin-mux-input@studio-v3`.
30
+ - While in your project folder, run `npm i sanity-plugin-mux-input`.
31
31
  Read more about [using plugins in Sanity here](https://beta.sanity.io/docs/platform/studio/plugin).
32
32
 
33
33
  * Make a schema type that uses the plugin's type `mux.video`, for example:
@@ -77,7 +77,7 @@ The Mux plugin will find its access tokens by fetching this document.
77
77
 
78
78
  We recommend using [Mux Player](https://www.mux.com/player), try the [Codesandbox example](https://codesandbox.io/s/github/sanity-io/sanity-plugin-mux-input/tree/main/example).
79
79
 
80
- # Enabling Signed Urls
80
+ # Enabling Signed URLs
81
81
 
82
82
  To enable [signed urls](https://docs.mux.com/docs/security-signed-urls) with content uploaded to Mux, you will need to check the "Enable Signed Urls" option in the Mux Plugin configuration. Assuming that the API Access Token and Secret Key are set (as per the [Quick start](#quick-start) section).
83
83
 
package/lib/index.cjs CHANGED
@@ -59,7 +59,7 @@ function tokenize(string) {
59
59
  function toGroqParams(terms) {
60
60
  const params = {};
61
61
  return terms.reduce((acc, term, i) => {
62
- acc["t".concat(i)] = "".concat(term, "*");
62
+ acc["t".concat(i)] = "*".concat(term, "*");
63
63
  return acc;
64
64
  }, params);
65
65
  }
@@ -76,15 +76,16 @@ function extractTermsFromQuery(query) {
76
76
  const remainingTerms = lodash.uniq(lodash.compact(tokenize(lodash.toLower(unquotedQuery))));
77
77
  return [...quotedTerms, ...remainingTerms];
78
78
  }
79
- const SEARCH_PATHS = ["filename"];
80
- function createConstraints(terms) {
81
- const constraints = terms.map((_term, i) => SEARCH_PATHS.map(joinedPath => "".concat(joinedPath, " match $t").concat(i))).filter(constraint => constraint.length > 0);
79
+ function createConstraints(terms, includeAssetId) {
80
+ const searchPaths = includeAssetId ? ["filename", "assetId"] : ["filename"];
81
+ const constraints = terms.map((_term, i) => searchPaths.map(joinedPath => "".concat(joinedPath, " match $t").concat(i))).filter(constraint => constraint.length > 0);
82
82
  return constraints.map(constraint => "(".concat(constraint.join(" || "), ")"));
83
83
  }
84
84
  function createSearchFilter(query) {
85
85
  const terms = extractTermsFromQuery(query);
86
86
  return {
87
- filter: createConstraints(terms),
87
+ filter: createConstraints(terms, query.length >= 8),
88
+ // if the search is big enough, include the assetId (mux id) in the results
88
89
  params: {
89
90
  ...toGroqParams(terms)
90
91
  }
@@ -354,7 +355,7 @@ function getVideoSrc(_ref3) {
354
355
  return "https://stream.mux.com/".concat(playbackId, ".m3u8?").concat(searchParams);
355
356
  }
356
357
  var name = "sanity-plugin-mux-input";
357
- var version = "2.2.2";
358
+ var version = "2.2.4";
358
359
  var description = "An input component that integrates Sanity Studio with Mux video encoding/hosting service.";
359
360
  var keywords = ["sanity", "video", "mux", "input", "plugin", "sanity-plugin", "media"];
360
361
  var homepage = "https://github.com/sanity-io/sanity-plugin-mux-input#readme";
@@ -375,8 +376,8 @@ var exports$1 = {
375
376
  source: "./src/index.ts",
376
377
  require: "./lib/index.cjs",
377
378
  node: {
378
- "import": "./lib/index.cjs.js",
379
- require: "./lib/index.cjs"
379
+ module: "./lib/index.js",
380
+ "import": "./lib/index.cjs.js"
380
381
  },
381
382
  "import": "./lib/index.js",
382
383
  "default": "./lib/index.js"
@@ -402,8 +403,8 @@ var scripts = {
402
403
  watch: "pkg-utils watch --strict"
403
404
  };
404
405
  var dependencies = {
405
- "@mux/mux-player-react": "^1.11.4",
406
- "@mux/upchunk": "^3",
406
+ "@mux/mux-player-react": "1.15.0",
407
+ "@mux/upchunk": "^3.2.0",
407
408
  "@sanity/icons": "^2",
408
409
  "@sanity/incompatible-plugin": "^1",
409
410
  "@sanity/ui": "^1",
@@ -413,46 +414,46 @@ var dependencies = {
413
414
  "react-rx": "^2.1.3",
414
415
  rxjs: "^7",
415
416
  "scroll-into-view-if-needed": "^3",
416
- "suspend-react": "^0.1.0",
417
- swr: "^2.1.0",
418
- "type-fest": "^4.0.0",
417
+ "suspend-react": "^0.1.3",
418
+ swr: "^2.2.1",
419
+ "type-fest": "^4.2.0",
419
420
  "use-error-boundary": "^2.0.6"
420
421
  };
421
422
  var devDependencies = {
422
- "@commitlint/cli": "^17.6.7",
423
- "@commitlint/config-conventional": "^17.6.7",
424
- "@sanity/pkg-utils": "^2.3.10",
425
- "@sanity/plugin-kit": "^3.1.7",
426
- "@sanity/semantic-release-preset": "^4.1.2",
427
- "@sanity/vision": "^3.14.5",
428
- "@types/react": "^18.2.18",
429
- "@types/styled-components": "^5.1.26",
423
+ "@commitlint/cli": "^17.8.1",
424
+ "@commitlint/config-conventional": "^17.8.1",
425
+ "@sanity/pkg-utils": "^2.4.10",
426
+ "@sanity/plugin-kit": "^3.1.10",
427
+ "@sanity/semantic-release-preset": "^4.1.6",
428
+ "@sanity/vision": "^3.19.2",
429
+ "@types/react": "^18.2.37",
430
+ "@types/styled-components": "^5.1.30",
430
431
  "@typescript-eslint/eslint-plugin": "^5.62.0",
431
432
  "@typescript-eslint/parser": "^5.62.0",
432
433
  "cz-conventional-changelog": "^3.3.0",
433
- eslint: "^8.46.0",
434
- "eslint-config-prettier": "^8.10.0",
434
+ eslint: "^8.53.0",
435
+ "eslint-config-prettier": "^9.0.0",
435
436
  "eslint-config-react-app": "^7.0.1",
436
437
  "eslint-config-sanity": "^6.0.0",
437
- "eslint-plugin-import": "^2.28.0",
438
- "eslint-plugin-prettier": "^5.0.0",
439
- "eslint-plugin-react": "^7.33.1",
438
+ "eslint-plugin-import": "^2.29.0",
439
+ "eslint-plugin-prettier": "^5.0.1",
440
+ "eslint-plugin-react": "^7.33.2",
440
441
  "eslint-plugin-react-hooks": "^4.6.0",
441
442
  "eslint-plugin-simple-import-sort": "^10.0.0",
442
443
  husky: "^8.0.3",
443
- "lint-staged": "^13.2.3",
444
- next: "^13.4.12",
445
- "next-sanity": "^5.1.6",
444
+ "lint-staged": "^13.3.0",
445
+ next: "^13.5.6",
446
+ "next-sanity": "^5.5.10",
446
447
  "npm-run-all": "^4.1.5",
447
- prettier: "^3.0.1",
448
- "prettier-plugin-packagejson": "^2.4.5",
448
+ prettier: "^3.1.0",
449
+ "prettier-plugin-packagejson": "^2.4.6",
449
450
  react: "^18.2.0",
450
451
  "react-dom": "^18.2.0",
451
452
  "react-is": "^18.2.0",
452
453
  rimraf: "^5.0.0",
453
- sanity: "^3.14.5",
454
+ sanity: "^3.19.2",
454
455
  "styled-components": "^5.3.11",
455
- typescript: "^5.1.6"
456
+ typescript: "^5.2.2"
456
457
  };
457
458
  var peerDependencies = {
458
459
  react: "^18",
@@ -1017,7 +1018,8 @@ function getVideoMetadata(doc) {
1017
1018
  const id = doc.assetId || doc._id || "";
1018
1019
  const date = ((_a = doc.data) == null ? void 0 : _a.created_at) ? new Date(Number(doc.data.created_at) * 1e3) : new Date(doc._createdAt || doc._updatedAt || Date.now());
1019
1020
  return {
1020
- title: doc.filename || id.slice(0, 10),
1021
+ title: doc.filename || id.slice(0, 12),
1022
+ id,
1021
1023
  createdAt: date,
1022
1024
  duration: ((_b = doc.data) == null ? void 0 : _b.duration) ? formatSeconds((_c = doc.data) == null ? void 0 : _c.duration) : void 0,
1023
1025
  aspect_ratio: (_d = doc.data) == null ? void 0 : _d.aspect_ratio,
@@ -1268,6 +1270,9 @@ const VideoDetails = props => {
1268
1270
  "aria-labelledby": "details-tab",
1269
1271
  id: "details-panel",
1270
1272
  hidden: tab !== "details",
1273
+ style: {
1274
+ wordBreak: "break-word"
1275
+ },
1271
1276
  children: /* @__PURE__ */jsxRuntime.jsxs(ui.Stack, {
1272
1277
  space: 4,
1273
1278
  children: [/* @__PURE__ */jsxRuntime.jsx(AssetInput, {
@@ -1305,6 +1310,10 @@ const VideoDetails = props => {
1305
1310
  })),
1306
1311
  icon: icons.CalendarIcon,
1307
1312
  size: 2
1313
+ }), /* @__PURE__ */jsxRuntime.jsx(IconInfo, {
1314
+ text: "Mux ID: \n".concat(displayInfo.id),
1315
+ icon: icons.TagIcon,
1316
+ size: 2
1308
1317
  })]
1309
1318
  })]
1310
1319
  })
@@ -1349,6 +1358,11 @@ const VideoMetadata = props => {
1349
1358
  icon: icons.CalendarIcon,
1350
1359
  size: 1,
1351
1360
  muted: true
1361
+ }), displayInfo.title != displayInfo.id.slice(0, 12) && /* @__PURE__ */jsxRuntime.jsx(IconInfo, {
1362
+ text: displayInfo.id.slice(0, 12),
1363
+ icon: icons.TagIcon,
1364
+ size: 1,
1365
+ muted: true
1352
1366
  })]
1353
1367
  })]
1354
1368
  });
package/lib/index.cjs.js CHANGED
@@ -3,4 +3,3 @@ import cjs from './index.cjs';
3
3
  export const defaultConfig = cjs.defaultConfig;
4
4
  export const muxInput = cjs.muxInput;
5
5
 
6
- export default cjs.default;