pds-dev-kit-web-test 0.2.12 → 0.2.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.
Files changed (39) hide show
  1. package/dist/src/sub/DynamicLayout/components/Section/CustomSection.d.ts +10 -0
  2. package/dist/src/sub/DynamicLayout/components/Section/CustomSection.js +48 -0
  3. package/dist/src/sub/DynamicLayout/components/Section/Section.d.ts +1 -2
  4. package/dist/src/sub/DynamicLayout/components/Section/Section.js +9 -83
  5. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackground.d.ts +6 -0
  6. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackground.js +108 -0
  7. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.d.ts +4 -1
  8. package/dist/src/sub/DynamicLayout/components/Section/components/CustomSectionBackgroundMedia.js +41 -19
  9. package/dist/src/sub/DynamicLayout/components/Section/index.d.ts +1 -0
  10. package/dist/src/sub/DynamicLayout/components/Section/index.js +3 -1
  11. package/dist/src/sub/DynamicLayout/components/Section/util/index.d.ts +1 -0
  12. package/dist/src/sub/DynamicLayout/components/Section/util/index.js +8 -0
  13. package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.d.ts +9 -0
  14. package/dist/src/sub/DynamicLayout/components/Section/util/parseSectionBackgroundMediaData.js +47 -0
  15. package/dist/src/sub/DynamicLayout/components/index.d.ts +1 -1
  16. package/dist/src/sub/DynamicLayout/components/index.js +2 -1
  17. package/dist/src/sub/DynamicLayout/mock_samplePage.js +530 -55
  18. package/dist/src/sub/DynamicLayout/sections/CustomSection/CustomSection.js +8 -28
  19. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Button/Button.js +3 -3
  20. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Image/Image.js +9 -9
  21. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/RichText/RichText.js +3 -3
  22. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Twitter/Twitter.js +3 -3
  23. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/Youtube/Youtube.js +4 -4
  24. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_Box.js +1 -31
  25. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_BoxWithShadow.d.ts +11 -0
  26. package/dist/src/sub/DynamicLayout/sections/CustomSection/components/ComponentBlock/componentBlocks/components/S_CB_BoxWithShadow.js +101 -0
  27. package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/colorUtil.js +4 -2
  28. package/dist/src/sub/DynamicLayout/sections/CustomSection/newUtils/textUtil.js +35 -3
  29. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/index.d.ts +2 -0
  30. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/index.js +5 -1
  31. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.d.ts +20 -0
  32. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/parseCustomSectionPlacement.js +37 -0
  33. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropBgColor.js +2 -2
  34. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropOpacity.js +2 -2
  35. package/dist/src/sub/DynamicLayout/sections/CustomSection/util/stylePropParsers/parseStylePropShadow.js +2 -2
  36. package/dist/src/sub/DynamicLayout/types.d.ts +12 -10
  37. package/package.json +1 -1
  38. package/release-note.md +1 -1
  39. package/webhook/node_modules/esrecurse/.babelrc +3 -0
@@ -0,0 +1,10 @@
1
+ import { CSSProperties } from 'react';
2
+ import type { ISection } from '../../types';
3
+ declare type SectionPropTypes = ISection & {
4
+ children?: React.ReactNode;
5
+ } & {
6
+ overrideStyles?: CSSProperties;
7
+ isMobile?: boolean;
8
+ };
9
+ declare function CustomSection({ children, overrideStyles, isMobile, ...props }: SectionPropTypes): JSX.Element;
10
+ export default CustomSection;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __assign = (this && this.__assign) || function () {
7
+ __assign = Object.assign || function(t) {
8
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9
+ s = arguments[i];
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
+ t[p] = s[p];
12
+ }
13
+ return t;
14
+ };
15
+ return __assign.apply(this, arguments);
16
+ };
17
+ var __rest = (this && this.__rest) || function (s, e) {
18
+ var t = {};
19
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
20
+ t[p] = s[p];
21
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
22
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
24
+ t[p[i]] = s[p[i]];
25
+ }
26
+ return t;
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ var jsx_runtime_1 = require("react/jsx-runtime");
33
+ var react_1 = require("react");
34
+ var styled_components_1 = __importDefault(require("styled-components"));
35
+ var CustomSectionBackground_1 = __importDefault(require("./components/CustomSectionBackground"));
36
+ var sectionContext_1 = require("./sectionContext");
37
+ function CustomSection(_a) {
38
+ var _b;
39
+ 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));
42
+ }
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) {
44
+ var isIframeSection = _a.isIframeSection;
45
+ return (isIframeSection ? '100%' : 'auto');
46
+ });
47
+ exports.default = CustomSection;
48
+ var templateObject_1;
@@ -4,7 +4,6 @@ declare type SectionPropTypes = ISection & {
4
4
  children?: React.ReactNode;
5
5
  } & {
6
6
  overrideStyles?: CSSProperties;
7
- isMobile?: boolean;
8
7
  };
