sanity-plugin-mux-input 2.0.17 → 2.1.0

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.
Files changed (36) hide show
  1. package/lib/_chunks/Player-d8f163ed.cjs +474 -0
  2. package/lib/_chunks/Player-d8f163ed.cjs.map +1 -0
  3. package/lib/_chunks/Player-fb9712c0.js +465 -0
  4. package/lib/_chunks/Player-fb9712c0.js.map +1 -0
  5. package/lib/_chunks/index-0656ede8.js +3229 -0
  6. package/lib/_chunks/index-0656ede8.js.map +1 -0
  7. package/lib/_chunks/index-9cd542f1.cjs +3271 -0
  8. package/lib/_chunks/index-9cd542f1.cjs.map +1 -0
  9. package/lib/index.cjs +1 -1
  10. package/lib/index.d.ts +97 -0
  11. package/lib/index.js +1 -1
  12. package/package.json +7 -8
  13. package/src/components/Input.tsx +34 -29
  14. package/src/components/__legacy__Uploader.tsx +7 -2
  15. package/src/index.ts +8 -49
  16. package/src/plugin.tsx +31 -0
  17. package/src/schema.tsx +42 -0
  18. package/lib/_chunks/Input-1b053a16.js +0 -189
  19. package/lib/_chunks/Input-1b053a16.js.map +0 -1
  20. package/lib/_chunks/Input-42aef09c.cjs +0 -189
  21. package/lib/_chunks/Input-42aef09c.cjs.map +0 -1
  22. package/lib/_chunks/Preview-22ff2e4a.cjs +0 -28
  23. package/lib/_chunks/Preview-22ff2e4a.cjs.map +0 -1
  24. package/lib/_chunks/Preview-af721846.js +0 -26
  25. package/lib/_chunks/Preview-af721846.js.map +0 -1
  26. package/lib/_chunks/VideoSource.styled-81ae8d6c.js +0 -318
  27. package/lib/_chunks/VideoSource.styled-81ae8d6c.js.map +0 -1
  28. package/lib/_chunks/VideoSource.styled-dda7be42.cjs +0 -336
  29. package/lib/_chunks/VideoSource.styled-dda7be42.cjs.map +0 -1
  30. package/lib/_chunks/index-376871b4.js +0 -248
  31. package/lib/_chunks/index-376871b4.js.map +0 -1
  32. package/lib/_chunks/index-3999f947.cjs +0 -265
  33. package/lib/_chunks/index-3999f947.cjs.map +0 -1
  34. package/src/components/FormInput.tsx +0 -26
  35. package/src/components/FormPreview.tsx +0 -19
  36. package/src/components/Preview.tsx +0 -33
