pds-dev-kit-web-test 0.2.15 → 0.2.17

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 (66) hide show
  1. package/dist/src/sub/DynamicLayout/DynamicLayout.js +1 -0
  2. package/dist/src/sub/DynamicLayout/components/Section/CustomSection.d.ts +2 -1
  3. package/dist/src/sub/DynamicLayout/components/Section/CustomSection.js +2 -4
  4. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackground.d.ts +1 -2
  5. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackground.js +14 -50
  6. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.d.ts +5 -3
  7. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.js +87 -57
  8. package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.d.ts +1 -4
  9. package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.js +3 -12
  10. package/dist/src/sub/DynamicLayout/components/YouTubeIframe/YouTubeIframe.js +4 -2
  11. package/dist/src/sub/DynamicLayout/mock_customSection.js +23 -7
  12. package/dist/src/sub/DynamicLayout/mock_samplePage.js +1650 -762
  13. package/dist/src/sub/DynamicLayout/nakedMocks.json +8 -0
  14. package/dist/src/sub/DynamicLayout/pagesPreviewMock.d.ts +645 -0
  15. package/dist/src/sub/DynamicLayout/pagesPreviewMock.js +1661 -0
  16. package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.d.ts +3 -2
  17. package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +70 -24
  18. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.d.ts +7 -1
  19. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/ComponentBlockMatcher.js +3 -5
  20. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +3 -1
  21. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/btnTypes.d.ts +50 -42
  22. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Image.js +22 -44
  23. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/types.d.ts +6 -6
  24. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/RichText/types.d.ts +24 -24
  25. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/Text.js +7 -2
  26. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Text/types.d.ts +30 -20
  27. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/types.d.ts +24 -24
  28. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_BoxWithShadow.d.ts +1 -1
  29. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_BoxWithShadow.js +7 -13
  30. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/hooks/useCLINK.js +3 -0
  31. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/types.d.ts +1 -1
  32. package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/colorUtil.js +6 -3
  33. package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/replaceUndefinedValues.js +3 -5
  34. package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.d.ts +1 -1
  35. package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +100 -13
  36. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseLayoutPropArrange.d.ts +1 -1
  37. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseLayoutPropArrange.js +2 -2
  38. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseSectionPadding.d.ts +23 -0
  39. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/layoutPropParsers/parseSectionPadding.js +26 -0
  40. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.d.ts +9 -9
  41. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.js +15 -28
  42. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseJsonProperties.d.ts +2 -2
  43. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseJsonProperties.js +2 -7
  44. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/index.d.ts +2 -2
  45. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/index.js +1 -1
  46. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgColor.d.ts +24 -24
  47. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgColor.js +4 -5
  48. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgImage.d.ts +6 -6
  49. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgImage.js +18 -56
  50. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgOverlay.d.ts +26 -26
  51. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgOverlay.js +6 -12
  52. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBorder.d.ts +5 -5
  53. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBorder.js +16 -4
  54. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropDivider.d.ts +9 -9
  55. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropDivider.js +17 -5
  56. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropImage.d.ts +6 -6
  57. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropImage.js +30 -54
  58. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropOpacity.d.ts +3 -3
  59. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropOpacity.js +9 -3
  60. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow.d.ts +21 -21
  61. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow.js +7 -4
  62. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropTextSpec.d.ts +2 -33
  63. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropTextSpec.js +27 -16
  64. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/types.d.ts +4 -4
  65. package/dist/src/sub/DynamicLayout/types.d.ts +37 -37
  66. package/package.json +2 -2
@@ -35,6 +35,7 @@ function DynamicLayout(_a) {
35
35
  isPreview: isPreview,
36
36
  navigationHandler: navigationHandler,
37
37
  sectionActionHandler: sectionActionHandler,
38
+ editingSectionId: editingSectionId,
38
39
  programmedSectionComponents: programmedSectionComponents
39
40
  } }, { children: [mode === 'EDIT' && onClickEditSection && ((0, jsx_runtime_1.jsx)(EditModeSectionMatcher_1.EditModeSectionMatcher, { editingSectionId: editingSectionId, scrollDownTargetSectionId: scrollDownTargetSectionId, filteredSortedSection: filteredSortedSection, onClickEditSection: onClickEditSection }, void 0)), mode !== 'EDIT' &&
40
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); })))] }), void 0));
@@ -1,4 +1,5 @@
1
- import { CSSProperties } from 'react';
1
+ /// <reference types="react" />
2
+ import { CSSProperties } from 'styled-components';
2
3
  import type { ISection } from '../../types';
