@cooperco/cooper-component-library 0.1.78 → 0.1.80

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 (47) hide show
  1. package/dist/cms/0065-create-hello-banner.cjs +62 -0
  2. package/dist/cms/0066-add-tile-collection-to-container-module.cjs +86 -0
  3. package/dist/cms/0067-add-cta-to-tile-collection-module.cjs +37 -0
  4. package/dist/cms/0068-add-body-copy-alignment-to-tile-content.cjs +35 -0
  5. package/dist/cms/0069-add-footer-to-tile-content.cjs +25 -0
  6. package/dist/cms/containerModule.query.ts +22 -0
  7. package/dist/cms/contentful/migrations/drafts/create-hello-banner.cjs +62 -0
  8. package/dist/cms/contentful/migrations/scripts/0065-create-hello-banner.cjs +62 -0
  9. package/dist/cms/contentful/migrations/scripts/0066-add-tile-collection-to-container-module.cjs +86 -0
  10. package/dist/cms/contentful/migrations/scripts/0067-add-cta-to-tile-collection-module.cjs +37 -0
  11. package/dist/cms/contentful/migrations/scripts/0068-add-body-copy-alignment-to-tile-content.cjs +35 -0
  12. package/dist/cms/contentful/migrations/scripts/0069-add-footer-to-tile-content.cjs +25 -0
  13. package/dist/cms/contentful/queries/containerModule.query.js +22 -0
  14. package/dist/cms/contentful/queries/containerModule.query.ts +22 -0
  15. package/dist/cms/contentful/queries/fragments.js +2 -0
  16. package/dist/cms/contentful/queries/fragments.ts +2 -0
  17. package/dist/cms/contentful/queries/tileCollection.query.js +7 -1
  18. package/dist/cms/contentful/queries/tileCollection.query.ts +11 -1
  19. package/dist/cms/create-hello-banner.cjs +62 -0
  20. package/dist/cms/drafts/create-hello-banner.cjs +62 -0
  21. package/dist/cms/fragments.ts +2 -0
  22. package/dist/cms/migrations/drafts/create-hello-banner.cjs +62 -0
  23. package/dist/cms/migrations/scripts/0065-create-hello-banner.cjs +62 -0
  24. package/dist/cms/migrations/scripts/0066-add-tile-collection-to-container-module.cjs +86 -0
  25. package/dist/cms/migrations/scripts/0067-add-cta-to-tile-collection-module.cjs +37 -0
  26. package/dist/cms/migrations/scripts/0068-add-body-copy-alignment-to-tile-content.cjs +35 -0
  27. package/dist/cms/migrations/scripts/0069-add-footer-to-tile-content.cjs +25 -0
  28. package/dist/cms/queries/containerModule.query.ts +22 -0
  29. package/dist/cms/queries/fragments.ts +2 -0
  30. package/dist/cms/queries/tileCollection.query.ts +11 -1
  31. package/dist/cms/scripts/0065-create-hello-banner.cjs +62 -0
  32. package/dist/cms/scripts/0066-add-tile-collection-to-container-module.cjs +86 -0
  33. package/dist/cms/scripts/0067-add-cta-to-tile-collection-module.cjs +37 -0
  34. package/dist/cms/scripts/0068-add-body-copy-alignment-to-tile-content.cjs +35 -0
  35. package/dist/cms/scripts/0069-add-footer-to-tile-content.cjs +25 -0
  36. package/dist/cms/tileCollection.query.ts +11 -1
  37. package/dist/lib/component-lib.js +1693 -1687
  38. package/dist/lib/component-lib.umd.cjs +19 -19
  39. package/dist/lib/style.css +1 -1
  40. package/dist/types/src/components/HelloBanner/HelloBanner.d.ts +23 -0
  41. package/dist/types/src/components/HelloBanner/HelloBanner.vue.d.ts +3 -0
  42. package/dist/types/src/components/TileContent/TileContent.d.ts +1 -0
  43. package/dist/types/src/components/components.d.ts +1 -1
  44. package/dist/types/src/components/types.d.ts +1 -1
  45. package/dist/types/src/config/defaultPassthrough/index.d.ts +2 -2
  46. package/dist/types/src/config/defaultPassthrough/types.d.ts +3 -3
  47. package/package.json +116 -112
