@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.
Files changed (116) hide show
  1. package/lib/_chunks-cjs/cli.js +1779 -1317
  2. package/lib/_chunks-cjs/cli.js.map +1 -1
  3. package/lib/_chunks-cjs/journeyConfig.js +11 -11
  4. package/lib/_chunks-cjs/journeyConfig.js.map +1 -1
  5. package/lib/_chunks-cjs/loadEnv.js +105 -2719
  6. package/lib/_chunks-cjs/loadEnv.js.map +1 -1
  7. package/lib/cli.d.ts +10 -0
  8. package/lib/index.d.ts +448 -0
  9. package/lib/index.esm.js +449 -5
  10. package/lib/index.esm.js.map +1 -1
  11. package/lib/index.js +3 -3
  12. package/lib/index.js.map +1 -1
  13. package/lib/index.mjs +452 -0
  14. package/lib/index.mjs.map +1 -0
  15. package/lib/run.d.ts +1 -0
  16. package/lib/workers/getAndWriteJourneySchema.d.ts +1 -0
  17. package/lib/workers/getCliConfig.d.ts +1 -0
  18. package/lib/workers/typegenGenerate.d.ts +37 -0
  19. package/lib/workers/typegenGenerate.js +6 -2
  20. package/lib/workers/typegenGenerate.js.map +1 -1
  21. package/package.json +18 -21
  22. package/src/actions/init-project/templates/shopify.ts +7 -0
  23. package/src/util/journeyConfig.ts +5 -5
  24. package/templates/ecommerce/plugins/barcode-input/BarcodeInput.js +1 -1
  25. package/templates/get-started/plugins/sanity-plugin-tutorial/GetStartedTutorial.tsx +1 -1
  26. package/templates/shared/tsconfig.json +2 -4
  27. package/templates/shopify/README.md +3 -3
  28. package/templates/shopify/components/hotspots/ProductTooltip.tsx +1 -1
  29. package/templates/shopify/components/icons/Shopify.tsx +1 -1
  30. package/templates/shopify/components/inputs/CollectionHidden.tsx +1 -1
  31. package/templates/shopify/components/media/ColorTheme.tsx +1 -1
  32. package/templates/shopify/components/studio/Navbar.tsx +29 -0
  33. package/templates/shopify/constants.ts +31 -1
  34. package/templates/shopify/docs/features.md +6 -7
  35. package/templates/shopify/schemaTypes/documents/collection.tsx +11 -47
  36. package/templates/shopify/schemaTypes/documents/colorTheme.tsx +2 -17
  37. package/templates/shopify/schemaTypes/documents/page.ts +10 -37
  38. package/templates/shopify/schemaTypes/documents/product.tsx +4 -27
  39. package/templates/shopify/schemaTypes/documents/productVariant.tsx +4 -13
  40. package/templates/shopify/schemaTypes/index.ts +97 -126
  41. package/templates/shopify/schemaTypes/objects/collection/{group.ts → collectionGroupType.ts} +7 -10
  42. package/templates/shopify/schemaTypes/objects/collection/{links.ts → collectionLinksType.ts} +4 -4
  43. package/templates/shopify/schemaTypes/objects/customProductOption/{colorObject.tsx → customProductOptionColorObjectType.tsx} +3 -6
  44. package/templates/shopify/schemaTypes/objects/customProductOption/{color.tsx → customProductOptionColorType.tsx} +2 -10
  45. package/templates/shopify/schemaTypes/objects/customProductOption/{sizeObject.ts → customProductOptionSizeObjectType.ts} +3 -7
  46. package/templates/shopify/schemaTypes/objects/customProductOption/{size.ts → customProductOptionSizeType.ts} +3 -12
  47. package/templates/shopify/schemaTypes/objects/global/footerType.ts +22 -0
  48. package/templates/shopify/schemaTypes/objects/global/menuLinksType.ts +21 -0
  49. package/templates/shopify/schemaTypes/objects/global/{menu.ts → menuType.ts} +2 -4
  50. package/templates/shopify/schemaTypes/objects/global/{notFoundPage.ts → notFoundPageType.ts} +1 -6
  51. package/templates/shopify/schemaTypes/objects/hotspot/{imageWithProductHotspots.ts → imageWithProductHotspotsType.ts} +4 -6
  52. package/templates/shopify/schemaTypes/objects/hotspot/{productHotspots.tsx → productHotspotsType.tsx} +3 -5
  53. package/templates/shopify/schemaTypes/objects/hotspot/{spot.tsx → spotType.tsx} +1 -3
  54. package/templates/shopify/schemaTypes/{annotations/linkEmail.tsx → objects/link/linkEmailType.tsx} +5 -13
  55. package/templates/shopify/schemaTypes/{annotations/linkExternal.tsx → objects/link/linkExternalType.tsx} +6 -13
  56. package/templates/shopify/schemaTypes/{annotations/linkInternal.tsx → objects/link/linkInternalType.tsx} +5 -12
  57. package/templates/shopify/schemaTypes/{annotations/product.tsx → objects/link/linkProductType.tsx} +4 -16
  58. package/templates/shopify/schemaTypes/objects/module/{accordionGroup.ts → accordionGroupType.ts} +6 -9
  59. package/templates/shopify/schemaTypes/objects/module/{accordion.ts → accordionType.ts} +4 -11
  60. package/templates/shopify/schemaTypes/objects/module/{callToAction.tsx → callToActionType.tsx} +10 -23
  61. package/templates/shopify/schemaTypes/objects/module/{callout.ts → calloutType.ts} +4 -10
  62. package/templates/shopify/schemaTypes/objects/module/{collection.tsx → collectionReferenceType.tsx} +4 -9
  63. package/templates/shopify/schemaTypes/objects/module/gridItemType.ts +41 -0
  64. package/templates/shopify/schemaTypes/objects/module/{grid.ts → gridType.ts} +7 -15
  65. package/templates/shopify/schemaTypes/objects/{hero/home.tsx → module/heroType.tsx} +14 -17
  66. package/templates/shopify/schemaTypes/objects/module/{imageCallToAction.tsx → imageCallToActionType.tsx} +6 -10
  67. package/templates/shopify/schemaTypes/objects/module/{image.ts → imageFeatureType.ts} +6 -18
  68. package/templates/shopify/schemaTypes/objects/module/{images.tsx → imageFeaturesType.tsx} +7 -25
  69. package/templates/shopify/schemaTypes/objects/module/{instagram.ts → instagramType.ts} +2 -2
  70. package/templates/shopify/schemaTypes/objects/module/{products.tsx → productFeaturesType.tsx} +6 -11
  71. package/templates/shopify/schemaTypes/objects/module/{product.tsx → productReferenceType.tsx} +6 -8
  72. package/templates/shopify/schemaTypes/objects/{seo/seo.ts → seoType.ts} +7 -6
  73. package/templates/shopify/schemaTypes/objects/shopify/{shopifyCollectionRule.tsx → collectionRuleType.tsx} +2 -10
  74. package/templates/shopify/schemaTypes/objects/shopify/{inventory.ts → inventoryType.ts} +7 -12
  75. package/templates/shopify/schemaTypes/objects/shopify/{option.tsx → optionType.tsx} +6 -12
  76. package/templates/shopify/schemaTypes/objects/shopify/{placeholderString.ts → placeholderStringType.ts} +3 -1
  77. package/templates/shopify/schemaTypes/objects/shopify/{priceRange.ts → priceRangeType.ts} +5 -7
  78. package/templates/shopify/schemaTypes/objects/shopify/{productWithVariant.tsx → productWithVariantType.tsx} +2 -2
  79. package/templates/shopify/schemaTypes/objects/shopify/{proxyString.ts → proxyStringType.ts} +1 -1
  80. package/templates/shopify/schemaTypes/objects/shopify/{shopifyCollection.ts → shopifyCollectionType.ts} +4 -25
  81. package/templates/shopify/schemaTypes/objects/shopify/{shopifyProduct.ts → shopifyProductType.ts} +5 -35
  82. package/templates/shopify/schemaTypes/objects/shopify/{shopifyProductVariant.ts → shopifyProductVariantType.ts} +1 -27
  83. package/templates/shopify/schemaTypes/portableText/portableTextSimpleType.tsx +45 -0
  84. package/templates/shopify/schemaTypes/portableText/portableTextType.tsx +52 -0
  85. package/templates/shopify/schemaTypes/singletons/homeType.ts +49 -0
  86. package/templates/shopify/schemaTypes/singletons/{settings.ts → settingsType.ts} +7 -9
  87. package/templates/shopify/utils/shopifyUrls.ts +3 -3
  88. package/templates/shopify/utils/validateSlug.ts +3 -7
  89. package/lib/_chunks-cjs/index.js +0 -547
  90. package/lib/_chunks-cjs/index.js.map +0 -1
  91. package/lib/_chunks-cjs/node.js +0 -213
  92. package/lib/_chunks-cjs/node.js.map +0 -1
  93. package/lib/_chunks-cjs/stegaEncodeSourceMap.js +0 -357
  94. package/lib/_chunks-cjs/stegaEncodeSourceMap.js.map +0 -1
  95. package/lib/_chunks-es/index.js +0 -3336
  96. package/lib/_chunks-es/index.js.map +0 -1
  97. package/lib/_chunks-es/node.js +0 -216
  98. package/lib/_chunks-es/node.js.map +0 -1
  99. package/lib/_chunks-es/stegaEncodeSourceMap.js +0 -358
  100. package/lib/_chunks-es/stegaEncodeSourceMap.js.map +0 -1
  101. package/lib/index.cjs.mjs +0 -7
  102. package/templates/shopify/schemaTypes/blocks/body.tsx +0 -70
  103. package/templates/shopify/schemaTypes/objects/global/footer.ts +0 -57
  104. package/templates/shopify/schemaTypes/objects/global/linkExternal.ts +0 -52
  105. package/templates/shopify/schemaTypes/objects/global/linkInternal.ts +0 -65
  106. package/templates/shopify/schemaTypes/objects/global/links.ts +0 -16
  107. package/templates/shopify/schemaTypes/objects/hero/collection.tsx +0 -42
  108. package/templates/shopify/schemaTypes/objects/hero/page.tsx +0 -35
  109. package/templates/shopify/schemaTypes/objects/module/accordionBody.ts +0 -45
  110. package/templates/shopify/schemaTypes/objects/module/gridItem.ts +0 -91
  111. package/templates/shopify/schemaTypes/objects/seo/description.tsx +0 -10
  112. package/templates/shopify/schemaTypes/objects/seo/home.tsx +0 -31
  113. package/templates/shopify/schemaTypes/objects/seo/page.tsx +0 -37
  114. package/templates/shopify/schemaTypes/objects/seo/shopify.tsx +0 -40
  115. package/templates/shopify/schemaTypes/singletons/home.ts +0 -62
  116. /package/lib/{dts/src/index.d.ts → index.d.mts} +0 -0