3
4
  declare type SectionPropTypes = ISection & {
4
5
  children?: React.ReactNode;
@@ -30,17 +30,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  var jsx_runtime_1 = require("react/jsx-runtime");
33
- var react_1 = require("react");
34
33
  var styled_components_1 = __importDefault(require("styled-components"));
35
34
  var CustomSectionBackground_1 = __importDefault(require("./components/CustomSectionBackground"));
36
35
  var sectionContext_1 = require("./sectionContext");
37
36
  function CustomSection(_a) {
38
37
  var _b;
39
38
  var children = _a.children, overrideStyles = _a.overrideStyles, _c = _a.isMobile, isMobile = _c === void 0 ? false : _c, props = __rest(_a, ["children", "overrideStyles", "isMobile"]);
40
- var _d = (0, react_1.useState)(false), isHover = _d[0], setIsHover = _d[1];
41
- return ((0, jsx_runtime_1.jsx)(sectionContext_1.sectionContext.Provider, __assign({ value: __assign({}, props) }, { children: (0, jsx_runtime_1.jsxs)(S_Section, __assign({ style: overrideStyles, isIframeSection: ((_b = props.manifest) === null || _b === void 0 ? void 0 : _b.schema) === 'EXP_IFRAME', onMouseEnter: function () { return setIsHover(true); }, onMouseMove: function () { return !isHover && setIsHover(true); }, onMouseLeave: function () { return setIsHover(false); } }, { children: [(0, jsx_runtime_1.jsx)(CustomSectionBackground_1.default, { isHover: isHover, isMobile: isMobile }, void 0), children] }), void 0) }), void 0));
39
+ return ((0, jsx_runtime_1.jsx)(sectionContext_1.sectionContext.Provider, __assign({ value: __assign({}, props) }, { children: (0, jsx_runtime_1.jsxs)(S_Section, __assign({ style: overrideStyles, isIframeSection: ((_b = props.manifest) === null || _b === void 0 ? void 0 : _b.schema) === 'EXP_IFRAME' }, { children: [(0, jsx_runtime_1.jsx)(CustomSectionBackground_1.default, { isMobile: isMobile }, void 0), children] }), void 0) }), void 0));
42
40
  }
43
- var S_Section = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n box-sizing: border-box;\n height: ", ";\n position: relative;\n width: 100%;\n z-index: 0;\n"], ["\n box-sizing: border-box;\n height: ", ";\n position: relative;\n width: 100%;\n z-index: 0;\n"])), function (_a) {
41
+ var S_Section = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n height: ", ";\n justify-content: center;\n position: relative;\n width: 100%;\n z-index: 0;\n"], ["\n align-items: center;\n box-sizing: border-box;\n display: flex;\n height: ", ";\n justify-content: center;\n position: relative;\n width: 100%;\n z-index: 0;\n"])), function (_a) {
44
42
  var isIframeSection = _a.isIframeSection;
45
43
  return (isIframeSection ? '100%' : 'auto');
46
44
  });
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare function CustomSectionBackground({ isHover, isMobile }: {
3
- isHover: boolean;
2
+ declare function CustomSectionBackground({ isMobile }: {
4
3
  isMobile?: boolean;
5
4
  }): JSX.Element;
6
5
  export default CustomSectionBackground;
@@ -26,81 +26,45 @@ var styled_components_1 = __importDefault(require("styled-components"));
26
26
  var sectionContext_1 = require("../sectionContext");
27
27
  var CustomSectionBackgroundMedia_1 = require("./CustomSectionBackgroundMedia");
28
28
  function CustomSectionBackground(_a) {
29
- var isHover = _a.isHover, _b = _a.isMobile, isMobile = _b === void 0 ? false : _b;
29
+ var _b = _a.isMobile, isMobile = _b === void 0 ? false : _b;
30
30
  var context = (0, react_1.useContext)(sectionContext_1.sectionContext);
31
31
  var id = context.id, jsonProperties = context.jsonProperties;
32
32
  var backgroundRef = (0, react_1.useRef)(null);
33
- var backgroundOverlayRef = (0, react_1.useRef)(null);
34
33
  var _c = jsonProperties || {}, CB_STYLE_PROP_BGOVERLAY = _c.CB_STYLE_PROP_BGOVERLAY, CB_STYLE_PROP_BGMEDIA = _c.CB_STYLE_PROP_BGMEDIA;
35
- var _d = (0, util_1.parseJsonProperties)(jsonProperties, isMobile ? 'MOBILE' : 'DESKTOP'), style = _d.style, hoverStyle = _d.hoverStyle, overlayStyle = _d.overlayStyle, overlayHoverStyle = _d.overlayHoverStyle, layout = _d.layout, effect = _d.effect;
36
- var isOverlay = getIsOverlay(isMobile, isHover, CB_STYLE_PROP_BGOVERLAY);
37
- var isBgMedia = getIsBgMedia(isMobile, isHover, CB_STYLE_PROP_BGMEDIA);
38
- var mediaType = getMediaType(isMobile, isHover, CB_STYLE_PROP_BGMEDIA);
39
- (0, react_1.useEffect)(function () {
40
- var sectionElement = backgroundRef.current;
41
- var sectionOverlayElement = backgroundOverlayRef.current;
42
- if (sectionElement) {
43
- if (isHover && style && 'background' in style) {
44
- sectionElement.style.background = style.background;
45
- }
46
- if (!isHover && hoverStyle && 'background' in hoverStyle) {
47
- sectionElement.style.background = hoverStyle.background;
48
- }
49
- }
50
- if (sectionOverlayElement) {
51
- if (isHover && overlayHoverStyle && 'background' in overlayHoverStyle) {
52
- sectionOverlayElement.style.background = overlayHoverStyle.background;
53
- }
54
- if (!isHover && overlayStyle && 'background' in overlayStyle) {
55
- sectionOverlayElement.style.background = overlayStyle.background;
56
- }
57
- }
58
- }, [isHover, style, hoverStyle, overlayStyle, overlayHoverStyle]);
59
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isOverlay && CB_STYLE_PROP_BGOVERLAY && ((0, jsx_runtime_1.jsx)(S_CustomBackgroundOverlay, { className: "Overlay", ref: backgroundOverlayRef }, void 0)), (0, jsx_runtime_1.jsx)(S_CustomBackgroundWrapper, __assign({ className: "CustomSection", ref: backgroundRef, style: __assign(__assign(__assign(__assign({}, layout), effect), style), { visibility: isHover ? hoverStyle.visibility : style.visibility }) }, { children: isBgMedia && CB_STYLE_PROP_BGMEDIA && ((0, jsx_runtime_1.jsx)(CustomSectionBackgroundMedia_1.CustomSectionBackgroundMedia, { specs: CB_STYLE_PROP_BGMEDIA, playerId: id, mediaType: mediaType || 'NONE', isHover: isHover, device: isMobile ? 'MOBILE' : 'DESKTOP' }, void 0)) }), void 0)] }, void 0));
34
+ var _d = (0, util_1.parseJsonProperties)(jsonProperties, isMobile ? 'MOBILE' : 'DESKTOP'), style = _d.style, overlayStyle = _d.overlayStyle, effect = _d.effect;
35
+ var isOverlay = getIsOverlay(isMobile, CB_STYLE_PROP_BGOVERLAY);
36
+ var isBgMedia = getIsBgMedia(isMobile, CB_STYLE_PROP_BGMEDIA);
37
+ var mediaType = getMediaType(isMobile, CB_STYLE_PROP_BGMEDIA);
38
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isOverlay && CB_STYLE_PROP_BGOVERLAY && ((0, jsx_runtime_1.jsx)(S_CustomBackgroundOverlay, { className: "Overlay", style: __assign(__assign({}, overlayStyle), { pointerEvents: 'none' }) }, void 0)), (0, jsx_runtime_1.jsx)(S_CustomBackgroundWrapper, __assign({ className: "CustomSection", ref: backgroundRef, style: __assign(__assign({}, effect), { background: style.background, overflow: mediaType === 'IMAGE' ? 'scroll' : 'hidden' }) }, { children: isBgMedia && CB_STYLE_PROP_BGMEDIA && ((0, jsx_runtime_1.jsx)(CustomSectionBackgroundMedia_1.CustomSectionBackgroundMedia, { specs: CB_STYLE_PROP_BGMEDIA, componentStyle: style, playerId: id, mediaType: mediaType || 'NONE', device: isMobile ? 'MOBILE' : 'DESKTOP', backgroundRef: backgroundRef }, void 0)) }), void 0)] }, void 0));
60
39
  }
