ml-cookie-control 0.0.13

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/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # ml-cookie-control
2
+
3
+ Cookie control react component
4
+
5
+ ## Features
6
+
7
+ - ES6 syntax, managed with Prettier + Eslint and Stylelint
8
+ - Unit testing via Jest
9
+ - React 17
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ yarn add ml-cookie-control
15
+ // or
16
+ npm i ml-cookie-control
17
+ ```
18
+
19
+ ### Requirements
20
+
21
+ - Node.js `v14.x` or later
22
+ - React 17
23
+
24
+
25
+ ### Usage
26
+
27
+ ```js
28
+ // pages/_document.js
29
+ import { CookieControl } from 'ml-cookie-control';
30
+
31
+ import { Html, Head, Main, NextScript } from 'next/document'
32
+
33
+ export default function Document() {
34
+ return (
35
+ <Html>
36
+ <Head>
37
+ <CookieControl domainScriptId={process.env.DOMAIN_SCRIPT_ID} />
38
+ </Head>
39
+ <body>
40
+ <Main />
41
+ <NextScript />
42
+ </body>
43
+ </Html>
44
+ )
45
+ }
46
+ ```
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true,
5
+ });
6
+ exports.CookieControl = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ function _interopRequireDefault(obj) {
11
+ return obj && obj.__esModule ? obj : { default: obj };
12
+ }
13
+
14
+ const CookieControl = ({ domainScriptId }) => {
15
+ return /*#__PURE__*/ _react.default.createElement(
16
+ _react.default.Fragment,
17
+ null,
18
+ /*#__PURE__*/ _react.default.createElement("script", {
19
+ src: "https://magicleap.com/assets/js/cookie-control-js/start-cookie-control.min.js",
20
+ }),
21
+ /*#__PURE__*/ _react.default.createElement("script", {
22
+ dangerouslySetInnerHTML: {
23
+ __html: `CookieControl.start(${JSON.stringify({
24
+ domainScriptId: domainScriptId,
25
+ })})`,
26
+ },
27
+ })
28
+ );
29
+ };
30
+
31
+ exports.CookieControl = CookieControl;
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "ml-cookie-control",
3
+ "version": "0.0.13",
4
+ "private": false,
5
+ "description": "Cookie control react component",
6
+ "license": "MIT",
7
+ "author": "hmgc-lp",
8
+ "main": "dist/CookieControl.js",
9
+ "scripts": {
10
+ "test": "exit 0"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "react": "17.0.2",
17
+ "react-dom": "17.0.2"
18
+ },
19
+ "devDependencies": {
20
+ "@babel/runtime": "^7.18.3",
21
+ "@babel/cli": "^7.18.3",
22
+ "@babel/core": "^7.18.3"
23
+ }
24
+ }