sanity-plugin-shopify-assets 1.2.3 → 2.0.1
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 +3 -3
- package/dist/index.d.ts +49 -61
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +477 -713
- package/dist/index.js.map +1 -1
- package/package.json +44 -75
- package/dist/index.esm.js +0 -859
- package/dist/index.esm.js.map +0 -1
- package/sanity.json +0 -8
- package/src/components/AssetDiff.tsx +0 -59
- package/src/components/AssetPreview.tsx +0 -75
- package/src/components/DialogHeader.tsx +0 -44
- package/src/components/File.styled.tsx +0 -60
- package/src/components/File.tsx +0 -54
- package/src/components/ShopifyAssetInput.styled.tsx +0 -13
- package/src/components/ShopifyAssetInput.tsx +0 -84
- package/src/components/ShopifyAssetPicker.tsx +0 -207
- package/src/components/ShopifyIcon.tsx +0 -22
- package/src/components/VideoPlayer.tsx +0 -50
- package/src/datastores/shopify.ts +0 -93
- package/src/index.ts +0 -33
- package/src/sanity-ui.d.ts +0 -6
- package/src/schema/shopifyAssetMetadataSchema.ts +0 -34
- package/src/schema/shopifyAssetPreviewSchema.ts +0 -24
- package/src/schema/shopifyAssetSchema.ts +0 -88
- package/src/types.ts +0 -54
- package/src/utils/helpers.ts +0 -1
- package/v2-incompatible.js +0 -11
package/dist/index.esm.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/File.styled.tsx","../src/components/VideoPlayer.tsx","../src/components/AssetPreview.tsx","../src/datastores/shopify.ts","../src/components/DialogHeader.tsx","../src/utils/helpers.ts","../src/components/File.tsx","../src/components/ShopifyAssetInput.styled.tsx","../src/components/ShopifyAssetPicker.tsx","../src/components/ShopifyIcon.tsx","../src/components/ShopifyAssetInput.tsx","../src/components/AssetDiff.tsx","../src/schema/shopifyAssetSchema.ts","../src/schema/shopifyAssetPreviewSchema.ts","../src/schema/shopifyAssetMetadataSchema.ts","../src/index.ts"],"sourcesContent":["import {Card} from '@sanity/ui'\nimport {styled} from 'styled-components'\n\nexport const Root = styled.div`\n overflow: hidden;\n background-origin: content-box;\n background-repeat: no-repeat;\n background-clip: border-box;\n background-size: cover;\n background-color: ${({theme}) => theme.sanity.color.card.enabled.bg2};\n position: relative;\n outline: none !important;\n border: ${({theme}) => `1px solid ${theme.sanity.color.card.enabled.border}`};\n box-sizing: content-box;\n user-drag: none;\n\n &:hover {\n opacity: 0.85;\n }\n\n &:focus,\n &:active {\n border: 1px solid var(--input-border-color-focus);\n box-shadow: inset 0 0 0 3px var(--input-border-color-focus);\n }\n`\n\nexport const InfoLine = styled(Card)`\n ${({theme}) => `\n --infoline-fg: ${theme.sanity.color.card.enabled.fg};\n --infoline-bg: ${theme.sanity.color.card.enabled.bg};\n `};\n user-drag: none;\n position: absolute;\n background-color: var(--infoline-bg);\n top: 0;\n left: 0;\n max-width: 65%;\n overflow-wrap: break-word;\n\n [data-ui='Text'] {\n color: var(--infoline-fg);\n }\n`\n\nexport const DurationLine = styled(Card)`\n ${({theme}) => `\n --durationline-fg: ${theme.sanity.color.card.enabled.bg};\n --durationline-bg: ${theme.sanity.color.card.enabled.fg};\n `};\n user-drag: none;\n position: absolute;\n background-color: var(--durationline-bg);\n top: 0;\n right: 0;\n\n [data-ui='Text'] {\n color: var(--durationline-fg);\n }\n`\n","import React, {type CSSProperties, type MouseEvent, useCallback, useEffect} from 'react'\nimport videojs, {type VideoJsPlayer} from 'video.js'\n\ntype PlayerKind = 'player' | 'diff'\n\ninterface VideoProps {\n src: string\n kind: PlayerKind\n}\n\nconst VideoPlayer = ({src, kind}: VideoProps) => {\n const videoNode = React.useRef<HTMLVideoElement>(null)\n const player = React.useRef<VideoJsPlayer>()\n\n useEffect(() => {\n player.current = videojs(videoNode.current ?? '', {\n sources: [{src}],\n controls: true,\n })\n\n player.current.src({src})\n }, [src])\n\n const stopPropagation = useCallback((event: MouseEvent) => {\n event.stopPropagation()\n }, [])\n\n const className: Record<PlayerKind, string> = {\n player: 'video-js vjs-16-9 vjs-big-play-centered',\n diff: 'video-js vjs-layout-tiny vjs-fluid',\n }\n\n const style: CSSProperties = {position: 'relative'}\n\n return (\n <div>\n <link href=\"https://vjs.zencdn.net/7.8.4/video-js.css\" rel=\"stylesheet\" />\n <div data-vjs-player>\n <video\n onClick={stopPropagation}\n style={kind === 'diff' ? style : {}}\n className={className[kind]}\n ref={videoNode}\n />\n </div>\n </div>\n )\n}\n\nexport default VideoPlayer\n","import React from 'react'\nimport prettyBytes from 'pretty-bytes'\nimport prettyMilliseconds from 'pretty-ms'\nimport {styled} from 'styled-components'\nimport {Box, Flex, Text} from '@sanity/ui'\n\nimport {Asset} from '../types'\nimport {DurationLine, InfoLine} from './File.styled'\nimport VideoPlayer from './VideoPlayer'\n\ninterface ComponentProps {\n value: Asset\n}\n\nexport const StyledBox = styled(Box)`\n background-color: ${({theme}) => theme.sanity.color?.card?.enabled?.bg2};\n border: ${({theme}) => `1px solid ${theme.sanity?.color?.card?.enabled?.border}`};\n display: flex;\n justify-content: center;\n margin-bottom: ${({theme}) => theme.sanity.space[4]};\n position: relative;\n`\n\nconst RenderAsset = ({value, url}: {value: Asset; url: string}) => {\n switch (value.type) {\n case 'video':\n return <VideoPlayer src={url} kind=\"player\" />\n default:\n return (\n <Flex justify=\"center\">\n <img\n alt=\"preview\"\n src={value?.preview?.url}\n style={{\n maxWidth: '100%',\n height: 'auto',\n display: 'block',\n maxHeight: '30vh',\n }}\n />\n </Flex>\n )\n }\n}\n\nconst AssetPreview = ({value}: ComponentProps) => {\n const url = value && value.url\n\n if (!value || !url) {\n return null\n }\n\n const {filename, meta} = value\n const {fileSize, duration} = meta\n\n return (\n <StyledBox marginBottom={2}>\n <RenderAsset value={value} url={url} />\n <InfoLine padding={2} radius={2} margin={2}>\n <Text size={1} title={`Select ${filename}`}>\n {filename} {fileSize && `(${prettyBytes(fileSize)})`}\n </Text>\n </InfoLine>\n {duration && (\n <DurationLine padding={2} radius={2} margin={2}>\n <Text size={1} title={`Video duration: ${filename}`}>\n {prettyMilliseconds(duration, {colonNotation: true, secondsDecimalDigits: 0})}\n </Text>\n </DurationLine>\n )}\n </StyledBox>\n )\n}\n\nexport default AssetPreview\n","import {BehaviorSubject, Observable, concat, defer} from 'rxjs'\nimport {debounceTime, distinctUntilChanged, map, switchMap, withLatestFrom} from 'rxjs/operators'\n\nimport axios from 'axios'\n\ntype SearchSubject = BehaviorSubject<string>\ntype CursorSubject = BehaviorSubject<any>\n\ninterface fetchProps {\n projectId: string\n dataset: string\n shop: string\n query: SearchSubject\n cursor: CursorSubject\n resultsPerPage: number\n token?: string\n}\n\ninterface searchProps extends Omit<fetchProps, 'query' | 'cursor'> {\n query: string\n cursor: string\n}\ninterface listProps extends Omit<fetchProps, 'query' | 'cursor'> {\n cursor: string\n}\n\nconst fetchSearch = (props: searchProps): Observable<any> => {\n const {projectId, dataset, shop, query, cursor, resultsPerPage, token} = props\n\n return defer(() => {\n return axios.get(\n `https://${projectId}.api.sanity.io/v1/shopify/assets/${dataset}?shop=${shop}&query=${encodeURIComponent(\n query\n )}${cursor && `&cursor=${cursor}`}&limit=${resultsPerPage}`,\n {\n withCredentials: true,\n method: 'GET',\n headers: token\n ? {\n Authorization: `Bearer ${token}`,\n }\n : {},\n }\n )\n }).pipe(map((result) => result.data))\n}\n\nconst fetchList = (props: listProps): Observable<any> => {\n const {projectId, dataset, shop, cursor, resultsPerPage, token} = props\n\n return defer(() =>\n axios.get(\n `https://${projectId}.api.sanity.io/v1/shopify/assets/${dataset}?shop=${shop}${\n cursor && `&cursor=${cursor}`\n }&limit=${resultsPerPage}`,\n {\n withCredentials: true,\n method: 'GET',\n headers: token\n ? {\n Authorization: `Bearer ${token}`,\n }\n : {},\n }\n )\n ).pipe(map((result) => result.data))\n}\n\nexport const search = (props: fetchProps): Observable<any> => {\n const {projectId, dataset, shop, query, cursor, resultsPerPage, token} = props\n\n return concat(\n query.pipe(\n withLatestFrom(cursor),\n debounceTime(500),\n distinctUntilChanged(),\n switchMap(([q, c]) => {\n if (q) {\n return fetchSearch({\n projectId,\n dataset,\n shop,\n query: q,\n cursor: c,\n resultsPerPage,\n token,\n }).pipe(distinctUntilChanged())\n }\n return fetchList({projectId, dataset, shop, cursor: c, resultsPerPage, token})\n })\n )\n )\n}\n","import React, {useCallback} from 'react'\nimport {Box, Flex, Button} from '@sanity/ui'\nimport {LaunchIcon} from '@sanity/icons'\n\ninterface Props {\n title: string\n shopifyDomain: string\n}\n\nconst DialogHeader = (props: Props) => {\n const {title, shopifyDomain} = props\n\n const handleOpenInNewTab = useCallback(() => {\n window.open(`https://${shopifyDomain}/admin/content/files`, '_blank')\n }, [shopifyDomain])\n\n return (\n <Flex align=\"center\">\n {title}\n {/*\n HACK: Sanity UI will attempt to focus the first 'focusable' descendant of any dialog.\n Typically this is fine, but since our first focusable element is a button with a tooltip, this\n default behaviour causes the tooltip to appear whenever the dialog is opened, which we don't want!\n\n To get around this, we include a pseudo-hidden input to ensure our tooltip-enabled button remains\n unfocused on initial mount.\n */}\n <input style={{opacity: 0}} tabIndex={-1} type=\"button\" />\n <Box style={{position: 'absolute', right: '-1.5em'}}>\n <Box className=\"button-large\">\n <Button\n fontSize={1}\n icon={LaunchIcon}\n mode=\"bleed\"\n onClick={handleOpenInNewTab}\n text=\"Add New\"\n />\n </Box>\n </Box>\n </Flex>\n )\n}\n\nexport default DialogHeader\n","export const extractName = (name: string): string => name?.split('/')?.pop()?.split('?')[0] ?? ''\n","import React, {useCallback, useRef} from 'react'\nimport {Text} from '@sanity/ui'\nimport prettyBytes from 'pretty-bytes'\nimport prettyMilliseconds from 'pretty-ms'\n\nimport {extractName} from '../utils/helpers'\nimport {Asset, ShopifyFile} from '../types'\nimport {DurationLine, InfoLine, Root} from './File.styled'\n\ntype Props = {\n data: ShopifyFile\n width: number\n height: number\n onClick: (file: Asset) => void\n}\n\nexport default function File(props: Props) {\n const {onClick, data, width, height} = props\n const rootElm = useRef<HTMLDivElement>(null)\n\n const {preview, meta} = data\n const filename = extractName(data.url)\n\n const handleClick = useCallback(() => {\n onClick({...data, filename})\n }, [onClick, data, filename])\n\n return (\n <Root\n ref={rootElm}\n title={`${filename}`}\n tabIndex={0}\n style={{\n width: `${width}px`,\n height: `${height}px`,\n backgroundImage: `url(\"${preview?.url}\")`,\n }}\n onClick={handleClick}\n >\n <InfoLine padding={2} radius={2} margin={2}>\n <Text size={1} title={`Select ${filename}`}>\n {filename} {meta.fileSize && `(${prettyBytes(meta.fileSize)})`}\n </Text>\n </InfoLine>\n {meta.duration && (\n <DurationLine padding={2} radius={2} margin={2}>\n <Text size={1} title={`Video duration: ${filename}`}>\n {prettyMilliseconds(meta.duration, {colonNotation: true, secondsDecimalDigits: 0})}\n </Text>\n </DurationLine>\n )}\n </Root>\n )\n}\n","import {Stack} from '@sanity/ui'\nimport {styled} from 'styled-components'\n\nexport const Search = styled(Stack)`\n position: sticky;\n top: 0;\n z-index: 1;\n`\n\nexport const Scroller = styled.div`\n overflow-y: auto;\n max-height: 80vh;\n`\n","import {BehaviorSubject, Subscription} from 'rxjs'\nimport {ErrorOutlineIcon} from '@sanity/icons'\nimport {Card, Dialog, Flex, Inline, Spinner, Stack, Text, TextInput} from '@sanity/ui'\nimport {PatchEvent, set, useProjectId, ObjectInputProps, useDataset, useClient} from 'sanity'\nimport React, {useCallback, useEffect, useMemo, useState} from 'react'\nimport PhotoAlbum from 'react-photo-album'\nimport InfiniteScroll from 'react-infinite-scroll-component'\n\nimport {search} from '../datastores/shopify'\nimport type {Asset, PageInfo, ShopifyAPIResponse, ShopifyFile} from '../types'\nimport DialogHeader from './DialogHeader'\nimport File from './File'\nimport {Search} from './ShopifyAssetInput.styled'\n\nconst RESULTS_PER_PAGE = 42\nconst PHOTO_SPACING = 2\nconst PHOTO_PADDING = 1\n\nexport interface AssetPickerProps extends ObjectInputProps<Asset> {\n shopifyDomain: string\n isOpen: boolean\n onClose: () => void\n}\n\nexport default function ShopifyAssetPicker(props: AssetPickerProps) {\n const {isOpen, onClose, shopifyDomain, onChange, schemaType, value} = props\n const projectId = useProjectId()\n const dataset = useDataset()\n const client = useClient({apiVersion: '2021-06-07'})\n const token = client.config().token\n\n const [error, setError] = useState('')\n const [query, setQuery] = useState('')\n const [searchResults, setSearchResults] = useState<any[]>([])\n const [pageInfo, setPageInfo] = useState<PageInfo>()\n const [isLoading, setIsLoading] = useState(true)\n\n const searchSubject$ = useMemo(() => new BehaviorSubject(''), [])\n const cursorSubject$ = useMemo(() => new BehaviorSubject(''), [])\n\n useEffect(() => {\n if (!shopifyDomain) setError('Please configure your Shopify domain in the plugin config')\n }, [shopifyDomain])\n\n useEffect(() => {\n const searchSubscription: Subscription = search({\n projectId,\n dataset,\n shop: shopifyDomain,\n query: searchSubject$,\n cursor: cursorSubject$,\n resultsPerPage: RESULTS_PER_PAGE,\n token,\n }).subscribe({\n next: (results: ShopifyAPIResponse) => {\n setSearchResults((prevResults) => [...prevResults, ...results.assets])\n setPageInfo(results.pageInfo)\n setIsLoading(false)\n },\n error: (err) => {\n setError(\n `${\n err.response?.data?.message || err.message || 'An error occurred'\n } - check plugin configuration`\n )\n },\n })\n\n return () => searchSubscription.unsubscribe()\n }, [searchSubject$, cursorSubject$, shopifyDomain, projectId, dataset, token])\n\n const handleSearchTermChanged = useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const newQuery = event.currentTarget.value\n setQuery(newQuery)\n setSearchResults([])\n setPageInfo(undefined)\n setIsLoading(true)\n\n cursorSubject$.next('')\n searchSubject$.next(newQuery)\n },\n [cursorSubject$, searchSubject$]\n )\n\n const handleScollerLoadMore = useCallback(() => {\n setIsLoading(true)\n if (pageInfo) cursorSubject$.next(pageInfo.cursor)\n searchSubject$.next(query)\n }, [cursorSubject$, pageInfo, searchSubject$, query])\n\n const handleSelect = useCallback(\n (file: Asset) => {\n file._key = value?._key\n file._type = schemaType.name\n onChange(PatchEvent.from([set(file)]))\n onClose()\n },\n [onChange, onClose, schemaType.name, value?._key]\n )\n\n const renderFile = useCallback(\n (fileProps: any) => {\n const {photo, layout} = fileProps\n return (\n <File\n onClick={handleSelect}\n data={photo.data}\n width={layout.width}\n height={layout.height}\n />\n )\n },\n [handleSelect]\n )\n\n const handleWidth = useCallback((width: number) => {\n if (width < 300) return 150\n else if (width < 600) return 200\n return 300\n }, [])\n\n return (\n <Dialog\n id=\"shopify-asset-source\"\n header={<DialogHeader title=\"Shopify Assets\" shopifyDomain={shopifyDomain} />}\n onClose={onClose}\n open={isOpen}\n width={4}\n >\n <Stack space={3} padding={4}>\n {error ? (\n <Card overflow=\"hidden\" padding={4} radius={2} shadow={1} tone=\"critical\">\n <Flex align=\"center\" gap={3}>\n <Text size={2}>\n <ErrorOutlineIcon />\n </Text>\n <Inline space={2}>\n <Text size={1}>{error}</Text>\n </Inline>\n </Flex>\n </Card>\n ) : (\n <>\n <Card>\n <Search space={3}>\n <Text size={1} weight=\"semibold\">\n Search Shopify for assets\n </Text>\n <TextInput\n label=\"Search Images\"\n placeholder=\"filename.jpg\"\n value={query}\n onChange={handleSearchTermChanged}\n />\n </Search>\n </Card>\n {!isLoading && searchResults.length === 0 && (\n <Text size={1} muted>\n No results found\n </Text>\n )}\n <InfiniteScroll\n dataLength={searchResults.length} // This is important field to render the next data\n next={handleScollerLoadMore}\n hasMore={pageInfo ? pageInfo?.hasNextPage : true}\n scrollThreshold={0.99}\n height=\"60vh\"\n loader={\n <Flex align=\"center\" justify=\"center\" padding={3}>\n <Spinner muted />\n </Flex>\n }\n endMessage={\n <Flex align=\"center\" justify=\"center\" padding={3}>\n <Text size={1} muted>\n No more results\n </Text>\n </Flex>\n }\n >\n {searchResults && (\n <PhotoAlbum\n layout=\"rows\"\n spacing={PHOTO_SPACING}\n padding={PHOTO_PADDING}\n targetRowHeight={handleWidth}\n photos={searchResults.map((file: ShopifyFile) => ({\n src: file?.preview?.url,\n width: file?.preview?.width || 2048,\n height: file?.preview?.height || 2048,\n key: file.id,\n data: file,\n }))}\n renderPhoto={renderFile}\n componentsProps={{\n containerProps: {style: {marginBottom: `${PHOTO_SPACING}px`}},\n }}\n />\n )}\n </InfiniteScroll>\n </>\n )}\n </Stack>\n </Dialog>\n )\n}\n","import React from 'react'\n\nconst ShopifyIcon = () => {\n return (\n <svg width=\"18\" height=\"20\" viewBox=\"0 0 18 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"M15.3269 3.85113C15.3132 3.75015 15.2258 3.69411 15.1531 3.688C15.081 3.6819 13.6693 3.66026 13.6693 3.66026C13.6693 3.66026 12.4887 2.50392 12.3722 2.38628C12.2555 2.26865 12.0277 2.30417 11.9392 2.3308C11.9381 2.33135 11.7175 2.40016 11.3461 2.51612C11.2839 2.31304 11.1927 2.06335 11.0622 1.81255C10.6419 1.00356 10.0263 0.575752 9.2825 0.574642C9.28142 0.574642 9.28092 0.574642 9.27975 0.574642C9.22808 0.574642 9.17692 0.579636 9.12517 0.584074C9.10317 0.557441 9.08117 0.531362 9.05808 0.505838C8.73408 0.156272 8.31869 -0.0140727 7.82082 0.000908712C6.86027 0.0286521 5.90357 0.72834 5.12787 1.97124C4.58212 2.84572 4.16677 3.94435 4.04904 4.79497C2.94601 5.13953 2.17471 5.38035 2.15766 5.3859C1.60091 5.56235 1.58331 5.57955 1.51069 6.10889C1.45677 6.50895 0 17.8704 0 17.8704L12.2082 20L17.4994 18.6733C17.4994 18.6733 15.3407 3.95212 15.3269 3.85113ZM10.7349 2.707C10.4537 2.79467 10.1342 2.89454 9.78758 3.00274C9.78042 2.51224 9.72267 1.82975 9.496 1.23992C10.2249 1.3792 10.5836 2.21095 10.7349 2.707ZM9.14883 3.20249C8.509 3.40225 7.81091 3.62031 7.11058 3.83892C7.30753 3.0782 7.68107 2.32081 8.13989 1.8242C8.31044 1.63943 8.54917 1.43358 8.832 1.31594C9.09767 1.87525 9.15542 2.66705 9.14883 3.20249ZM7.84007 0.645665C8.06562 0.640671 8.25542 0.690609 8.41775 0.798253C8.15805 0.9342 7.90718 1.12951 7.67172 1.38419C7.06162 2.04448 6.594 3.06932 6.4075 4.0581C5.826 4.23954 5.25715 4.41766 4.73342 4.58078C5.06405 3.02438 6.35743 0.688944 7.84007 0.645665Z\"\n fill=\"#95BF47\"\n />\n <path\n d=\"M9.276 6.43238L8.66142 8.75117C8.66142 8.75117 7.97598 8.43658 7.16342 8.48817C5.97181 8.56417 5.95916 9.32217 5.97126 9.51242C6.03618 10.5495 8.74125 10.7759 8.89308 13.2051C9.01242 15.1161 7.88796 16.4233 6.26779 16.5265C4.32303 16.6502 3.25246 15.4933 3.25246 15.4933L3.66452 13.7256C3.66452 13.7256 4.74224 14.5457 5.60487 14.4907C6.16821 14.4547 6.36957 13.9924 6.34921 13.6657C6.26448 12.3128 4.06172 12.3927 3.92253 10.17C3.80536 8.29951 5.02337 6.40408 7.71081 6.23318C8.74617 6.16604 9.276 6.43238 9.276 6.43238Z\"\n fill=\"white\"\n />\n <path\n d=\"M15.1536 3.68853C15.0815 3.68243 13.6698 3.66078 13.6698 3.66078C13.6698 3.66078 12.4893 2.50444 12.3726 2.38681C12.3292 2.34298 12.2703 2.32023 12.2087 2.31079L12.2093 19.9994L17.4999 18.6733C17.4999 18.6733 15.3412 3.95264 15.3274 3.85166C15.3137 3.75068 15.2257 3.69463 15.1536 3.68853Z\"\n fill=\"#5E8E3E\"\n />\n </svg>\n )\n}\n\nexport default ShopifyIcon\n","import React from 'react'\nimport {ErrorOutlineIcon} from '@sanity/icons'\nimport {Button, Card, Flex, Grid, Inline, Stack, Text} from '@sanity/ui'\nimport {ObjectInputProps, PatchEvent, unset} from 'sanity'\nimport {useCallback, useState} from 'react'\n\nimport {Asset} from '../types'\nimport AssetPreview from './AssetPreview'\nimport ShopifyAssetPicker from './ShopifyAssetPicker'\nimport ShopifyIcon from './ShopifyIcon'\n\nexport default function ShopifyAssetInput(props: ObjectInputProps) {\n const {onChange, readOnly, value, schemaType} = props\n const {options} = schemaType\n const {shopifyDomain} = options\n\n const [dialogOpen, setDialogOpen] = useState(false)\n\n const removeValue = useCallback(() => {\n onChange(PatchEvent.from([unset()]))\n }, [onChange])\n\n const onOpen = useCallback(() => {\n setDialogOpen(true)\n }, [setDialogOpen])\n\n const onClose = useCallback(() => {\n setDialogOpen(false)\n }, [setDialogOpen])\n\n if (!shopifyDomain) {\n return (\n <Card overflow=\"hidden\" padding={4} radius={2} shadow={1} tone=\"critical\">\n <Flex align=\"center\" gap={3}>\n <Text size={2}>\n <ErrorOutlineIcon />\n </Text>\n <Inline space={2}>\n <Text size={1}>\n You need to configure your *.myshopify.com domain in the plugin / field options to\n enable Shopify Assets.\n </Text>\n </Inline>\n </Flex>\n </Card>\n )\n }\n\n return (\n <>\n {dialogOpen && (\n <ShopifyAssetPicker\n {...props}\n shopifyDomain={shopifyDomain}\n isOpen={dialogOpen}\n onClose={onClose}\n value={value as Asset}\n />\n )}\n <Stack>\n <AssetPreview value={value as Asset} />\n\n <Grid gap={1} style={{gridTemplateColumns: 'repeat(auto-fit, minmax(100px, 1fr))'}}>\n <Button\n disabled={readOnly}\n mode=\"ghost\"\n icon={ShopifyIcon}\n title=\"Select an asset\"\n onClick={onOpen}\n text=\"Select…\"\n />\n <Button\n disabled={readOnly || !value}\n tone=\"critical\"\n mode=\"ghost\"\n title=\"Remove asset\"\n text=\"Remove\"\n onClick={removeValue}\n />\n </Grid>\n </Stack>\n </>\n )\n}\n","import React from 'react'\nimport {DiffFromTo} from 'sanity'\nimport {Flex, Text, Stack} from '@sanity/ui'\n\nimport type {Asset} from '../types'\n\ntype Props = {\n value: Asset | undefined\n}\n\nconst CloudinaryDiffPreview = ({value}: Props) => {\n if (!value) {\n return null\n }\n\n if (value?.preview?.url) {\n return (\n <Flex justify=\"center\" align=\"center\" height=\"fill\" width=\"fill\">\n <Stack space={2}>\n <img\n alt=\"preview\"\n src={value?.preview?.url}\n style={{\n objectFit: 'contain',\n margin: 'auto',\n maxWidth: '100%',\n maxHeight: '100%',\n }}\n />\n <Text size={1}>{value.type.charAt(0).toUpperCase() + value.type.slice(1)}</Text>\n </Stack>\n </Flex>\n )\n }\n\n return (\n <Flex justify=\"center\" align=\"center\" height=\"fill\" width=\"fill\">\n <div>(no image)</div>\n </Flex>\n )\n}\n\ntype DiffProps = {\n diff: any\n schemaType: any\n}\n\nconst AssetDiff = ({diff, schemaType}: DiffProps) => {\n return (\n <DiffFromTo\n diff={diff}\n schemaType={schemaType}\n previewComponent={CloudinaryDiffPreview}\n layout={'grid'}\n />\n )\n}\n\nexport default AssetDiff\n","/* eslint-disable */\nimport ShopifyAssetInput from '../components/ShopifyAssetInput'\nimport AssetDiff from '../components/AssetDiff'\nimport AssetPreview from '../components/AssetPreview'\nimport {defineField, defineType} from 'sanity'\n\ninterface ObjectConfig {\n shopifyDomain: string\n}\n\ndeclare module 'sanity' {\n interface ObjectOptions {\n shopifyDomain?: string\n }\n}\n\nexport const shopifyAssetSchema = (config: ObjectConfig) => {\n const {shopifyDomain} = config\n\n return defineType({\n type: 'object',\n name: 'shopify.asset',\n title: 'Shopify Asset',\n options: {\n shopifyDomain,\n },\n fields: [\n defineField({\n type: 'string',\n name: 'filename',\n title: 'Filename',\n }),\n defineField({\n type: 'string',\n name: 'id',\n title: 'ID',\n }),\n defineField({\n type: 'shopify.assetMetadata',\n name: 'meta',\n title: 'Metadata',\n }),\n defineField({\n type: 'shopify.assetPreview',\n name: 'preview',\n title: 'Preview',\n }),\n defineField({\n type: 'string',\n name: 'type',\n title: 'Type',\n }),\n defineField({\n type: 'url',\n name: 'url',\n title: 'URL',\n }),\n ],\n ...({\n components: {\n input: ShopifyAssetInput,\n diff: AssetDiff,\n preview: AssetPreview,\n },\n } as {}),\n preview: {\n select: {\n meta: 'meta',\n preview: 'preview',\n url: 'url',\n filename: 'filename',\n type: 'type',\n },\n prepare({url, meta, preview, filename, type}) {\n return {\n title: filename,\n subtitle: type,\n value: {\n url,\n meta,\n preview,\n filename,\n },\n }\n },\n },\n })\n}\n","import {defineField, defineType} from 'sanity'\n\nexport const shopifyAssetPreviewSchema = defineType({\n type: 'object',\n name: 'shopify.assetPreview',\n title: 'Asset preview',\n fields: [\n defineField({\n type: 'number',\n name: 'height',\n title: 'Height',\n }),\n defineField({\n type: 'number',\n name: 'width',\n title: 'Width',\n }),\n defineField({\n type: 'url',\n name: 'url',\n title: 'URL',\n }),\n ],\n})\n","import {defineField, defineType} from 'sanity'\n\nexport const shopifyAssetMetadataSchema = defineType({\n type: 'object',\n name: 'shopify.assetMetadata',\n title: 'Asset metadata',\n fields: [\n defineField({\n type: 'string',\n name: 'alt',\n title: 'Alternative text',\n }),\n defineField({\n type: 'number',\n name: 'duration',\n title: 'Duration',\n }),\n defineField({\n type: 'number',\n name: 'fileSize',\n title: 'File size',\n }),\n defineField({\n type: 'number',\n name: 'height',\n title: 'Height',\n }),\n defineField({\n type: 'number',\n name: 'width',\n title: 'Width',\n }),\n ],\n})\n","import {definePlugin, type ObjectDefinition} from 'sanity'\nimport {shopifyAssetSchema} from './schema/shopifyAssetSchema'\nimport {shopifyAssetPreviewSchema} from './schema/shopifyAssetPreviewSchema'\nimport {shopifyAssetMetadataSchema} from './schema/shopifyAssetMetadataSchema'\nimport type {PluginConfig} from './types'\n\nexport * from './types'\n\n// enables autocompletion and validation of document options\ndeclare module 'sanity' {\n export namespace Schema {\n // here we type up our custom schema definition\n export type ShopifyAssetTypeDef = Omit<ObjectDefinition, 'type' | 'fields'> & {\n type: 'shopify.asset'\n options: {\n shopifyDomain: string\n }\n }\n // Adds 'extension-type' as an intrinsic type\n export interface IntrinsicTypeDefinition {\n 'shopify.asset': ShopifyAssetTypeDef\n }\n }\n}\n\nexport const shopifyAssets = definePlugin<PluginConfig>((config) => {\n return {\n name: 'shopify-asset-schema',\n schema: {\n types: [shopifyAssetPreviewSchema, shopifyAssetMetadataSchema, shopifyAssetSchema(config)],\n },\n }\n})\n"],"names":["Root","styled","div","_ref","theme","sanity","color","card","enabled","bg2","_ref2","border","InfoLine","Card","_ref3","fg","bg","DurationLine","_ref4","VideoPlayer","_ref5","src","kind","videoNode","React","useRef","player","useEffect","current","videojs","sources","controls","stopPropagation","useCallback","event","className","diff","style","position","children","jsx","href","rel","onClick","ref","StyledBox","Box","_ref6","_ref7","_ref8","space","RenderAsset","_ref9","value","url","type","Flex","justify","alt","preview","maxWidth","height","display","maxHeight","AssetPreview","_ref0","filename","meta","fileSize","duration","jsxs","marginBottom","padding","radius","margin","Text","size","title","prettyBytes","prettyMilliseconds","colonNotation","secondsDecimalDigits","fetchSearch","props","projectId","dataset","shop","query","cursor","resultsPerPage","token","defer","axios","get","encodeURIComponent","withCredentials","method","headers","Authorization","pipe","map","result","data","fetchList","search","concat","withLatestFrom","debounceTime","distinctUntilChanged","switchMap","_ref1","q","c","DialogHeader","shopifyDomain","handleOpenInNewTab","window","open","align","opacity","tabIndex","right","Button","fontSize","icon","LaunchIcon","mode","text","extractName","name","split","pop","File","width","rootElm","handleClick","backgroundImage","Search","Stack","RESULTS_PER_PAGE","PHOTO_SPACING","PHOTO_PADDING","ShopifyAssetPicker","isOpen","onClose","onChange","schemaType","useProjectId","useDataset","client","useClient","apiVersion","config","error","setError","useState","setQuery","searchResults","setSearchResults","pageInfo","setPageInfo","isLoading","setIsLoading","searchSubject$","useMemo","BehaviorSubject","cursorSubject$","searchSubscription","subscribe","next","results","prevResults","assets","err","response","message","unsubscribe","handleSearchTermChanged","newQuery","currentTarget","handleScollerLoadMore","handleSelect","file","_key","_type","PatchEvent","from","set","renderFile","fileProps","photo","layout","handleWidth","Dialog","id","header","overflow","shadow","tone","gap","ErrorOutlineIcon","Inline","Fragment","weight","TextInput","label","placeholder","length","muted","InfiniteScroll","dataLength","hasMore","hasNextPage","scrollThreshold","loader","Spinner","endMessage","PhotoAlbum","spacing","targetRowHeight","photos","key","renderPhoto","componentsProps","containerProps","ShopifyIcon","viewBox","fill","xmlns","d","ShopifyAssetInput","readOnly","options","dialogOpen","setDialogOpen","removeValue","unset","onOpen","Grid","gridTemplateColumns","disabled","CloudinaryDiffPreview","_ref10","objectFit","charAt","toUpperCase","slice","AssetDiff","_ref11","DiffFromTo","previewComponent","shopifyAssetSchema","defineType","fields","defineField","components","input","select","prepare","_ref12","subtitle","shopifyAssetPreviewSchema","shopifyAssetMetadataSchema","shopifyAssets","definePlugin","schema","types"],"mappings":";;;;;;;;;;;;;;AAGO,MAAMA,OAAOC,MAAO,CAAAC,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAMLC,IAAA;EAAA,IAAC;IAACC;EAAK,CAAA,GAAAD,IAAA;EAAA,OAAMC,MAAMC,MAAO,CAAAC,KAAA,CAAMC,IAAK,CAAAC,OAAA,CAAQC,GAAG;AAAA;AAAA;AAAA;AAAA,YAG1DC,KAAA;EAAA,IAAC;IAACN;GAAW,GAAAM,KAAA;EAAA,OAAA,aAAaN,KAAM,CAAAC,MAAA,CAAOC,KAAM,CAAAC,IAAA,CAAKC,OAAQ,CAAAG,MAAM,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAejE,MAAAC,QAAA,GAAWX,OAAOY,IAAI,CAAA;AAAA,IAC/BC,KAAA;EAAA,IAAC;IAACV;EAAA,CAAW,GAAAU,KAAA;EAAA,OAAA;AAAA,qBACIV,KAAM,CAAAC,MAAA,CAAOC,KAAM,CAAAC,IAAA,CAAKC,QAAQO,EAAE;AAAA,qBAClCX,KAAM,CAAAC,MAAA,CAAOC,KAAM,CAAAC,IAAA,CAAKC,QAAQQ,EAAE;AAAA,GACpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAcU,MAAAC,YAAA,GAAehB,OAAOY,IAAI,CAAA;AAAA,IACnCK,KAAA;EAAA,IAAC;IAACd;EAAA,CAAW,GAAAc,KAAA;EAAA,OAAA;AAAA,yBACQd,KAAM,CAAAC,MAAA,CAAOC,KAAM,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,59 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {DiffFromTo} from 'sanity'
|
|
3
|
-
import {Flex, Text, Stack} from '@sanity/ui'
|
|
4
|
-
|
|
5
|
-
import type {Asset} from '../types'
|
|
6
|
-
|
|
7
|
-
type Props = {
|
|
8
|
-
value: Asset | undefined
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const CloudinaryDiffPreview = ({value}: Props) => {
|
|
12
|
-
if (!value) {
|
|
13
|
-
return null
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (value?.preview?.url) {
|
|
17
|
-
return (
|
|
18
|
-
<Flex justify="center" align="center" height="fill" width="fill">
|
|
19
|
-
<Stack space={2}>
|
|
20
|
-
<img
|
|
21
|
-
alt="preview"
|
|
22
|
-
src={value?.preview?.url}
|
|
23
|
-
style={{
|
|
24
|
-
objectFit: 'contain',
|
|
25
|
-
margin: 'auto',
|
|
26
|
-
maxWidth: '100%',
|
|
27
|
-
maxHeight: '100%',
|
|
28
|
-
}}
|
|
29
|
-
/>
|
|
30
|
-
<Text size={1}>{value.type.charAt(0).toUpperCase() + value.type.slice(1)}</Text>
|
|
31
|
-
</Stack>
|
|
32
|
-
</Flex>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<Flex justify="center" align="center" height="fill" width="fill">
|
|
38
|
-
<div>(no image)</div>
|
|
39
|
-
</Flex>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
type DiffProps = {
|
|
44
|
-
diff: any
|
|
45
|
-
schemaType: any
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const AssetDiff = ({diff, schemaType}: DiffProps) => {
|
|
49
|
-
return (
|
|
50
|
-
<DiffFromTo
|
|
51
|
-
diff={diff}
|
|
52
|
-
schemaType={schemaType}
|
|
53
|
-
previewComponent={CloudinaryDiffPreview}
|
|
54
|
-
layout={'grid'}
|
|
55
|
-
/>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export default AssetDiff
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import prettyBytes from 'pretty-bytes'
|
|
3
|
-
import prettyMilliseconds from 'pretty-ms'
|
|
4
|
-
import {styled} from 'styled-components'
|
|
5
|
-
import {Box, Flex, Text} from '@sanity/ui'
|
|
6
|
-
|
|
7
|
-
import {Asset} from '../types'
|
|
8
|
-
import {DurationLine, InfoLine} from './File.styled'
|
|
9
|
-
import VideoPlayer from './VideoPlayer'
|
|
10
|
-
|
|
11
|
-
interface ComponentProps {
|
|
12
|
-
value: Asset
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const StyledBox = styled(Box)`
|
|
16
|
-
background-color: ${({theme}) => theme.sanity.color?.card?.enabled?.bg2};
|
|
17
|
-
border: ${({theme}) => `1px solid ${theme.sanity?.color?.card?.enabled?.border}`};
|
|
18
|
-
display: flex;
|
|
19
|
-
justify-content: center;
|
|
20
|
-
margin-bottom: ${({theme}) => theme.sanity.space[4]};
|
|
21
|
-
position: relative;
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
const RenderAsset = ({value, url}: {value: Asset; url: string}) => {
|
|
25
|
-
switch (value.type) {
|
|
26
|
-
case 'video':
|
|
27
|
-
return <VideoPlayer src={url} kind="player" />
|
|
28
|
-
default:
|
|
29
|
-
return (
|
|
30
|
-
<Flex justify="center">
|
|
31
|
-
<img
|
|
32
|
-
alt="preview"
|
|
33
|
-
src={value?.preview?.url}
|
|
34
|
-
style={{
|
|
35
|
-
maxWidth: '100%',
|
|
36
|
-
height: 'auto',
|
|
37
|
-
display: 'block',
|
|
38
|
-
maxHeight: '30vh',
|
|
39
|
-
}}
|
|
40
|
-
/>
|
|
41
|
-
</Flex>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const AssetPreview = ({value}: ComponentProps) => {
|
|
47
|
-
const url = value && value.url
|
|
48
|
-
|
|
49
|
-
if (!value || !url) {
|
|
50
|
-
return null
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const {filename, meta} = value
|
|
54
|
-
const {fileSize, duration} = meta
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<StyledBox marginBottom={2}>
|
|
58
|
-
<RenderAsset value={value} url={url} />
|
|
59
|
-
<InfoLine padding={2} radius={2} margin={2}>
|
|
60
|
-
<Text size={1} title={`Select ${filename}`}>
|
|
61
|
-
{filename} {fileSize && `(${prettyBytes(fileSize)})`}
|
|
62
|
-
</Text>
|
|
63
|
-
</InfoLine>
|
|
64
|
-
{duration && (
|
|
65
|
-
<DurationLine padding={2} radius={2} margin={2}>
|
|
66
|
-
<Text size={1} title={`Video duration: ${filename}`}>
|
|
67
|
-
{prettyMilliseconds(duration, {colonNotation: true, secondsDecimalDigits: 0})}
|
|
68
|
-
</Text>
|
|
69
|
-
</DurationLine>
|
|
70
|
-
)}
|
|
71
|
-
</StyledBox>
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default AssetPreview
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, {useCallback} from 'react'
|
|
2
|
-
import {Box, Flex, Button} from '@sanity/ui'
|
|
3
|
-
import {LaunchIcon} from '@sanity/icons'
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
title: string
|
|
7
|
-
shopifyDomain: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const DialogHeader = (props: Props) => {
|
|
11
|
-
const {title, shopifyDomain} = props
|
|
12
|
-
|
|
13
|
-
const handleOpenInNewTab = useCallback(() => {
|
|
14
|
-
window.open(`https://${shopifyDomain}/admin/content/files`, '_blank')
|
|
15
|
-
}, [shopifyDomain])
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Flex align="center">
|
|
19
|
-
{title}
|
|
20
|
-
{/*
|
|
21
|
-
HACK: Sanity UI will attempt to focus the first 'focusable' descendant of any dialog.
|
|
22
|
-
Typically this is fine, but since our first focusable element is a button with a tooltip, this
|
|
23
|
-
default behaviour causes the tooltip to appear whenever the dialog is opened, which we don't want!
|
|
24
|
-
|
|
25
|
-
To get around this, we include a pseudo-hidden input to ensure our tooltip-enabled button remains
|
|
26
|
-
unfocused on initial mount.
|
|
27
|
-
*/}
|
|
28
|
-
<input style={{opacity: 0}} tabIndex={-1} type="button" />
|
|
29
|
-
<Box style={{position: 'absolute', right: '-1.5em'}}>
|
|
30
|
-
<Box className="button-large">
|
|
31
|
-
<Button
|
|
32
|
-
fontSize={1}
|
|
33
|
-
icon={LaunchIcon}
|
|
34
|
-
mode="bleed"
|
|
35
|
-
onClick={handleOpenInNewTab}
|
|
36
|
-
text="Add New"
|
|
37
|
-
/>
|
|
38
|
-
</Box>
|
|
39
|
-
</Box>
|
|
40
|
-
</Flex>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default DialogHeader
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import {Card} from '@sanity/ui'
|
|
2
|
-
import {styled} from 'styled-components'
|
|
3
|
-
|
|
4
|
-
export const Root = styled.div`
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
background-origin: content-box;
|
|
7
|
-
background-repeat: no-repeat;
|
|
8
|
-
background-clip: border-box;
|
|
9
|
-
background-size: cover;
|
|
10
|
-
background-color: ${({theme}) => theme.sanity.color.card.enabled.bg2};
|
|
11
|
-
position: relative;
|
|
12
|
-
outline: none !important;
|
|
13
|
-
border: ${({theme}) => `1px solid ${theme.sanity.color.card.enabled.border}`};
|
|
14
|
-
box-sizing: content-box;
|
|
15
|
-
user-drag: none;
|
|
16
|
-
|
|
17
|
-
&:hover {
|
|
18
|
-
opacity: 0.85;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&:focus,
|
|
22
|
-
&:active {
|
|
23
|
-
border: 1px solid var(--input-border-color-focus);
|
|
24
|
-
box-shadow: inset 0 0 0 3px var(--input-border-color-focus);
|
|
25
|
-
}
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
export const InfoLine = styled(Card)`
|
|
29
|
-
${({theme}) => `
|
|
30
|
-
--infoline-fg: ${theme.sanity.color.card.enabled.fg};
|
|
31
|
-
--infoline-bg: ${theme.sanity.color.card.enabled.bg};
|
|
32
|
-
`};
|
|
33
|
-
user-drag: none;
|
|
34
|
-
position: absolute;
|
|
35
|
-
background-color: var(--infoline-bg);
|
|
36
|
-
top: 0;
|
|
37
|
-
left: 0;
|
|
38
|
-
max-width: 65%;
|
|
39
|
-
overflow-wrap: break-word;
|
|
40
|
-
|
|
41
|
-
[data-ui='Text'] {
|
|
42
|
-
color: var(--infoline-fg);
|
|
43
|
-
}
|
|
44
|
-
`
|
|
45
|
-
|
|
46
|
-
export const DurationLine = styled(Card)`
|
|
47
|
-
${({theme}) => `
|
|
48
|
-
--durationline-fg: ${theme.sanity.color.card.enabled.bg};
|
|
49
|
-
--durationline-bg: ${theme.sanity.color.card.enabled.fg};
|
|
50
|
-
`};
|
|
51
|
-
user-drag: none;
|
|
52
|
-
position: absolute;
|
|
53
|
-
background-color: var(--durationline-bg);
|
|
54
|
-
top: 0;
|
|
55
|
-
right: 0;
|
|
56
|
-
|
|
57
|
-
[data-ui='Text'] {
|
|
58
|
-
color: var(--durationline-fg);
|
|
59
|
-
}
|
|
60
|
-
`
|
package/src/components/File.tsx
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React, {useCallback, useRef} from 'react'
|
|
2
|
-
import {Text} from '@sanity/ui'
|
|
3
|
-
import prettyBytes from 'pretty-bytes'
|
|
4
|
-
import prettyMilliseconds from 'pretty-ms'
|
|
5
|
-
|
|
6
|
-
import {extractName} from '../utils/helpers'
|
|
7
|
-
import {Asset, ShopifyFile} from '../types'
|
|
8
|
-
import {DurationLine, InfoLine, Root} from './File.styled'
|
|
9
|
-
|
|
10
|
-
type Props = {
|
|
11
|
-
data: ShopifyFile
|
|
12
|
-
width: number
|
|
13
|
-
height: number
|
|
14
|
-
onClick: (file: Asset) => void
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default function File(props: Props) {
|
|
18
|
-
const {onClick, data, width, height} = props
|
|
19
|
-
const rootElm = useRef<HTMLDivElement>(null)
|
|
20
|
-
|
|
21
|
-
const {preview, meta} = data
|
|
22
|
-
const filename = extractName(data.url)
|
|
23
|
-
|
|
24
|
-
const handleClick = useCallback(() => {
|
|
25
|
-
onClick({...data, filename})
|
|
26
|
-
}, [onClick, data, filename])
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Root
|
|
30
|
-
ref={rootElm}
|
|
31
|
-
title={`${filename}`}
|
|
32
|
-
tabIndex={0}
|
|
33
|
-
style={{
|
|
34
|
-
width: `${width}px`,
|
|
35
|
-
height: `${height}px`,
|
|
36
|
-
backgroundImage: `url("${preview?.url}")`,
|
|
37
|
-
}}
|
|
38
|
-
onClick={handleClick}
|
|
39
|
-
>
|
|
40
|
-
<InfoLine padding={2} radius={2} margin={2}>
|
|
41
|
-
<Text size={1} title={`Select ${filename}`}>
|
|
42
|
-
{filename} {meta.fileSize && `(${prettyBytes(meta.fileSize)})`}
|
|
43
|
-
</Text>
|
|
44
|
-
</InfoLine>
|
|
45
|
-
{meta.duration && (
|
|
46
|
-
<DurationLine padding={2} radius={2} margin={2}>
|
|
47
|
-
<Text size={1} title={`Video duration: ${filename}`}>
|
|
48
|
-
{prettyMilliseconds(meta.duration, {colonNotation: true, secondsDecimalDigits: 0})}
|
|
49
|
-
</Text>
|
|
50
|
-
</DurationLine>
|
|
51
|
-
)}
|
|
52
|
-
</Root>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import {ErrorOutlineIcon} from '@sanity/icons'
|
|
3
|
-
import {Button, Card, Flex, Grid, Inline, Stack, Text} from '@sanity/ui'
|
|
4
|
-
import {ObjectInputProps, PatchEvent, unset} from 'sanity'
|
|
5
|
-
import {useCallback, useState} from 'react'
|
|
6
|
-
|
|
7
|
-
import {Asset} from '../types'
|
|
8
|
-
import AssetPreview from './AssetPreview'
|
|
9
|
-
import ShopifyAssetPicker from './ShopifyAssetPicker'
|
|
10
|
-
import ShopifyIcon from './ShopifyIcon'
|
|
11
|
-
|
|
12
|
-
export default function ShopifyAssetInput(props: ObjectInputProps) {
|
|
13
|
-
const {onChange, readOnly, value, schemaType} = props
|
|
14
|
-
const {options} = schemaType
|
|
15
|
-
const {shopifyDomain} = options
|
|
16
|
-
|
|
17
|
-
const [dialogOpen, setDialogOpen] = useState(false)
|
|
18
|
-
|
|
19
|
-
const removeValue = useCallback(() => {
|
|
20
|
-
onChange(PatchEvent.from([unset()]))
|
|
21
|
-
}, [onChange])
|
|
22
|
-
|
|
23
|
-
const onOpen = useCallback(() => {
|
|
24
|
-
setDialogOpen(true)
|
|
25
|
-
}, [setDialogOpen])
|
|
26
|
-
|
|
27
|
-
const onClose = useCallback(() => {
|
|
28
|
-
setDialogOpen(false)
|
|
29
|
-
}, [setDialogOpen])
|
|
30
|
-
|
|
31
|
-
if (!shopifyDomain) {
|
|
32
|
-
return (
|
|
33
|
-
<Card overflow="hidden" padding={4} radius={2} shadow={1} tone="critical">
|
|
34
|
-
<Flex align="center" gap={3}>
|
|
35
|
-
<Text size={2}>
|
|
36
|
-
<ErrorOutlineIcon />
|
|
37
|
-
</Text>
|
|
38
|
-
<Inline space={2}>
|
|
39
|
-
<Text size={1}>
|
|
40
|
-
You need to configure your *.myshopify.com domain in the plugin / field options to
|
|
41
|
-
enable Shopify Assets.
|
|
42
|
-
</Text>
|
|
43
|
-
</Inline>
|
|
44
|
-
</Flex>
|
|
45
|
-
</Card>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return (
|
|
50
|
-
<>
|
|
51
|
-
{dialogOpen && (
|
|
52
|
-
<ShopifyAssetPicker
|
|
53
|
-
{...props}
|
|
54
|
-
shopifyDomain={shopifyDomain}
|
|
55
|
-
isOpen={dialogOpen}
|
|
56
|
-
onClose={onClose}
|
|
57
|
-
value={value as Asset}
|
|
58
|
-
/>
|
|
59
|
-
)}
|
|
60
|
-
<Stack>
|
|
61
|
-
<AssetPreview value={value as Asset} />
|
|
62
|
-
|
|
63
|
-
<Grid gap={1} style={{gridTemplateColumns: 'repeat(auto-fit, minmax(100px, 1fr))'}}>
|
|
64
|
-
<Button
|
|
65
|
-
disabled={readOnly}
|
|
66
|
-
mode="ghost"
|
|
67
|
-
icon={ShopifyIcon}
|
|
68
|
-
title="Select an asset"
|
|
69
|
-
onClick={onOpen}
|
|
70
|
-
text="Select…"
|
|
71
|
-
/>
|
|
72
|
-
<Button
|
|
73
|
-
disabled={readOnly || !value}
|
|
74
|
-
tone="critical"
|
|
75
|
-
mode="ghost"
|
|
76
|
-
title="Remove asset"
|
|
77
|
-
text="Remove"
|
|
78
|
-
onClick={removeValue}
|
|
79
|
-
/>
|
|
80
|
-
</Grid>
|
|
81
|
-
</Stack>
|
|
82
|
-
</>
|
|
83
|
-
)
|
|
84
|
-
}
|