@propellerads/cookie-message 4.0.1 → 4.0.3
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 +1 -1
- package/dist/index.js +40 -41
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,50 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import i from "
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
right: `${o * 5}px`
|
|
15
|
-
}
|
|
16
|
-
}, $ = i.div`
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
import t, { ButtonVariant as n } from "@propellerads/button";
|
|
3
|
+
import r from "styled-components";
|
|
4
|
+
import { baseShadow as i, borderRadius as a, spacing as o, white as s } from "@propellerads/stylevariables";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
//#region src/types.ts
|
|
7
|
+
var u = {
|
|
8
|
+
LeftBottom: "left_bottom",
|
|
9
|
+
RightBottom: "right_bottom"
|
|
10
|
+
}, d = {
|
|
11
|
+
[u.LeftBottom]: { left: `${o * 5}px` },
|
|
12
|
+
[u.RightBottom]: { right: `${o * 5}px` }
|
|
13
|
+
}, f = r.div`
|
|
17
14
|
width: 320px;
|
|
18
|
-
border-radius: ${
|
|
19
|
-
background-color: ${
|
|
20
|
-
box-shadow: ${
|
|
15
|
+
border-radius: ${a}px;
|
|
16
|
+
background-color: ${s};
|
|
17
|
+
box-shadow: ${i};
|
|
21
18
|
position: fixed;
|
|
22
19
|
z-index: 99999;
|
|
23
20
|
bottom: ${o * 5}px;
|
|
24
21
|
padding: ${o * 5}px;
|
|
25
22
|
|
|
26
|
-
${({ $position: e }) =>
|
|
27
|
-
`,
|
|
23
|
+
${({ $position: e }) => d[e]}
|
|
24
|
+
`, p = r.div`
|
|
28
25
|
margin-bottom: ${o * 3}px;
|
|
29
|
-
`,
|
|
26
|
+
`, m = r.div`
|
|
30
27
|
margin-bottom: ${o * 3}px;
|
|
31
|
-
`,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
`, h = r.div``, g = "accept_cookie_policy", _ = ({ title: r = "Cookies", children: i, position: a = u.LeftBottom, cookieKey: o = g }) => {
|
|
29
|
+
let [s, d] = e(!window.localStorage.getItem(o));
|
|
30
|
+
return s ? /* @__PURE__ */ l(f, {
|
|
31
|
+
$position: a,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ c(m, { children: /* @__PURE__ */ c("b", { children: r }) }),
|
|
34
|
+
/* @__PURE__ */ c(p, { children: i }),
|
|
35
|
+
/* @__PURE__ */ c(h, { children: /* @__PURE__ */ c(t, {
|
|
36
|
+
id: "cookie-consent",
|
|
37
|
+
variant: n.Primary,
|
|
38
|
+
onClick: () => {
|
|
39
|
+
window.localStorage.setItem(o, "true"), d(!1);
|
|
40
|
+
},
|
|
41
|
+
children: "Got it"
|
|
42
|
+
}) })
|
|
43
|
+
]
|
|
44
|
+
}) : null;
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=index.js.map
|
|
46
|
+
//#endregion
|
|
47
|
+
export { u as Position, _ as default };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import type {ReactNode} from 'react';\n\nexport const Position = {\n LeftBottom: 'left_bottom',\n RightBottom: 'right_bottom',\n} as const;\nexport type Position = (typeof Position)[keyof typeof Position];\n\nexport type CookieMessageProps = {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: Position;\n};\n","import styled, {CSSObject} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport type {Position} from './types';\nimport {Position as CookieMessagePosition} from './types';\n\ntype StyledCookieCardProps = {\n $position: Position;\n};\n\nconst positionStylesMap = {\n [CookieMessagePosition.LeftBottom]: {\n left: `${spacing * 5}px`,\n },\n [CookieMessagePosition.RightBottom]: {\n right: `${spacing * 5}px`,\n },\n} as const satisfies Record<Position, CSSObject>;\n\nconst StyledCookieCard = styled.div<StyledCookieCardProps>`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${({$position}) => positionStylesMap[$position]}\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import {useState} from 'react';\nimport Button, {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/types.ts","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import type {ReactNode} from 'react';\n\nexport const Position = {\n LeftBottom: 'left_bottom',\n RightBottom: 'right_bottom',\n} as const;\nexport type Position = (typeof Position)[keyof typeof Position];\n\nexport type CookieMessageProps = {\n children: ReactNode;\n title?: ReactNode;\n cookieKey?: string;\n position?: Position;\n};\n","import styled, {CSSObject} from 'styled-components';\nimport {white, borderRadius, baseShadow, spacing} from '@propellerads/stylevariables';\nimport type {Position} from './types';\nimport {Position as CookieMessagePosition} from './types';\n\ntype StyledCookieCardProps = {\n $position: Position;\n};\n\nconst positionStylesMap = {\n [CookieMessagePosition.LeftBottom]: {\n left: `${spacing * 5}px`,\n },\n [CookieMessagePosition.RightBottom]: {\n right: `${spacing * 5}px`,\n },\n} as const satisfies Record<Position, CSSObject>;\n\nconst StyledCookieCard = styled.div<StyledCookieCardProps>`\n width: 320px;\n border-radius: ${borderRadius}px;\n background-color: ${white};\n box-shadow: ${baseShadow};\n position: fixed;\n z-index: 99999;\n bottom: ${spacing * 5}px;\n padding: ${spacing * 5}px;\n\n ${({$position}) => positionStylesMap[$position]}\n`;\n\nconst CookieInfo = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\nconst CookieTitle = styled.div`\n margin-bottom: ${spacing * 3}px;\n`;\n\nconst CookieAction = styled.div``;\n\nexport {StyledCookieCard, CookieInfo, CookieTitle, CookieAction};\n","import {useState} from 'react';\nimport Button, {ButtonVariant} from '@propellerads/button';\nimport type {CookieMessageProps} from './types';\nimport {Position} from './types';\nimport {StyledCookieCard, CookieAction, CookieInfo, CookieTitle} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = Position.LeftBottom,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n if (!isShow) {\n return null;\n }\n\n return (\n <StyledCookieCard $position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>{children}</CookieInfo>\n\n <CookieAction>\n <Button id=\"cookie-consent\" variant={ButtonVariant.Primary} onClick={handleClick}>\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n );\n};\n\nexport default CookieMessage;\n\nexport {Position};\nexport type {CookieMessageProps};\n"],"mappings":";;;;;;AAEA,IAAa,IAAW;CACtB,YAAY;CACZ,aAAa;CACd,ECIK,IAAoB;EACvB,EAAsB,aAAa,EAClC,MAAM,GAAG,IAAU,EAAE,KACtB;EACA,EAAsB,cAAc,EACnC,OAAO,GAAG,IAAU,EAAE,KACvB;CACF,EAEK,IAAmB,EAAO,GAA0B;;mBAEvC,EAAa;sBACV,EAAM;gBACZ,EAAW;;;YAGf,IAAU,EAAE;aACX,IAAU,EAAE;;KAEpB,EAAC,mBAAe,EAAkB,GAAW;GAG5C,IAAa,EAAO,GAAG;mBACV,IAAU,EAAE;GAEzB,IAAc,EAAO,GAAG;mBACX,IAAU,EAAE;GAGzB,IAAe,EAAO,GAAG,IChCzB,IAAqB,wBAErB,KAAiB,EACrB,WAAQ,WACR,aACA,cAAW,EAAS,YACpB,eAAY,QACY;CACxB,IAAM,CAAC,GAAQ,KAAW,EAAS,CAAC,OAAO,aAAa,QAAQ,EAAU,CAAC;CAW3E,OAJK,IAKH,kBAAC,GAAD;EAAkB,WAAW;YAA7B;GACE,kBAAC,GAAD,EAAA,UACE,kBAAC,KAAD,EAAA,UAAI,GAAU,CAAA,EACF,CAAA;GAEd,kBAAC,GAAD,EAAa,aAAsB,CAAA;GAEnC,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;IAAQ,IAAG;IAAiB,SAAS,EAAc;IAAS,eAlBxC;KAExB,AADA,OAAO,aAAa,QAAQ,GAAW,OAAO,EAC9C,EAAQ,GAAM;;cAgBwE;IAEzE,CAAA,EACI,CAAA;GACE;MAhBZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/cookie-message",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"url": "https://github.com/propellerads/ui-components/issues"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
|
|
22
|
+
"build": "tsc && vite build && bunx rollup -c rollup.dts.config.mjs"
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/propellerads/ui-components#readme",
|
|
25
25
|
"private": false,
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@propellerads/button": "^
|
|
27
|
+
"@propellerads/button": "^11.0.0",
|
|
28
28
|
"@propellerads/stylevariables": "^2.0.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/react": "^19.2.14",
|
|
36
|
-
"@vitejs/plugin-react": "^
|
|
37
|
-
"rollup": "^4.
|
|
38
|
-
"rollup-plugin-dts": "^6.
|
|
39
|
-
"typescript": "^
|
|
40
|
-
"vite": "^
|
|
36
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
37
|
+
"rollup": "^4.60.3",
|
|
38
|
+
"rollup-plugin-dts": "^6.4.1",
|
|
39
|
+
"typescript": "^6.0.3",
|
|
40
|
+
"vite": "^8.0.10"
|
|
41
41
|
}
|
|
42
42
|
}
|