sanity-plugin-cloudinary 1.0.2 → 1.1.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/README.md +53 -44
- package/lib/index.d.ts +57 -0
- package/lib/index.esm.js +108 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +121 -15
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/AssetDiff.tsx +1 -1
- package/src/components/AssetListFunctions.tsx +100 -0
- package/src/components/AssetPreview.tsx +1 -1
- package/src/components/CloudinaryInput.tsx +2 -2
- package/src/components/WidgetInput.tsx +1 -1
- package/src/components/asset-source/CloudinaryAssetSource.tsx +1 -1
- package/src/index.ts +44 -3
- package/src/schema/cloudinaryAsset.ts +4 -1
- package/src/schema/cloudinaryAssetContext.ts +16 -0
- package/src/schema/cloudinaryAssetContextCustom.ts +21 -0
- package/src/{typings.d.ts → types.ts} +0 -6
- package/src/utils.ts +2 -2
- package/src/arrayFunctions.tsx +0 -71
package/README.md
CHANGED
|
@@ -116,7 +116,8 @@ If you use this type in an array, you will have additional array functions for a
|
|
|
116
116
|
}
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
<img width="
|
|
119
|
+
<img width="571" alt="image" src="https://user-images.githubusercontent.com/835514/223700970-ee536da7-57b1-4ada-add7-57d7179f462e.png">
|
|
120
|
+
|
|
120
121
|
|
|
121
122
|
## Content
|
|
122
123
|
|
|
@@ -124,24 +125,28 @@ Here is an example of which data is stored on your document after selecting an a
|
|
|
124
125
|
|
|
125
126
|
```json
|
|
126
127
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
128
|
+
"public_id": "29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x",
|
|
129
|
+
"resource_type": "image",
|
|
130
|
+
"type": "upload",
|
|
131
|
+
"format": "jpg",
|
|
132
|
+
"version": 1616474653,
|
|
133
|
+
"url": "http://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
134
|
+
"secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
135
|
+
"width": 2400,
|
|
136
|
+
"height": 1344,
|
|
137
|
+
"bytes": 547710,
|
|
138
|
+
"duration": null,
|
|
139
|
+
"tags": [],
|
|
140
|
+
"context": {
|
|
141
|
+
"custom": {
|
|
142
|
+
"alt": "alternative text for image"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"created_at": "2021-03-23T04:44:13Z",
|
|
146
|
+
"access_mode": "public",
|
|
147
|
+
"_version": 1,
|
|
148
|
+
"_type": "cloudinary.asset"
|
|
149
|
+
}
|
|
145
150
|
```
|
|
146
151
|
|
|
147
152
|
Note: The `_version` in the data here refers to the schema version of this plugin, should the way it stores the data from Cloudinary change in the future.
|
|
@@ -154,31 +159,35 @@ You can create a transformation when selecting the asset, and this information i
|
|
|
154
159
|
|
|
155
160
|
```json
|
|
156
161
|
{
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
162
|
+
"public_id": "29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x",
|
|
163
|
+
"resource_type": "image",
|
|
164
|
+
"type": "upload",
|
|
165
|
+
"format": "jpg",
|
|
166
|
+
"version": 1616474653,
|
|
167
|
+
"url": "http://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
168
|
+
"secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
169
|
+
"width": 2400,
|
|
170
|
+
"height": 1344,
|
|
171
|
+
"bytes": 547710,
|
|
172
|
+
"duration": null,
|
|
173
|
+
"tags": null,
|
|
174
|
+
"context": {
|
|
175
|
+
"custom": {
|
|
176
|
+
"alt": "alternative text for image"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"created_at": "2021-03-23T04:44:13Z",
|
|
180
|
+
"derived": [
|
|
181
|
+
{
|
|
182
|
+
"url": "http://res.cloudinary.com/dzwiku20l/image/upload/a_45/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
183
|
+
"secure_url": "https://res.cloudinary.com/dzwiku20l/image/upload/a_45/v1616474653/29b4a88182b4cb50330011d23a29bcb371bd5886-2400x1344_lzcx7x.jpg",
|
|
184
|
+
"raw_transformation": "a_45"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
"access_mode": "public",
|
|
188
|
+
"_version": 1,
|
|
189
|
+
"_type": "cloudinary.asset"
|
|
190
|
+
}
|
|
182
191
|
```
|
|
183
192
|
|
|
184
193
|
## Video
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,63 @@ import {ObjectDefinition} from 'sanity'
|
|
|
3
3
|
import {Plugin as Plugin_2} from 'sanity'
|
|
4
4
|
import {PreviewConfig} from 'sanity'
|
|
5
5
|
|
|
6
|
+
export declare type AssetDocument = {
|
|
7
|
+
_id: string
|
|
8
|
+
label?: string
|
|
9
|
+
title?: string
|
|
10
|
+
description?: string
|
|
11
|
+
source?: {
|
|
12
|
+
id: string
|
|
13
|
+
name: string
|
|
14
|
+
url?: string
|
|
15
|
+
}
|
|
16
|
+
creditLine?: string
|
|
17
|
+
originalFilename?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export declare type CloudinaryAsset = {
|
|
21
|
+
_type: string
|
|
22
|
+
_key?: string
|
|
23
|
+
_version: number
|
|
24
|
+
public_id: string
|
|
25
|
+
resource_type: string
|
|
26
|
+
type: string
|
|
27
|
+
format: string
|
|
28
|
+
version: number
|
|
29
|
+
url: string
|
|
30
|
+
secure_url: string
|
|
31
|
+
derived?: CloudinaryAssetDerived[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export declare interface CloudinaryAssetContext {
|
|
35
|
+
custom: object
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export declare const cloudinaryAssetContext: {
|
|
39
|
+
type: 'object'
|
|
40
|
+
name: 'cloudinary.assetContext'
|
|
41
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
42
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare type CloudinaryAssetContextCustom = {
|
|
46
|
+
alt: string
|
|
47
|
+
caption: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare const cloudinaryAssetContextCustom: {
|
|
51
|
+
type: 'object'
|
|
52
|
+
name: 'cloudinary.assetContextCustom'
|
|
53
|
+
} & Omit<ObjectDefinition, 'preview'> & {
|
|
54
|
+
preview?: PreviewConfig<Record<string, string>, Record<never, any>> | undefined
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare type CloudinaryAssetDerived = {
|
|
58
|
+
raw_transformation: string
|
|
59
|
+
url: string
|
|
60
|
+
secure_url: string
|
|
61
|
+
}
|
|
62
|
+
|
|
6
63
|
export declare const cloudinaryAssetDerivedSchema: {
|
|
7
64
|
type: 'object'
|
|
8
65
|
name: 'cloudinary.assetDerived'
|
package/lib/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _templateObject, _templateObject2;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { useCallback, useState, useRef, useEffect } from 'react';
|
|
5
|
-
import { PatchEvent, unset, set, DiffFromTo, defineType, definePlugin } from 'sanity';
|
|
4
|
+
import React, { useCallback, useState, useRef, useEffect } from 'react';
|
|
5
|
+
import { PatchEvent, unset, set, DiffFromTo, defineType, setIfMissing, insert, ArrayOfObjectsFunctions, definePlugin, isArrayOfObjectsSchemaType } from 'sanity';
|
|
6
6
|
import { Flex, Stack, Button, Grid, Dialog, Box, Spinner, Text } from '@sanity/ui';
|
|
7
7
|
import { PlugIcon } from '@sanity/icons';
|
|
8
8
|
import styled from 'styled-components';
|
|
@@ -368,8 +368,10 @@ const cloudinaryAssetSchema = defineType({
|
|
|
368
368
|
}, {
|
|
369
369
|
type: "string",
|
|
370
370
|
name: "access_mode"
|
|
371
|
+
}, {
|
|
372
|
+
type: "cloudinary.assetContext",
|
|
373
|
+
name: "context"
|
|
371
374
|
}
|
|
372
|
-
// context array of unknown content
|
|
373
375
|
// metadata array of unknown content
|
|
374
376
|
],
|
|
375
377
|
|
|
@@ -582,10 +584,111 @@ function CloudinaryAssetSource(props) {
|
|
|
582
584
|
})
|
|
583
585
|
});
|
|
584
586
|
}
|
|
587
|
+
const cloudinaryAssetContext = defineType({
|
|
588
|
+
type: "object",
|
|
589
|
+
name: "cloudinary.assetContext",
|
|
590
|
+
fields: [{
|
|
591
|
+
type: "cloudinary.assetContextCustom",
|
|
592
|
+
name: "custom"
|
|
593
|
+
}]
|
|
594
|
+
});
|
|
595
|
+
const cloudinaryAssetContextCustom = defineType({
|
|
596
|
+
type: "object",
|
|
597
|
+
name: "cloudinary.assetContextCustom",
|
|
598
|
+
fields: [{
|
|
599
|
+
type: "string",
|
|
600
|
+
name: "alt"
|
|
601
|
+
}, {
|
|
602
|
+
type: "string",
|
|
603
|
+
name: "caption"
|
|
604
|
+
}]
|
|
605
|
+
});
|
|
606
|
+
const AssetListFunctions = props => {
|
|
607
|
+
const {
|
|
608
|
+
onValueCreate,
|
|
609
|
+
onChange
|
|
610
|
+
} = props;
|
|
611
|
+
const {
|
|
612
|
+
secrets,
|
|
613
|
+
loading
|
|
614
|
+
} = useSecrets(namespace);
|
|
615
|
+
const [showSettings, setShowSettings] = React.useState(false);
|
|
616
|
+
const show = useCallback(() => setShowSettings(true), [setShowSettings]);
|
|
617
|
+
const hide = useCallback(() => setShowSettings(false), [setShowSettings]);
|
|
618
|
+
const cloudinaryType = props.schemaType.of.find(t => t.name === cloudinaryAssetSchema.name);
|
|
619
|
+
if (!cloudinaryType) {
|
|
620
|
+
throw new Error("AssetListFunctions can only be used in array.of ".concat(cloudinaryAssetSchema.name, ", but it was array.of\n ").concat(props.schemaType.of.map(t => t.name)));
|
|
621
|
+
}
|
|
622
|
+
const handleSelect = useCallback(selected => {
|
|
623
|
+
const items = selected.assets.map(asset => Object.assign({}, asset, {
|
|
624
|
+
// Schema version. In case we ever change our schema.
|
|
625
|
+
_version: 1
|
|
626
|
+
}, onValueCreate(cloudinaryType)
|
|
627
|
+
// onValueCreate is mistyped
|
|
628
|
+
));
|
|
629
|
+
|
|
630
|
+
onChange(PatchEvent.from([setIfMissing([]), insert(items, "after", [-1])]));
|
|
631
|
+
}, [onValueCreate, onChange, cloudinaryType]);
|
|
632
|
+
const handleOpenSelector = useCallback(() => secrets && openMediaSelector(secrets.cloudName, secrets.apiKey, true,
|
|
633
|
+
// multi-selection
|
|
634
|
+
handleSelect), [secrets, handleSelect]);
|
|
635
|
+
return /* @__PURE__ */jsxs(Flex, {
|
|
636
|
+
gap: 2,
|
|
637
|
+
flex: 1,
|
|
638
|
+
children: [showSettings && /* @__PURE__ */jsx(SecretsConfigView, {
|
|
639
|
+
onClose: hide
|
|
640
|
+
}), /* @__PURE__ */jsx(Box, {
|
|
641
|
+
flex: 1,
|
|
642
|
+
children: /* @__PURE__ */jsx(ArrayOfObjectsFunctions, {
|
|
643
|
+
...props
|
|
644
|
+
})
|
|
645
|
+
}), cloudinaryType && /* @__PURE__ */jsxs(Fragment, {
|
|
646
|
+
children: [/* @__PURE__ */jsx(Box, {
|
|
647
|
+
flex: 1,
|
|
648
|
+
children: /* @__PURE__ */jsx(Button, {
|
|
649
|
+
style: {
|
|
650
|
+
width: "100%"
|
|
651
|
+
},
|
|
652
|
+
disabled: props.readOnly || loading,
|
|
653
|
+
mode: "bleed",
|
|
654
|
+
text: "Add multiple",
|
|
655
|
+
onClick: handleOpenSelector
|
|
656
|
+
})
|
|
657
|
+
}), /* @__PURE__ */jsx(Box, {
|
|
658
|
+
children: /* @__PURE__ */jsx(Button, {
|
|
659
|
+
onClick: show,
|
|
660
|
+
icon: PlugIcon,
|
|
661
|
+
mode: "bleed",
|
|
662
|
+
title: "Configure"
|
|
663
|
+
})
|
|
664
|
+
})]
|
|
665
|
+
})]
|
|
666
|
+
});
|
|
667
|
+
};
|
|
585
668
|
const cloudinarySchemaPlugin = definePlugin({
|
|
586
669
|
name: "cloudinary-schema",
|
|
670
|
+
form: {
|
|
671
|
+
components: {
|
|
672
|
+
input: props => {
|
|
673
|
+
const {
|
|
674
|
+
schemaType
|
|
675
|
+
} = props;
|
|
676
|
+
if (isArrayOfObjectsSchemaType(schemaType)) {
|
|
677
|
+
const arrayProps = props;
|
|
678
|
+
const cloudinaryType = arrayProps.schemaType.of.find(t => t.name === cloudinaryAssetSchema.name);
|
|
679
|
+
if (cloudinaryType) {
|
|
680
|
+
return arrayProps.renderDefault({
|
|
681
|
+
...arrayProps,
|
|
682
|
+
arrayFunctions: AssetListFunctions
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return props.renderDefault(props);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
},
|
|
587
690
|
schema: {
|
|
588
|
-
types: [cloudinaryAssetSchema, cloudinaryAssetDerivedSchema]
|
|
691
|
+
types: [cloudinaryAssetSchema, cloudinaryAssetDerivedSchema, cloudinaryAssetContext, cloudinaryAssetContextCustom]
|
|
589
692
|
}
|
|
590
693
|
});
|
|
591
694
|
const cloudinaryImageSource = {
|
|
@@ -602,5 +705,5 @@ const cloudinaryAssetSourcePlugin = definePlugin({
|
|
|
602
705
|
}
|
|
603
706
|
}
|
|
604
707
|
});
|
|
605
|
-
export { cloudinaryAssetDerivedSchema, cloudinaryAssetSchema, cloudinaryAssetSourcePlugin, cloudinaryImageSource, cloudinarySchemaPlugin };
|
|
708
|
+
export { cloudinaryAssetContext, cloudinaryAssetContextCustom, cloudinaryAssetDerivedSchema, cloudinaryAssetSchema, cloudinaryAssetSourcePlugin, cloudinaryImageSource, cloudinarySchemaPlugin };
|
|
606
709
|
//# sourceMappingURL=index.esm.js.map
|
package/lib/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/VideoPlayer.tsx","../src/utils.ts","../src/components/AssetPreview.tsx","../src/components/WidgetInput.tsx","../src/components/SecretsConfigView.tsx","../src/components/CloudinaryInput.tsx","../src/components/AssetDiff.tsx","../src/schema/cloudinaryAsset.ts","../src/schema/cloudinaryAssetDerived.ts","../src/components/asset-source/Icon.tsx","../src/components/asset-source/CloudinaryAssetSource.tsx","../src/index.ts"],"sourcesContent":["import React, {CSSProperties} from 'react'\n\ntype PlayerKind = 'player' | 'diff'\n\nexport type VideoPlayerProps = {\n src: string\n // eslint-disable-next-line react/no-unused-prop-types\n kind: PlayerKind\n}\n\nexport default function VideoPlayer(props: VideoPlayerProps) {\n const {src} = props\n\n const style: CSSProperties = {\n width: '100%',\n height: 'auto',\n }\n\n return (\n <video controls style={style}>\n <source src={src} type=\"video/mp4\" />\n </video>\n )\n}\n","/* eslint-disable camelcase */\nimport {\n CloudinaryAsset,\n CloudinaryAssetResponse,\n CloudinaryMediaLibrary,\n InsertHandlerParams,\n} from './typings'\n\nconst widgetSrc = 'https://media-library.cloudinary.com/global/all.js'\n\nexport function assetUrl(asset: Partial<Pick<CloudinaryAsset, 'url' | 'secure_url' | 'derived'>>) {\n if (asset.derived && asset.derived.length > 0) {\n const [derived] = asset.derived\n if (derived.secure_url) {\n return derived.secure_url\n }\n return derived.url\n }\n if (asset.secure_url) {\n return asset.secure_url\n }\n return asset.url\n}\n\nexport const openMediaSelector = (\n cloudName: string,\n apiKey: string,\n multiple: boolean,\n insertHandler: (params: InsertHandlerParams) => void,\n selectedAsset?: CloudinaryAsset\n) => {\n loadJS(widgetSrc, () => {\n const options: Record<string, any> = {\n cloud_name: cloudName,\n api_key: apiKey,\n insert_caption: 'Select',\n multiple,\n }\n\n if (selectedAsset) {\n options.asset = {\n public_id: selectedAsset.public_id,\n type: selectedAsset.type,\n resource_type: selectedAsset.resource_type,\n }\n }\n\n window.cloudinary.openMediaLibrary(options, {insertHandler})\n })\n}\n\nexport const createMediaLibrary = ({\n cloudName,\n apiKey,\n inlineContainer,\n libraryCreated,\n insertHandler,\n}: {\n cloudName: string\n apiKey: string\n inlineContainer: string\n libraryCreated: (library: CloudinaryMediaLibrary) => void\n insertHandler: (params: InsertHandlerParams) => void\n}) => {\n loadJS(widgetSrc, () => {\n const options: Record<string, any> = {\n cloud_name: cloudName,\n api_key: apiKey,\n insert_caption: 'Select',\n inline_container: inlineContainer,\n remove_header: true,\n }\n\n libraryCreated(window.cloudinary.createMediaLibrary(options, {insertHandler}))\n })\n}\n\nexport function loadJS(url: string, callback: () => void) {\n const existingScript = document.getElementById('damWidget')\n if (!existingScript) {\n const script = document.createElement('script')\n script.src = url\n script.id = 'damWidget'\n document.body.appendChild(script)\n script.onload = () => {\n if (callback) {\n return callback()\n }\n return true\n }\n }\n if (existingScript && callback) {\n return callback()\n }\n return true\n}\n\nexport function encodeSourceId(asset: CloudinaryAssetResponse): string {\n const {resource_type, public_id, type} = asset\n return btoa(JSON.stringify({public_id, resource_type, type})) // Sort keys alphabetically!\n}\n\nexport function encodeFilename(asset: CloudinaryAssetResponse) {\n return `${asset.public_id.split('/').slice(-1)[0]}.${asset.format}`\n}\n\nexport function decodeSourceId(sourceId: string): CloudinaryAssetResponse | undefined {\n let sourceIdDecoded: any\n try {\n sourceIdDecoded = JSON.parse(atob(sourceId))\n } catch (err) {\n // Do nothing\n }\n return sourceIdDecoded\n}\n","import React from 'react'\nimport VideoPlayer from './VideoPlayer'\nimport {assetUrl} from '../utils'\nimport {Flex} from '@sanity/ui'\nimport {CloudinaryAsset} from '../typings'\n\ninterface ComponentProps {\n layout?: 'default' | 'block'\n value: CloudinaryAsset | undefined\n}\n\nconst AssetPreview = ({value, layout}: ComponentProps) => {\n const url = value && assetUrl(value)\n if (!value || !url) {\n return null\n }\n\n switch (value.resource_type) {\n case 'video':\n return (\n <Flex\n align=\"center\"\n style={{\n maxWidth: layout === 'default' ? '80px' : '100%',\n }}\n >\n <VideoPlayer src={url} kind=\"player\" />\n </Flex>\n )\n default:\n return (\n <Flex align=\"center\">\n <img\n alt=\"preview\"\n src={url}\n style={{\n maxWidth: layout === 'default' ? '80px' : '100%',\n height: 'auto',\n }}\n />\n </Flex>\n )\n }\n}\n\nexport default AssetPreview\n","import React, {useCallback} from 'react'\nimport {ObjectInputProps, PatchEvent, unset} from 'sanity'\nimport {Button, Flex, Grid, Stack} from '@sanity/ui'\nimport {PlugIcon} from '@sanity/icons'\nimport styled from 'styled-components'\nimport AssetPreview from './AssetPreview'\nimport {CloudinaryAsset} from '../typings'\n\nconst SetupButtonContainer = styled.div`\n position: relative;\n display: block;\n font-size: 0.8em;\n transform: translate(0%, -10%);\n`\n\ntype WidgetInputProps = ObjectInputProps & {openMediaSelector: () => void; onSetup: () => void}\n\nconst WidgetInput = (props: WidgetInputProps) => {\n const {onChange, readOnly, value, openMediaSelector} = props\n\n const removeValue = useCallback(() => {\n onChange(PatchEvent.from([unset()]))\n }, [onChange])\n\n return (\n <Stack>\n <SetupButtonContainer>\n <Flex flex={1} justify=\"flex-end\">\n <Button\n color=\"primary\"\n icon={PlugIcon}\n mode=\"bleed\"\n title=\"Configure\"\n onClick={props.onSetup}\n tabIndex={1}\n />\n </Flex>\n </SetupButtonContainer>\n\n <Flex style={{textAlign: 'center', width: '100%'}} marginBottom={2}>\n <AssetPreview value={value as CloudinaryAsset} />\n </Flex>\n\n <Grid gap={1} style={{gridTemplateColumns: 'repeat(auto-fit, minmax(100px, 1fr))'}}>\n <Button\n disabled={readOnly}\n mode=\"ghost\"\n title=\"Select an asset\"\n tone=\"default\"\n onClick={openMediaSelector}\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\nexport default WidgetInput\n","import React from 'react'\nimport {SettingsView} from '@sanity/studio-secrets'\n\nexport type Secrets = {\n cloudName: string\n apiKey: string\n}\n\nconst pluginConfigKeys = [\n {\n key: 'cloudName',\n title: 'Cloud name',\n description: '',\n },\n {\n key: 'apiKey',\n title: 'API key',\n description: '',\n },\n]\n\nexport const namespace = 'cloudinary'\n\ntype Props = {\n onClose: () => void\n}\n\nconst SecretsConfigView = (props: Props) => {\n return (\n <SettingsView\n title=\"Cloudinary config\"\n namespace={namespace}\n keys={pluginConfigKeys}\n onClose={props.onClose}\n />\n )\n}\n\nexport default SecretsConfigView\n","import React, {useCallback, useState} from 'react'\nimport WidgetInput from './WidgetInput'\nimport {nanoid} from 'nanoid'\nimport {ObjectInputProps, PatchEvent, set} from 'sanity'\nimport {CloudinaryAsset} from '../typings'\nimport {useSecrets} from '@sanity/studio-secrets'\nimport {InsertHandlerParams} from '../typings'\nimport {openMediaSelector} from '../utils'\nimport SecretsConfigView, {namespace, Secrets} from './SecretsConfigView'\n\nconst CloudinaryInput = (props: ObjectInputProps) => {\n const [showSettings, setShowSettings] = useState(false)\n const {secrets} = useSecrets<Secrets>(namespace)\n const {onChange, schemaType: type} = props\n const value = (props.value as CloudinaryAsset) || undefined\n\n const handleSelect = useCallback(\n (payload: InsertHandlerParams) => {\n const [asset] = payload.assets\n if (!asset) {\n return\n }\n\n onChange(\n PatchEvent.from([\n set(\n Object.assign(\n {\n _type: type.name,\n _version: 1,\n ...(value?._key ? {_key: value._key} : {_key: nanoid()}),\n },\n asset\n )\n ),\n ])\n )\n },\n [onChange, type, value?._key]\n )\n\n const action = secrets\n ? () =>\n openMediaSelector(\n secrets.cloudName,\n secrets.apiKey,\n false, // single selection\n handleSelect,\n value\n )\n : () => setShowSettings(true)\n\n return (\n <>\n {showSettings && <SecretsConfigView onClose={() => setShowSettings(false)} />}\n <WidgetInput onSetup={() => setShowSettings(true)} openMediaSelector={action} {...props} />\n </>\n )\n}\n\nexport default CloudinaryInput\n","import React from 'react'\nimport {DiffFromTo} from 'sanity'\nimport VideoPlayer from './VideoPlayer'\nimport {assetUrl} from '../utils'\nimport {CloudinaryAsset} from '../typings'\n\ntype Props = {\n value: CloudinaryAsset | undefined\n}\n\nconst CloudinaryDiffPreview = ({value}: Props) => {\n if (!value) {\n return null\n }\n\n const url = assetUrl(value)\n\n if (value.resource_type === 'video' && url) {\n return (\n <section\n style={{\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n }}\n >\n <VideoPlayer src={url} kind=\"diff\" />\n </section>\n )\n }\n\n return <img alt=\"preview\" src={url} style={{maxWidth: '100%', height: 'auto'}} />\n}\n\ntype DiffProps = {\n diff: any\n schemaType: any\n}\n\nconst AssetDiff = ({diff, schemaType}: DiffProps) => {\n return <DiffFromTo diff={diff} schemaType={schemaType} previewComponent={CloudinaryDiffPreview} />\n}\n\nexport default AssetDiff\n","/* eslint-disable */\nimport CloudinaryInput from '../components/CloudinaryInput'\nimport AssetDiff from '../components/AssetDiff'\nimport AssetPreview from '../components/AssetPreview'\nimport {defineType} from 'sanity'\n\nexport const cloudinaryAssetSchema = defineType({\n type: 'object',\n name: 'cloudinary.asset',\n fields: [\n {\n type: 'string',\n name: 'public_id',\n },\n {\n type: 'string',\n name: 'resource_type',\n // \"image\", \"?\"\n },\n {\n type: 'string',\n name: 'type',\n // \"upload\", \"?\"\n },\n {\n type: 'string',\n name: 'format',\n // \"jpg\"\n },\n {\n type: 'number',\n name: 'version',\n },\n {\n type: 'url',\n name: 'url',\n },\n {\n type: 'url',\n name: 'secure_url',\n },\n {\n type: 'number',\n name: 'width',\n },\n {\n type: 'number',\n name: 'height',\n },\n {\n type: 'number',\n name: 'bytes',\n },\n {\n type: 'number',\n name: 'duration',\n // can be null\n },\n {\n type: 'array',\n name: 'tags',\n of: [{type: 'string'}],\n },\n {\n type: 'datetime',\n name: 'created_at',\n },\n {\n type: 'array',\n name: 'derived',\n of: [{type: 'cloudinary.assetDerived'}],\n },\n {\n type: 'string',\n name: 'access_mode',\n },\n // context array of unknown content\n // metadata array of unknown content\n ],\n ...({\n components: {\n input: CloudinaryInput,\n diff: AssetDiff,\n preview: AssetPreview,\n },\n } as {}), //TODO revert this change when rc.1 is released\n preview: {\n select: {\n url: 'url',\n resource_type: 'resource_type',\n derived: 'derived.0.url',\n },\n prepare({url, derived, resource_type}) {\n return {\n title: url,\n value: {\n title: url,\n resource_type,\n url: derived || url,\n },\n }\n },\n },\n})\n","import {defineType} from 'sanity'\n\nexport type CloudinaryAssetDerived = {\n raw_transformation: string\n url: string\n secure_url: string\n}\n\nexport const cloudinaryAssetDerivedSchema = defineType({\n type: 'object',\n name: 'cloudinary.assetDerived',\n fields: [\n {\n type: 'string',\n name: 'raw_transformation',\n },\n {\n type: 'url',\n name: 'url',\n },\n {\n type: 'url',\n name: 'secure_url',\n },\n ],\n})\n","import React from 'react'\n\nexport function CloudinaryIcon() {\n return (\n <svg\n version=\"1.1\"\n id=\"Layer_1\"\n x=\"0px\"\n y=\"0px\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 141.732 141.747\"\n enableBackground=\"new 0 0 141.732 141.747\"\n >\n <g>\n <path\n fill=\"#0071CE\"\n d=\"M115.585,109.242c-1.609,0-3.107-1.024-3.635-2.637c-0.657-2.008,0.438-4.169,2.447-4.826\n c7.278-2.382,11.98-8.761,11.98-16.252c0-9.487-7.718-17.206-17.205-17.206c-0.659,0-1.368,0.052-2.231,0.164l-3.741,0.485\n l-0.537-3.735c-2.299-16.016-16.251-28.094-32.454-28.094c-13.395,0-25.32,8.019-30.377,20.43l-0.952,2.335l-2.52,0.046\n c-11.581,0.213-21.003,9.804-21.003,21.379c0,8.45,4.906,16.156,12.498,19.631c1.921,0.88,2.766,3.15,1.886,5.071\n c-0.88,1.921-3.149,2.764-5.07,1.887C14.363,103.202,7.703,92.766,7.703,81.331c0-14.88,11.465-27.345,26.028-28.876\n c6.71-14.03,20.773-22.965,36.477-22.965c18.796,0,35.135,13.178,39.372,31.184c13.519,0.219,24.45,11.284,24.45,24.854\n c0,10.693-6.934,20.146-17.253,23.523C116.382,109.18,115.98,109.242,115.585,109.242z\"\n />\n <path\n fill=\"#DC8327\"\n d=\"M57.12,111.02c-0.001-0.001-0.001-0.001-0.002-0.001c-0.001,0-0.002-0.001-0.003-0.001h-0.001\n c0,0-0.001-0.001-0.001-0.001l-0.001-0.001c0,0-0.001,0-0.001-0.001h-0.001l-0.001-0.001c0.001-0.001-0.001-0.001-0.001-0.001\n l-0.001-0.001c0,0-0.001,0-0.001,0l-0.001-0.001c0.001,0.001-0.001-0.001-0.001-0.001s-0.002-0.001-0.003-0.001l-0.001-0.001H57.1\n c-0.001-0.001-0.001-0.001-0.001-0.001l-0.001-0.001c-0.003-0.001-0.002-0.001-0.003-0.001c-0.001,0.001-0.001-0.001-0.002-0.001\n l-0.001-0.001c0,0-0.001-0.001-0.002-0.001l-0.001-0.001c-0.001-0.001-0.003-0.001-0.004-0.001s-0.003-0.001-0.004-0.001\n c-0.001-0.001-0.001-0.001-0.002-0.001h-0.001c-0.001-0.001-0.002-0.001-0.003-0.001c-0.001-0.001-0.003-0.001-0.003-0.001\n c-0.001,0-0.001,0-0.001,0l-0.002-0.001c-0.001,0-0.001-0.001-0.001-0.001h-0.001c-0.059-0.021-0.122-0.034-0.188-0.037h-0.002\n h-0.002c-0.001,0-0.001,0-0.002,0c0,0,0,0-0.001,0c0,0-0.001,0-0.001,0h-0.001c-0.001-0.001-0.001-0.001-0.001-0.001\n c-0.001,0-0.002,0-0.002,0c-0.001,0-0.002,0-0.002,0h-0.001h-0.001h-0.001c-0.001,0-0.002,0-0.002,0h-0.001H56.86h-0.001h-0.001\n c-0.001,0-0.001,0-0.001,0h-0.001h-0.001h-0.001h-0.001c-0.001,0-0.001,0-0.001,0c-1.656,0-3.011-1.348-3.021-3V74.29h2.567\n c0.004,0,0.009,0,0.013,0c0.393,0.017,0.661-0.285,0.661-0.648c0-0.271-0.166-0.503-0.402-0.6l-12.379-8.544\n c-0.222-0.153-0.515-0.153-0.737,0l-12.476,8.611c-0.234,0.161-0.335,0.456-0.251,0.727c0.085,0.271,0.335,0.455,0.619,0.455h2.58\n l0.002,33.674c0.013,2.328,1.883,4.228,4.262,4.288c0.027,0.003,0.053,0.005,0.08,0.005h18.481c0.004,0,0.007,0,0.011,0\n c0.17-0.003,0.324-0.071,0.438-0.18c0,0,0,0,0.001-0.001c0.002-0.002,0.004-0.004,0.005-0.005c0.001-0.001,0.002-0.001,0.003-0.003\n c0,0,0.001-0.001,0.001-0.001l0.001-0.001l0.001-0.001l0.001-0.001l0.001-0.001c0.001-0.001,0.001-0.001,0.001-0.001\n c0.002-0.001,0.001-0.001,0.002-0.002c0,0,0,0,0.001-0.001l0.001-0.001c0,0,0,0,0.001-0.001c0.112-0.116,0.182-0.273,0.183-0.447\n v-0.002v-0.001v-0.001v-0.001v-0.001v-0.001v-0.001v-0.002C57.498,111.345,57.343,111.121,57.12,111.02z\"\n />\n <path\n fill=\"#F4B21B\"\n d=\"M83.889,111.02c0,0-0.001-0.001-0.002-0.001c-0.001,0-0.002-0.001-0.003-0.001h-0.001\n c-0.001-0.001-0.001-0.001-0.001-0.001l-0.001-0.001h-0.001c0,0-0.001-0.001-0.001-0.001c0,0-0.001-0.001-0.001-0.001\n c0.001-0.001-0.001-0.001-0.002-0.001l-0.001-0.001h-0.001c-0.001,0-0.001-0.001-0.001-0.001c-0.002,0.001-0.002-0.001-0.002-0.001\n l-0.002-0.001l-0.001-0.001h-0.001c0,0-0.001-0.001-0.001-0.001l-0.001-0.001c-0.001-0.001-0.002-0.001-0.002-0.001\n c-0.001,0.001-0.001-0.001-0.003-0.001l-0.001-0.001l-0.001-0.001c0,0-0.001,0-0.002-0.001c-0.001-0.001-0.003-0.001-0.004-0.001\n s-0.003-0.001-0.004-0.001c-0.001-0.001-0.001-0.001-0.002-0.001c-0.001,0-0.001,0-0.002-0.001c0,0-0.001,0-0.002-0.001\n c-0.003-0.001-0.001-0.001-0.002-0.001c-0.003,0-0.001,0-0.002-0.001c0,0-0.001-0.001-0.002-0.001l-0.001-0.001h-0.001\n c-0.059-0.021-0.122-0.034-0.188-0.037h-0.002c-0.001,0-0.001,0-0.001,0c-0.001,0-0.002,0-0.002,0s-0.001,0-0.001,0h-0.001h-0.001\n l-0.001-0.001c-0.001,0-0.002,0-0.002,0c-0.001,0-0.002,0-0.002,0h-0.001c-0.001,0-0.001,0-0.001,0h-0.001\n c-0.001,0-0.002,0-0.002,0s-0.001,0-0.002,0h-0.001c0,0-0.001,0-0.001,0h-0.001c-0.001,0-0.001,0-0.001,0h-0.001h-0.001h-0.001\n h-0.001c-0.001,0-0.001,0-0.001,0c-1.655,0-3.01-1.348-3.02-3V81.829h2.579c0.009-0.001,0.016-0.001,0.026,0\n c0.358,0,0.648-0.29,0.648-0.648c0-0.271-0.166-0.503-0.402-0.6l-12.38-8.544c-0.222-0.153-0.515-0.153-0.737,0L57.86,80.647\n c-0.234,0.161-0.335,0.456-0.251,0.727c0.085,0.271,0.335,0.455,0.619,0.455h2.568l0.002,26.135\n c0.011,2.329,1.884,4.23,4.264,4.289c0.026,0.003,0.052,0.004,0.078,0.004h18.481c0.004,0,0.007,0,0.011,0\n c0.17-0.003,0.324-0.071,0.438-0.18c0,0,0,0,0.001-0.001c0.002-0.002,0.006-0.004,0.005-0.005c0.001-0.001,0.002-0.001,0.003-0.003\n c0.001-0.001,0.001-0.001,0.001-0.001l0.001-0.001l0.001-0.001c0,0,0.001,0,0.001-0.001l0.001-0.001\n c0.001,0,0.001-0.001,0.001-0.001c0.003-0.001,0.002-0.001,0.002-0.002c0,0,0,0,0.001-0.001c0,0,0,0,0.001-0.001\n c0,0,0,0,0.001-0.001c0.112-0.116,0.182-0.273,0.183-0.447v-0.002v-0.001v-0.001v-0.001v-0.001v-0.001v-0.001v-0.002\n C84.267,111.345,84.112,111.121,83.889,111.02z\"\n />\n <path\n fill=\"#F2D864\"\n d=\"M110.667,111.02l-0.002-0.001c-0.001,0-0.002-0.001-0.003-0.001h-0.001\n c-0.001-0.001-0.001-0.001-0.001-0.001l-0.001-0.001c-0.001,0-0.001,0-0.001-0.001h-0.001l-0.001-0.001\n c-0.001-0.001-0.001-0.001-0.001-0.001s-0.001,0-0.001-0.001h-0.001c0,0-0.001-0.001-0.001-0.001\n c-0.001,0.001-0.001-0.001-0.002-0.001c0.001-0.001-0.001-0.001-0.002-0.001l-0.001-0.001c-0.001,0-0.001,0-0.001,0\n c-0.001-0.001-0.001-0.001-0.001-0.001l-0.001-0.001c-0.003-0.001-0.002-0.001-0.002-0.001c-0.001,0.001-0.001-0.001-0.003-0.001\n l-0.001-0.001c0.001-0.001-0.001-0.001-0.002-0.001c0,0-0.001,0-0.001-0.001c-0.001-0.001-0.003-0.001-0.004-0.001\n s-0.003-0.001-0.004-0.001l-0.002-0.001c0,0-0.001,0-0.002-0.001l-0.002-0.001c-0.003-0.001-0.003-0.001-0.002-0.001\n c-0.003,0-0.003,0-0.002-0.001c-0.001,0-0.001-0.001-0.001-0.001c-0.001,0-0.002-0.001-0.002-0.001h-0.001\n c-0.059-0.021-0.122-0.034-0.188-0.037h-0.001c-0.001,0-0.002,0-0.002,0c-0.001,0-0.002,0-0.003,0h-0.001h-0.001h-0.001\n c-0.001-0.001-0.001-0.001-0.002-0.001c0,0-0.001,0-0.002,0c0,0-0.001,0-0.002,0h-0.001c0,0-0.001,0-0.001,0h-0.001\n c-0.001,0-0.002,0-0.002,0h-0.002c0,0,0,0-0.001,0c0,0-0.001,0-0.001,0h-0.001c0,0-0.001,0-0.001,0h-0.001h-0.001h-0.001H110.4\n c0,0-0.001,0-0.001,0c-1.655,0-3.01-1.348-3.02-3V89.365h2.573c0.004,0,0.009,0,0.013,0c0.365-0.009,0.661-0.285,0.661-0.648\n c0-0.271-0.166-0.503-0.402-0.6l-12.38-8.544c-0.221-0.153-0.515-0.153-0.737,0l-12.476,8.61c-0.234,0.161-0.335,0.456-0.251,0.727\n c0.085,0.271,0.335,0.455,0.619,0.455h2.573l0.002,18.599c0.013,2.329,1.885,4.231,4.264,4.289\n c0.026,0.003,0.052,0.004,0.078,0.004h18.481c0.004,0,0.007,0,0.011,0c0.17-0.003,0.324-0.071,0.438-0.18l0.001-0.001\n c0.002-0.002,0.005-0.004,0.005-0.005c0.001-0.001,0.002-0.001,0.003-0.003c0,0,0.001-0.001,0.001-0.001l0.001-0.001l0.001-0.001\n l0.001-0.001l0.001-0.001l0.001-0.001c0.003-0.001,0.001-0.001,0.002-0.002c0,0,0,0,0.001-0.001l0.001-0.001c0,0,0,0,0.001-0.001\n c0.112-0.116,0.182-0.273,0.183-0.447v-0.002v-0.001v-0.001v-0.001v-0.001v-0.001v-0.001v-0.002\n C111.045,111.345,110.889,111.121,110.667,111.02z\"\n />\n </g>\n </svg>\n )\n}\n","/* eslint-disable camelcase */\nimport React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Flex, Spinner, Stack, Text} from '@sanity/ui'\nimport {CloudinaryMediaLibrary, InsertHandlerParams} from '../../typings'\nimport {createMediaLibrary, decodeSourceId, encodeFilename, encodeSourceId} from '../../utils'\nimport styled from 'styled-components'\nimport {useSecrets} from '@sanity/studio-secrets'\nimport SecretsConfigView, {namespace, Secrets} from '../SecretsConfigView'\nimport {AssetSourceComponentProps, ImageAsset} from 'sanity'\nimport {PlugIcon} from '@sanity/icons'\n\nexport const Widget = styled.div`\n height: 70vh;\n`\n\nexport function CloudinaryAssetSource(props: AssetSourceComponentProps) {\n const {onClose} = props\n\n const [loadingMessage, setLoadingMessage] = useState<string | undefined>(\n 'Loading Cloudinary Media Libary'\n )\n const library = useRef<CloudinaryMediaLibrary | undefined>()\n const contentRef = useRef<HTMLDivElement | null>(null)\n const {secrets} = useSecrets<Secrets>(namespace)\n const cloudName = secrets?.cloudName\n const apiKey = secrets?.apiKey\n const [widgetId] = useState(() => `cloundinaryWidget-${Date.now()}`)\n const [showSettings, setShowSettings] = useState(false)\n\n const propsRef = useRef(props)\n\n useEffect(() => {\n // because we have to access props after loading js in a callback,\n // we cannot pass props as dependecnies as that will cause infinite updates\n // this takes a snapshot of props, so we can access them later\n propsRef.current = props\n }, [props])\n\n const handleClose = useCallback(() => {\n if (library.current) {\n library.current.hide()\n }\n onClose()\n }, [onClose, library])\n\n useEffect(() => {\n if (!cloudName || !apiKey) {\n return\n }\n\n createMediaLibrary({\n cloudName,\n apiKey,\n inlineContainer: `#${widgetId}`,\n libraryCreated: (lib: CloudinaryMediaLibrary) => {\n library.current = lib\n const selectedAssets = propsRef.current.selectedAssets\n const firstSelectedAsset = selectedAssets ? selectedAssets[0] : null\n\n // eslint-disable-next-line no-undef\n const iframe: ChildNode | null | undefined =\n contentRef.current && contentRef.current.firstChild\n if (iframe && iframe instanceof HTMLIFrameElement) {\n setLoadingMessage(undefined)\n let asset\n if (\n propsRef.current.selectionType === 'single' &&\n firstSelectedAsset &&\n firstSelectedAsset.source &&\n firstSelectedAsset.source.id\n ) {\n asset = decodeSourceId(firstSelectedAsset.source.id)\n }\n const folder = asset\n ? {\n path: asset.public_id.split('/').slice(0, -1).join('/'),\n resource_type: 'image',\n }\n : {path: '', resource_type: 'image'}\n if (lib && contentRef.current) {\n lib.show({folder, asset})\n contentRef.current.style.visibility = 'visible'\n }\n }\n },\n insertHandler: ({assets}: InsertHandlerParams) => {\n if (!library.current) {\n return\n }\n const imageAssets = assets.filter((asset) => asset.resource_type === 'image')\n if (imageAssets.length === 0) {\n throw new Error('The selection did not contain any images.')\n }\n library.current.hide()\n propsRef.current.onSelect(\n imageAssets.map((asset) => {\n const url =\n asset.derived && asset.derived[0] ? asset.derived[0].secure_url : asset.secure_url\n return {\n kind: 'url',\n value: url,\n assetDocumentProps: {\n _type: 'sanity.imageAsset',\n originalFilename: encodeFilename(asset),\n source: {\n id: encodeSourceId(asset),\n name: `cloudinary:${cloudName}`,\n },\n } as ImageAsset,\n }\n })\n )\n },\n })\n }, [cloudName, apiKey, widgetId])\n\n const hasConfig = apiKey && cloudName\n return (\n <Dialog\n id=\"cloudinary-asset-source\"\n header=\"Select image from Cloudinary\"\n onClose={handleClose}\n open\n width={4}\n >\n <Box padding={4}>\n {showSettings && <SecretsConfigView onClose={() => setShowSettings(false)} />}\n <Flex flex={1} justify=\"flex-end\">\n <Button\n color=\"primary\"\n icon={PlugIcon}\n mode=\"bleed\"\n title=\"Configure\"\n onClick={() => setShowSettings(true)}\n tabIndex={1}\n text={hasConfig ? undefined : 'Configure Cloudinary plugin'}\n />\n </Flex>\n\n {hasConfig && loadingMessage && (\n <Stack space={3}>\n <Flex align=\"center\" justify=\"center\">\n <Spinner muted />\n </Flex>\n <Text size={1} muted align=\"center\">\n {loadingMessage}\n </Text>\n </Stack>\n )}\n\n <Widget style={{visibility: 'hidden'}} ref={contentRef} id={widgetId} />\n </Box>\n </Dialog>\n )\n}\n","import {cloudinaryAssetSchema} from './schema/cloudinaryAsset'\nimport {cloudinaryAssetDerivedSchema} from './schema/cloudinaryAssetDerived'\nimport {definePlugin, AssetSource} from 'sanity'\nimport {CloudinaryIcon} from './components/asset-source/Icon'\nimport {CloudinaryAssetSource} from './components/asset-source/CloudinaryAssetSource'\n\nexport {cloudinaryAssetSchema, cloudinaryAssetDerivedSchema}\n\nexport const cloudinarySchemaPlugin = definePlugin({\n name: 'cloudinary-schema',\n schema: {\n types: [cloudinaryAssetSchema, cloudinaryAssetDerivedSchema],\n },\n})\n\nexport const cloudinaryImageSource: AssetSource = {\n name: 'cloudinary-image',\n title: 'Cloudinary',\n icon: CloudinaryIcon,\n component: CloudinaryAssetSource,\n}\n\nexport const cloudinaryAssetSourcePlugin = definePlugin({\n name: 'cloudinart-asset-source',\n form: {\n image: {\n assetSources: [cloudinaryImageSource],\n },\n },\n})\n"],"names":["VideoPlayer","props","src","style","width","height","jsx","controls","children","type","widgetSrc","assetUrl","asset","derived","length","secure_url","url","openMediaSelector","cloudName","apiKey","multiple","insertHandler","selectedAsset","loadJS","options","cloud_name","api_key","insert_caption","public_id","resource_type","window","cloudinary","openMediaLibrary","createMediaLibrary","inlineContainer","libraryCreated","inline_container","remove_header","callback","existingScript","document","getElementById","script","createElement","id","body","appendChild","onload","encodeSourceId","btoa","JSON","stringify","encodeFilename","split","slice","format","decodeSourceId","sourceId","sourceIdDecoded","parse","atob","err","AssetPreview","value","layout","Flex","align","maxWidth","kind","alt","SetupButtonContainer","styled","div","WidgetInput","onChange","readOnly","removeValue","useCallback","PatchEvent","from","unset","Stack","flex","justify","Button","color","icon","PlugIcon","mode","title","onClick","onSetup","tabIndex","textAlign","marginBottom","jsxs","Grid","gap","gridTemplateColumns","disabled","tone","text","pluginConfigKeys","key","description","namespace","SecretsConfigView","SettingsView","keys","onClose","CloudinaryInput","showSettings","setShowSettings","useState","secrets","useSecrets","schemaType","handleSelect","payload","assets","set","Object","assign","_type","name","_version","_key","nanoid","action","Fragment","CloudinaryDiffPreview","display","flexWrap","justifyContent","AssetDiff","diff","DiffFromTo","previewComponent","cloudinaryAssetSchema","defineType","fields","of","components","input","preview","select","prepare","cloudinaryAssetDerivedSchema","CloudinaryIcon","version","x","y","viewBox","enableBackground","fill","d","Widget","CloudinaryAssetSource","loadingMessage","setLoadingMessage","library","useRef","contentRef","widgetId","Date","now","propsRef","useEffect","current","handleClose","hide","lib","selectedAssets","firstSelectedAsset","iframe","firstChild","HTMLIFrameElement","selectionType","source","folder","path","join","show","visibility","imageAssets","filter","Error","onSelect","map","assetDocumentProps","originalFilename","hasConfig","Dialog","header","open","Box","padding","space","Spinner","muted","Text","size","ref","cloudinarySchemaPlugin","definePlugin","schema","types","cloudinaryImageSource","component","cloudinaryAssetSourcePlugin","form","image","assetSources"],"mappings":";;;;;;;;;;AAUA,SAAwBA,YAAYC,KAAyB,EAAA;EACrD,MAAA;IAACC;EAAO,CAAA,GAAAD,KAAA;EAEd,MAAME,KAAuB,GAAA;IAC3BC,KAAO,EAAA,MAAA;IACPC,MAAQ,EAAA;EAAA,CACV;EAGE,OAAA,eAAAC,GAAA,CAAC,OAAM,EAAA;IAAAC,QAAA,EAAQ,IAAC;IAAAJ,KAAA;IACdK,6BAAC,QAAO,EAAA;MAAAN,GAAA;MAAUO,IAAK,EAAA;IAAY,CAAA;EACrC,CAAA,CAAA;AAEJ;ACfA,MAAMC,SAAY,GAAA,oDAAA;AAEX,SAASC,SAASC,KAAyE,EAAA;EAChG,IAAIA,KAAM,CAAAC,OAAA,IAAWD,KAAM,CAAAC,OAAA,CAAQC,SAAS,CAAG,EAAA;IACvC,MAAA,CAACD,OAAO,CAAA,GAAID,KAAM,CAAAC,OAAA;IACxB,IAAIA,QAAQE,UAAY,EAAA;MACtB,OAAOF,OAAQ,CAAAE,UAAA;IACjB;IACA,OAAOF,OAAQ,CAAAG,GAAA;EACjB;EACA,IAAIJ,MAAMG,UAAY,EAAA;IACpB,OAAOH,KAAM,CAAAG,UAAA;EACf;EACA,OAAOH,KAAM,CAAAI,GAAA;AACf;AAEO,MAAMC,oBAAoB,CAC/BC,SAAA,EACAC,MACA,EAAAC,QAAA,EACAC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AA;KACxE;EAAA,CAAA,CACF;AAEJ;AClJO,MAAMwC,yBAAyBC,YAAa,CAAA;EACjDhF,IAAM,EAAA,mBAAA;EACNiF,MAAQ,EAAA;IACNC,KAAA,EAAO,CAACpE,qBAAA,EAAuBS,4BAA4B;EAC7D;AACF,CAAC,CAAA;AAEM,MAAM4D,qBAAqC,GAAA;EAChDnF,IAAM,EAAA,kBAAA;EACNnC,KAAO,EAAA,YAAA;EACPH,IAAM,EAAA8D,cAAA;EACN4D,SAAW,EAAAnD;AACb,CAAA;AAEO,MAAMoD,8BAA8BL,YAAa,CAAA;EACtDhF,IAAM,EAAA,yBAAA;EACNsF,IAAM,EAAA;IACJC,KAAO,EAAA;MACLC,YAAA,EAAc,CAACL,qBAAqB;IACtC;EACF;AACF,CAAC,CAAA;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/VideoPlayer.tsx","../src/utils.ts","../src/components/AssetPreview.tsx","../src/components/WidgetInput.tsx","../src/components/SecretsConfigView.tsx","../src/components/CloudinaryInput.tsx","../src/components/AssetDiff.tsx","../src/schema/cloudinaryAsset.ts","../src/schema/cloudinaryAssetDerived.ts","../src/components/asset-source/Icon.tsx","../src/components/asset-source/CloudinaryAssetSource.tsx","../src/schema/cloudinaryAssetContext.ts","../src/schema/cloudinaryAssetContextCustom.ts","../src/components/AssetListFunctions.tsx","../src/index.ts"],"sourcesContent":["import React, {CSSProperties} from 'react'\n\ntype PlayerKind = 'player' | 'diff'\n\nexport type VideoPlayerProps = {\n src: string\n // eslint-disable-next-line react/no-unused-prop-types\n kind: PlayerKind\n}\n\nexport default function VideoPlayer(props: VideoPlayerProps) {\n const {src} = props\n\n const style: CSSProperties = {\n width: '100%',\n height: 'auto',\n }\n\n return (\n <video controls style={style}>\n <source src={src} type=\"video/mp4\" />\n </video>\n )\n}\n","/* eslint-disable camelcase,@typescript-eslint/explicit-module-boundary-types */\nimport {\n CloudinaryAsset,\n CloudinaryAssetResponse,\n CloudinaryMediaLibrary,\n InsertHandlerParams,\n} from './types'\n\nconst widgetSrc = 'https://media-library.cloudinary.com/global/all.js'\n\nexport function assetUrl(asset: Partial<Pick<CloudinaryAsset, 'url' | 'secure_url' | 'derived'>>) {\n if (asset.derived && asset.derived.length > 0) {\n const [derived] = asset.derived\n if (derived.secure_url) {\n return derived.secure_url\n }\n return derived.url\n }\n if (asset.secure_url) {\n return asset.secure_url\n }\n return asset.url\n}\n\nexport const openMediaSelector = (\n cloudName: string,\n apiKey: string,\n multiple: boolean,\n insertHandler: (params: InsertHandlerParams) => void,\n selectedAsset?: CloudinaryAsset\n) => {\n loadJS(widgetSrc, () => {\n const options: Record<string, any> = {\n cloud_name: cloudName,\n api_key: apiKey,\n insert_caption: 'Select',\n multiple,\n }\n\n if (selectedAsset) {\n options.asset = {\n public_id: selectedAsset.public_id,\n type: selectedAsset.type,\n resource_type: selectedAsset.resource_type,\n }\n }\n\n window.cloudinary.openMediaLibrary(options, {insertHandler})\n })\n}\n\nexport const createMediaLibrary = ({\n cloudName,\n apiKey,\n inlineContainer,\n libraryCreated,\n insertHandler,\n}: {\n cloudName: string\n apiKey: string\n inlineContainer: string\n libraryCreated: (library: CloudinaryMediaLibrary) => void\n insertHandler: (params: InsertHandlerParams) => void\n}) => {\n loadJS(widgetSrc, () => {\n const options: Record<string, any> = {\n cloud_name: cloudName,\n api_key: apiKey,\n insert_caption: 'Select',\n inline_container: inlineContainer,\n remove_header: true,\n }\n\n libraryCreated(window.cloudinary.createMediaLibrary(options, {insertHandler}))\n })\n}\n\nexport function loadJS(url: string, callback: () => void) {\n const existingScript = document.getElementById('damWidget')\n if (!existingScript) {\n const script = document.createElement('script')\n script.src = url\n script.id = 'damWidget'\n document.body.appendChild(script)\n script.onload = () => {\n if (callback) {\n return callback()\n }\n return true\n }\n }\n if (existingScript && callback) {\n return callback()\n }\n return true\n}\n\nexport function encodeSourceId(asset: CloudinaryAssetResponse): string {\n const {resource_type, public_id, type} = asset\n return btoa(JSON.stringify({public_id, resource_type, type})) // Sort keys alphabetically!\n}\n\nexport function encodeFilename(asset: CloudinaryAssetResponse) {\n return `${asset.public_id.split('/').slice(-1)[0]}.${asset.format}`\n}\n\nexport function decodeSourceId(sourceId: string): CloudinaryAssetResponse | undefined {\n let sourceIdDecoded: any\n try {\n sourceIdDecoded = JSON.parse(atob(sourceId))\n } catch (err) {\n // Do nothing\n }\n return sourceIdDecoded\n}\n","import React from 'react'\nimport VideoPlayer from './VideoPlayer'\nimport {assetUrl} from '../utils'\nimport {Flex} from '@sanity/ui'\nimport {CloudinaryAsset} from '../types'\n\ninterface ComponentProps {\n layout?: 'default' | 'block'\n value: CloudinaryAsset | undefined\n}\n\nconst AssetPreview = ({value, layout}: ComponentProps) => {\n const url = value && assetUrl(value)\n if (!value || !url) {\n return null\n }\n\n switch (value.resource_type) {\n case 'video':\n return (\n <Flex\n align=\"center\"\n style={{\n maxWidth: layout === 'default' ? '80px' : '100%',\n }}\n >\n <VideoPlayer src={url} kind=\"player\" />\n </Flex>\n )\n default:\n return (\n <Flex align=\"center\">\n <img\n alt=\"preview\"\n src={url}\n style={{\n maxWidth: layout === 'default' ? '80px' : '100%',\n height: 'auto',\n }}\n />\n </Flex>\n )\n }\n}\n\nexport default AssetPreview\n","import React, {useCallback} from 'react'\nimport {ObjectInputProps, PatchEvent, unset} from 'sanity'\nimport {Button, Flex, Grid, Stack} from '@sanity/ui'\nimport {PlugIcon} from '@sanity/icons'\nimport styled from 'styled-components'\nimport AssetPreview from './AssetPreview'\nimport {CloudinaryAsset} from '../types'\n\nconst SetupButtonContainer = styled.div`\n position: relative;\n display: block;\n font-size: 0.8em;\n transform: translate(0%, -10%);\n`\n\ntype WidgetInputProps = ObjectInputProps & {openMediaSelector: () => void; onSetup: () => void}\n\nconst WidgetInput = (props: WidgetInputProps) => {\n const {onChange, readOnly, value, openMediaSelector} = props\n\n const removeValue = useCallback(() => {\n onChange(PatchEvent.from([unset()]))\n }, [onChange])\n\n return (\n <Stack>\n <SetupButtonContainer>\n <Flex flex={1} justify=\"flex-end\">\n <Button\n color=\"primary\"\n icon={PlugIcon}\n mode=\"bleed\"\n title=\"Configure\"\n onClick={props.onSetup}\n tabIndex={1}\n />\n </Flex>\n </SetupButtonContainer>\n\n <Flex style={{textAlign: 'center', width: '100%'}} marginBottom={2}>\n <AssetPreview value={value as CloudinaryAsset} />\n </Flex>\n\n <Grid gap={1} style={{gridTemplateColumns: 'repeat(auto-fit, minmax(100px, 1fr))'}}>\n <Button\n disabled={readOnly}\n mode=\"ghost\"\n title=\"Select an asset\"\n tone=\"default\"\n onClick={openMediaSelector}\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\nexport default WidgetInput\n","import React from 'react'\nimport {SettingsView} from '@sanity/studio-secrets'\n\nexport type Secrets = {\n cloudName: string\n apiKey: string\n}\n\nconst pluginConfigKeys = [\n {\n key: 'cloudName',\n title: 'Cloud name',\n description: '',\n },\n {\n key: 'apiKey',\n title: 'API key',\n description: '',\n },\n]\n\nexport const namespace = 'cloudinary'\n\ntype Props = {\n onClose: () => void\n}\n\nconst SecretsConfigView = (props: Props) => {\n return (\n <SettingsView\n title=\"Cloudinary config\"\n namespace={namespace}\n keys={pluginConfigKeys}\n onClose={props.onClose}\n />\n )\n}\n\nexport default SecretsConfigView\n","import React, {useCallback, useState} from 'react'\nimport WidgetInput from './WidgetInput'\nimport {nanoid} from 'nanoid'\nimport {ObjectInputProps, PatchEvent, set} from 'sanity'\nimport {CloudinaryAsset} from '../types'\nimport {useSecrets} from '@sanity/studio-secrets'\nimport {InsertHandlerParams} from '../types'\nimport {openMediaSelector} from '../utils'\nimport SecretsConfigView, {namespace, Secrets} from './SecretsConfigView'\n\nconst CloudinaryInput = (props: ObjectInputProps) => {\n const [showSettings, setShowSettings] = useState(false)\n const {secrets} = useSecrets<Secrets>(namespace)\n const {onChange, schemaType: type} = props\n const value = (props.value as CloudinaryAsset) || undefined\n\n const handleSelect = useCallback(\n (payload: InsertHandlerParams) => {\n const [asset] = payload.assets\n if (!asset) {\n return\n }\n\n onChange(\n PatchEvent.from([\n set(\n Object.assign(\n {\n _type: type.name,\n _version: 1,\n ...(value?._key ? {_key: value._key} : {_key: nanoid()}),\n },\n asset\n )\n ),\n ])\n )\n },\n [onChange, type, value?._key]\n )\n\n const action = secrets\n ? () =>\n openMediaSelector(\n secrets.cloudName,\n secrets.apiKey,\n false, // single selection\n handleSelect,\n value\n )\n : () => setShowSettings(true)\n\n return (\n <>\n {showSettings && <SecretsConfigView onClose={() => setShowSettings(false)} />}\n <WidgetInput onSetup={() => setShowSettings(true)} openMediaSelector={action} {...props} />\n </>\n )\n}\n\nexport default CloudinaryInput\n","import React from 'react'\nimport {DiffFromTo} from 'sanity'\nimport VideoPlayer from './VideoPlayer'\nimport {assetUrl} from '../utils'\nimport {CloudinaryAsset} from '../types'\n\ntype Props = {\n value: CloudinaryAsset | undefined\n}\n\nconst CloudinaryDiffPreview = ({value}: Props) => {\n if (!value) {\n return null\n }\n\n const url = assetUrl(value)\n\n if (value.resource_type === 'video' && url) {\n return (\n <section\n style={{\n display: 'flex',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n }}\n >\n <VideoPlayer src={url} kind=\"diff\" />\n </section>\n )\n }\n\n return <img alt=\"preview\" src={url} style={{maxWidth: '100%', height: 'auto'}} />\n}\n\ntype DiffProps = {\n diff: any\n schemaType: any\n}\n\nconst AssetDiff = ({diff, schemaType}: DiffProps) => {\n return <DiffFromTo diff={diff} schemaType={schemaType} previewComponent={CloudinaryDiffPreview} />\n}\n\nexport default AssetDiff\n","/* eslint-disable */\nimport CloudinaryInput from '../components/CloudinaryInput'\nimport AssetDiff from '../components/AssetDiff'\nimport AssetPreview from '../components/AssetPreview'\nimport {defineType} from 'sanity'\n\nexport const cloudinaryAssetSchema = defineType({\n type: 'object',\n name: 'cloudinary.asset',\n fields: [\n {\n type: 'string',\n name: 'public_id',\n },\n {\n type: 'string',\n name: 'resource_type',\n // \"image\", \"?\"\n },\n {\n type: 'string',\n name: 'type',\n // \"upload\", \"?\"\n },\n {\n type: 'string',\n name: 'format',\n // \"jpg\"\n },\n {\n type: 'number',\n name: 'version',\n },\n {\n type: 'url',\n name: 'url',\n },\n {\n type: 'url',\n name: 'secure_url',\n },\n {\n type: 'number',\n name: 'width',\n },\n {\n type: 'number',\n name: 'height',\n },\n {\n type: 'number',\n name: 'bytes',\n },\n {\n type: 'number',\n name: 'duration',\n // can be null\n },\n {\n type: 'array',\n name: 'tags',\n of: [{type: 'string'}],\n },\n {\n type: 'datetime',\n name: 'created_at',\n },\n {\n type: 'array',\n name: 'derived',\n of: [{type: 'cloudinary.assetDerived'}],\n },\n {\n type: 'string',\n name: 'access_mode',\n },\n {\n type: 'cloudinary.assetContext',\n name: 'context',\n },\n // metadata array of unknown content\n ],\n ...({\n components: {\n input: CloudinaryInput,\n diff: AssetDiff,\n preview: AssetPreview,\n },\n } as {}), //TODO revert this change when rc.1 is released\n preview: {\n select: {\n url: 'url',\n resource_type: 'resource_type',\n derived: 'derived.0.url',\n },\n prepare({url, derived, resource_type}) {\n return {\n title: url,\n value: {\n title: url,\n resource_type,\n url: derived || url,\n },\n }\n },\n },\n})\n","import {defineType} from 'sanity'\n\nexport type CloudinaryAssetDerived = {\n raw_transformation: string\n url: string\n secure_url: string\n}\n\nexport const cloudinaryAssetDerivedSchema = defineType({\n type: 'object',\n name: 'cloudinary.assetDerived',\n fields: [\n {\n type: 'string',\n name: 'raw_transformation',\n },\n {\n type: 'url',\n name: 'url',\n },\n {\n type: 'url',\n name: 'secure_url',\n },\n ],\n})\n","import React from 'react'\n\nexport function CloudinaryIcon() {\n return (\n <svg\n version=\"1.1\"\n id=\"Layer_1\"\n x=\"0px\"\n y=\"0px\"\n width=\"1em\"\n height=\"1em\"\n viewBox=\"0 0 141.732 141.747\"\n enableBackground=\"new 0 0 141.732 141.747\"\n >\n <g>\n <path\n fill=\"#0071CE\"\n d=\"M115.585,109.242c-1.609,0-3.107-1.024-3.635-2.637c-0.657-2.008,0.438-4.169,2.447-4.826\n c7.278-2.382,11.98-8.761,11.98-16.252c0-9.487-7.718-17.206-17.205-17.206c-0.659,0-1.368,0.052-2.231,0.164l-3.741,0.485\n l-0.537-3.735c-2.299-16.016-16.251-28.094-32.454-28.094c-13.395,0-25.32,8.019-30.377,20.43l-0.952,2.335l-2.52,0.046\n c-11.581,0.213-21.003,9.804-21.003,21.379c0,8.45,4.906,16.156,12.498,19.631c1.921,0.88,2.766,3.15,1.886,5.071\n c-0.88,1.921-3.149,2.764-5.07,1.887C14.363,103.202,7.703,92.766,7.703,81.331c0-14.88,11.465-27.345,26.028-28.876\n c6.71-14.03,20.773-22.965,36.477-22.965c18.796,0,35.135,13.178,39.372,31.184c13.519,0.219,24.45,11.284,24.45,24.854\n c0,10.693-6.934,20.146-17.253,23.523C116.382,109.18,115.98,109.242,115.585,109.242z\"\n />\n <path\n fill=\"#DC8327\"\n d=\"M57.12,111.02c-0.001-0.001-0.001-0.001-0.002-0.001c-0.001,0-0.002-0.001-0.003-0.001h-0.001\n c0,0-0.001-0.001-0.001-0.001l-0.001-0.001c0,0-0.001,0-0.001-0.001h-0.001l-0.001-0.001c0.001-0.001-0.001-0.001-0.001-0.001\n l-0.001-0.001c0,0-0.001,0-0.001,0l-0.001-0.001c0.001,0.001-0.001-0.001-0.001-0.001s-0.002-0.001-0.003-0.001l-0.001-0.001H57.1\n c-0.001-0.001-0.001-0.001-0.001-0.001l-0.001-0.001c-0.003-0.001-0.002-0.001-0.003-0.001c-0.001,0.001-0.001-0.001-0.002-0.001\n l-0.001-0.001c0,0-0.001-0.001-0.002-0.001l-0.001-0.001c-0.001-0.001-0.003-0.001-0.004-0.001s-0.003-0.001-0.004-0.001\n c-0.001-0.001-0.001-0.001-0.002-0.001h-0.001c-0.001-0.001-0.002-0.001-0.003-0.001c-0.001-0.001-0.003-0.001-0.003-0.001\n c-0.001,0-0.001,0-0.001,0l-0.002-0.001c-0.001,0-0.001-0.001-0.001-0.001h-0.001c-0.059-0.021-0.122-0.034-0.188-0.037h-0.002\n h-0.002c-0.001,0-0.001,0-0.002,0c0,0,0,0-0.001,0c0,0-0.001,0-0.001,0h-0.001c-0.001-0.001-0.001-0.001-0.001-0.001\n c-0.001,0-0.002,0-0.002,0c-0.001,0-0.002,0-0.002,0h-0.001h-0.001h-0.001c-0.001,0-0.002,0-0.002,0h-0.001H56.86h-0.001h-0.001\n c-0.001,0-0.001,0-0.001,0h-0.001h-0.001h-0.001h-0.001c-0.001,0-0.001,0-0.001,0c-1.656,0-3.011-1.348-3.021-3V74.29h2.567\n c0.004,0,0.009,0,0.013,0c0.393,0.017,0.661-0.285,0.661-0.648c0-0.271-0.166-0.503-0.402-0.6l-12.379-8.544\n c-0.222-0.153-0.515-0.153-0.737,0l-12.476,8.611c-0.234,0.161-0.335,0.456-0.251,0.727c0.085,0.271,0.335,0.455,0.619,0.455h2.58\n l0.002,33.674c0.013,2.328,1.883,4.228,4.262,4.288c0.027,0.003,0.053,0.005,0.08,0.005h18.481c0.004,0,0.007,0,0.011,0\n c0.17-0.003,0.324-0.071,0.438-0.18c0,0,0,0,0.001-0.001c0.002-0.002,0.004-0.004,0.005-0.005c0.001-0.001,0.002-0.001,0.003-0.003\n c0,0,0.001-0.001,0.001-0.001l0.001-0.001l0.001-0.001l0.001-0.001l0.001-0.001c0.001-0.001,0.001-0.001,0.001-0.001\n c0.002-0.001,0.001-0.001,0.002-0.002c0,0,0,0,0.001-0.001l0.001-0.001c0,0,0,0,0.001-0.001c0.112-0.116,0.182-0.273,0.183-0.447\n v-0.002v-0.001v-0.001v-0.001v-0.001v-0.001v-0.001v-0.002C57.498,111.345,57.343,111.121,57.12,111.02z\"\n />\n <path\n fill=\"#F4B21B\"\n d=\"M83.889,111.02c0,0-0.001-0.001-0.002-0.001c-0.001,0-0.002-0.001-0.003-0.001h-0.001\n c-0.001-0.001-0.001-0.001-0.001-0.001l-0.001-0.001h-0.001c0,0-0.001-0.001-0.001-0.001c0,0-0.001-0.001-0.001-0.001\n c0.001-0.001-0.001-0.001-0.002-0.001l-0.001-0.001h-0.001c-0.001,0-0.001-0.001-0.001-0.001c-0.002,0.001-0.002-0.001-0.002-0.001\n l-0.002-0.001l-0.001-0.001h-0.001c0,0-0.001-0.001-0.001-0.001l-0.001-0.001c-0.001-0.001-0.002-0.001-0.002-0.001\n c-0.001,0.001-0.001-0.001-0.003-0.001l-0.001-0.001l-0.001-0.001c0,0-0.001,0-0.002-0.001c-0.001-0.001-0.003-0.001-0.004-0.001\n s-0.003-0.001-0.004-0.001c-0.001-0.001-0.001-0.001-0.002-0.001c-0.001,0-0.001,0-0.002-0.001c0,0-0.001,0-0.002-0.001\n c-0.003-0.001-0.001-0.001-0.002-0.001c-0.003,0-0.001,0-0.002-0.001c0,0-0.001-0.001-0.002-0.001l-0.001-0.001h-0.001\n c-0.059-0.021-0.122-0.034-0.188-0.037h-0.002c-0.001,0-0.001,0-0.001,0c-0.001,0-0.002,0-0.002,0s-0.001,0-0.001,0h-0.001h-0.001\n l-0.001-0.001c-0.001,0-0.002,0-0.002,0c-0.001,0-0.002,0-0.002,0h-0.001c-0.001,0-0.001,0-0.001,0h-0.001\n c-0.001,0-0.002,0-0.002,0s-0.001,0-0.002,0h-0.001c0,0-0.001,0-0.001,0h-0.001c-0.001,0-0.001,0-0.001,0h-0.001h-0.001h-0.001\n h-0.001c-0.001,0-0.001,0-0.001,0c-1.655,0-3.01-1.348-3.02-3V81.829h2.579c0.009-0.001,0.016-0.001,0.026,0\n c0.358,0,0.648-0.29,0.648-0.648c0-0.271-0.166-0.503-0.402-0.6l-12.38-8.544c-0.222-0.153-0.515-0.153-0.737,0L57.86,80.647\n c-0.234,0.161-0.335,0.456-0.251,0.727c0.085,0.271,0.335,0.455,0.619,0.455h2.568l0.002,26.135\n c0.011,2.329,1.884,4.23,4.264,4.289c0.026,0.003,0.052,0.004,0.078,0.004h18.481c0.004,0,0.007,0,0.011,0\n c0.17-0.003,0.324-0.071,0.438-0.18c0,0,0,0,0.001-0.001c0.002-0.002,0.006-0.004,0.005-0.005c0.001-0.001,0.002-0.001,0.003-0.003\n c0.001-0.001,0.001-0.001,0.001-0.001l0.001-0.001l0.001-0.001c0,0,0.001,0,0.001-0.001l0.001-0.001\n c0.001,0,0.001-0.001,0.001-0.001c0.003-0.001,0.002-0.001,0.002-0.002c0,0,0,0,0.001-0.001c0,0,0,0,0.001-0.001\n c0,0,0,0,0.001-0.001c0.112-0.116,0.182-0.273,0.183-0.447v-0.002v-0.001v-0.001v-0.001v-0.001v-0.001v-0.001v-0.002\n C84.267,111.345,84.112,111.121,83.889,111.02z\"\n />\n <path\n fill=\"#F2D864\"\n d=\"M110.667,111.02l-0.002-0.001c-0.001,0-0.002-0.001-0.003-0.001h-0.001\n c-0.001-0.001-0.001-0.001-0.001-0.001l-0.001-0.001c-0.001,0-0.001,0-0.001-0.001h-0.001l-0.001-0.001\n c-0.001-0.001-0.001-0.001-0.001-0.001s-0.001,0-0.001-0.001h-0.001c0,0-0.001-0.001-0.001-0.001\n c-0.001,0.001-0.001-0.001-0.002-0.001c0.001-0.001-0.001-0.001-0.002-0.001l-0.001-0.001c-0.001,0-0.001,0-0.001,0\n c-0.001-0.001-0.001-0.001-0.001-0.001l-0.001-0.001c-0.003-0.001-0.002-0.001-0.002-0.001c-0.001,0.001-0.001-0.001-0.003-0.001\n l-0.001-0.001c0.001-0.001-0.001-0.001-0.002-0.001c0,0-0.001,0-0.001-0.001c-0.001-0.001-0.003-0.001-0.004-0.001\n s-0.003-0.001-0.004-0.001l-0.002-0.001c0,0-0.001,0-0.002-0.001l-0.002-0.001c-0.003-0.001-0.003-0.001-0.002-0.001\n c-0.003,0-0.003,0-0.002-0.001c-0.001,0-0.001-0.001-0.001-0.001c-0.001,0-0.002-0.001-0.002-0.001h-0.001\n c-0.059-0.021-0.122-0.034-0.188-0.037h-0.001c-0.001,0-0.002,0-0.002,0c-0.001,0-0.002,0-0.003,0h-0.001h-0.001h-0.001\n c-0.001-0.001-0.001-0.001-0.002-0.001c0,0-0.001,0-0.002,0c0,0-0.001,0-0.002,0h-0.001c0,0-0.001,0-0.001,0h-0.001\n c-0.001,0-0.002,0-0.002,0h-0.002c0,0,0,0-0.001,0c0,0-0.001,0-0.001,0h-0.001c0,0-0.001,0-0.001,0h-0.001h-0.001h-0.001H110.4\n c0,0-0.001,0-0.001,0c-1.655,0-3.01-1.348-3.02-3V89.365h2.573c0.004,0,0.009,0,0.013,0c0.365-0.009,0.661-0.285,0.661-0.648\n c0-0.271-0.166-0.503-0.402-0.6l-12.38-8.544c-0.221-0.153-0.515-0.153-0.737,0l-12.476,8.61c-0.234,0.161-0.335,0.456-0.251,0.727\n c0.085,0.271,0.335,0.455,0.619,0.455h2.573l0.002,18.599c0.013,2.329,1.885,4.231,4.264,4.289\n c0.026,0.003,0.052,0.004,0.078,0.004h18.481c0.004,0,0.007,0,0.011,0c0.17-0.003,0.324-0.071,0.438-0.18l0.001-0.001\n c0.002-0.002,0.005-0.004,0.005-0.005c0.001-0.001,0.002-0.001,0.003-0.003c0,0,0.001-0.001,0.001-0.001l0.001-0.001l0.001-0.001\n l0.001-0.001l0.001-0.001l0.001-0.001c0.003-0.001,0.001-0.001,0.002-0.002c0,0,0,0,0.001-0.001l0.001-0.001c0,0,0,0,0.001-0.001\n c0.112-0.116,0.182-0.273,0.183-0.447v-0.002v-0.001v-0.001v-0.001v-0.001v-0.001v-0.001v-0.002\n C111.045,111.345,110.889,111.121,110.667,111.02z\"\n />\n </g>\n </svg>\n )\n}\n","/* eslint-disable camelcase */\nimport React, {useCallback, useEffect, useRef, useState} from 'react'\nimport {Box, Button, Dialog, Flex, Spinner, Stack, Text} from '@sanity/ui'\nimport {CloudinaryMediaLibrary, InsertHandlerParams} from '../../types'\nimport {createMediaLibrary, decodeSourceId, encodeFilename, encodeSourceId} from '../../utils'\nimport styled from 'styled-components'\nimport {useSecrets} from '@sanity/studio-secrets'\nimport SecretsConfigView, {namespace, Secrets} from '../SecretsConfigView'\nimport {AssetSourceComponentProps, ImageAsset} from 'sanity'\nimport {PlugIcon} from '@sanity/icons'\n\nexport const Widget = styled.div`\n height: 70vh;\n`\n\nexport function CloudinaryAssetSource(props: AssetSourceComponentProps) {\n const {onClose} = props\n\n const [loadingMessage, setLoadingMessage] = useState<string | undefined>(\n 'Loading Cloudinary Media Libary'\n )\n const library = useRef<CloudinaryMediaLibrary | undefined>()\n const contentRef = useRef<HTMLDivElement | null>(null)\n const {secrets} = useSecrets<Secrets>(namespace)\n const cloudName = secrets?.cloudName\n const apiKey = secrets?.apiKey\n const [widgetId] = useState(() => `cloundinaryWidget-${Date.now()}`)\n const [showSettings, setShowSettings] = useState(false)\n\n const propsRef = useRef(props)\n\n useEffect(() => {\n // because we have to access props after loading js in a callback,\n // we cannot pass props as dependecnies as that will cause infinite updates\n // this takes a snapshot of props, so we can access them later\n propsRef.current = props\n }, [props])\n\n const handleClose = useCallback(() => {\n if (library.current) {\n library.current.hide()\n }\n onClose()\n }, [onClose, library])\n\n useEffect(() => {\n if (!cloudName || !apiKey) {\n return\n }\n\n createMediaLibrary({\n cloudName,\n apiKey,\n inlineContainer: `#${widgetId}`,\n libraryCreated: (lib: CloudinaryMediaLibrary) => {\n library.current = lib\n const selectedAssets = propsRef.current.selectedAssets\n const firstSelectedAsset = selectedAssets ? selectedAssets[0] : null\n\n // eslint-disable-next-line no-undef\n const iframe: ChildNode | null | undefined =\n contentRef.current && contentRef.current.firstChild\n if (iframe && iframe instanceof HTMLIFrameElement) {\n setLoadingMessage(undefined)\n let asset\n if (\n propsRef.current.selectionType === 'single' &&\n firstSelectedAsset &&\n firstSelectedAsset.source &&\n firstSelectedAsset.source.id\n ) {\n asset = decodeSourceId(firstSelectedAsset.source.id)\n }\n const folder = asset\n ? {\n path: asset.public_id.split('/').slice(0, -1).join('/'),\n resource_type: 'image',\n }\n : {path: '', resource_type: 'image'}\n if (lib && contentRef.current) {\n lib.show({folder, asset})\n contentRef.current.style.visibility = 'visible'\n }\n }\n },\n insertHandler: ({assets}: InsertHandlerParams) => {\n if (!library.current) {\n return\n }\n const imageAssets = assets.filter((asset) => asset.resource_type === 'image')\n if (imageAssets.length === 0) {\n throw new Error('The selection did not contain any images.')\n }\n library.current.hide()\n propsRef.current.onSelect(\n imageAssets.map((asset) => {\n const url =\n asset.derived && asset.derived[0] ? asset.derived[0].secure_url : asset.secure_url\n return {\n kind: 'url',\n value: url,\n assetDocumentProps: {\n _type: 'sanity.imageAsset',\n originalFilename: encodeFilename(asset),\n source: {\n id: encodeSourceId(asset),\n name: `cloudinary:${cloudName}`,\n },\n } as ImageAsset,\n }\n })\n )\n },\n })\n }, [cloudName, apiKey, widgetId])\n\n const hasConfig = apiKey && cloudName\n return (\n <Dialog\n id=\"cloudinary-asset-source\"\n header=\"Select image from Cloudinary\"\n onClose={handleClose}\n open\n width={4}\n >\n <Box padding={4}>\n {showSettings && <SecretsConfigView onClose={() => setShowSettings(false)} />}\n <Flex flex={1} justify=\"flex-end\">\n <Button\n color=\"primary\"\n icon={PlugIcon}\n mode=\"bleed\"\n title=\"Configure\"\n onClick={() => setShowSettings(true)}\n tabIndex={1}\n text={hasConfig ? undefined : 'Configure Cloudinary plugin'}\n />\n </Flex>\n\n {hasConfig && loadingMessage && (\n <Stack space={3}>\n <Flex align=\"center\" justify=\"center\">\n <Spinner muted />\n </Flex>\n <Text size={1} muted align=\"center\">\n {loadingMessage}\n </Text>\n </Stack>\n )}\n\n <Widget style={{visibility: 'hidden'}} ref={contentRef} id={widgetId} />\n </Box>\n </Dialog>\n )\n}\n","import {defineType} from 'sanity'\n\nexport interface CloudinaryAssetContext {\n custom: object\n}\n\nexport const cloudinaryAssetContext = defineType({\n type: 'object',\n name: 'cloudinary.assetContext',\n fields: [\n {\n type: 'cloudinary.assetContextCustom',\n name: 'custom',\n },\n ],\n})\n","import {defineType} from 'sanity'\n\nexport type CloudinaryAssetContextCustom = {\n alt: string\n caption: string\n}\n\nexport const cloudinaryAssetContextCustom = defineType({\n type: 'object',\n name: 'cloudinary.assetContextCustom',\n fields: [\n {\n type: 'string',\n name: 'alt',\n },\n {\n type: 'string',\n name: 'caption',\n },\n ],\n})\n","import React, {useCallback} from 'react'\nimport {Box, Button, Flex} from '@sanity/ui'\nimport {\n ArrayInputFunctionsProps,\n ArrayOfObjectsFunctions,\n ArraySchemaType,\n insert,\n ObjectSchemaType,\n PatchEvent,\n setIfMissing,\n} from 'sanity'\n\nimport {useSecrets} from '@sanity/studio-secrets'\nimport SecretsConfigView, {namespace} from './SecretsConfigView'\nimport {cloudinaryAssetSchema} from '../schema/cloudinaryAsset'\nimport {openMediaSelector} from '../utils'\nimport {InsertHandlerParams} from '../types'\nimport {PlugIcon} from '@sanity/icons'\n\ninterface ApiConfig {\n cloudName: string\n apiKey: string\n}\n\nexport const AssetListFunctions = (\n props: ArrayInputFunctionsProps<{_key: string}, ArraySchemaType>\n) => {\n const {onValueCreate, onChange} = props\n\n const {secrets, loading} = useSecrets<ApiConfig>(namespace)\n const [showSettings, setShowSettings] = React.useState(false)\n\n const show = useCallback(() => setShowSettings(true), [setShowSettings])\n const hide = useCallback(() => setShowSettings(false), [setShowSettings])\n\n const cloudinaryType = props.schemaType.of.find(\n (t: {name: string}) => t.name === cloudinaryAssetSchema.name\n ) as ObjectSchemaType | undefined\n\n if (!cloudinaryType) {\n throw new Error(`AssetListFunctions can only be used in array.of ${\n cloudinaryAssetSchema.name\n }, but it was array.of\n ${props.schemaType.of.map((t) => t.name)}`)\n }\n\n const handleSelect = useCallback(\n (selected: InsertHandlerParams) => {\n const items = selected.assets.map((asset) =>\n Object.assign(\n {},\n asset,\n {\n // Schema version. In case we ever change our schema.\n _version: 1,\n },\n onValueCreate(cloudinaryType as any) // onValueCreate is mistyped\n )\n )\n onChange(PatchEvent.from([setIfMissing([]), insert(items, 'after', [-1])]))\n },\n [onValueCreate, onChange, cloudinaryType]\n )\n\n const handleOpenSelector = useCallback(\n () =>\n secrets &&\n openMediaSelector(\n secrets.cloudName,\n secrets.apiKey,\n true, // multi-selection\n handleSelect\n ),\n [secrets, handleSelect]\n )\n return (\n <Flex gap={2} flex={1}>\n {showSettings && <SecretsConfigView onClose={hide} />}\n <Box flex={1}>\n <ArrayOfObjectsFunctions {...props} />\n </Box>\n {cloudinaryType && (\n <>\n <Box flex={1}>\n <Button\n style={{width: '100%'}}\n disabled={props.readOnly || loading}\n mode=\"bleed\"\n text=\"Add multiple\"\n onClick={handleOpenSelector}\n />\n </Box>\n <Box>\n <Button onClick={show} icon={PlugIcon} mode=\"bleed\" title={'Configure'} />\n </Box>\n </>\n )}\n </Flex>\n )\n}\n","import {cloudinaryAssetSchema} from './schema/cloudinaryAsset'\nimport {cloudinaryAssetDerivedSchema} from './schema/cloudinaryAssetDerived'\nimport {\n definePlugin,\n AssetSource,\n ArrayOfObjectsInputProps,\n isArrayOfObjectsSchemaType,\n} from 'sanity'\nimport {CloudinaryIcon} from './components/asset-source/Icon'\nimport {CloudinaryAssetSource} from './components/asset-source/CloudinaryAssetSource'\nimport {cloudinaryAssetContext} from './schema/cloudinaryAssetContext'\nimport {cloudinaryAssetContextCustom} from './schema/cloudinaryAssetContextCustom'\nimport {AssetListFunctions} from './components/AssetListFunctions'\n\nexport {type CloudinaryAssetContext} from './schema/cloudinaryAssetContext'\nexport {type CloudinaryAssetDerived} from './schema/cloudinaryAssetDerived'\nexport {type CloudinaryAssetContextCustom} from './schema/cloudinaryAssetContextCustom'\n\nexport type {AssetDocument, CloudinaryAsset} from './types'\n\nexport {\n cloudinaryAssetSchema,\n cloudinaryAssetDerivedSchema,\n cloudinaryAssetContext,\n cloudinaryAssetContextCustom,\n}\n\nexport const cloudinarySchemaPlugin = definePlugin({\n name: 'cloudinary-schema',\n form: {\n components: {\n input: (props) => {\n const {schemaType} = props\n if (isArrayOfObjectsSchemaType(schemaType)) {\n const arrayProps = props as ArrayOfObjectsInputProps\n const cloudinaryType = arrayProps.schemaType.of.find(\n (t: {name: string}) => t.name === cloudinaryAssetSchema.name\n )\n if (cloudinaryType) {\n return arrayProps.renderDefault({...arrayProps, arrayFunctions: AssetListFunctions})\n }\n }\n return props.renderDefault(props)\n },\n },\n },\n schema: {\n types: [\n cloudinaryAssetSchema,\n cloudinaryAssetDerivedSchema,\n cloudinaryAssetContext,\n cloudinaryAssetContextCustom,\n ],\n },\n})\n\nexport const cloudinaryImageSource: AssetSource = {\n name: 'cloudinary-image',\n title: 'Cloudinary',\n icon: CloudinaryIcon,\n component: CloudinaryAssetSource,\n}\n\nexport const cloudinaryAssetSourcePlugin = definePlugin({\n name: 'cloudinart-asset-source',\n form: {\n image: {\n assetSources: [cloudinaryImageSource],\n },\n },\n})\n"],"names":["VideoPlayer","props","src","style","width","height","jsx","controls","children","type","widgetSrc","assetUrl","asset","derived","length","secure_url","url","openMediaSelector","cloudName","apiKey","multiple","insertHandler","selectedAsset","loadJS","options","cloud_name","api_key","insert_caption","public_id","resource_type","window","cloudinary","openMediaLibrary","createMediaLibrary","inlineContainer","libraryCreated","inline_container","remove_header","callback","existingScript","document","getElementById","script","createElement","id","body","appendChild","onload","encodeSourceId","btoa","JSON","stringify","encodeFilename","split","slice","format","decodeSourceId","sourceId","sourceIdDecoded","parse","atob","err","AssetPreview","value","layout","Flex","align","maxWidth","kind","alt","SetupButtonContainer","styled","div","WidgetInput","onChange","readOnly","removeValue","useCallback","PatchEvent","from","unset","Stack","flex","justify","Button","color","icon","PlugIcon","mode","title","onClick","onSetup","tabIndex","textAlign","marginBottom","jsxs","Grid","gap","gridTemplateColumns","disabled","tone","text","pluginConfigKeys","key","description","namespace","SecretsConfigView","SettingsView","keys","onClose","CloudinaryInput","showSettings","setShowSettings","useState","secrets","useSecrets","schemaType","handleSelect","payload","assets","set","Object","assign","_type","name","_version","_key","nanoid","action","Fragment","CloudinaryDiffPreview","display","flexWrap","justifyContent","AssetDiff","diff","DiffFromTo","previewComponent","cloudinaryAssetSchema","defineType","fields","of","components","input","preview","select","prepare","cloudinaryAssetDerivedSchema","CloudinaryIcon","version","x","y","viewBox","enableBackground","fill","d","Widget","CloudinaryAssetSource","loadingMessage","setLoadingMessage","library","useRef","contentRef","widgetId","Date","now","propsRef","useEffect","current","handleClose","hide","lib","selectedAssets","firstSelectedAsset","iframe","firstChild","HTMLIFrameElement","selectionType","source","folder","path","join","show","visibility","imageAssets","filter","Error","onSelect","map","assetDocumentProps","originalFilename","hasConfig","Dialog","header","open","Box","padding","space","Spinner","muted","Text","size","ref","cloudinaryAssetContext","cloudinaryAssetContextCustom","AssetListFunctions","onValueCreate","loading","React","cloudinaryType","find","t","selected","items","setIfMissing","insert","handleOpenSelector","ArrayOfObjectsFunctions","cloudinarySchemaPlugin","definePlugin","form","isArrayOfObjectsSchemaType","arrayProps","renderDefault","arrayFunctions","schema","types","cloudinaryImageSource","component","cloudinaryAssetSourcePlugin","image","assetSources"],"mappings":";;;;;;;;;;AAUA,SAAwBA,YAAYC,KAAyB,EAAA;EACrD,MAAA;IAACC;EAAO,CAAA,GAAAD,KAAA;EAEd,MAAME,KAAuB,GAAA;IAC3BC,KAAO,EAAA,MAAA;IACPC,MAAQ,EAAA;EAAA,CACV;EAGE,OAAA,eAAAC,GAAA,CAAC,OAAM,EAAA;IAAAC,QAAA,EAAQ,IAAC;IAAAJ,KAAA;IACdK,6BAAC,QAAO,EAAA;MAAAN,GAAA;MAAUO,IAAK,EAAA;IAAY,CAAA;EACrC,CAAA,CAAA;AAEJ;ACfA,MAAMC,SAAY,GAAA,oDAAA;AAEX,SAASC,SAASC,KAAyE,EAAA;EAChG,IAAIA,KAAM,CAAAC,OAAA,IAAWD,KAAM,CAAAC,OAAA,CAAQC,SAAS,CAAG,EAAA;IACvC,MAAA,CAACD,OAAO,CAAA,GAAID,KAAM,CAAAC,OAAA;IACxB,IAAIA,QAAQE,UAAY,EAAA;MACtB,OAAOF,OAAQ,CAAAE,UAAA;IACjB;IACA,OAAOF,OAAQ,CAA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