video-privacy 1.0.0-beta.2 → 1.0.0-beta.4

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 (2) hide show
  1. package/dist/index.js +69 -2
  2. package/package.json +2 -3
package/dist/index.js CHANGED
@@ -1,2 +1,69 @@
1
- import VideoPrivacy from '/src/video-privacy/video-privacy';
2
- export { default } from '/src/video-privacy/video-privacy';
1
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
+ import React, { useState } from 'react';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ document.head.innerHTML += "<style>.vidpriv--container {\n position: relative;\n background-color: black;\n aspect-ratio: 16 / 9;\n}\n\n.vidpriv--backdrop {\n background-size: cover;\n width: 100%;\n height: 100%;\n filter: blur(5px);\n opacity: 0.25;\n}\n\n.vidpriv--content {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.vidpriv--info {\n font-family: Arial, Helvetica, sans-serif;\n color: white;\n text-align: center;\n}\n\n.vidpriv--button {\n font-family: Arial, Helvetica, sans-serif;\n border: solid;\n border-width: 1px;\n border-color: white;\n border-radius: 0;\n background-color: transparent;\n padding: 10px 20px;\n color: white;\n font-weight: bold;\n cursor: pointer;\n}\n\n.vidpriv--button:hover {\n background-color: white;\n color: black;\n transition: all 0.3s;\n}\n</style>";
6
+
7
+ function VideoPrivacy(props) {
8
+ // State to determine if the user has acknowledged the privacy notice
9
+
10
+ var _useState = useState(false),
11
+ _useState2 = _slicedToArray(_useState, 2),
12
+ acknowledged = _useState2[0],
13
+ setAcknowledged = _useState2[1];
14
+
15
+ // Info and button text, either from props or default values
16
+
17
+ var info = props.info || "Info text";
18
+ var buttonText = props.buttonText || "I agree";
19
+
20
+ // Style definitions, either from module CSS or from props
21
+
22
+ var customInfoClass = "vidpriv--info";
23
+ if (props.customInfoClass) {
24
+ customInfoClass = props.customInfoClass;
25
+ }
26
+ var customButtonClass = "vidpriv--button";
27
+ if (props.customButtonClass) {
28
+ customButtonClass = props.customButtonClass;
29
+ }
30
+ var containerStyle = {
31
+ width: props.width || 800
32
+ };
33
+ var backdropStyle = {
34
+ backgroundImage: "url(".concat(props.imageUrl || "", ")")
35
+ };
36
+
37
+ // If the user has acknowledged the privacy notice, render the children
38
+
39
+ if (acknowledged) {
40
+ return /*#__PURE__*/jsx(React.Fragment, {
41
+ children: props.children
42
+ });
43
+ }
44
+
45
+ // Otherwise, render the privacy notice container
46
+
47
+ return /*#__PURE__*/jsxs("div", {
48
+ className: "vidpriv--container",
49
+ style: containerStyle,
50
+ children: [/*#__PURE__*/jsx("div", {
51
+ className: "vidpriv--backdrop",
52
+ style: backdropStyle
53
+ }), /*#__PURE__*/jsxs("div", {
54
+ className: "vidpriv--content",
55
+ children: [/*#__PURE__*/jsx("h2", {
56
+ className: customInfoClass,
57
+ children: info
58
+ }), /*#__PURE__*/jsx("button", {
59
+ className: customButtonClass,
60
+ onClick: function onClick() {
61
+ return setAcknowledged(true);
62
+ },
63
+ children: buttonText
64
+ })]
65
+ })]
66
+ });
67
+ }
68
+
69
+ export { VideoPrivacy as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "video-privacy",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.4",
4
4
  "scripts": {
5
5
  "rollup": "node_modules/rollup/dist/rollup.js",
6
6
  "dev": "next dev",
@@ -31,8 +31,6 @@
31
31
  "@chromatic-com/storybook": "^1.5.0",
32
32
  "@rollup/plugin-babel": "^6.0.4",
33
33
  "@rollup/plugin-commonjs": "^26.0.1",
34
- "@rollup/plugin-json": "^6.1.0",
35
- "@rollup/plugin-node-resolve": "^15.2.3",
36
34
  "@semantic-release/git": "^10.0.1",
37
35
  "@semantic-release/gitlab": "^13.1.0",
38
36
  "@semantic-release/npm": "^12.0.1",
@@ -48,6 +46,7 @@
48
46
  "eslint-config-next": "14.2.4",
49
47
  "eslint-plugin-storybook": "^0.8.0",
50
48
  "rollup": "^4.18.0",
49
+ "rollup-plugin-import-css": "^3.5.0",
51
50
  "semantic-release": "^24.0.0",
52
51
  "storybook": "^8.1.10"
53
52
  },