@cooperco/cooper-component-library 0.1.71 → 0.1.73
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/0062-create-new-article.cjs +231 -0
- package/dist/cms/0063-update-accordion-item-types.cjs +36 -0
- package/dist/cms/contentful/migrations/scripts/0062-create-new-article.cjs +231 -0
- package/dist/cms/contentful/migrations/scripts/0063-update-accordion-item-types.cjs +36 -0
- package/dist/cms/contentful/migrations/scripts-entries/migrate-legacy-articles.cjs +275 -0
- package/dist/cms/migrate-legacy-articles.cjs +275 -0
- package/dist/cms/migrations/scripts/0062-create-new-article.cjs +231 -0
- package/dist/cms/migrations/scripts/0063-update-accordion-item-types.cjs +36 -0
- package/dist/cms/migrations/scripts-entries/migrate-legacy-articles.cjs +275 -0
- package/dist/cms/scripts/0062-create-new-article.cjs +231 -0
- package/dist/cms/scripts/0063-update-accordion-item-types.cjs +36 -0
- package/dist/cms/scripts-entries/migrate-legacy-articles.cjs +275 -0
- package/dist/lib/component-lib.js +2495 -2413
- package/dist/lib/component-lib.umd.cjs +22 -22
- package/dist/lib/style.css +1 -1
- package/dist/types/src/components/Accordion/Accordion.d.ts +1 -1
- package/dist/types/src/components/Accordion/AccordionItem.d.ts +8 -1
- package/dist/types/src/config/defaultPassthrough/index.d.ts +5 -0
- package/package.json +3 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const article = migration.createContentType('blog-article', {
|
|
6
|
+
name: 'Blog Article',
|
|
7
|
+
description: 'Article content',
|
|
8
|
+
displayField: 'slug',
|
|
9
|
+
})
|
|
10
|
+
// Add slug field
|
|
11
|
+
article.createField('slug', {
|
|
12
|
+
name: 'Slug',
|
|
13
|
+
type: 'Symbol',
|
|
14
|
+
required: true,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
// Add heading field
|
|
18
|
+
article.createField('heading', {
|
|
19
|
+
name: 'Heading',
|
|
20
|
+
type: 'Symbol',
|
|
21
|
+
required: true,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// Add image field
|
|
25
|
+
article.createField('image',{
|
|
26
|
+
name: 'Image',
|
|
27
|
+
type: 'Link',
|
|
28
|
+
linkType: 'Asset',
|
|
29
|
+
required: false
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Add summary field
|
|
33
|
+
article.createField('summary', {
|
|
34
|
+
name: 'Summary',
|
|
35
|
+
type: 'RichText',
|
|
36
|
+
required: false,
|
|
37
|
+
validations: [
|
|
38
|
+
{
|
|
39
|
+
enabledMarks: [
|
|
40
|
+
'bold',
|
|
41
|
+
'italic',
|
|
42
|
+
'underline',
|
|
43
|
+
'code',
|
|
44
|
+
'superscript',
|
|
45
|
+
'subscript',
|
|
46
|
+
'strikethrough',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
enabledNodeTypes: [
|
|
51
|
+
'heading-1',
|
|
52
|
+
'heading-2',
|
|
53
|
+
'heading-3',
|
|
54
|
+
'heading-4',
|
|
55
|
+
'heading-5',
|
|
56
|
+
'heading-6',
|
|
57
|
+
'ordered-list',
|
|
58
|
+
'unordered-list',
|
|
59
|
+
'blockquote',
|
|
60
|
+
'hr',
|
|
61
|
+
'embedded-entry-block',
|
|
62
|
+
'embedded-asset-block',
|
|
63
|
+
'embedded-entry-inline',
|
|
64
|
+
'hyperlink',
|
|
65
|
+
'entry-hyperlink',
|
|
66
|
+
'asset-hyperlink',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Add content field
|
|
73
|
+
article.createField('content', {
|
|
74
|
+
name: 'Content',
|
|
75
|
+
type: 'RichText',
|
|
76
|
+
required: false,
|
|
77
|
+
validations: [
|
|
78
|
+
{
|
|
79
|
+
enabledMarks: [
|
|
80
|
+
'bold',
|
|
81
|
+
'italic',
|
|
82
|
+
'underline',
|
|
83
|
+
'code',
|
|
84
|
+
'superscript',
|
|
85
|
+
'subscript',
|
|
86
|
+
'strikethrough',
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
enabledNodeTypes: [
|
|
91
|
+
'heading-1',
|
|
92
|
+
'heading-2',
|
|
93
|
+
'heading-3',
|
|
94
|
+
'heading-4',
|
|
95
|
+
'heading-5',
|
|
96
|
+
'heading-6',
|
|
97
|
+
'ordered-list',
|
|
98
|
+
'unordered-list',
|
|
99
|
+
'blockquote',
|
|
100
|
+
'hr',
|
|
101
|
+
'embedded-entry-block',
|
|
102
|
+
'embedded-asset-block',
|
|
103
|
+
'embedded-entry-inline',
|
|
104
|
+
'hyperlink',
|
|
105
|
+
'entry-hyperlink',
|
|
106
|
+
'asset-hyperlink',
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// Add footnote field
|
|
113
|
+
article.createField('footnote', {
|
|
114
|
+
name: 'Footnote',
|
|
115
|
+
type: 'RichText',
|
|
116
|
+
required: false,
|
|
117
|
+
validations: [
|
|
118
|
+
{
|
|
119
|
+
enabledMarks: [
|
|
120
|
+
'bold',
|
|
121
|
+
'italic',
|
|
122
|
+
'underline',
|
|
123
|
+
'code',
|
|
124
|
+
'superscript',
|
|
125
|
+
'subscript',
|
|
126
|
+
'strikethrough',
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
enabledNodeTypes: [
|
|
131
|
+
'heading-1',
|
|
132
|
+
'heading-2',
|
|
133
|
+
'heading-3',
|
|
134
|
+
'heading-4',
|
|
135
|
+
'heading-5',
|
|
136
|
+
'heading-6',
|
|
137
|
+
'ordered-list',
|
|
138
|
+
'unordered-list',
|
|
139
|
+
'blockquote',
|
|
140
|
+
'hr',
|
|
141
|
+
'embedded-entry-block',
|
|
142
|
+
'embedded-asset-block',
|
|
143
|
+
'embedded-entry-inline',
|
|
144
|
+
'hyperlink',
|
|
145
|
+
'entry-hyperlink',
|
|
146
|
+
'asset-hyperlink',
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
// Add heading field
|
|
153
|
+
article.createField('author', {
|
|
154
|
+
name: 'Author',
|
|
155
|
+
type: 'Symbol',
|
|
156
|
+
required: false,
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
//Add top field
|
|
160
|
+
article.createField('top', {
|
|
161
|
+
name: 'Top',
|
|
162
|
+
type: 'Boolean',
|
|
163
|
+
required: false,
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
// Add heading field
|
|
167
|
+
article.createField('instagram', {
|
|
168
|
+
name: 'Instagram',
|
|
169
|
+
type: 'Symbol',
|
|
170
|
+
required: false,
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
// Add categories field
|
|
174
|
+
article.createField('categories', {
|
|
175
|
+
name: 'Categories',
|
|
176
|
+
type: 'Array',
|
|
177
|
+
items: {
|
|
178
|
+
type: 'Symbol',
|
|
179
|
+
validations: [],
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
//Add top field
|
|
184
|
+
article.createField('active', {
|
|
185
|
+
name: 'Active',
|
|
186
|
+
type: 'Boolean',
|
|
187
|
+
required: false,
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
//Add date field
|
|
191
|
+
article.createField('date', {
|
|
192
|
+
name: 'Date',
|
|
193
|
+
type: 'Date',
|
|
194
|
+
required: false,
|
|
195
|
+
})
|
|
196
|
+
article.changeFieldControl('date', 'builtin', 'datePicker', {
|
|
197
|
+
format: 'dateAndTime',
|
|
198
|
+
ampm: '24',
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
//Add comments field
|
|
202
|
+
article.createField('comments', {
|
|
203
|
+
name: 'Comments',
|
|
204
|
+
type: 'Array',
|
|
205
|
+
items: {
|
|
206
|
+
type: 'Link',
|
|
207
|
+
linkType: 'Entry',
|
|
208
|
+
validations: [],
|
|
209
|
+
},
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
//Add article type field
|
|
213
|
+
article.createField('articleType', {
|
|
214
|
+
name: 'Article Type',
|
|
215
|
+
type: 'Symbol',
|
|
216
|
+
required: false,
|
|
217
|
+
validations: [
|
|
218
|
+
{
|
|
219
|
+
in: ['Default', 'HCP'],
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
})
|
|
223
|
+
article.changeFieldControl('articleType', 'builtin', 'dropdown', {
|
|
224
|
+
helpText: 'Select the type of article',
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
},
|
|
228
|
+
down: function (migration) {
|
|
229
|
+
migration.deleteContentType('blog-article')
|
|
230
|
+
},
|
|
231
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
3
|
+
up: function (migration) {
|
|
4
|
+
const accordion = migration.editContentType('accordion')
|
|
5
|
+
|
|
6
|
+
accordion
|
|
7
|
+
.editField('accordionItem')
|
|
8
|
+
.items({
|
|
9
|
+
type: 'Link',
|
|
10
|
+
validations: [
|
|
11
|
+
{
|
|
12
|
+
linkContentType: ['accordionItem', 'accordion'],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
linkType: 'Entry',
|
|
16
|
+
})
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
20
|
+
down: async function (migration) {
|
|
21
|
+
const accordion = migration.editContentType('accordion')
|
|
22
|
+
|
|
23
|
+
accordion
|
|
24
|
+
.editField('accordionItem')
|
|
25
|
+
.items({
|
|
26
|
+
type: 'Link',
|
|
27
|
+
validations: [
|
|
28
|
+
{
|
|
29
|
+
linkContentType: ['accordionItem'],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
linkType: 'Entry',
|
|
33
|
+
})
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const article = migration.createContentType('blog-article', {
|
|
6
|
+
name: 'Blog Article',
|
|
7
|
+
description: 'Article content',
|
|
8
|
+
displayField: 'slug',
|
|
9
|
+
})
|
|
10
|
+
// Add slug field
|
|
11
|
+
article.createField('slug', {
|
|
12
|
+
name: 'Slug',
|
|
13
|
+
type: 'Symbol',
|
|
14
|
+
required: true,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
// Add heading field
|
|
18
|
+
article.createField('heading', {
|
|
19
|
+
name: 'Heading',
|
|
20
|
+
type: 'Symbol',
|
|
21
|
+
required: true,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// Add image field
|
|
25
|
+
article.createField('image',{
|
|
26
|
+
name: 'Image',
|
|
27
|
+
type: 'Link',
|
|
28
|
+
linkType: 'Asset',
|
|
29
|
+
required: false
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Add summary field
|
|
33
|
+
article.createField('summary', {
|
|
34
|
+
name: 'Summary',
|
|
35
|
+
type: 'RichText',
|
|
36
|
+
required: false,
|
|
37
|
+
validations: [
|
|
38
|
+
{
|
|
39
|
+
enabledMarks: [
|
|
40
|
+
'bold',
|
|
41
|
+
'italic',
|
|
42
|
+
'underline',
|
|
43
|
+
'code',
|
|
44
|
+
'superscript',
|
|
45
|
+
'subscript',
|
|
46
|
+
'strikethrough',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
enabledNodeTypes: [
|
|
51
|
+
'heading-1',
|
|
52
|
+
'heading-2',
|
|
53
|
+
'heading-3',
|
|
54
|
+
'heading-4',
|
|
55
|
+
'heading-5',
|
|
56
|
+
'heading-6',
|
|
57
|
+
'ordered-list',
|
|
58
|
+
'unordered-list',
|
|
59
|
+
'blockquote',
|
|
60
|
+
'hr',
|
|
61
|
+
'embedded-entry-block',
|
|
62
|
+
'embedded-asset-block',
|
|
63
|
+
'embedded-entry-inline',
|
|
64
|
+
'hyperlink',
|
|
65
|
+
'entry-hyperlink',
|
|
66
|
+
'asset-hyperlink',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Add content field
|
|
73
|
+
article.createField('content', {
|
|
74
|
+
name: 'Content',
|
|
75
|
+
type: 'RichText',
|
|
76
|
+
required: false,
|
|
77
|
+
validations: [
|
|
78
|
+
{
|
|
79
|
+
enabledMarks: [
|
|
80
|
+
'bold',
|
|
81
|
+
'italic',
|
|
82
|
+
'underline',
|
|
83
|
+
'code',
|
|
84
|
+
'superscript',
|
|
85
|
+
'subscript',
|
|
86
|
+
'strikethrough',
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
enabledNodeTypes: [
|
|
91
|
+
'heading-1',
|
|
92
|
+
'heading-2',
|
|
93
|
+
'heading-3',
|
|
94
|
+
'heading-4',
|
|
95
|
+
'heading-5',
|
|
96
|
+
'heading-6',
|
|
97
|
+
'ordered-list',
|
|
98
|
+
'unordered-list',
|
|
99
|
+
'blockquote',
|
|
100
|
+
'hr',
|
|
101
|
+
'embedded-entry-block',
|
|
102
|
+
'embedded-asset-block',
|
|
103
|
+
'embedded-entry-inline',
|
|
104
|
+
'hyperlink',
|
|
105
|
+
'entry-hyperlink',
|
|
106
|
+
'asset-hyperlink',
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// Add footnote field
|
|
113
|
+
article.createField('footnote', {
|
|
114
|
+
name: 'Footnote',
|
|
115
|
+
type: 'RichText',
|
|
116
|
+
required: false,
|
|
117
|
+
validations: [
|
|
118
|
+
{
|
|
119
|
+
enabledMarks: [
|
|
120
|
+
'bold',
|
|
121
|
+
'italic',
|
|
122
|
+
'underline',
|
|
123
|
+
'code',
|
|
124
|
+
'superscript',
|
|
125
|
+
'subscript',
|
|
126
|
+
'strikethrough',
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
enabledNodeTypes: [
|
|
131
|
+
'heading-1',
|
|
132
|
+
'heading-2',
|
|
133
|
+
'heading-3',
|
|
134
|
+
'heading-4',
|
|
135
|
+
'heading-5',
|
|
136
|
+
'heading-6',
|
|
137
|
+
'ordered-list',
|
|
138
|
+
'unordered-list',
|
|
139
|
+
'blockquote',
|
|
140
|
+
'hr',
|
|
141
|
+
'embedded-entry-block',
|
|
142
|
+
'embedded-asset-block',
|
|
143
|
+
'embedded-entry-inline',
|
|
144
|
+
'hyperlink',
|
|
145
|
+
'entry-hyperlink',
|
|
146
|
+
'asset-hyperlink',
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
// Add heading field
|
|
153
|
+
article.createField('author', {
|
|
154
|
+
name: 'Author',
|
|
155
|
+
type: 'Symbol',
|
|
156
|
+
required: false,
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
//Add top field
|
|
160
|
+
article.createField('top', {
|
|
161
|
+
name: 'Top',
|
|
162
|
+
type: 'Boolean',
|
|
163
|
+
required: false,
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
// Add heading field
|
|
167
|
+
article.createField('instagram', {
|
|
168
|
+
name: 'Instagram',
|
|
169
|
+
type: 'Symbol',
|
|
170
|
+
required: false,
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
// Add categories field
|
|
174
|
+
article.createField('categories', {
|
|
175
|
+
name: 'Categories',
|
|
176
|
+
type: 'Array',
|
|
177
|
+
items: {
|
|
178
|
+
type: 'Symbol',
|
|
179
|
+
validations: [],
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
//Add top field
|
|
184
|
+
article.createField('active', {
|
|
185
|
+
name: 'Active',
|
|
186
|
+
type: 'Boolean',
|
|
187
|
+
required: false,
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
//Add date field
|
|
191
|
+
article.createField('date', {
|
|
192
|
+
name: 'Date',
|
|
193
|
+
type: 'Date',
|
|
194
|
+
required: false,
|
|
195
|
+
})
|
|
196
|
+
article.changeFieldControl('date', 'builtin', 'datePicker', {
|
|
197
|
+
format: 'dateAndTime',
|
|
198
|
+
ampm: '24',
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
//Add comments field
|
|
202
|
+
article.createField('comments', {
|
|
203
|
+
name: 'Comments',
|
|
204
|
+
type: 'Array',
|
|
205
|
+
items: {
|
|
206
|
+
type: 'Link',
|
|
207
|
+
linkType: 'Entry',
|
|
208
|
+
validations: [],
|
|
209
|
+
},
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
//Add article type field
|
|
213
|
+
article.createField('articleType', {
|
|
214
|
+
name: 'Article Type',
|
|
215
|
+
type: 'Symbol',
|
|
216
|
+
required: false,
|
|
217
|
+
validations: [
|
|
218
|
+
{
|
|
219
|
+
in: ['Default', 'HCP'],
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
})
|
|
223
|
+
article.changeFieldControl('articleType', 'builtin', 'dropdown', {
|
|
224
|
+
helpText: 'Select the type of article',
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
},
|
|
228
|
+
down: function (migration) {
|
|
229
|
+
migration.deleteContentType('blog-article')
|
|
230
|
+
},
|
|
231
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
3
|
+
up: function (migration) {
|
|
4
|
+
const accordion = migration.editContentType('accordion')
|
|
5
|
+
|
|
6
|
+
accordion
|
|
7
|
+
.editField('accordionItem')
|
|
8
|
+
.items({
|
|
9
|
+
type: 'Link',
|
|
10
|
+
validations: [
|
|
11
|
+
{
|
|
12
|
+
linkContentType: ['accordionItem', 'accordion'],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
linkType: 'Entry',
|
|
16
|
+
})
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
20
|
+
down: async function (migration) {
|
|
21
|
+
const accordion = migration.editContentType('accordion')
|
|
22
|
+
|
|
23
|
+
accordion
|
|
24
|
+
.editField('accordionItem')
|
|
25
|
+
.items({
|
|
26
|
+
type: 'Link',
|
|
27
|
+
validations: [
|
|
28
|
+
{
|
|
29
|
+
linkContentType: ['accordionItem'],
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
linkType: 'Entry',
|
|
33
|
+
})
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|