61
- function getIsOverlay(isMobile, isHover, specs) {
40
+ function getIsOverlay(isMobile, specs) {
62
41
  if (!specs) {
63
42
  return false;
64
43
  }
65
44
  if (isMobile) {
66
- return isHover
67
- ? specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:MOBILE:HOVER'] !== 'NONE'
68
- : specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:MOBILE'] !== 'NONE';
45
+ return specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:MOBILE'] !== 'NONE';
69
46
  }
70
- return isHover
71
- ? specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:HOVER'] !== 'NONE'
72
- : specs.CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE !== 'NONE';
47
+ return specs.CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE !== 'NONE';
73
48
  }
74
- function getIsBgMedia(isMobile, isHover, specs) {
49
+ function getIsBgMedia(isMobile, specs) {
75
50
  if (!specs) {
76
51
  return false;
77
52
  }
78
53
  if (isMobile) {
79
- return isHover
80
- ? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'] !== 'NONE'
81
- : specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'] !== 'NONE';
54
+ return specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'] !== 'NONE';
82
55
  }
83
- return isHover
84
- ? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER'] !== 'NONE'
85
- : specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE !== 'NONE';
56
+ return specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE !== 'NONE';
86
57
  }
87
- function getMediaType(isMobile, isHover, specs) {
58
+ function getMediaType(isMobile, specs) {
88
59
  if (!specs) {
89
60
  return 'NONE';
90
61
  }
91
62
  if (isMobile) {
92
- if (isHover) {
93
- return (0, isNullOrUndefined_1.default)(specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'])
94
- ? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER']
95
- : specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'];
96
- }
97
63
  return (0, isNullOrUndefined_1.default)(specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'])
98
64
  ? specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE
99
65
  : specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'];
100
66
  }
101
- return isHover
102
- ? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER']
103
- : specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE;
67
+ return specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE;
104
68
  }
105
69
  var S_CustomBackgroundWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-items: center;\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n overflow: hidden;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -2;\n"], ["\n align-items: center;\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n overflow: hidden;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -2;\n"])));
106
70
  var S_CustomBackgroundOverlay = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n"], ["\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n z-index: -1;\n"])));
@@ -1,12 +1,14 @@
1
- /// <reference types="react" />
1
+ import { MutableRefObject } from 'react';
2
+ import { CSSProperties } from 'styled-components';
2
3
  import type { Device } from '../../../../DynamicLayout/sections/CustomSection/util/types';
3
4
  import type { CB_STYLE_PROP_BGMEDIA_SPECS } from '../../../../DynamicLayout/types';
4
5
  declare type Props = {
5
6
  specs: CB_STYLE_PROP_BGMEDIA_SPECS;
6
7
  playerId: number;
7
8
  mediaType: string;
8
- isHover: boolean;
9
+ componentStyle: CSSProperties;
9
10
  device: Device;
11
+ backgroundRef: MutableRefObject<HTMLDivElement | null>;
10
12
  };
11
- export declare function CustomSectionBackgroundMedia({ specs, playerId, mediaType, isHover, device }: Props): JSX.Element;
13
+ export declare function CustomSectionBackgroundMedia({ specs, playerId, mediaType, componentStyle, device, backgroundRef }: Props): JSX.Element;
12
14
  export {};
@@ -14,78 +14,108 @@ var __assign = (this && this.__assign) || function () {
14
14
  };
15
15
  return __assign.apply(this, arguments);
16
16
  };
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
19
35
  };
20
36
  Object.defineProperty(exports, "__esModule", { value: true });
21
37
  exports.CustomSectionBackgroundMedia = void 0;
22
38
  var jsx_runtime_1 = require("react/jsx-runtime");
23
- /* eslint-disable @typescript-eslint/no-unused-vars */
24
- require("react");
25
- var styled_components_1 = __importDefault(require("styled-components"));
26
- var pdsOriginal_1 = require("../../pdsOriginal");
39
+ var react_1 = require("react");
40
+ var styled_components_1 = __importStar(require("styled-components"));
27
41
  var YouTubeIframe_1 = require("../../YouTubeIframe");
28
42
  var util_1 = require("../util");
29
43
  function CustomSectionBackgroundMedia(_a) {
30
- var specs = _a.specs, playerId = _a.playerId, mediaType = _a.mediaType, isHover = _a.isHover, device = _a.device;
31
- var _b = (0, util_1.parseSectionBackgroundMediaData)(specs, device), normal = _b.normal, hover = _b.hover;
32
- var scaleType = getScaleType(isHover
33
- ? hover.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT
34
- : normal.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT);
44
+ var specs = _a.specs, playerId = _a.playerId, mediaType = _a.mediaType, componentStyle = _a.componentStyle, device = _a.device, backgroundRef = _a.backgroundRef;
45
+ 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_SCROLL = _b.CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL, CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR = _b.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR;
46
+ var _c = (0, react_1.useState)({ width: 0, height: 0 }), youtubeSize = _c[0], setYoutubeSize = _c[1];
47
+ var getResponsiveYoutubeSize = (0, react_1.useCallback)(function () {
48
+ var backgroundWrapper = backgroundRef.current;
49
+ if (!backgroundWrapper)
50
+ return { width: 0, height: 0 };
51
+ var backgroundSize = {
52
+ width: backgroundWrapper.getBoundingClientRect().width,
53
+ height: backgroundWrapper.getBoundingClientRect().height
54
+ };
55
+ var isHorizontal = backgroundSize.width / backgroundSize.height > 1;
56
+ var isOverRatio = backgroundSize.width / backgroundSize.height > 16 / 9;
57
+ var youtubeSize = isHorizontal && isOverRatio
58
+ ? { width: backgroundSize.width, height: backgroundSize.width * (9 / 16) }
59
+ : { width: backgroundSize.height * (16 / 9), height: backgroundSize.height };
60
+ return youtubeSize;
61
+ }, [backgroundRef.current]);
62
+ (0, react_1.useEffect)(function () {
63
+ if (mediaType !== 'YOUTUBE')
64
+ return;
65
+ setYoutubeSize(getResponsiveYoutubeSize());
66
+ }, [getResponsiveYoutubeSize, CB_STYLE_PROP_BGMEDIA_SPEC_YSRC]);
67
+ (0, react_1.useEffect)(function () {
68
+ if (mediaType !== 'YOUTUBE')
69
+ return;
70
+ function onResize() {
71
+ setYoutubeSize(getResponsiveYoutubeSize());
72
+ }
73
+ var element = backgroundRef.current;
74
+ if (!element)
75
+ return;
76
+ var observer = new ResizeObserver(function (entries) {
77
+ entries.forEach(function () {
78
+ onResize();
79
+ });
80
+ });
81
+ observer.observe(element);
82
+ return function () {
83
+ observer.disconnect();
84
+ };
85
+ }, [device, specs, playerId, mediaType]);
86
+ if ('background' in componentStyle) {
87
+ delete componentStyle.background;
88
+ }
35
89
  switch (mediaType) {
36
90
  case 'IMAGE':
37
- return ((0, jsx_runtime_1.jsx)(S_ImageWrapper, __assign({ isOverflowScroll: isHover
38
- ? hover.CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL
39
- : normal.CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL, scaleType: isHover
40
- ? hover.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT
41
- : normal.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT }, { children: (0, jsx_runtime_1.jsx)(pdsOriginal_1.ImageView, { src: isHover
42
- ? hover.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR
43
- : normal.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR, width: "responsive", height: "responsive", scaleType: scaleType, shapeType: "rectangle" }, void 0) }), void 0));
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), style: {
92
+ overflow: CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL ? 'auto' : 'hidden'
93
+ }, 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));
44
94
  case 'YOUTUBE':
45
- return ((0, jsx_runtime_1.jsx)(S_YoutubeContainer, { children: (0, jsx_runtime_1.jsx)(YouTubeIframe_1.YouTubeIframe, { id: playerId, src: isHover
46
- ? hover.CB_STYLE_PROP_BGMEDIA_SPEC_YSRC
47
- : normal.CB_STYLE_PROP_BGMEDIA_SPEC_YSRC, loopMode: isHover
48
- ? hover.CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY
49
- ? 'use'
50
- : 'none'
51
- : normal.CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY
52
- ? 'use'
53
- : 'none', startSeconds: isHover
54
- ? hover.CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME
55
- : normal.CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME, endSeconds: isHover
56
- ? hover.CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME
57
- : normal.CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME }, void 0) }, void 0));
95
+ 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));
58
96
  case 'NONE':
