pds-dev-kit-web-test 0.2.22 → 0.2.23

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 (15) hide show
  1. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.js +1 -1
  2. package/dist/src/sub/DynamicLayout/components/YouTubeIframe/YouTubeIframe.d.ts +3 -1
  3. package/dist/src/sub/DynamicLayout/components/YouTubeIframe/YouTubeIframe.js +35 -24
  4. package/dist/src/sub/DynamicLayout/mock_customSection.js +4 -1
  5. package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +36 -1134
  6. package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +53 -2907
  7. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +3 -2
  8. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Image.js +25 -12
  9. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +3 -2
  10. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Twitter/Twitter.js +2 -1
  11. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/Youtube.js +1 -1
  12. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/hooks/useCLINK.d.ts +1 -0
  13. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/hooks/useCLINK.js +14 -4
  14. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/types.d.ts +1 -0
  15. package/package.json +1 -1
@@ -90,7 +90,7 @@ function CustomSectionBackgroundMedia(_a) {
90
90
  case 'IMAGE':
91
91
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR && ((0, jsx_runtime_1.jsx)(S_Image, __assign({ src: String(CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR), normalStyle: componentStyle }, { children: (0, jsx_runtime_1.jsx)("img", { src: String(CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR), style: { visibility: 'hidden', width: '100%', height: '100%' } }, void 0) }), void 0)) }, void 0));
92
92
  case 'YOUTUBE':
93
- return ((0, jsx_runtime_1.jsx)(S_YoutubeContainer, __assign({}, youtubeSize, { children: (0, jsx_runtime_1.jsx)(YouTubeIframe_1.YouTubeIframe, { id: playerId, src: String(CB_STYLE_PROP_BGMEDIA_SPEC_YSRC), loopMode: CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY ? 'use' : 'none', startSeconds: Number(CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME), endSeconds: Number(CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME) }, void 0) }), void 0));
93
+ return ((0, jsx_runtime_1.jsx)(S_YoutubeContainer, __assign({}, youtubeSize, { children: youtubeSize.height > 0 && youtubeSize.width > 0 && ((0, jsx_runtime_1.jsx)(YouTubeIframe_1.YouTubeIframe, { id: playerId, src: String(CB_STYLE_PROP_BGMEDIA_SPEC_YSRC), loopMode: CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY ? 'use' : 'none', startSeconds: Number(CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME), endSeconds: Number(CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME), customHeight: youtubeSize.height, customWidth: youtubeSize.width }, void 0)) }), void 0));
94
94
  case 'NONE':
95
95
  default:
96
96
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
@@ -5,6 +5,8 @@ declare type Props = {
5
5
  loopMode?: 'use' | 'none';
6
6
  startSeconds?: number;
7
7
  endSeconds?: number;
8
+ customHeight?: number;
9
+ customWidth?: number;
8
10
  };
9
- declare function YouTubeIframe({ id, src, loopMode, startSeconds, endSeconds }: Props): JSX.Element;
11
+ declare function YouTubeIframe({ id, src, loopMode, startSeconds, endSeconds, customHeight, customWidth }: Props): JSX.Element;
10
12
  export default YouTubeIframe;
@@ -13,17 +13,23 @@ var styled_components_1 = __importDefault(require("styled-components"));
13
13
  var hooks_1 = require("../../hooks");
14
14
  var TouTubeLinkParser_1 = __importDefault(require("../../utils/TouTubeLinkParser"));
15
15
  function YouTubeIframe(_a) {
16
- var id = _a.id, src = _a.src, _b = _a.loopMode, loopMode = _b === void 0 ? 'use' : _b, _c = _a.startSeconds, startSeconds = _c === void 0 ? 0 : _c, endSeconds = _a.endSeconds;
17
- var _d = (0, react_1.useState)(true), isYoutubeLoading = _d[0], setIsYoutubeLoading = _d[1];
18
- var _e = (0, react_1.useState)(null), error = _e[0], setError = _e[1];
16
+ var id = _a.id, src = _a.src, _b = _a.loopMode, loopMode = _b === void 0 ? 'use' : _b, _c = _a.startSeconds, startSeconds = _c === void 0 ? 0 : _c, _d = _a.endSeconds, endSeconds = _d === void 0 ? 0 : _d, customHeight = _a.customHeight, customWidth = _a.customWidth;
17
+ var _e = (0, react_1.useState)(true), isYoutubeLoading = _e[0], setIsYoutubeLoading = _e[1];
18
+ var _f = (0, react_1.useState)(null), error = _f[0], setError = _f[1];
19
+ var _g = (0, react_1.useState)(null), timeoutId = _g[0], setTimeoutId = _g[1];
19
20
  var playerRef = (0, react_1.useRef)();
20
21
  var videoId = TouTubeLinkParser_1.default.getId(src);
21
22
  var prevVideoId = (0, hooks_1.usePrevious)(videoId);
22
23
  var PLAYER_ID = "PLAYER_" + id;
23
24
  var YOUTUBE_SCRIPT_ID = "YOUTUBE_SCRIPT_" + id;
24
25
  var YOUTUBE_SCRIPT_SRC = 'https://www.youtube.com/iframe_api';
26
+ var section = {
27
+ start: startSeconds,
28
+ end: endSeconds
29
+ };
25
30
  var isLoop = loopMode === 'use';
26
31
  var onPlayerReady = (0, react_1.useCallback)(function (event) {
32
+ event.target.seekTo(section.start);
27
33
  event.target.mute();
28
34
  event.target.playVideo();
29
35
  }, []);
@@ -45,13 +51,21 @@ function YouTubeIframe(_a) {
45
51
  case ENDED:
46
52
  case PAUSED:
47
53
  setIsYoutubeLoading(true);
48
- event.target.playVideo();
54
+ isLoop && event.target.seekTo(section.start);
49
55
  break;
50
56
  case PLAYING:
51
57
  setError(null);
52
58
  setTimeout(function () {
53
59
  setIsYoutubeLoading(false);
54
60
  }, 100);
61
+ if (isLoop && stateCode === PLAYING && section.end > section.start) {
62
+ var duration = section.end - section.start;
63
+ var restartVideoSection = function () {
64
+ event.target.seekTo(section.start);
65
+ };
66
+ var id_1 = setTimeout(restartVideoSection, duration * 1000);
67
+ setTimeoutId(id_1);
68
+ }
55
69
  break;
56
70
  }
57
71
  }
