pds-dev-kit-web-test 2.5.358 → 2.5.359
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.
- package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.js +0 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/VideoPlayer/VideoPlayer.js +42 -43
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/VideoPlayer/index.js +1 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseProperties.d.ts +2 -2
- package/package.json +1 -1
package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.js
CHANGED
@@ -48,7 +48,6 @@ var util_1 = require("../util");
|
|
48
48
|
function CustomSectionBackgroundMedia(_a) {
|
49
49
|
var specs = _a.specs, playerId = _a.playerId, mediaType = _a.mediaType, componentStyle = _a.componentStyle, device = _a.device, backgroundRef = _a.backgroundRef;
|
50
50
|
var _b = (0, util_1.parseSectionBackgroundMediaData)(specs, device), CB_STYLE_PROP_BGMEDIA_SPEC_YSRC = _b.CB_STYLE_PROP_BGMEDIA_SPEC_YSRC, CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY = _b.CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY, CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME = _b.CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME, CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME = _b.CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME, CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR = _b.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR, CB_STYLE_PROP_BGMEDIA_SPEC_VIDEOSELECTOR = _b.CB_STYLE_PROP_BGMEDIA_SPEC_VIDEOSELECTOR;
|
51
|
-
console.log(specs);
|
52
51
|
var _c = (0, react_1.useState)({ width: 0, height: 0 }), youtubeSize = _c[0], setYoutubeSize = _c[1];
|
53
52
|
var youTubeIframeKey = (0, react_1.useMemo)(function () {
|
54
53
|
return "".concat(utils_1.YouTubeLinkParser.getId(String(CB_STYLE_PROP_BGMEDIA_SPEC_YSRC)), "-").concat(CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY, "-").concat(CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME, "-").concat(CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME);
|
@@ -22,54 +22,37 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
22
22
|
var react_1 = require("react");
|
23
23
|
var compositionQueryContext_1 = require("../../../../../../../DynamicLayout/compositionQueryContext");
|
24
24
|
var dynamicLayoutContext_1 = require("../../../../../../../DynamicLayout/dynamicLayoutContext");
|
25
|
+
var hooks_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/hooks");
|
26
|
+
var colorUtil_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/newUtils/colorUtil");
|
27
|
+
var util_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/util");
|
25
28
|
var styled_components_1 = __importDefault(require("styled-components"));
|
26
|
-
require("../components/S_CB_AnimationObserverBox");
|
27
|
-
require("../components/S_CB_BoxWithShadow");
|
29
|
+
var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverBox");
|
30
|
+
var S_CB_BoxWithShadow_1 = require("../components/S_CB_BoxWithShadow");
|
28
31
|
var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
29
32
|
function VideoPlayer(props) {
|
30
33
|
var _a = (0, react_1.useContext)(dynamicLayoutContext_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
31
34
|
var queryContext = (0, compositionQueryContext_1.useCCBQueryPath)();
|
32
35
|
var CB_CONTENT_PROP_VIDEO = props.CB_CONTENT_PROP_VIDEO;
|
33
|
-
var
|
36
|
+
var index = props.index, CB_STYLE_PROP_BGCOLOR = props.CB_STYLE_PROP_BGCOLOR, CB_STYLE_PROP_SHADOW = props.CB_STYLE_PROP_SHADOW, CB_EFFECT_PROP_ENTANIM = props.CB_EFFECT_PROP_ENTANIM;
|
37
|
+
var isEditMode = mode === 'EDIT';
|
38
|
+
var _b = getBGColorStyles(CB_STYLE_PROP_BGCOLOR, device), bgColorStyle = _b.style, bgColorHoverStyle = _b.hoverStyle;
|
39
|
+
var _c = (0, util_1.parseProperties)(props, device), propsStyle = _c.style, propsHoverStyle = _c.hoverStyle, layoutStyle = _c.layout, effect = _c.effect;
|
40
|
+
var isEditModeAndHidden = propsStyle.visibility === 'hidden' && mode === 'EDIT';
|
41
|
+
if (mode === 'EDIT') {
|
42
|
+
propsStyle.visibility = 'visible';
|
43
|
+
}
|
44
|
+
var cbRef = (0, react_1.useRef)(null);
|
45
|
+
var entry = (0, hooks_1.useIntersectionObserver)(cbRef, { threshold: 0.2, freezeOnceVisible: false }, [
|
46
|
+
index
|
47
|
+
]);
|
48
|
+
var isVisible = !!(entry === null || entry === void 0 ? void 0 : entry.isIntersecting);
|
49
|
+
var effectCssProperties = isVisible ? effect : {};
|
50
|
+
var isNoneEffectType = device === 'DESKTOP'
|
51
|
+
? CB_EFFECT_PROP_ENTANIM.CB_EFFECT_PROP_ENTANIM_SPEC_TYPE === 'NONE'
|
52
|
+
: CB_EFFECT_PROP_ENTANIM['CB_EFFECT_PROP_ENTANIM_SPEC_TYPE:MOBILE'] === 'NONE';
|
53
|
+
var hasEffect = !isNoneEffectType;
|
54
|
+
var effectVisibleStyle = hasEffect ? { opacity: isVisible ? 1 : 0 } : {};
|
34
55
|
var CB_CONTENT_PROP_VIDEO_SPEC_CONNECTDATA = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_CONNECTDATA, CB_CONTENT_PROP_VIDEO_SPEC_MPLAY = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_MPLAY, CB_CONTENT_PROP_VIDEO_SPEC_REPLAY = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_REPLAY, CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR, CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME, CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME, CB_CONTENT_PROP_VIDEO_SPEC_THUMB = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_THUMB, CB_CONTENT_PROP_VIDEO_SPEC_TYPE = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_TYPE, CB_CONTENT_PROP_VIDEO_SPEC_VALUETYPE = CB_CONTENT_PROP_VIDEO.CB_CONTENT_PROP_VIDEO_SPEC_VALUETYPE;
|
35
|
-
// useEffect(() => {
|
36
|
-
// const video = videoRef.current;
|
37
|
-
// if (!video) return;
|
38
|
-
// // 비디오가 로드되면 시작 시간으로 이동
|
39
|
-
// const handleLoadedMetadata = () => {
|
40
|
-
// if (CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME) {
|
41
|
-
// video.currentTime = CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME;
|
42
|
-
// }
|
43
|
-
// };
|
44
|
-
// // 재생 중 끝 시간에 도달하면 정지 또는 루프
|
45
|
-
// const handleTimeUpdate = () => {
|
46
|
-
// if (
|
47
|
-
// CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME &&
|
48
|
-
// video.currentTime >= CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME
|
49
|
-
// ) {
|
50
|
-
// if (CB_CONTENT_PROP_VIDEO_SPEC_REPLAY) {
|
51
|
-
// // 루프: 시작 시간으로 이동 후 재생
|
52
|
-
// video.currentTime = CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME || 0;
|
53
|
-
// video.play();
|
54
|
-
// } else {
|
55
|
-
// // 정지
|
56
|
-
// video.pause();
|
57
|
-
// video.currentTime = CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME;
|
58
|
-
// }
|
59
|
-
// }
|
60
|
-
// };
|
61
|
-
// video.addEventListener('loadedmetadata', handleLoadedMetadata);
|
62
|
-
// video.addEventListener('timeupdate', handleTimeUpdate);
|
63
|
-
// return () => {
|
64
|
-
// video.removeEventListener('loadedmetadata', handleLoadedMetadata);
|
65
|
-
// video.removeEventListener('timeupdate', handleTimeUpdate);
|
66
|
-
// };
|
67
|
-
// }, [
|
68
|
-
// CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME,
|
69
|
-
// CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME,
|
70
|
-
// CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR,
|
71
|
-
// CB_CONTENT_PROP_VIDEO_SPEC_REPLAY
|
72
|
-
// ]);
|
73
56
|
var getTimeHash = function () {
|
74
57
|
if (typeof CB_CONTENT_PROP_VIDEO_SPEC_STARTTIME === 'number' &&
|
75
58
|
typeof CB_CONTENT_PROP_VIDEO_SPEC_ENDTIME === 'number') {
|
@@ -116,8 +99,24 @@ function VideoPlayer(props) {
|
|
116
99
|
observer.disconnect();
|
117
100
|
};
|
118
101
|
}, []);
|
119
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), (0, jsx_runtime_1.jsxs)(S_Video, __assign({ ref: videoRef, controls: true, poster: CB_CONTENT_PROP_VIDEO_SPEC_THUMB, preload: "auto", loop: true, muted: true }, { children: [(0, jsx_runtime_1.jsx)("source", { src: getVideoSrc() + getTimeHash(), type: "video/mp4" }), "Your browser does not support the video tag."] }), CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR)] }));
|
102
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isEditModeAndHidden && (0, jsx_runtime_1.jsx)(S_HiddenCover_1.S_HiddenCover, {}), (0, jsx_runtime_1.jsx)(S_CB_AnimationObserverBox_1.S_CB_AnimationObserverBox, __assign({ ref: hasEffect ? cbRef : null, effectVisibleStyle: effectVisibleStyle }, { children: (0, jsx_runtime_1.jsx)(S_CB_BoxWithShadow_1.S_CB_BoxWithShadow, __assign({ className: "cb-layout-box", normalStyle: __assign(__assign(__assign(__assign({}, propsStyle), layoutStyle), effectCssProperties), bgColorStyle), hoverStyle: __assign(__assign({}, propsHoverStyle), bgColorHoverStyle), cbStylePropsShadowSpecs: CB_STYLE_PROP_SHADOW, device: device }, { children: (0, jsx_runtime_1.jsxs)(S_Video, __assign({ isEditMode: isEditMode, ref: videoRef, controls: true, poster: CB_CONTENT_PROP_VIDEO_SPEC_THUMB, preload: "auto", loop: true, muted: true }, { children: [(0, jsx_runtime_1.jsx)("source", { src: getVideoSrc() + getTimeHash(), type: "video/mp4" }), "Your browser does not support the video tag."] }), CB_CONTENT_PROP_VIDEO_SPEC_SELECTOR) })) }))] }));
|
120
103
|
}
|
121
|
-
|
104
|
+
function getBGColorStyles(props, device) {
|
105
|
+
var availableSpecCodes = [
|
106
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ANGLE',
|
107
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_COLOR',
|
108
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDCOLOR',
|
109
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_ENDLOC',
|
110
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_GRADIENT',
|
111
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTCOLOR',
|
112
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_STARTLOC',
|
113
|
+
'CB_STYLE_PROP_BGCOLOR_SPEC_TYPE'
|
114
|
+
];
|
115
|
+
return (0, colorUtil_1.parseStyleColorToCSSProp)({ availableSpecCodes: availableSpecCodes, props: props, propKey: 'BGCOLOR', device: device });
|
116
|
+
}
|
117
|
+
var S_Video = styled_components_1.default.video(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 100%;\n object-fit: cover;\n pointer-events: ", ";\n width: 100%;\n"], ["\n height: 100%;\n object-fit: cover;\n pointer-events: ", ";\n width: 100%;\n"])), function (_a) {
|
118
|
+
var isEditMode = _a.isEditMode;
|
119
|
+
return (isEditMode ? 'none' : 'auto');
|
120
|
+
});
|
122
121
|
exports.default = VideoPlayer;
|
123
122
|
var templateObject_1;
|
@@ -4,5 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.VideoPlayer = void 0;
|
7
|
+
// export { default as VideoPlayer } from './VideoPlayer';
|
7
8
|
var VideoPlayer_1 = require("./VideoPlayer");
|
8
9
|
Object.defineProperty(exports, "VideoPlayer", { enumerable: true, get: function () { return __importDefault(VideoPlayer_1).default; } });
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { CB_LAYOUT_PROP_KEYS } from './layoutPropParsers/types';
|
2
2
|
import { CB_STYLE_PROP_KEYS } from './stylePropParsers/types';
|
3
|
-
import type { Device, ParserResult, CB_TEXT_PROPERTIES_TYPE, CB_BTN_PROPERTIES_TYPE, CB_IMG_PROPERTIES_TYPE, CB_TWITTER_PROPERTIES_TYPE, CB_DIVIDER_PROPERTIES_TYPE, CB_YOUTUBE_PROPERTIES_TYPE, CB_RICHTEXT_PROPERTIES_TYPE, CB_EMBED_PROPERTIES_TYPE, CB_LIST_PROPERTIES_TYPE, CB_CONTENTSCAROUSEL_PROPERTIES_TYPE, CB_SLIDEBANNER_PROPERTIES_TYPE } from './types';
|
3
|
+
import type { Device, ParserResult, CB_TEXT_PROPERTIES_TYPE, CB_BTN_PROPERTIES_TYPE, CB_IMG_PROPERTIES_TYPE, CB_TWITTER_PROPERTIES_TYPE, CB_DIVIDER_PROPERTIES_TYPE, CB_YOUTUBE_PROPERTIES_TYPE, CB_RICHTEXT_PROPERTIES_TYPE, CB_EMBED_PROPERTIES_TYPE, CB_LIST_PROPERTIES_TYPE, CB_CONTENTSCAROUSEL_PROPERTIES_TYPE, CB_SLIDEBANNER_PROPERTIES_TYPE, CB_VIDEOPLAYER_PROPERTIES_TYPE } from './types';
|
4
4
|
export type specTypes = CB_LAYOUT_PROP_KEYS | CB_STYLE_PROP_KEYS;
|
5
|
-
export default function parseProperties(properties: CB_TEXT_PROPERTIES_TYPE | CB_BTN_PROPERTIES_TYPE | CB_IMG_PROPERTIES_TYPE | CB_TWITTER_PROPERTIES_TYPE | CB_DIVIDER_PROPERTIES_TYPE | CB_YOUTUBE_PROPERTIES_TYPE | CB_RICHTEXT_PROPERTIES_TYPE | CB_EMBED_PROPERTIES_TYPE | CB_LIST_PROPERTIES_TYPE | CB_CONTENTSCAROUSEL_PROPERTIES_TYPE | CB_SLIDEBANNER_PROPERTIES_TYPE, device: Device): ParserResult;
|
5
|
+
export default function parseProperties(properties: CB_TEXT_PROPERTIES_TYPE | CB_BTN_PROPERTIES_TYPE | CB_IMG_PROPERTIES_TYPE | CB_TWITTER_PROPERTIES_TYPE | CB_DIVIDER_PROPERTIES_TYPE | CB_YOUTUBE_PROPERTIES_TYPE | CB_RICHTEXT_PROPERTIES_TYPE | CB_EMBED_PROPERTIES_TYPE | CB_LIST_PROPERTIES_TYPE | CB_CONTENTSCAROUSEL_PROPERTIES_TYPE | CB_SLIDEBANNER_PROPERTIES_TYPE | CB_VIDEOPLAYER_PROPERTIES_TYPE, device: Device): ParserResult;
|