59
97
  default:
60
98
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
61
99
  }
62
100
  }
63
101
  exports.CustomSectionBackgroundMedia = CustomSectionBackgroundMedia;
64
- function getScaleType(scaleSpec) {
65
- switch (scaleSpec) {
66
- case 'FILL':
67
- return 'fill';
68
- case 'CONTAIN':
69
- return 'contain';
70
- case 'COVER':
71
- return 'cover';
72
- case 'NONE':
73
- return 'none';
74
- default:
75
- return 'none';
76
- }
77
- }
78
- var S_ImageWrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n overflow: ", ";\n\n ", ";\n"], ["\n overflow: ", ";\n\n ", ";\n"])), function (_a) {
79
- var isOverflowScroll = _a.isOverflowScroll;
80
- return (isOverflowScroll ? 'scroll' : 'hidden');
102
+ var S_Image = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-image: ", ";\n background-repeat: no-repeat;\n\n ", ";\n\n & img {\n ", ";\n }\n"], ["\n background-image: ", ";\n background-repeat: no-repeat;\n\n ", ";\n\n & img {\n ", ";\n }\n"])), function (_a) {
103
+ var src = _a.src;
104
+ return "url(" + src + ")";
81
105
  }, function (_a) {
82
- var scaleType = _a.scaleType;
83
- switch (scaleType) {
84
- case 'cover':
85
- return "height: 100%;\n width: 100%;";
86
- default:
87
- return "height: auto;\n width: auto";
88
- }
106
+ var normalStyle = _a.normalStyle;
107
+ var isContain = normalStyle.backgroundSize === 'contain';
108
+ return (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n "], ["\n ", "\n "])), __assign(__assign({}, normalStyle), { backgroundPosition: isContain ? 'unset' : normalStyle.backgroundPosition, height: isContain ? 'auto' : '100%', width: isContain ? 'auto' : '100%' }));
109
+ }, function (_a) {
110
+ var normalStyle = _a.normalStyle;
111
+ var isContain = normalStyle.backgroundSize === 'contain';
112
+ return (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n object-fit: ", ";\n "], ["\n object-fit: ", ";\n "])), isContain ? 'contain' : 'cover');
113
+ });
114
+ var S_YoutubeContainer = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n height: ", ";\n width: ", ";\n"], ["\n height: ", ";\n width: ", ";\n"])), function (_a) {
115
+ var height = _a.height;
116
+ return height + "px";
117
+ }, function (_a) {
118
+ var width = _a.width;
119
+ return width + "px";
89
120
  });
