@propellerads/cookie-message 2.2.1 → 2.4.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/CHANGELOG.md +6 -0
- package/dist/cookie-message.cjs.development.js.map +1 -1
- package/dist/cookie-message.cjs.production.min.js.map +1 -1
- package/dist/cookie-message.esm.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +10 -11
- package/src/index.tsx +36 -36
- package/src/style.tsx +8 -8
- package/src/types.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-message.cjs.development.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from
|
|
1
|
+
{"version":3,"file":"cookie-message.cjs.development.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom'\n}\n\nexport interface CookieMessageProps {\n children: React.ReactChildren | string | React.ComponentElement<any, any>\n title?: React.ReactChildren | string | React.ComponentElement<any, any>\n cookieKey?: string\n position?: POSITION\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {\n white,\n borderRadius,\n baseShadow,\n spacing,\n} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION\n}\n\nconst StyledCookieCard = styled.div`\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 ${(props: StyledCookieCardProps) => (props.position === POSITION.RIGHT_BOTTOM && css`\n right: ${spacing * 5}px;\n `)};\n\n ${(props: StyledCookieCardProps) => (props.position === POSITION.LEFT_BOTTOM && css`\n left: ${spacing * 5}px;\n `)};\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`;\n\nexport {\n StyledCookieCard,\n CookieInfo,\n CookieTitle,\n CookieAction,\n};\n","import React, {useState} from 'react';\nimport Button, {BUTTON_TYPE} from '@propellerads/button';\n\nimport {CookieMessageProps, POSITION} from './types';\nimport {\n StyledCookieCard,\n CookieAction,\n CookieInfo,\n CookieTitle,\n} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = POSITION.LEFT_BOTTOM,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState<boolean>(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n return isShow ? (\n <StyledCookieCard position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>\n {children}\n </CookieInfo>\n\n <CookieAction>\n <Button\n elementId=\"cookie-consent\"\n type={BUTTON_TYPE.PRIMARY}\n onClick={handleClick}\n >\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n ) : null;\n};\n\nexport {CookieMessage};\n"],"names":["POSITION","StyledCookieCard","styled","div","borderRadius","white","baseShadow","spacing","props","position","RIGHT_BOTTOM","css","LEFT_BOTTOM","CookieInfo","CookieTitle","CookieAction","DEFAULT_COOKIE_KEY","CookieMessage","title","children","cookieKey","useState","window","localStorage","getItem","isShow","setShow","handleClick","setItem","React","Button","elementId","type","BUTTON_TYPE","PRIMARY","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAYA,QAAZ;;AAAA,WAAYA;AACRA,EAAAA,uBAAA,gBAAA;AACAA,EAAAA,wBAAA,iBAAA;AACH,CAHD,EAAYA,QAAQ,KAARA,QAAQ,KAAA,CAApB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,IAAAA,QAAQ,EAAEA;GAA5B,EACEoB,4BAAA,CAACf,WAAD,MAAA,EACEe,4BAAA,IAAA,MAAA,EAAIX,KAAJ,CADF,CADF,EAKEW,4BAAA,CAAChB,UAAD,MAAA,EACGM,QADH,CALF,EASEU,4BAAA,CAACd,YAAD,MAAA,EACEc,4BAAA,CAACC,eAAD;AACEC,IAAAA,SAAS,EAAC;AACVC,IAAAA,IAAI,EAAEC,kBAAW,CAACC;AAClBC,IAAAA,OAAO,EAAER;GAHX,UAAA,CADF,CATF,CADW,GAoBT,IApBJ;AAqBD,CAlCD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-message.cjs.production.min.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from
|
|
1
|
+
{"version":3,"file":"cookie-message.cjs.production.min.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom'\n}\n\nexport interface CookieMessageProps {\n children: React.ReactChildren | string | React.ComponentElement<any, any>\n title?: React.ReactChildren | string | React.ComponentElement<any, any>\n cookieKey?: string\n position?: POSITION\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {\n white,\n borderRadius,\n baseShadow,\n spacing,\n} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION\n}\n\nconst StyledCookieCard = styled.div`\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 ${(props: StyledCookieCardProps) => (props.position === POSITION.RIGHT_BOTTOM && css`\n right: ${spacing * 5}px;\n `)};\n\n ${(props: StyledCookieCardProps) => (props.position === POSITION.LEFT_BOTTOM && css`\n left: ${spacing * 5}px;\n `)};\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`;\n\nexport {\n StyledCookieCard,\n CookieInfo,\n CookieTitle,\n CookieAction,\n};\n","import React, {useState} from 'react';\nimport Button, {BUTTON_TYPE} from '@propellerads/button';\n\nimport {CookieMessageProps, POSITION} from './types';\nimport {\n StyledCookieCard,\n CookieAction,\n CookieInfo,\n CookieTitle,\n} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = POSITION.LEFT_BOTTOM,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState<boolean>(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n return isShow ? (\n <StyledCookieCard position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>\n {children}\n </CookieInfo>\n\n <CookieAction>\n <Button\n elementId=\"cookie-consent\"\n type={BUTTON_TYPE.PRIMARY}\n onClick={handleClick}\n >\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n ) : null;\n};\n\nexport {CookieMessage};\n"],"names":["POSITION","StyledCookieCard","styled","div","borderRadius","white","baseShadow","spacing","props","position","RIGHT_BOTTOM","css","LEFT_BOTTOM","CookieInfo","CookieTitle","CookieAction","title","children","cookieKey","useState","window","localStorage","getItem","setShow","React","Button","elementId","type","BUTTON_TYPE","PRIMARY","onClick","setItem"],"mappings":"8IAEYA,80BAAZ,SAAYA,GACRA,4BACAA,8BAFJ,CAAYA,IAAAA,WCWNC,EAAmBC,EAAOC,QAEbC,eACGC,QACNC,aAGM,EAAVC,UACW,EAAVA,WAET,SAACC,UAAkCA,EAAMC,WAAaT,EAASU,cAAgBC,UAC5D,EAAVJ,cAGT,SAACC,UAAkCA,EAAMC,WAAaT,EAASY,aAAeD,UAC5D,EAAVJ,cAINM,EAAaX,EAAOC,QACK,EAAVI,WAEfO,EAAcZ,EAAOC,QACI,EAAVI,WAGfQ,EAAeb,EAAOC,+BC1BN,oBACpBa,MAAAA,aAAQ,YACRC,IAAAA,aACAR,SAAAA,aAAWT,EAASY,kBACpBM,UAAAA,aANyB,2BAQCC,YAAmBC,OAAOC,aAAaC,QAAQJ,IAA1DK,mBAQbC,gBAACvB,GAAiBQ,SAAUA,GAC1Be,gBAACV,OACCU,yBAAIR,IAGNQ,gBAACX,OACEI,GAGHO,gBAACT,OACCS,gBAACC,GACCC,UAAU,iBACVC,KAAMC,cAAYC,QAClBC,QAnBY,WAClBV,OAAOC,aAAaU,QAAQb,EAAW,QACvCK,GAAQ,iBAuBN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-message.esm.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from
|
|
1
|
+
{"version":3,"file":"cookie-message.esm.js","sources":["../src/types.tsx","../src/style.tsx","../src/index.tsx"],"sourcesContent":["import React from 'react';\n\nexport enum POSITION {\n LEFT_BOTTOM = 'left_bottom',\n RIGHT_BOTTOM = 'right_bottom'\n}\n\nexport interface CookieMessageProps {\n children: React.ReactChildren | string | React.ComponentElement<any, any>\n title?: React.ReactChildren | string | React.ComponentElement<any, any>\n cookieKey?: string\n position?: POSITION\n}\n\nexport class CookieMessage extends React.Component<CookieMessageProps> {}\n","import styled, {css} from 'styled-components';\nimport {\n white,\n borderRadius,\n baseShadow,\n spacing,\n} from '@propellerads/stylevariables';\nimport {POSITION} from './types';\n\ninterface StyledCookieCardProps {\n position: POSITION\n}\n\nconst StyledCookieCard = styled.div`\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 ${(props: StyledCookieCardProps) => (props.position === POSITION.RIGHT_BOTTOM && css`\n right: ${spacing * 5}px;\n `)};\n\n ${(props: StyledCookieCardProps) => (props.position === POSITION.LEFT_BOTTOM && css`\n left: ${spacing * 5}px;\n `)};\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`;\n\nexport {\n StyledCookieCard,\n CookieInfo,\n CookieTitle,\n CookieAction,\n};\n","import React, {useState} from 'react';\nimport Button, {BUTTON_TYPE} from '@propellerads/button';\n\nimport {CookieMessageProps, POSITION} from './types';\nimport {\n StyledCookieCard,\n CookieAction,\n CookieInfo,\n CookieTitle,\n} from './style';\n\nconst DEFAULT_COOKIE_KEY = 'accept_cookie_policy';\n\nconst CookieMessage = ({\n title = 'Cookies',\n children,\n position = POSITION.LEFT_BOTTOM,\n cookieKey = DEFAULT_COOKIE_KEY,\n}: CookieMessageProps) => {\n const [isShow, setShow] = useState<boolean>(!window.localStorage.getItem(cookieKey));\n\n const handleClick = () => {\n window.localStorage.setItem(cookieKey, 'true');\n setShow(false);\n };\n\n return isShow ? (\n <StyledCookieCard position={position}>\n <CookieTitle>\n <b>{title}</b>\n </CookieTitle>\n\n <CookieInfo>\n {children}\n </CookieInfo>\n\n <CookieAction>\n <Button\n elementId=\"cookie-consent\"\n type={BUTTON_TYPE.PRIMARY}\n onClick={handleClick}\n >\n Got it\n </Button>\n </CookieAction>\n </StyledCookieCard>\n ) : null;\n};\n\nexport {CookieMessage};\n"],"names":["POSITION","StyledCookieCard","styled","div","borderRadius","white","baseShadow","spacing","props","position","RIGHT_BOTTOM","css","LEFT_BOTTOM","CookieInfo","CookieTitle","CookieAction","DEFAULT_COOKIE_KEY","CookieMessage","title","children","cookieKey","useState","window","localStorage","getItem","isShow","setShow","handleClick","setItem","React","Button","elementId","type","BUTTON_TYPE","PRIMAR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AACC,YAAP,CAAoBK,OAApB,CAA4BR,SAA5B,EAAuC,MAAvC;AACAM,IAAAA,OAAO,CAAC,KAAD,CAAP;AACD,GAHD;;AAKA,SAAOD,MAAM,GACXI,mBAAA,CAAC5B,gBAAD;AAAkBQ,IAAAA,QAAQ,EAAEA;GAA5B,EACEoB,mBAAA,CAACf,WAAD,MAAA,EACEe,mBAAA,IAAA,MAAA,EAAIX,KAAJ,CADF,CADF,EAKEW,mBAAA,CAAChB,UAAD,MAAA,EACGM,QADH,CALF,EASEU,mBAAA,CAACd,YAAD,MAAA,EACEc,mBAAA,CAACC,MAAD;AACEC,IAAAA,SAAS,EAAC;AACVC,IAAAA,IAAI,EAAEC,WAAW,CAACC;AAClBC,IAAAA,OAAO,EAAER;GAHX,UAAA,CADF,CATF,CADW,GAoBT,IApBJ;AAqBD,CAlCD;;;;"}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@propellerads/cookie-message",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"repository": "https://github.com/propellerads/ui-components",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,23 +20,22 @@
|
|
|
20
20
|
"build": "tsdx build"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"react": "
|
|
23
|
+
"@types/react": "^17.0.2",
|
|
24
|
+
"@types/react-dom": "^17.0.2",
|
|
25
|
+
"@types/styled-components": "5.1.1",
|
|
26
|
+
"react": "^17.0.2",
|
|
27
|
+
"react-dom": "^17.0.2",
|
|
28
|
+
"styled-components": "5.1.1"
|
|
24
29
|
},
|
|
25
30
|
"module": "dist/cookie-message.esm.js",
|
|
26
31
|
"devDependencies": {
|
|
27
|
-
"@types/react": "^16.9.49",
|
|
28
|
-
"@types/react-dom": "^16.9.8",
|
|
29
|
-
"@types/styled-components": "^5.1.3",
|
|
30
|
-
"react": "^16.13.1",
|
|
31
|
-
"react-dom": "^16.13.1",
|
|
32
32
|
"tsdx": "^0.13.3",
|
|
33
33
|
"tslib": "^2.0.1",
|
|
34
34
|
"typescript": "^4.0.2"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@propellerads/button": "^5.2.
|
|
38
|
-
"@propellerads/stylevariables": "^1.3.
|
|
39
|
-
"styled-components": "^5.2.0"
|
|
37
|
+
"@propellerads/button": "^5.2.1",
|
|
38
|
+
"@propellerads/stylevariables": "^1.3.1"
|
|
40
39
|
},
|
|
41
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "82824622b4ac991d78567c473a46b5044cd72035"
|
|
42
41
|
}
|
package/src/index.tsx
CHANGED
|
@@ -3,48 +3,48 @@ import Button, {BUTTON_TYPE} from '@propellerads/button';
|
|
|
3
3
|
|
|
4
4
|
import {CookieMessageProps, POSITION} from './types';
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
StyledCookieCard,
|
|
7
|
+
CookieAction,
|
|
8
|
+
CookieInfo,
|
|
9
|
+
CookieTitle,
|
|
10
10
|
} from './style';
|
|
11
11
|
|
|
12
12
|
const DEFAULT_COOKIE_KEY = 'accept_cookie_policy';
|
|
13
13
|
|
|
14
14
|
const CookieMessage = ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
title = 'Cookies',
|
|
16
|
+
children,
|
|
17
|
+
position = POSITION.LEFT_BOTTOM,
|
|
18
|
+
cookieKey = DEFAULT_COOKIE_KEY,
|
|
19
19
|
}: CookieMessageProps) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
20
|
+
const [isShow, setShow] = useState<boolean>(!window.localStorage.getItem(cookieKey));
|
|
21
|
+
|
|
22
|
+
const handleClick = () => {
|
|
23
|
+
window.localStorage.setItem(cookieKey, 'true');
|
|
24
|
+
setShow(false);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return isShow ? (
|
|
28
|
+
<StyledCookieCard position={position}>
|
|
29
|
+
<CookieTitle>
|
|
30
|
+
<b>{title}</b>
|
|
31
|
+
</CookieTitle>
|
|
32
|
+
|
|
33
|
+
<CookieInfo>
|
|
34
|
+
{children}
|
|
35
|
+
</CookieInfo>
|
|
36
|
+
|
|
37
|
+
<CookieAction>
|
|
38
|
+
<Button
|
|
39
|
+
elementId="cookie-consent"
|
|
40
|
+
type={BUTTON_TYPE.PRIMARY}
|
|
41
|
+
onClick={handleClick}
|
|
42
|
+
>
|
|
43
|
+
Got it
|
|
44
|
+
</Button>
|
|
45
|
+
</CookieAction>
|
|
46
|
+
</StyledCookieCard>
|
|
47
|
+
) : null;
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
export {CookieMessage};
|
package/src/style.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import styled, {css} from 'styled-components';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
white,
|
|
4
|
+
borderRadius,
|
|
5
|
+
baseShadow,
|
|
6
|
+
spacing,
|
|
7
7
|
} from '@propellerads/stylevariables';
|
|
8
8
|
import {POSITION} from './types';
|
|
9
9
|
|
|
@@ -41,8 +41,8 @@ const CookieAction = styled.div`
|
|
|
41
41
|
`;
|
|
42
42
|
|
|
43
43
|
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
StyledCookieCard,
|
|
45
|
+
CookieInfo,
|
|
46
|
+
CookieTitle,
|
|
47
|
+
CookieAction,
|
|
48
48
|
};
|
package/src/types.tsx
CHANGED