@sanity/cli 3.36.4 → 3.36.5-canary.34
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/lib/_chunks-cjs/cli.js +1779 -1317
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/_chunks-cjs/journeyConfig.js +11 -11
- package/lib/_chunks-cjs/journeyConfig.js.map +1 -1
- package/lib/_chunks-cjs/loadEnv.js +105 -2719
- package/lib/_chunks-cjs/loadEnv.js.map +1 -1
- package/lib/cli.d.ts +10 -0
- package/lib/index.d.ts +448 -0
- package/lib/index.esm.js +449 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +452 -0
- package/lib/index.mjs.map +1 -0
- package/lib/run.d.ts +1 -0
- package/lib/workers/getAndWriteJourneySchema.d.ts +1 -0
- package/lib/workers/getCliConfig.d.ts +1 -0
- package/lib/workers/typegenGenerate.d.ts +37 -0
- package/lib/workers/typegenGenerate.js +6 -2
- package/lib/workers/typegenGenerate.js.map +1 -1
- package/package.json +18 -21
- package/src/actions/init-project/templates/shopify.ts +7 -0
- package/src/util/journeyConfig.ts +5 -5
- package/templates/ecommerce/plugins/barcode-input/BarcodeInput.js +1 -1
- package/templates/get-started/plugins/sanity-plugin-tutorial/GetStartedTutorial.tsx +1 -1
- package/templates/shared/tsconfig.json +2 -4
- package/templates/shopify/README.md +3 -3
- package/templates/shopify/components/hotspots/ProductTooltip.tsx +1 -1
- package/templates/shopify/components/icons/Shopify.tsx +1 -1
- package/templates/shopify/components/inputs/CollectionHidden.tsx +1 -1
- package/templates/shopify/components/media/ColorTheme.tsx +1 -1
- package/templates/shopify/components/studio/Navbar.tsx +29 -0
- package/templates/shopify/constants.ts +31 -1
- package/templates/shopify/docs/features.md +6 -7
- package/templates/shopify/schemaTypes/documents/collection.tsx +11 -47
- package/templates/shopify/schemaTypes/documents/colorTheme.tsx +2 -17
- package/templates/shopify/schemaTypes/documents/page.ts +10 -37
- package/templates/shopify/schemaTypes/documents/product.tsx +4 -27
- package/templates/shopify/schemaTypes/documents/productVariant.tsx +4 -13
- package/templates/shopify/schemaTypes/index.ts +97 -126
- package/templates/shopify/schemaTypes/objects/collection/{group.ts → collectionGroupType.ts} +7 -10
- package/templates/shopify/schemaTypes/objects/collection/{links.ts → collectionLinksType.ts} +4 -4
- package/templates/shopify/schemaTypes/objects/customProductOption/{colorObject.tsx → customProductOptionColorObjectType.tsx} +3 -6
- package/templates/shopify/schemaTypes/objects/customProductOption/{color.tsx → customProductOptionColorType.tsx} +2 -10
- package/templates/shopify/schemaTypes/objects/customProductOption/{sizeObject.ts → customProductOptionSizeObjectType.ts} +3 -7
- package/templates/shopify/schemaTypes/objects/customProductOption/{size.ts → customProductOptionSizeType.ts} +3 -12
- package/templates/shopify/schemaTypes/objects/global/footerType.ts +22 -0
- package/templates/shopify/schemaTypes/objects/global/menuLinksType.ts +21 -0
- package/templates/shopify/schemaTypes/objects/global/{menu.ts → menuType.ts} +2 -4
- package/templates/shopify/schemaTypes/objects/global/{notFoundPage.ts → notFoundPageType.ts} +1 -6
- package/templates/shopify/schemaTypes/objects/hotspot/{imageWithProductHotspots.ts → imageWithProductHotspotsType.ts} +4 -6
- package/templates/shopify/schemaTypes/objects/hotspot/{productHotspots.tsx → productHotspotsType.tsx} +3 -5
- package/templates/shopify/schemaTypes/objects/hotspot/{spot.tsx → spotType.tsx} +1 -3
- package/templates/shopify/schemaTypes/{annotations/linkEmail.tsx → objects/link/linkEmailType.tsx} +5 -13
- package/templates/shopify/schemaTypes/{annotations/linkExternal.tsx → objects/link/linkExternalType.tsx} +6 -13
- package/templates/shopify/schemaTypes/{annotations/linkInternal.tsx → objects/link/linkInternalType.tsx} +5 -12
- package/templates/shopify/schemaTypes/{annotations/product.tsx → objects/link/linkProductType.tsx} +4 -16
- package/templates/shopify/schemaTypes/objects/module/{accordionGroup.ts → accordionGroupType.ts} +6 -9
- package/templates/shopify/schemaTypes/objects/module/{accordion.ts → accordionType.ts} +4 -11
- package/templates/shopify/schemaTypes/objects/module/{callToAction.tsx → callToActionType.tsx} +10 -23
- package/templates/shopify/schemaTypes/objects/module/{callout.ts → calloutType.ts} +4 -10
- package/templates/shopify/schemaTypes/objects/module/{collection.tsx → collectionReferenceType.tsx} +4 -9
- package/templates/shopify/schemaTypes/objects/module/gridItemType.ts +41 -0
- package/templates/shopify/schemaTypes/objects/module/{grid.ts → gridType.ts} +7 -15
- package/templates/shopify/schemaTypes/objects/{hero/home.tsx → module/heroType.tsx} +14 -17
- package/templates/shopify/schemaTypes/objects/module/{imageCallToAction.tsx → imageCallToActionType.tsx} +6 -10
- package/templates/shopify/schemaTypes/objects/module/{image.ts → imageFeatureType.ts} +6 -18
- package/templates/shopify/schemaTypes/objects/module/{images.tsx → imageFeaturesType.tsx} +7 -25
- package/templates/shopify/schemaTypes/objects/module/{instagram.ts → instagramType.ts} +2 -2
- package/templates/shopify/schemaTypes/objects/module/{products.tsx → productFeaturesType.tsx} +6 -11
- package/templates/shopify/schemaTypes/objects/module/{product.tsx → productReferenceType.tsx} +6 -8
- package/templates/shopify/schemaTypes/objects/{seo/seo.ts → seoType.ts} +7 -6
- package/templates/shopify/schemaTypes/objects/shopify/{shopifyCollectionRule.tsx → collectionRuleType.tsx} +2 -10
- package/templates/shopify/schemaTypes/objects/shopify/{inventory.ts → inventoryType.ts} +7 -12
- package/templates/shopify/schemaTypes/objects/shopify/{option.tsx → optionType.tsx} +6 -12
- package/templates/shopify/schemaTypes/objects/shopify/{placeholderString.ts → placeholderStringType.ts} +3 -1
- package/templates/shopify/schemaTypes/objects/shopify/{priceRange.ts → priceRangeType.ts} +5 -7
- package/templates/shopify/schemaTypes/objects/shopify/{productWithVariant.tsx → productWithVariantType.tsx} +2 -2
- package/templates/shopify/schemaTypes/objects/shopify/{proxyString.ts → proxyStringType.ts} +1 -1
- package/templates/shopify/schemaTypes/objects/shopify/{shopifyCollection.ts → shopifyCollectionType.ts} +4 -25
- package/templates/shopify/schemaTypes/objects/shopify/{shopifyProduct.ts → shopifyProductType.ts} +5 -35
- package/templates/shopify/schemaTypes/objects/shopify/{shopifyProductVariant.ts → shopifyProductVariantType.ts} +1 -27
- package/templates/shopify/schemaTypes/portableText/portableTextSimpleType.tsx +45 -0
- package/templates/shopify/schemaTypes/portableText/portableTextType.tsx +52 -0
- package/templates/shopify/schemaTypes/singletons/homeType.ts +49 -0
- package/templates/shopify/schemaTypes/singletons/{settings.ts → settingsType.ts} +7 -9
- package/templates/shopify/utils/shopifyUrls.ts +3 -3
- package/templates/shopify/utils/validateSlug.ts +3 -7
- package/lib/_chunks-cjs/index.js +0 -547
- package/lib/_chunks-cjs/index.js.map +0 -1
- package/lib/_chunks-cjs/node.js +0 -213
- package/lib/_chunks-cjs/node.js.map +0 -1
- package/lib/_chunks-cjs/stegaEncodeSourceMap.js +0 -357
- package/lib/_chunks-cjs/stegaEncodeSourceMap.js.map +0 -1
- package/lib/_chunks-es/index.js +0 -3336
- package/lib/_chunks-es/index.js.map +0 -1
- package/lib/_chunks-es/node.js +0 -216
- package/lib/_chunks-es/node.js.map +0 -1
- package/lib/_chunks-es/stegaEncodeSourceMap.js +0 -358
- package/lib/_chunks-es/stegaEncodeSourceMap.js.map +0 -1
- package/lib/index.cjs.mjs +0 -7
- package/templates/shopify/schemaTypes/blocks/body.tsx +0 -70
- package/templates/shopify/schemaTypes/objects/global/footer.ts +0 -57
- package/templates/shopify/schemaTypes/objects/global/linkExternal.ts +0 -52
- package/templates/shopify/schemaTypes/objects/global/linkInternal.ts +0 -65
- package/templates/shopify/schemaTypes/objects/global/links.ts +0 -16
- package/templates/shopify/schemaTypes/objects/hero/collection.tsx +0 -42
- package/templates/shopify/schemaTypes/objects/hero/page.tsx +0 -35
- package/templates/shopify/schemaTypes/objects/module/accordionBody.ts +0 -45
- package/templates/shopify/schemaTypes/objects/module/gridItem.ts +0 -91
- package/templates/shopify/schemaTypes/objects/seo/description.tsx +0 -10
- package/templates/shopify/schemaTypes/objects/seo/home.tsx +0 -31
- package/templates/shopify/schemaTypes/objects/seo/page.tsx +0 -37
- package/templates/shopify/schemaTypes/objects/seo/shopify.tsx +0 -40
- package/templates/shopify/schemaTypes/singletons/home.ts +0 -62
- /package/lib/{dts/src/index.d.ts → index.d.mts} +0 -0
@@ -1,29 +1,12 @@
|
|
1
1
|
import {TagIcon} from '@sanity/icons'
|
2
2
|
import pluralize from 'pluralize-esm'
|
3
|
-
import ShopifyIcon from '../../components/icons/Shopify'
|
4
3
|
import ProductHiddenInput from '../../components/inputs/ProductHidden'
|
5
4
|
import ShopifyDocumentStatus from '../../components/media/ShopifyDocumentStatus'
|
6
5
|
import {defineField, defineType} from 'sanity'
|
7
6
|
import {getPriceRange} from '../../utils/getPriceRange'
|
7
|
+
import { GROUPS } from '../../constants'
|
8
8
|
|
9
|
-
const
|
10
|
-
{
|
11
|
-
name: 'editorial',
|
12
|
-
title: 'Editorial',
|
13
|
-
default: true,
|
14
|
-
},
|
15
|
-
{
|
16
|
-
name: 'shopifySync',
|
17
|
-
title: 'Shopify sync',
|
18
|
-
icon: ShopifyIcon,
|
19
|
-
},
|
20
|
-
{
|
21
|
-
name: 'seo',
|
22
|
-
title: 'SEO',
|
23
|
-
},
|
24
|
-
]
|
25
|
-
|
26
|
-
export default defineType({
|
9
|
+
export const productType = defineType({
|
27
10
|
name: 'product',
|
28
11
|
title: 'Product',
|
29
12
|
type: 'document',
|
@@ -43,37 +26,31 @@ export default defineType({
|
|
43
26
|
return !parent?.store || (isActive && !isDeleted)
|
44
27
|
},
|
45
28
|
}),
|
46
|
-
// Title (proxy)
|
47
29
|
defineField({
|
48
30
|
name: 'titleProxy',
|
49
31
|
title: 'Title',
|
50
32
|
type: 'proxyString',
|
51
33
|
options: {field: 'store.title'},
|
52
34
|
}),
|
53
|
-
// Slug (proxy)
|
54
35
|
defineField({
|
55
36
|
name: 'slugProxy',
|
56
37
|
title: 'Slug',
|
57
38
|
type: 'proxyString',
|
58
39
|
options: {field: 'store.slug.current'},
|
59
40
|
}),
|
60
|
-
// Color theme
|
61
41
|
defineField({
|
62
42
|
name: 'colorTheme',
|
63
|
-
title: 'Color theme',
|
64
43
|
type: 'reference',
|
65
44
|
to: [{type: 'colorTheme'}],
|
66
45
|
group: 'editorial',
|
67
46
|
}),
|
68
47
|
defineField({
|
69
48
|
name: 'body',
|
70
|
-
|
71
|
-
type: 'body',
|
49
|
+
type: 'portableText',
|
72
50
|
group: 'editorial',
|
73
51
|
}),
|
74
52
|
defineField({
|
75
53
|
name: 'store',
|
76
|
-
title: 'Shopify',
|
77
54
|
type: 'shopifyProduct',
|
78
55
|
description: 'Product data from Shopify (read-only)',
|
79
56
|
group: 'shopifySync',
|
@@ -81,7 +58,7 @@ export default defineType({
|
|
81
58
|
defineField({
|
82
59
|
name: 'seo',
|
83
60
|
title: 'SEO',
|
84
|
-
type: 'seo
|
61
|
+
type: 'seo',
|
85
62
|
group: 'seo',
|
86
63
|
}),
|
87
64
|
],
|
@@ -1,25 +1,18 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
import { CopyIcon } from '@sanity/icons'
|
3
3
|
import {defineField, defineType} from 'sanity'
|
4
4
|
|
5
|
-
import ShopifyIcon from '../../components/icons/Shopify'
|
6
5
|
import ProductVariantHiddenInput from '../../components/inputs/ProductVariantHidden'
|
7
6
|
import ShopifyDocumentStatus from '../../components/media/ShopifyDocumentStatus'
|
7
|
+
import { GROUPS } from '../../constants'
|
8
8
|
|
9
|
-
export
|
9
|
+
export const productVariantType = defineType({
|
10
10
|
name: 'productVariant',
|
11
11
|
title: 'Product variant',
|
12
12
|
type: 'document',
|
13
13
|
icon: CopyIcon,
|
14
|
-
groups:
|
15
|
-
{
|
16
|
-
name: 'shopifySync',
|
17
|
-
title: 'Shopify sync',
|
18
|
-
icon: ShopifyIcon,
|
19
|
-
},
|
20
|
-
],
|
14
|
+
groups: GROUPS,
|
21
15
|
fields: [
|
22
|
-
// Product variant hidden status
|
23
16
|
defineField({
|
24
17
|
name: 'hidden',
|
25
18
|
type: 'string',
|
@@ -32,14 +25,12 @@ export default defineType({
|
|
32
25
|
return !isDeleted
|
33
26
|
},
|
34
27
|
}),
|
35
|
-
// Title (proxy)
|
36
28
|
defineField({
|
37
29
|
title: 'Title',
|
38
30
|
name: 'titleProxy',
|
39
31
|
type: 'proxyString',
|
40
32
|
options: {field: 'store.title'},
|
41
33
|
}),
|
42
|
-
// Shopify product variant
|
43
34
|
defineField({
|
44
35
|
name: 'store',
|
45
36
|
title: 'Shopify',
|
@@ -1,135 +1,106 @@
|
|
1
|
-
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
1
|
+
import {accordionGroupType} from './objects/module/accordionGroupType'
|
2
|
+
import {accordionType} from './objects/module/accordionType'
|
3
|
+
import {calloutType} from './objects/module/calloutType'
|
4
|
+
import {callToActionType} from './objects/module/callToActionType'
|
5
|
+
import {collectionGroupType} from './objects/collection/collectionGroupType'
|
6
|
+
import {collectionLinksType} from './objects/collection/collectionLinksType'
|
7
|
+
import {collectionReferenceType} from './objects/module/collectionReferenceType'
|
8
|
+
import {collectionRuleType} from './objects/shopify/collectionRuleType'
|
9
|
+
import {customProductOptionColorObjectType} from './objects/customProductOption/customProductOptionColorObjectType'
|
10
|
+
import {customProductOptionColorType} from './objects/customProductOption/customProductOptionColorType'
|
11
|
+
import {customProductOptionSizeObjectType} from './objects/customProductOption/customProductOptionSizeObjectType'
|
12
|
+
import {customProductOptionSizeType} from './objects/customProductOption/customProductOptionSizeType'
|
13
|
+
import {footerType} from './objects/global/footerType'
|
14
|
+
import {gridItemType} from './objects/module/gridItemType'
|
15
|
+
import {gridType} from './objects/module/gridType'
|
16
|
+
import {heroType} from './objects/module/heroType'
|
17
|
+
import {imageCallToActionType} from './objects/module/imageCallToActionType'
|
18
|
+
import {imageFeaturesType} from './objects/module/imageFeaturesType'
|
19
|
+
import {imageFeatureType} from './objects/module/imageFeatureType'
|
20
|
+
import {imageWithProductHotspotsType} from './objects/hotspot/imageWithProductHotspotsType'
|
21
|
+
import {instagramType} from './objects/module/instagramType'
|
22
|
+
import {inventoryType} from './objects/shopify/inventoryType'
|
23
|
+
import {linkEmailType} from './objects/link/linkEmailType'
|
24
|
+
import {linkExternalType} from './objects/link/linkExternalType'
|
25
|
+
import {linkInternalType} from './objects/link/linkInternalType'
|
26
|
+
import {linkProductType} from './objects/link/linkProductType'
|
27
|
+
import {menuLinksType} from './objects/global/menuLinksType'
|
28
|
+
import {menuType} from './objects/global/menuType'
|
29
|
+
import {notFoundPageType} from './objects/global/notFoundPageType'
|
30
|
+
import {optionType} from './objects/shopify/optionType'
|
31
|
+
import {placeholderStringType} from './objects/shopify/placeholderStringType'
|
32
|
+
import {priceRangeType} from './objects/shopify/priceRangeType'
|
33
|
+
import {productFeaturesType} from './objects/module/productFeaturesType'
|
34
|
+
import {productHotspotsType} from './objects/hotspot/productHotspotsType'
|
35
|
+
import {productReferenceType} from './objects/module/productReferenceType'
|
36
|
+
import {productWithVariantType} from './objects/shopify/productWithVariantType'
|
37
|
+
import {proxyStringType} from './objects/shopify/proxyStringType'
|
38
|
+
import {seoType} from './objects/seoType'
|
39
|
+
import {shopifyCollectionType} from './objects/shopify/shopifyCollectionType'
|
40
|
+
import {shopifyProductType} from './objects/shopify/shopifyProductType'
|
41
|
+
import {shopifyProductVariantType} from './objects/shopify/shopifyProductVariantType'
|
42
|
+
import {spotType} from './objects/hotspot/spotType'
|
6
43
|
|
7
|
-
|
8
|
-
|
9
|
-
annotationLinkExternal,
|
10
|
-
annotationLinkInternal,
|
11
|
-
annotationProduct,
|
12
|
-
]
|
13
|
-
|
14
|
-
// Document types
|
15
|
-
import collection from './documents/collection'
|
16
|
-
import colorTheme from './documents/colorTheme'
|
17
|
-
import page from './documents/page'
|
18
|
-
import product from './documents/product'
|
19
|
-
import productVariant from './documents/productVariant'
|
44
|
+
// Objects used as annotations must be imported first
|
45
|
+
const annotations = [linkEmailType, linkExternalType, linkInternalType, linkProductType]
|
20
46
|
|
21
|
-
const
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
47
|
+
const objects = [
|
48
|
+
accordionGroupType,
|
49
|
+
accordionType,
|
50
|
+
calloutType,
|
51
|
+
callToActionType,
|
52
|
+
collectionGroupType,
|
53
|
+
collectionLinksType,
|
54
|
+
collectionReferenceType,
|
55
|
+
collectionRuleType,
|
56
|
+
customProductOptionColorObjectType,
|
57
|
+
customProductOptionColorType,
|
58
|
+
customProductOptionSizeObjectType,
|
59
|
+
customProductOptionSizeType,
|
60
|
+
footerType,
|
61
|
+
gridItemType,
|
62
|
+
gridType,
|
63
|
+
heroType,
|
64
|
+
imageCallToActionType,
|
65
|
+
imageFeaturesType,
|
66
|
+
imageFeatureType,
|
67
|
+
imageWithProductHotspotsType,
|
68
|
+
instagramType,
|
69
|
+
inventoryType,
|
70
|
+
menuLinksType,
|
71
|
+
menuType,
|
72
|
+
notFoundPageType,
|
73
|
+
optionType,
|
74
|
+
placeholderStringType,
|
75
|
+
priceRangeType,
|
76
|
+
productFeaturesType,
|
77
|
+
productHotspotsType,
|
78
|
+
productReferenceType,
|
79
|
+
productWithVariantType,
|
80
|
+
proxyStringType,
|
81
|
+
seoType,
|
82
|
+
shopifyCollectionType,
|
83
|
+
shopifyProductType,
|
84
|
+
shopifyProductVariantType,
|
85
|
+
spotType,
|
86
|
+
]
|
26
87
|
|
27
|
-
|
88
|
+
import {portableTextType} from './portableText/portableTextType'
|
89
|
+
import {portableTextSimpleType} from './portableText/portableTextSimpleType'
|
28
90
|
|
29
|
-
|
30
|
-
import body from './blocks/body'
|
91
|
+
const blocks = [portableTextType, portableTextSimpleType]
|
31
92
|
|
32
|
-
|
93
|
+
import {collectionType} from './documents/collection'
|
94
|
+
import {colorThemeType} from './documents/colorTheme'
|
95
|
+
import {pageType} from './documents/page'
|
96
|
+
import {productType} from './documents/product'
|
97
|
+
import {productVariantType} from './documents/productVariant'
|
33
98
|
|
34
|
-
|
35
|
-
import customProductOptionColor from './objects/customProductOption/color'
|
36
|
-
import customProductOptionColorObject from './objects/customProductOption/colorObject'
|
37
|
-
import customProductOptionSize from './objects/customProductOption/size'
|
38
|
-
import customProductOptionSizeObject from './objects/customProductOption/sizeObject'
|
39
|
-
import footer from './objects/global/footer'
|
40
|
-
import imageWithProductHotspots from './objects/hotspot/imageWithProductHotspots'
|
41
|
-
import inventory from './objects/shopify/inventory'
|
42
|
-
import linkExternal from './objects/global/linkExternal'
|
43
|
-
import linkInternal from './objects/global/linkInternal'
|
44
|
-
import links from './objects/global/links'
|
45
|
-
import notFoundPage from './objects/global/notFoundPage'
|
46
|
-
import heroCollection from './objects/hero/collection'
|
47
|
-
import heroHome from './objects/hero/home'
|
48
|
-
import heroPage from './objects/hero/page'
|
49
|
-
import moduleAccordion from './objects/module/accordion'
|
50
|
-
import accordionBody from './objects/module/accordionBody'
|
51
|
-
import accordionGroup from './objects/module/accordionGroup'
|
52
|
-
import moduleCallout from './objects/module/callout'
|
53
|
-
import moduleCallToAction from './objects/module/callToAction'
|
54
|
-
import moduleCollection from './objects/module/collection'
|
55
|
-
import moduleGrid from './objects/module/grid'
|
56
|
-
import gridItems from './objects/module/gridItem'
|
57
|
-
import menu from './objects/global/menu'
|
58
|
-
import moduleImage from './objects/module/image'
|
59
|
-
import moduleImageAction from './objects/module/imageCallToAction'
|
60
|
-
import moduleImages from './objects/module/images'
|
61
|
-
import moduleInstagram from './objects/module/instagram'
|
62
|
-
import moduleProduct from './objects/module/product'
|
63
|
-
import moduleProducts from './objects/module/products'
|
64
|
-
import placeholderString from './objects/shopify/placeholderString'
|
65
|
-
import priceRange from './objects/shopify/priceRange'
|
66
|
-
import spot from './objects/hotspot/spot'
|
67
|
-
import productHotspots from './objects/hotspot/productHotspots'
|
68
|
-
import option from './objects/shopify/option'
|
69
|
-
import productWithVariant from './objects/shopify/productWithVariant'
|
70
|
-
import proxyString from './objects/shopify/proxyString'
|
71
|
-
import seo from './objects/seo/seo'
|
72
|
-
import seoHome from './objects/seo/home'
|
73
|
-
import seoPage from './objects/seo/page'
|
74
|
-
import seoDescription from './objects/seo/description'
|
75
|
-
import seoShopify from './objects/seo/shopify'
|
76
|
-
import shopifyCollection from './objects/shopify/shopifyCollection'
|
77
|
-
import shopifyCollectionRule from './objects/shopify/shopifyCollectionRule'
|
78
|
-
import shopifyProduct from './objects/shopify/shopifyProduct'
|
79
|
-
import shopifyProductVariant from './objects/shopify/shopifyProductVariant'
|
99
|
+
const documents = [collectionType, colorThemeType, pageType, productType, productVariantType]
|
80
100
|
|
81
|
-
|
82
|
-
import
|
83
|
-
import collectionLinks from './objects/collection/links'
|
101
|
+
import {homeType} from './singletons/homeType'
|
102
|
+
import {settingsType} from './singletons/settingsType'
|
84
103
|
|
85
|
-
const
|
86
|
-
customProductOptionColor,
|
87
|
-
customProductOptionColorObject,
|
88
|
-
customProductOptionSize,
|
89
|
-
customProductOptionSizeObject,
|
90
|
-
footer,
|
91
|
-
imageWithProductHotspots,
|
92
|
-
inventory,
|
93
|
-
links,
|
94
|
-
linkExternal,
|
95
|
-
linkInternal,
|
96
|
-
notFoundPage,
|
97
|
-
heroCollection,
|
98
|
-
heroHome,
|
99
|
-
heroPage,
|
100
|
-
moduleAccordion,
|
101
|
-
accordionBody,
|
102
|
-
accordionGroup,
|
103
|
-
menu,
|
104
|
-
moduleCallout,
|
105
|
-
moduleCallToAction,
|
106
|
-
moduleCollection,
|
107
|
-
moduleGrid,
|
108
|
-
gridItems,
|
109
|
-
moduleImage,
|
110
|
-
moduleImageAction,
|
111
|
-
moduleImages,
|
112
|
-
moduleInstagram,
|
113
|
-
moduleProduct,
|
114
|
-
moduleProducts,
|
115
|
-
placeholderString,
|
116
|
-
priceRange,
|
117
|
-
spot,
|
118
|
-
productHotspots,
|
119
|
-
option,
|
120
|
-
productWithVariant,
|
121
|
-
proxyString,
|
122
|
-
seo,
|
123
|
-
seoHome,
|
124
|
-
seoPage,
|
125
|
-
seoDescription,
|
126
|
-
seoShopify,
|
127
|
-
shopifyCollection,
|
128
|
-
shopifyCollectionRule,
|
129
|
-
shopifyProduct,
|
130
|
-
shopifyProductVariant,
|
131
|
-
collectionGroup,
|
132
|
-
collectionLinks,
|
133
|
-
]
|
104
|
+
const singletons = [homeType, settingsType]
|
134
105
|
|
135
|
-
export const schemaTypes = [...annotations, ...
|
106
|
+
export const schemaTypes = [...annotations, ...objects, ...singletons, ...blocks, ...documents]
|
package/templates/shopify/schemaTypes/objects/collection/{group.ts → collectionGroupType.ts}
RENAMED
@@ -1,30 +1,27 @@
|
|
1
1
|
import {PackageIcon} from '@sanity/icons'
|
2
2
|
import {defineField} from 'sanity'
|
3
3
|
|
4
|
-
export
|
4
|
+
export const collectionGroupType = defineField({
|
5
5
|
name: 'collectionGroup',
|
6
6
|
title: 'Collection group',
|
7
7
|
type: 'object',
|
8
8
|
icon: PackageIcon,
|
9
9
|
fields: [
|
10
|
-
{
|
10
|
+
defineField({
|
11
11
|
name: 'title',
|
12
|
-
title: 'Title',
|
13
12
|
type: 'string',
|
14
13
|
validation: (Rule) => Rule.required(),
|
15
|
-
},
|
16
|
-
{
|
14
|
+
}),
|
15
|
+
defineField({
|
17
16
|
name: 'collectionLinks',
|
18
|
-
title: 'Collection links',
|
19
17
|
type: 'collectionLinks',
|
20
|
-
},
|
21
|
-
{
|
18
|
+
}),
|
19
|
+
defineField({
|
22
20
|
name: 'collectionProducts',
|
23
|
-
title: 'Collection products',
|
24
21
|
type: 'reference',
|
25
22
|
description: 'Products from this collection will be listed',
|
26
23
|
weak: true,
|
27
24
|
to: [{type: 'collection'}],
|
28
|
-
},
|
25
|
+
}),
|
29
26
|
],
|
30
27
|
})
|
package/templates/shopify/schemaTypes/objects/collection/{links.ts → collectionLinksType.ts}
RENAMED
@@ -1,16 +1,16 @@
|
|
1
|
-
import {defineField} from 'sanity'
|
1
|
+
import {defineArrayMember, defineField} from 'sanity'
|
2
2
|
|
3
|
-
export
|
3
|
+
export const collectionLinksType = defineField({
|
4
4
|
name: 'collectionLinks',
|
5
5
|
title: 'Collection links',
|
6
6
|
type: 'array',
|
7
7
|
validation: (Rule) => Rule.unique().max(4),
|
8
8
|
of: [
|
9
|
-
{
|
9
|
+
defineArrayMember({
|
10
10
|
name: 'collection',
|
11
11
|
type: 'reference',
|
12
12
|
weak: true,
|
13
13
|
to: [{type: 'collection'}],
|
14
|
-
},
|
14
|
+
}),
|
15
15
|
],
|
16
16
|
})
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
import {defineField} from 'sanity'
|
3
3
|
|
4
4
|
const ColorPreview = ({color}: {color: string}) => {
|
@@ -15,21 +15,19 @@ const ColorPreview = ({color}: {color: string}) => {
|
|
15
15
|
)
|
16
16
|
}
|
17
17
|
|
18
|
-
export
|
18
|
+
export const customProductOptionColorObjectType = defineField({
|
19
19
|
name: 'customProductOption.colorObject',
|
20
20
|
title: 'Color',
|
21
21
|
type: 'object',
|
22
22
|
fields: [
|
23
23
|
defineField({
|
24
24
|
name: 'title',
|
25
|
-
title: 'Title',
|
26
25
|
type: 'string',
|
27
26
|
description: 'Shopify product option value (case sensitive)',
|
28
27
|
validation: (Rule) => Rule.required(),
|
29
28
|
}),
|
30
29
|
defineField({
|
31
30
|
name: 'color',
|
32
|
-
title: 'Color',
|
33
31
|
type: 'color',
|
34
32
|
options: {disableAlpha: true},
|
35
33
|
validation: (Rule) => Rule.required(),
|
@@ -40,8 +38,7 @@ export default defineField({
|
|
40
38
|
color: 'color.hex',
|
41
39
|
title: 'title',
|
42
40
|
},
|
43
|
-
prepare(
|
44
|
-
const {color, title} = selection
|
41
|
+
prepare({color, title}) {
|
45
42
|
return {
|
46
43
|
media: <ColorPreview color={color} />,
|
47
44
|
subtitle: color,
|
@@ -5,30 +5,22 @@ interface ColorOption {
|
|
5
5
|
title: string
|
6
6
|
}
|
7
7
|
|
8
|
-
export
|
8
|
+
export const customProductOptionColorType = defineField({
|
9
9
|
name: 'customProductOption.color',
|
10
10
|
title: 'Color',
|
11
11
|
type: 'object',
|
12
12
|
icon: false,
|
13
13
|
fields: [
|
14
|
-
// Title
|
15
14
|
defineField({
|
16
15
|
name: 'title',
|
17
|
-
title: 'Title',
|
18
16
|
type: 'string',
|
19
17
|
description: 'Shopify product option name (case sensitive)',
|
20
18
|
validation: (Rule) => Rule.required(),
|
21
19
|
}),
|
22
|
-
// Colors
|
23
20
|
defineField({
|
24
21
|
name: 'colors',
|
25
|
-
title: 'Colors',
|
26
22
|
type: 'array',
|
27
|
-
of: [
|
28
|
-
{
|
29
|
-
type: 'customProductOption.colorObject',
|
30
|
-
},
|
31
|
-
],
|
23
|
+
of: [{type: 'customProductOption.colorObject'}],
|
32
24
|
validation: (Rule) =>
|
33
25
|
Rule.custom((options: ColorOption[] | undefined) => {
|
34
26
|
// Each size must have a unique title
|
@@ -1,27 +1,24 @@
|
|
1
1
|
import {defineField} from 'sanity'
|
2
2
|
|
3
|
-
export
|
3
|
+
export const customProductOptionSizeObjectType = defineField({
|
4
4
|
name: 'customProductOption.sizeObject',
|
5
5
|
title: 'Size',
|
6
6
|
type: 'object',
|
7
7
|
fields: [
|
8
8
|
defineField({
|
9
9
|
name: 'title',
|
10
|
-
title: 'Title',
|
11
10
|
type: 'string',
|
12
11
|
description: 'Shopify product option value (case sensitive)',
|
13
12
|
validation: (Rule) => Rule.required(),
|
14
13
|
}),
|
15
14
|
defineField({
|
16
15
|
name: 'width',
|
17
|
-
title: 'Width',
|
18
16
|
type: 'number',
|
19
17
|
description: 'In mm',
|
20
18
|
validation: (Rule) => Rule.required().precision(2),
|
21
19
|
}),
|
22
20
|
defineField({
|
23
21
|
name: 'height',
|
24
|
-
title: 'Height',
|
25
22
|
type: 'number',
|
26
23
|
description: 'In mm',
|
27
24
|
validation: (Rule) => Rule.required().precision(2),
|
@@ -33,10 +30,9 @@ export default defineField({
|
|
33
30
|
title: 'title',
|
34
31
|
width: 'width',
|
35
32
|
},
|
36
|
-
prepare(
|
37
|
-
const {height, title, width} = selection
|
33
|
+
prepare({height, title, width}) {
|
38
34
|
return {
|
39
|
-
subtitle: `${width || '??'}
|
35
|
+
subtitle: `${width || '??'}mm x ${height || '??'}mm`,
|
40
36
|
title,
|
41
37
|
}
|
42
38
|
},
|
@@ -5,30 +5,22 @@ interface SizeOption {
|
|
5
5
|
title: string
|
6
6
|
}
|
7
7
|
|
8
|
-
export
|
8
|
+
export const customProductOptionSizeType = defineField({
|
9
9
|
name: 'customProductOption.size',
|
10
10
|
title: 'Size',
|
11
11
|
type: 'object',
|
12
12
|
icon: false,
|
13
13
|
fields: [
|
14
|
-
// Title
|
15
14
|
defineField({
|
16
15
|
name: 'title',
|
17
|
-
title: 'Title',
|
18
16
|
type: 'string',
|
19
17
|
description: 'Shopify product option name (case sensitive)',
|
20
18
|
validation: (Rule) => Rule.required(),
|
21
19
|
}),
|
22
|
-
// Sizes
|
23
20
|
defineField({
|
24
21
|
name: 'sizes',
|
25
|
-
title: 'Sizes',
|
26
22
|
type: 'array',
|
27
|
-
of: [
|
28
|
-
{
|
29
|
-
type: 'customProductOption.sizeObject',
|
30
|
-
},
|
31
|
-
],
|
23
|
+
of: [{type: 'customProductOption.sizeObject'}],
|
32
24
|
validation: (Rule) =>
|
33
25
|
Rule.custom((options: SizeOption[] | undefined) => {
|
34
26
|
// Each size must have a unique title
|
@@ -47,8 +39,7 @@ export default defineField({
|
|
47
39
|
sizes: 'sizes',
|
48
40
|
title: 'title',
|
49
41
|
},
|
50
|
-
prepare(
|
51
|
-
const {sizes, title} = selection
|
42
|
+
prepare({sizes, title}) {
|
52
43
|
return {
|
53
44
|
subtitle: sizes.length > 0 ? pluralize('size', sizes.length, true) : 'No sizes',
|
54
45
|
title,
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import {defineField} from 'sanity'
|
2
|
+
|
3
|
+
export const footerType = defineField({
|
4
|
+
name: 'footerSettings',
|
5
|
+
title: 'Footer',
|
6
|
+
type: 'object',
|
7
|
+
options: {
|
8
|
+
collapsed: false,
|
9
|
+
collapsible: true,
|
10
|
+
},
|
11
|
+
fields: [
|
12
|
+
defineField({
|
13
|
+
name: 'links',
|
14
|
+
type: 'array',
|
15
|
+
of: [{type: 'linkInternal'}, {type: 'linkExternal'}],
|
16
|
+
}),
|
17
|
+
defineField({
|
18
|
+
name: 'text',
|
19
|
+
type: 'portableTextSimple',
|
20
|
+
}),
|
21
|
+
],
|
22
|
+
})
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import {defineField} from 'sanity'
|
2
|
+
|
3
|
+
export const menuLinksType = defineField({
|
4
|
+
name: 'menuLinks',
|
5
|
+
title: 'Menu Links',
|
6
|
+
type: 'array',
|
7
|
+
of: [
|
8
|
+
defineField({
|
9
|
+
name: 'collectionGroup',
|
10
|
+
type: 'collectionGroup',
|
11
|
+
}),
|
12
|
+
defineField({
|
13
|
+
name: 'linkInternal',
|
14
|
+
type: 'linkInternal',
|
15
|
+
}),
|
16
|
+
defineField({
|
17
|
+
name: 'linkExternal',
|
18
|
+
type: 'linkExternal',
|
19
|
+
}),
|
20
|
+
],
|
21
|
+
})
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import {defineField} from 'sanity'
|
2
2
|
|
3
|
-
export
|
4
|
-
name: '
|
3
|
+
export const menuType = defineField({
|
4
|
+
name: 'menu',
|
5
5
|
title: 'Menu',
|
6
6
|
type: 'object',
|
7
7
|
options: {
|
@@ -9,10 +9,8 @@ export default defineField({
|
|
9
9
|
collapsible: true,
|
10
10
|
},
|
11
11
|
fields: [
|
12
|
-
// Links
|
13
12
|
defineField({
|
14
13
|
name: 'links',
|
15
|
-
title: 'Links',
|
16
14
|
type: 'menuLinks',
|
17
15
|
}),
|
18
16
|
],
|