@financial-times/cp-content-pipeline-ui 6.15.6 → 7.0.0

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 (137) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/components/BigNumber/index.d.ts +4 -1
  3. package/lib/components/BigNumber/index.js +1 -1
  4. package/lib/components/BigNumber/index.js.map +1 -1
  5. package/lib/components/Body/index.test.js +12 -1
  6. package/lib/components/Body/index.test.js.map +1 -1
  7. package/lib/components/Byline/index.js +2 -2
  8. package/lib/components/Byline/index.js.map +1 -1
  9. package/lib/components/Clip/components/ClipTag.d.ts +3 -3
  10. package/lib/components/Clip/components/ClipTag.js.map +1 -1
  11. package/lib/components/Clip/components/ClosedCaptions.d.ts +2 -2
  12. package/lib/components/Clip/components/VideoDescription.d.ts +2 -2
  13. package/lib/components/Clip/components/VideoDescription.js.map +1 -1
  14. package/lib/components/Clip/template/component.d.ts +9 -4
  15. package/lib/components/Clip/template/component.js +19 -14
  16. package/lib/components/Clip/template/component.js.map +1 -1
  17. package/lib/components/Clip/test/fixtures.js +114 -77
  18. package/lib/components/Clip/test/fixtures.js.map +1 -1
  19. package/lib/components/Clip/test/snapshot.spec.js +110 -61
  20. package/lib/components/Clip/test/snapshot.spec.js.map +1 -1
  21. package/lib/components/Flourish/index.d.ts +4 -12
  22. package/lib/components/Flourish/index.js +1 -1
  23. package/lib/components/Flourish/index.js.map +1 -1
  24. package/lib/components/Flourish/test/snapshot.spec.js +48 -6
  25. package/lib/components/Flourish/test/snapshot.spec.js.map +1 -1
  26. package/lib/components/Heading/index.d.ts +2 -1
  27. package/lib/components/Heading/index.js +2 -2
  28. package/lib/components/Heading/index.js.map +1 -1
  29. package/lib/components/ImageOverrideWrappers/index.d.ts +4 -0
  30. package/lib/components/ImageOverrideWrappers/index.js +44 -0
  31. package/lib/components/ImageOverrideWrappers/index.js.map +1 -0
  32. package/lib/components/ImageSet/index.d.ts +12 -8
  33. package/lib/components/ImageSet/index.js +13 -8
  34. package/lib/components/ImageSet/index.js.map +1 -1
  35. package/lib/components/Layout/index.d.ts +3 -13
  36. package/lib/components/Layout/index.js +1 -1
  37. package/lib/components/Layout/index.js.map +1 -1
  38. package/lib/components/MainImage/index.js +2 -2
  39. package/lib/components/MainImage/index.js.map +1 -1
  40. package/lib/components/Paragraph/index.d.ts +4 -1
  41. package/lib/components/Paragraph/index.js.map +1 -1
  42. package/lib/components/Pullquote/index.d.ts +4 -1
  43. package/lib/components/Pullquote/index.js +7 -6
  44. package/lib/components/Pullquote/index.js.map +1 -1
  45. package/lib/components/Recommended/index.d.ts +5 -8
  46. package/lib/components/Recommended/index.js +1 -6
  47. package/lib/components/Recommended/index.js.map +1 -1
  48. package/lib/components/RichText/BasicComponents.d.ts +12 -11
  49. package/lib/components/RichText/BasicComponents.js +2 -2
  50. package/lib/components/RichText/BasicComponents.js.map +1 -1
  51. package/lib/components/RichText/index.d.ts +10 -3
  52. package/lib/components/RichText/index.js +8 -2
  53. package/lib/components/RichText/index.js.map +1 -1
  54. package/lib/components/Scrollytelling/ScrollyImage.d.ts +6 -3
  55. package/lib/components/Scrollytelling/ScrollyImage.js +2 -2
  56. package/lib/components/Scrollytelling/ScrollyImage.js.map +1 -1
  57. package/lib/components/Scrollytelling/index.d.ts +14 -6
  58. package/lib/components/Scrollytelling/index.js +3 -3
  59. package/lib/components/Scrollytelling/index.js.map +1 -1
  60. package/lib/components/Table/TableBody.d.ts +4 -1
  61. package/lib/components/Table/TableBody.js +1 -1
  62. package/lib/components/Table/TableBody.js.map +1 -1
  63. package/lib/components/Table/TableCell.d.ts +4 -4
  64. package/lib/components/Table/TableCell.js +2 -2
  65. package/lib/components/Table/TableCell.js.map +1 -1
  66. package/lib/components/Table/index.d.ts +4 -1
  67. package/lib/components/Table/index.js +1 -1
  68. package/lib/components/Table/index.js.map +1 -1
  69. package/lib/components/Topper/Picture.d.ts +1 -1
  70. package/lib/components/Topper/Picture.js +6 -3
  71. package/lib/components/Topper/Picture.js.map +1 -1
  72. package/lib/components/Topper/index.js +7 -1
  73. package/lib/components/Topper/index.js.map +1 -1
  74. package/lib/components/Tweet/index.d.ts +4 -2
  75. package/lib/components/Tweet/index.js +1 -1
  76. package/lib/components/Tweet/index.js.map +1 -1
  77. package/lib/components/Video/index.d.ts +4 -2
  78. package/lib/components/Video/index.js +1 -1
  79. package/lib/components/Video/index.js.map +1 -1
  80. package/lib/components/Workarounds.d.ts +88 -0
  81. package/lib/components/Workarounds.js +3 -0
  82. package/lib/components/Workarounds.js.map +1 -0
  83. package/lib/components/YoutubeVideo/index.d.ts +5 -2
  84. package/lib/components/YoutubeVideo/index.js +1 -1
  85. package/lib/components/YoutubeVideo/index.js.map +1 -1
  86. package/lib/components/types.d.ts +5 -0
  87. package/lib/components/types.js +3 -0
  88. package/lib/components/types.js.map +1 -0
  89. package/lib/context.d.ts +14 -0
  90. package/lib/context.js +2 -1
  91. package/lib/context.js.map +1 -1
  92. package/lib/index.d.ts +1 -1
  93. package/lib/index.js +2 -1
  94. package/lib/index.js.map +1 -1
  95. package/lib/stories/Clip.stories.d.ts +39 -243
  96. package/lib/stories/Clip.stories.js +320 -307
  97. package/lib/stories/Clip.stories.js.map +1 -1
  98. package/package.json +2 -1
  99. package/src/components/BigNumber/index.tsx +6 -3
  100. package/src/components/Body/__snapshots__/index.test.tsx.snap +2 -1
  101. package/src/components/Body/index.test.tsx +12 -1
  102. package/src/components/Byline/index.tsx +9 -4
  103. package/src/components/Clip/components/ClipTag.tsx +3 -6
  104. package/src/components/Clip/components/ClosedCaptions.tsx +2 -2
  105. package/src/components/Clip/components/VideoDescription.tsx +2 -2
  106. package/src/components/Clip/template/component.tsx +39 -41
  107. package/src/components/Clip/test/__snapshots__/snapshot.spec.tsx.snap +4 -8
  108. package/src/components/Clip/test/fixtures.ts +127 -90
  109. package/src/components/Clip/test/snapshot.spec.tsx +123 -102
  110. package/src/components/Flourish/index.tsx +10 -21
  111. package/src/components/Flourish/test/snapshot.spec.tsx +48 -36
  112. package/src/components/Heading/index.tsx +6 -5
  113. package/src/components/ImageOverrideWrappers/index.tsx +34 -0
  114. package/src/components/ImageSet/index.tsx +75 -55
  115. package/src/components/Layout/index.tsx +6 -18
  116. package/src/components/MainImage/index.tsx +10 -8
  117. package/src/components/Paragraph/index.tsx +4 -1
  118. package/src/components/Pullquote/index.tsx +15 -8
  119. package/src/components/Recommended/index.tsx +11 -11
  120. package/src/components/RichText/BasicComponents.tsx +22 -20
  121. package/src/components/RichText/index.tsx +35 -12
  122. package/src/components/Scrollytelling/ScrollyImage.tsx +10 -7
  123. package/src/components/Scrollytelling/index.tsx +19 -9
  124. package/src/components/Table/TableBody.tsx +7 -3
  125. package/src/components/Table/TableCell.tsx +9 -7
  126. package/src/components/Table/index.tsx +12 -9
  127. package/src/components/Topper/Picture.tsx +17 -12
  128. package/src/components/Topper/index.tsx +7 -4
  129. package/src/components/Tweet/index.tsx +4 -2
  130. package/src/components/Video/index.tsx +4 -6
  131. package/src/components/Workarounds.ts +188 -0
  132. package/src/components/YoutubeVideo/index.tsx +5 -4
  133. package/src/components/types.ts +6 -0
  134. package/src/context.ts +22 -1
  135. package/src/index.ts +4 -1
  136. package/src/stories/Clip.stories.tsx +357 -341
  137. package/tsconfig.tsbuildinfo +1 -1
