@brightcove/components-embed-code-modal 1.1.1 → 1.1.2

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 (187) hide show
  1. package/__tests__/PrismPlayerControls.test.d.ts +2 -0
  2. package/__tests__/PrismPlayerControls.test.d.ts.map +1 -0
  3. package/{build/index.js → index.js} +1 -1
  4. package/index.js.map +1 -0
  5. package/package.json +6 -16
  6. package/{build/src → src}/js/components/prism/PrismPlayerControls.d.ts.map +1 -1
  7. package/.eslintignore +0 -7
  8. package/.eslintrc +0 -23
  9. package/.github/workflows/ci.yml +0 -23
  10. package/.husky/pre-commit +0 -4
  11. package/.nvmrc +0 -1
  12. package/.prettierignore +0 -7
  13. package/.prettierrc +0 -5
  14. package/.release-it.json +0 -40
  15. package/.whitesource +0 -3
  16. package/CHANGELOG.md +0 -403
  17. package/CODEOWNERS +0 -37
  18. package/PULL_REQUEST_TEMPLATE.md +0 -17
  19. package/__tests__/EmbedCode.test.tsx +0 -51
  20. package/__tests__/InteractivityProject.test.tsx +0 -50
  21. package/__tests__/PlayerPreview.test.tsx +0 -23
  22. package/__tests__/PrismPlayerPreview.test.tsx +0 -168
  23. package/__tests__/TabsHeader.test.tsx +0 -19
  24. package/__tests__/TabsSection.test.tsx +0 -46
  25. package/__tests__/TitleWithTooltip.test.tsx +0 -45
  26. package/__tests__/VideoPlayer.test.tsx +0 -38
  27. package/__tests__/embedCodeGenerator.test.ts +0 -111
  28. package/__tests__/util.test.ts +0 -89
  29. package/babel.config.json +0 -17
  30. package/build/README.md +0 -109
  31. package/build/index.js.map +0 -1
  32. package/build/package.json +0 -100
  33. package/etc/wildcard.brightcove.com.key +0 -27
  34. package/etc/wildcard.brightcove.com.pem +0 -96
  35. package/jest/jest.setup.js +0 -90
  36. package/jest/jest.stub.js +0 -4
  37. package/jest.config.js +0 -24
  38. package/scripts/create-dist-pkg-prod.js +0 -19
  39. package/src/index.ts +0 -17
  40. package/src/js/EmbedCodeModal.tsx +0 -105
  41. package/src/js/components/CustomSettingsDropdown.tsx +0 -184
  42. package/src/js/components/EmbedCopySection.tsx +0 -130
  43. package/src/js/components/ModalContainer.tsx +0 -367
  44. package/src/js/components/NoPlayerModal.tsx +0 -42
  45. package/src/js/components/PlayerPreview.tsx +0 -116
  46. package/src/js/components/TabsHeader.tsx +0 -31
  47. package/src/js/components/TabsSection.tsx +0 -74
  48. package/src/js/components/TitleWithTooltip.tsx +0 -39
  49. package/src/js/components/VideoLinks.tsx +0 -83
  50. package/src/js/components/VideoPlayer.tsx +0 -324
  51. package/src/js/components/index.ts +0 -9
  52. package/src/js/components/prism/PrismLiveModal.tsx +0 -162
  53. package/src/js/components/prism/PrismPlayerControls.tsx +0 -343
  54. package/src/js/components/prism/PrismPlayerPreview.tsx +0 -188
  55. package/src/js/components/prism/index.ts +0 -3
  56. package/src/js/constants/baseUrls.ts +0 -4
  57. package/src/js/constants/embed.ts +0 -12
  58. package/src/js/constants/player.ts +0 -32
  59. package/src/js/constants/pluginsRegistry.ts +0 -30
  60. package/src/js/hooks/useGetPlayers.ts +0 -12
  61. package/src/js/i18n.ts +0 -43
  62. package/src/js/services/players-api.ts +0 -26
  63. package/src/js/services/url-shortener.ts +0 -10
  64. package/src/js/types/EmbedCodeModalProps.ts +0 -72
  65. package/src/js/types/EmbedCodeProps.ts +0 -13
  66. package/src/js/types/brightcoveEmbedCode.d.ts +0 -18
  67. package/src/js/types/players.ts +0 -64
  68. package/src/js/types/react-i18next.d.ts +0 -8
  69. package/src/js/types/studioModule.ts +0 -7
  70. package/src/js/utils/addPluginsDataToPlayers.ts +0 -59
  71. package/src/js/utils/call.ts +0 -31
  72. package/src/js/utils/dimensions.ts +0 -53
  73. package/src/js/utils/embedCodeGenerator.ts +0 -120
  74. package/src/js/utils/featureSwitches.ts +0 -16
  75. package/src/js/utils/util.ts +0 -153
  76. package/src/module.tsx +0 -280
  77. package/src/styles/CustomSettingsDropdown.sass +0 -42
  78. package/src/styles/EmbedCode.sass +0 -30
  79. package/src/styles/EmbedCodeModal.sass +0 -76
  80. package/src/styles/base.sass +0 -1
  81. package/src/styles/prism/PrismLiveModal.sass +0 -155
  82. package/src/styles/theme.sass +0 -11
  83. package/src/styles/typings.td.ts +0 -9
  84. package/src/translations/en.json +0 -65
  85. package/src/translations/es.json +0 -65
  86. package/src/translations/fr.json +0 -65
  87. package/src/translations/ja.json +0 -65
  88. package/src/translations/ko.json +0 -65
  89. package/src/translations/zh.json +0 -65
  90. package/src/types/studio.ts +0 -197
  91. package/tsconfig.json +0 -34
  92. package/webpack.config.js +0 -117
  93. /package/{build/__tests__ → __tests__}/EmbedCode.test.d.ts +0 -0
  94. /package/{build/__tests__ → __tests__}/EmbedCode.test.d.ts.map +0 -0
  95. /package/{build/__tests__ → __tests__}/InteractivityProject.test.d.ts +0 -0
  96. /package/{build/__tests__ → __tests__}/InteractivityProject.test.d.ts.map +0 -0
  97. /package/{build/__tests__ → __tests__}/PlayerPreview.test.d.ts +0 -0
  98. /package/{build/__tests__ → __tests__}/PlayerPreview.test.d.ts.map +0 -0
  99. /package/{build/__tests__ → __tests__}/PrismPlayerPreview.test.d.ts +0 -0
  100. /package/{build/__tests__ → __tests__}/PrismPlayerPreview.test.d.ts.map +0 -0
  101. /package/{build/__tests__ → __tests__}/TabsHeader.test.d.ts +0 -0
  102. /package/{build/__tests__ → __tests__}/TabsHeader.test.d.ts.map +0 -0
  103. /package/{build/__tests__ → __tests__}/TabsSection.test.d.ts +0 -0
  104. /package/{build/__tests__ → __tests__}/TabsSection.test.d.ts.map +0 -0
  105. /package/{build/__tests__ → __tests__}/TitleWithTooltip.test.d.ts +0 -0
  106. /package/{build/__tests__ → __tests__}/TitleWithTooltip.test.d.ts.map +0 -0
  107. /package/{build/__tests__ → __tests__}/VideoPlayer.test.d.ts +0 -0
  108. /package/{build/__tests__ → __tests__}/VideoPlayer.test.d.ts.map +0 -0
  109. /package/{build/__tests__ → __tests__}/embedCodeGenerator.test.d.ts +0 -0
  110. /package/{build/__tests__ → __tests__}/embedCodeGenerator.test.d.ts.map +0 -0
  111. /package/{build/__tests__ → __tests__}/util.test.d.ts +0 -0
  112. /package/{build/__tests__ → __tests__}/util.test.d.ts.map +0 -0
  113. /package/{build/src → src}/index.d.ts +0 -0
  114. /package/{build/src → src}/index.d.ts.map +0 -0
  115. /package/{build/src → src}/js/EmbedCodeModal.d.ts +0 -0
  116. /package/{build/src → src}/js/EmbedCodeModal.d.ts.map +0 -0
  117. /package/{build/src → src}/js/components/CustomSettingsDropdown.d.ts +0 -0
  118. /package/{build/src → src}/js/components/CustomSettingsDropdown.d.ts.map +0 -0
  119. /package/{build/src → src}/js/components/EmbedCopySection.d.ts +0 -0
  120. /package/{build/src → src}/js/components/EmbedCopySection.d.ts.map +0 -0
  121. /package/{build/src → src}/js/components/ModalContainer.d.ts +0 -0
  122. /package/{build/src → src}/js/components/ModalContainer.d.ts.map +0 -0
  123. /package/{build/src → src}/js/components/NoPlayerModal.d.ts +0 -0
  124. /package/{build/src → src}/js/components/NoPlayerModal.d.ts.map +0 -0
  125. /package/{build/src → src}/js/components/PlayerPreview.d.ts +0 -0
  126. /package/{build/src → src}/js/components/PlayerPreview.d.ts.map +0 -0
  127. /package/{build/src → src}/js/components/TabsHeader.d.ts +0 -0
  128. /package/{build/src → src}/js/components/TabsHeader.d.ts.map +0 -0
  129. /package/{build/src → src}/js/components/TabsSection.d.ts +0 -0
  130. /package/{build/src → src}/js/components/TabsSection.d.ts.map +0 -0
  131. /package/{build/src → src}/js/components/TitleWithTooltip.d.ts +0 -0
  132. /package/{build/src → src}/js/components/TitleWithTooltip.d.ts.map +0 -0
  133. /package/{build/src → src}/js/components/VideoLinks.d.ts +0 -0
  134. /package/{build/src → src}/js/components/VideoLinks.d.ts.map +0 -0
  135. /package/{build/src → src}/js/components/VideoPlayer.d.ts +0 -0
  136. /package/{build/src → src}/js/components/VideoPlayer.d.ts.map +0 -0
  137. /package/{build/src → src}/js/components/index.d.ts +0 -0
  138. /package/{build/src → src}/js/components/index.d.ts.map +0 -0
  139. /package/{build/src → src}/js/components/prism/PrismLiveModal.d.ts +0 -0
  140. /package/{build/src → src}/js/components/prism/PrismLiveModal.d.ts.map +0 -0
  141. /package/{build/src → src}/js/components/prism/PrismPlayerControls.d.ts +0 -0
  142. /package/{build/src → src}/js/components/prism/PrismPlayerPreview.d.ts +0 -0
  143. /package/{build/src → src}/js/components/prism/PrismPlayerPreview.d.ts.map +0 -0
  144. /package/{build/src → src}/js/components/prism/index.d.ts +0 -0
  145. /package/{build/src → src}/js/components/prism/index.d.ts.map +0 -0
  146. /package/{build/src → src}/js/constants/baseUrls.d.ts +0 -0
  147. /package/{build/src → src}/js/constants/baseUrls.d.ts.map +0 -0
  148. /package/{build/src → src}/js/constants/embed.d.ts +0 -0
  149. /package/{build/src → src}/js/constants/embed.d.ts.map +0 -0
  150. /package/{build/src → src}/js/constants/player.d.ts +0 -0
  151. /package/{build/src → src}/js/constants/player.d.ts.map +0 -0
  152. /package/{build/src → src}/js/constants/pluginsRegistry.d.ts +0 -0
  153. /package/{build/src → src}/js/constants/pluginsRegistry.d.ts.map +0 -0
  154. /package/{build/src → src}/js/hooks/useGetPlayers.d.ts +0 -0
  155. /package/{build/src → src}/js/hooks/useGetPlayers.d.ts.map +0 -0
  156. /package/{build/src → src}/js/i18n.d.ts +0 -0
  157. /package/{build/src → src}/js/i18n.d.ts.map +0 -0
  158. /package/{build/src → src}/js/services/players-api.d.ts +0 -0
  159. /package/{build/src → src}/js/services/players-api.d.ts.map +0 -0
  160. /package/{build/src → src}/js/services/url-shortener.d.ts +0 -0
  161. /package/{build/src → src}/js/services/url-shortener.d.ts.map +0 -0
  162. /package/{build/src → src}/js/types/EmbedCodeModalProps.d.ts +0 -0
  163. /package/{build/src → src}/js/types/EmbedCodeModalProps.d.ts.map +0 -0
  164. /package/{build/src → src}/js/types/EmbedCodeProps.d.ts +0 -0
  165. /package/{build/src → src}/js/types/EmbedCodeProps.d.ts.map +0 -0
  166. /package/{build/src → src}/js/types/players.d.ts +0 -0
  167. /package/{build/src → src}/js/types/players.d.ts.map +0 -0
  168. /package/{build/src → src}/js/types/studioModule.d.ts +0 -0
  169. /package/{build/src → src}/js/types/studioModule.d.ts.map +0 -0
  170. /package/{build/src → src}/js/utils/addPluginsDataToPlayers.d.ts +0 -0
  171. /package/{build/src → src}/js/utils/addPluginsDataToPlayers.d.ts.map +0 -0
  172. /package/{build/src → src}/js/utils/call.d.ts +0 -0
  173. /package/{build/src → src}/js/utils/call.d.ts.map +0 -0
  174. /package/{build/src → src}/js/utils/dimensions.d.ts +0 -0
  175. /package/{build/src → src}/js/utils/dimensions.d.ts.map +0 -0
  176. /package/{build/src → src}/js/utils/embedCodeGenerator.d.ts +0 -0
  177. /package/{build/src → src}/js/utils/embedCodeGenerator.d.ts.map +0 -0
  178. /package/{build/src → src}/js/utils/featureSwitches.d.ts +0 -0
  179. /package/{build/src → src}/js/utils/featureSwitches.d.ts.map +0 -0
  180. /package/{build/src → src}/js/utils/util.d.ts +0 -0
  181. /package/{build/src → src}/js/utils/util.d.ts.map +0 -0
  182. /package/{build/src → src}/module.d.ts +0 -0
  183. /package/{build/src → src}/module.d.ts.map +0 -0
  184. /package/{build/src → src}/styles/typings.td.d.ts +0 -0
  185. /package/{build/src → src}/styles/typings.td.d.ts.map +0 -0
  186. /package/{build/src → src}/types/studio.d.ts +0 -0
  187. /package/{build/src → src}/types/studio.d.ts.map +0 -0