@@ -59,6 +73,14 @@ function YouTubeIframe(_a) {
59
73
  setIsYoutubeLoading(true);
60
74
  }
61
75
  }, []);
76
+ (0, react_1.useEffect)(function () {
77
+ if (!timeoutId) {
78
+ return;
79
+ }
80
+ return function () {
81
+ timeoutId && clearTimeout(timeoutId);
82
+ };
83
+ }, [timeoutId]);
62
84
  var onPlayerError = (0, react_1.useCallback)(function (event) {
63
85
  var _a;
64
86
  // eslint-disable-next-line no-console
@@ -82,32 +104,21 @@ function YouTubeIframe(_a) {
82
104
  try {
83
105
  // api 참고
84
106
  // https://developers.google.com/youtube/player_parameters?hl=ko
85
- var playerVars = endSeconds
86
- ? {
107
+ var player = new window.YT.Player(PLAYER_ID, {
108
+ videoId: videoId,
109
+ height: customHeight || 720,
110
+ width: customWidth || 1920,
111
+ playerVars: {
112
+ cc_load_policy: 0,
87
113
  playsinline: 1,
88
114
  autoplay: 1,
89
115
  controls: 0,
90
116
  iv_load_policy: 3,
91
117
  listType: 'playlist',
118
+ disablekb: 1,
92
119
  playlist: videoId,
93
- loop: isLoop ? 1 : 0,
94
- start: startSeconds,
95
- end: endSeconds,
96
- cc_load_policy: 0
97
- }
98
- : {
99
- autoplay: 1,
100
- controls: 0,
101
- iv_load_policy: 3,
102
- listType: 'playlist',
103
- playlist: videoId,
104
- loop: isLoop ? 1 : 0,
105
- start: startSeconds,
106
- cc_load_policy: 0
107
- };
108
- var player = new window.YT.Player(PLAYER_ID, {
109
- videoId: videoId,
110
- playerVars: playerVars,
120
+ start: startSeconds
121
+ },
111
122
  events: {
112
123
  onReady: onPlayerReady,
113
124
  onStateChange: onPlayerStateChange,
@@ -243,7 +243,8 @@ exports.customSectionMock1 = {
243
243
  CB_CONTENT_PROP_CLINK: {
244
244
  CB_CONTENT_PROP_CLINK_SPEC_TYPE: 'EXTERNAL',
245
245
  CB_CONTENT_PROP_CLINK_SPEC_SRC: 'http://www.naver.com',
246
- CB_CONTENT_PROP_CLINK_SPEC_NEWTAB: true
246
+ CB_CONTENT_PROP_CLINK_SPEC_NEWTAB: true,
247
+ CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC: 'true'
247
248
  },
248
249
  CB_CONTENT_PROP_VISIBILITY: {
249
250
  CB_CONTENT_PROP_VISIBILITY_SPEC_DESKTOP: true,
@@ -342,6 +343,7 @@ exports.customSectionMock1 = {
342
343
  },
343
344
  CB_CONTENT_PROP_CLINK: {
344
345
  CB_CONTENT_PROP_CLINK_SPEC_NEWTAB: true,
346
+ CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC: 'true',
345
347
  CB_CONTENT_PROP_CLINK_SPEC_SRC: 'https://publ.co',
346
348
  CB_CONTENT_PROP_CLINK_SPEC_TYPE: 'EXTERNAL'
347
349
  },
@@ -616,6 +618,7 @@ exports.customSectionMock1 = {
616
618
  },
617
619
  CB_CONTENT_PROP_CLINK: {
618
620
  CB_CONTENT_PROP_CLINK_SPEC_NEWTAB: true,
621
+ CB_CONTENT_PROP_CLINK_SPEC_INTERNALSRC: 'true',
619
622
  CB_CONTENT_PROP_CLINK_SPEC_SRC: 'https://publ.co',
620
623
  CB_CONTENT_PROP_CLINK_SPEC_TYPE: 'EXTERNAL'
621
624
  },