@@ -5,108 +5,145 @@ if (typeof global.TextEncoder === 'undefined') {
5
5
  import Clip from '../template/index'
6
6
 
7
7
  export const inlineVideo = Clip({
8
- dataLayout: 'in-line',
9
- url: 'https://d1e00ek4ebabms.cloudfront.net/production/84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png',
10
- description:
11
- ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
12
- poster:
13
- 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
14
- caption: 'Aenean lobortis volutpat nunc vitae elementum',
8
+ content: {
9
+ type: 'clip',
10
+ id: '',
11
+ dataLayout: 'in-line',
12
+ url: 'https://d1e00ek4ebabms.cloudfront.net/production/84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png',
13
+ description:
14
+ ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
15
+ poster:
16
+ 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
17
+ posterAlt: '',
18
+ posterCredits: '',
19
+ caption: 'Aenean lobortis volutpat nunc vitae elementum',
20
+ autoplay: false,
21
+ muted: false,
22
+ loop: false,
23
+ credits: '',
24
+ },
15
25
  })
16
26
  export const inlineVideoAutoplay = Clip({
17
- dataLayout: 'in-line',
18
- url: 'https://d1e00ek4ebabms.cloudfront.net/production/84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png',
19
- description:
20
- ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
21
- poster:
22
- 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
23
- caption: 'Aenean lobortis volutpat nunc vitae elementum',
24
- autoplay: true,
25
- muted: true,
26
- loop: true,
27
- credits: 'Copyright Line',
28
- accessibility: {
29
- captions: [
30
- {
31
- url: 'https://next-media-api.ft.com/captions/16862228218010.vtt',
32
- },
33
- ],
27
+ content: {
28
+ type: 'clip',
29
+ id: '',
30
+ dataLayout: 'in-line',
31
+ url: 'https://d1e00ek4ebabms.cloudfront.net/production/84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png',
32
+ description:
33
+ ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
34
+ poster:
35
+ 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
36
+ posterAlt: '',
37
+ posterCredits: '',
38
+ caption: 'Aenean lobortis volutpat nunc vitae elementum',
39
+ autoplay: true,
40
+ muted: true,
41
+ loop: true,
42
+ credits: 'Copyright Line',
43
+ accessibility: {
44
+ captions: [
45
+ {
46
+ url: 'https://next-media-api.ft.com/captions/16862228218010.vtt',
47
+ },
48
+ ],
49
+ },
34
50
  },
35
51
  })
36
52
  export const inlineVideoNoAudio = Clip({
37
- dataLayout: 'in-line',
38
- url: 'https://d1e00ek4ebabms.cloudfront.net/production/84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png',
39
- description:
40
- ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
41
- poster:
42
- 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
43
- caption: 'Aenean lobortis volutpat nunc vitae elementum',
44
- autoplay: true,
45
- muted: true,
46
- loop: true,
47
- noAudio: true,
48
- credits: 'Copyright Line',
49
- accessibility: {
50
- captions: [
51
- {
52
- url: 'https://next-media-api.ft.com/captions/16862228218010.vtt',
53
- },
54
- ],
53
+ content: {
54
+ type: 'clip',
55
+ id: '',
56
+ dataLayout: 'in-line',
57
+ url: 'https://d1e00ek4ebabms.cloudfront.net/production/84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png',
58
+ description:
59
+ ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
60
+ poster:
61
+ 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
62
+ posterAlt: '',
63
+ posterCredits: '',
64
+ caption: 'Aenean lobortis volutpat nunc vitae elementum',
65
+ autoplay: true,
66
+ muted: true,
67
+ loop: true,
68
+ credits: 'Copyright Line',
69
+ accessibility: {
70
+ captions: [
71
+ {
72
+ url: 'https://next-media-api.ft.com/captions/16862228218010.vtt',
73
+ },
74
+ ],
75
+ },
76
+ noAudio: true,
55
77
  },
56
78
  })
57
79
 
58
80
  export const teaserClipWithoutExpander = Clip({
59
- dataLayout: 'in-line',
60
- url: 'https://d1e00ek4ebabms.cloudfront.net/production/84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png',
61
- description: '',
62
- poster:
63
- 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
64
- caption: '',
81
+ content: {
82
+ type: 'clip',
83
+ id: '',
84
+ dataLayout: 'in-line',
85
+ url: 'https://d1e00ek4ebabms.cloudfront.net/production/84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png',
86
+ description: '',
87
+ poster:
88
+ 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
89
+ posterAlt: '',
90
+ posterCredits: '',
91
+ caption: '',
92
+ autoplay: false,
93
+ muted: false,
94
+ loop: false,
95
+ credits: '',
96
+ },
65
97
  preset: 'thumbnail',
66
98
  })
67
99
 
68
100
  export const teaserClipWithMultipleSources = Clip({
69
- dataLayout: 'in-line',
70
- description:
71
- ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
72
- poster:
73
- 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
74
- caption: 'Aenean lobortis volutpat nunc vitae elementum',
75
- autoplay: true,
76
- muted: true,
77
- loop: true,
101
+ content: {
102
+ type: 'clip',
103
+ id: '',
104
+ url: '',
105
+ dataLayout: 'in-line',
106
+ description:
107
+ ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
108
+ poster:
109
+ 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
110
+ posterAlt: '',
111
+ posterCredits: '',
112
+ caption: 'Aenean lobortis volutpat nunc vitae elementum',
113
+ autoplay: true,
114
+ muted: true,
115
+ loop: true,
116
+ credits: 'Copyright Line',
117
+ clips: [
118
+ {
119
+ dataSource: [
120
+ {
121
+ binaryUrl:
122
+ 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/raw-media-files/17018837600780',
123
+ mediaType: 'video/mp4',
124
+ },
125
+ {
126
+ binaryUrl:
127
+ 'https://ark-clips-staging.s3.eu-west-1.amazonaws.com/raw-media-files/17018837600780',
128
+ mediaType: 'video/mp4',
129
+ },
130
+ {
131
+ binaryUrl:
132
+ 'https://k-clips-staging.s3.eu-west-1.amazonaws.com/raw-media-files/17018837600780',
133
+ mediaType: 'video/mp4',
134
+ },
135
+ ],
136
+ },
137
+ {
138
+ dataSource: [
139
+ {
140
+ binaryUrl:
141
+ 'https://ark-clips-staging.s3.eu-west-1.amazonaws.com/raw-media-files/17018837600780',
142
+ mediaType: 'video/mp4',
143
+ },
144
+ ],
145
+ },
146
+ ],
147
+ },
78
148
  preload: 'none',
79
- credits: 'Copyright Line',
80
- clips: [
81
- {
82
- dataSource: [
83
- {
84
- binaryUrl:
85
- 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/raw-media-files/17018837600780',
86
- mediaType: 'video/mp4',
87
- },
88
- {
89
- binaryUrl:
90
- 'https://ark-clips-staging.s3.eu-west-1.amazonaws.com/raw-media-files/17018837600780',
91
- mediaType: 'video/mp4',
92
- },
93
- {
94
- binaryUrl:
95
- 'https://k-clips-staging.s3.eu-west-1.amazonaws.com/raw-media-files/17018837600780',
96
- mediaType: 'video/mp4',
97
- },
98
- ],
99
- id: 'inline-1',
100
- },
101
- {
102
- dataSource: [
103
- {
104
- binaryUrl:
105
- 'https://ark-clips-staging.s3.eu-west-1.amazonaws.com/raw-media-files/17018837600780',
106
- mediaType: 'video/mp4',
107
- },
108
- ],
109
- id: 'inline-2',
110
- },
111
- ],
112
149
  })
@@ -27,19 +27,25 @@ describe('Clip Snapshot', () => {
27
27
 
28
28
  it('in-line render', () => {
29
29
  const tree = renderer
30
- .create(<ClipServer url={url} dataLayout="in-line"></ClipServer>)
30
+ .create(
31
+ <ClipServer content={{ url, dataLayout: 'in-line' }}></ClipServer>
32
+ )
31
33
  .toJSON()
32
34
  expect(formatString(tree)).toMatchSnapshot()
33
35
  })
34
36
  it('full-grid default render', () => {
35
37
  const tree = renderer
36
- .create(<ClipServer url={url} dataLayout="full-grid"></ClipServer>)
38
+ .create(
39
+ <ClipServer content={{ url, dataLayout: 'full-grid' }}></ClipServer>
40
+ )
37
41
  .toJSON()
38
42
  expect(formatString(tree)).toMatchSnapshot()
39
43
  })
40
44
  it('mid-grid default render', () => {
41
45
  const tree = renderer
42
- .create(<ClipServer url={url} dataLayout="mid-grid"></ClipServer>)
46
+ .create(
47
+ <ClipServer content={{ url, dataLayout: 'mid-grid' }}></ClipServer>
48
+ )
43
49
  .toJSON()
44
50
  expect(formatString(tree)).toMatchSnapshot()
45
51
  })
@@ -48,16 +54,18 @@ describe('Clip Snapshot', () => {
48
54
  const tree = renderer
49
55
  .create(
50
56
  <ClipServer
51
- url={url}
52
- dataLayout="in-line"
53
- autoplay
54
- loop
55
- description="Video description"
56
- caption="caption text"
57
- credits="@credits"
58
- poster={poster}
59
- posterAlt="text poster"
60
- mute
57
+ content={{
58
+ url,
59
+ dataLayout: 'in-line',
60
+ autoplay: true,
61
+ loop: true,
62
+ description: 'Video description',
63
+ caption: 'caption text',
64
+ credits: '@credits',
65
+ poster,
66
+ posterAlt: 'text poster',
67
+ muted: true,
68
+ }}
61
69
  ></ClipServer>
62
70
  )
63
71
  .toJSON()
@@ -67,16 +75,18 @@ describe('Clip Snapshot', () => {
67
75
  const tree = renderer
68
76
  .create(
69
77
  <ClipServer
70
- url={url}
71
- dataLayout="full-grid"
72
- autoplay
73
- loop
74
- description="Video description"
75
- caption="caption text"
76
- credits="@credits"
77
- poster={poster}
78
- posterAlt="text poster"
79
- mute
78
+ content={{
79
+ url,
80
+ dataLayout: 'full-grid',
81
+ autoplay: true,
82
+ loop: true,
83
+ description: 'Video description',
84
+ caption: 'caption text',
85
+ credits: '@credits',
86
+ poster,
87
+ posterAlt: 'text poster',
88
+ muted: true,
89
+ }}
80
90
  ></ClipServer>
81
91
  )
82
92
  .toJSON()
@@ -86,16 +96,18 @@ describe('Clip Snapshot', () => {
86
96
  const tree = renderer
87
97
  .create(
88
98
  <ClipServer
89
- url={url}
90
- dataLayout="mid-grid"
91
- autoplay
92
- loop
93
- description="Video description"
94
- caption="caption text"
95
- credits="@credits"
96
- poster={poster}
97
- posterAlt="text poster"
98
- mute
99
+ content={{
100
+ url,
101
+ dataLayout: 'mid-grid',
102
+ autoplay: true,
103
+ loop: true,
104
+ description: 'Video description',
105
+ caption: 'caption text',
106
+ credits: '@credits',
107
+ poster,
108
+ posterAlt: 'text poster',
109
+ muted: true,
110
+ }}
99
111
  ></ClipServer>
100
112
  )
101
113
  .toJSON()
@@ -104,37 +116,39 @@ describe('Clip Snapshot', () => {
104
116
 
105
117
  it('renders multiple video sources', () => {
106
118
  const videoWithMultipleSources = {
107
- dataLayout: 'in-line',
108
- id: '84d7e1b0-e8b2-4ffc-a798-306f29dc9d52',
109
- url: 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
110
- description:
111
- ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
112
- clips: [
113
- {
114
- dataSource: [
115
- {
116
- binaryUrl: 'https://whatever/1080x1920.mp4',
117
- mediaType: 'video/mp4',
118
- pixelHeight: 1080,
119
- pixelWidth: 1920,
120
- },
121
- {
122
- binaryUrl: 'https://whatever/320x240.mp4',
123
- mediaType: 'video/mp4',
124
- pixelHeight: 320,
125
- pixelWidth: 240,
126
- },
127
- {
128
- binaryUrl: 'https://whatever/640x480.avi',
129
- mediaType: 'video/avi',
130
- pixelHeight: 640,
131
- pixelWidth: 480,
132
- },
133
- ],
134
- poster: 'https://whatever/1080x1920.jpg',
135
- },
136
- ],
137
- caption: 'Aenean lobortis volutpat nunc vitae elementum',
119
+ content: {
120
+ dataLayout: 'in-line',
121
+ id: '84d7e1b0-e8b2-4ffc-a798-306f29dc9d52',
122
+ url: 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
123
+ description:
124
+ ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
125
+ caption: 'Aenean lobortis volutpat nunc vitae elementum',
126
+ clips: [
127
+ {
128
+ dataSource: [
129
+ {
130
+ binaryUrl: 'https://whatever/1080x1920.mp4',
131
+ mediaType: 'video/mp4',
132
+ pixelHeight: 1080,
133
+ pixelWidth: 1920,
134
+ },
135
+ {
136
+ binaryUrl: 'https://whatever/320x240.mp4',
137
+ mediaType: 'video/mp4',
138
+ pixelHeight: 320,
139
+ pixelWidth: 240,
140
+ },
141
+ {
142
+ binaryUrl: 'https://whatever/640x480.avi',
143
+ mediaType: 'video/avi',
144
+ pixelHeight: 640,
145
+ pixelWidth: 480,
146
+ },
147
+ ],
148
+ poster: 'https://whatever/1080x1920.jpg',
149
+ },
150
+ ],
151
+ },
138
152
  }
139
153
  const tree = renderer
140
154
  .create(<ClipServer {...videoWithMultipleSources}></ClipServer>)
@@ -144,36 +158,40 @@ describe('Clip Snapshot', () => {
144
158
 
145
159
  it('in-line rendered output is the same for CAPI and cp-content-pipeline data', () => {
146
160
  const inlineVideo = {
147
- dataLayout: 'in-line',
148
- url: 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
149
- description:
150
- ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
151
- poster:
152
- 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
153
- caption: 'Aenean lobortis volutpat nunc vitae elementum',
161
+ content: {
162
+ dataLayout: 'in-line',
163
+ url: 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
164
+ description:
165
+ ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
166
+ poster:
167
+ 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
168
+ caption: 'Aenean lobortis volutpat nunc vitae elementum',
169
+ },
154
170
  }
155
171
 
156
172
  const inlineVideoCPPipeline = {
157
- dataLayout: 'in-line',
158
- id: 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
159
- url: 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
160
- description:
161
- ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
162
- clips: [
163
- {
164
- dataSource: [
165
- {
166
- binaryUrl:
167
- 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
168
- mediaType: 'video/mp4',
169
- },
170
- ],
171
- id: '22a65f5a-ead3-4a25-bf79-c6b080f00547',
172
- poster:
173
- 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
174
- },
175
- ],
176
- caption: 'Aenean lobortis volutpat nunc vitae elementum',
173
+ content: {
174
+ dataLayout: 'in-line',
175
+ id: 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
176
+ url: 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
177
+ description:
178
+ ' Dolor sit amet, consectetur adipiscing elit. Sed sit amet odio quis ante auctor dapibus. Sed dapibus cursus nisi, tincidunt sagittis sapien vehicula vitae.',
179
+ caption: 'Aenean lobortis volutpat nunc vitae elementum',
180
+ clips: [
181
+ {
182
+ dataSource: [
183
+ {
184
+ binaryUrl:
185
+ 'https://spark-clips-staging.s3.eu-west-1.amazonaws.com/optimised-media-files/16968704765960/1080x1920.mp4',
186
+ mediaType: 'video/mp4',
187
+ },
188
+ ],
189
+ id: '22a65f5a-ead3-4a25-bf79-c6b080f00547',
190
+ poster:
191
+ 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fd1e00ek4ebabms.cloudfront.net%2Fproduction%2F84d7e1b0-e8b2-4ffc-a798-306f29dc9d52.png?fit=scale-down&source=next&width=700',
192
+ },
193
+ ],
194
+ },
177
195
  }
178
196
 
179
197
  const capiContainer = renderer
@@ -190,17 +208,20 @@ describe('Clip Snapshot', () => {
190
208
  const tree = renderer
191
209
  .create(
192
210
  <ClipServer
193
- url={url}
194
- dataLayout="full-grid"
195
- autoplay
196
- loop
197
- description="Video description"
198
- caption="caption text"
199
- credits="@credits"
200
- // New Origami image
201
- poster="https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fspark-clips-prod.s3.eu-west-1.amazonaws.com%2Fposter-images%2F898c06df-6ffa-4ed6-87a3-48a8edc309ae?source=cp-content-pipeline&fit=scale-down&quality=highest&width=700&dpr=1"
202
- posterAlt="text poster"
203
- mute
211
+ content={{
212
+ url,
213
+ dataLayout: 'full-grid',
214
+ autoplay: true,
215
+ loop: true,
216
+ description: 'Video description',
217
+ caption: 'caption text',
218
+ credits: '@credits',
219
+ // New Origami image
220
+ poster:
221
+ 'https://www.ft.com/__origami/service/image/v2/images/raw/https%3A%2F%2Fspark-clips-prod.s3.eu-west-1.amazonaws.com%2Fposter-images%2F898c06df-6ffa-4ed6-87a3-48a8edc309ae?source=cp-content-pipeline&fit=scale-down&quality=highest&width=700&dpr=1',
222
+ posterAlt: 'text poster',
223
+ muted: true,
224
+ }}
204
225
  ></ClipServer>
205
226
  )
206
227
  .toJSON()
@@ -1,25 +1,12 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
+ import { ContentProps } from '../types'
4
+ import { ContentTreeWorkarounds } from '@financial-times/cp-content-pipeline-schema'
3
5
 
4
- type disclaimerProps = {
6
+ interface disclaimerProps {
5
7
  id: string
6
8
  }
7
9
 
8
- type FlourishProps = {
9
- id: string
10
- type?: string
11
- flourishType?: string
12
- description?: string
13
- layoutWidth?: string
14
- fallbackImage: {
15
- url?: string | null | undefined
16
- width?: number | null | undefined
17
- height?: number | null | undefined
18
- }
19
- iFrame?: boolean
20
- inArticleBody?: boolean
21
- }
22
-
23
10
  const DisclaimerNotice = ({ id }: disclaimerProps) => (
24
11
  <div
25
12
  id={id}
@@ -37,12 +24,14 @@ const DisclaimerNotice = ({ id }: disclaimerProps) => (
37
24
  </div>
38
25
  </div>
39
26
  )
27
+
28
+ interface FlourishProps extends ContentProps<ContentTreeWorkarounds.Flourish> {
29
+ iFrame?: boolean
30
+ inArticleBody?: boolean
31
+ }
32
+
40
33
  const Flourish: React.FC<FlourishProps> = ({
41
- id,
42
- flourishType,
43
- description,
44
- layoutWidth,
45
- fallbackImage,
34
+ content: { id, flourishType, description, layoutWidth, fallbackImage },
46
35
  iFrame = false,
47
36
  inArticleBody = true,
48
37
  }) => {