@raketa-builder/builder 0.23.0 → 0.24.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/dist/index.js +0 -1
- package/package.json +1 -1
- package/src/index.js +0 -6
- package/src/Container.js +0 -15
- package/src/EmbeddedVideo.js +0 -150
package/dist/index.js
CHANGED
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -10,11 +10,8 @@ import ImageInput from "./pickers/ImagePicker/ImageInput";
|
|
|
10
10
|
import Dialog from "./dialogs/Dialog";
|
|
11
11
|
import Img from "./lib/Image";
|
|
12
12
|
import List from "./List";
|
|
13
|
-
import Container from "./Container";
|
|
14
|
-
import EmbeddedVideo from "./EmbeddedVideo";
|
|
15
13
|
import MediaManager from "./MediaManager";
|
|
16
14
|
import ListInput from "./ListInput";
|
|
17
|
-
import imageSrc from "./helpers/imageSrc";
|
|
18
15
|
import Button from "./forms/Button";
|
|
19
16
|
import ButtonSettings from "./forms/ButtonSettings";
|
|
20
17
|
import LinkSettings from "./forms/LinkSettings";
|
|
@@ -40,13 +37,10 @@ export {
|
|
|
40
37
|
Dialog,
|
|
41
38
|
Img,
|
|
42
39
|
List,
|
|
43
|
-
Container,
|
|
44
|
-
EmbeddedVideo,
|
|
45
40
|
MediaManager,
|
|
46
41
|
ImagePicker,
|
|
47
42
|
ImageInput,
|
|
48
43
|
ListInput,
|
|
49
|
-
imageSrc,
|
|
50
44
|
Button,
|
|
51
45
|
ButtonSettings,
|
|
52
46
|
LinkSettings,
|
package/src/Container.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
const Container = ({ settings, className, children }) => {
|
|
4
|
-
const { containerID, ...restSettings } = settings || {};
|
|
5
|
-
|
|
6
|
-
const cssClasses = [...Object.values(restSettings), className].join(" ");
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<div id={containerID} className={cssClasses}>
|
|
10
|
-
{children}
|
|
11
|
-
</div>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default Container;
|
package/src/EmbeddedVideo.js
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
const VimeoEmbed = ({ videoId, autoplay }) => (
|
|
4
|
-
<iframe
|
|
5
|
-
frameBorder="0"
|
|
6
|
-
allowFullScreen="0"
|
|
7
|
-
src={`https://player.vimeo.com/video/${videoId}?color=ffffff&title=0&byline=0&portrait=0&autoplay=${
|
|
8
|
-
autoplay === true ? "1" : "0"
|
|
9
|
-
}`}
|
|
10
|
-
className="content"
|
|
11
|
-
allow="autoplay"
|
|
12
|
-
/>
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const YoukuEmbed = ({ videoId, autoplay }) => (
|
|
16
|
-
<iframe
|
|
17
|
-
height="0"
|
|
18
|
-
width="0"
|
|
19
|
-
src={`https://player.youku.com/embed/${videoId}?autoplay=${
|
|
20
|
-
autoplay === true ? "1" : "0"
|
|
21
|
-
}`}
|
|
22
|
-
frameBorder="0"
|
|
23
|
-
allowFullScreen
|
|
24
|
-
className="content"
|
|
25
|
-
allow="autoplay"
|
|
26
|
-
/>
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
const YouTubeEmbed = ({ videoId, autoplay }) => (
|
|
30
|
-
<iframe
|
|
31
|
-
frameBorder="0"
|
|
32
|
-
allowFullScreen
|
|
33
|
-
src={`https://youtube.com/embed/${videoId}?autoplay=${
|
|
34
|
-
autoplay === true ? "1" : "0"
|
|
35
|
-
}`}
|
|
36
|
-
className="content"
|
|
37
|
-
allow="autoplay"
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const YouTubeNoCookieEmbed = ({ videoId, autoplay }) => (
|
|
42
|
-
<iframe
|
|
43
|
-
frameBorder="0"
|
|
44
|
-
allowFullScreen
|
|
45
|
-
src={`https://www.youtube-nocookie.com/embed/${videoId}?autoplay=${
|
|
46
|
-
autoplay === true ? "1" : "0"
|
|
47
|
-
}`}
|
|
48
|
-
className="content"
|
|
49
|
-
allow="autoplay"
|
|
50
|
-
/>
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const WistiaEmbed = ({ videoId, autoplay }) => (
|
|
54
|
-
<iframe
|
|
55
|
-
frameBorder="0"
|
|
56
|
-
allowFullScreen
|
|
57
|
-
src={`https://fast.wistia.net/embed/iframe/${videoId}${
|
|
58
|
-
autoplay ? "?autoPlay=true" : ""
|
|
59
|
-
}`}
|
|
60
|
-
className="content"
|
|
61
|
-
allow="autoplay"
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
const videoType = (url) => {
|
|
66
|
-
if (url.includes("youtu")) return "youtube";
|
|
67
|
-
if (url.includes("vimeo")) return "vimeo";
|
|
68
|
-
if (url.includes("youku")) return "youku";
|
|
69
|
-
if (url.includes("wistia")) return "wistia";
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const youtubeId = (url) => {
|
|
73
|
-
let matches = url.match(
|
|
74
|
-
/(youtu\.be\/|youtube\.com\/(watch\?(.*&)?v=|(embed|v)\/))([^\?&"'>]+)/
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
if (matches && matches[5]) {
|
|
78
|
-
return matches[5]
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
matches = url.match(/youtu\.be\/|youtube\.com\/shorts\/(?<id>.*)(\?.*)?/)
|
|
82
|
-
|
|
83
|
-
return matches?.groups?.id || ''
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const vimeoId = (url) => {
|
|
87
|
-
const matches = url.match(/http(s?):\/\/(www\.)?vimeo\.com\/(\d+)($|\/)/);
|
|
88
|
-
return matches !== "" && matches !== null ? matches[3] : "";
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
const youkuId = (url) => {
|
|
92
|
-
const matches = url.match(
|
|
93
|
-
/http(s?):\/\/v\.youku\.com\/v_show\/id_([A-Za-z0-9=]+)\.html/
|
|
94
|
-
);
|
|
95
|
-
return matches !== "" && matches !== null ? matches[2] : "";
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const wistiaId = (url) => {
|
|
99
|
-
const matches = url.match(
|
|
100
|
-
/http(s?):\/\/fast\.wistia\.net\/embed\/iframe\/(.*)($|\?)/
|
|
101
|
-
);
|
|
102
|
-
return matches !== "" && matches !== null ? matches[2] : "";
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const videoId = (url) => {
|
|
106
|
-
if (videoType(url) === "youtube") return youtubeId(url);
|
|
107
|
-
if (videoType(url) === "vimeo") return vimeoId(url);
|
|
108
|
-
if (videoType(url) === "youku") return youkuId(url);
|
|
109
|
-
if (videoType(url) === "wistia") return wistiaId(url);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const VideoComponentType = (vType, noCookieDomains) => {
|
|
113
|
-
const components = {
|
|
114
|
-
youtube: YouTubeEmbed,
|
|
115
|
-
vimeo: VimeoEmbed,
|
|
116
|
-
youku: YoukuEmbed,
|
|
117
|
-
wistia: WistiaEmbed,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const noCookiesComponents = {
|
|
121
|
-
youtube: YouTubeNoCookieEmbed,
|
|
122
|
-
vimeo: VimeoEmbed,
|
|
123
|
-
youku: YoukuEmbed,
|
|
124
|
-
wistia: WistiaEmbed,
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
if (noCookieDomains) {
|
|
128
|
-
return noCookiesComponents[vType];
|
|
129
|
-
} else {
|
|
130
|
-
return components[vType];
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const EmbeddedVideo = ({
|
|
135
|
-
videoUrl,
|
|
136
|
-
autoplay = false,
|
|
137
|
-
noCookieDomains = false,
|
|
138
|
-
}) => {
|
|
139
|
-
const vType = videoType(videoUrl);
|
|
140
|
-
const vId = videoId(videoUrl);
|
|
141
|
-
const VideoComponent = VideoComponentType(vType, noCookieDomains);
|
|
142
|
-
|
|
143
|
-
if (VideoComponent) {
|
|
144
|
-
return <VideoComponent videoId={vId} autoplay={autoplay} />;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return null;
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
export default EmbeddedVideo;
|