@cooperco/cooper-component-library 0.1.95 → 0.1.97
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/dist/cms/0083-create-placeholder-module.cjs +44 -0
- package/dist/cms/0084-limit-page-modules.cjs +40 -0
- package/dist/cms/contentful/migrations/scripts/0083-create-placeholder-module.cjs +44 -0
- package/dist/cms/contentful/migrations/scripts/0084-limit-page-modules.cjs +40 -0
- package/dist/cms/contentful/queries/helloBanner.query.d.ts +3 -0
- package/dist/cms/contentful/queries/helloBanner.query.js +30 -0
- package/dist/cms/contentful/queries/helloBanner.query.ts +33 -0
- package/dist/cms/contentful/queries/index.d.ts +2 -0
- package/dist/cms/contentful/queries/index.js +2 -0
- package/dist/cms/contentful/queries/index.ts +2 -0
- package/dist/cms/contentful/queries/placeholderModule.query.d.ts +3 -0
- package/dist/cms/contentful/queries/placeholderModule.query.js +19 -0
- package/dist/cms/contentful/queries/placeholderModule.query.ts +22 -0
- package/dist/cms/helloBanner.query.ts +33 -0
- package/dist/cms/index.ts +2 -0
- package/dist/cms/migrations/scripts/0083-create-placeholder-module.cjs +44 -0
- package/dist/cms/migrations/scripts/0084-limit-page-modules.cjs +40 -0
- package/dist/cms/placeholderModule.query.ts +22 -0
- package/dist/cms/queries/helloBanner.query.ts +33 -0
- package/dist/cms/queries/index.ts +2 -0
- package/dist/cms/queries/placeholderModule.query.ts +22 -0
- package/dist/cms/scripts/0083-create-placeholder-module.cjs +44 -0
- package/dist/cms/scripts/0084-limit-page-modules.cjs +40 -0
- package/dist/lib/component-lib.js +587 -573
- package/dist/lib/component-lib.umd.cjs +11 -11
- package/dist/types/cms/contentful/queries/helloBanner.query.d.ts +3 -0
- package/dist/types/cms/contentful/queries/index.d.ts +2 -0
- package/dist/types/cms/contentful/queries/placeholderModule.query.d.ts +3 -0
- package/dist/types/src/components/PlaceholderModule/PlaceholderModule.d.ts +12 -0
- package/dist/types/src/components/types.d.ts +3 -0
- package/dist/types/src/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const addEntryNameField = require('../helpers/addEntryNameField.cjs')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
// @ts-check
|
|
5
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
6
|
+
up: async function (migration) {
|
|
7
|
+
const placeholderModule = migration.createContentType('placeholderModule', {
|
|
8
|
+
name: 'Placeholder Module',
|
|
9
|
+
displayField: 'entryName',
|
|
10
|
+
description: 'Manage the placeholder module component',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Add required entryName field
|
|
14
|
+
addEntryNameField(placeholderModule)
|
|
15
|
+
|
|
16
|
+
// Module Name dropdown field
|
|
17
|
+
placeholderModule
|
|
18
|
+
.createField('moduleName')
|
|
19
|
+
.name('Module Name')
|
|
20
|
+
.type('Symbol')
|
|
21
|
+
.required(false)
|
|
22
|
+
.validations([
|
|
23
|
+
{
|
|
24
|
+
in: ['Contact Us', 'Contact Us Form'],
|
|
25
|
+
},
|
|
26
|
+
])
|
|
27
|
+
placeholderModule.changeFieldControl('moduleName', 'builtin', 'dropdown', {
|
|
28
|
+
helpText: 'Select the placeholder module to render.',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Custom Module Name field
|
|
32
|
+
placeholderModule
|
|
33
|
+
.createField('customModuleName')
|
|
34
|
+
.name('Custom Module Name')
|
|
35
|
+
.type('Symbol')
|
|
36
|
+
.required(false)
|
|
37
|
+
placeholderModule.changeFieldControl('customModuleName', 'builtin', 'singleLine', {
|
|
38
|
+
helpText: 'This will overwrite the dropdown selection if used. Confirm with the team before using this field.',
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
down: async function (migration) {
|
|
42
|
+
await migration.deleteContentType('placeholderModule')
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
3
|
+
up: function (migration) {
|
|
4
|
+
const page = migration.editContentType('page')
|
|
5
|
+
|
|
6
|
+
page.editField('pageModules').items({
|
|
7
|
+
type: 'Link',
|
|
8
|
+
validations: [
|
|
9
|
+
{
|
|
10
|
+
linkContentType: [
|
|
11
|
+
'carouselModule',
|
|
12
|
+
'chartModule',
|
|
13
|
+
'containerCollectionModule',
|
|
14
|
+
'containerModule',
|
|
15
|
+
'contentModule',
|
|
16
|
+
'logoCollectionModule',
|
|
17
|
+
'placeholderModule',
|
|
18
|
+
'productModule',
|
|
19
|
+
'splitModule',
|
|
20
|
+
'tabModule',
|
|
21
|
+
'testimonialModule',
|
|
22
|
+
'tileCollectionModule',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
linkType: 'Entry',
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
31
|
+
down: function (migration) {
|
|
32
|
+
const page = migration.editContentType('page')
|
|
33
|
+
|
|
34
|
+
page.editField('pageModules').items({
|
|
35
|
+
type: 'Link',
|
|
36
|
+
validations: [],
|
|
37
|
+
linkType: 'Entry',
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const addEntryNameField = require('../helpers/addEntryNameField.cjs')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
// @ts-check
|
|
5
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
6
|
+
up: async function (migration) {
|
|
7
|
+
const placeholderModule = migration.createContentType('placeholderModule', {
|
|
8
|
+
name: 'Placeholder Module',
|
|
9
|
+
displayField: 'entryName',
|
|
10
|
+
description: 'Manage the placeholder module component',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Add required entryName field
|
|
14
|
+
addEntryNameField(placeholderModule)
|
|
15
|
+
|
|
16
|
+
// Module Name dropdown field
|
|
17
|
+
placeholderModule
|
|
18
|
+
.createField('moduleName')
|
|
19
|
+
.name('Module Name')
|
|
20
|
+
.type('Symbol')
|
|
21
|
+
.required(false)
|
|
22
|
+
.validations([
|
|
23
|
+
{
|
|
24
|
+
in: ['Contact Us', 'Contact Us Form'],
|
|
25
|
+
},
|
|
26
|
+
])
|
|
27
|
+
placeholderModule.changeFieldControl('moduleName', 'builtin', 'dropdown', {
|
|
28
|
+
helpText: 'Select the placeholder module to render.',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Custom Module Name field
|
|
32
|
+
placeholderModule
|
|
33
|
+
.createField('customModuleName')
|
|
34
|
+
.name('Custom Module Name')
|
|
35
|
+
.type('Symbol')
|
|
36
|
+
.required(false)
|
|
37
|
+
placeholderModule.changeFieldControl('customModuleName', 'builtin', 'singleLine', {
|
|
38
|
+
helpText: 'This will overwrite the dropdown selection if used. Confirm with the team before using this field.',
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
down: async function (migration) {
|
|
42
|
+
await migration.deleteContentType('placeholderModule')
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
3
|
+
up: function (migration) {
|
|
4
|
+
const page = migration.editContentType('page')
|
|
5
|
+
|
|
6
|
+
page.editField('pageModules').items({
|
|
7
|
+
type: 'Link',
|
|
8
|
+
validations: [
|
|
9
|
+
{
|
|
10
|
+
linkContentType: [
|
|
11
|
+
'carouselModule',
|
|
12
|
+
'chartModule',
|
|
13
|
+
'containerCollectionModule',
|
|
14
|
+
'containerModule',
|
|
15
|
+
'contentModule',
|
|
16
|
+
'logoCollectionModule',
|
|
17
|
+
'placeholderModule',
|
|
18
|
+
'productModule',
|
|
19
|
+
'splitModule',
|
|
20
|
+
'tabModule',
|
|
21
|
+
'testimonialModule',
|
|
22
|
+
'tileCollectionModule',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
linkType: 'Entry',
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
31
|
+
down: function (migration) {
|
|
32
|
+
const page = migration.editContentType('page')
|
|
33
|
+
|
|
34
|
+
page.editField('pageModules').items({
|
|
35
|
+
type: 'Link',
|
|
36
|
+
validations: [],
|
|
37
|
+
linkType: 'Entry',
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag';
|
|
2
|
+
import { ctaFragment } from './fragments.js';
|
|
3
|
+
export const getHelloBanner = gql `
|
|
4
|
+
${ctaFragment}
|
|
5
|
+
query helloBannerQuery($id: String!, $preview: Boolean = false) {
|
|
6
|
+
helloBanner(id: $id, preview: $preview) {
|
|
7
|
+
__typename
|
|
8
|
+
entryName
|
|
9
|
+
active
|
|
10
|
+
fullCopy
|
|
11
|
+
mobileCollapsed
|
|
12
|
+
cta {
|
|
13
|
+
...ctaFragment
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
export const helloBannerFragment = gql `
|
|
19
|
+
${ctaFragment}
|
|
20
|
+
fragment helloBannerFragment on HelloBanner {
|
|
21
|
+
__typename
|
|
22
|
+
entryName
|
|
23
|
+
active
|
|
24
|
+
fullCopy
|
|
25
|
+
mobileCollapsed
|
|
26
|
+
cta {
|
|
27
|
+
...ctaFragment
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
import { ctaFragment } from './fragments.js'
|
|
4
|
+
|
|
5
|
+
export const getHelloBanner: DocumentNode = gql`
|
|
6
|
+
${ctaFragment}
|
|
7
|
+
query helloBannerQuery($id: String!, $preview: Boolean = false) {
|
|
8
|
+
helloBanner(id: $id, preview: $preview) {
|
|
9
|
+
__typename
|
|
10
|
+
entryName
|
|
11
|
+
active
|
|
12
|
+
fullCopy
|
|
13
|
+
mobileCollapsed
|
|
14
|
+
cta {
|
|
15
|
+
...ctaFragment
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
export const helloBannerFragment = gql`
|
|
22
|
+
${ctaFragment}
|
|
23
|
+
fragment helloBannerFragment on HelloBanner {
|
|
24
|
+
__typename
|
|
25
|
+
entryName
|
|
26
|
+
active
|
|
27
|
+
fullCopy
|
|
28
|
+
mobileCollapsed
|
|
29
|
+
cta {
|
|
30
|
+
...ctaFragment
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag';
|
|
2
|
+
export const getPlaceholderModule = gql `
|
|
3
|
+
query placeholderModuleQuery($id: String!, $preview: Boolean = false) {
|
|
4
|
+
placeholderModule(id: $id, preview: $preview) {
|
|
5
|
+
__typename
|
|
6
|
+
entryName
|
|
7
|
+
moduleName
|
|
8
|
+
customModuleName
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
export const placeholderModuleFragment = gql `
|
|
13
|
+
fragment placeholderModuleFragment on PlaceholderModule {
|
|
14
|
+
__typename
|
|
15
|
+
entryName
|
|
16
|
+
moduleName
|
|
17
|
+
customModuleName
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
|
|
4
|
+
export const getPlaceholderModule: DocumentNode = gql`
|
|
5
|
+
query placeholderModuleQuery($id: String!, $preview: Boolean = false) {
|
|
6
|
+
placeholderModule(id: $id, preview: $preview) {
|
|
7
|
+
__typename
|
|
8
|
+
entryName
|
|
9
|
+
moduleName
|
|
10
|
+
customModuleName
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
export const placeholderModuleFragment = gql`
|
|
16
|
+
fragment placeholderModuleFragment on PlaceholderModule {
|
|
17
|
+
__typename
|
|
18
|
+
entryName
|
|
19
|
+
moduleName
|
|
20
|
+
customModuleName
|
|
21
|
+
}
|
|
22
|
+
`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
import { ctaFragment } from './fragments.js'
|
|
4
|
+
|
|
5
|
+
export const getHelloBanner: DocumentNode = gql`
|
|
6
|
+
${ctaFragment}
|
|
7
|
+
query helloBannerQuery($id: String!, $preview: Boolean = false) {
|
|
8
|
+
helloBanner(id: $id, preview: $preview) {
|
|
9
|
+
__typename
|
|
10
|
+
entryName
|
|
11
|
+
active
|
|
12
|
+
fullCopy
|
|
13
|
+
mobileCollapsed
|
|
14
|
+
cta {
|
|
15
|
+
...ctaFragment
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
export const helloBannerFragment = gql`
|
|
22
|
+
${ctaFragment}
|
|
23
|
+
fragment helloBannerFragment on HelloBanner {
|
|
24
|
+
__typename
|
|
25
|
+
entryName
|
|
26
|
+
active
|
|
27
|
+
fullCopy
|
|
28
|
+
mobileCollapsed
|
|
29
|
+
cta {
|
|
30
|
+
...ctaFragment
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`
|
package/dist/cms/index.ts
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const addEntryNameField = require('../helpers/addEntryNameField.cjs')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
// @ts-check
|
|
5
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
6
|
+
up: async function (migration) {
|
|
7
|
+
const placeholderModule = migration.createContentType('placeholderModule', {
|
|
8
|
+
name: 'Placeholder Module',
|
|
9
|
+
displayField: 'entryName',
|
|
10
|
+
description: 'Manage the placeholder module component',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Add required entryName field
|
|
14
|
+
addEntryNameField(placeholderModule)
|
|
15
|
+
|
|
16
|
+
// Module Name dropdown field
|
|
17
|
+
placeholderModule
|
|
18
|
+
.createField('moduleName')
|
|
19
|
+
.name('Module Name')
|
|
20
|
+
.type('Symbol')
|
|
21
|
+
.required(false)
|
|
22
|
+
.validations([
|
|
23
|
+
{
|
|
24
|
+
in: ['Contact Us', 'Contact Us Form'],
|
|
25
|
+
},
|
|
26
|
+
])
|
|
27
|
+
placeholderModule.changeFieldControl('moduleName', 'builtin', 'dropdown', {
|
|
28
|
+
helpText: 'Select the placeholder module to render.',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Custom Module Name field
|
|
32
|
+
placeholderModule
|
|
33
|
+
.createField('customModuleName')
|
|
34
|
+
.name('Custom Module Name')
|
|
35
|
+
.type('Symbol')
|
|
36
|
+
.required(false)
|
|
37
|
+
placeholderModule.changeFieldControl('customModuleName', 'builtin', 'singleLine', {
|
|
38
|
+
helpText: 'This will overwrite the dropdown selection if used. Confirm with the team before using this field.',
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
down: async function (migration) {
|
|
42
|
+
await migration.deleteContentType('placeholderModule')
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
3
|
+
up: function (migration) {
|
|
4
|
+
const page = migration.editContentType('page')
|
|
5
|
+
|
|
6
|
+
page.editField('pageModules').items({
|
|
7
|
+
type: 'Link',
|
|
8
|
+
validations: [
|
|
9
|
+
{
|
|
10
|
+
linkContentType: [
|
|
11
|
+
'carouselModule',
|
|
12
|
+
'chartModule',
|
|
13
|
+
'containerCollectionModule',
|
|
14
|
+
'containerModule',
|
|
15
|
+
'contentModule',
|
|
16
|
+
'logoCollectionModule',
|
|
17
|
+
'placeholderModule',
|
|
18
|
+
'productModule',
|
|
19
|
+
'splitModule',
|
|
20
|
+
'tabModule',
|
|
21
|
+
'testimonialModule',
|
|
22
|
+
'tileCollectionModule',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
linkType: 'Entry',
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
31
|
+
down: function (migration) {
|
|
32
|
+
const page = migration.editContentType('page')
|
|
33
|
+
|
|
34
|
+
page.editField('pageModules').items({
|
|
35
|
+
type: 'Link',
|
|
36
|
+
validations: [],
|
|
37
|
+
linkType: 'Entry',
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
|
|
4
|
+
export const getPlaceholderModule: DocumentNode = gql`
|
|
5
|
+
query placeholderModuleQuery($id: String!, $preview: Boolean = false) {
|
|
6
|
+
placeholderModule(id: $id, preview: $preview) {
|
|
7
|
+
__typename
|
|
8
|
+
entryName
|
|
9
|
+
moduleName
|
|
10
|
+
customModuleName
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
export const placeholderModuleFragment = gql`
|
|
16
|
+
fragment placeholderModuleFragment on PlaceholderModule {
|
|
17
|
+
__typename
|
|
18
|
+
entryName
|
|
19
|
+
moduleName
|
|
20
|
+
customModuleName
|
|
21
|
+
}
|
|
22
|
+
`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
import { ctaFragment } from './fragments.js'
|
|
4
|
+
|
|
5
|
+
export const getHelloBanner: DocumentNode = gql`
|
|
6
|
+
${ctaFragment}
|
|
7
|
+
query helloBannerQuery($id: String!, $preview: Boolean = false) {
|
|
8
|
+
helloBanner(id: $id, preview: $preview) {
|
|
9
|
+
__typename
|
|
10
|
+
entryName
|
|
11
|
+
active
|
|
12
|
+
fullCopy
|
|
13
|
+
mobileCollapsed
|
|
14
|
+
cta {
|
|
15
|
+
...ctaFragment
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
export const helloBannerFragment = gql`
|
|
22
|
+
${ctaFragment}
|
|
23
|
+
fragment helloBannerFragment on HelloBanner {
|
|
24
|
+
__typename
|
|
25
|
+
entryName
|
|
26
|
+
active
|
|
27
|
+
fullCopy
|
|
28
|
+
mobileCollapsed
|
|
29
|
+
cta {
|
|
30
|
+
...ctaFragment
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
|
|
4
|
+
export const getPlaceholderModule: DocumentNode = gql`
|
|
5
|
+
query placeholderModuleQuery($id: String!, $preview: Boolean = false) {
|
|
6
|
+
placeholderModule(id: $id, preview: $preview) {
|
|
7
|
+
__typename
|
|
8
|
+
entryName
|
|
9
|
+
moduleName
|
|
10
|
+
customModuleName
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
export const placeholderModuleFragment = gql`
|
|
16
|
+
fragment placeholderModuleFragment on PlaceholderModule {
|
|
17
|
+
__typename
|
|
18
|
+
entryName
|
|
19
|
+
moduleName
|
|
20
|
+
customModuleName
|
|
21
|
+
}
|
|
22
|
+
`
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const addEntryNameField = require('../helpers/addEntryNameField.cjs')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
// @ts-check
|
|
5
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
6
|
+
up: async function (migration) {
|
|
7
|
+
const placeholderModule = migration.createContentType('placeholderModule', {
|
|
8
|
+
name: 'Placeholder Module',
|
|
9
|
+
displayField: 'entryName',
|
|
10
|
+
description: 'Manage the placeholder module component',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Add required entryName field
|
|
14
|
+
addEntryNameField(placeholderModule)
|
|
15
|
+
|
|
16
|
+
// Module Name dropdown field
|
|
17
|
+
placeholderModule
|
|
18
|
+
.createField('moduleName')
|
|
19
|
+
.name('Module Name')
|
|
20
|
+
.type('Symbol')
|
|
21
|
+
.required(false)
|
|
22
|
+
.validations([
|
|
23
|
+
{
|
|
24
|
+
in: ['Contact Us', 'Contact Us Form'],
|
|
25
|
+
},
|
|
26
|
+
])
|
|
27
|
+
placeholderModule.changeFieldControl('moduleName', 'builtin', 'dropdown', {
|
|
28
|
+
helpText: 'Select the placeholder module to render.',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
// Custom Module Name field
|
|
32
|
+
placeholderModule
|
|
33
|
+
.createField('customModuleName')
|
|
34
|
+
.name('Custom Module Name')
|
|
35
|
+
.type('Symbol')
|
|
36
|
+
.required(false)
|
|
37
|
+
placeholderModule.changeFieldControl('customModuleName', 'builtin', 'singleLine', {
|
|
38
|
+
helpText: 'This will overwrite the dropdown selection if used. Confirm with the team before using this field.',
|
|
39
|
+
})
|
|
40
|
+
},
|
|
41
|
+
down: async function (migration) {
|
|
42
|
+
await migration.deleteContentType('placeholderModule')
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
3
|
+
up: function (migration) {
|
|
4
|
+
const page = migration.editContentType('page')
|
|
5
|
+
|
|
6
|
+
page.editField('pageModules').items({
|
|
7
|
+
type: 'Link',
|
|
8
|
+
validations: [
|
|
9
|
+
{
|
|
10
|
+
linkContentType: [
|
|
11
|
+
'carouselModule',
|
|
12
|
+
'chartModule',
|
|
13
|
+
'containerCollectionModule',
|
|
14
|
+
'containerModule',
|
|
15
|
+
'contentModule',
|
|
16
|
+
'logoCollectionModule',
|
|
17
|
+
'placeholderModule',
|
|
18
|
+
'productModule',
|
|
19
|
+
'splitModule',
|
|
20
|
+
'tabModule',
|
|
21
|
+
'testimonialModule',
|
|
22
|
+
'tileCollectionModule',
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
linkType: 'Entry',
|
|
27
|
+
})
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
31
|
+
down: function (migration) {
|
|
32
|
+
const page = migration.editContentType('page')
|
|
33
|
+
|
|
34
|
+
page.editField('pageModules').items({
|
|
35
|
+
type: 'Link',
|
|
36
|
+
validations: [],
|
|
37
|
+
linkType: 'Entry',
|
|
38
|
+
})
|
|
39
|
+
},
|
|
40
|
+
}
|