90
- var S_YoutubeContainer = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n height: 100%;\n width: 100%;\n"], ["\n height: 100%;\n width: 100%;\n"])));
91
- var templateObject_1, templateObject_2;
121
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -2,8 +2,5 @@ import type { Device } from '../../../../DynamicLayout/sections/CustomSection/ut
2
2
  import type { CB_STYLE_PROP_BGMEDIA_SPECS } from '../../../../DynamicLayout/types';
3
3
  declare type SpecKeys = keyof Omit<CB_STYLE_PROP_BGMEDIA_SPECS, 'CB_STYLE_PROP_BGMEDIA_SPEC_MPLAY'>;
4
4
  declare type ValueSetType = Partial<Record<SpecKeys, string | number | boolean | undefined>>;
5
- export default function UseCustomSectionBackgroundMediaData(specs: CB_STYLE_PROP_BGMEDIA_SPECS, device: Device): {
6
- normal: ValueSetType;
7
- hover: ValueSetType;
8
- };
5
+ export default function UseCustomSectionBackgroundMediaData(specs: CB_STYLE_PROP_BGMEDIA_SPECS, device: Device): ValueSetType;
9
6
  export {};
@@ -29,19 +29,10 @@ var AVAILABLE_SPECS = [
29
29
  ];
30
30
  function UseCustomSectionBackgroundMediaData(specs, device) {
31
31
  return AVAILABLE_SPECS.reduce(function (acc, cur) {
32
- var _a, _b;
32
+ var _a;
33
33
  var baseKey = device === 'DESKTOP' ? cur : cur + ":MOBILE";
34
34
  var value = (0, isNullOrUndefined_1.default)(specs[baseKey]) ? specs[cur] : specs[baseKey];
35
- var hoverValue = (0, isNullOrUndefined_1.default)(specs[baseKey + ":HOVER"])
36
- ? specs[cur + ":HOVER"]
37
- : specs[baseKey + ":HOVER"];
38
- return {
39
- normal: __assign(__assign({}, acc.normal), (_a = {}, _a[cur] = value, _a)),
40
- hover: __assign(__assign({}, acc.hover), (_b = {}, _b[cur] = hoverValue, _b))
41
- };
42
- }, {
43
- normal: {},
44
- hover: {}
45
- });
35
+ return __assign(__assign({}, acc), (_a = {}, _a[cur] = value, _a));
36
+ }, {});
46
37
  }