9
- declare function Section({ children, overrideStyles, isMobile, ...props }: SectionPropTypes): JSX.Element;
8
+ declare function Section({ children, overrideStyles, ...props }: SectionPropTypes): JSX.Element;
10
9
  export default Section;
@@ -31,31 +31,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  var jsx_runtime_1 = require("react/jsx-runtime");
33
33
  var react_1 = require("react");
34
- var util_1 = require("../../../DynamicLayout/sections/CustomSection/util");
35
- var isNullOrUndefined_1 = __importDefault(require("../../../DynamicLayout/sections/CustomSection/util/isNullOrUndefined"));
36
34
  var styled_components_1 = __importDefault(require("styled-components"));
37
35
  var pdsOriginal_1 = require("../pdsOriginal");
38
36
  var YouTubeIframe_1 = require("../YouTubeIframe");
39
- var CustomSectionBackgroundMedia_1 = require("./components/CustomSectionBackgroundMedia");
40
37
  var sectionContext_1 = require("./sectionContext");
41
38
  function Section(_a) {
42
39
  var _b;
43
- var children = _a.children, overrideStyles = _a.overrideStyles, _c = _a.isMobile, isMobile = _c === void 0 ? false : _c, props = __rest(_a, ["children", "overrideStyles", "isMobile"]);
44
- var _d = (0, react_1.useState)(false), isHover = _d[0], setIsHover = _d[1];
45
- return ((0, jsx_runtime_1.jsx)(sectionContext_1.sectionContext.Provider, __assign({ value: 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)(Background, { isHover: isHover, isMobile: isMobile }, void 0), children] }), void 0) }), void 0));
40
+ var children = _a.children, overrideStyles = _a.overrideStyles, props = __rest(_a, ["children", "overrideStyles"]);
41
+ var _c = (0, react_1.useState)(false), isHover = _c[0], setIsHover = _c[1];
42
+ 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)(Background, {}, void 0), children] }), void 0) }), void 0));
46
43
  }
47
44
  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) {
48
45
  var isIframeSection = _a.isIframeSection;
49
46
  return (isIframeSection ? '100%' : 'auto');
50
47
  });