@@ -1,23 +1,19 @@
1
1
  import {defineField} from 'sanity'
2
2
 
3
- export default defineField({
3
+ export const imageCallToActionType = defineField({
4
4
  name: 'imageCallToAction',
5
5
  title: 'Call to action',
6
6
  type: 'object',
7
7
  fields: [
8
- // Title
9
- {
8
+ defineField({
10
9
  name: 'title',
11
- title: 'Title',
12
10
  type: 'string',
13
- },
14
- // Link
15
- {
16
- name: 'links',
17
- title: 'Link',
11
+ }),
12
+ defineField({
13
+ name: 'link',
18
14
  type: 'array',
19
15
  of: [{type: 'linkInternal'}, {type: 'linkExternal'}],
20
16
  validation: (Rule) => Rule.max(1),
21
- },
17
+ }),
22
18
  ],
23
19
  })
@@ -9,24 +9,20 @@ const VARIANTS = [
9
9
  {title: 'Product tags', value: 'productTags'},
10
10
  ]
11
11
 
12
- export default defineField({
13
- name: 'module.image',
14
- title: 'Image',
12
+ export const imageFeatureType = defineField({
13
+ name: 'imageFeature',
14
+ title: 'Image Feature',
15
15
  type: 'object',
16
16
  icon: ImageIcon,
17
17
  fields: [
18
- // Image
19
18
  defineField({
20
19
  name: 'image',
21
- title: 'Image',
22
20
  type: 'image',
23
21
  options: {hotspot: true},
24
22
  validation: (Rule) => Rule.required(),
25
23
  }),
26
- // Variant
27
24
  defineField({
28
25
  name: 'variant',
29
- title: 'Variant',
30
26
  type: 'string',
31
27
  options: {
32
28
  direction: 'horizontal',
@@ -35,40 +31,33 @@ export default defineField({
35
31
  },
36
32
  initialValue: undefined,
37
33
  }),
38
- // Caption
39
34
  defineField({
40
35
  name: 'caption',
41
- title: 'Caption',
42
36
  type: 'text',
43
37
  rows: 2,
44
38
  hidden: ({parent}) => parent.variant !== 'caption',
45
39
  }),
46
- // Call to action
47
40
  defineField({
48
41
  name: 'callToAction',
49
- title: 'Call to action',
50
42
  type: 'imageCallToAction',
51
43
  hidden: ({parent}) => parent.variant !== 'callToAction',
52
44
  }),
53
- // Product hotspots
54
45
  defineField({
55
46
  name: 'productHotspots',
56
47
  title: 'Hotspots',
57
48
  type: 'productHotspots',
58
49
  hidden: ({parent}) => parent.variant !== 'productHotspots',
59
50
  }),
60
- // Product tags
61
51
  defineField({
62
52
  name: 'productTags',
63
53
  title: 'Products',
64
54
  type: 'array',
65
55
  hidden: ({parent}) => parent.variant !== 'productTags',
66
56
  of: [
67
- {
57
+ defineField({
68
58
  name: 'productWithVariant',
69
- title: 'Product + Variant',
70
59
  type: 'productWithVariant',
71
- },
60
+ }),
72
61
  ],
73
62
  }),
74
63
  ],
@@ -78,8 +67,7 @@ export default defineField({
78
67
  image: 'image',
79
68
  variant: 'variant',
80
69
  },
81
- prepare(selection) {
82
- const {fileName, image, variant} = selection
70
+ prepare({fileName, image, variant}) {
83
71
  const currentVariant = VARIANTS.find((v) => v.value === variant)
84
72
 
85
73
  return {
@@ -2,30 +2,26 @@ import {ImageIcon} from '@sanity/icons'
2
2
  import pluralize from 'pluralize-esm'
3
3
  import {defineField} from 'sanity'
4
4
 
5
- export default defineField({
6
- name: 'module.images',
5
+ export const imageFeaturesType = defineField({
6
+ name: 'images',
7
7
  title: 'Images',
8
8
  type: 'object',
9
9
  icon: ImageIcon,
10
10
  fields: [
11
- // Modules (Images)
12
11
  defineField({
13
- name: 'modules',
12
+ name: 'imageFeatures',
14
13
  title: 'Images',
15
14
  type: 'array',
16
- of: [{type: 'module.image'}],
15
+ of: [{type: 'imageFeature'}],
17
16
  validation: (Rule) => Rule.required().max(2),
18
17
  }),
19
- // Full width
20
18
  defineField({
21
19
  name: 'fullWidth',
22
- title: 'Full width',
23
20
  type: 'boolean',
24
21
  description: 'Display single image at full width (on larger breakpoints)',
25
22
  initialValue: false,
26
23
  hidden: ({parent}) => parent?.modules?.length > 1,
27
24
  }),
28
- // Vertical alignment
29
25
  defineField({
30
26
  name: 'verticalAlign',
31
27
  title: 'Vertical alignment',
@@ -34,20 +30,7 @@ export default defineField({
34
30
  options: {
35
31
  direction: 'horizontal',
36
32
  layout: 'radio',
37
- list: [
38
- {
39
- title: 'Top',
40
- value: 'top',
41
- },
42
- {
43
- title: 'Center',
44
- value: 'center',
45
- },
46
- {
47
- title: 'Bottom',
48
- value: 'bottom',
49
- },
50
- ],
33
+ list: ['top', 'center', 'bottom'],
51
34
  },
52
35
  hidden: ({parent}) => !parent?.modules || parent?.modules?.length < 2,
53
36
  validation: (Rule) => Rule.required(),
@@ -55,10 +38,9 @@ export default defineField({
55
38
  ],
56
39
  preview: {
57
40
  select: {
58
- images: 'modules',
41
+ images: 'imageFeatures',
59
42
  },
60
- prepare(selection) {
61
- const {images} = selection
43
+ prepare({images}) {
62
44
  return {
63
45
  subtitle: 'Images',
64
46
  title: images?.length > 0 ? pluralize('image', images.length, true) : 'No images',
@@ -1,8 +1,8 @@
1
1
  import {UserIcon} from '@sanity/icons'
2
2
  import {defineField} from 'sanity'
3
3
 
4
- export default defineField({
5
- name: 'module.instagram',
4
+ export const instagramType = defineField({
5
+ name: 'instagram',
6
6
  title: 'Instagram',
7
7
  type: 'object',
8
8
  icon: UserIcon,
@@ -2,24 +2,20 @@ import {TagIcon} from '@sanity/icons'
2
2
  import pluralize from 'pluralize-esm'
3
3
  import {defineField} from 'sanity'
4
4
 
5
- export default defineField({
6
- name: 'module.products',
5
+ export const productFeaturesType = defineField({
6
+ name: 'products',
7
7
  title: 'Products',
8
8
  type: 'object',
9
9
  icon: TagIcon,
10
10
  fields: [
11
- // Modules (products)
12
11
  defineField({
13
- name: 'modules',
14
- title: 'Products',
12
+ name: 'products',
15
13
  type: 'array',
16
- of: [{type: 'module.product'}],
14
+ of: [{type: 'productReference'}],
17
15
  validation: (Rule) => Rule.required().max(2),
18
16
  }),
19
- // Layout
20
17
  defineField({
21
18
  name: 'layout',
22
- title: 'Layout',
23
19
  type: 'string',
24
20
  initialValue: 'card',
25
21
  options: {
@@ -41,10 +37,9 @@ export default defineField({
41
37
  ],
42
38
  preview: {
43
39
  select: {
44
- products: 'modules',
40
+ products: 'products',
45
41
  },
46
- prepare(selection) {
47
- const {products} = selection
42
+ prepare({products}) {
48
43
  return {
49
44
  subtitle: 'Products',
50
45
  title: products.length > 0 ? pluralize('product', products.length, true) : 'No products',
@@ -1,21 +1,20 @@
1
1
  import {TagIcon} from '@sanity/icons'
2
- import React from 'react'
2
+
3
3
  import {defineField} from 'sanity'
4
4
 
5
5
  import ShopifyDocumentStatus from '../../../components/media/ShopifyDocumentStatus'
6
6
 
7
- export default defineField({
8
- name: 'module.product',
7
+ export const productReferenceType = defineField({
8
+ name: 'productReference',
9
9
  title: 'Product',
10
10
  type: 'object',
11
11
  icon: TagIcon,
12
12
  fields: [
13
- {
13
+ defineField({
14
14
  name: 'productWithVariant',
15
- title: 'Product + Variant',
16
15
  type: 'productWithVariant',
17
16
  validation: (Rule) => Rule.required(),
18
- },
17
+ }),
19
18
  ],
20
19
  preview: {
21
20
  select: {
@@ -24,8 +23,7 @@ export default defineField({
24
23
  status: 'productWithVariant.product.store.status',
25
24
  title: 'productWithVariant.product.store.title',
26
25
  },
27
- prepare(selection) {
28
- const {isDeleted, previewImageUrl, status, title} = selection
26
+ prepare({isDeleted, previewImageUrl, status, title}) {
29
27
  return {
30
28
  media: (
31
29
  <ShopifyDocumentStatus
@@ -1,11 +1,10 @@
1
1
  import {defineField} from 'sanity'
2
2
 
3
- export default defineField({
3
+ export const seoType = defineField({
4
4
  name: 'seo',
5
5
  title: 'SEO',
6
6
  type: 'object',
7
7
  group: 'seo',
8
- description: 'Defaults for every page',
9
8
  options: {
10
9
  collapsed: false,
11
10
  collapsible: true,
@@ -13,18 +12,20 @@ export default defineField({
13
12
  fields: [
14
13
  defineField({
15
14
  name: 'title',
16
- title: 'Site title',
17
15
  type: 'string',
18
- validation: (Rule) => Rule.required(),
16
+ validation: (Rule) =>
17
+ Rule.max(50).warning('Longer titles may be truncated by search engines'),
19
18
  }),
20
19
  defineField({
21
20
  name: 'description',
22
- title: 'Description',
23
21
  type: 'text',
24
22
  rows: 2,
25
23
  validation: (Rule) =>
26
24
  Rule.max(150).warning('Longer descriptions may be truncated by search engines'),
27
25
  }),
26
+ defineField({
27
+ name: 'image',
28
+ type: 'image',
29
+ }),
28
30
  ],
29
- validation: (Rule) => Rule.required(),
30
31
  })
@@ -1,28 +1,22 @@
1
1
  import {FilterIcon} from '@sanity/icons'
2
2
  import {defineField} from 'sanity'
3
3
 
4
- export default defineField({
4
+ export const collectionRuleType = defineField({
5
5
  title: 'Collection rule',
6
6
  name: 'collectionRule',
7
7
  type: 'object',
8
8
  icon: FilterIcon,
9
9
  readOnly: true,
10
10
  fields: [
11
- // Column
12
11
  defineField({
13
- title: 'Column',
14
12
  name: 'column',
15
13
  type: 'string',
16
14
  }),
17
- // Values
18
15
  defineField({
19
- title: 'Relation',
20
16
  name: 'relation',
21
17
  type: 'string',
22
18
  }),
23
- // Condition
24
19
  defineField({
25
- title: 'Condition',
26
20
  name: 'condition',
27
21
  type: 'string',
28
22
  }),
@@ -33,9 +27,7 @@ export default defineField({
33
27
  name: 'column',
34
28
  relation: 'relation',
35
29
  },
36
- prepare(selection) {
37
- const {condition, name, relation} = selection
38
-
30
+ prepare({condition, name, relation}) {
39
31
  return {
40
32
  subtitle: `${relation} ${condition}`,
41
33
  title: name,
@@ -1,6 +1,6 @@
1
1
  import {defineField} from 'sanity'
2
2
 
3
- export default defineField({
3
+ export const inventoryType = defineField({
4
4
  name: 'inventory',
5
5
  title: 'Inventory',
6
6
  type: 'object',
@@ -8,23 +8,18 @@ export default defineField({
8
8
  columns: 3,
9
9
  },
10
10
  fields: [
11
- // Available
12
- {
11
+ defineField({
13
12
  name: 'isAvailable',
14
13
  title: 'Available',
15
14
  type: 'boolean',
16
- },
17
- // Management
18
- {
15
+ }),
16
+ defineField({
19
17
  name: 'management',
20
- title: 'Management',
21
18
  type: 'string',
22
- },
23
- // Policy
24
- {
19
+ }),
20
+ defineField({
25
21
  name: 'policy',
26
- title: 'Policy',
27
22
  type: 'string',
28
- },
23
+ }),
29
24
  ],
30
25
  })
@@ -1,34 +1,28 @@
1
1
  import {SunIcon} from '@sanity/icons'
2
2
  import {defineField} from 'sanity'
3
3
 
4
- export default defineField({
4
+ export const optionType = defineField({
5
5
  title: 'Product option',
6
6
  name: 'option',
7
7
  type: 'object',
8
8
  icon: SunIcon,
9
9
  readOnly: true,
10
10
  fields: [
11
- // Name
12
- {
13
- title: 'Name',
11
+ defineField({
14
12
  name: 'name',
15
13
  type: 'string',
16
- },
17
- // Values
18
- {
19
- title: 'Values',
14
+ }),
15
+ defineField({
20
16
  name: 'values',
21
17
  type: 'array',
22
18
  of: [{type: 'string'}],
23
- },
19
+ }),
24
20
  ],
25
21
  preview: {
26
22
  select: {
27
23
  name: 'name',
28
24
  },
29
- prepare(selection) {
30
- const {name} = selection
31
-
25
+ prepare({name}) {
32
26
  return {
33
27
  title: name,
34
28
  }
@@ -1,6 +1,7 @@
1
+ import { defineType } from 'sanity'
1
2
  import PlaceholderStringInput from '../../../components/inputs/PlaceholderString'
2
3
 
3
- export default {
4
+ export const placeholderStringType = defineType({
4
5
  name: 'placeholderString',
5
6
  title: 'Title',
6
7
  type: 'string',
@@ -8,3 +9,4 @@ export default {
8
9
  input: PlaceholderStringInput,
9
10
  },
10
11
  }
12
+ )
@@ -1,6 +1,6 @@
1
1
  import {defineField} from 'sanity'
2
2
 
3
- export default defineField({
3
+ export const priceRangeType = defineField({
4
4
  name: 'priceRange',
5
5
  title: 'Price range',
6
6
  type: 'object',
@@ -8,15 +8,13 @@ export default defineField({
8
8
  columns: 2,
9
9
  },
10
10
  fields: [
11
- {
11
+ defineField({
12
12
  name: 'minVariantPrice',
13
- title: 'Min variant price',
14
13
  type: 'number',
15
- },
16
- {
14
+ }),
15
+ defineField({
17
16
  name: 'maxVariantPrice',
18
- title: 'Max variant price',
19
17
  type: 'number',
20
- },
18
+ }),
21
19
  ],
22
20
  })
@@ -1,13 +1,13 @@
1
1
  import {TagIcon} from '@sanity/icons'
2
2
  import pluralize from 'pluralize-esm'
3
- import React from 'react'
3
+
4
4
  import {defineField} from 'sanity'
5
5
 
6
6
  import ShopifyDocumentStatus from '../../../components/media/ShopifyDocumentStatus'
7
7
  import {SANITY_API_VERSION} from '../../../constants'
8
8
  import {getPriceRange} from '../../../utils/getPriceRange'
9
9
 
10
- export default defineField({
10
+ export const productWithVariantType = defineField({
11
11
  name: 'productWithVariant',
12
12
  title: 'Product with variant',
13
13
  type: 'object',
@@ -2,7 +2,7 @@ import {defineField} from 'sanity'
2
2
 
3
3
  import ProxyStringInput from '../../../components/inputs/ProxyString'
4
4
 
5
- export default defineField({
5
+ export const proxyStringType = defineField({
6
6
  name: 'proxyString',
7
7
  title: 'Title',
8
8
  type: 'string',
@@ -1,6 +1,6 @@
1
1
  import {defineField} from 'sanity'
2
2
 
3
- export default defineField({
3
+ export const shopifyCollectionType = defineField({
4
4
  name: 'shopifyCollection',
5
5
  title: 'Shopify',
6
6
  type: 'object',
@@ -16,90 +16,69 @@ export default defineField({
16
16
  },
17
17
  ],
18
18
  fields: [
19
- // Created at
20
19
  defineField({
21
20
  fieldset: 'status',
22
21
  name: 'createdAt',
23
- title: 'Created at',
24
22
  type: 'string',
25
23
  }),
26
- // Updated at
27
24
  defineField({
28
25
  fieldset: 'status',
29
26
  name: 'updatedAt',
30
- title: 'Updated at',
31
27
  type: 'string',
32
28
  }),
33
- // Deleted
34
29
  defineField({
35
30
  fieldset: 'status',
36
31
  name: 'isDeleted',
37
32
  title: 'Deleted from Shopify?',
38
33
  type: 'boolean',
39
34
  }),
40
- // Title
41
- {
35
+ defineField({
42
36
  name: 'title',
43
- title: 'Title',
44
37
  type: 'string',
45
- },
46
- // Collection ID
38
+ }),
47
39
  defineField({
48
40
  name: 'id',
49
41
  title: 'ID',
50
42
  type: 'number',
51
43
  description: 'Shopify Collection ID',
52
44
  }),
53
- // GID
54
45
  defineField({
55
46
  name: 'gid',
56
47
  title: 'GID',
57
48
  type: 'string',
58
49
  description: 'Shopify Collection GID',
59
50
  }),
60
- // Slug
61
51
  defineField({
62
52
  name: 'slug',
63
- title: 'Slug',
64
53
  description: 'Shopify Collection handle',
65
54
  type: 'slug',
66
55
  }),
67
- // Description
68
56
  defineField({
69
57
  name: 'descriptionHtml',
70
58
  title: 'HTML Description',
71
59
  type: 'text',
72
60
  rows: 5,
73
61
  }),
74
- // Image URL
75
62
  defineField({
76
63
  name: 'imageUrl',
77
64
  title: 'Image URL',
78
65
  type: 'string',
79
66
  }),
80
- // Rules
81
67
  defineField({
82
68
  name: 'rules',
83
- title: 'Rules',
84
69
  type: 'array',
85
70
  description: 'Include Shopify products that satisfy these conditions',
86
- of: [
87
- {
88
- type: 'collectionRule',
89
- },
71
+ of: [{type: 'collectionRule'},
90
72
  ],
91
73
  }),
92
- // Disjunctive rules
93
74
  defineField({
94
75
  name: 'disjunctive',
95
76
  title: 'Disjunctive rules?',
96
77
  description: 'Require any condition if true, otherwise require all conditions',
97
78
  type: 'boolean',
98
79
  }),
99
- // Sort order
100
80
  defineField({
101
81
  name: 'sortOrder',
102
- title: 'Sort order',
103
82
  type: 'string',
104
83
  }),
105
84
  ],