@@ -1,343 +0,0 @@
1
- import React, { useState, useCallback, useMemo } from 'react';
2
- import {
3
- PrismDropDown,
4
- PrismInput,
5
- PrismIconButton,
6
- PrismCheckbox,
7
- PrismCodeCard,
8
- } from '@brightcove/prism-core';
9
- import { useTranslation } from 'react-i18next';
10
-
11
- import { PlayerSelectItem, PlayersObject } from 'js/types/players';
12
- import {
13
- LivePayload,
14
- EmbedCodeAspectRatio,
15
- EmbedCodeProperties,
16
- } from 'js/types/EmbedCodeModalProps';
17
- import {
18
- calculateDimensions,
19
- calculateHeight,
20
- shouldUpdateWidth,
21
- } from 'js/utils/dimensions';
22
- import { generateEmbedCode } from 'js/utils/embedCodeGenerator';
23
-
24
- import css from 'styles/prism/PrismLiveModal.sass';
25
-
26
- interface PrismPlayerControlsProps {
27
- video: LivePayload;
28
- players: PlayersObject;
29
- playerListForSelection: PlayerSelectItem[];
30
- selectedPlayer: string;
31
- onPlayerChange: (playerId: string) => void;
32
- embedProperties: EmbedCodeProperties;
33
- setEmbedProperties: (value: EmbedCodeProperties) => void;
34
- showDVR?: boolean;
35
- onDVRClick?: (newValue: boolean) => void;
36
- dvrTime?: number;
37
- showLowLatency?: boolean;
38
- onLowLatencyClick?: (newValue: boolean) => void;
39
- adConfigValue?: string;
40
- onAdConfigChange?: (value: string) => void;
41
- ssai?: boolean;
42
- adConfigOptions?: Array<{ label: string; value: string }>;
43
- }
44
-
45
- export const PrismPlayerControls = ({
46
- video,
47
- players,
48
- playerListForSelection,
49
- selectedPlayer,
50
- onPlayerChange,
51
- embedProperties,
52
- setEmbedProperties,
53
- showDVR,
54
- onDVRClick,
55
- dvrTime,
56
- showLowLatency,
57
- onLowLatencyClick,
58
- adConfigValue,
59
- onAdConfigChange,
60
- ssai,
61
- adConfigOptions = [],
62
- }: PrismPlayerControlsProps) => {
63
- const { t } = useTranslation();
64
- const [prevAspectRatio, setPrevAspectRatio] = useState(
65
- embedProperties.aspectRatio,
66
- );
67
- const [aspectRatioLocked, setAspectRatioLocked] = useState(
68
- embedProperties.aspectRatio !== EmbedCodeAspectRatio.CUSTOM,
69
- );
70
- const [dvrEnabled, setDvrEnabled] = useState(!showLowLatency);
71
- const [lowLatencyEnabled, setLowLatencyEnabled] = useState(true);
72
-
73
- const handlePropertiesUpdate = useCallback(
74
- (name: string, value: string | boolean | number) => {
75
- if (name === 'aspectRatio') {
76
- const calculateNewWidth = shouldUpdateWidth(
77
- prevAspectRatio,
78
- value as EmbedCodeAspectRatio,
79
- );
80
-
81
- setPrevAspectRatio(value as EmbedCodeAspectRatio);
82
- setAspectRatioLocked(value !== EmbedCodeAspectRatio.CUSTOM);
83
-
84
- const dimensions = calculateDimensions(
85
- calculateNewWidth,
86
- value as EmbedCodeAspectRatio,
87
- embedProperties.width,
88
- embedProperties.height,
89
- );
90
-
91
- setEmbedProperties({
92
- ...embedProperties,
93
- aspectRatio: value as EmbedCodeAspectRatio,
94
- width: dimensions.width as number,
95
- height: dimensions.height,
96
- });
97
-
98
- return;
99
- } else if (name === 'width' && aspectRatioLocked) {
100
- const height = calculateHeight(
101
- value as number,
102
- embedProperties.aspectRatio,
103
- );
104
-
105
- setEmbedProperties({
106
- ...embedProperties,
107
- width: value as number,
108
- height,
109
- });
110
-
111
- return;
112
- }
113
-
114
- setEmbedProperties({
115
- ...embedProperties,
116
- [name]: value,
117
- });
118
- },
119
- [prevAspectRatio, aspectRatioLocked, embedProperties, setEmbedProperties],
120
- );
121
-
122
- const toggleAspectRatioLock = useCallback(() => {
123
- if (embedProperties.aspectRatio === EmbedCodeAspectRatio.CUSTOM) {
124
- return;
125
- }
126
- setAspectRatioLocked(!aspectRatioLocked);
127
- }, [aspectRatioLocked, embedProperties.aspectRatio]);
128
-
129
- // Player dropdown items
130
- const playerItems = playerListForSelection.map((player) => ({
131
- value: player.value,
132
- label: player.label,
133
- }));
134
-
135
- // Sizing dropdown items
136
- const sizingItems = [
137
- { value: 'responsive', label: 'Responsive' },
138
- { value: 'fixed', label: 'Fixed' },
139
- ];
140
-
141
- // Aspect ratio dropdown items
142
- const aspectRatioItems = [
143
- { value: EmbedCodeAspectRatio.SIXTEEN_NINE, label: '16:9 (Desktop)' },
144
- { value: EmbedCodeAspectRatio.NINE_SIXTEEN, label: '9:16 (Mobile)' },
145
- { value: EmbedCodeAspectRatio.ONE_ONE, label: '1:1' },
146
- { value: EmbedCodeAspectRatio.FOUR_THREE, label: '4:3' },
147
- { value: EmbedCodeAspectRatio.CUSTOM, label: 'Custom' },
148
- ];
149
-
150
- // Generate embed code
151
- const player = players[selectedPlayer];
152
- const { embedCode, embedCodeJS } = generateEmbedCode({
153
- accountId: video.accountId,
154
- playerId: selectedPlayer,
155
- videoId: video.videoId,
156
- embedProperties,
157
- isCampaign: player?.hasCampaignPlugin || false,
158
- isViewerIdSource: player?.hasViewerIDSource || false,
159
- isBcMapTracking: player?.hasBcMapTracking || false,
160
- livePlaybackToken: video.livePlaybackToken,
161
- adConfigId: adConfigValue || video.adConfigId,
162
- });
163
-
164
- const codeCardTabs = useMemo(
165
- () => [
166
- {
167
- label: (t('tabs.labels.iframe') as string) || 'iframe',
168
- code: embedCode,
169
- language: 'html',
170
- },
171
- {
172
- label: (t('tabs.labels.javascript') as string) || 'JavaScript',
173
- code: embedCodeJS,
174
- language: 'javascript',
175
- },
176
- ],
177
- [embedCode, embedCodeJS, t],
178
- );
179
-
180
- // Warning message for custom plugins
181
- const warningMessage: string | undefined =
182
- player?.hasCampaignPlugin || player?.hasViewerIDSource
183
- ? (t('customPluginNotice') as string)
184
- : void 0;
185
-
186
- const handleDVRChange = useCallback(
187
- (checked: boolean) => {
188
- setDvrEnabled(checked);
189
- if (onDVRClick) {
190
- onDVRClick(checked);
191
- }
192
- if (checked && lowLatencyEnabled) {
193
- setLowLatencyEnabled(false);
194
- if (onLowLatencyClick) {
195
- onLowLatencyClick(false);
196
- }
197
- }
198
- },
199
- [lowLatencyEnabled, onDVRClick, onLowLatencyClick],
200
- );
201
-
202
- const handleLowLatencyChange = useCallback(
203
- (checked: boolean) => {
204
- setLowLatencyEnabled(checked);
205
- if (onLowLatencyClick) {
206
- onLowLatencyClick(checked);
207
- }
208
- if (checked && dvrEnabled) {
209
- setDvrEnabled(false);
210
- if (onDVRClick) {
211
- onDVRClick(false);
212
- }
213
- }
214
- },
215
- [dvrEnabled, onDVRClick, onLowLatencyClick],
216
- );
217
-
218
- return (
219
- <div className={css.prismLeftColumn}>
220
- {/* Player Dropdown */}
221
- <PrismDropDown
222
- label={t('player') as string}
223
- items={playerItems}
224
- value={selectedPlayer}
225
- onChange={(item) => onPlayerChange(item.value as string)}
226
- searchable
227
- placeholder='Select Player'
228
- />
229
-
230
- {/* Player Sizing Dropdown */}
231
- <PrismDropDown
232
- label={(t('prism.customSettings.sizing') as string) || 'Player Sizing'}
233
- items={sizingItems}
234
- value={embedProperties.responsive ? 'responsive' : 'fixed'}
235
- onChange={(item) =>
236
- handlePropertiesUpdate('responsive', item.value === 'responsive')
237
- }
238
- />
239
-
240
- {/* Aspect Ratio Dropdown */}
241
- <PrismDropDown
242
- label={(t('customSettings.aspectRatio') as string) || 'Aspect Ratio'}
243
- items={aspectRatioItems}
244
- value={embedProperties.aspectRatio}
245
- onChange={(item) => handlePropertiesUpdate('aspectRatio', item.value)}
246
- />
247
-
248
- {/* Width/Height Input Group */}
249
- <div className={css.prismInputGroup}>
250
- <PrismInput
251
- variant='FieldGroup'
252
- label={(t('customSettings.playerWidth') as string) || 'Player Width'}
253
- type='number'
254
- value={String(embedProperties.width)}
255
- onChange={(value) => handlePropertiesUpdate('width', Number(value))}
256
- groupTitle='Unit'
257
- groupValue={embedProperties.units}
258
- onGroupChange={(unit) => handlePropertiesUpdate('units', unit)}
259
- groupOptions={['px', '%']}
260
- />
261
-
262
- <PrismIconButton
263
- icon='link'
264
- variant='Ghost'
265
- size='small'
266
- onClick={toggleAspectRatioLock}
267
- disabled={embedProperties.aspectRatio === EmbedCodeAspectRatio.CUSTOM}
268
- className={css.prismLinkButton}
269
- />
270
-
271
- <PrismInput
272
- variant='FieldGroup'
273
- label={
274
- (t('customSettings.playerHeight') as string) || 'Player Height'
275
- }
276
- type='number'
277
- value={String(embedProperties.height)}
278
- onChange={(value) => handlePropertiesUpdate('height', Number(value))}
279
- disabled={aspectRatioLocked}
280
- groupTitle='Unit'
281
- groupValue={embedProperties.units}
282
- onGroupChange={(unit) => handlePropertiesUpdate('units', unit)}
283
- groupOptions={['px', '%']}
284
- />
285
- </div>
286
-
287
- {/* DVR Checkbox (conditional) */}
288
- {showDVR && (
289
- <div>
290
- <PrismCheckbox
291
- label={(t('dvr.allowDVR') as string) || 'Enable DVR'}
292
- checked={dvrEnabled}
293
- onChange={(e) => handleDVRChange(e.target.checked)}
294
- disabled={showLowLatency && lowLatencyEnabled}
295
- />
296
- {dvrEnabled && typeof dvrTime === 'number' && (
297
- <div className={css.prismInputGroup}>
298
- <PrismInput
299
- variant='FieldGroup'
300
- label={(t('dvr.inputLabel') as string) || 'DVR Window'}
301
- type='number'
302
- value={String(dvrTime)}
303
- disabled
304
- groupTitle='Unit'
305
- groupValue={(t('dvr.unit') as string) || 'sec'}
306
- groupOptions={[(t('dvr.unit') as string) || 'sec']}
307
- />
308
- </div>
309
- )}
310
- </div>
311
- )}
312
-
313
- {/* Low Latency Checkbox (conditional) */}
314
- {showLowLatency && (
315
- <PrismCheckbox
316
- label={(t('lowLatency') as string) || 'Enable Low Latency'}
317
- checked={lowLatencyEnabled}
318
- onChange={(e) => handleLowLatencyChange(e.target.checked)}
319
- disabled={showDVR && dvrEnabled}
320
- />
321
- )}
322
-
323
- {/* Ad Config Dropdown (conditional) */}
324
- {ssai && adConfigOptions.length > 0 && onAdConfigChange && (
325
- <PrismDropDown
326
- label={(t('adConfiguration') as string) || 'Ad Configuration'}
327
- items={adConfigOptions.map((opt) => ({
328
- value: opt.value,
329
- label: opt.label,
330
- }))}
331
- value={adConfigValue || adConfigOptions[0].value}
332
- onChange={(item) => onAdConfigChange(item.value as string)}
333
- />
334
- )}
335
-
336
- {warningMessage && (
337
- <div className={css.prismCustomPluginNotice}>{warningMessage}</div>
338
- )}
339
-
340
- <PrismCodeCard className={css.prismCodeCard} tabs={codeCardTabs} />
341
- </div>
342
- );
343
- };
@@ -1,188 +0,0 @@
1
- import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
- import ReactPlayerLoader from '@brightcove/react-player-loader';
3
- import { PrismButton, PrismButtonDropdown } from '@brightcove/prism-core';
4
- import { getBrightcove, getUrlBase } from 'js/utils/util';
5
- import { useTranslation } from 'react-i18next';
6
-
7
- import { getUrlAndAddItToClipboard } from '../VideoLinks';
8
-
9
- import css from 'styles/prism/PrismLiveModal.sass';
10
-
11
- interface PrismPlayerPreviewProps {
12
- accountId: string;
13
- playerId: string;
14
- videoId: string;
15
- previewUrl: string;
16
- livePlaybackToken?: string;
17
- adConfigId?: string;
18
- }
19
-
20
- export const PrismPlayerPreview = ({
21
- accountId,
22
- playerId,
23
- videoId,
24
- previewUrl,
25
- }: PrismPlayerPreviewProps) => {
26
- const { t } = useTranslation();
27
- const [isShorteningUrl, setIsShorteningUrl] = useState<boolean>(false);
28
- const [isCopied, setIsCopied] = useState<boolean>(false);
29
- const copiedTimeoutRef = useRef<ReturnType<typeof setTimeout>>();
30
- const shortenRequestRef = useRef<number>(0);
31
-
32
- useEffect(
33
- () => () => {
34
- shortenRequestRef.current += 1;
35
- if (copiedTimeoutRef.current) {
36
- clearTimeout(copiedTimeoutRef.current);
37
- }
38
- setIsShorteningUrl(false);
39
- setIsCopied(false);
40
- },
41
- [previewUrl],
42
- );
43
-
44
- const notifyMissingPreviewUrl = useCallback(() => {
45
- getBrightcove().Toaster.error({
46
- title: t('toasterTitle') as string,
47
- message: 'Please select a player first',
48
- });
49
- }, [t]);
50
-
51
- const showCopiedFeedback = useCallback(() => {
52
- if (copiedTimeoutRef.current) {
53
- clearTimeout(copiedTimeoutRef.current);
54
- }
55
- setIsCopied(true);
56
- copiedTimeoutRef.current = setTimeout(() => setIsCopied(false), 2000);
57
- }, []);
58
-
59
- const handleCopyFullUrl = useCallback(() => {
60
- if (!previewUrl) {
61
- notifyMissingPreviewUrl();
62
- return;
63
- }
64
- navigator.clipboard
65
- .writeText(previewUrl)
66
- .then(showCopiedFeedback)
67
- .catch(() => {
68
- getBrightcove().Toaster.error({
69
- message: t('toasterErrorMessage') as string,
70
- });
71
- });
72
- }, [previewUrl, t, notifyMissingPreviewUrl, showCopiedFeedback]);
73
-
74
- const handleCopyShortUrl = useCallback(() => {
75
- if (!previewUrl) {
76
- notifyMissingPreviewUrl();
77
- return;
78
- }
79
- const requestId = shortenRequestRef.current + 1;
80
- shortenRequestRef.current = requestId;
81
- const isCurrentRequest = () => shortenRequestRef.current === requestId;
82
-
83
- setIsShorteningUrl(true);
84
- getUrlAndAddItToClipboard(previewUrl)
85
- .then(() => {
86
- if (isCurrentRequest()) {
87
- showCopiedFeedback();
88
- }
89
- })
90
- .catch(() => {
91
- if (isCurrentRequest()) {
92
- getBrightcove().Toaster.error({
93
- message: t('toasterGetURLError') as string,
94
- });
95
- }
96
- })
97
- .finally(() => {
98
- if (isCurrentRequest()) {
99
- setIsShorteningUrl(false);
100
- }
101
- });
102
- }, [previewUrl, t, notifyMissingPreviewUrl, showCopiedFeedback]);
103
-
104
- const copyUrlOptions = useMemo(
105
- () => [
106
- {
107
- id: 'short-url',
108
- label: t('prism.shortURL') as string,
109
- icon: 'LAYERS_SUBTRACT',
110
- onClick: handleCopyShortUrl,
111
- disabled: isShorteningUrl,
112
- },
113
- {
114
- id: 'full-url',
115
- label: t('prism.fullURL') as string,
116
- icon: 'LAYERS_SUBTRACT',
117
- onClick: handleCopyFullUrl,
118
- },
119
- ],
120
- [t, handleCopyShortUrl, handleCopyFullUrl, isShorteningUrl],
121
- );
122
-
123
- const copyUrlLabel = () => {
124
- if (isCopied) {
125
- return t('prism.copied') as string;
126
- }
127
- if (isShorteningUrl) {
128
- return t('prism.copying') as string;
129
- }
130
- return t('prism.copyURL') as string;
131
- };
132
-
133
- const handleOpenPreview = useCallback(() => {
134
- if (!previewUrl) {
135
- notifyMissingPreviewUrl();
136
- return;
137
- }
138
- window.open(previewUrl, '_blank', 'noopener,noreferrer');
139
- }, [previewUrl, notifyMissingPreviewUrl]);
140
-
141
- // Build player options for Live modal
142
- // Note: Following Bluesteel pattern - we DON'T pass adConfigId or livePlaybackToken
143
- // to ReactPlayerLoader. These are only used in the previewUrl for external links
144
- // and in the embed code generation, not for the embedded player preview.
145
- const playerOptions: Record<string, string> = {
146
- accountId,
147
- playerId,
148
- videoId,
149
- };
150
-
151
- return (
152
- <div className={css.prismPlayerPreviewContainer}>
153
- <div className={css.prismPlayerActions}>
154
- <PrismButtonDropdown
155
- variant='Primary'
156
- size='small'
157
- options={copyUrlOptions}
158
- modalTitle={t('prism.copyURL') as string}
159
- showDropdownIcon={!isCopied && !isShorteningUrl}
160
- {...(isCopied ? { rightIcon: 'CHECK' } : {})}
161
- disabled={!previewUrl || isShorteningUrl || isCopied}
162
- >
163
- {copyUrlLabel()}
164
- </PrismButtonDropdown>
165
- <PrismButton
166
- variant='Primary'
167
- size='small'
168
- onClick={handleOpenPreview}
169
- rightIcon='link'
170
- disabled={!previewUrl}
171
- >
172
- {t('previewButton') as string}
173
- </PrismButton>
174
- </div>
175
-
176
- <div className={css.prismPlayerWrapper}>
177
- <ReactPlayerLoader
178
- key={`${accountId}-${playerId}-${videoId}`}
179
- {...playerOptions}
180
- baseUrl={getUrlBase()}
181
- attrs={{ className: css.playerLoader }}
182
- embedType='iframe'
183
- refNode='player-container'
184
- />
185
- </div>
186
- </div>
187
- );
188
- };
@@ -1,3 +0,0 @@
1
- export { PrismLiveModal } from './PrismLiveModal';
2
- export { PrismPlayerControls } from './PrismPlayerControls';
3
- export { PrismPlayerPreview } from './PrismPlayerPreview';
@@ -1,4 +0,0 @@
1
- export const QA_URL = 'https://players.qa.brightcove.net/';
2
- export const PROD_URL = 'https://players.brightcove.net/';
3
- export const QA_PREVIEW_URL = 'https://preview-players.qa.brightcove.net';
4
- export const PROD_PREVIEW_URL = 'https://preview-players.brightcove.net';
@@ -1,12 +0,0 @@
1
- import {
2
- EmbedCodeAspectRatio,
3
- EmbedCodeUnits,
4
- } from 'js/types/EmbedCodeModalProps';
5
-
6
- export const EMBED_DEFAULT = {
7
- responsive: false,
8
- width: 960,
9
- height: 540,
10
- units: EmbedCodeUnits.PX,
11
- aspectRatio: EmbedCodeAspectRatio.CUSTOM,
12
- };
@@ -1,32 +0,0 @@
1
- export const DEFAULT_PLAYER_ID = 'default';
2
- export const DEFAULT_PLAYER_NAME = 'Brightcove Default Player';
3
-
4
- export const PLAYER_LIST_FOR_SELECTION = [
5
- {
6
- label: DEFAULT_PLAYER_NAME,
7
- value: DEFAULT_PLAYER_ID,
8
- },
9
- ];
10
-
11
- export const FAVORITE_PLAYER_SETTING = 'favorite_player_id';
12
-
13
- export const PLAYERS = {
14
- default: {
15
- hasCustomPlugins: false,
16
- id: DEFAULT_PLAYER_ID,
17
- hasCampaignPlugin: false,
18
- label: DEFAULT_PLAYER_NAME,
19
- hasInteractivityPlugin: false,
20
- hasViewerIDSource: false,
21
- hasBcMapTracking: false,
22
- },
23
- };
24
-
25
- export const DEFAULT_INTERACTIVITY_PLAYER = {
26
- name: 'Interactivity Player',
27
- registry_id: '@brightcove/videojs-interactivity-viewer',
28
- version: '2.x',
29
- options: {
30
- mobilefullscreen: true,
31
- },
32
- };
@@ -1,30 +0,0 @@
1
- // Plugins available in the BC registry
2
- export const bcHostedPlugins = [
3
- 'bcAa',
4
- 'bcAirplay',
5
- 'bcGa',
6
- 'bcGtm',
7
- 'bcPlaylistUi',
8
- 'bcTealium',
9
- 'bcMapPlugin',
10
- 'chromecastReceiver',
11
- 'customEndscreen',
12
- 'eme',
13
- 'ima3',
14
- 'interactivityViewer',
15
- 'kollective',
16
- 'overlay',
17
- 'pip',
18
- 'playlistEndscreen',
19
- 'qualityMenu',
20
- 'social',
21
- 'ssai',
22
- 'thumbnails',
23
- ];
24
-
25
- export const CAMPAIGN_PLUGIN_NAME = 'bcMapPlugin';
26
- export const VIEWER_ID_KEY_NAME = 'viewer_id_source';
27
- export const BC_MAP_TRACKING_NAME = 'bcMapTracking';
28
- export const INTERACTIVITY_PLUGIN_NAME = 'interactivityViewer';
29
- export const INTERACTIVITY_REGISTRY_ID =
30
- '@brightcove/videojs-interactivity-viewer';
@@ -1,12 +0,0 @@
1
- import { useQuery } from 'react-query';
2
-
3
- import { getPlayers } from 'js/services/players-api';
4
-
5
- const useGetPlayers = (isPlayersCallEnabled: boolean) => {
6
- return useQuery(['players'], () => getPlayers(), {
7
- refetchOnWindowFocus: false,
8
- enabled: isPlayersCallEnabled,
9
- });
10
- };
11
-
12
- export default useGetPlayers;
package/src/js/i18n.ts DELETED
@@ -1,43 +0,0 @@
1
- import i18n from 'i18next';
2
- import { initReactI18next } from 'react-i18next';
3
-
4
- import common_en from 'translations/en.json';
5
- import common_es from 'translations/es.json';
6
- import common_fr from 'translations/fr.json';
7
- import common_ja from 'translations/ja.json';
8
- import common_ko from 'translations/ko.json';
9
- import common_zh from 'translations/zh.json';
10
-
11
- export const resources = {
12
- en: {
13
- translation: common_en,
14
- },
15
- es: {
16
- translation: common_es,
17
- },
18
- fr: {
19
- translation: common_fr,
20
- },
21
- ja: {
22
- translation: common_ja,
23
- },
24
- ko: {
25
- translation: common_ko,
26
- },
27
- zh: {
28
- translation: common_zh,
29
- },
30
- };
31
-
32
- i18n.use(initReactI18next).init({
33
- lng: window.StudioModule?.config?.lang || 'en',
34
- fallbackLng: 'en',
35
- debug: true,
36
- returnObjects: true,
37
- resources,
38
- interpolation: {
39
- escapeValue: false, // react already safe from xss
40
- },
41
- });
42
-
43
- export default i18n;
@@ -1,26 +0,0 @@
1
- import {
2
- getAllPlayers,
3
- createPlayer as createPlayerAPI,
4
- getPlayer as getPlayerAPI,
5
- } from '@brightcove/studio-api-services/api/players-api';
6
- import { callAPI } from 'js/utils/call';
7
- import {
8
- GetPlayersPayload,
9
- CreatePlayerPayload,
10
- CreatePlayerResponse,
11
- PlayerItem,
12
- } from 'js/types/players';
13
-
14
- export const getPlayers = async (): Promise<GetPlayersPayload> => {
15
- return callAPI(getAllPlayers, {});
16
- };
17
-
18
- export const createPlayer = async (
19
- payload: CreatePlayerPayload,
20
- ): Promise<CreatePlayerResponse> => {
21
- return callAPI(createPlayerAPI, payload);
22
- };
23
-
24
- export const getPlayer = async (playerId: string): Promise<PlayerItem> => {
25
- return callAPI(getPlayerAPI, { playerId });
26
- };