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/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useClient as useClient$1, createHookFromObservableFactory, useDocumentStore, collate, SanityDefaultPreview, useTimeAgo, TextWithTone, isRecord, getPreviewStateObservable, getPreviewValueWithFallback, DocumentPreviewPresence, useDocumentPreviewStore, useSchema, useDocumentPresence, PreviewCard, useDocumentValues, isReference, useProjectId, useDataset, PatchEvent, unset, setIfMissing, set, LinearProgress, definePlugin } from 'sanity';
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { SortIcon, WarningOutlineIcon, EditIcon, PublishIcon, DocumentIcon, TrashIcon, CheckmarkIcon, ErrorOutlineIcon, RevertIcon, SearchIcon, ClockIcon, CropIcon, CalendarIcon, LockIcon, PlayIcon, UploadIcon, PlugIcon, ResetIcon, EllipsisVerticalIcon, DocumentVideoIcon } from '@sanity/icons';
|
|
3
|
+
import { SortIcon, WarningOutlineIcon, EditIcon, PublishIcon, DocumentIcon, TrashIcon, CheckmarkIcon, ErrorOutlineIcon, RevertIcon, SearchIcon, ClockIcon, CropIcon, CalendarIcon, TagIcon, LockIcon, PlayIcon, UploadIcon, PlugIcon, ResetIcon, EllipsisVerticalIcon, DocumentVideoIcon } from '@sanity/icons';
|
|
4
4
|
import { MenuButton, Button, Menu, MenuItem, Box, Spinner, Stack, Flex, Text, Card, Tooltip, Inline, useToast, Dialog, Heading, Checkbox, TabList, Tab, TabPanel, TextInput, Label as Label$1, Grid, Code, useClickOutside, Popover, MenuDivider, rem } from '@sanity/ui';
|
|
5
5
|
import React, { useState, useMemo, useId, memo, isValidElement, useEffect, useRef, useCallback, createElement, forwardRef, Component, useReducer, Suspense } from 'react';
|
|
6
6
|
import { words, trim, toLower, uniq, compact, isString, isNumber } from 'lodash';
|
|
@@ -44,7 +44,7 @@ function tokenize(string) {
|
|
|
44
44
|
function toGroqParams(terms) {
|
|
45
45
|
const params = {};
|
|
46
46
|
return terms.reduce((acc, term, i) => {
|
|
47
|
-
acc["t".concat(i)] = "".concat(term, "*");
|
|
47
|
+
acc["t".concat(i)] = "*".concat(term, "*");
|
|
48
48
|
return acc;
|
|
49
49
|
}, params);
|
|
50
50
|
}
|
|
@@ -61,15 +61,16 @@ function extractTermsFromQuery(query) {
|
|
|
61
61
|
const remainingTerms = uniq(compact(tokenize(toLower(unquotedQuery))));
|
|
62
62
|
return [...quotedTerms, ...remainingTerms];
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const constraints = terms.map((_term, i) =>
|
|
64
|
+
function createConstraints(terms, includeAssetId) {
|
|
65
|
+
const searchPaths = includeAssetId ? ["filename", "assetId"] : ["filename"];
|
|
66
|
+
const constraints = terms.map((_term, i) => searchPaths.map(joinedPath => "".concat(joinedPath, " match $t").concat(i))).filter(constraint => constraint.length > 0);
|
|
67
67
|
return constraints.map(constraint => "(".concat(constraint.join(" || "), ")"));
|
|
68
68
|
}
|
|
69
69
|
function createSearchFilter(query) {
|
|
70
70
|
const terms = extractTermsFromQuery(query);
|
|
71
71
|
return {
|
|
72
|
-
filter: createConstraints(terms),
|
|
72
|
+
filter: createConstraints(terms, query.length >= 8),
|
|
73
|
+
// if the search is big enough, include the assetId (mux id) in the results
|
|
73
74
|
params: {
|
|
74
75
|
...toGroqParams(terms)
|
|
75
76
|
}
|
|
@@ -339,7 +340,7 @@ function getVideoSrc(_ref3) {
|
|
|
339
340
|
return "https://stream.mux.com/".concat(playbackId, ".m3u8?").concat(searchParams);
|
|
340
341
|
}
|
|
341
342
|
var name = "sanity-plugin-mux-input";
|
|
342
|
-
var version = "2.2.
|
|
343
|
+
var version = "2.2.4";
|
|
343
344
|
var description = "An input component that integrates Sanity Studio with Mux video encoding/hosting service.";
|
|
344
345
|
var keywords = ["sanity", "video", "mux", "input", "plugin", "sanity-plugin", "media"];
|
|
345
346
|
var homepage = "https://github.com/sanity-io/sanity-plugin-mux-input#readme";
|
|
@@ -387,8 +388,8 @@ var scripts = {
|
|
|
387
388
|
watch: "pkg-utils watch --strict"
|
|
388
389
|
};
|
|
389
390
|
var dependencies = {
|
|
390
|
-
"@mux/mux-player-react": "1.
|
|
391
|
-
"@mux/upchunk": "^3",
|
|
391
|
+
"@mux/mux-player-react": "1.15.0",
|
|
392
|
+
"@mux/upchunk": "^3.2.0",
|
|
392
393
|
"@sanity/icons": "^2",
|
|
393
394
|
"@sanity/incompatible-plugin": "^1",
|
|
394
395
|
"@sanity/ui": "^1",
|
|
@@ -404,40 +405,40 @@ var dependencies = {
|
|
|
404
405
|
"use-error-boundary": "^2.0.6"
|
|
405
406
|
};
|
|
406
407
|
var devDependencies = {
|
|
407
|
-
"@commitlint/cli": "^17.
|
|
408
|
-
"@commitlint/config-conventional": "^17.
|
|
409
|
-
"@sanity/pkg-utils": "^2.4.
|
|
408
|
+
"@commitlint/cli": "^17.8.1",
|
|
409
|
+
"@commitlint/config-conventional": "^17.8.1",
|
|
410
|
+
"@sanity/pkg-utils": "^2.4.10",
|
|
410
411
|
"@sanity/plugin-kit": "^3.1.10",
|
|
411
|
-
"@sanity/semantic-release-preset": "^4.1.
|
|
412
|
-
"@sanity/vision": "^3.
|
|
413
|
-
"@types/react": "^18.2.
|
|
414
|
-
"@types/styled-components": "^5.1.
|
|
412
|
+
"@sanity/semantic-release-preset": "^4.1.6",
|
|
413
|
+
"@sanity/vision": "^3.19.2",
|
|
414
|
+
"@types/react": "^18.2.37",
|
|
415
|
+
"@types/styled-components": "^5.1.30",
|
|
415
416
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
416
417
|
"@typescript-eslint/parser": "^5.62.0",
|
|
417
418
|
"cz-conventional-changelog": "^3.3.0",
|
|
418
|
-
eslint: "^8.
|
|
419
|
-
"eslint-config-prettier": "^
|
|
419
|
+
eslint: "^8.53.0",
|
|
420
|
+
"eslint-config-prettier": "^9.0.0",
|
|
420
421
|
"eslint-config-react-app": "^7.0.1",
|
|
421
422
|
"eslint-config-sanity": "^6.0.0",
|
|
422
|
-
"eslint-plugin-import": "^2.
|
|
423
|
-
"eslint-plugin-prettier": "^5.0.
|
|
423
|
+
"eslint-plugin-import": "^2.29.0",
|
|
424
|
+
"eslint-plugin-prettier": "^5.0.1",
|
|
424
425
|
"eslint-plugin-react": "^7.33.2",
|
|
425
426
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
426
427
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
427
428
|
husky: "^8.0.3",
|
|
428
429
|
"lint-staged": "^13.3.0",
|
|
429
|
-
next: "^13.
|
|
430
|
-
"next-sanity": "^5.
|
|
430
|
+
next: "^13.5.6",
|
|
431
|
+
"next-sanity": "^5.5.10",
|
|
431
432
|
"npm-run-all": "^4.1.5",
|
|
432
|
-
prettier: "^3.0
|
|
433
|
-
"prettier-plugin-packagejson": "^2.4.
|
|
433
|
+
prettier: "^3.1.0",
|
|
434
|
+
"prettier-plugin-packagejson": "^2.4.6",
|
|
434
435
|
react: "^18.2.0",
|
|
435
436
|
"react-dom": "^18.2.0",
|
|
436
437
|
"react-is": "^18.2.0",
|
|
437
438
|
rimraf: "^5.0.0",
|
|
438
|
-
sanity: "^3.
|
|
439
|
+
sanity: "^3.19.2",
|
|
439
440
|
"styled-components": "^5.3.11",
|
|
440
|
-
typescript: "^5.
|
|
441
|
+
typescript: "^5.2.2"
|
|
441
442
|
};
|
|
442
443
|
var peerDependencies = {
|
|
443
444
|
react: "^18",
|
|
@@ -1002,7 +1003,8 @@ function getVideoMetadata(doc) {
|
|
|
1002
1003
|
const id = doc.assetId || doc._id || "";
|
|
1003
1004
|
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());
|
|
1004
1005
|
return {
|
|
1005
|
-
title: doc.filename || id.slice(0,
|
|
1006
|
+
title: doc.filename || id.slice(0, 12),
|
|
1007
|
+
id,
|
|
1006
1008
|
createdAt: date,
|
|
1007
1009
|
duration: ((_b = doc.data) == null ? void 0 : _b.duration) ? formatSeconds((_c = doc.data) == null ? void 0 : _c.duration) : void 0,
|
|
1008
1010
|
aspect_ratio: (_d = doc.data) == null ? void 0 : _d.aspect_ratio,
|
|
@@ -1253,6 +1255,9 @@ const VideoDetails = props => {
|
|
|
1253
1255
|
"aria-labelledby": "details-tab",
|
|
1254
1256
|
id: "details-panel",
|
|
1255
1257
|
hidden: tab !== "details",
|
|
1258
|
+
style: {
|
|
1259
|
+
wordBreak: "break-word"
|
|
1260
|
+
},
|
|
1256
1261
|
children: /* @__PURE__ */jsxs(Stack, {
|
|
1257
1262
|
space: 4,
|
|
1258
1263
|
children: [/* @__PURE__ */jsx(AssetInput, {
|
|
@@ -1290,6 +1295,10 @@ const VideoDetails = props => {
|
|
|
1290
1295
|
})),
|
|
1291
1296
|
icon: CalendarIcon,
|
|
1292
1297
|
size: 2
|
|
1298
|
+
}), /* @__PURE__ */jsx(IconInfo, {
|
|
1299
|
+
text: "Mux ID: \n".concat(displayInfo.id),
|
|
1300
|
+
icon: TagIcon,
|
|
1301
|
+
size: 2
|
|
1293
1302
|
})]
|
|
1294
1303
|
})]
|
|
1295
1304
|
})
|
|
@@ -1334,6 +1343,11 @@ const VideoMetadata = props => {
|
|
|
1334
1343
|
icon: CalendarIcon,
|
|
1335
1344
|
size: 1,
|
|
1336
1345
|
muted: true
|
|
1346
|
+
}), displayInfo.title != displayInfo.id.slice(0, 12) && /* @__PURE__ */jsx(IconInfo, {
|
|
1347
|
+
text: displayInfo.id.slice(0, 12),
|
|
1348
|
+
icon: TagIcon,
|
|
1349
|
+
size: 1,
|
|
1350
|
+
muted: true
|
|
1337
1351
|
})]
|
|
1338
1352
|
})]
|
|
1339
1353
|
});
|