51
- function Background(_a) {
52
- var isHover = _a.isHover, _b = _a.isMobile, isMobile = _b === void 0 ? false : _b;
48
+ function Background() {
53
49
  var context = (0, react_1.useContext)(sectionContext_1.sectionContext);
54
- var id = context.id, jsonProperties = context.jsonProperties;
55
- var _c = context.styles, backgroundMediaSrc = _c.backgroundMediaSrc, backgroundColorInHex = _c.backgroundColorInHex, backgroundOverlayColorInHex = _c.backgroundOverlayColorInHex, backgroundMediaType = _c.backgroundMediaType;
50
+ var id = context.id;
51
+ var _a = context.styles, backgroundMediaSrc = _a.backgroundMediaSrc, backgroundColorInHex = _a.backgroundColorInHex, backgroundOverlayColorInHex = _a.backgroundOverlayColorInHex, backgroundMediaType = _a.backgroundMediaType;
56
52
  var backgroundRef = (0, react_1.useRef)(null);
57
- var backgroundOverlayRef = (0, react_1.useRef)(null);
58
- var _d = (0, react_1.useState)({ width: 0, height: 0 }), youtubeSize = _d[0], setYoutubeSize = _d[1];
53
+ var _b = (0, react_1.useState)({ width: 0, height: 0 }), youtubeSize = _b[0], setYoutubeSize = _b[1];
59
54
  var getResponsiveYoutubeSize = (0, react_1.useCallback)(function () {
60
55
  var backgroundWrapper = backgroundRef.current;
61
56
  if (!backgroundWrapper)
@@ -71,7 +66,6 @@ function Background(_a) {
71
66
  : { width: backgroundSize.height * (16 / 9), height: backgroundSize.height };
72
67
  return youtubeSize;
73
68
  }, [backgroundRef.current]);
74
- var _e = (0, util_1.parseJsonProperties)(jsonProperties, isMobile ? 'MOBILE' : 'DESKTOP'), style = _e.style, hoverStyle = _e.hoverStyle, overlayStyle = _e.overlayStyle, overlayHoverStyle = _e.overlayHoverStyle, layout = _e.layout, effect = _e.effect;
75
69
  (0, react_1.useEffect)(function () {
76
70
  if (backgroundMediaType !== 'YOUTUBE')
77
71
  return;
@@ -96,24 +90,6 @@ function Background(_a) {
96
90
  observer.disconnect();
97
91
  };
98
92
  }, []);
99
- (0, react_1.useEffect)(function () {
100
- var sectionElement = backgroundRef.current;
101
- var sectionOverlayElement = backgroundOverlayRef.current;
102
- if (sectionElement && style && hoverStyle) {
103
- if ('background' in style && 'background' in hoverStyle) {
104
- sectionElement.style.background = isHover
105
- ? hoverStyle.background
106
- : style.background;
107
- }
108
- }
109
- if (sectionOverlayElement && overlayStyle && overlayHoverStyle) {
110
- if ('background' in overlayStyle && 'background' in overlayHoverStyle) {
111
- sectionOverlayElement.style.background = isHover
112
- ? overlayHoverStyle.background
113
- : overlayStyle.background;
114
- }
115
- }
116
- }, [isHover, style, hoverStyle, overlayStyle, overlayHoverStyle]);
117
93
  var backgroundMedia = (0, react_1.useMemo)(function () {
118
94
  switch (backgroundMediaType) {
119
95
  case 'IMAGE':
@@ -127,55 +103,7 @@ function Background(_a) {
127
103
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
128
104
  }
129
105
  }, [youtubeSize, id, backgroundMediaType, backgroundMediaSrc]);
130
- var _f = jsonProperties || {}, CB_STYLE_PROP_BGOVERLAY = _f.CB_STYLE_PROP_BGOVERLAY, CB_STYLE_PROP_BGMEDIA = _f.CB_STYLE_PROP_BGMEDIA;
131
- var isOverlay = (0, react_1.useMemo)(function () {
132
- if (!CB_STYLE_PROP_BGOVERLAY) {
133
- return false;
134
- }
135
- if (isMobile) {
136
- return isHover
137
- ? CB_STYLE_PROP_BGOVERLAY['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:MOBILE:HOVER'] !== 'NONE'
138
- : CB_STYLE_PROP_BGOVERLAY['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:MOBILE'] !== 'NONE';
139
- }
140
- return isHover
141
- ? CB_STYLE_PROP_BGOVERLAY['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:HOVER'] !== 'NONE'
142
- : CB_STYLE_PROP_BGOVERLAY.CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE !== 'NONE';
143
- }, [isMobile, isHover, CB_STYLE_PROP_BGOVERLAY]);
144
- var isBgMedia = (0, react_1.useMemo)(function () {
145
- if (!CB_STYLE_PROP_BGMEDIA) {
146
- return false;
147
- }
148
- if (isMobile) {
149
- return isHover
150
- ? CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'] !== 'NONE'
151
- : CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'] !== 'NONE';
152
- }
153
- return isHover
154
- ? CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER'] !== 'NONE'
155
- : CB_STYLE_PROP_BGMEDIA.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE !== 'NONE';
156
- }, [isMobile, isHover, CB_STYLE_PROP_BGOVERLAY]);
157
- var mediaType = (0, react_1.useMemo)(function () {
158
- if (!CB_STYLE_PROP_BGMEDIA) {
159
- return 'NONE';
160
- }
161
- if (isMobile) {
162
- if (isHover) {
163
- return (0, isNullOrUndefined_1.default)(CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'])
164
- ? CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER']
165
- : CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE:HOVER'];
166
- }
167
- return (0, isNullOrUndefined_1.default)(CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'])
168
- ? CB_STYLE_PROP_BGMEDIA.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE
169
- : CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'];
170
- }
171
- return isHover
172
- ? CB_STYLE_PROP_BGMEDIA['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER']
173
- : CB_STYLE_PROP_BGMEDIA.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE;
174
- }, [isMobile, isHover, CB_STYLE_PROP_BGOVERLAY]);
175
- if (!jsonProperties) {
176
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(S_BackgroundWrapper, __assign({ ref: backgroundRef, color: backgroundColorInHex }, { children: backgroundMediaSrc && backgroundMedia }), void 0), (0, jsx_runtime_1.jsx)(S_BackgroundOverlay, { color: backgroundOverlayColorInHex }, void 0)] }, void 0));
177
- }
178
- 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' }, void 0)) }), void 0)] }, void 0));
106
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(S_BackgroundWrapper, __assign({ ref: backgroundRef, color: backgroundColorInHex }, { children: backgroundMediaSrc && backgroundMedia }), void 0), (0, jsx_runtime_1.jsx)(S_BackgroundOverlay, { color: backgroundOverlayColorInHex }, void 0)] }, void 0));
179
107
  }
