@brightcove/components-embed-code-modal 0.8.2 → 0.8.3

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 (162) hide show
  1. package/.eslintignore +7 -0
  2. package/.eslintrc +23 -0
  3. package/.husky/pre-commit +4 -0
  4. package/.nvmrc +1 -0
  5. package/.prettierignore +7 -0
  6. package/.prettierrc +5 -0
  7. package/.release-it.json +40 -0
  8. package/.whitesource +3 -0
  9. package/CHANGELOG.md +342 -0
  10. package/CODEOWNERS +37 -0
  11. package/PULL_REQUEST_TEMPLATE.md +17 -0
  12. package/__tests__/EmbedCode.test.tsx +51 -0
  13. package/__tests__/InteractivityProject.test.tsx +50 -0
  14. package/__tests__/PlayerPreview.test.tsx +23 -0
  15. package/__tests__/TabsHeader.test.tsx +19 -0
  16. package/__tests__/TabsSection.test.tsx +46 -0
  17. package/__tests__/TitleWithTooltip.test.tsx +45 -0
  18. package/__tests__/VideoPlayer.test.tsx +38 -0
  19. package/__tests__/util.test.ts +89 -0
  20. package/babel.config.json +17 -0
  21. package/etc/wildcard.brightcove.com.key +27 -0
  22. package/etc/wildcard.brightcove.com.pem +96 -0
  23. package/jest/jest.setup.js +62 -0
  24. package/jest/jest.stub.js +4 -0
  25. package/jest.config.js +24 -0
  26. package/package.json +15 -5
  27. package/scripts/create-dist-pkg-prod.js +18 -0
  28. package/src/index.ts +16 -0
  29. package/src/js/EmbedCodeModal.tsx +88 -0
  30. package/src/js/components/CustomSettingsDropdown.tsx +184 -0
  31. package/src/js/components/EmbedCopySection.tsx +130 -0
  32. package/src/js/components/ModalContainer.tsx +274 -0
  33. package/src/js/components/NoPlayerModal.tsx +42 -0
  34. package/src/js/components/PlayerPreview.tsx +116 -0
  35. package/src/js/components/TabsHeader.tsx +31 -0
  36. package/src/js/components/TabsSection.tsx +74 -0
  37. package/src/js/components/TitleWithTooltip.tsx +39 -0
  38. package/src/js/components/VideoLinks.tsx +83 -0
  39. package/src/js/components/VideoPlayer.tsx +303 -0
  40. package/src/js/components/{index.d.ts → index.ts} +0 -1
  41. package/src/js/constants/baseUrls.ts +4 -0
  42. package/src/js/constants/embed.ts +12 -0
  43. package/src/js/constants/player.ts +32 -0
  44. package/src/js/constants/pluginsRegistry.ts +30 -0
  45. package/src/js/hooks/useGetPlayers.ts +12 -0
  46. package/src/js/i18n.ts +43 -0
  47. package/src/js/services/players-api.ts +26 -0
  48. package/src/js/services/url-shortener.ts +10 -0
  49. package/src/js/types/EmbedCodeModalProps.ts +72 -0
  50. package/src/js/types/EmbedCodeProps.ts +13 -0
  51. package/src/js/types/brightcoveEmbedCode.d.ts +18 -0
  52. package/src/js/types/players.ts +64 -0
  53. package/src/js/types/react-i18next.d.ts +8 -0
  54. package/src/js/types/studioModule.ts +7 -0
  55. package/src/js/utils/addPluginsDataToPlayers.ts +59 -0
  56. package/src/js/utils/call.ts +31 -0
  57. package/src/js/utils/dimensions.ts +53 -0
  58. package/src/js/utils/featureSwitches.ts +16 -0
  59. package/src/js/utils/util.ts +153 -0
  60. package/src/module.tsx +246 -0
  61. package/src/styles/CustomSettingsDropdown.sass +42 -0
  62. package/src/styles/EmbedCode.sass +30 -0
  63. package/src/styles/EmbedCodeModal.sass +76 -0
  64. package/src/styles/base.sass +1 -0
  65. package/src/styles/theme.sass +11 -0
  66. package/src/styles/typings.td.ts +9 -0
  67. package/src/translations/en.json +53 -0
  68. package/src/translations/es.json +53 -0
  69. package/src/translations/fr.json +53 -0
  70. package/src/translations/ja.json +53 -0
  71. package/src/translations/ko.json +53 -0
  72. package/src/translations/zh.json +53 -0
  73. package/src/types/studio.ts +197 -0
  74. package/tsconfig.json +34 -0
  75. package/webpack.config.js +97 -0
  76. package/__tests__/EmbedCode.test.d.ts +0 -2
  77. package/__tests__/EmbedCode.test.d.ts.map +0 -1
  78. package/__tests__/InteractivityProject.test.d.ts +0 -2
  79. package/__tests__/InteractivityProject.test.d.ts.map +0 -1
  80. package/__tests__/PlayerPreview.test.d.ts +0 -2
  81. package/__tests__/PlayerPreview.test.d.ts.map +0 -1
  82. package/__tests__/PlayersDropdown.test.d.ts +0 -2
  83. package/__tests__/PlayersDropdown.test.d.ts.map +0 -1
  84. package/__tests__/TabsHeader.test.d.ts +0 -2
  85. package/__tests__/TabsHeader.test.d.ts.map +0 -1
  86. package/__tests__/TabsSection.test.d.ts +0 -2
  87. package/__tests__/TabsSection.test.d.ts.map +0 -1
  88. package/__tests__/TitleWithTooltip.test.d.ts +0 -2
  89. package/__tests__/TitleWithTooltip.test.d.ts.map +0 -1
  90. package/__tests__/VideoPlayer.test.d.ts +0 -2
  91. package/__tests__/VideoPlayer.test.d.ts.map +0 -1
  92. package/__tests__/util.test.d.ts +0 -2
  93. package/__tests__/util.test.d.ts.map +0 -1
  94. package/index.js +0 -56
  95. package/index.js.map +0 -1
  96. package/src/index.d.ts +0 -5
  97. package/src/index.d.ts.map +0 -1
  98. package/src/js/EmbedCodeModal.d.ts +0 -17
  99. package/src/js/EmbedCodeModal.d.ts.map +0 -1
  100. package/src/js/components/CustomSettingsDropdown.d.ts +0 -11
  101. package/src/js/components/CustomSettingsDropdown.d.ts.map +0 -1
  102. package/src/js/components/EmbedCopySection.d.ts +0 -4
  103. package/src/js/components/EmbedCopySection.d.ts.map +0 -1
  104. package/src/js/components/ModalContainer.d.ts +0 -17
  105. package/src/js/components/ModalContainer.d.ts.map +0 -1
  106. package/src/js/components/NoPlayerModal.d.ts +0 -8
  107. package/src/js/components/NoPlayerModal.d.ts.map +0 -1
  108. package/src/js/components/PlayerPreview.d.ts +0 -4
  109. package/src/js/components/PlayerPreview.d.ts.map +0 -1
  110. package/src/js/components/PlayersDropdown.d.ts +0 -9
  111. package/src/js/components/PlayersDropdown.d.ts.map +0 -1
  112. package/src/js/components/TabsHeader.d.ts +0 -11
  113. package/src/js/components/TabsHeader.d.ts.map +0 -1
  114. package/src/js/components/TabsSection.d.ts +0 -15
  115. package/src/js/components/TabsSection.d.ts.map +0 -1
  116. package/src/js/components/TitleWithTooltip.d.ts +0 -8
  117. package/src/js/components/TitleWithTooltip.d.ts.map +0 -1
  118. package/src/js/components/VideoLinks.d.ts +0 -9
  119. package/src/js/components/VideoLinks.d.ts.map +0 -1
  120. package/src/js/components/VideoPlayer.d.ts +0 -17
  121. package/src/js/components/VideoPlayer.d.ts.map +0 -1
  122. package/src/js/components/index.d.ts.map +0 -1
  123. package/src/js/constants/baseUrls.d.ts +0 -5
  124. package/src/js/constants/baseUrls.d.ts.map +0 -1
  125. package/src/js/constants/embed.d.ts +0 -9
  126. package/src/js/constants/embed.d.ts.map +0 -1
  127. package/src/js/constants/player.d.ts +0 -27
  128. package/src/js/constants/player.d.ts.map +0 -1
  129. package/src/js/constants/pluginsRegistry.d.ts +0 -7
  130. package/src/js/constants/pluginsRegistry.d.ts.map +0 -1
  131. package/src/js/hooks/useGetPlayers.d.ts +0 -3
  132. package/src/js/hooks/useGetPlayers.d.ts.map +0 -1
  133. package/src/js/i18n.d.ts +0 -335
  134. package/src/js/i18n.d.ts.map +0 -1
  135. package/src/js/services/players-api.d.ts +0 -5
  136. package/src/js/services/players-api.d.ts.map +0 -1
  137. package/src/js/services/url-shortener.d.ts +0 -4
  138. package/src/js/services/url-shortener.d.ts.map +0 -1
  139. package/src/js/types/EmbedCodeModalProps.d.ts +0 -59
  140. package/src/js/types/EmbedCodeModalProps.d.ts.map +0 -1
  141. package/src/js/types/EmbedCodeProps.d.ts +0 -13
  142. package/src/js/types/EmbedCodeProps.d.ts.map +0 -1
  143. package/src/js/types/players.d.ts +0 -58
  144. package/src/js/types/players.d.ts.map +0 -1
  145. package/src/js/types/studioModule.d.ts +0 -8
  146. package/src/js/types/studioModule.d.ts.map +0 -1
  147. package/src/js/utils/addPluginsDataToPlayers.d.ts +0 -6
  148. package/src/js/utils/addPluginsDataToPlayers.d.ts.map +0 -1
  149. package/src/js/utils/call.d.ts +0 -14
  150. package/src/js/utils/call.d.ts.map +0 -1
  151. package/src/js/utils/dimensions.d.ts +0 -9
  152. package/src/js/utils/dimensions.d.ts.map +0 -1
  153. package/src/js/utils/featureSwitches.d.ts +0 -2
  154. package/src/js/utils/featureSwitches.d.ts.map +0 -1
  155. package/src/js/utils/util.d.ts +0 -67
  156. package/src/js/utils/util.d.ts.map +0 -1
  157. package/src/module.d.ts +0 -2
  158. package/src/module.d.ts.map +0 -1
  159. package/src/styles/typings.td.d.ts +0 -13
  160. package/src/styles/typings.td.d.ts.map +0 -1
  161. package/src/types/studio.d.ts +0 -202
  162. package/src/types/studio.d.ts.map +0 -1
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { act, fireEvent, render } from '@testing-library/react';
3
+ import { TabsSection } from 'js/components';
4
+
5
+ const DEFAULT_MODAL_COMP = {
6
+ playerId: 'default',
7
+ videoId: '1234',
8
+ accountId: 'default',
9
+ isBcMapTracking: false,
10
+ };
11
+
12
+ test('renders TabsSection clickeable tabs', async () => {
13
+ const { getByRole, getByText } = render(
14
+ <TabsSection {...DEFAULT_MODAL_COMP} isCampaign isViewerIdSource={false} />,
15
+ );
16
+ const jsBtn = getByRole('tab', { name: /javascript/i });
17
+ act(() => {
18
+ fireEvent.click(jsBtn);
19
+ });
20
+ expect(getByText(/data-video-id/i)).toBeInTheDocument();
21
+ });
22
+
23
+ test('renders helper text for campaign players', async () => {
24
+ const { getByText } = render(
25
+ <TabsSection {...DEFAULT_MODAL_COMP} isCampaign isViewerIdSource={false} />,
26
+ );
27
+ expect(getByText('tabs.helperTextWarning')).toBeInTheDocument();
28
+ });
29
+
30
+ test('renders helper text for viewer id source players', async () => {
31
+ const { getByText } = render(
32
+ <TabsSection {...DEFAULT_MODAL_COMP} isCampaign={false} isViewerIdSource />,
33
+ );
34
+ expect(getByText('tabs.viewerIdTextWarning')).toBeInTheDocument();
35
+ });
36
+
37
+ test('renders iframe content if it is not campaign or viewer id', async () => {
38
+ const { getByText } = render(
39
+ <TabsSection
40
+ {...DEFAULT_MODAL_COMP}
41
+ isCampaign={false}
42
+ isViewerIdSource={false}
43
+ />,
44
+ );
45
+ expect(getByText(/allowfullscreen/i)).toBeInTheDocument();
46
+ });
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import { TitleWithTooltip } from '../src/js/components';
4
+ import { truncateVideoTitle } from '../src/js/utils/util';
5
+
6
+ const DEFAULT_VIDEO_COMP = {
7
+ videoId: '123',
8
+ videoName:
9
+ 'The cat is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family. ',
10
+ accountId: '456',
11
+ duration: 10,
12
+ };
13
+
14
+ const DEFAULT_PROJECT_COMP = {
15
+ videoId: '456',
16
+ interactivityProjectId: '987',
17
+ interactivityProjectName:
18
+ "The dog is a domesticated descendant of the wolf. Also called the domestic dog, it is derived from the extinct Pleistocene wolf, and the modern wolf is the dog's nearest living relative. ",
19
+ accountId: '456',
20
+ duration: 10,
21
+ };
22
+
23
+ test('renders TitleWithTooltip for Video with truncated title if its too long', () => {
24
+ const truncatedTitle = truncateVideoTitle(DEFAULT_VIDEO_COMP.videoName);
25
+ render(
26
+ <TitleWithTooltip
27
+ name={DEFAULT_VIDEO_COMP.videoName}
28
+ id={DEFAULT_VIDEO_COMP.videoId}
29
+ />,
30
+ );
31
+ expect(screen.getByText(truncatedTitle)).toBeInTheDocument();
32
+ });
33
+
34
+ test('renders TitleWithTooltip for Project with truncated title if its too long', () => {
35
+ const truncatedTitle = truncateVideoTitle(
36
+ DEFAULT_PROJECT_COMP.interactivityProjectName,
37
+ );
38
+ render(
39
+ <TitleWithTooltip
40
+ name={DEFAULT_PROJECT_COMP.interactivityProjectName}
41
+ id={DEFAULT_PROJECT_COMP.videoId}
42
+ />,
43
+ );
44
+ expect(screen.getByText(truncatedTitle)).toBeInTheDocument();
45
+ });
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import { QueryClientProvider, QueryClient } from 'react-query';
3
+ import { render, screen } from '@testing-library/react';
4
+ import { VideoPlayer } from '../src/js/components/VideoPlayer';
5
+ import { EmbedCodeModalTypes } from '../src/js/types/EmbedCodeModalProps';
6
+ import { PLAYER_LIST_FOR_SELECTION, PLAYERS } from '../src/js/constants/player';
7
+
8
+ jest.mock('../src/js/utils/featureSwitches');
9
+
10
+ const wrappedComponent = (children: React.ReactElement) => (
11
+ <QueryClientProvider client={new QueryClient()}>
12
+ {children}
13
+ </QueryClientProvider>
14
+ );
15
+
16
+ const DEFAULT_MODAL_COMP = {
17
+ videoId: '123',
18
+ videoName: 'test video',
19
+ accountId: '456',
20
+ duration: 10,
21
+ };
22
+
23
+ test('renders EmbedCodeModal component with right information', () => {
24
+ render(
25
+ wrappedComponent(
26
+ <VideoPlayer
27
+ video={DEFAULT_MODAL_COMP}
28
+ embedCodeModalType={EmbedCodeModalTypes.VIDEO}
29
+ playerListForSelection={PLAYER_LIST_FOR_SELECTION}
30
+ players={PLAYERS}
31
+ />,
32
+ ),
33
+ );
34
+ expect(screen.getByText(DEFAULT_MODAL_COMP.videoId)).toBeInTheDocument();
35
+ expect(screen.getByText(DEFAULT_MODAL_COMP.videoName)).toBeInTheDocument();
36
+ expect(screen.getByRole('tab', { name: /javascript/i })).toBeInTheDocument();
37
+ expect(screen.getByRole('tab', { name: /IFrame/i })).toBeInTheDocument();
38
+ });
@@ -0,0 +1,89 @@
1
+ import {
2
+ getVideoPreviewLink,
3
+ sortAsc,
4
+ truncateVideoTitle,
5
+ } from '../src/js/utils/util';
6
+
7
+ test('sorting working as expected', () => {
8
+ const data = [
9
+ { value: '6B9lFzOYe', label: '#1212' },
10
+ { value: 'BKCEJEm0L', label: 'other 2' },
11
+ { value: 'WbMYTw0lh', label: '&^qwe' },
12
+ { value: 'ZLJg8MzKS', label: '123' },
13
+ { value: 'default', label: 'Brightcove' },
14
+ ];
15
+ const expected = [
16
+ { value: 'WbMYTw0lh', label: '&^qwe' },
17
+ { value: '6B9lFzOYe', label: '#1212' },
18
+ { value: 'ZLJg8MzKS', label: '123' },
19
+ { value: 'default', label: 'Brightcove' },
20
+ { value: 'BKCEJEm0L', label: 'other 2' },
21
+ ];
22
+ expect(sortAsc(data)).toEqual(expected);
23
+ });
24
+
25
+ test('video preview url created correctly', () => {
26
+ const video = {
27
+ videoId: 'test',
28
+ videoName: 'test',
29
+ accountId: 'test',
30
+ posterUrl: 'test',
31
+ duration: 10,
32
+ };
33
+ const expected =
34
+ 'https://players.qa.brightcove.net/test/default_default/index.html?videoId=test';
35
+ expect(
36
+ getVideoPreviewLink({
37
+ accountId: video.accountId,
38
+ videoId: video.videoId,
39
+ playerId: 'default',
40
+ }),
41
+ ).toBe(expected);
42
+ });
43
+
44
+ test('interactivity project preview url created correctly', () => {
45
+ const video = {
46
+ interactivityProjectId: 'test',
47
+ accountId: 'test',
48
+ posterUrl: 'test',
49
+ duration: 10,
50
+ };
51
+ const expected =
52
+ 'https://players.qa.brightcove.net/test/default_default/index.html?interactivityProjectId=test';
53
+ expect(
54
+ getVideoPreviewLink({
55
+ accountId: video.accountId,
56
+ interactivityProjectId: video.interactivityProjectId,
57
+ playerId: 'default',
58
+ }),
59
+ ).toBe(expected);
60
+ });
61
+
62
+ test('long video titles are truncated properly', () => {
63
+ const video = {
64
+ videoId: 'test',
65
+ videoName:
66
+ 'The cat is a domestic species of small carnivorous mammal. It is the only domesticated species in the family Felidae and is often referred to as the domestic cat to distinguish it from the wild members of the family. ',
67
+ accountId: 'test',
68
+ posterUrl: 'test',
69
+ duration: 10,
70
+ };
71
+ const expected =
72
+ 'The cat is a domestic species of small carnivorous mammal. I...';
73
+ const truncatedTitle = truncateVideoTitle(video.videoName);
74
+
75
+ expect(expected).toEqual(truncatedTitle);
76
+ });
77
+
78
+ test('short video titles are truncated properly', () => {
79
+ const video = {
80
+ videoId: 'test',
81
+ videoName: 'This is a normal video title',
82
+ accountId: 'test',
83
+ posterUrl: 'test',
84
+ duration: 10,
85
+ };
86
+ const truncatedTitle = truncateVideoTitle(video.videoName);
87
+
88
+ expect(video.videoName).toEqual(truncatedTitle);
89
+ });
@@ -0,0 +1,17 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@babel/preset-env",
5
+ {
6
+ "useBuiltIns": "entry",
7
+ "corejs": 3
8
+ }
9
+ ],
10
+ "@babel/preset-typescript",
11
+ "@babel/preset-react"
12
+ ],
13
+ "plugins": [
14
+ "@babel/proposal-class-properties",
15
+ "@babel/plugin-transform-runtime"
16
+ ]
17
+ }
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEpAIBAAKCAQEAxXmI7sOBKvFm8TFIhKoYCYOaDE+upc6TcPqNlTt8wA8bBpUY
3
+ Je99ofu5CBNsD0uI1XTWy+Bjmo177ND+3apni6KZkOh8kSb/5OAL+eEbqHksL8Z6
4
+ +bAlKtOjjyv3Se/T8sEIo1dszgBFVdPbQZVrYLzGu9g6tLcu1jJ9mjdCLthEdSJH
5
+ tPkTFUYp8Wlup9qMmvG1jo2wqz4pFVtHyZW/fCkQ+MkfeOPnGiSw2oEnHaVmGuPF
6
+ eyxhWBh2q2MAqpyc9qVMkDQowQxtg//zOVlr632XZpI2xhpuINHUztDxEHOB3Hd5
7
+ lT+v3WQttQZ/1gRXaJkFAGKxgbLfuLh92L975QIDAQABAoIBAFKdh/YsAKwQlnqt
8
+ naMy7h982UPxSiXACNspV3ZpjsVjDHFyisnEKhFMmJqSVZEIjtSOrxZYaBNOwdvP
9
+ i/D8y5kVi52eRg8L+96rBRejX8jZ+Ox74xL26HXEWRca07gxB8D1lUGQ38pHPrqr
10
+ iX0kn+m20IXh7p2QTZ37PaT5HU0vHIs6K0wOWelPxjtU93FIsiwfaOOba3FOLEXa
11
+ Sd5GvRu9pCpSPO45zTsMI6w1MlD38KUJDcBf2Tm/gSMgfDvj1gPvynXBedlWDXsL
12
+ TIckV0YO0gmRiWanoXc0lafE3Fb0ctcRrGBBlpjhGxkXxYNY5A6b8CE9eJQWtUg8
13
+ 7Xo14kECgYEA9V3uqpE0TuArzNzy8jth0meH/gGmIWknQSCSX2wj6b4yvArOWrsS
14
+ qyq1Wd0JfE8AOZf4uWuiJKRk0uRE+xkpYk4tH+7/0+R315a1SXiQb020R6iMC406
15
+ wrRSz0R+xFF8zyD4AKKxSO8CgMotcU/oH78lGObWwTuxQlptXjcC8/kCgYEAzghL
16
+ EDS6TzM9EFt8rbOi6quoahTsDNoPm8kG1TNKxmM805N7dQS3E72/6Sp2ndiTysgu
17
+ rS8j0JC8yBx6oaQMcvY/dUZ3/ZdR6Y6SDqmaTFmbcpWGQzKW89VP5kIffi80dF3A
18
+ FtXt94mG2vcbxdWxyC8CIrDwevfmczs0C5pPak0CgYBHJHcg6X0bKZBJk/61EVap
19
+ pO8fTOcYZN7G2WTXWgmHqmgXcaKnV/pvurBeX+JyMo3EJTYuvPCEY04Af8MocwE2
20
+ yaf3zFpM27+LuNzTcqueOg99f3crmkVhUtt30UpYLbBcdhiyRnnUxcgaA4Tth9er
21
+ 7MYa1EOMP3yD2qg/Wv/2MQKBgQCnRrJzCOxPC0HDuxOiD9vw/cexwSTZVl4f1HoY
22
+ tRk7syyadv5gRqDBhWh/zXsastFjbV4AO+qvFiQ/sGecPw3gdK+W7szS9n2Jy7gn
23
+ 8WmWHZaI1H96pWNLut+xCfR5xaen5snjgHNBa8YylzhUSiiaaBgqxE+q9wSCgAnE
24
+ ddeObQKBgQCpy2Vq/aUUNMVNDV3vmEwYRD8qsqe5JWXswyOM+ZyHg3N06auP2RHx
25
+ NqUE9gdDxR1gc6cUhxbR9+L9DMEWiLVqXY51yddMCVuQVTHyH4MhyJcXv1eEbtX2
26
+ T/5dnQPy5ib85HAvAei6bf+uRKjm86984JfYZIwEwbGS+H9irF/3Pw==
27
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,96 @@
1
+ Certificate:
2
+ Data:
3
+ Version: 3 (0x2)
4
+ Serial Number: 4109 (0x100d)
5
+ Signature Algorithm: sha256WithRSAEncryption
6
+ Issuer: C=US, ST=Massachusetts, L=Boston, O=Brightcove Inc., OU=Systems Engineering/emailAddress=syseng@brightcove.com
7
+ Validity
8
+ Not Before: Jan 22 15:49:19 2016 GMT
9
+ Not After : Jan 19 15:49:19 2026 GMT
10
+ Subject: C=US, ST=Massachusetts, O=Brightcove Inc., OU=Systems Engineering, CN=*.brightcove.com/emailAddress=syseng@brightcove.com
11
+ Subject Public Key Info:
12
+ Public Key Algorithm: rsaEncryption
13
+ RSA Public Key: (2048 bit)
14
+ Modulus (2048 bit):
15
+ 00:c5:79:88:ee:c3:81:2a:f1:66:f1:31:48:84:aa:
16
+ 18:09:83:9a:0c:4f:ae:a5:ce:93:70:fa:8d:95:3b:
17
+ 7c:c0:0f:1b:06:95:18:25:ef:7d:a1:fb:b9:08:13:
18
+ 6c:0f:4b:88:d5:74:d6:cb:e0:63:9a:8d:7b:ec:d0:
19
+ fe:dd:aa:67:8b:a2:99:90:e8:7c:91:26:ff:e4:e0:
20
+ 0b:f9:e1:1b:a8:79:2c:2f:c6:7a:f9:b0:25:2a:d3:
21
+ a3:8f:2b:f7:49:ef:d3:f2:c1:08:a3:57:6c:ce:00:
22
+ 45:55:d3:db:41:95:6b:60:bc:c6:bb:d8:3a:b4:b7:
23
+ 2e:d6:32:7d:9a:37:42:2e:d8:44:75:22:47:b4:f9:
24
+ 13:15:46:29:f1:69:6e:a7:da:8c:9a:f1:b5:8e:8d:
25
+ b0:ab:3e:29:15:5b:47:c9:95:bf:7c:29:10:f8:c9:
26
+ 1f:78:e3:e7:1a:24:b0:da:81:27:1d:a5:66:1a:e3:
27
+ c5:7b:2c:61:58:18:76:ab:63:00:aa:9c:9c:f6:a5:
28
+ 4c:90:34:28:c1:0c:6d:83:ff:f3:39:59:6b:eb:7d:
29
+ 97:66:92:36:c6:1a:6e:20:d1:d4:ce:d0:f1:10:73:
30
+ 81:dc:77:79:95:3f:af:dd:64:2d:b5:06:7f:d6:04:
31
+ 57:68:99:05:00:62:b1:81:b2:df:b8:b8:7d:d8:bf:
32
+ 7b:e5
33
+ Exponent: 65537 (0x10001)
34
+ X509v3 extensions:
35
+ X509v3 Basic Constraints:
36
+ CA:FALSE
37
+ Netscape Comment:
38
+ OpenSSL Generated Certificate
39
+ X509v3 Subject Key Identifier:
40
+ 25:8C:64:B3:F5:49:BD:8A:1F:42:9A:D6:69:9C:B4:04:FE:4B:82:C2
41
+ X509v3 Authority Key Identifier:
42
+ keyid:D1:E0:AC:DE:01:80:DB:94:DA:29:66:0F:A9:48:11:BF:62:9F:51:9E
43
+ DirName:/C=US/ST=Massachusetts/L=Boston/O=Brightcove Inc./OU=Systems Engineering/emailAddress=syseng@brightcove.com
44
+ serial:C2:3B:9A:77:9C:63:DE:2B
45
+
46
+ X509v3 Subject Alternative Name:
47
+ DNS:*.brightcove.com, DNS:*.qa.brightcove.com, DNS:*.oauth.qa.brightcove.com, DNS:*.staging.brightcove.com
48
+ X509v3 Key Usage:
49
+ Digital Signature, Non Repudiation, Key Encipherment
50
+ Signature Algorithm: sha256WithRSAEncryption
51
+ a7:58:ec:1b:a5:c3:29:1d:71:c1:dd:b0:8c:ac:1d:34:b3:24:
52
+ 56:53:43:37:49:20:21:13:b3:1c:bc:d9:a3:e3:56:49:15:56:
53
+ 40:51:6f:cf:9e:c1:c2:ad:08:67:b1:bd:a6:11:3b:35:65:06:
54
+ b3:ff:de:36:93:86:10:45:e9:36:0a:5b:26:f0:23:82:8f:83:
55
+ 9f:1d:3f:be:ab:54:b3:f6:6c:7d:7b:67:6f:27:f7:f9:fa:30:
56
+ 27:1e:70:e4:05:85:ac:ad:d8:a5:45:83:54:68:0a:1d:fa:c2:
57
+ 05:46:41:d3:ad:a9:97:db:7a:fa:77:e1:0f:b0:29:09:da:15:
58
+ 2c:f1:d4:0f:a4:ce:90:fe:54:23:20:5c:68:3d:3a:06:0e:83:
59
+ ab:3a:3e:43:84:2f:71:5f:d9:c8:29:d1:35:51:c2:c2:57:75:
60
+ 8b:10:1e:cd:c0:8b:ca:b1:31:bb:5c:cf:03:52:05:f1:a8:0e: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94
+ IpbL3SsAaFzOzdbnXfH+nmAHft8t1Zl0s5AzVdoYfIMxgFmxpVMvXPKG0W/r/mhd
95
+ owtSNth3QCT87VxyeiPlL7tr
96
+ -----END CERTIFICATE-----
@@ -0,0 +1,62 @@
1
+ import '@testing-library/jest-dom';
2
+ import 'jest-canvas-mock';
3
+ import ResizeObserver from 'resize-observer-polyfill';
4
+
5
+ // eslint-disable-next-line no-undef
6
+ jest.mock('js/hooks/useGetPlayers', () => {
7
+ // eslint-disable-next-line no-undef
8
+ return jest.fn().mockReturnValue({
9
+ isLoading: false,
10
+ data: {
11
+ items: [
12
+ {
13
+ account_id: 'test',
14
+ id: 'default',
15
+ name: 'default',
16
+ description: 'test',
17
+ branches: { master: { configuration: {} } },
18
+ created_at: 'test',
19
+ embed_count: 2,
20
+ url: 'test',
21
+ },
22
+ ],
23
+ },
24
+ });
25
+ });
26
+
27
+ // eslint-disable-next-line no-undef
28
+ jest.mock('react-i18next', () => ({
29
+ useTranslation: () => {
30
+ return {
31
+ t: (str) => str,
32
+ i18n: {
33
+ changeLanguage: () =>
34
+ new Promise(() => {
35
+ return;
36
+ }),
37
+ },
38
+ };
39
+ },
40
+ initReactI18next: {
41
+ type: '3rdParty',
42
+ init: () => {
43
+ return;
44
+ },
45
+ },
46
+ Trans: () => '<div/>',
47
+ }));
48
+
49
+ global.StudioModule = {
50
+ config: {
51
+ product: {
52
+ env: 'qa',
53
+ },
54
+ },
55
+ getCurrentUserAccount: () => {
56
+ return {
57
+ roles: [],
58
+ };
59
+ },
60
+ };
61
+
62
+ global.ResizeObserver = ResizeObserver;
@@ -0,0 +1,4 @@
1
+ // stub out modules that you want to load for tests here
2
+ module.exports = {
3
+ process: () => '',
4
+ };
package/jest.config.js ADDED
@@ -0,0 +1,24 @@
1
+ module.exports = {
2
+ transform: {
3
+ '\\.(css|sass)$': '<rootDir>/jest/jest.stub.js',
4
+ '^.+\\.(t|j)sx?$': 'babel-jest',
5
+ },
6
+ moduleNameMapper: {
7
+ '^js/(.*)$': '<rootDir>/src/js/$1',
8
+ '^styles/(.*)$': '<rootDir>/src/styles/$1',
9
+ '^mocks/(.*)$': '<rootDir>/__mocks__/$1',
10
+ '^translations/(.*)$': '<rootDir>/src/translations/$1',
11
+ '\\.(css|sass)$': '<rootDir>/jest/jest.stub.js',
12
+ },
13
+ testPathIgnorePatterns : [
14
+ './build/',
15
+ ],
16
+ setupFilesAfterEnv: ['<rootDir>/jest/jest.setup.js'],
17
+ coveragePathIgnorePatterns: [
18
+ '/node_modules/',
19
+ '/jest/',
20
+ '/locales/',
21
+ '/styles/',
22
+ ],
23
+ testEnvironment: 'jest-environment-jsdom',
24
+ };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@brightcove/components-embed-code-modal",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://bithub.brightcove.com/studio-ui-kit/studio-components-embed-code-modal.git"
7
7
  },
