@cooperco/cooper-component-library 0.1.83 → 0.1.84
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/0071-create-chart-module.cjs +122 -0
- package/dist/cms/0072-remove-comments-from-blog-article.cjs +23 -0
- package/dist/cms/chartModule.query.ts +26 -0
- package/dist/cms/contentful/migrations/scripts/0071-create-chart-module.cjs +122 -0
- package/dist/cms/contentful/migrations/scripts/0072-remove-comments-from-blog-article.cjs +23 -0
- package/dist/cms/contentful/queries/chartModule.query.d.ts +2 -0
- package/dist/cms/contentful/queries/chartModule.query.js +24 -0
- package/dist/cms/contentful/queries/chartModule.query.ts +26 -0
- package/dist/cms/contentful/queries/index.d.ts +1 -0
- package/dist/cms/contentful/queries/index.js +1 -0
- package/dist/cms/contentful/queries/index.ts +1 -0
- package/dist/cms/index.ts +1 -0
- package/dist/cms/migrations/scripts/0071-create-chart-module.cjs +122 -0
- package/dist/cms/migrations/scripts/0072-remove-comments-from-blog-article.cjs +23 -0
- package/dist/cms/queries/chartModule.query.ts +26 -0
- package/dist/cms/queries/index.ts +1 -0
- package/dist/cms/scripts/0071-create-chart-module.cjs +122 -0
- package/dist/cms/scripts/0072-remove-comments-from-blog-article.cjs +23 -0
- package/dist/lib/component-lib.js +11070 -3601
- package/dist/lib/component-lib.umd.cjs +47 -30
- package/dist/lib/style.css +1 -1
- package/dist/types/cms/contentful/queries/index.d.ts +1 -0
- package/dist/types/src/components/components.d.ts +1 -0
- package/dist/types/src/components/types.d.ts +4 -0
- package/dist/types/src/config/defaultPassthrough/index.d.ts +1 -0
- package/dist/types/src/config/defaultPassthrough/types.d.ts +3 -1
- package/package.json +4 -2
|
@@ -0,0 +1,122 @@
|
|
|
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 chartModule = migration.createContentType('chartModule', {
|
|
8
|
+
name: 'Chart Module',
|
|
9
|
+
displayField: 'entryName',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
addEntryNameField(chartModule)
|
|
13
|
+
|
|
14
|
+
chartModule
|
|
15
|
+
.createField('variant')
|
|
16
|
+
.name('Variant')
|
|
17
|
+
.type('Symbol')
|
|
18
|
+
.required(true)
|
|
19
|
+
.validations([
|
|
20
|
+
{
|
|
21
|
+
in: ['Single', 'Multi', 'Section'],
|
|
22
|
+
},
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
chartModule.changeFieldControl('variant', 'builtin', 'dropdown')
|
|
26
|
+
|
|
27
|
+
chartModule.createField('headline').name('Headline').type('Symbol')
|
|
28
|
+
|
|
29
|
+
chartModule
|
|
30
|
+
.createField('subHeadline')
|
|
31
|
+
.name('Sub Headline')
|
|
32
|
+
.type('RichText')
|
|
33
|
+
.validations([
|
|
34
|
+
{
|
|
35
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
36
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
enabledNodeTypes: ['heading-3', 'heading-4'],
|
|
40
|
+
message: 'Only heading 3 and heading 4 nodes are allowed',
|
|
41
|
+
},
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
chartModule
|
|
45
|
+
.createField('bodyCopy')
|
|
46
|
+
.name('Body Copy')
|
|
47
|
+
.type('RichText')
|
|
48
|
+
.validations([
|
|
49
|
+
{
|
|
50
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
51
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
enabledNodeTypes: [
|
|
55
|
+
'heading-3',
|
|
56
|
+
'heading-4',
|
|
57
|
+
'unordered-list',
|
|
58
|
+
'ordered-list',
|
|
59
|
+
'hyperlink',
|
|
60
|
+
],
|
|
61
|
+
message:
|
|
62
|
+
'Only heading 3, heading 4, unordered list, ordered list, and hyperlink nodes are allowed',
|
|
63
|
+
},
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
chartModule
|
|
67
|
+
.createField('footer')
|
|
68
|
+
.name('Footer')
|
|
69
|
+
.type('RichText')
|
|
70
|
+
.validations([
|
|
71
|
+
{
|
|
72
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
73
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
enabledNodeTypes: ['hyperlink'],
|
|
77
|
+
message: 'Only hyperlink nodes are allowed',
|
|
78
|
+
},
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
chartModule
|
|
82
|
+
.createField('chartHeadline')
|
|
83
|
+
.name('Chart Headline')
|
|
84
|
+
.type('Symbol')
|
|
85
|
+
|
|
86
|
+
chartModule
|
|
87
|
+
.createField('chartBodyCopy')
|
|
88
|
+
.name('Chart Body Copy')
|
|
89
|
+
.type('Symbol')
|
|
90
|
+
|
|
91
|
+
chartModule
|
|
92
|
+
.createField('chartType')
|
|
93
|
+
.name('Chart Type')
|
|
94
|
+
.type('Symbol')
|
|
95
|
+
.validations([
|
|
96
|
+
{
|
|
97
|
+
in: ['pie', 'doughnut'],
|
|
98
|
+
},
|
|
99
|
+
])
|
|
100
|
+
|
|
101
|
+
chartModule.changeFieldControl('chartType', 'builtin', 'dropdown')
|
|
102
|
+
|
|
103
|
+
chartModule
|
|
104
|
+
.createField('chartData')
|
|
105
|
+
.name('Chart Data')
|
|
106
|
+
.type('Object')
|
|
107
|
+
|
|
108
|
+
chartModule
|
|
109
|
+
.createField('backgroundColor')
|
|
110
|
+
.name('Background Color')
|
|
111
|
+
.type('Symbol')
|
|
112
|
+
|
|
113
|
+
chartModule.changeFieldControl(
|
|
114
|
+
'backgroundColor',
|
|
115
|
+
'app',
|
|
116
|
+
process.env.COLOR_PICKER_APP_ID
|
|
117
|
+
)
|
|
118
|
+
},
|
|
119
|
+
down: async function (migration) {
|
|
120
|
+
await migration.deleteContentType('chartModule')
|
|
121
|
+
},
|
|
122
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const article = migration.editContentType('blog-article')
|
|
6
|
+
article.deleteField('comments')
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
// @ts-check
|
|
10
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
11
|
+
down: function (migration) {
|
|
12
|
+
const article = migration.editContentType('blog-article')
|
|
13
|
+
article.createField('comments', {
|
|
14
|
+
name: 'Comments',
|
|
15
|
+
type: 'Array',
|
|
16
|
+
items: {
|
|
17
|
+
type: 'Link',
|
|
18
|
+
linkType: 'Entry',
|
|
19
|
+
validations: [],
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
|
|
4
|
+
export const getChartModule: DocumentNode = gql`
|
|
5
|
+
query chartModuleQuery($id: String!, $preview: Boolean = false) {
|
|
6
|
+
chartModule(id: $id, preview: $preview) {
|
|
7
|
+
__typename
|
|
8
|
+
variant
|
|
9
|
+
headline
|
|
10
|
+
subHeadline {
|
|
11
|
+
json
|
|
12
|
+
}
|
|
13
|
+
bodyCopy {
|
|
14
|
+
json
|
|
15
|
+
}
|
|
16
|
+
footer {
|
|
17
|
+
json
|
|
18
|
+
}
|
|
19
|
+
chartHeadline
|
|
20
|
+
chartBodyCopy
|
|
21
|
+
chartType
|
|
22
|
+
chartData
|
|
23
|
+
backgroundColor
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`
|
|
@@ -0,0 +1,122 @@
|
|
|
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 chartModule = migration.createContentType('chartModule', {
|
|
8
|
+
name: 'Chart Module',
|
|
9
|
+
displayField: 'entryName',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
addEntryNameField(chartModule)
|
|
13
|
+
|
|
14
|
+
chartModule
|
|
15
|
+
.createField('variant')
|
|
16
|
+
.name('Variant')
|
|
17
|
+
.type('Symbol')
|
|
18
|
+
.required(true)
|
|
19
|
+
.validations([
|
|
20
|
+
{
|
|
21
|
+
in: ['Single', 'Multi', 'Section'],
|
|
22
|
+
},
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
chartModule.changeFieldControl('variant', 'builtin', 'dropdown')
|
|
26
|
+
|
|
27
|
+
chartModule.createField('headline').name('Headline').type('Symbol')
|
|
28
|
+
|
|
29
|
+
chartModule
|
|
30
|
+
.createField('subHeadline')
|
|
31
|
+
.name('Sub Headline')
|
|
32
|
+
.type('RichText')
|
|
33
|
+
.validations([
|
|
34
|
+
{
|
|
35
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
36
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
enabledNodeTypes: ['heading-3', 'heading-4'],
|
|
40
|
+
message: 'Only heading 3 and heading 4 nodes are allowed',
|
|
41
|
+
},
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
chartModule
|
|
45
|
+
.createField('bodyCopy')
|
|
46
|
+
.name('Body Copy')
|
|
47
|
+
.type('RichText')
|
|
48
|
+
.validations([
|
|
49
|
+
{
|
|
50
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
51
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
enabledNodeTypes: [
|
|
55
|
+
'heading-3',
|
|
56
|
+
'heading-4',
|
|
57
|
+
'unordered-list',
|
|
58
|
+
'ordered-list',
|
|
59
|
+
'hyperlink',
|
|
60
|
+
],
|
|
61
|
+
message:
|
|
62
|
+
'Only heading 3, heading 4, unordered list, ordered list, and hyperlink nodes are allowed',
|
|
63
|
+
},
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
chartModule
|
|
67
|
+
.createField('footer')
|
|
68
|
+
.name('Footer')
|
|
69
|
+
.type('RichText')
|
|
70
|
+
.validations([
|
|
71
|
+
{
|
|
72
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
73
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
enabledNodeTypes: ['hyperlink'],
|
|
77
|
+
message: 'Only hyperlink nodes are allowed',
|
|
78
|
+
},
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
chartModule
|
|
82
|
+
.createField('chartHeadline')
|
|
83
|
+
.name('Chart Headline')
|
|
84
|
+
.type('Symbol')
|
|
85
|
+
|
|
86
|
+
chartModule
|
|
87
|
+
.createField('chartBodyCopy')
|
|
88
|
+
.name('Chart Body Copy')
|
|
89
|
+
.type('Symbol')
|
|
90
|
+
|
|
91
|
+
chartModule
|
|
92
|
+
.createField('chartType')
|
|
93
|
+
.name('Chart Type')
|
|
94
|
+
.type('Symbol')
|
|
95
|
+
.validations([
|
|
96
|
+
{
|
|
97
|
+
in: ['pie', 'doughnut'],
|
|
98
|
+
},
|
|
99
|
+
])
|
|
100
|
+
|
|
101
|
+
chartModule.changeFieldControl('chartType', 'builtin', 'dropdown')
|
|
102
|
+
|
|
103
|
+
chartModule
|
|
104
|
+
.createField('chartData')
|
|
105
|
+
.name('Chart Data')
|
|
106
|
+
.type('Object')
|
|
107
|
+
|
|
108
|
+
chartModule
|
|
109
|
+
.createField('backgroundColor')
|
|
110
|
+
.name('Background Color')
|
|
111
|
+
.type('Symbol')
|
|
112
|
+
|
|
113
|
+
chartModule.changeFieldControl(
|
|
114
|
+
'backgroundColor',
|
|
115
|
+
'app',
|
|
116
|
+
process.env.COLOR_PICKER_APP_ID
|
|
117
|
+
)
|
|
118
|
+
},
|
|
119
|
+
down: async function (migration) {
|
|
120
|
+
await migration.deleteContentType('chartModule')
|
|
121
|
+
},
|
|
122
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const article = migration.editContentType('blog-article')
|
|
6
|
+
article.deleteField('comments')
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
// @ts-check
|
|
10
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
11
|
+
down: function (migration) {
|
|
12
|
+
const article = migration.editContentType('blog-article')
|
|
13
|
+
article.createField('comments', {
|
|
14
|
+
name: 'Comments',
|
|
15
|
+
type: 'Array',
|
|
16
|
+
items: {
|
|
17
|
+
type: 'Link',
|
|
18
|
+
linkType: 'Entry',
|
|
19
|
+
validations: [],
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag';
|
|
2
|
+
export const getChartModule = gql `
|
|
3
|
+
query chartModuleQuery($id: String!, $preview: Boolean = false) {
|
|
4
|
+
chartModule(id: $id, preview: $preview) {
|
|
5
|
+
__typename
|
|
6
|
+
variant
|
|
7
|
+
headline
|
|
8
|
+
subHeadline {
|
|
9
|
+
json
|
|
10
|
+
}
|
|
11
|
+
bodyCopy {
|
|
12
|
+
json
|
|
13
|
+
}
|
|
14
|
+
footer {
|
|
15
|
+
json
|
|
16
|
+
}
|
|
17
|
+
chartHeadline
|
|
18
|
+
chartBodyCopy
|
|
19
|
+
chartType
|
|
20
|
+
chartData
|
|
21
|
+
backgroundColor
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
|
|
4
|
+
export const getChartModule: DocumentNode = gql`
|
|
5
|
+
query chartModuleQuery($id: String!, $preview: Boolean = false) {
|
|
6
|
+
chartModule(id: $id, preview: $preview) {
|
|
7
|
+
__typename
|
|
8
|
+
variant
|
|
9
|
+
headline
|
|
10
|
+
subHeadline {
|
|
11
|
+
json
|
|
12
|
+
}
|
|
13
|
+
bodyCopy {
|
|
14
|
+
json
|
|
15
|
+
}
|
|
16
|
+
footer {
|
|
17
|
+
json
|
|
18
|
+
}
|
|
19
|
+
chartHeadline
|
|
20
|
+
chartBodyCopy
|
|
21
|
+
chartType
|
|
22
|
+
chartData
|
|
23
|
+
backgroundColor
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`
|
package/dist/cms/index.ts
CHANGED
|
@@ -0,0 +1,122 @@
|
|
|
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 chartModule = migration.createContentType('chartModule', {
|
|
8
|
+
name: 'Chart Module',
|
|
9
|
+
displayField: 'entryName',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
addEntryNameField(chartModule)
|
|
13
|
+
|
|
14
|
+
chartModule
|
|
15
|
+
.createField('variant')
|
|
16
|
+
.name('Variant')
|
|
17
|
+
.type('Symbol')
|
|
18
|
+
.required(true)
|
|
19
|
+
.validations([
|
|
20
|
+
{
|
|
21
|
+
in: ['Single', 'Multi', 'Section'],
|
|
22
|
+
},
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
chartModule.changeFieldControl('variant', 'builtin', 'dropdown')
|
|
26
|
+
|
|
27
|
+
chartModule.createField('headline').name('Headline').type('Symbol')
|
|
28
|
+
|
|
29
|
+
chartModule
|
|
30
|
+
.createField('subHeadline')
|
|
31
|
+
.name('Sub Headline')
|
|
32
|
+
.type('RichText')
|
|
33
|
+
.validations([
|
|
34
|
+
{
|
|
35
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
36
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
enabledNodeTypes: ['heading-3', 'heading-4'],
|
|
40
|
+
message: 'Only heading 3 and heading 4 nodes are allowed',
|
|
41
|
+
},
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
chartModule
|
|
45
|
+
.createField('bodyCopy')
|
|
46
|
+
.name('Body Copy')
|
|
47
|
+
.type('RichText')
|
|
48
|
+
.validations([
|
|
49
|
+
{
|
|
50
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
51
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
enabledNodeTypes: [
|
|
55
|
+
'heading-3',
|
|
56
|
+
'heading-4',
|
|
57
|
+
'unordered-list',
|
|
58
|
+
'ordered-list',
|
|
59
|
+
'hyperlink',
|
|
60
|
+
],
|
|
61
|
+
message:
|
|
62
|
+
'Only heading 3, heading 4, unordered list, ordered list, and hyperlink nodes are allowed',
|
|
63
|
+
},
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
chartModule
|
|
67
|
+
.createField('footer')
|
|
68
|
+
.name('Footer')
|
|
69
|
+
.type('RichText')
|
|
70
|
+
.validations([
|
|
71
|
+
{
|
|
72
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
73
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
enabledNodeTypes: ['hyperlink'],
|
|
77
|
+
message: 'Only hyperlink nodes are allowed',
|
|
78
|
+
},
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
chartModule
|
|
82
|
+
.createField('chartHeadline')
|
|
83
|
+
.name('Chart Headline')
|
|
84
|
+
.type('Symbol')
|
|
85
|
+
|
|
86
|
+
chartModule
|
|
87
|
+
.createField('chartBodyCopy')
|
|
88
|
+
.name('Chart Body Copy')
|
|
89
|
+
.type('Symbol')
|
|
90
|
+
|
|
91
|
+
chartModule
|
|
92
|
+
.createField('chartType')
|
|
93
|
+
.name('Chart Type')
|
|
94
|
+
.type('Symbol')
|
|
95
|
+
.validations([
|
|
96
|
+
{
|
|
97
|
+
in: ['pie', 'doughnut'],
|
|
98
|
+
},
|
|
99
|
+
])
|
|
100
|
+
|
|
101
|
+
chartModule.changeFieldControl('chartType', 'builtin', 'dropdown')
|
|
102
|
+
|
|
103
|
+
chartModule
|
|
104
|
+
.createField('chartData')
|
|
105
|
+
.name('Chart Data')
|
|
106
|
+
.type('Object')
|
|
107
|
+
|
|
108
|
+
chartModule
|
|
109
|
+
.createField('backgroundColor')
|
|
110
|
+
.name('Background Color')
|
|
111
|
+
.type('Symbol')
|
|
112
|
+
|
|
113
|
+
chartModule.changeFieldControl(
|
|
114
|
+
'backgroundColor',
|
|
115
|
+
'app',
|
|
116
|
+
process.env.COLOR_PICKER_APP_ID
|
|
117
|
+
)
|
|
118
|
+
},
|
|
119
|
+
down: async function (migration) {
|
|
120
|
+
await migration.deleteContentType('chartModule')
|
|
121
|
+
},
|
|
122
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const article = migration.editContentType('blog-article')
|
|
6
|
+
article.deleteField('comments')
|
|
7
|
+
},
|
|
8
|
+
|
|
9
|
+
// @ts-check
|
|
10
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
11
|
+
down: function (migration) {
|
|
12
|
+
const article = migration.editContentType('blog-article')
|
|
13
|
+
article.createField('comments', {
|
|
14
|
+
name: 'Comments',
|
|
15
|
+
type: 'Array',
|
|
16
|
+
items: {
|
|
17
|
+
type: 'Link',
|
|
18
|
+
linkType: 'Entry',
|
|
19
|
+
validations: [],
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { gql } from 'graphql-tag'
|
|
2
|
+
import type { DocumentNode } from 'graphql'
|
|
3
|
+
|
|
4
|
+
export const getChartModule: DocumentNode = gql`
|
|
5
|
+
query chartModuleQuery($id: String!, $preview: Boolean = false) {
|
|
6
|
+
chartModule(id: $id, preview: $preview) {
|
|
7
|
+
__typename
|
|
8
|
+
variant
|
|
9
|
+
headline
|
|
10
|
+
subHeadline {
|
|
11
|
+
json
|
|
12
|
+
}
|
|
13
|
+
bodyCopy {
|
|
14
|
+
json
|
|
15
|
+
}
|
|
16
|
+
footer {
|
|
17
|
+
json
|
|
18
|
+
}
|
|
19
|
+
chartHeadline
|
|
20
|
+
chartBodyCopy
|
|
21
|
+
chartType
|
|
22
|
+
chartData
|
|
23
|
+
backgroundColor
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
`
|
|
@@ -0,0 +1,122 @@
|
|
|
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 chartModule = migration.createContentType('chartModule', {
|
|
8
|
+
name: 'Chart Module',
|
|
9
|
+
displayField: 'entryName',
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
addEntryNameField(chartModule)
|
|
13
|
+
|
|
14
|
+
chartModule
|
|
15
|
+
.createField('variant')
|
|
16
|
+
.name('Variant')
|
|
17
|
+
.type('Symbol')
|
|
18
|
+
.required(true)
|
|
19
|
+
.validations([
|
|
20
|
+
{
|
|
21
|
+
in: ['Single', 'Multi', 'Section'],
|
|
22
|
+
},
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
chartModule.changeFieldControl('variant', 'builtin', 'dropdown')
|
|
26
|
+
|
|
27
|
+
chartModule.createField('headline').name('Headline').type('Symbol')
|
|
28
|
+
|
|
29
|
+
chartModule
|
|
30
|
+
.createField('subHeadline')
|
|
31
|
+
.name('Sub Headline')
|
|
32
|
+
.type('RichText')
|
|
33
|
+
.validations([
|
|
34
|
+
{
|
|
35
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
36
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
enabledNodeTypes: ['heading-3', 'heading-4'],
|
|
40
|
+
message: 'Only heading 3 and heading 4 nodes are allowed',
|
|
41
|
+
},
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
chartModule
|
|
45
|
+
.createField('bodyCopy')
|
|
46
|
+
.name('Body Copy')
|
|
47
|
+
.type('RichText')
|
|
48
|
+
.validations([
|
|
49
|
+
{
|
|
50
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
51
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
enabledNodeTypes: [
|
|
55
|
+
'heading-3',
|
|
56
|
+
'heading-4',
|
|
57
|
+
'unordered-list',
|
|
58
|
+
'ordered-list',
|
|
59
|
+
'hyperlink',
|
|
60
|
+
],
|
|
61
|
+
message:
|
|
62
|
+
'Only heading 3, heading 4, unordered list, ordered list, and hyperlink nodes are allowed',
|
|
63
|
+
},
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
chartModule
|
|
67
|
+
.createField('footer')
|
|
68
|
+
.name('Footer')
|
|
69
|
+
.type('RichText')
|
|
70
|
+
.validations([
|
|
71
|
+
{
|
|
72
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
73
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
enabledNodeTypes: ['hyperlink'],
|
|
77
|
+
message: 'Only hyperlink nodes are allowed',
|
|
78
|
+
},
|
|
79
|
+
])
|
|
80
|
+
|
|
81
|
+
chartModule
|
|
82
|
+
.createField('chartHeadline')
|
|
83
|
+
.name('Chart Headline')
|
|
84
|
+
.type('Symbol')
|
|
85
|
+
|
|
86
|
+
chartModule
|
|
87
|
+
.createField('chartBodyCopy')
|
|
88
|
+
.name('Chart Body Copy')
|
|
89
|
+
.type('Symbol')
|
|
90
|
+
|
|
91
|
+
chartModule
|
|
92
|
+
.createField('chartType')
|
|
93
|
+
.name('Chart Type')
|
|
94
|
+
.type('Symbol')
|
|
95
|
+
.validations([
|
|
96
|
+
{
|
|
97
|
+
in: ['pie', 'doughnut'],
|
|
98
|
+
},
|
|
99
|
+
])
|
|
100
|
+
|
|
101
|
+
chartModule.changeFieldControl('chartType', 'builtin', 'dropdown')
|
|
102
|
+
|
|
103
|
+
chartModule
|
|
104
|
+
.createField('chartData')
|
|
105
|
+
.name('Chart Data')
|
|
106
|
+
.type('Object')
|
|
107
|
+
|
|
108
|
+
chartModule
|
|
109
|
+
.createField('backgroundColor')
|
|
110
|
+
.name('Background Color')
|
|
111
|
+
.type('Symbol')
|
|
112
|
+
|
|
113
|
+
chartModule.changeFieldControl(
|
|
114
|
+
'backgroundColor',
|
|
115
|
+
'app',
|
|
116
|
+
process.env.COLOR_PICKER_APP_ID
|
|
117
|
+
)
|
|
118
|
+
},
|
|
119
|
+
down: async function (migration) {
|
|
120
|
+
await migration.deleteContentType('chartModule')
|
|
121
|
+
},
|
|
122
|
+
}
|