180
108
  var S_BackgroundWrapper = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-items: center;\n background-color: ", ";\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 background-color: ", ";\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"])), function (_a) {
181
109
  var color = _a.color;
@@ -192,7 +120,5 @@ var S_YoutubeContainer = styled_components_1.default.div(templateObject_4 || (te
192
120
  var width = _a.width;
193
121
  return width + "px";
194
122
  });
195
- var S_CustomBackgroundWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __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"])));
196
- var S_CustomBackgroundOverlay = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __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"])));
197
123
  exports.default = Section;
198
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
124
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare function CustomSectionBackground({ isHover, isMobile }: {
3
+ isHover: boolean;
4
+ isMobile?: boolean;
5
+ }): JSX.Element;
6
+ export default CustomSectionBackground;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
+ return cooked;
5
+ };
6
+ var __assign = (this && this.__assign) || function () {
7
+ __assign = Object.assign || function(t) {
8
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9
+ s = arguments[i];
10
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
+ t[p] = s[p];
12
+ }
13
+ return t;
14
+ };
15
+ return __assign.apply(this, arguments);
16
+ };
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ var jsx_runtime_1 = require("react/jsx-runtime");
22
+ var react_1 = require("react");
23
+ var util_1 = require("../../../../DynamicLayout/sections/CustomSection/util");
24
+ var isNullOrUndefined_1 = __importDefault(require("../../../../DynamicLayout/sections/CustomSection/util/isNullOrUndefined"));
25
+ var styled_components_1 = __importDefault(require("styled-components"));
26
+ var sectionContext_1 = require("../sectionContext");
27
+ var CustomSectionBackgroundMedia_1 = require("./CustomSectionBackgroundMedia");
28
+ function CustomSectionBackground(_a) {
29
+ var isHover = _a.isHover, _b = _a.isMobile, isMobile = _b === void 0 ? false : _b;
30
+ var context = (0, react_1.useContext)(sectionContext_1.sectionContext);
31
+ var id = context.id, jsonProperties = context.jsonProperties;
32
+ var backgroundRef = (0, react_1.useRef)(null);
33
+ var backgroundOverlayRef = (0, react_1.useRef)(null);
34
+ 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));
60
+ }
61
+ function getIsOverlay(isMobile, isHover, specs) {
62
+ if (!specs) {
63
+ return false;
64
+ }
65
+ 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';
69
+ }
70
+ return isHover
71
+ ? specs['CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE:HOVER'] !== 'NONE'
72
+ : specs.CB_STYLE_PROP_BGOVERLAY_SPEC_TYPE !== 'NONE';
73
+ }
74
+ function getIsBgMedia(isMobile, isHover, specs) {
75
+ if (!specs) {
76
+ return false;
77
+ }
78
+ 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';
82
+ }
83
+ return isHover
84
+ ? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER'] !== 'NONE'
85
+ : specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE !== 'NONE';
86
+ }
87
+ function getMediaType(isMobile, isHover, specs) {
88
+ if (!specs) {
89
+ return 'NONE';
90
+ }
91
+ 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
+ return (0, isNullOrUndefined_1.default)(specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'])
98
+ ? specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE
99
+ : specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:MOBILE'];
100
+ }
101
+ return isHover
102
+ ? specs['CB_STYLE_PROP_BGMEDIA_SPEC_TYPE:HOVER']
103
+ : specs.CB_STYLE_PROP_BGMEDIA_SPEC_TYPE;
104
+ }
105
+ 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
+ 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"])));
107
+ exports.default = CustomSectionBackground;
108
+ var templateObject_1, templateObject_2;
@@ -1,9 +1,12 @@
1
1
  /// <reference types="react" />
