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/LICENSE +1 -1
- package/README.md +7 -7
- package/lib/index.cjs +40 -26
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +41 -27
- package/lib/index.js.map +1 -1
- package/package.json +20 -20
- package/src/components/VideoDetails/VideoDetails.tsx +8 -1
- package/src/components/VideoMetadata.tsx +4 -1
- package/src/components/__legacy__Uploader.tsx +2 -2
- package/src/util/createSearchFilter.ts +5 -7
- package/src/util/generateJwt.ts +6 -6
- package/src/util/getVideoMetadata.ts +2 -1
package/LICENSE
CHANGED
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
|
|
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
|
|
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/
|
|
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
|
|
19
|
+
npm install sanity-plugin-mux-input
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
or
|
|
23
23
|
|
|
24
24
|
```
|
|
25
|
-
yarn add
|
|
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
|
|
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
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
const constraints = terms.map((_term, i) =>
|
|
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.
|
|
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";
|
|
@@ -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.
|
|
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",
|
|
@@ -419,40 +420,40 @@ var dependencies = {
|
|
|
419
420
|
"use-error-boundary": "^2.0.6"
|
|
420
421
|
};
|
|
421
422
|
var devDependencies = {
|
|
422
|
-
"@commitlint/cli": "^17.
|
|
423
|
-
"@commitlint/config-conventional": "^17.
|
|
424
|
-
"@sanity/pkg-utils": "^2.4.
|
|
423
|
+
"@commitlint/cli": "^17.8.1",
|
|
424
|
+
"@commitlint/config-conventional": "^17.8.1",
|
|
425
|
+
"@sanity/pkg-utils": "^2.4.10",
|
|
425
426
|
"@sanity/plugin-kit": "^3.1.10",
|
|
426
|
-
"@sanity/semantic-release-preset": "^4.1.
|
|
427
|
-
"@sanity/vision": "^3.
|
|
428
|
-
"@types/react": "^18.2.
|
|
429
|
-
"@types/styled-components": "^5.1.
|
|
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.
|
|
434
|
-
"eslint-config-prettier": "^
|
|
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.
|
|
438
|
-
"eslint-plugin-prettier": "^5.0.
|
|
438
|
+
"eslint-plugin-import": "^2.29.0",
|
|
439
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
439
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
444
|
"lint-staged": "^13.3.0",
|
|
444
|
-
next: "^13.
|
|
445
|
-
"next-sanity": "^5.
|
|
445
|
+
next: "^13.5.6",
|
|
446
|
+
"next-sanity": "^5.5.10",
|
|
446
447
|
"npm-run-all": "^4.1.5",
|
|
447
|
-
prettier: "^3.0
|
|
448
|
-
"prettier-plugin-packagejson": "^2.4.
|
|
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.
|
|
454
|
+
sanity: "^3.19.2",
|
|
454
455
|
"styled-components": "^5.3.11",
|
|
455
|
-
typescript: "^5.
|
|
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,
|
|
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
|
});
|