Skip to content

Commit

Permalink
fix: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan committed Oct 10, 2022
1 parent 1860fdd commit 4f722e9
Show file tree
Hide file tree
Showing 41 changed files with 151 additions and 483 deletions.
5 changes: 1 addition & 4 deletions example/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, viewport-fit=cover"
/>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta name="theme-color" content="hsl(18deg, 100%, 50%)" />
<title>Loading...</title>
</head>
Expand Down
4 changes: 2 additions & 2 deletions example/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
display: grid;
align-items: center;
height: 100%;
padding: env(safe-area-inset-top) env(safe-area-inset-right)
env(safe-area-inset-bottom) env(safe-area-inset-left);
padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom)
env(safe-area-inset-left);
}

.spinner {
Expand Down
9 changes: 1 addition & 8 deletions example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ function App() {
<Suspense
fallback={
<svg className="spinner" viewBox="0 0 50 50">
<circle
className="path"
cx="25"
cy="25"
r="20"
fill="none"
strokeWidth="5"
></circle>
<circle className="path" cx="25" cy="25" r="20" fill="none" strokeWidth="5"></circle>
</svg>
}
>
Expand Down
8 changes: 3 additions & 5 deletions example/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ html {

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
}
44 changes: 22 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@
"prettier": {
"arrowParens": "always",
"bracketSpacing": false,
"printWidth": 100,
"semi": false,
"singleQuote": true,
"trailingComma": "es5"
},
"dependencies": {
"@mux/playback-core": "^0.10.0",
"@mux/playback-core": "^0.11.0",
"@mux/upchunk": "^2.6.0",
"@reach/auto-id": "^0.17.0",
"@sanity/icons": "^1.3.6",
Expand All @@ -67,7 +68,7 @@
"@sanity/uuid": "^3.0.1",
"classnames": "^2.3.2",
"jsonwebtoken-esm": "^1.0.3",
"media-chrome": "^0.10.2",
"media-chrome": "^0.11.1",
"motion": "^10.14.2",
"rxjs": "^6",
"scroll-into-view-if-needed": "^2.2.29",
Expand Down
4 changes: 1 addition & 3 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
{
"matchFiles": ["example/package.json"],
"extends": [":semanticCommitTypeAll(chore)"],
"ignorePresets": [
"github>sanity-io/renovate-presets//ecosystem/group-update-types"
],
"ignorePresets": ["github>sanity-io/renovate-presets//ecosystem/group-update-types"],
"groupName": "example dependencies",
"groupSlug": "example",
"matchPackagePatterns": ["*"],
Expand Down
6 changes: 1 addition & 5 deletions src/actions/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ export async function haveValidSigningKeys(
//
return !!(res.data && res.data.id)
} catch (e) {
console.error(
'Error fetching signingKeyId',
signingKeyId,
'assuming it is not valid'
)
console.error('Error fetching signingKeyId', signingKeyId, 'assuming it is not valid')
return false
}
}
Expand Down
29 changes: 6 additions & 23 deletions src/actions/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ export function uploadUrl(
).pipe(
mergeMap((result) => {
const asset =
(result &&
result.results &&
result.results[0] &&
result.results[0].document) ||
(result && result.results && result.results[0] && result.results[0].document) ||
null

if (!asset) {
Expand Down Expand Up @@ -129,31 +126,23 @@ export function uploadFile(
})
).pipe(
mergeMap((result) => {
return createUpChunkObservable(
uuid,
result.upload.url,
file
).pipe(
return createUpChunkObservable(uuid, result.upload.url, file).pipe(
// eslint-disable-next-line no-warning-comments
// @TODO type the observable events
// eslint-disable-next-line max-nested-callbacks
mergeMap((event: any) => {
if (event.type !== 'success') {
return of(event)
}
return from(
updateAssetDocumentFromUpload(client, uuid)
).pipe(
return from(updateAssetDocumentFromUpload(client, uuid)).pipe(
// eslint-disable-next-line max-nested-callbacks
mergeMap((doc) => of({...event, asset: doc}))
)
}),
// eslint-disable-next-line max-nested-callbacks
catchError((err) => {
// Delete asset document
return cancelUpload(client, uuid).pipe(
mergeMapTo(throwError(err))
)
return cancelUpload(client, uuid).pipe(mergeMapTo(throwError(err)))
})
)
})
Expand Down Expand Up @@ -189,10 +178,7 @@ export function getUpload(client: SanityClient, assetId: string) {
})
}

function pollUpload(
client: SanityClient,
uuid: string
): Promise<UploadResponse> {
function pollUpload(client: SanityClient, uuid: string): Promise<UploadResponse> {
const maxTries = 10
let pollInterval: number
let tries = 0
Expand Down Expand Up @@ -220,10 +206,7 @@ function pollUpload(
})
}

async function updateAssetDocumentFromUpload(
client: SanityClient,
uuid: string
) {
async function updateAssetDocumentFromUpload(client: SanityClient, uuid: string) {
let upload: UploadResponse
let asset: {data: MuxAsset}
try {
Expand Down
9 changes: 2 additions & 7 deletions src/clients/upChunkObservable.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import * as UpChunk from '@mux/upchunk'
import {Observable} from 'rxjs'

export function createUpChunkObservable(
uuid: string,
uploadUrl: string,
source: File
) {
export function createUpChunkObservable(uuid: string, uploadUrl: string, source: File) {
return new Observable((subscriber) => {
const upchunk = UpChunk.createUpload({
endpoint: uploadUrl,
Expand All @@ -21,8 +17,7 @@ export function createUpChunkObservable(
subscriber.complete()
}

const errorHandler = (data: CustomEvent) =>
subscriber.error(new Error(data.detail.message))
const errorHandler = (data: CustomEvent) => subscriber.error(new Error(data.detail.message))

const progressHandler = (data: CustomEvent) => {
return subscriber.next({type: 'progress', percent: data.detail})
Expand Down
36 changes: 10 additions & 26 deletions src/components/ConfigureApi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ const fieldNames = ['token', 'secretKey', 'enableSignedUrls'] as const
function ConfigureApi({secrets, setDialogState}: Props) {
const client = useClient()
const [state, dispatch] = useSecretsFormState(secrets)
const hasSecretsInitially = useMemo(
() => secrets.token && secrets.secretKey,
[secrets]
)
const hasSecretsInitially = useMemo(() => secrets.token && secrets.secretKey, [secrets])
const handleClose = useCallback(() => setDialogState(false), [setDialogState])
const dirty = useMemo(
() =>
Expand All @@ -47,10 +44,7 @@ function ConfigureApi({secrets, setDialogState}: Props) {
)
const id = `ConfigureApi${useId()}`
const [tokenId, secretKeyId, enableSignedUrlsId] = useMemo<typeof fieldNames>(
() =>
fieldNames.map(
(field) => `${id}-${field}`
) as unknown as typeof fieldNames,
() => fieldNames.map((field) => `${id}-${field}`) as unknown as typeof fieldNames,
[id]
)
const firstField = useRef<HTMLInputElement>(null)
Expand All @@ -69,10 +63,7 @@ function ConfigureApi({secrets, setDialogState}: Props) {
.then((savedSecrets) => {
const {projectId, dataset} = client.config()
clear([cacheNs, secretsId, projectId, dataset])
preload(
() => Promise.resolve(savedSecrets),
[cacheNs, secretsId, projectId, dataset]
)
preload(() => Promise.resolve(savedSecrets), [cacheNs, secretsId, projectId, dataset])
setDialogState(false)
})
.catch((err) => dispatch({type: 'error', payload: err.message}))
Expand Down Expand Up @@ -137,12 +128,11 @@ function ConfigureApi({secrets, setDialogState}: Props) {
.
</Text>
<Text size={1}>
The access token needs permissions:{' '}
<strong>Mux Video </strong>
The access token needs permissions: <strong>Mux Video </strong>
(Full Access) and <strong>Mux Data</strong> (Read)
<br />
The credentials will be stored safely in a hidden document
only available to editors.
The credentials will be stored safely in a hidden document only available to
editors.
</Text>
</Stack>
</Card>
Expand Down Expand Up @@ -177,26 +167,20 @@ function ConfigureApi({secrets, setDialogState}: Props) {
/>
<Box flex={1} paddingLeft={3}>
<Text>
<label htmlFor={enableSignedUrlsId}>
Enable Signed Urls
</label>
<label htmlFor={enableSignedUrlsId}>Enable Signed Urls</label>
</Text>
</Box>
</Flex>
{/* TODO: use a popover instead to avoid jumping around */}
{secrets.signingKeyId && state.enableSignedUrls ? (
<Card padding={[3, 3, 3]} radius={2} shadow={1} tone="caution">
<Stack space={3}>
<Text size={1}>
The signing key ID that Sanity will use is:
</Text>
<Text size={1}>The signing key ID that Sanity will use is:</Text>
<Code size={1}>{secrets.signingKeyId}</Code>
<Text size={1}>
This key is only used for previewing content in the Sanity
UI.
This key is only used for previewing content in the Sanity UI.
<br />
You should generate a different key to use in your
application server.
You should generate a different key to use in your application server.
</Text>
</Stack>
</Card>
Expand Down
Loading

2 comments on commit 4f722e9

@vercel
Copy link

@vercel vercel bot commented on 4f722e9 Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sanity-plugin-mux-input-codesandbox – ./example

mux-player-codesandbox.sanity.build
sanity-plugin-mux-input-codesandbox.sanity.build
sanity-plugin-mux-input-codesandbox-git-main.sanity.build

@vercel
Copy link

@vercel vercel bot commented on 4f722e9 Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sanity-plugin-mux-input – ./

sanity-plugin-mux-input-git-main.sanity.build
sanity-plugin-mux-input.sanity.build

Please sign in to comment.