2
+ import type { Device } from '../../../../DynamicLayout/sections/CustomSection/util/types';
2
3
  import type { CB_STYLE_PROP_BGMEDIA_SPECS } from '../../../../DynamicLayout/types';
3
4
  declare type Props = {
4
5
  specs: CB_STYLE_PROP_BGMEDIA_SPECS;
5
6
  playerId: number;
6
7
  mediaType: string;
8
+ isHover: boolean;
9
+ device: Device;
7
10
  };
8
- export declare function CustomSectionBackgroundMedia({ specs, playerId, mediaType }: Props): JSX.Element;
11
+ export declare function CustomSectionBackgroundMedia({ specs, playerId, mediaType, isHover, device }: Props): JSX.Element;
9
12
  export {};
@@ -21,38 +21,60 @@ Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.CustomSectionBackgroundMedia = void 0;
22
22
  var jsx_runtime_1 = require("react/jsx-runtime");
23
23
  /* eslint-disable @typescript-eslint/no-unused-vars */
24
- var react_1 = require("react");
24
+ require("react");
25
25
  var styled_components_1 = __importDefault(require("styled-components"));
26
26
  var pdsOriginal_1 = require("../../pdsOriginal");
27
27
  var YouTubeIframe_1 = require("../../YouTubeIframe");
28
+ var util_1 = require("../util");
28
29
  function CustomSectionBackgroundMedia(_a) {
29
- var specs = _a.specs, playerId = _a.playerId, mediaType = _a.mediaType;
30
- var CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME = specs.CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME, CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT = specs.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT, CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR = specs.CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR, CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY = specs.CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY, CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL = specs.CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL, CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME = specs.CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME, CB_STYLE_PROP_BGMEDIA_SPEC_YSRC = specs.CB_STYLE_PROP_BGMEDIA_SPEC_YSRC;
31
- var scaleType = (0, react_1.useMemo)(function () {
32
- switch (CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT) {
33
- case 'FILL':
34
- return 'fill';
35
- case 'CONTAIN':
36
- return 'contain';
37
- case 'COVER':
38
- return 'cover';
39
- case 'NONE':
40
- return 'none';
41
- default:
42
- return undefined;
43
- }
44
- }, [CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT]);
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);
45
35
  switch (mediaType) {
46
36
  case 'IMAGE':
47
- return ((0, jsx_runtime_1.jsx)(S_ImageWrapper, __assign({ isOverflowScroll: CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL, scaleType: scaleType }, { children: (0, jsx_runtime_1.jsx)(pdsOriginal_1.ImageView, { src: CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR, width: "responsive", height: "responsive", scaleType: scaleType, shapeType: "rectangle" }, void 0) }), void 0));
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));
48
44
  case 'YOUTUBE':
