@commercetools-frontend/cookie-consent 1.0.3 → 1.1.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/README.md +59 -0
- package/core/dist/commercetools-frontend-cookie-consent-core.cjs.d.ts +1 -1
- package/core/dist/commercetools-frontend-cookie-consent-core.cjs.dev.js +16 -10
- package/core/dist/commercetools-frontend-cookie-consent-core.cjs.prod.js +16 -10
- package/dist/declarations/constants/links.d.ts +3 -0
- package/dist/declarations/src/{core.d.ts → core/index.d.ts} +5 -2
- package/dist/declarations/src/react/cookie-consent-banner/cookie-consent-banner.d.ts +8 -0
- package/dist/declarations/src/react/cookie-consent-banner/index.d.ts +1 -0
- package/dist/declarations/src/react/cookie-consent-banner/messages.d.ts +23 -0
- package/dist/declarations/src/react/cookie-consent-modal/cookie-consent-modal.d.ts +7 -0
- package/dist/declarations/src/react/cookie-consent-modal/cookie-details.d.ts +19 -0
- package/dist/declarations/src/react/cookie-consent-modal/index.d.ts +1 -0
- package/dist/declarations/src/react/cookie-consent-modal/messages.d.ts +173 -0
- package/dist/declarations/src/react/index.d.ts +4 -0
- package/dist/declarations/src/react/use-cookie-consent/index.d.ts +1 -0
- package/dist/declarations/src/react/use-cookie-consent/use-cookie-consent.d.ts +10 -0
- package/dist/declarations/src/react/use-skip-cookie-consent/index.d.ts +1 -0
- package/dist/declarations/src/react/use-skip-cookie-consent/use-skip-cookie-consent.d.ts +2 -0
- package/package.json +10 -5
- package/react/dist/commercetools-frontend-cookie-consent-react.cjs.d.ts +1 -1
- package/react/dist/commercetools-frontend-cookie-consent-react.cjs.dev.js +796 -15
- package/react/dist/commercetools-frontend-cookie-consent-react.cjs.prod.js +780 -15
- package/dist/declarations/src/react.d.ts +0 -6
package/README.md
CHANGED
|
@@ -71,6 +71,16 @@ import { useCookieConsent } from '@commercetools-frontend/cookie-consent/react';
|
|
|
71
71
|
const { givenConsent } = useCookieConsent('performanceCookies');
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
Note also that in certain cases (e.g. a staging environment) you may want to skip cookie consent entirely. To do so you can use the `skipConsent` option:
|
|
75
|
+
|
|
76
|
+
```js
|
|
77
|
+
const { givenConsent } = useCookieConsent('performanceCookies', {
|
|
78
|
+
skipConsent: true,
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The preferred value of `skipConsent` can be determined for instance by an environment variable and read using the `useSkipCookieConsent` hook.
|
|
83
|
+
|
|
74
84
|
The resulting `givenConsent` value is a boolean which can be passed to any software needing consent for instance FullStory or Intercom. A combination of `@commercetools-frontend/cookie-consent` and `@commercetools-frontend/fullstory` could look like this:
|
|
75
85
|
|
|
76
86
|
```js
|
|
@@ -101,3 +111,52 @@ const { setConsent } = useCookieConsent('performanceCookies');
|
|
|
101
111
|
Update cookie consent
|
|
102
112
|
</button>;
|
|
103
113
|
```
|
|
114
|
+
|
|
115
|
+
### Showing a consent banner
|
|
116
|
+
|
|
117
|
+
You can render the `CookieConsentBanner` to show a consent banner.
|
|
118
|
+
|
|
119
|
+
```jsx
|
|
120
|
+
import { CookieConsentBanner } from '@commercetools-frontend/cookie-consent/react';
|
|
121
|
+
|
|
122
|
+
<CookieConsentBanner />;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Showing a consent modal
|
|
126
|
+
|
|
127
|
+
You can render the `CookieConsentModal` to open a consent modal. Upon interaction with the modal a cookie will be written in accordance with the consent groups selected.
|
|
128
|
+
|
|
129
|
+
```jsx
|
|
130
|
+
import { CookieConsentModal } from '@commercetools-frontend/cookie-consent/react';
|
|
131
|
+
|
|
132
|
+
<CookieConsentModal />;
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Local development strategies
|
|
136
|
+
|
|
137
|
+
Cookies are bound to a domain. In order to test this functionality when developing locally, it's important to spoof a cookie, and also ensure that the domain is localhost when using `cookie-consent` module functionality.
|
|
138
|
+
|
|
139
|
+
To spoof a cookie in your browser, open Chrome, and enter the following into the console:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
document.cookie="OptanonConsent=isGpcEnabled=0&datestamp=Wed+Mar+01+2023+11%3A38%3A38+GMT-0500+(Eastern+Standard+Time)&version=202301.2.0&isIABGlobal=false&hosts=&consentId=1623165b-6d62-4e4a-beae-71598c0756c6&interactionCount=1&landingPath=NotLandingPage&groups=C0001%3A1%2CC0002%3A0%2CC0003%3A1%2CC0004%3A1%2CC0005%3A1&geolocation=US%3BNC&AwaitingReconsent=false; domain=localhost; path=/"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
This will create a cookie with all consent values set to false, bound to localhost.
|
|
146
|
+
|
|
147
|
+
In order to set the domain to localhost when using `cookie-consent`, pass the domain in where appropriate. For example:
|
|
148
|
+
|
|
149
|
+
```js
|
|
150
|
+
setConsent(
|
|
151
|
+
{
|
|
152
|
+
essentialCookies: true,
|
|
153
|
+
performanceCookies: true,
|
|
154
|
+
functionalCookies: false,
|
|
155
|
+
socialMediaCookies: false,
|
|
156
|
+
targetingCookies: false,
|
|
157
|
+
},
|
|
158
|
+
'localhost' // <- the important part
|
|
159
|
+
);
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Remember to remove this argument before making a PR.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "../../dist/declarations/src/core";
|
|
1
|
+
export * from "../../dist/declarations/src/core/index";
|
|
@@ -64,11 +64,13 @@ var defaultConsentGroups = _Object$fromEntries__default["default"](_mapInstanceP
|
|
|
64
64
|
function getParsedConsentCookieGroups() {
|
|
65
65
|
var _context3;
|
|
66
66
|
var cookieValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getRawConsentCookie();
|
|
67
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
68
|
+
skipConsent = _ref.skipConsent;
|
|
67
69
|
var parsedConsentCookieGroups = {};
|
|
68
|
-
var encodedConsentGroupToConsentGroup = _Object$fromEntries__default["default"](_mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](COOKIE_CONSENT_GROUPS)).call(_context3, function (
|
|
69
|
-
var
|
|
70
|
-
encodedConsentGroupName =
|
|
71
|
-
decodedConsentGroupName =
|
|
70
|
+
var encodedConsentGroupToConsentGroup = _Object$fromEntries__default["default"](_mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](COOKIE_CONSENT_GROUPS)).call(_context3, function (_ref2) {
|
|
71
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
72
|
+
encodedConsentGroupName = _ref3[0],
|
|
73
|
+
decodedConsentGroupName = _ref3[1];
|
|
72
74
|
return [decodedConsentGroupName, encodedConsentGroupName];
|
|
73
75
|
}));
|
|
74
76
|
try {
|
|
@@ -80,7 +82,7 @@ function getParsedConsentCookieGroups() {
|
|
|
80
82
|
_consentGroup$split2 = _slicedToArray(_consentGroup$split, 2),
|
|
81
83
|
encodedConsentGroupName = _consentGroup$split2[0],
|
|
82
84
|
consentGroupValue = _consentGroup$split2[1];
|
|
83
|
-
return [encodedConsentGroupToConsentGroup[encodedConsentGroupName], consentGroupValue === '1'];
|
|
85
|
+
return [encodedConsentGroupToConsentGroup[encodedConsentGroupName], skipConsent === true ? true : consentGroupValue === '1'];
|
|
84
86
|
});
|
|
85
87
|
parsedConsentCookieGroups = parsedConsentCookieGroupEntries ? _Object$fromEntries__default["default"](parsedConsentCookieGroupEntries) : null;
|
|
86
88
|
} catch (error) {}
|
|
@@ -94,19 +96,23 @@ function getParsedConsentCookieGroups() {
|
|
|
94
96
|
function generateUuid(prefix) {
|
|
95
97
|
return prefix ? ((Number(prefix) ^ Math.random() * 16) >> Number(prefix) / 4).toString(16) : "".concat(1e7, "-", 1e3, "-", 4e3, "-", 8e3, "-", 1e11).replace(/[018]/g, generateUuid);
|
|
96
98
|
}
|
|
97
|
-
function
|
|
99
|
+
function generateEncodedConsentGroups(consentGroups) {
|
|
98
100
|
var _context5, _context6;
|
|
99
|
-
|
|
101
|
+
return _filterInstanceProperty__default["default"](_context5 = _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](consentGroups)).call(_context6, function (_ref4) {
|
|
100
102
|
var _context7;
|
|
101
|
-
var
|
|
102
|
-
consentGroupName =
|
|
103
|
-
consentGroupValue =
|
|
103
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
104
|
+
consentGroupName = _ref5[0],
|
|
105
|
+
consentGroupValue = _ref5[1];
|
|
104
106
|
var encodedConsentGroup = COOKIE_CONSENT_GROUPS[consentGroupName];
|
|
105
107
|
if (!encodedConsentGroup) {
|
|
106
108
|
return null;
|
|
107
109
|
}
|
|
108
110
|
return _concatInstanceProperty__default["default"](_context7 = "".concat(encodedConsentGroup, ":")).call(_context7, consentGroupValue && '1' || '0');
|
|
109
111
|
})).call(_context5, Boolean).join(',');
|
|
112
|
+
}
|
|
113
|
+
function generateConsentCookie(consentGroups) {
|
|
114
|
+
var existingConsentGroups = getParsedConsentCookieGroups();
|
|
115
|
+
var encodedConsentGroups = generateEncodedConsentGroups(_objectSpread(_objectSpread({}, existingConsentGroups), consentGroups));
|
|
110
116
|
var consentValues = {
|
|
111
117
|
isGpcEnabled: '0',
|
|
112
118
|
datestamp: new Date().toString(),
|
|
@@ -64,11 +64,13 @@ var defaultConsentGroups = _Object$fromEntries__default["default"](_mapInstanceP
|
|
|
64
64
|
function getParsedConsentCookieGroups() {
|
|
65
65
|
var _context3;
|
|
66
66
|
var cookieValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getRawConsentCookie();
|
|
67
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
68
|
+
skipConsent = _ref.skipConsent;
|
|
67
69
|
var parsedConsentCookieGroups = {};
|
|
68
|
-
var encodedConsentGroupToConsentGroup = _Object$fromEntries__default["default"](_mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](COOKIE_CONSENT_GROUPS)).call(_context3, function (
|
|
69
|
-
var
|
|
70
|
-
encodedConsentGroupName =
|
|
71
|
-
decodedConsentGroupName =
|
|
70
|
+
var encodedConsentGroupToConsentGroup = _Object$fromEntries__default["default"](_mapInstanceProperty__default["default"](_context3 = _Object$entries__default["default"](COOKIE_CONSENT_GROUPS)).call(_context3, function (_ref2) {
|
|
71
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
72
|
+
encodedConsentGroupName = _ref3[0],
|
|
73
|
+
decodedConsentGroupName = _ref3[1];
|
|
72
74
|
return [decodedConsentGroupName, encodedConsentGroupName];
|
|
73
75
|
}));
|
|
74
76
|
try {
|
|
@@ -80,7 +82,7 @@ function getParsedConsentCookieGroups() {
|
|
|
80
82
|
_consentGroup$split2 = _slicedToArray(_consentGroup$split, 2),
|
|
81
83
|
encodedConsentGroupName = _consentGroup$split2[0],
|
|
82
84
|
consentGroupValue = _consentGroup$split2[1];
|
|
83
|
-
return [encodedConsentGroupToConsentGroup[encodedConsentGroupName], consentGroupValue === '1'];
|
|
85
|
+
return [encodedConsentGroupToConsentGroup[encodedConsentGroupName], skipConsent === true ? true : consentGroupValue === '1'];
|
|
84
86
|
});
|
|
85
87
|
parsedConsentCookieGroups = parsedConsentCookieGroupEntries ? _Object$fromEntries__default["default"](parsedConsentCookieGroupEntries) : null;
|
|
86
88
|
} catch (error) {}
|
|
@@ -94,19 +96,23 @@ function getParsedConsentCookieGroups() {
|
|
|
94
96
|
function generateUuid(prefix) {
|
|
95
97
|
return prefix ? ((Number(prefix) ^ Math.random() * 16) >> Number(prefix) / 4).toString(16) : "".concat(1e7, "-", 1e3, "-", 4e3, "-", 8e3, "-", 1e11).replace(/[018]/g, generateUuid);
|
|
96
98
|
}
|
|
97
|
-
function
|
|
99
|
+
function generateEncodedConsentGroups(consentGroups) {
|
|
98
100
|
var _context5, _context6;
|
|
99
|
-
|
|
101
|
+
return _filterInstanceProperty__default["default"](_context5 = _mapInstanceProperty__default["default"](_context6 = _Object$entries__default["default"](consentGroups)).call(_context6, function (_ref4) {
|
|
100
102
|
var _context7;
|
|
101
|
-
var
|
|
102
|
-
consentGroupName =
|
|
103
|
-
consentGroupValue =
|
|
103
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
104
|
+
consentGroupName = _ref5[0],
|
|
105
|
+
consentGroupValue = _ref5[1];
|
|
104
106
|
var encodedConsentGroup = COOKIE_CONSENT_GROUPS[consentGroupName];
|
|
105
107
|
if (!encodedConsentGroup) {
|
|
106
108
|
return null;
|
|
107
109
|
}
|
|
108
110
|
return _concatInstanceProperty__default["default"](_context7 = "".concat(encodedConsentGroup, ":")).call(_context7, consentGroupValue && '1' || '0');
|
|
109
111
|
})).call(_context5, Boolean).join(',');
|
|
112
|
+
}
|
|
113
|
+
function generateConsentCookie(consentGroups) {
|
|
114
|
+
var existingConsentGroups = getParsedConsentCookieGroups();
|
|
115
|
+
var encodedConsentGroups = generateEncodedConsentGroups(_objectSpread(_objectSpread({}, existingConsentGroups), consentGroups));
|
|
110
116
|
var consentValues = {
|
|
111
117
|
isGpcEnabled: '0',
|
|
112
118
|
datestamp: new Date().toString(),
|
|
@@ -7,12 +7,15 @@ declare const COOKIE_CONSENT_GROUPS: {
|
|
|
7
7
|
};
|
|
8
8
|
type TConsentGroupNames = keyof typeof COOKIE_CONSENT_GROUPS;
|
|
9
9
|
declare function getRawConsentCookie(name?: string): string | undefined;
|
|
10
|
-
|
|
10
|
+
type TGetParsedConsentCookieGroupsOptions = {
|
|
11
|
+
skipConsent?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare function getParsedConsentCookieGroups(cookieValue?: string | undefined, { skipConsent }?: TGetParsedConsentCookieGroupsOptions): {
|
|
11
14
|
essentialCookies: boolean;
|
|
12
15
|
performanceCookies: boolean;
|
|
13
16
|
functionalCookies: boolean;
|
|
14
17
|
targetingCookies: boolean;
|
|
15
18
|
socialMediaCookies: boolean;
|
|
16
19
|
};
|
|
17
|
-
declare function setConsentCookie(consentGroups: Record<TConsentGroupNames, boolean
|
|
20
|
+
declare function setConsentCookie(consentGroups: Partial<Record<TConsentGroupNames, boolean>>, domain?: string): void;
|
|
18
21
|
export { getRawConsentCookie, getParsedConsentCookieGroups, setConsentCookie, COOKIE_CONSENT_GROUPS, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CookieConsentBanner } from './cookie-consent-banner';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
bannerMessage: {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
privacyPolicyLink: {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
};
|
|
12
|
+
bannerCookiesModalLink: {
|
|
13
|
+
id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
defaultMessage: string;
|
|
16
|
+
};
|
|
17
|
+
buttonLabel: {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type ModalStateProps = {
|
|
2
|
+
isModalOpen: boolean;
|
|
3
|
+
closeModal: () => void;
|
|
4
|
+
setBannerClosed: (boolean: boolean) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const CookieConsentModal: (modalProps: ModalStateProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default CookieConsentModal;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IntlShape } from 'react-intl';
|
|
2
|
+
type Detail = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
type Link = Detail & {
|
|
7
|
+
to: string;
|
|
8
|
+
};
|
|
9
|
+
export type CookieDetails = {
|
|
10
|
+
name: Link;
|
|
11
|
+
host: Detail;
|
|
12
|
+
duration: Detail;
|
|
13
|
+
type: Detail;
|
|
14
|
+
category: Detail;
|
|
15
|
+
description: Detail;
|
|
16
|
+
};
|
|
17
|
+
export declare const createEssentialCookieDetails: (intl: IntlShape) => Array<CookieDetails>;
|
|
18
|
+
export declare const createPerformanceCookieDetails: (intl: IntlShape) => Array<CookieDetails>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CookieConsentModal } from './cookie-consent-modal';
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export declare const modalMessages: {
|
|
2
|
+
title: {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
primaryButtonLabel: {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
defaultMessage: string;
|
|
11
|
+
};
|
|
12
|
+
secondaryButtonLabel: {
|
|
13
|
+
id: string;
|
|
14
|
+
description: string;
|
|
15
|
+
defaultMessage: string;
|
|
16
|
+
};
|
|
17
|
+
mainDescription: {
|
|
18
|
+
id: string;
|
|
19
|
+
description: string;
|
|
20
|
+
defaultMessage: string;
|
|
21
|
+
};
|
|
22
|
+
privacyPolicyLink: {
|
|
23
|
+
id: string;
|
|
24
|
+
description: string;
|
|
25
|
+
defaultMessage: string;
|
|
26
|
+
};
|
|
27
|
+
necessaryCookiesHeader: {
|
|
28
|
+
id: string;
|
|
29
|
+
description: string;
|
|
30
|
+
defaultMessage: string;
|
|
31
|
+
};
|
|
32
|
+
necessaryCookiesDescription: {
|
|
33
|
+
id: string;
|
|
34
|
+
description: string;
|
|
35
|
+
defaultMessage: string;
|
|
36
|
+
};
|
|
37
|
+
necessaryCookiesHeaderState: {
|
|
38
|
+
id: string;
|
|
39
|
+
description: string;
|
|
40
|
+
defaultMessage: string;
|
|
41
|
+
};
|
|
42
|
+
performanceCookiesHeader: {
|
|
43
|
+
id: string;
|
|
44
|
+
description: string;
|
|
45
|
+
defaultMessage: string;
|
|
46
|
+
};
|
|
47
|
+
performanceCookiesDescription: {
|
|
48
|
+
id: string;
|
|
49
|
+
description: string;
|
|
50
|
+
defaultMessage: string;
|
|
51
|
+
};
|
|
52
|
+
cookieInformationLink: {
|
|
53
|
+
id: string;
|
|
54
|
+
description: string;
|
|
55
|
+
defaultMessage: string;
|
|
56
|
+
};
|
|
57
|
+
navigateBackLink: {
|
|
58
|
+
id: string;
|
|
59
|
+
description: string;
|
|
60
|
+
defaultMessage: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export declare const cookieDetailLabels: {
|
|
64
|
+
nameLabel: {
|
|
65
|
+
id: string;
|
|
66
|
+
description: string;
|
|
67
|
+
defaultMessage: string;
|
|
68
|
+
};
|
|
69
|
+
hostLabel: {
|
|
70
|
+
id: string;
|
|
71
|
+
description: string;
|
|
72
|
+
defaultMessage: string;
|
|
73
|
+
};
|
|
74
|
+
durationLabel: {
|
|
75
|
+
id: string;
|
|
76
|
+
description: string;
|
|
77
|
+
defaultMessage: string;
|
|
78
|
+
};
|
|
79
|
+
typeLabel: {
|
|
80
|
+
id: string;
|
|
81
|
+
description: string;
|
|
82
|
+
defaultMessage: string;
|
|
83
|
+
};
|
|
84
|
+
categoryLabel: {
|
|
85
|
+
id: string;
|
|
86
|
+
description: string;
|
|
87
|
+
defaultMessage: string;
|
|
88
|
+
};
|
|
89
|
+
descriptionLabel: {
|
|
90
|
+
id: string;
|
|
91
|
+
description: string;
|
|
92
|
+
defaultMessage: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export declare const cookieDetailValues: {
|
|
96
|
+
duration9Months: {
|
|
97
|
+
id: string;
|
|
98
|
+
description: string;
|
|
99
|
+
defaultMessage: string;
|
|
100
|
+
};
|
|
101
|
+
duration1Week: {
|
|
102
|
+
id: string;
|
|
103
|
+
description: string;
|
|
104
|
+
defaultMessage: string;
|
|
105
|
+
};
|
|
106
|
+
durationSession: {
|
|
107
|
+
id: string;
|
|
108
|
+
description: string;
|
|
109
|
+
defaultMessage: string;
|
|
110
|
+
};
|
|
111
|
+
duration1Year: {
|
|
112
|
+
id: string;
|
|
113
|
+
description: string;
|
|
114
|
+
defaultMessage: string;
|
|
115
|
+
};
|
|
116
|
+
duration1Day: {
|
|
117
|
+
id: string;
|
|
118
|
+
description: string;
|
|
119
|
+
defaultMessage: string;
|
|
120
|
+
};
|
|
121
|
+
typeFirstParty: {
|
|
122
|
+
id: string;
|
|
123
|
+
description: string;
|
|
124
|
+
defaultMessage: string;
|
|
125
|
+
};
|
|
126
|
+
categoryStrictlyNecessary: {
|
|
127
|
+
id: string;
|
|
128
|
+
description: string;
|
|
129
|
+
defaultMessage: string;
|
|
130
|
+
};
|
|
131
|
+
categoryPerformance: {
|
|
132
|
+
id: string;
|
|
133
|
+
description: string;
|
|
134
|
+
defaultMessage: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export declare const cookieDetailDescriptions: {
|
|
138
|
+
essentialCookieDescription1: {
|
|
139
|
+
id: string;
|
|
140
|
+
description: string;
|
|
141
|
+
defaultMessage: string;
|
|
142
|
+
};
|
|
143
|
+
essentialCookieDescription2: {
|
|
144
|
+
id: string;
|
|
145
|
+
description: string;
|
|
146
|
+
defaultMessage: string;
|
|
147
|
+
};
|
|
148
|
+
essentialCookieDescription3: {
|
|
149
|
+
id: string;
|
|
150
|
+
description: string;
|
|
151
|
+
defaultMessage: string;
|
|
152
|
+
};
|
|
153
|
+
performanceCookieDescription1: {
|
|
154
|
+
id: string;
|
|
155
|
+
description: string;
|
|
156
|
+
defaultMessage: string;
|
|
157
|
+
};
|
|
158
|
+
performanceCookieDescription2: {
|
|
159
|
+
id: string;
|
|
160
|
+
description: string;
|
|
161
|
+
defaultMessage: string;
|
|
162
|
+
};
|
|
163
|
+
performanceCookieDescription3: {
|
|
164
|
+
id: string;
|
|
165
|
+
description: string;
|
|
166
|
+
defaultMessage: string;
|
|
167
|
+
};
|
|
168
|
+
performanceCookieDescription4: {
|
|
169
|
+
id: string;
|
|
170
|
+
description: string;
|
|
171
|
+
defaultMessage: string;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useCookieConsent } from './use-cookie-consent';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { setConsentCookie, COOKIE_CONSENT_GROUPS } from '../../core';
|
|
2
|
+
type TConsentOptions = {
|
|
3
|
+
skipConsent?: boolean;
|
|
4
|
+
cookieName?: string;
|
|
5
|
+
};
|
|
6
|
+
declare function useCookieConsent(consentGroup: keyof typeof COOKIE_CONSENT_GROUPS, { skipConsent, cookieName }?: TConsentOptions): {
|
|
7
|
+
givenConsent: boolean;
|
|
8
|
+
setConsent: typeof setConsentCookie;
|
|
9
|
+
};
|
|
10
|
+
export { useCookieConsent };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSkipCookieConsent } from './use-skip-cookie-consent';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-frontend/cookie-consent",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A package integrating with OneTrust cookie consent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/commercetools-frontend-cookie-consent.cjs.js",
|
|
@@ -18,23 +18,28 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.21.0",
|
|
21
|
-
"@babel/runtime-corejs3": "^7.21.0"
|
|
21
|
+
"@babel/runtime-corejs3": "^7.21.0",
|
|
22
|
+
"@emotion/react": "^11.10.6"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/node": "18.14.6",
|
|
25
26
|
"typescript": "4.9.5"
|
|
26
27
|
},
|
|
27
28
|
"peerDependencies": {
|
|
29
|
+
"@commercetools-frontend/application-components": "21.x",
|
|
28
30
|
"@commercetools-frontend/application-shell": "21.x",
|
|
29
|
-
"
|
|
31
|
+
"@commercetools-frontend/application-shell-connectors": "21.x",
|
|
32
|
+
"@commercetools-frontend/ui-kit": "15.x",
|
|
33
|
+
"react": "17.x",
|
|
34
|
+
"react-intl": "5.x"
|
|
30
35
|
},
|
|
31
36
|
"publishConfig": {
|
|
32
37
|
"access": "public"
|
|
33
38
|
},
|
|
34
39
|
"preconstruct": {
|
|
35
40
|
"entrypoints": [
|
|
36
|
-
"./core.ts",
|
|
37
|
-
"./react.ts"
|
|
41
|
+
"./core/index.ts",
|
|
42
|
+
"./react/index.ts"
|
|
38
43
|
]
|
|
39
44
|
}
|
|
40
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "../../dist/declarations/src/react";
|
|
1
|
+
export * from "../../dist/declarations/src/react/index";
|