@@ -1,265 +0,0 @@
1
- 'use strict';
2
-
3
- var _templateObject;
4
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
5
- var sanity = require('sanity');
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var React = require('react');
8
- var ui = require('@sanity/ui');
9
- var scrollIntoView = require('scroll-into-view-if-needed');
10
- var suspendReact = require('suspend-react');
11
- var useErrorBoundary = require('use-error-boundary');
12
- var styled = require('styled-components');
13
- function _interopDefaultCompat(e) {
14
- return e && typeof e === 'object' && 'default' in e ? e : {
15
- default: e
16
- };
17
- }
18
- var scrollIntoView__default = /*#__PURE__*/_interopDefaultCompat(scrollIntoView);
19
- var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
20
- function isMuxInputProps(props) {
21
- var _a;
22
- return sanity.isObjectInputProps(props) && ((_a = props.schemaType.type) == null ? void 0 : _a.name) === "mux.video";
23
- }
24
- function isMuxInputPreviewProps(props) {
25
- var _a, _b;
26
- return ((_b = (_a = props.schemaType) == null ? void 0 : _a.type) == null ? void 0 : _b.name) === "mux.video";
27
- }
28
- const name = "mux-input";
29
- const cacheNs = "sanity-plugin-mux-input";
30
- const muxSecretsDocumentId = "secrets.mux";
31
- function ErrorBoundaryCard(props) {
32
- const {
33
- children,
34
- schemaType
35
- } = props;
36
- const {
37
- push: pushToast
38
- } = ui.useToast();
39
- const errorRef = React.useRef(null);
40
- const {
41
- ErrorBoundary,
42
- didCatch,
43
- error,
44
- reset
45
- } = useErrorBoundary.useErrorBoundary({
46
- onDidCatch: (err, errorInfo) => {
47
- console.group(err.toString());
48
- console.groupCollapsed("console.error");
49
- console.error(err);
50
- console.groupEnd();
51
- if (err.stack) {
52
- console.groupCollapsed("error.stack");
53
- console.log(err.stack);
54
- console.groupEnd();
55
- }
56
- if (errorInfo == null ? void 0 : errorInfo.componentStack) {
57
- console.groupCollapsed("errorInfo.componentStack");
58
- console.log(errorInfo.componentStack);
59
- console.groupEnd();
60
- }
61
- console.groupEnd();
62
- pushToast({
63
- status: "error",
64
- title: "Plugin crashed",
65
- description: /* @__PURE__ */jsxRuntime.jsx(ui.Flex, {
66
- align: "center",
67
- children: /* @__PURE__ */jsxRuntime.jsxs(ui.Inline, {
68
- space: 1,
69
- children: ["An error happened while rendering", /* @__PURE__ */jsxRuntime.jsx(ui.Button, {
70
- padding: 1,
71
- fontSize: 1,
72
- style: {
73
- transform: "translateY(1px)"
74
- },
75
- mode: "ghost",
76
- text: schemaType.title,
77
- onClick: () => {
78
- if (errorRef.current) {
79
- scrollIntoView__default.default(errorRef.current, {
80
- behavior: "smooth",
81
- scrollMode: "if-needed",
82
- block: "center"
83
- });
84
- }
85
- }
86
- })]
87
- })
88
- })
89
- });
90
- }
91
- });
92
- const handleRetry = React.useCallback(() => {
93
- suspendReact.clear([name]);
94
- reset();
95
- }, [reset]);
96
- if (didCatch) {
97
- return /* @__PURE__ */jsxRuntime.jsx(ui.Card, {
98
- ref: errorRef,
99
- paddingX: [2, 3, 4, 4],
100
- height: "fill",
101
- shadow: 1,
102
- overflow: "auto",
103
- children: /* @__PURE__ */jsxRuntime.jsx(ui.Flex, {
104
- justify: "flex-start",
105
- align: "center",
106
- height: "fill",
107
- children: /* @__PURE__ */jsxRuntime.jsxs(ui.Grid, {
108
- columns: 1,
109
- gap: [2, 3, 4, 4],
110
- children: [/* @__PURE__ */jsxRuntime.jsxs(ui.Heading, {
111
- as: "h1",
112
- children: ["The ", /* @__PURE__ */jsxRuntime.jsx("code", {
113
- children: name
114
- }), " plugin crashed"]
115
- }), (error == null ? void 0 : error.message) && /* @__PURE__ */jsxRuntime.jsx(ui.Card, {
116
- padding: 3,
117
- tone: "critical",
118
- shadow: 1,
119
- radius: 2,
120
- children: /* @__PURE__ */jsxRuntime.jsx(ui.Text, {
121
- children: error.message
122
- })
123
- }), /* @__PURE__ */jsxRuntime.jsx(ui.Inline, {
124
- children: /* @__PURE__ */jsxRuntime.jsx(ui.Button, {
125
- onClick: handleRetry,
126
- text: "Retry"
127
- })
128
- })]
129
- })
130
- })
131
- });
132
- }
133
- return /* @__PURE__ */jsxRuntime.jsx(ErrorBoundary, {
134
- children
135
- });
136
- }
137
- var ErrorBoundaryCard$1 = React.memo(ErrorBoundaryCard);
138
- const AspectRatioCard = styled__default.default(ui.Card)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n"])));
139
- const InputFallback = () => {
140
- return /* @__PURE__ */jsxRuntime.jsx("div", {
141
- style: {
142
- padding: 1
143
- },
144
- children: /* @__PURE__ */jsxRuntime.jsx(ui.Card, {
145
- shadow: 1,
146
- sizing: "border",
147
- style: {
148
- aspectRatio: "16/9",
149
- width: "100%",
150
- borderRadius: "1px"
151
- },
152
- children: /* @__PURE__ */jsxRuntime.jsxs(ui.Flex, {
153
- align: "center",
154
- direction: "column",
155
- height: "fill",
156
- justify: "center",
157
- children: [/* @__PURE__ */jsxRuntime.jsx(ui.Spinner, {
158
- muted: true
159
- }), /* @__PURE__ */jsxRuntime.jsx(ui.Box, {
160
- marginTop: 3,
161
- children: /* @__PURE__ */jsxRuntime.jsx(ui.Text, {
162
- align: "center",
163
- muted: true,
164
- size: 1,
165
- children: "Loading\u2026"
166
- })
167
- })]
168
- })
169
- })
170
- });
171
- };
172
- const Input = React.lazy(() => Promise.resolve().then(function () {
173
- return require('./Input-42aef09c.cjs');
174
- }));
175
- var createFormInput = config => React.memo(function FormInput(props) {
176
- if (isMuxInputProps(props)) {
177
- return /* @__PURE__ */jsxRuntime.jsx(AspectRatioCard, {
178
- children: /* @__PURE__ */jsxRuntime.jsx(ErrorBoundaryCard$1, {
179
- schemaType: props.schemaType,
180
- children: /* @__PURE__ */jsxRuntime.jsx(React.Suspense, {
181
- fallback: /* @__PURE__ */jsxRuntime.jsx(InputFallback, {}),
182
- children: /* @__PURE__ */jsxRuntime.jsx(Input, {
183
- config,
184
- ...props
185
- })
186
- })
187
- })
188
- });
189
- }
190
- return props.renderDefault(props);
191
- });
192
- const Preview = React.lazy(() => Promise.resolve().then(function () {
193
- return require('./Preview-22ff2e4a.cjs');
194
- }));
195
- var FormPreview = React.memo(function FormPreview(props) {
196
- if (isMuxInputPreviewProps(props)) {
197
- return /* @__PURE__ */jsxRuntime.jsx(AspectRatioCard, {
198
- children: /* @__PURE__ */jsxRuntime.jsx(Preview, {
199
- ...props
200
- })
201
- });
202
- }
203
- return props.renderDefault(props);
204
- });
205
- const defaultConfig = {
206
- mp4_support: "none"
207
- };
208
- const muxInput = sanity.definePlugin(userConfig => {
209
- const config = {
210
- ...defaultConfig,
211
- ...userConfig
212
- };
213
- const InputComponent = createFormInput(config);
214
- return {
215
- name: "mux-input",
216
- form: {
217
- components: {
218
- input: InputComponent,
219
- preview: FormPreview
220
- }
221
- },
222
- schema: {
223
- types: [{
224
- name: "mux.video",
225
- type: "object",
226
- title: "Video asset reference",
227
- fields: [{
228
- title: "Video",
229
- name: "asset",
230
- type: "reference",
231
- weak: true,
232
- to: [{
233
- type: "mux.videoAsset"
234
- }]
235
- }]
236
- }, {
237
- name: "mux.videoAsset",
238
- type: "object",
239
- title: "Video asset",
240
- fields: [{
241
- type: "string",
242
- name: "status"
243
- }, {
244
- type: "string",
245
- name: "assetId"
246
- }, {
247
- type: "string",
248
- name: "playbackId"
249
- }, {
250
- type: "string",
251
- name: "filename"
252
- }, {
253
- type: "number",
254
- name: "thumbTime"
255
- }]
256
- }]
257
- }
258
- };
259
- });
260
- exports.InputFallback = InputFallback;
261
- exports.cacheNs = cacheNs;
262
- exports.defaultConfig = defaultConfig;
263
- exports.muxInput = muxInput;
264
- exports.muxSecretsDocumentId = muxSecretsDocumentId;
265
- //# sourceMappingURL=index-3999f947.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-3999f947.cjs","sources":["../../src/util/asserters.ts","../../src/util/constants.ts","../../src/components/ErrorBoundaryCard.tsx","../../src/components/Input.styled.tsx","../../src/components/FormInput.tsx","../../src/components/FormPreview.tsx","../../src/index.ts"],"sourcesContent":["import {type InputProps, isObjectInputProps, type PreviewLayoutKey, type PreviewProps} from 'sanity'\n\nimport type {MuxInputPreviewProps, MuxInputProps} from './types'\n\nexport function isMuxInputProps(props: InputProps): props is MuxInputProps {\n return isObjectInputProps(props) && props.schemaType.type?.name === 'mux.video'\n}\n\nexport function isMuxInputPreviewProps(\n props: PreviewProps<PreviewLayoutKey>\n): props is MuxInputPreviewProps {\n return props.schemaType?.type?.name === 'mux.video'\n}\n","export const name = 'mux-input' as const\n\n// Caching namespace, as suspend-react might be in use by other components on the page we must ensure we don't collide\nexport const cacheNs = 'sanity-plugin-mux-input' as const\n\nexport const muxSecretsDocumentId = 'secrets.mux' as const\n","/* eslint-disable no-console */\nimport {Button, Card, Flex, Grid, Heading, Inline, Text, useToast} from '@sanity/ui'\nimport React, {memo, useCallback, useRef} from 'react'\nimport scrollIntoView from 'scroll-into-view-if-needed'\nimport {clear} from 'suspend-react'\nimport {useErrorBoundary} from 'use-error-boundary'\n\nimport {name} from '../util/constants'\nimport {type MuxInputProps} from '../util/types'\n\nexport interface Props extends Pick<MuxInputProps, 'schemaType'> {\n children: React.ReactNode\n}\nfunction ErrorBoundaryCard(props: Props) {\n const {children, schemaType} = props\n const {push: pushToast} = useToast()\n const errorRef = useRef(null)\n const {ErrorBoundary, didCatch, error, reset} = useErrorBoundary({\n onDidCatch: (err, errorInfo) => {\n console.group(err.toString())\n console.groupCollapsed('console.error')\n console.error(err)\n console.groupEnd()\n if (err.stack) {\n console.groupCollapsed('error.stack')\n console.log(err.stack)\n console.groupEnd()\n }\n if (errorInfo?.componentStack) {\n console.groupCollapsed('errorInfo.componentStack')\n console.log(errorInfo.componentStack)\n console.groupEnd()\n }\n console.groupEnd()\n pushToast({\n status: 'error',\n title: 'Plugin crashed',\n description: (\n <Flex align=\"center\">\n <Inline space={1}>\n An error happened while rendering\n <Button\n padding={1}\n fontSize={1}\n style={{transform: 'translateY(1px)'}}\n mode=\"ghost\"\n text={schemaType.title}\n onClick={() => {\n if (errorRef.current) {\n scrollIntoView(errorRef.current, {\n behavior: 'smooth',\n scrollMode: 'if-needed',\n block: 'center',\n })\n }\n }}\n />\n </Inline>\n </Flex>\n ),\n })\n },\n })\n const handleRetry = useCallback(() => {\n // Purge request cache before retrying, otherwise the cached errors will rethrow\n clear([name])\n\n reset()\n }, [reset])\n\n if (didCatch) {\n return (\n <Card ref={errorRef} paddingX={[2, 3, 4, 4]} height=\"fill\" shadow={1} overflow=\"auto\">\n <Flex justify=\"flex-start\" align=\"center\" height=\"fill\">\n <Grid columns={1} gap={[2, 3, 4, 4]}>\n <Heading as=\"h1\">\n The <code>{name}</code> plugin crashed\n </Heading>\n {error?.message && (\n <Card padding={3} tone=\"critical\" shadow={1} radius={2}>\n <Text>{error.message}</Text>\n </Card>\n )}\n <Inline>\n <Button onClick={handleRetry} text=\"Retry\" />\n </Inline>\n </Grid>\n </Flex>\n </Card>\n )\n }\n\n return <ErrorBoundary>{children}</ErrorBoundary>\n}\n\nexport default memo(ErrorBoundaryCard)\n","import {Box, Card, Flex, Spinner, Text} from '@sanity/ui'\nimport React from 'react'\nimport styled from 'styled-components'\n\n// This container base container ensures everything uses the same aspect ratio, avoids layout shifts and stuff jumping around\nexport const AspectRatioCard = styled(Card)`\n aspect-ratio: 16 / 9;\n position: relative;\n width: 100%;\n`\n\nexport const InputFallback = () => {\n return (\n <div style={{padding: 1}}>\n <Card\n shadow={1}\n sizing=\"border\"\n style={{aspectRatio: '16/9', width: '100%', borderRadius: '1px'}}\n >\n <Flex align=\"center\" direction=\"column\" height=\"fill\" justify=\"center\">\n <Spinner muted />\n <Box marginTop={3}>\n <Text align=\"center\" muted size={1}>\n Loading…\n </Text>\n </Box>\n </Flex>\n </Card>\n </div>\n )\n}\n","import React, {lazy, memo, Suspense} from 'react'\nimport {type InputProps} from 'sanity'\n\nimport {isMuxInputProps} from '../util/asserters'\nimport {type Config} from '../util/types'\nimport ErrorBoundaryCard from './ErrorBoundaryCard'\nimport {AspectRatioCard, InputFallback} from './Input.styled'\n\nconst Input = lazy(() => import('./Input'))\n\n// eslint-disable-next-line import/no-anonymous-default-export\nexport default (config: Config) =>\n memo(function FormInput(props: InputProps) {\n if (isMuxInputProps(props)) {\n return (\n <AspectRatioCard>\n <ErrorBoundaryCard schemaType={props.schemaType}>\n <Suspense fallback={<InputFallback />}>\n <Input config={config} {...props} />\n </Suspense>\n </ErrorBoundaryCard>\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n })\n","import React, {lazy, memo} from 'react'\nimport {PreviewLayoutKey, PreviewProps} from 'sanity'\n\nimport {isMuxInputPreviewProps} from '../util/asserters'\nimport {AspectRatioCard} from './Input.styled'\n\nconst Preview = lazy(() => import('./Preview'))\n\nexport default memo(function FormPreview(props: PreviewProps<PreviewLayoutKey>) {\n if (isMuxInputPreviewProps(props)) {\n return (\n <AspectRatioCard>\n {/* @ts-expect-error */}\n <Preview {...props} />\n </AspectRatioCard>\n )\n }\n return props.renderDefault(props)\n})\n","import {definePlugin} from 'sanity'\n\nimport createFormInput from './components/FormInput'\nimport FormPreview from './components/FormPreview'\nimport {type Config} from './util/types'\n\nexport const defaultConfig: Config = {\n mp4_support: 'none',\n}\n\nexport const muxInput = definePlugin<Partial<Config> | void>((userConfig) => {\n const config: Config = {...defaultConfig, ...userConfig}\n const InputComponent = createFormInput(config)\n return {\n name: 'mux-input',\n form: {\n components: {\n input: InputComponent,\n preview: FormPreview,\n },\n },\n schema: {\n types: [\n {\n name: 'mux.video',\n type: 'object',\n title: 'Video asset reference',\n fields: [\n {\n title: 'Video',\n name: 'asset',\n type: 'reference',\n weak: true,\n to: [{type: 'mux.videoAsset'}],\n },\n ],\n },\n {\n name: 'mux.videoAsset',\n type: 'object',\n title: 'Video asset',\n fields: [\n {\n type: 'string',\n name: 'status',\n },\n {\n type: 'string',\n name: 'assetId',\n },\n {\n type: 'string',\n name: 'playbackId',\n },\n {\n type: 'string',\n name: 'filename',\n },\n {\n type: 'number',\n name: 'thumbTime',\n },\n ],\n },\n ],\n },\n }\n})\n"],"names":["isMuxInputProps","props","_a","isObjectInputProps","schemaType","type","name","isMuxInputPreviewProps","_b","cacheNs","muxSecretsDocumentId","ErrorBoundaryCard","children","push","pushToast","useToast","errorRef","useRef","ErrorBoundary","didCatch","error","reset","useErrorBoundary","onDidCatch","err","errorInfo","console","group","toString","groupCollapsed","groupEnd","stack","log","componentStack","status","title","description","Flex","align","jsxs","Inline","space","jsx","Button","padding","fontSize","style","transform","mode","text","onClick","current","scrollIntoView","default","behavior","scrollMode","block","handleRetry","useCallback","clear","Card","ref","paddingX","height","shadow","overflow","justify","Grid","columns","gap","Heading","as","message","tone","radius","Text","memo","AspectRatioCard","styled","_templateObject","_taggedTemplateLiteral","InputFallback","sizing","aspectRatio","width","borderRadius","direction","Spinner","muted","Box","marginTop","size","Input","lazy","Promise","resolve","then","require","createFormInput","config","FormInput","Suspense","fallback","renderDefault","Preview","FormPreview","defaultConfig","mp4_support","muxInput","definePlugin","userConfig","InputComponent","form","components","input","preview","schema","types","fields","weak","to"],"mappings":";;;;;;;;;;;;;;;;;;;AAIO,SAASA,gBAAgBC,KAA2C,EAAA;EAJ3E,IAAAC,EAAA;EAKE,OAAOC,0BAAmBF,KAAK,CAAA,IAAA,CAAA,CAAKC,WAAME,UAAW,CAAAC,IAAA,KAAjB,mBAAuBC,IAAS,MAAA,WAAA;AACtE;AAEO,SAASC,uBACdN,KAC+B,EAAA;EAVjC,IAAAC,EAAA,EAAAM,EAAA;EAWE,OAAA,CAAA,CAAOA,EAAM,GAAA,CAAAN,EAAA,GAAAD,KAAA,CAAAG,UAAA,KAAN,IAAkB,GAAA,KAAA,CAAA,GAAAF,EAAA,CAAAG,IAAA,KAAlB,mBAA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C,KAAO,EAAA,CACL;QACE/G,IAAM,EAAA,WAAA;QACND,IAAM,EAAA,QAAA;QACN8B,KAAO,EAAA,uBAAA;QACPmF,MAAQ,EAAA,CACN;UACEnF,KAAO,EAAA,OAAA;UACP7B,IAAM,EAAA,OAAA;UACND,IAAM,EAAA,WAAA;UACNkH,IAAM,EAAA,IAAA;UACNC,EAAI,EAAA,CAAC;YAACnH,IAAA,EAAM;WAAiB;QAC/B,CAAA;MAEJ,CAAA,EACA;QACEC,IAAM,EAAA,gBAAA;QACND,IAAM,EAAA,QAAA;QACN8B,KAAO,EAAA,aAAA;QACPmF,MAAQ,EAAA,CACN;UACEjH,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA,EACA;UACED,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA,EACA;UACED,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA,EACA;UACED,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA,EACA;UACED,IAAM,EAAA,QAAA;UACNC,IAAM,EAAA;QACR,CAAA;MAEJ,CAAA;IAEJ;EAAA,CACF;AACF,CAAC,CAAA;;;;;"}
@@ -1,26 +0,0 @@
1
- import React, {lazy, memo, Suspense} from 'react'
2
- import {type InputProps} from 'sanity'
3
-
4
- import {isMuxInputProps} from '../util/asserters'
5
- import {type Config} from '../util/types'
6
- import ErrorBoundaryCard from './ErrorBoundaryCard'
7
- import {AspectRatioCard, InputFallback} from './Input.styled'
8
-
9
- const Input = lazy(() => import('./Input'))
10
-
11
- // eslint-disable-next-line import/no-anonymous-default-export
12
- export default (config: Config) =>
13
- memo(function FormInput(props: InputProps) {
14
- if (isMuxInputProps(props)) {
15
- return (
16
- <AspectRatioCard>
17
- <ErrorBoundaryCard schemaType={props.schemaType}>
18
- <Suspense fallback={<InputFallback />}>
19
- <Input config={config} {...props} />
20
- </Suspense>
21
- </ErrorBoundaryCard>
22
- </AspectRatioCard>
23
- )
24
- }
25
- return props.renderDefault(props)
26
- })
@@ -1,19 +0,0 @@
1
- import React, {lazy, memo} from 'react'
2
- import {PreviewLayoutKey, PreviewProps} from 'sanity'
3
-
4
- import {isMuxInputPreviewProps} from '../util/asserters'
5
- import {AspectRatioCard} from './Input.styled'
6
-
7
- const Preview = lazy(() => import('./Preview'))
8
-
9
- export default memo(function FormPreview(props: PreviewProps<PreviewLayoutKey>) {
10
- if (isMuxInputPreviewProps(props)) {
11
- return (
12
- <AspectRatioCard>
13
- {/* @ts-expect-error */}
14
- <Preview {...props} />
15
- </AspectRatioCard>
16
- )
17
- }
18
- return props.renderDefault(props)
19
- })
@@ -1,33 +0,0 @@
1
- import React from 'react'
2
- import {SanityDefaultPreview} from 'sanity'
3
-
4
- import {useAssetDocumentValues} from '../hooks/useAssetDocumentValues'
5
- import {VideoThumbnail} from './VideoSource.styled'
6
-
7
- export interface MuxVideoPreviewProps {
8
- value: {
9
- asset: {
10
- _type: 'reference'
11
- _ref: string
12
- }
13
- }
14
- }
15
- const MuxVideoPreview = ({value}: MuxVideoPreviewProps) => {
16
- const assetDocumentValues = useAssetDocumentValues(value?.asset!)
17
-
18
- if (assetDocumentValues.value) {
19
- return <VideoThumbnail asset={assetDocumentValues.value} width={640} />
20
- }
21
-
22
- // @ts-expect-error
23
- const {filename, playbackId, status} = value ?? {}
24
-
25
- return (
26
- <SanityDefaultPreview
27
- title={filename || playbackId || ''}
28
- subtitle={status ? `status: ${status}` : null}
29
- />
30
- )
31
- }
32
-
33
- export default MuxVideoPreview