@digital-b2c/coreui-kit 0.30.0 → 0.30.2

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/index.mjs CHANGED
@@ -6046,7 +6046,13 @@ var TextCenterWithMedia_module_default = {
6046
6046
  var TextCenterWithMediaTitle = ({ children }) => {
6047
6047
  return /* @__PURE__ */ jsx(Fragment, { children });
6048
6048
  };
6049
- var DIRECT_FILE_PATTERN = /\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i;
6049
+ var YOUTUBE_ID_PATTERN = /(?:youtube\.com\/(?:embed\/|shorts\/)|youtube\.com\/watch\?(?:.*&)?v=|youtu\.be\/)([^/?#&]+)/i;
6050
+ var VIMEO_PATTERN = /vimeo\.com\//i;
6051
+ var isOEmbedProvider = (url) => YOUTUBE_ID_PATTERN.test(url) || VIMEO_PATTERN.test(url);
6052
+ var toOEmbedFriendlyUrl = (url) => {
6053
+ const match = url.match(YOUTUBE_ID_PATTERN);
6054
+ return match ? `https://www.youtube.com/watch?v=${match[1]}` : url;
6055
+ };
6050
6056
  var TextCenterWithMedia = ({
6051
6057
  className,
6052
6058
  title,
@@ -6070,7 +6076,7 @@ var TextCenterWithMedia = ({
6070
6076
  };
6071
6077
  const slots = resolveCompoundSlots(children, { title: TextCenterWithMediaTitle });
6072
6078
  const titleNode = (_a = slots.title) != null ? _a : title;
6073
- const isDirectFile = !!videoUrl && DIRECT_FILE_PATTERN.test(videoUrl);
6079
+ const isDirectFile = !!videoUrl && !isOEmbedProvider(videoUrl);
6074
6080
  return /* @__PURE__ */ jsxs("section", { className: clsx73(TextCenterWithMedia_module_default.textCenterWithMedia, className), children: [
6075
6081
  /* @__PURE__ */ jsxs(Container, { children: [
6076
6082
  titleNode && /* @__PURE__ */ jsx("h2", { className: "h2", children: titleNode }),
@@ -6097,7 +6103,16 @@ var TextCenterWithMedia = ({
6097
6103
  "aria-hidden": "true",
6098
6104
  className: TextCenterWithMedia_module_default.videoPreviewElement
6099
6105
  }
6100
- ) : /* @__PURE__ */ jsx(ReactPlayer2, { src: videoUrl, light: true, playing: false, width: "100%", height: "100%" }),
6106
+ ) : /* @__PURE__ */ jsx(
6107
+ ReactPlayer2,
6108
+ {
6109
+ src: toOEmbedFriendlyUrl(videoUrl),
6110
+ light: true,
6111
+ playing: false,
6112
+ width: "100%",
6113
+ height: "100%"
6114
+ }
6115
+ ),
6101
6116
  /* @__PURE__ */ jsx(
6102
6117
  "button",
6103
6118
  {