@@ -0,0 +1,62 @@
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 helloBanner = migration.createContentType('helloBanner', {
8
+ name: 'Hello Banner',
9
+ displayField: 'entryName',
10
+ description: 'Manage the hello banner component',
11
+ })
12
+
13
+ // Add required entryName field
14
+ addEntryNameField(helloBanner)
15
+
16
+ // Active field
17
+ helloBanner
18
+ .createField('active')
19
+ .name('Active')
20
+ .type('Boolean')
21
+ .required(true)
22
+ .defaultValue({ 'en-US': false })
23
+ helloBanner.changeFieldControl('active', 'builtin', 'boolean', {
24
+ helpText: 'Toggle to show/hide the hello banner',
25
+ })
26
+
27
+ // Full Copy field
28
+ helloBanner
29
+ .createField('fullCopy')
30
+ .name('Full Copy')
31
+ .type('Text')
32
+ .required(true)
33
+ helloBanner.changeFieldControl('fullCopy', 'builtin', 'multipleLine', {
34
+ helpText: 'Main promotional text displayed on desktop and mobile expanded',
35
+ })
36
+
37
+ // Mobile Collapsed field
38
+ helloBanner
39
+ .createField('mobileCollapsed')
40
+ .name('Mobile Collapsed')
41
+ .type('Symbol')
42
+ .required(true)
43
+ helloBanner.changeFieldControl('mobileCollapsed', 'builtin', 'singleLine', {
44
+ helpText: 'Text displayed when the hello banner is collapsed on mobile devices',
45
+ })
46
+
47
+ // CTA reference
48
+ helloBanner.createField('cta', {
49
+ name: 'CTA',
50
+ type: 'Link',
51
+ linkType: 'Entry',
52
+ required: false,
53
+ validations: [{ linkContentType: ['cta'] }],
54
+ })
55
+ helloBanner.changeFieldControl('cta', 'builtin', 'entryLinkEditor', {
56
+ helpText: 'Call-to-action button or link',
57
+ })
58
+ },
59
+ down: async function (migration) {
60
+ await migration.deleteContentType('helloBanner')
61
+ },
62
+ }
@@ -0,0 +1,86 @@
1
+ module.exports = {
2
+ // @ts-check
3
+ /** @type { import('contentful-migration').MigrationFunction } */
4
+ up: function (migration) {
5
+ const containerModule = migration.editContentType('containerModule')
6
+
7
+ // Add tileCollectionModule to fullWidthContent validations
8
+ containerModule.editField('fullWidthContent').validations([
9
+ {
10
+ linkContentType: [
11
+ 'contentModule',
12
+ 'tileContent',
13
+ 'accordion',
14
+ 'tileCollectionModule',
15
+ ],
16
+ },
17
+ ])
18
+
19
+ // Add tileCollectionModule to leftContent validations
20
+ containerModule.editField('leftContent').validations([
21
+ {
22
+ linkContentType: [
23
+ 'contentModule',
24
+ 'tileContent',
25
+ 'accordion',
26
+ 'image',
27
+ 'video',
28
+ 'tileCollectionModule',
29
+ ],
30
+ },
31
+ ])
32
+
33
+ // Add tileCollectionModule to rightContent validations
34
+ containerModule.editField('rightContent').validations([
35
+ {
36
+ linkContentType: [
37
+ 'contentModule',
38
+ 'tileContent',
39
+ 'accordion',
40
+ 'image',
41
+ 'video',
42
+ 'tileCollectionModule',
43
+ ],
44
+ },
45
+ ])
46
+ },
47
+
48
+ // @ts-check
49
+ /** @type { import('contentful-migration').MigrationFunction } */
50
+ down: function (migration) {
51
+ const containerModule = migration.editContentType('containerModule')
52
+
53
+ // Revert fullWidthContent to original validations
54
+ containerModule.editField('fullWidthContent').validations([
55
+ {
56
+ linkContentType: ['contentModule', 'tileContent', 'accordion'],
57
+ },
58
+ ])
59
+
60
+ // Revert leftContent to original validations
61
+ containerModule.editField('leftContent').validations([
62
+ {
63
+ linkContentType: [
64
+ 'contentModule',
65
+ 'tileContent',
66
+ 'accordion',
67
+ 'image',
68
+ 'video',
69
+ ],
70
+ },
71
+ ])
72
+
73
+ // Revert rightContent to original validations
74
+ containerModule.editField('rightContent').validations([
75
+ {
76
+ linkContentType: [
77
+ 'contentModule',
78
+ 'tileContent',
79
+ 'accordion',
80
+ 'image',
81
+ 'video',
82
+ ],
83
+ },
84
+ ])
85
+ },
86
+ }
@@ -0,0 +1,37 @@
1
+ module.exports = {
2
+ // @ts-check
3
+ /** @type { import('contentful-migration').MigrationFunction } */
4
+ up: function (migration) {
5
+ const tileCollectionModule =
6
+ migration.editContentType('tileCollectionModule')
7
+
8
+ tileCollectionModule
9
+ .createField('ctas')
10
+ .name('CTAs')
11
+ .type('Array')
12
+ .items({
13
+ type: 'Link',
14
+ linkType: 'Entry',
15
+ validations: [{ linkContentType: ['cta'] }],
16
+ })
17
+ .validations([{ size: { max: 4 } }])
18
+ tileCollectionModule.changeFieldControl(
19
+ 'ctas',
20
+ 'builtin',
21
+ 'entryLinksEditor',
22
+ {
23
+ helpText: 'Call-to-action buttons displayed below the tile collection',
24
+ }
25
+ )
26
+
27
+ tileCollectionModule.moveField('ctas').afterField('tiles')
28
+ },
29
+
30
+ // @ts-check
31
+ /** @type { import('contentful-migration').MigrationFunction } */
32
+ down: function (migration) {
33
+ const tileCollectionModule =
34
+ migration.editContentType('tileCollectionModule')
35
+ tileCollectionModule.deleteField('ctas')
36
+ },
37
+ }
@@ -0,0 +1,35 @@
1
+ module.exports = {
2
+ // @ts-check
3
+ /** @type { import('contentful-migration').MigrationFunction } */
4
+ up: function (migration) {
5
+ const tileContent = migration.editContentType('tileContent')
6
+
7
+ tileContent.createField('bodyCopyAlignment', {
8
+ name: 'Body Copy Alignment',
9
+ type: 'Symbol',
10
+ validations: [
11
+ {
12
+ in: ['Left', 'Center', 'Right'],
13
+ },
14
+ ],
15
+ })
16
+ tileContent.changeFieldControl(
17
+ 'bodyCopyAlignment',
18
+ 'builtin',
19
+ 'dropdown',
20
+ {
21
+ helpText:
22
+ 'Override the body copy text alignment independently from the general alignment. If not set, body copy will follow the general alignment.',
23
+ }
24
+ )
25
+
26
+ tileContent.moveField('bodyCopyAlignment').afterField('bodyCopy')
27
+ },
28
+
29
+ // @ts-check
30
+ /** @type { import('contentful-migration').MigrationFunction } */
31
+ down: function (migration) {
32
+ const tileContent = migration.editContentType('tileContent')
33
+ tileContent.deleteField('bodyCopyAlignment')
34
+ },
35
+ }
@@ -0,0 +1,25 @@
1
+ module.exports = {
2
+ // @ts-check
3
+ /** @type { import('contentful-migration').MigrationFunction } */
4
+ up: function (migration) {
5
+ const tileContent = migration.editContentType('tileContent')
6
+
7
+ tileContent.createField('footer', {
8
+ name: 'Footer',
9
+ type: 'Symbol',
10
+ })
11
+ tileContent.changeFieldControl('footer', 'builtin', 'singleLine', {
12
+ helpText: 'Optional footer text displayed below the body copy and CTAs.',
13
+ })
14
+
15
+ tileContent.moveField('footer').afterField('bodyCopyAlignment')
16
+ tileContent.moveField('backgroundColor').afterField('tileLabel')
17
+ },
18
+
19
+ // @ts-check
20
+ /** @type { import('contentful-migration').MigrationFunction } */
21
+ down: function (migration) {
22
+ const tileContent = migration.editContentType('tileContent')
23
+ tileContent.deleteField('footer')
24
+ },
25
+ }
@@ -1,6 +1,10 @@
1
1
  import { gql } from 'graphql-tag'
2
2
  import type { DocumentNode } from 'graphql'
3
- import { tileContentFragment, tileLabelFragment } from './fragments.js'
3
+ import {
4
+ tileContentFragment,
5
+ tileLabelFragment,
6
+ ctaFragment,
7
+ } from './fragments.js'
4
8
 
5
9
  export const getTileContent: DocumentNode = gql`
6
10
  ${tileContentFragment}
@@ -22,6 +26,7 @@ export const getTileLabel: DocumentNode = gql`
22
26
 
23
27
  export const getTileCollection: DocumentNode = gql`
24
28
  ${tileContentFragment}
29
+ ${ctaFragment}
25
30
  query tileCollectionQuery($id: String!, $preview: Boolean = false) {
26
31
  tileCollectionModule(id: $id, preview: $preview) {
27
32
  headline
@@ -30,6 +35,11 @@ export const getTileCollection: DocumentNode = gql`
30
35
  ...tileContentFragment
31
36
  }
32
37
  }
38
+ ctasCollection(limit: 4) {
39
+ items {
40
+ ...ctaFragment
41
+ }
42
+ }
33
43
  backgroundColor
34
44
  variant
35
45
  tileLabelType