47
38
  exports.default = UseCustomSectionBackgroundMediaData;
@@ -92,7 +92,8 @@ function YouTubeIframe(_a) {
92
92
  playlist: videoId,
93
93
  loop: isLoop ? 1 : 0,
94
94
  start: startSeconds,
95
- end: endSeconds
95
+ end: endSeconds,
96
+ cc_load_policy: 0
96
97
  }
97
98
  : {
98
99
  autoplay: 1,
@@ -101,7 +102,8 @@ function YouTubeIframe(_a) {
101
102
  listType: 'playlist',
102
103
  playlist: videoId,
103
104
  loop: isLoop ? 1 : 0,
104
- start: startSeconds
105
+ start: startSeconds,
106
+ cc_load_policy: 0
105
107
  };
106
108
  var player = new window.YT.Player(PLAYER_ID, {
107
109
  videoId: videoId,
@@ -273,7 +273,15 @@ exports.customSectionMock1 = {
273
273
  CB_STYLE_PROP_TEXT_SPEC_COLOR: '#fffc00eb',
274
274
  'CB_STYLE_PROP_TEXT_SPEC_COLOR:HOVER': '#ff2727',
275
275
  'CB_STYLE_PROP_TEXT_SPEC_COLOR:MOBILE': undefined,
276
- 'CB_STYLE_PROP_TEXT_SPEC_COLOR:MOBILE:HOVER': undefined
276
+ 'CB_STYLE_PROP_TEXT_SPEC_COLOR:MOBILE:HOVER': undefined,
277
+ CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL: 'LEFT',
278
+ 'CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL:HOVER': 'CENTER',
279
+ 'CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL:MOBILE': undefined,
280
+ 'CB_STYLE_PROP_TEXT_SPEC_HORIZONTAL:MOBILE:HOVER': undefined,
281
+ CB_STYLE_PROP_TEXT_SPEC_VERTICAL: 'TOP',
282
+ 'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:HOVER': 'CENTER',
283
+ 'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:MOBILE': undefined,
284
+ 'CB_STYLE_PROP_TEXT_SPEC_VERTICAL:MOBILE:HOVER': undefined
277
285
  },
278
286
  CB_STYLE_PROP_OPACITY: {
279
287
  CB_STYLE_PROP_OPACITY_SPEC_OPACITY: 1,
@@ -343,27 +351,35 @@ exports.customSectionMock1 = {
343
351
  },
344
352
  CB_STYLE_PROP_BTNTEXT: {
345
353
  CB_STYLE_PROP_BTNTEXT_SPEC_COLOR: '#FFFFFFFF',
346
- 'CB_STYLE_PROP_BTNTEXT_SPEC_COLOR:HOVER': '#ff2727',
354
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_COLOR:HOVER': undefined,
347
355
  'CB_STYLE_PROP_BTNTEXT_SPEC_COLOR:MOBILE': undefined,
348
356
  'CB_STYLE_PROP_BTNTEXT_SPEC_COLOR:MOBILE:HOVER': undefined,
357
+ CB_STYLE_PROP_BTNTEXT_SPEC_HORIZONTAL: 'RIGHT',
358
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_HORIZONTAL:HOVER': undefined,
359
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_HORIZONTAL:MOBILE': undefined,
360
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_HORIZONTAL:MOBILE:HOVER': undefined,
349
361
  CB_STYLE_PROP_BTNTEXT_SPEC_LETTERSPACING: 0,
350
- 'CB_STYLE_PROP_BTNTEXT_SPEC_LETTERSPACING:HOVER': 0,
362
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_LETTERSPACING:HOVER': undefined,
351
363
  'CB_STYLE_PROP_BTNTEXT_SPEC_LETTERSPACING:MOBILE': undefined,
352
364
  'CB_STYLE_PROP_BTNTEXT_SPEC_LETTERSPACING:MOBILE:HOVER': undefined,
353
365
  CB_STYLE_PROP_BTNTEXT_SPEC_LINEHEIGHT: 130,
354
- 'CB_STYLE_PROP_BTNTEXT_SPEC_LINEHEIGHT:HOVER': 130,
366
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_LINEHEIGHT:HOVER': undefined,
355
367
  'CB_STYLE_PROP_BTNTEXT_SPEC_LINEHEIGHT:MOBILE': undefined,
356
368
  'CB_STYLE_PROP_BTNTEXT_SPEC_LINEHEIGHT:MOBILE:HOVER': undefined,
357
369
  CB_STYLE_PROP_BTNTEXT_SPEC_SIZE: 16,
358
- 'CB_STYLE_PROP_BTNTEXT_SPEC_SIZE:HOVER': 16,
370
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_SIZE:HOVER': undefined,
359
371
  'CB_STYLE_PROP_BTNTEXT_SPEC_SIZE:MOBILE': undefined,
360
372
  'CB_STYLE_PROP_BTNTEXT_SPEC_SIZE:MOBILE:HOVER': undefined,
361
373
  CB_STYLE_PROP_BTNTEXT_SPEC_TYPEFACE: 'PRETENDARD',
362
- 'CB_STYLE_PROP_BTNTEXT_SPEC_TYPEFACE:HOVER': 'PRETENDARD',
374
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_TYPEFACE:HOVER': undefined,
363
375
  'CB_STYLE_PROP_BTNTEXT_SPEC_TYPEFACE:MOBILE': undefined,
364
376
  'CB_STYLE_PROP_BTNTEXT_SPEC_TYPEFACE:MOBILE:HOVER': undefined,
377
+ CB_STYLE_PROP_BTNTEXT_SPEC_VERTICAL: 'TOP',
378
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_VERTICAL:HOVER': undefined,
379
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_VERTICAL:MOBILE': undefined,
380
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_VERTICAL:MOBILE:HOVER': undefined,
365
381
  CB_STYLE_PROP_BTNTEXT_SPEC_WEIGHT: 500,
366
- 'CB_STYLE_PROP_BTNTEXT_SPEC_WEIGHT:HOVER': 500,
382
+ 'CB_STYLE_PROP_BTNTEXT_SPEC_WEIGHT:HOVER': undefined,
367
383
  'CB_STYLE_PROP_BTNTEXT_SPEC_WEIGHT:MOBILE': undefined,
368
384
  'CB_STYLE_PROP_BTNTEXT_SPEC_WEIGHT:MOBILE:HOVER': undefined
369
385
  },