pds-dev-kit-web-test 0.3.12 → 0.3.14
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/common/assets/icons/line/Face.d.ts +4 -0
- package/dist/src/common/assets/icons/line/Face.js +30 -0
- package/dist/src/common/assets/icons/line/index.d.ts +1 -0
- package/dist/src/common/assets/icons/line/index.js +2 -0
- package/dist/src/common/styles/colorSet/UIColor.json +2 -1
- package/dist/src/common/styles/colorSet/index.d.ts +965 -964
- package/dist/src/common/styles/colorSet/index.js +5 -5
- package/dist/src/common/styles/colorSet/ui-type.d.ts +1 -0
- package/dist/src/desktop/components/ChatBubbleListItem/ChatBubble.d.ts +1 -1
- package/dist/src/desktop/components/ChatBubbleListItem/ChatBubble.js +2 -1
- package/dist/src/desktop/components/ChatBubbleListItem/ChatBubbleListItem.d.ts +1 -1
- package/dist/src/desktop/components/ChatBubbleListItem/ChatBubbleListItem.js +2 -1
- package/dist/src/desktop/components/ChatList/Body.js +2 -1
- package/dist/src/mobile/components/ChatBubbleListItem/ChatBubble.d.ts +1 -1
- package/dist/src/mobile/components/ChatBubbleListItem/ChatBubble.js +2 -1
- package/dist/src/mobile/components/ChatBubbleListItem/ChatBubbleListItem.d.ts +1 -1
- package/dist/src/mobile/components/ChatBubbleListItem/ChatBubbleListItem.js +2 -1
- package/dist/src/mobile/components/ChatList/Body.js +1 -1
- package/dist/src/sub/DynamicLayout/DynamicLayout.d.ts +1 -1
- package/dist/src/sub/DynamicLayout/DynamicLayout.js +2 -3
- package/dist/src/sub/DynamicLayout/dynamicLayoutContext.js +1 -2
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +2 -3
- package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +2 -3
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/Youtube.d.ts +1 -0
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/Youtube.js +22 -50
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/parseYoutubeContentProp.d.ts +9 -1
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/parseYoutubeContentProp.js +31 -6
- package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/types.d.ts +2 -3
- package/dist/src/sub/DynamicLayout/types.d.ts +0 -1
- package/package.json +1 -1
- package/release-note.md +2 -2
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
/* eslint-disable import/order */
|
|
7
|
-
var SemanticColor_json_1 = __importDefault(require("./SemanticColor.json"));
|
|
8
7
|
var PaletteColor_Dark_json_1 = __importDefault(require("./PaletteColor_Dark.json"));
|
|
9
|
-
var UIColor_json_1 = __importDefault(require("./UIColor.json"));
|
|
10
8
|
var PaletteColor_light_json_1 = __importDefault(require("./PaletteColor_light.json"));
|
|
9
|
+
var SemanticColor_json_1 = __importDefault(require("./SemanticColor.json"));
|
|
10
|
+
var UIColor_json_1 = __importDefault(require("./UIColor.json"));
|
|
11
11
|
var colorSet = {
|
|
12
|
-
SemanticColor: SemanticColor_json_1.default,
|
|
13
12
|
PaletteColor_Dark: PaletteColor_Dark_json_1.default,
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
PaletteColor_light: PaletteColor_light_json_1.default,
|
|
14
|
+
SemanticColor: SemanticColor_json_1.default,
|
|
15
|
+
UIColor: UIColor_json_1.default
|
|
16
16
|
};
|
|
17
17
|
exports.default = colorSet;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export type ChatBubbleProps = {
|
|
3
|
-
colorTheme?: 'grey' | 'brand_primary' | 'translucent_white' | 'translucent_black';
|
|
3
|
+
colorTheme?: 'grey' | 'brand_primary' | 'translucent_white' | 'translucent_black' | 'transparent';
|
|
4
4
|
tailType?: 'none' | 'left_top' | 'right_top';
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
};
|
|
@@ -44,7 +44,8 @@ var backgroundColorTheme = {
|
|
|
44
44
|
grey: 'ui_cpnt_list_chatbubble_base_grey',
|
|
45
45
|
brand_primary: 'ui_cpnt_list_chatbubble_base_brand_primary',
|
|
46
46
|
translucent_white: 'ui_cpnt_list_chatbubble_base_translucent_white',
|
|
47
|
-
translucent_black: 'ui_cpnt_list_chatbubble_base_translucent_black'
|
|
47
|
+
translucent_black: 'ui_cpnt_list_chatbubble_base_translucent_black',
|
|
48
|
+
transparent: 'ui_cpnt_list_chatbubble_base_transparent'
|
|
48
49
|
};
|
|
49
50
|
function ChatBubble(_a) {
|
|
50
51
|
var _b = _a.colorTheme, colorTheme = _b === void 0 ? 'grey' : _b, _c = _a.tailType, tailType = _c === void 0 ? 'left_top' : _c, children = _a.children;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PDSTextType, PDSValueOption } from '../../../common';
|
|
3
|
-
type ColorThemeType = 'grey' | 'brand_primary' | 'translucent_white' | 'translucent_black';
|
|
3
|
+
type ColorThemeType = 'grey' | 'brand_primary' | 'translucent_white' | 'translucent_black' | 'transparent';
|
|
4
4
|
export type ChatBubbleListItemProps = {
|
|
5
5
|
titleText?: PDSTextType;
|
|
6
6
|
imageSrc?: string;
|
|
@@ -64,7 +64,8 @@ var profileImageBorderColorTheme = {
|
|
|
64
64
|
grey: 'ui_avatar_border',
|
|
65
65
|
brand_primary: 'ui_avatar_border_brandprimary',
|
|
66
66
|
translucent_white: 'ui_avatar_border_translucent_white',
|
|
67
|
-
translucent_black: 'ui_avatar_border_translucent_black'
|
|
67
|
+
translucent_black: 'ui_avatar_border_translucent_black',
|
|
68
|
+
transparent: 'ui_cpnt_list_chatbubble_base_transparent'
|
|
68
69
|
};
|
|
69
70
|
function ChatBubbleListItem(_a) {
|
|
70
71
|
var titleText = _a.titleText, imageSrc = _a.imageSrc, _b = _a.hoverMode, hoverMode = _b === void 0 ? 'use' : _b, styleTheme = _a.styleTheme, _c = _a.colorTheme, colorTheme = _c === void 0 ? 'grey' : _c, _d = _a.timeMode, timeMode = _d === void 0 ? 'use' : _d, timeText = _a.timeText, _e = _a.countMode, countMode = _e === void 0 ? 'none' : _e, countText = _a.countText, contextMenuOptionArray = _a.contextMenuOptionArray, _f = _a.contextMenuState, contextMenuState = _f === void 0 ? 'normal' : _f, children = _a.children, onClickContextMenuItem = _a.onClickContextMenuItem;
|
|
@@ -79,7 +79,8 @@ var Body = react_1.default.forwardRef(function (_a, ref) {
|
|
|
79
79
|
};
|
|
80
80
|
var handleScroll = function (e) {
|
|
81
81
|
var _a = e.currentTarget, scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
82
|
-
|
|
82
|
+
var BUTTON_SHOW_UP_HEIGHT = 64;
|
|
83
|
+
if (Math.ceil(scrollTop) + clientHeight + BUTTON_SHOW_UP_HEIGHT > scrollHeight) {
|
|
83
84
|
setIsButtonShow(false);
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export type ChatBubbleProps = {
|
|
3
|
-
colorTheme?: 'grey' | 'brand_primary' | 'translucent_white' | 'translucent_black';
|
|
3
|
+
colorTheme?: 'grey' | 'brand_primary' | 'translucent_white' | 'translucent_black' | 'transparent';
|
|
4
4
|
tailType?: 'none' | 'left_top' | 'right_top';
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
};
|
|
@@ -44,7 +44,8 @@ var backgroundColorTheme = {
|
|
|
44
44
|
grey: 'ui_cpnt_list_chatbubble_base_grey',
|
|
45
45
|
brand_primary: 'ui_cpnt_list_chatbubble_base_brand_primary',
|
|
46
46
|
translucent_white: 'ui_cpnt_list_chatbubble_base_translucent_white',
|
|
47
|
-
translucent_black: 'ui_cpnt_list_chatbubble_base_translucent_black'
|
|
47
|
+
translucent_black: 'ui_cpnt_list_chatbubble_base_translucent_black',
|
|
48
|
+
transparent: 'ui_cpnt_list_chatbubble_base_transparent'
|
|
48
49
|
};
|
|
49
50
|
function ChatBubble(_a) {
|
|
50
51
|
var _b = _a.colorTheme, colorTheme = _b === void 0 ? 'grey' : _b, _c = _a.tailType, tailType = _c === void 0 ? 'left_top' : _c, children = _a.children;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PDSTextType, PDSValueOption } from '../../../common';
|
|
3
|
-
type ColorThemeType = 'grey' | 'brand_primary' | 'translucent_white' | 'translucent_black';
|
|
3
|
+
type ColorThemeType = 'grey' | 'brand_primary' | 'translucent_white' | 'translucent_black' | 'transparent';
|
|
4
4
|
export type ChatBubbleListItemProps = {
|
|
5
5
|
titleText?: PDSTextType;
|
|
6
6
|
imageSrc?: string;
|
|
@@ -64,7 +64,8 @@ var profileImageBorderColorTheme = {
|
|
|
64
64
|
grey: 'ui_avatar_border',
|
|
65
65
|
brand_primary: 'ui_avatar_border_brandprimary',
|
|
66
66
|
translucent_white: 'ui_avatar_border_translucent_white',
|
|
67
|
-
translucent_black: 'ui_avatar_border_translucent_black'
|
|
67
|
+
translucent_black: 'ui_avatar_border_translucent_black',
|
|
68
|
+
transparent: 'ui_cpnt_list_chatbubble_base_transparent'
|
|
68
69
|
};
|
|
69
70
|
function ChatBubbleListItem(_a) {
|
|
70
71
|
var titleText = _a.titleText, imageSrc = _a.imageSrc, _b = _a.hoverMode, hoverMode = _b === void 0 ? 'use' : _b, styleTheme = _a.styleTheme, _c = _a.colorTheme, colorTheme = _c === void 0 ? 'grey' : _c, _d = _a.timeMode, timeMode = _d === void 0 ? 'use' : _d, timeText = _a.timeText, _e = _a.countMode, countMode = _e === void 0 ? 'none' : _e, countText = _a.countText, contextMenuOptionArray = _a.contextMenuOptionArray, _f = _a.contextMenuState, contextMenuState = _f === void 0 ? 'normal' : _f, children = _a.children, onClickContextMenuItem = _a.onClickContextMenuItem;
|
|
@@ -79,7 +79,7 @@ var Body = react_1.default.forwardRef(function (_a, ref) {
|
|
|
79
79
|
};
|
|
80
80
|
var handleScroll = function (e) {
|
|
81
81
|
var _a = e.currentTarget, scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
82
|
-
var BUTTON_SHOW_UP_HEIGHT =
|
|
82
|
+
var BUTTON_SHOW_UP_HEIGHT = 64;
|
|
83
83
|
if (Math.ceil(scrollTop) + clientHeight + BUTTON_SHOW_UP_HEIGHT > scrollHeight) {
|
|
84
84
|
setIsButtonShow(false);
|
|
85
85
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { DynamicLayoutProps } from './types';
|
|
3
|
-
declare function DynamicLayout({ device, mode, isPreview, sections, scrollDownTargetSectionId, editingSectionId, navigationHandler, sectionActionHandler, onClickEditSection, programmedSectionComponents
|
|
3
|
+
declare function DynamicLayout({ device, mode, isPreview, sections, scrollDownTargetSectionId, editingSectionId, navigationHandler, sectionActionHandler, onClickEditSection, programmedSectionComponents }: DynamicLayoutProps): JSX.Element;
|
|
4
4
|
export default DynamicLayout;
|
|
@@ -25,7 +25,7 @@ var EditModeSectionMatcher_1 = require("./components/EditModeSectionMatcher");
|
|
|
25
25
|
var SectionMatcher_1 = require("./components/SectionMatcher");
|
|
26
26
|
var dynamicLayoutContext_1 = require("./dynamicLayoutContext");
|
|
27
27
|
function DynamicLayout(_a) {
|
|
28
|
-
var device = _a.device, _b = _a.mode, mode = _b === void 0 ? 'NORMAL' : _b, isPreview = _a.isPreview, sections = _a.sections, scrollDownTargetSectionId = _a.scrollDownTargetSectionId, editingSectionId = _a.editingSectionId, navigationHandler = _a.navigationHandler, sectionActionHandler = _a.sectionActionHandler, onClickEditSection = _a.onClickEditSection, programmedSectionComponents = _a.programmedSectionComponents
|
|
28
|
+
var device = _a.device, _b = _a.mode, mode = _b === void 0 ? 'NORMAL' : _b, isPreview = _a.isPreview, sections = _a.sections, scrollDownTargetSectionId = _a.scrollDownTargetSectionId, editingSectionId = _a.editingSectionId, navigationHandler = _a.navigationHandler, sectionActionHandler = _a.sectionActionHandler, onClickEditSection = _a.onClickEditSection, programmedSectionComponents = _a.programmedSectionComponents;
|
|
29
29
|
var filteredSortedSection = __spreadArray([], sections, true).filter(function (section) { return section.display; })
|
|
30
30
|
.sort(function (a, b) { return a.order - b.order; });
|
|
31
31
|
var iframeSection = filteredSortedSection.find(function (section) { return section.manifest.schema === 'EXP_IFRAME' && section.display; });
|
|
@@ -36,8 +36,7 @@ function DynamicLayout(_a) {
|
|
|
36
36
|
navigationHandler: navigationHandler,
|
|
37
37
|
sectionActionHandler: sectionActionHandler,
|
|
38
38
|
editingSectionId: editingSectionId,
|
|
39
|
-
programmedSectionComponents: programmedSectionComponents
|
|
40
|
-
youtubeAutoplayMode: youtubeAutoplayMode
|
|
39
|
+
programmedSectionComponents: programmedSectionComponents
|
|
41
40
|
} }, { children: [mode === 'EDIT' && onClickEditSection && ((0, jsx_runtime_1.jsx)(EditModeSectionMatcher_1.EditModeSectionMatcher, { editingSectionId: editingSectionId, scrollDownTargetSectionId: scrollDownTargetSectionId, filteredSortedSection: filteredSortedSection, onClickEditSection: onClickEditSection })), mode !== 'EDIT' &&
|
|
42
41
|
(iframeSection ? ((0, jsx_runtime_1.jsx)(SectionMatcher_1.SectionMatcher, __assign({}, iframeSection), iframeSection.id)) : (filteredSortedSection.map(function (section) { return (0, jsx_runtime_1.jsx)(SectionMatcher_1.SectionMatcher, __assign({}, section), section.id); })))] })));
|
|
43
42
|
}
|
|
@@ -699,9 +699,8 @@ export declare const sampleCustomsection1: {
|
|
|
699
699
|
CB_CONTENT_PROP_VISIBILITY_SPEC_MOBILEWEB: boolean;
|
|
700
700
|
};
|
|
701
701
|
CB_CONTENT_PROP_YOUTUBE: {
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
CB_CONTENT_PROP_YOUTUBE_SPEC_REPLAY: boolean;
|
|
702
|
+
CB_CONTENT_PROP_YOUTUBE_SPEC_AUTOPLAY: boolean;
|
|
703
|
+
CB_CONTENT_PROP_YOUTUBE_SPEC_MAUTOPLAY: boolean;
|
|
705
704
|
CB_CONTENT_PROP_YOUTUBE_SPEC_SRC: string;
|
|
706
705
|
CB_CONTENT_PROP_YOUTUBE_SPEC_STARTTIME: number;
|
|
707
706
|
};
|
|
@@ -659,9 +659,8 @@ exports.sampleCustomsection1 = {
|
|
|
659
659
|
CB_CONTENT_PROP_VISIBILITY_SPEC_MOBILEWEB: true
|
|
660
660
|
},
|
|
661
661
|
CB_CONTENT_PROP_YOUTUBE: {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
CB_CONTENT_PROP_YOUTUBE_SPEC_REPLAY: true,
|
|
662
|
+
CB_CONTENT_PROP_YOUTUBE_SPEC_AUTOPLAY: false,
|
|
663
|
+
CB_CONTENT_PROP_YOUTUBE_SPEC_MAUTOPLAY: false,
|
|
665
664
|
CB_CONTENT_PROP_YOUTUBE_SPEC_SRC: 'https://www.youtube.com/watch?v=ryYFcl57bVo',
|
|
666
665
|
CB_CONTENT_PROP_YOUTUBE_SPEC_STARTTIME: 0
|
|
667
666
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { CB_YOUTUBE_PROPERTIES_TYPE } from '../../../../../../../DynamicLayout/sections/CustomSection/util/types';
|
|
3
3
|
type Props = CB_YOUTUBE_PROPERTIES_TYPE;
|
|
4
|
+
export type YOUTUBE_AUTOPLAY_TRIGGER_POINT = 'ALWAYS' | 'VIEWPORT-FREEZE' | 'VIEWPORT';
|
|
4
5
|
declare function Youtube(props: Props): JSX.Element;
|
|
5
6
|
export default Youtube;
|
|
@@ -25,16 +25,16 @@ var DynamicLayout_1 = require("../../../../../../../DynamicLayout");
|
|
|
25
25
|
var hooks_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/hooks");
|
|
26
26
|
var colorUtil_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/newUtils/colorUtil");
|
|
27
27
|
var util_1 = require("../../../../../../../DynamicLayout/sections/CustomSection/util");
|
|
28
|
-
var utils_1 = require("../../../../../../../DynamicLayout/utils");
|
|
29
28
|
var styled_components_1 = __importDefault(require("styled-components"));
|
|
30
29
|
var S_CB_AnimationObserverBox_1 = require("../components/S_CB_AnimationObserverBox");
|
|
31
30
|
var S_CB_BoxWithShadow_1 = require("../components/S_CB_BoxWithShadow");
|
|
32
31
|
var S_HiddenCover_1 = require("../components/S_HiddenCover");
|
|
33
32
|
var parseYoutubeContentProp_1 = __importDefault(require("./parseYoutubeContentProp"));
|
|
33
|
+
var YOUTUBE_AUTOPLAY_TRIGGER_POINT = 'VIEWPORT';
|
|
34
34
|
function Youtube(props) {
|
|
35
|
-
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode
|
|
35
|
+
var _a = (0, react_1.useContext)(DynamicLayout_1.dynamicLayoutContext), device = _a.device, mode = _a.mode;
|
|
36
36
|
var CB_CONTENT_PROP_YOUTUBE = props.CB_CONTENT_PROP_YOUTUBE, 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 _b = (0, parseYoutubeContentProp_1.default)(CB_CONTENT_PROP_YOUTUBE), youtubeSrc = _b.youtubeSrc, thumbnailSrc = _b.thumbnailSrc, id = _b.id;
|
|
37
|
+
var _b = (0, parseYoutubeContentProp_1.default)(CB_CONTENT_PROP_YOUTUBE, device, YOUTUBE_AUTOPLAY_TRIGGER_POINT), youtubeSrc = _b.youtubeSrc, thumbnailSrc = _b.thumbnailSrc, id = _b.id, cbAutoplayMode = _b.cbAutoplayMode;
|
|
38
38
|
var isEditMode = mode === 'EDIT';
|
|
39
39
|
var _c = getBGColorStyles(CB_STYLE_PROP_BGCOLOR, device), bgColorStyle = _c.style, bgColorHoverStyle = _c.hoverStyle;
|
|
40
40
|
var _d = (0, util_1.parseProperties)(props, device), propsStyle = _d.style, propsHoverStyle = _d.hoverStyle, layoutStyle = _d.layout, effect = _d.effect;
|
|
@@ -54,38 +54,32 @@ function Youtube(props) {
|
|
|
54
54
|
var iframeRef = (0, react_1.useRef)(null);
|
|
55
55
|
var autoplayRef = (0, react_1.useRef)(null);
|
|
56
56
|
var autoplayEntry = (0, hooks_1.useIntersectionObserver)(autoplayRef, {
|
|
57
|
-
freezeOnceVisible:
|
|
57
|
+
freezeOnceVisible: YOUTUBE_AUTOPLAY_TRIGGER_POINT === 'VIEWPORT-FREEZE' ? true : false
|
|
58
58
|
});
|
|
59
|
-
var
|
|
60
|
-
var _a
|
|
61
|
-
if (
|
|
62
|
-
return
|
|
59
|
+
var onLoadIframe = function () {
|
|
60
|
+
var _a;
|
|
61
|
+
if (!((_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow)) {
|
|
62
|
+
return;
|
|
63
63
|
}
|
|
64
|
-
if (
|
|
65
|
-
if (!((_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow)) {
|
|
66
|
-
console.log('ERROR: no CONTENT WINDOW');
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
64
|
+
if (cbAutoplayMode === 'VIEWPORT' && (autoplayEntry === null || autoplayEntry === void 0 ? void 0 : autoplayEntry.isIntersecting)) {
|
|
69
65
|
iframeRef.current.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
|
|
70
|
-
console.log('VIEWPORT & intersecting');
|
|
71
|
-
return true;
|
|
72
66
|
}
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
};
|
|
68
|
+
// NOTE: Effect for AUTO-PLAY
|
|
69
|
+
(0, react_1.useEffect)(function () {
|
|
70
|
+
var _a;
|
|
71
|
+
if (!((_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (cbAutoplayMode === 'VIEWPORT' && (autoplayEntry === null || autoplayEntry === void 0 ? void 0 : autoplayEntry.isIntersecting)) {
|
|
75
|
+
iframeRef.current.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
|
|
75
76
|
}
|
|
76
|
-
if (
|
|
77
|
-
console.log('viewport and NOT intersecting');
|
|
78
|
-
if (!((_b = iframeRef.current) === null || _b === void 0 ? void 0 : _b.contentWindow)) {
|
|
79
|
-
console.log('no window, return true');
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
77
|
+
if (cbAutoplayMode === 'VIEWPORT' && !(autoplayEntry === null || autoplayEntry === void 0 ? void 0 : autoplayEntry.isIntersecting)) {
|
|
82
78
|
iframeRef.current.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*');
|
|
83
|
-
console.log('send pause');
|
|
84
|
-
return true;
|
|
85
79
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
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({ ref: autoplayRef, 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: isEditMode ? ((0, jsx_runtime_1.jsxs)(S_ThumbnailBox, { children: [(0, jsx_runtime_1.jsx)(YoutubeButton, {}), (0, jsx_runtime_1.jsx)(S_Thumbnail, { src: thumbnailSrc })] })) : ((0, jsx_runtime_1.jsx)(S_Iframe, { ref: iframeRef, title: id, src:
|
|
80
|
+
}, [autoplayEntry === null || autoplayEntry === void 0 ? void 0 : autoplayEntry.isIntersecting, cbAutoplayMode]);
|
|
81
|
+
console.log(youtubeSrc);
|
|
82
|
+
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({ ref: autoplayRef, 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: isEditMode ? ((0, jsx_runtime_1.jsxs)(S_ThumbnailBox, { children: [(0, jsx_runtime_1.jsx)(YoutubeButton, {}), (0, jsx_runtime_1.jsx)(S_Thumbnail, { src: thumbnailSrc })] })) : ((0, jsx_runtime_1.jsx)(S_Iframe, { ref: iframeRef, title: id, src: youtubeSrc, onLoad: onLoadIframe, allow: "accelerometer; encrypted-media; gyroscope; picture-in-picture" })) })) }))] }));
|
|
89
83
|
}
|
|
90
84
|
function getBGColorStyles(props, device) {
|
|
91
85
|
var availableSpecCodes = [
|
|
@@ -107,27 +101,5 @@ var S_YoutubeButton = styled_components_1.default.div(templateObject_4 || (templ
|
|
|
107
101
|
function YoutubeButton() {
|
|
108
102
|
return ((0, jsx_runtime_1.jsx)(S_YoutubeButton, { children: (0, jsx_runtime_1.jsxs)("svg", __assign({ height: "100%", version: "1.1", viewBox: "0 0 68 48", width: "100%" }, { children: [(0, jsx_runtime_1.jsx)("path", { className: "ytp-large-play-button-bg", d: "M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z", fill: "#f00" }), (0, jsx_runtime_1.jsx)("path", { d: "M 45,24 27,14 27,34", fill: "#fff" })] })) }));
|
|
109
103
|
}
|
|
110
|
-
function getAutoplaySrc(youtubeSrc, youtubeAutoplayMode) {
|
|
111
|
-
try {
|
|
112
|
-
var url = new URL(youtubeSrc);
|
|
113
|
-
if (url.hostname.includes('youtube.com') || url.hostname.includes('youtu.be')) {
|
|
114
|
-
var id = utils_1.YouTubeLinkParser.getId(youtubeSrc);
|
|
115
|
-
if (youtubeAutoplayMode === 'VIEWPORT') {
|
|
116
|
-
url.searchParams.set('enablejsapi', '1');
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
url.searchParams.set('autoplay', '1');
|
|
120
|
-
}
|
|
121
|
-
url.searchParams.set('mute', '1');
|
|
122
|
-
url.searchParams.set('loop', '1');
|
|
123
|
-
url.searchParams.set('playlist', "".concat(id));
|
|
124
|
-
return url.href;
|
|
125
|
-
}
|
|
126
|
-
return 'Invalid YouTube URL';
|
|
127
|
-
}
|
|
128
|
-
catch (error) {
|
|
129
|
-
return 'Invalid URL';
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
104
|
exports.default = Youtube;
|
|
133
105
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { CB_CONTENT_PROP_YOUTUBE_TYPE } from './types';
|
|
2
|
-
|
|
2
|
+
import type { YOUTUBE_AUTOPLAY_TRIGGER_POINT } from './Youtube';
|
|
3
|
+
import type { Device } from '../../../../../../../DynamicLayout/sections/CustomSection/util/types';
|
|
4
|
+
declare function parseYoutubeContentProp(props: CB_CONTENT_PROP_YOUTUBE_TYPE, device: Device, autoplayTriggerPoint: YOUTUBE_AUTOPLAY_TRIGGER_POINT): {
|
|
3
5
|
id: string;
|
|
4
6
|
youtubeSrc: string;
|
|
5
7
|
thumbnailSrc: string;
|
|
8
|
+
cbAutoplayMode?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
id: string;
|
|
11
|
+
youtubeSrc: string;
|
|
12
|
+
thumbnailSrc: string;
|
|
13
|
+
cbAutoplayMode: string;
|
|
6
14
|
};
|
|
7
15
|
export default parseYoutubeContentProp;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function parseYoutubeContentProp(props) {
|
|
3
|
+
function parseYoutubeContentProp(props, device, autoplayTriggerPoint) {
|
|
4
4
|
var id = getYoutubeId(props.CB_CONTENT_PROP_YOUTUBE_SPEC_SRC);
|
|
5
5
|
var start = props.CB_CONTENT_PROP_YOUTUBE_SPEC_STARTTIME;
|
|
6
|
-
var
|
|
6
|
+
var shouldAutoPlay = device === 'DESKTOP'
|
|
7
|
+
? props.CB_CONTENT_PROP_YOUTUBE_SPEC_AUTOPLAY
|
|
8
|
+
: props.CB_CONTENT_PROP_YOUTUBE_SPEC_MAUTOPLAY;
|
|
9
|
+
var cbAutoplayMode = shouldAutoPlay ? autoplayTriggerPoint : 'NONE';
|
|
7
10
|
if (!id) {
|
|
8
11
|
return {
|
|
9
12
|
id: 'no-id',
|
|
@@ -13,8 +16,9 @@ function parseYoutubeContentProp(props) {
|
|
|
13
16
|
}
|
|
14
17
|
return {
|
|
15
18
|
id: id,
|
|
16
|
-
youtubeSrc: getEmbedUrl(id, start,
|
|
17
|
-
thumbnailSrc: getThumbnailUrl(id)
|
|
19
|
+
youtubeSrc: getEmbedUrl(id, { start: start, shouldAutoPlay: shouldAutoPlay, autoplayMode: autoplayTriggerPoint }),
|
|
20
|
+
thumbnailSrc: getThumbnailUrl(id),
|
|
21
|
+
cbAutoplayMode: cbAutoplayMode
|
|
18
22
|
};
|
|
19
23
|
}
|
|
20
24
|
function getYoutubeId(src) {
|
|
@@ -27,7 +31,28 @@ function getYoutubeId(src) {
|
|
|
27
31
|
function getThumbnailUrl(id) {
|
|
28
32
|
return "https://img.youtube.com/vi/".concat(id, "/0.jpg");
|
|
29
33
|
}
|
|
30
|
-
function getEmbedUrl(id,
|
|
31
|
-
|
|
34
|
+
function getEmbedUrl(id, _a) {
|
|
35
|
+
var start = _a.start, autoplayMode = _a.autoplayMode, shouldAutoPlay = _a.shouldAutoPlay;
|
|
36
|
+
try {
|
|
37
|
+
var url = new URL("https://www.youtube.com/embed/".concat(id));
|
|
38
|
+
url.searchParams.set('start', "".concat(start));
|
|
39
|
+
if (!shouldAutoPlay) {
|
|
40
|
+
return url.href;
|
|
41
|
+
}
|
|
42
|
+
// NOTE: AUTOPLAY PARAMS
|
|
43
|
+
if (autoplayMode === 'ALWAYS') {
|
|
44
|
+
url.searchParams.set('autoplay', '1');
|
|
45
|
+
}
|
|
46
|
+
if (autoplayMode === 'VIEWPORT') {
|
|
47
|
+
url.searchParams.set('enablejsapi', '1');
|
|
48
|
+
}
|
|
49
|
+
url.searchParams.set('mute', '1');
|
|
50
|
+
url.searchParams.set('loop', '1');
|
|
51
|
+
url.searchParams.set('playlist', "".concat(id));
|
|
52
|
+
return url.href;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return "https://www.youtube.com/embed/".concat(id, "?start=").concat(start);
|
|
56
|
+
}
|
|
32
57
|
}
|
|
33
58
|
exports.default = parseYoutubeContentProp;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { ENUM_STRING, NUMBER_INTEGER } from '../../../../../../../DynamicLayout/sections/CustomSection/util/types';
|
|
2
2
|
export type CB_CONTENT_PROP_YOUTUBE_TYPE = {
|
|
3
|
-
CB_CONTENT_PROP_YOUTUBE_SPEC_ENDTIME: number;
|
|
4
|
-
CB_CONTENT_PROP_YOUTUBE_SPEC_MPLAY: boolean;
|
|
5
|
-
CB_CONTENT_PROP_YOUTUBE_SPEC_REPLAY: boolean;
|
|
6
3
|
CB_CONTENT_PROP_YOUTUBE_SPEC_SRC: string;
|
|
7
4
|
CB_CONTENT_PROP_YOUTUBE_SPEC_STARTTIME: number;
|
|
5
|
+
CB_CONTENT_PROP_YOUTUBE_SPEC_AUTOPLAY: boolean;
|
|
6
|
+
CB_CONTENT_PROP_YOUTUBE_SPEC_MAUTOPLAY: boolean;
|
|
8
7
|
};
|
|
9
8
|
export type CB_STYLE_PROP_BGCOLOR_ENUM_GRADIENT = 'LINEAR' | 'RADIAL';
|
|
10
9
|
export type CB_STYLE_PROP_BGCOLOR_ENUM_TYPE = 'NONE' | 'SOLID' | 'GRADIENT';
|
|
@@ -224,7 +224,6 @@ export type DynamicLayoutProps = {
|
|
|
224
224
|
sectionActionHandler?: (action: TypeOfSectionAction) => void;
|
|
225
225
|
programmedSectionComponents?: IProgrammedSectionComponents;
|
|
226
226
|
width?: number;
|
|
227
|
-
youtubeAutoplayMode?: 'ALWAYS' | 'VIEWPORT-FREEZE' | 'VIEWPORT';
|
|
228
227
|
};
|
|
229
228
|
export type NavHandlerAction = {
|
|
230
229
|
openNewTab: boolean;
|
package/package.json
CHANGED
package/release-note.md
CHANGED