sanity-plugin-shopify-assets 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +21 -21
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +140 -2054
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +171 -2085
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
- package/src/components/AssetDiff.tsx +2 -1
- package/src/components/AssetPreview.tsx +11 -18
- package/src/components/DialogHeader.tsx +1 -2
- package/src/components/File.styled.tsx +10 -16
- package/src/components/File.tsx +7 -9
- package/src/components/ShopifyAssetInput.styled.tsx +1 -1
- package/src/components/ShopifyAssetInput.tsx +2 -2
- package/src/components/ShopifyAssetPicker.tsx +5 -5
- package/src/components/VideoPlayer.tsx +2 -2
- package/src/index.ts +5 -3
- package/src/sanity-ui.d.ts +6 -0
- package/src/schema/shopifyAssetMetadataSchema.ts +34 -0
- package/src/schema/shopifyAssetPreviewSchema.ts +24 -0
- package/src/schema/shopifyAssetSchema.ts +8 -38
- package/src/types.ts +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -14,45 +14,45 @@ npm install sanity-plugin-shopify-assets
|
|
|
14
14
|
|
|
15
15
|
Add it as a plugin in sanity.config.ts (or .js):
|
|
16
16
|
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
```ts
|
|
18
|
+
import {defineConfig} from 'sanity'
|
|
19
|
+
import {shopifyAssets} from 'sanity-plugin-shopify-assets'
|
|
20
|
+
|
|
21
|
+
export const defineConfig({
|
|
22
|
+
//...
|
|
23
|
+
plugins: [
|
|
24
|
+
shopifyAssets({
|
|
25
|
+
shopifyDomain: '*.myshopify.com'
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Simply update the `shopifyDomain` to your store URL. You'll need to install the [Sanity Connect](https://www.sanity.io/docs/sanity-connect-for-shopify) app on your store to handle authorisation. You'll need to ensure the Liquid sync option is enabled within the Sanity Connect app.
|
|
32
32
|
|
|
33
33
|
Then you can enable the asset selector on a field:
|
|
34
34
|
|
|
35
|
-
```
|
|
35
|
+
```ts
|
|
36
36
|
import {defineType, defineField} from 'sanity'
|
|
37
37
|
|
|
38
38
|
export const myDocumentSchema = defineType({
|
|
39
|
-
type:
|
|
40
|
-
name:
|
|
39
|
+
type: 'document',
|
|
40
|
+
name: 'article',
|
|
41
41
|
fields: [
|
|
42
42
|
defineField({
|
|
43
|
-
type:
|
|
44
|
-
name:
|
|
43
|
+
type: 'shopify.asset',
|
|
44
|
+
name: 'shopifyAsset',
|
|
45
45
|
}),
|
|
46
|
-
]
|
|
46
|
+
],
|
|
47
47
|
})
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
It's also possible to define the Shopify domain on the field level, which allows you to retrieve assets from different stores. Each store must be connected to your Sanity project via the Sanity Connect app. In order to do this, simply declare the `shopifyDomain` on the field:
|
|
51
51
|
|
|
52
|
-
```
|
|
52
|
+
```ts
|
|
53
53
|
defineField({
|
|
54
|
-
type:
|
|
55
|
-
name:
|
|
54
|
+
type: 'shopify.asset',
|
|
55
|
+
name: 'shopifyAsset',
|
|
56
56
|
options: {
|
|
57
57
|
shopifyDomain: '*.myshopify.com'
|
|
58
58
|
}
|
package/dist/index.d.ts
CHANGED