8
8
  "description": "Embed Code Modal used for publishing videos",
9
- "main": "./index.js",
9
+ "main": "build/index.js",
10
10
  "types": "./src/index.d.ts",
11
11
  "author": "Campaign Team",
12
12
  "scripts": {
@@ -15,14 +15,25 @@
15
15
  "build:watch": "NODE_ENV=production webpack --watch",
16
16
  "clean": "rm -r build",
17
17
  "lint": "eslint \"{src,__tests__,demo}/**/*.{ts,tsx,js,jsx}\"",
18
+ "lint:staged": "lint-staged",
18
19
  "type-check": "tsc",
19
20
  "notify": "notify-change -m proj-projstudio",
21
+ "prepare": "husky install",
20
22
  "release": "release-it",
21
23
  "test": "jest",
22
24
  "test:coverage": "jest --coverage",
23
25
  "test:watch": "jest --watch",
24
26
  "pre-commit": "lint-staged && npm test"
25
27
  },
28
+ "lint-staged": {
29
+ "*.{ts,tsx,js,jsx}": [
30
+ "eslint --fix",
31
+ "prettier --write"
32
+ ],
33
+ "*.{css,scss}": [
34
+ "prettier --write"
35
+ ]
36
+ },
26
37
  "devDependencies": {
27
38
  "@babel/core": "^7.20.7",
28
39
  "@babel/plugin-proposal-class-properties": "^7.16.0",
@@ -85,6 +96,5 @@
85
96
  "@brightcove/studio-icons": "*",
86
97
  "react": "^17.0.2",
87
98
  "react-dom": "^17.0.2"
88
- },
89
- "module": "./index.js"
90
- }
99
+ }
100
+ }
@@ -0,0 +1,18 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const pkg = require('../package.json');
4
+
5
+ const BUILD_DIR = path.resolve(__dirname, '..', 'build');
6
+
7
+ pkg.name = '@brightcove/components-embed-code-modal'
8
+ pkg.main = './index.js';
9
+ pkg.module = './index.js';
10
+
11
+ delete pkg.scripts.prepare;
12
+ delete pkg.scripts['lint:staged'];
13
+ delete pkg['lint-staged'];
14
+
15
+ fs.writeFileSync(
16
+ path.join(BUILD_DIR, 'package.json'),
17
+ JSON.stringify(pkg, null, 2)
18
+ );
package/src/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ import EmbedCodeModal from './js/EmbedCodeModal';
2
+ import type {
3
+ VideoPayload,
4
+ PlayerPayload,
5
+ ProjectPayload,
6
+ } from 'js/types/EmbedCodeModalProps';
7
+ // eslint-disable-next-line no-duplicate-imports
8
+ import { EmbedCodeModalTypes } from 'js/types/EmbedCodeModalProps';
9
+
10
+ export {
11
+ EmbedCodeModal,
12
+ VideoPayload,
13
+ PlayerPayload,
14
+ ProjectPayload,
15
+ EmbedCodeModalTypes,
16
+ };
@@ -0,0 +1,88 @@
1
+ import React, { useEffect, useState } from 'react';
2
+
3
+ import { I18nextProvider } from 'react-i18next';
4
+ import { initialize } from '@brightcove/studio-components';
5
+ import { QueryClient, QueryClientProvider } from 'react-query';
6
+
7
+ import { ModalContainer } from 'js/components';
8
+
9
+ import i18n from 'js/i18n';
10
+ import {
11
+ EmbedCodeModalTypes,
12
+ EmbedCodeProperties,
13
+ ModalDataPayload,
14
+ } from './types/EmbedCodeModalProps';
15
+
16
+ const appTheme = 'blueSteel';
17
+
18
+ initialize({ theme: appTheme });
19
+
20
+ const queryClient = new QueryClient();
21
+
22
+ export interface EmbedCodeModalProps {
23
+ data: ModalDataPayload;
24
+ language?: 'en' | 'es' | 'fr' | 'ko' | 'ja' | 'zh';
25
+ embedCodeModalType?: EmbedCodeModalTypes;
26
+ // Parameters to be passed in case the the type is Player
27
+ embedCodeProperties?: EmbedCodeProperties;
28
+ isOutstreamPlayer?: boolean;
29
+ showDVR?: boolean;
30
+ onDVRClick?: (newValue: boolean) => void;
31
+ dvrTime?: number;
32
+ showLowLatency?: boolean;
33
+ onLowLatencyClick?: (newValue: boolean) => void;
34
+ }
35
+
36
+ const EmbedModal = ({
37
+ data,
38
+ language,
39
+ embedCodeModalType,
40
+ embedCodeProperties,
41
+ isOutstreamPlayer,
42
+ showDVR,
43
+ onDVRClick,
44
+ dvrTime,
45
+ showLowLatency,
46
+ onLowLatencyClick,
47
+ }: EmbedCodeModalProps) => {
48
+ const [componentKey, setComponentKey] = useState(0);
49
+ const [hasCreatedPlayer, setHasCreatedPlayer] = useState(false);
50
+
51
+ useEffect(() => {
52
+ i18n.changeLanguage(language || window.StudioModule.config.lang);
53
+ }, [language]);
54
+
55
+ const handleSetComponentKey = () => {
56
+ setComponentKey(componentKey + 1);
57
+ };
58
+
59
+ const handleSetHasCreatedPlayer = (value: boolean) => {
60
+ setHasCreatedPlayer(value);
61
+ };
62
+
63
+ // avoid calling anything if there is not data
64
+ return data ? (
65
+ <QueryClientProvider client={queryClient}>
66
+ <I18nextProvider i18n={i18n}>
67
+ <ModalContainer
68
+ key={componentKey}
69
+ handleSetComponentKey={handleSetComponentKey}
70
+ data={data}
71
+ language={language}
72
+ embedCodeModalType={embedCodeModalType}
73
+ handleSetHasCreatedPlayer={handleSetHasCreatedPlayer}
74
+ hasCreatedPlayer={hasCreatedPlayer}
75
+ embedCodeProperties={embedCodeProperties}
76
+ isOutstreamPlayer={isOutstreamPlayer}
77
+ showDVR={showDVR}
78
+ onDVRClick={onDVRClick}
79
+ dvrTime={dvrTime}
80
+ showLowLatency={showLowLatency}
81
+ onLowLatencyClick={onLowLatencyClick}
82
+ />
83
+ </I18nextProvider>
84
+ </QueryClientProvider>
85
+ ) : null;
86
+ };
87
+
88
+ export default EmbedModal;