49
- return ((0, jsx_runtime_1.jsx)(S_YoutubeContainer, { children: (0, jsx_runtime_1.jsx)(YouTubeIframe_1.YouTubeIframe, { id: playerId, src: CB_STYLE_PROP_BGMEDIA_SPEC_YSRC, loopMode: CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY ? 'use' : 'none', startSeconds: CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME, endSeconds: CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME }, void 0) }, void 0));
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));
50
58
  case 'NONE':
51
59
  default:
52
60
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}, void 0);
53
61
  }
54
62
  }
55
63
  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
+ }
56
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) {
57
79
  var isOverflowScroll = _a.isOverflowScroll;
58
80
  return (isOverflowScroll ? 'scroll' : 'hidden');
@@ -1,2 +1,3 @@
1
+ export { default as CustomSection } from './CustomSection';
1
2
  export { default as Section } from './Section';
2
3
  export { sectionContext } from './sectionContext';
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.sectionContext = exports.Section = void 0;
6
+ exports.sectionContext = exports.Section = exports.CustomSection = void 0;
7
+ var CustomSection_1 = require("./CustomSection");
8
+ Object.defineProperty(exports, "CustomSection", { enumerable: true, get: function () { return __importDefault(CustomSection_1).default; } });
7
9
  var Section_1 = require("./Section");
8
10
  Object.defineProperty(exports, "Section", { enumerable: true, get: function () { return __importDefault(Section_1).default; } });
9
11
  var sectionContext_1 = require("./sectionContext");
@@ -0,0 +1 @@
1
+ export { default as parseSectionBackgroundMediaData } from './parseSectionBackgroundMediaData';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.parseSectionBackgroundMediaData = void 0;
7
+ var parseSectionBackgroundMediaData_1 = require("./parseSectionBackgroundMediaData");
8
+ Object.defineProperty(exports, "parseSectionBackgroundMediaData", { enumerable: true, get: function () { return __importDefault(parseSectionBackgroundMediaData_1).default; } });
@@ -0,0 +1,9 @@
1
+ import type { Device } from '../../../../DynamicLayout/sections/CustomSection/util/types';
2
+ import type { CB_STYLE_PROP_BGMEDIA_SPECS } from '../../../../DynamicLayout/types';
3
+ declare type SpecKeys = keyof Omit<CB_STYLE_PROP_BGMEDIA_SPECS, 'CB_STYLE_PROP_BGMEDIA_SPEC_MPLAY'>;
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
+ };
9
+ export {};
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var isNullOrUndefined_1 = __importDefault(require("../../../../DynamicLayout/sections/CustomSection/util/isNullOrUndefined"));
18
+ var AVAILABLE_SPECS = [
19
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_YSRC',
20
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_TYPE',
21
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_SCROLL',
22
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_STARTTIME',
23
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_REPLAY',
24
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT',
25
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEPOSITION',
26
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGESELECTOR',
27
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_IMAGEFIT',
28
+ 'CB_STYLE_PROP_BGMEDIA_SPEC_ENDTIME'
29
+ ];
30
+ function UseCustomSectionBackgroundMediaData(specs, device) {
31
+ return AVAILABLE_SPECS.reduce(function (acc, cur) {
32
+ var _a, _b;
33
+ var baseKey = device === 'DESKTOP' ? cur : cur + ":MOBILE";
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
+ });
46
+ }
47
+ exports.default = UseCustomSectionBackgroundMediaData;
@@ -1,2 +1,2 @@
1
1
  export * from './pdsOriginal';
2
- export { Section } from './Section';
2
+ export { Section, CustomSection } from './Section';
@@ -10,7 +10,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.Section = void 0;
13
+ exports.CustomSection = exports.Section = void 0;
14
14
  __exportStar(require("./pdsOriginal"), exports);
15
15
  var Section_1 = require("./Section");
16
16
  Object.defineProperty(exports, "Section", { enumerable: true, get: function () { return Section_1.Section; } });
17
+ Object.defineProperty(exports, "CustomSection", { enumerable: true, get: function () { return Section_1.CustomSection; } });