diy-template-components 5.10.0 → 5.11.0

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/build/index.es.js CHANGED
@@ -5,7 +5,6 @@ import moment from 'moment';
5
5
  import Countdown from 'react-countdown';
6
6
  import koreanLocale from 'moment/locale/ko';
7
7
  import ReactDOMServer from 'react-dom/server';
8
- import '@storybook/theming';
9
8
  import { createTheming, createUseStyles as createUseStyles$1, useTheme as useTheme$1 } from 'react-jss';
10
9
 
11
10
  function insertStyle(css) {
@@ -882,7 +881,7 @@ const someMethod1 = (/** @type {import('./types').IconData["svgChildrenConfigs"]
882
881
  }
883
882
  return obj;
884
883
  };
885
- const useStyles$1 = createUseStyles$1({
884
+ const useStyles$2 = createUseStyles$1({
886
885
  '@keyframes slideRight': {
887
886
  to: {
888
887
  backgroundPosition: '1250% 0, 0 0'
@@ -960,7 +959,7 @@ const Icon = ({
960
959
  // this ref is used to cancel the fetch promise success callback in case name prop changed
961
960
  const currentName = useRef(name);
962
961
  const [svgState, setSvgState] = useState(defaultSvgState);
963
- const styles = useStyles$1({
962
+ const styles = useStyles$2({
964
963
  width,
965
964
  height,
966
965
  color,
@@ -2549,7 +2548,87 @@ function FontSeeder({
2549
2548
  return null;
2550
2549
  }
2551
2550
 
2552
- insertStyle("@charset \"UTF-8\";\n/* Wrapper: no height/min-height – height comes only from section content, not from HOC */\n.sectionBackgroundWrapper {\n position: relative;\n width: 100%;\n overflow: hidden;\n}\n\n/* Section root transparent so background (image/color/gradient/video) shows through */\n.sectionBackgroundWrapper > .sectionBackgroundContent > * {\n background: transparent !important;\n}\n\n/* Video: absolute so it does not affect wrapper height; height follows section */\n.sectionBackgroundVideo {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n object-fit: cover;\n z-index: 0;\n pointer-events: none;\n}\n\n/* YouTube embed: cover background, no UI interaction, minimal branding via URL params */\n.sectionBackgroundYoutube {\n position: absolute;\n top: 50%;\n left: 50%;\n width: 100vw;\n min-width: 100%;\n min-height: 100%;\n height: 56.25vw; /* 16:9 */\n min-height: 100vh;\n transform: translate(-50%, -50%);\n border: none;\n z-index: 0;\n pointer-events: none;\n}\n\n@media (min-aspect-ratio: 16/9) {\n .sectionBackgroundYoutube {\n width: 177.78vh;\n height: 100vh;\n min-width: 100%;\n min-height: 100%;\n }\n}\n/* Blur overlay: frosted glass so content stays readable over video/image/gradient */\n.sectionBackgroundBlur {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 1;\n pointer-events: none;\n /* backdrop-filter: blur(2px);\n -webkit-backdrop-filter: blur(2px); */\n /* background: rgba(255, 255, 255, 0.08); */\n}\n\n/* Content wrapper: above blur so component items are clear */\n.sectionBackgroundContent {\n position: relative;\n z-index: 2;\n}\n\n/* Background layer: fills wrapper only (absolute), does not affect wrapper height */\n.sectionBackgroundLayer {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 0;\n pointer-events: none;\n}\n\n.sectionBackgroundLayer.sectionBackgroundImage {\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n}");
2551
+ /**
2552
+ * JSS styles for section background wrapper (replaces styles.css).
2553
+ * Used with react-jss createUseStyles.
2554
+ */
2555
+ const sectionBackgroundStyles = () => ({
2556
+ /* Wrapper: no height/min-height – height comes only from section content */
2557
+ sectionBackgroundWrapper: {
2558
+ position: 'relative',
2559
+ width: '100%',
2560
+ overflow: 'hidden',
2561
+ '& > $sectionBackgroundContent > *': {
2562
+ background: 'transparent !important'
2563
+ }
2564
+ },
2565
+ /* Section root transparent so background (image/color/gradient/video) shows through */
2566
+ sectionBackgroundContent: {
2567
+ position: 'relative',
2568
+ zIndex: 2
2569
+ },
2570
+ /* Video: absolute so it does not affect wrapper height; height follows section */
2571
+ sectionBackgroundVideo: {
2572
+ position: 'absolute',
2573
+ top: 0,
2574
+ left: 0,
2575
+ width: '100%',
2576
+ height: '100%',
2577
+ objectFit: 'cover',
2578
+ zIndex: 0,
2579
+ pointerEvents: 'none'
2580
+ },
2581
+ /* YouTube embed: cover background, no UI interaction */
2582
+ sectionBackgroundYoutube: {
2583
+ position: 'absolute',
2584
+ top: '50%',
2585
+ left: '50%',
2586
+ width: '100vw',
2587
+ minWidth: '100%',
2588
+ minHeight: '100vh',
2589
+ height: '56.25vw' /* 16:9 */,
2590
+ transform: 'translate(-50%, -50%)',
2591
+ border: 'none',
2592
+ zIndex: 0,
2593
+ pointerEvents: 'none',
2594
+ '@media (min-aspect-ratio: 16/9)': {
2595
+ width: '177.78vh',
2596
+ height: '100vh',
2597
+ minWidth: '100%',
2598
+ minHeight: '100%'
2599
+ }
2600
+ },
2601
+ /* Blur overlay: frosted glass so content stays readable */
2602
+ sectionBackgroundBlur: {
2603
+ position: 'absolute',
2604
+ top: 0,
2605
+ left: 0,
2606
+ width: '100%',
2607
+ height: '100%',
2608
+ zIndex: 1,
2609
+ pointerEvents: 'none'
2610
+ },
2611
+ /* Background layer: fills wrapper only (absolute), does not affect wrapper height */
2612
+ sectionBackgroundLayer: {
2613
+ position: 'absolute',
2614
+ top: 0,
2615
+ left: 0,
2616
+ width: '100%',
2617
+ height: '100%',
2618
+ zIndex: 0,
2619
+ pointerEvents: 'none'
2620
+ },
2621
+ sectionBackgroundImage: {
2622
+ backgroundSize: 'cover',
2623
+ backgroundPosition: 'center',
2624
+ backgroundRepeat: 'no-repeat'
2625
+ },
2626
+ sectionBackgroundGradient: {
2627
+ /* inherits from sectionBackgroundLayer; gradient value comes from inline style */
2628
+ }
2629
+ });
2630
+
2631
+ const useStyles$1 = createUseStyles$1(sectionBackgroundStyles);
2553
2632
 
2554
2633
  /**
2555
2634
  * Extracts YouTube video ID from various YouTube URL formats.
@@ -2568,6 +2647,13 @@ function getYoutubeVideoId(url) {
2568
2647
  return null;
2569
2648
  }
2570
2649
 
2650
+ /**
2651
+ * Returns YouTube thumbnail URL for a video ID (used when app is in iframe and YouTube iframe won't play).
2652
+ */
2653
+ function getYoutubeThumbnailUrl(videoId) {
2654
+ return `https://img.youtube.com/vi/${videoId}/maxresdefault.jpg`;
2655
+ }
2656
+
2571
2657
  /**
2572
2658
  * Builds YouTube embed URL with params for background video:
2573
2659
  * autoplay, mute, loop (via playlist), no controls, minimal branding, no end-screen suggestions.
@@ -2611,10 +2697,13 @@ function withSectionBackground(WrappedSectionRenderer) {
2611
2697
  sectionIndex,
2612
2698
  ...restProps
2613
2699
  } = props;
2700
+ const {
2701
+ isMobile
2702
+ } = useContext(PageContext);
2703
+ const classes = useStyles$1();
2614
2704
 
2615
2705
  // Use props first, then fall back to sectionData so it works for all sections
2616
2706
  const componentBg = componentBgProp ?? {};
2617
- console.log('amit1111', componentBg, isSkipV2Section, sectionData);
2618
2707
 
2619
2708
  // version !== 2: skip background — render section only, no wrapper
2620
2709
 
@@ -2668,7 +2757,7 @@ function withSectionBackground(WrappedSectionRenderer) {
2668
2757
  return {};
2669
2758
  }
2670
2759
  };
2671
- const layerClassName = type === 'image' ? 'sectionBackgroundLayer sectionBackgroundImage' : type === 'gradient' ? 'sectionBackgroundLayer sectionBackgroundGradient' : 'sectionBackgroundLayer';
2760
+ const layerClassName = type === 'image' ? `${classes.sectionBackgroundLayer} ${classes.sectionBackgroundImage}` : type === 'gradient' ? `${classes.sectionBackgroundLayer} ${classes.sectionBackgroundGradient}` : classes.sectionBackgroundLayer;
2672
2761
 
2673
2762
  // Video background: YouTube embed (when isYoutube/isYoutubeVideo) or normal <video> from url
2674
2763
  if (type === 'video') {
@@ -2677,9 +2766,9 @@ function withSectionBackground(WrappedSectionRenderer) {
2677
2766
  if (!videoId) {
2678
2767
  // Fallback to normal video if we can't parse YouTube ID
2679
2768
  return /*#__PURE__*/React.createElement("div", {
2680
- className: "sectionBackgroundWrapper"
2769
+ className: classes.sectionBackgroundWrapper
2681
2770
  }, /*#__PURE__*/React.createElement("video", {
2682
- className: "sectionBackgroundVideo",
2771
+ className: classes.sectionBackgroundVideo,
2683
2772
  src: value,
2684
2773
  autoPlay: true,
2685
2774
  muted: true,
@@ -2687,10 +2776,33 @@ function withSectionBackground(WrappedSectionRenderer) {
2687
2776
  playsInline: true,
2688
2777
  "aria-hidden": "true"
2689
2778
  }), /*#__PURE__*/React.createElement("div", {
2690
- className: "sectionBackgroundBlur",
2779
+ className: classes.sectionBackgroundBlur,
2780
+ "aria-hidden": "true"
2781
+ }), /*#__PURE__*/React.createElement("div", {
2782
+ className: classes.sectionBackgroundContent
2783
+ }, /*#__PURE__*/React.createElement(WrappedSectionRenderer, _extends({
2784
+ sectionData: sectionData,
2785
+ extraProps: extraProps,
2786
+ sectionIndex: sectionIndex
2787
+ }, restProps))));
2788
+ }
2789
+ // When isMobile is true, app is rendered inside an iframe; YouTube iframe often fails in nested iframes.
2790
+ // Use static YouTube thumbnail as background instead of the YouTube player.
2791
+ if (isMobile) {
2792
+ const thumbUrl = getYoutubeThumbnailUrl(videoId);
2793
+ return /*#__PURE__*/React.createElement("div", {
2794
+ className: classes.sectionBackgroundWrapper
2795
+ }, /*#__PURE__*/React.createElement("div", {
2796
+ className: `${classes.sectionBackgroundLayer} ${classes.sectionBackgroundImage}`,
2797
+ style: {
2798
+ backgroundImage: `url(${thumbUrl})`
2799
+ },
2800
+ "aria-hidden": "true"
2801
+ }), /*#__PURE__*/React.createElement("div", {
2802
+ className: classes.sectionBackgroundBlur,
2691
2803
  "aria-hidden": "true"
2692
2804
  }), /*#__PURE__*/React.createElement("div", {
2693
- className: "sectionBackgroundContent"
2805
+ className: classes.sectionBackgroundContent
2694
2806
  }, /*#__PURE__*/React.createElement(WrappedSectionRenderer, _extends({
2695
2807
  sectionData: sectionData,
2696
2808
  extraProps: extraProps,
@@ -2699,19 +2811,20 @@ function withSectionBackground(WrappedSectionRenderer) {
2699
2811
  }
2700
2812
  const embedUrl = getYoutubeEmbedUrl(videoId);
2701
2813
  return /*#__PURE__*/React.createElement("div", {
2702
- className: "sectionBackgroundWrapper"
2814
+ className: classes.sectionBackgroundWrapper
2703
2815
  }, /*#__PURE__*/React.createElement("iframe", {
2704
- className: "sectionBackgroundYoutube",
2816
+ className: classes.sectionBackgroundYoutube,
2705
2817
  src: embedUrl,
2706
2818
  title: "Background video",
2707
- allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope",
2819
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
2708
2820
  allowFullScreen: true,
2821
+ referrerPolicy: "strict-origin-when-cross-origin",
2709
2822
  "aria-hidden": "true"
2710
2823
  }), /*#__PURE__*/React.createElement("div", {
2711
- className: "sectionBackgroundBlur",
2824
+ className: classes.sectionBackgroundBlur,
2712
2825
  "aria-hidden": "true"
2713
2826
  }), /*#__PURE__*/React.createElement("div", {
2714
- className: "sectionBackgroundContent"
2827
+ className: classes.sectionBackgroundContent
2715
2828
  }, /*#__PURE__*/React.createElement(WrappedSectionRenderer, _extends({
2716
2829
  sectionData: sectionData,
2717
2830
  extraProps: extraProps,
@@ -2720,9 +2833,9 @@ function withSectionBackground(WrappedSectionRenderer) {
2720
2833
  }
2721
2834
  // Normal video from URL
2722
2835
  return /*#__PURE__*/React.createElement("div", {
2723
- className: "sectionBackgroundWrapper"
2836
+ className: classes.sectionBackgroundWrapper
2724
2837
  }, /*#__PURE__*/React.createElement("video", {
2725
- className: "sectionBackgroundVideo",
2838
+ className: classes.sectionBackgroundVideo,
2726
2839
  src: value,
2727
2840
  autoPlay: true,
2728
2841
  muted: true,
@@ -2730,10 +2843,10 @@ function withSectionBackground(WrappedSectionRenderer) {
2730
2843
  playsInline: true,
2731
2844
  "aria-hidden": "true"
2732
2845
  }), /*#__PURE__*/React.createElement("div", {
2733
- className: "sectionBackgroundBlur",
2846
+ className: classes.sectionBackgroundBlur,
2734
2847
  "aria-hidden": "true"
2735
2848
  }), /*#__PURE__*/React.createElement("div", {
2736
- className: "sectionBackgroundContent"
2849
+ className: classes.sectionBackgroundContent
2737
2850
  }, /*#__PURE__*/React.createElement(WrappedSectionRenderer, _extends({
2738
2851
  sectionData: sectionData,
2739
2852
  extraProps: extraProps,
@@ -2743,16 +2856,17 @@ function withSectionBackground(WrappedSectionRenderer) {
2743
2856
 
2744
2857
  // color | image | gradient: background layer behind content so section can be transparent
2745
2858
  return /*#__PURE__*/React.createElement("div", {
2746
- className: "sectionBackgroundWrapper"
2859
+ className: classes.sectionBackgroundWrapper,
2860
+ style: isMobile ? getLayerStyle() : {}
2747
2861
  }, /*#__PURE__*/React.createElement("div", {
2748
2862
  className: layerClassName,
2749
2863
  style: getLayerStyle(),
2750
2864
  "aria-hidden": "true"
2751
2865
  }), /*#__PURE__*/React.createElement("div", {
2752
- className: "sectionBackgroundBlur",
2866
+ className: classes.sectionBackgroundBlur,
2753
2867
  "aria-hidden": "true"
2754
2868
  }), /*#__PURE__*/React.createElement("div", {
2755
- className: "sectionBackgroundContent"
2869
+ className: classes.sectionBackgroundContent
2756
2870
  }, /*#__PURE__*/React.createElement(WrappedSectionRenderer, _extends({
2757
2871
  sectionData: sectionData,
2758
2872
  extraProps: extraProps,
@@ -5518,8 +5632,9 @@ function VideoPlayer(props) {
5518
5632
  className: classes.iframe + ' ' + classes.hideImg,
5519
5633
  src: imageUrl ? getId(videoUrl) + '?autoplay=1' : getId(videoUrl),
5520
5634
  frameBorder: "0",
5521
- allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
5635
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
5522
5636
  allowFullScreen: true,
5637
+ referrerPolicy: "strict-origin-when-cross-origin",
5523
5638
  onLoad: () => {
5524
5639
  setIsLoaded(true);
5525
5640
  }
@@ -12137,7 +12252,8 @@ const getFloatingButtonResponsive = theme => {
12137
12252
  left: 16,
12138
12253
  padding: '10px 16px',
12139
12254
  gap: '8px',
12140
- fontSize: '12px'
12255
+ fontSize: '12px',
12256
+ background: theme?.colors?.ctaColor || '#FFFFFF'
12141
12257
  },
12142
12258
  tablet: {
12143
12259
  ...base,
@@ -12145,7 +12261,8 @@ const getFloatingButtonResponsive = theme => {
12145
12261
  left: 20,
12146
12262
  padding: '12px 18px',
12147
12263
  gap: '10px',
12148
- fontSize: '13px'
12264
+ fontSize: '13px',
12265
+ background: theme?.colors?.ctaColor || '#FFFFFF'
12149
12266
  },
12150
12267
  desktop: {
12151
12268
  ...base,
@@ -12153,7 +12270,8 @@ const getFloatingButtonResponsive = theme => {
12153
12270
  left: 24,
12154
12271
  padding: '12px 20px',
12155
12272
  gap: '10px',
12156
- fontSize: '14px'
12273
+ fontSize: '14px',
12274
+ background: theme?.colors?.ctaColor || '#FFFFFF'
12157
12275
  }
12158
12276
  };
12159
12277
  };