@commercetools-frontend/cookie-consent 0.0.0-FEC-212-react19-20250122084835
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/LICENSE +21 -0
- package/README.md +143 -0
- package/core/dist/commercetools-frontend-cookie-consent-core.cjs.d.ts +2 -0
- package/core/dist/commercetools-frontend-cookie-consent-core.cjs.dev.js +190 -0
- package/core/dist/commercetools-frontend-cookie-consent-core.cjs.js +7 -0
- package/core/dist/commercetools-frontend-cookie-consent-core.cjs.prod.js +190 -0
- package/core/dist/commercetools-frontend-cookie-consent-core.esm.js +164 -0
- package/core/package.json +4 -0
- package/dist/declarations/src/core/index.d.ts +35 -0
- 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-modal/cookie-consent-modal.d.ts +7 -0
- package/dist/declarations/src/react/cookie-consent-modal/index.d.ts +1 -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 +67 -0
- package/react/dist/commercetools-frontend-cookie-consent-react.cjs.d.ts +2 -0
- package/react/dist/commercetools-frontend-cookie-consent-react.cjs.dev.js +818 -0
- package/react/dist/commercetools-frontend-cookie-consent-react.cjs.js +7 -0
- package/react/dist/commercetools-frontend-cookie-consent-react.cjs.prod.js +796 -0
- package/react/dist/commercetools-frontend-cookie-consent-react.esm.js +791 -0
- package/react/package.json +4 -0
|
@@ -0,0 +1,796 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var core_dist_commercetoolsFrontendCookieConsentCore = require('../../core/dist/commercetools-frontend-cookie-consent-core.cjs.prod.js');
|
|
7
|
+
var applicationShellConnectors = require('@commercetools-frontend/application-shell-connectors');
|
|
8
|
+
var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
|
|
9
|
+
var _Object$getOwnPropertySymbols = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
|
|
10
|
+
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/filter');
|
|
11
|
+
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
|
|
12
|
+
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
|
|
13
|
+
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
14
|
+
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
15
|
+
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
16
|
+
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
17
|
+
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
18
|
+
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
19
|
+
var _Object$values = require('@babel/runtime-corejs3/core-js-stable/object/values');
|
|
20
|
+
var CollapsiblePanel = require('@commercetools-uikit/collapsible-panel');
|
|
21
|
+
var designSystem = require('@commercetools-uikit/design-system');
|
|
22
|
+
var Grid = require('@commercetools-uikit/grid');
|
|
23
|
+
var Link = require('@commercetools-uikit/link');
|
|
24
|
+
var Spacings = require('@commercetools-uikit/spacings');
|
|
25
|
+
var Text = require('@commercetools-uikit/text');
|
|
26
|
+
var ToggleInput = require('@commercetools-uikit/toggle-input');
|
|
27
|
+
var react$1 = require('@emotion/react');
|
|
28
|
+
var reactIntl = require('react-intl');
|
|
29
|
+
var applicationComponents = require('@commercetools-frontend/application-components');
|
|
30
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
31
|
+
var PrimaryButton = require('@commercetools-uikit/primary-button');
|
|
32
|
+
require('@babel/runtime-corejs3/core-js-stable/instance/find');
|
|
33
|
+
require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
|
|
34
|
+
require('@babel/runtime-corejs3/core-js-stable/object/entries');
|
|
35
|
+
require('@babel/runtime-corejs3/core-js-stable/url-search-params');
|
|
36
|
+
|
|
37
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
38
|
+
|
|
39
|
+
var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
|
|
40
|
+
var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
|
|
41
|
+
var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
|
|
42
|
+
var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
|
|
43
|
+
var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
|
|
44
|
+
var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
|
|
45
|
+
var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
|
|
46
|
+
var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
|
|
47
|
+
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
48
|
+
var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
|
|
49
|
+
var CollapsiblePanel__default = /*#__PURE__*/_interopDefault(CollapsiblePanel);
|
|
50
|
+
var Grid__default = /*#__PURE__*/_interopDefault(Grid);
|
|
51
|
+
var Link__default = /*#__PURE__*/_interopDefault(Link);
|
|
52
|
+
var Spacings__default = /*#__PURE__*/_interopDefault(Spacings);
|
|
53
|
+
var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
54
|
+
var ToggleInput__default = /*#__PURE__*/_interopDefault(ToggleInput);
|
|
55
|
+
var PrimaryButton__default = /*#__PURE__*/_interopDefault(PrimaryButton);
|
|
56
|
+
|
|
57
|
+
const defaultConsentOptions = {
|
|
58
|
+
skipConsent: false,
|
|
59
|
+
cookieName: 'OptanonConsent'
|
|
60
|
+
};
|
|
61
|
+
function useCookieConsent(consentGroup) {
|
|
62
|
+
let _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConsentOptions,
|
|
63
|
+
skipConsent = _ref.skipConsent,
|
|
64
|
+
cookieName = _ref.cookieName;
|
|
65
|
+
const consentCookieGroups = react.useMemo(() => {
|
|
66
|
+
const rawConsentCookie = core_dist_commercetoolsFrontendCookieConsentCore.getRawConsentCookie(cookieName);
|
|
67
|
+
const consentCookieGroups = core_dist_commercetoolsFrontendCookieConsentCore.getParsedConsentCookieGroups(rawConsentCookie, {
|
|
68
|
+
skipConsent
|
|
69
|
+
});
|
|
70
|
+
return consentCookieGroups;
|
|
71
|
+
}, [cookieName, skipConsent]);
|
|
72
|
+
return {
|
|
73
|
+
givenConsent: skipConsent || Boolean(consentCookieGroups[consentGroup]),
|
|
74
|
+
setConsent: core_dist_commercetoolsFrontendCookieConsentCore.setConsentCookie
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function useSkipCookieConsent() {
|
|
79
|
+
const skipCookieConsent = applicationShellConnectors.useApplicationContext(context => context.environment.skipCookieConsent);
|
|
80
|
+
return Boolean(skipCookieConsent);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const COOKIE_CONSENT_LINKS = {
|
|
84
|
+
PRIVACY_POLICY: 'https://commercetools.com/privacy#website',
|
|
85
|
+
USER_GUIDING_COOKIE_POLICY: 'https://userguiding.com/cookie-policy/'
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const modalMessages = reactIntl.defineMessages({
|
|
89
|
+
title: {
|
|
90
|
+
id: 'CookieConsentModal.title',
|
|
91
|
+
description: 'Confirmation dialog title',
|
|
92
|
+
defaultMessage: 'Privacy Preference Center'
|
|
93
|
+
},
|
|
94
|
+
primaryButtonLabel: {
|
|
95
|
+
id: 'CookieConsentModal.primaryButtonLabel',
|
|
96
|
+
description: 'Primary button text',
|
|
97
|
+
defaultMessage: 'Accept all cookies'
|
|
98
|
+
},
|
|
99
|
+
secondaryButtonLabel: {
|
|
100
|
+
id: 'CookieConsentModal.secondaryButtonLabel',
|
|
101
|
+
description: 'Secondary button text',
|
|
102
|
+
defaultMessage: 'Confirm my choices'
|
|
103
|
+
},
|
|
104
|
+
mainDescription: {
|
|
105
|
+
id: 'CookieConsentModal.primary.mainDescription',
|
|
106
|
+
description: 'Main body copy',
|
|
107
|
+
defaultMessage: 'When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.'
|
|
108
|
+
},
|
|
109
|
+
privacyPolicyLink: {
|
|
110
|
+
id: 'CookieConsentModal.primary.privacyPolicyLink',
|
|
111
|
+
description: 'Link to privacy policy',
|
|
112
|
+
defaultMessage: 'More information'
|
|
113
|
+
},
|
|
114
|
+
necessaryCookiesHeader: {
|
|
115
|
+
id: 'CookieConsentModal.primary.necessaryCookiesHeader',
|
|
116
|
+
description: 'Header for first collapsible content block',
|
|
117
|
+
defaultMessage: 'Strictly necessary cookies'
|
|
118
|
+
},
|
|
119
|
+
functionalCookiesHeader: {
|
|
120
|
+
id: 'CookieConsentModal.primary.functionalCookiesHeader',
|
|
121
|
+
description: 'Header for first collapsible content block',
|
|
122
|
+
defaultMessage: 'Functional cookies'
|
|
123
|
+
},
|
|
124
|
+
functionalCookiesDescription: {
|
|
125
|
+
id: 'CookieConsentModal.primary.functionalCookiesDescription',
|
|
126
|
+
description: 'Description of content from first collapsible header',
|
|
127
|
+
defaultMessage: 'These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.'
|
|
128
|
+
},
|
|
129
|
+
performanceCookiesHeader: {
|
|
130
|
+
id: 'CookieConsentModal.primary.performanceCookiesHeader',
|
|
131
|
+
description: 'Header for second collapsible content block',
|
|
132
|
+
defaultMessage: 'Performance cookies'
|
|
133
|
+
},
|
|
134
|
+
performanceCookiesDescription: {
|
|
135
|
+
id: 'CookieConsentModal.primary.performanceCookiesDescription',
|
|
136
|
+
description: 'Description of content from second collapsible header',
|
|
137
|
+
defaultMessage: 'These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.'
|
|
138
|
+
},
|
|
139
|
+
cookieInformationLink: {
|
|
140
|
+
id: 'CookieConsentModal.primary.cookieInformationLink',
|
|
141
|
+
description: 'Link to additional cookie information',
|
|
142
|
+
defaultMessage: 'Cookies details'
|
|
143
|
+
},
|
|
144
|
+
navigateBackLink: {
|
|
145
|
+
id: 'CookieConsentModal.primary.navigateBackLink',
|
|
146
|
+
description: 'Link to go back to primary view',
|
|
147
|
+
defaultMessage: 'Back to Privacy Preference Center'
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
const cookieDetailLabels = reactIntl.defineMessages({
|
|
151
|
+
nameLabel: {
|
|
152
|
+
id: 'CookieConsentModal.cookieDetails.nameLabel',
|
|
153
|
+
description: 'Name - category identifier',
|
|
154
|
+
defaultMessage: 'Name'
|
|
155
|
+
},
|
|
156
|
+
hostLabel: {
|
|
157
|
+
id: 'CookieConsentModal.cookieDetails.hostLabel',
|
|
158
|
+
description: 'Host - category identifier',
|
|
159
|
+
defaultMessage: 'Host'
|
|
160
|
+
},
|
|
161
|
+
durationLabel: {
|
|
162
|
+
id: 'CookieConsentModal.cookieDetails.durationLabel',
|
|
163
|
+
description: 'Duration - category identifier',
|
|
164
|
+
defaultMessage: 'Duration'
|
|
165
|
+
},
|
|
166
|
+
typeLabel: {
|
|
167
|
+
id: 'CookieConsentModal.cookieDetails.typeLabel',
|
|
168
|
+
description: 'Type - category identifier',
|
|
169
|
+
defaultMessage: 'Type'
|
|
170
|
+
},
|
|
171
|
+
categoryLabel: {
|
|
172
|
+
id: 'CookieConsentModal.cookieDetails.categoryLabel',
|
|
173
|
+
description: 'Category - category identifier',
|
|
174
|
+
defaultMessage: 'Category'
|
|
175
|
+
},
|
|
176
|
+
descriptionLabel: {
|
|
177
|
+
id: 'CookieConsentModal.cookieDetails.descriptionLabel',
|
|
178
|
+
description: 'Description - category identifier',
|
|
179
|
+
defaultMessage: 'Description'
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
const cookieDetailValues = reactIntl.defineMessages({
|
|
183
|
+
duration9Months: {
|
|
184
|
+
id: 'CookieConsentModal.cookieDetails.duration9Months',
|
|
185
|
+
description: 'Length of time',
|
|
186
|
+
defaultMessage: '9 Months'
|
|
187
|
+
},
|
|
188
|
+
duration1Week: {
|
|
189
|
+
id: 'CookieConsentModal.cookieDetails.duration1Week',
|
|
190
|
+
description: 'Length of time',
|
|
191
|
+
defaultMessage: '1 Week'
|
|
192
|
+
},
|
|
193
|
+
durationSession: {
|
|
194
|
+
id: 'CookieConsentModal.cookieDetails.durationSession',
|
|
195
|
+
description: 'Length of time for cookie to expire in the browser',
|
|
196
|
+
defaultMessage: 'Session'
|
|
197
|
+
},
|
|
198
|
+
duration1Year: {
|
|
199
|
+
id: 'CookieConsentModal.cookieDetails.duration1Year',
|
|
200
|
+
description: 'Length of time',
|
|
201
|
+
defaultMessage: '1 Year'
|
|
202
|
+
},
|
|
203
|
+
duration1Day: {
|
|
204
|
+
id: 'CookieConsentModal.cookieDetails.duration1Day',
|
|
205
|
+
description: 'Length of time',
|
|
206
|
+
defaultMessage: '1 Day'
|
|
207
|
+
},
|
|
208
|
+
typeFirstParty: {
|
|
209
|
+
id: 'CookieConsentModal.cookieDetails.typeFirstParty',
|
|
210
|
+
description: 'Type of cookie',
|
|
211
|
+
defaultMessage: 'First party'
|
|
212
|
+
},
|
|
213
|
+
categoryStrictlyNecessary: {
|
|
214
|
+
id: 'CookieConsentModal.cookieDetails.categoryStrictlyNecessary',
|
|
215
|
+
description: 'Type of cookie',
|
|
216
|
+
defaultMessage: 'Strictly Necessary Cookies'
|
|
217
|
+
},
|
|
218
|
+
categoryFunctional: {
|
|
219
|
+
id: 'CookieConsentModal.cookieDetails.categoryFunctional',
|
|
220
|
+
description: 'Type of cookie',
|
|
221
|
+
defaultMessage: 'Functional Cookies'
|
|
222
|
+
},
|
|
223
|
+
categoryPerformance: {
|
|
224
|
+
id: 'CookieConsentModal.cookieDetails.categoryPerformance',
|
|
225
|
+
description: 'Type of cookie',
|
|
226
|
+
defaultMessage: 'Performance Cookies'
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
const cookieDetailDescriptions = reactIntl.defineMessages({
|
|
230
|
+
functionalCookieDescription1: {
|
|
231
|
+
id: 'CookieConsentModal.cookieDetails.functionalCookieDescription1',
|
|
232
|
+
description: 'Description of cookie',
|
|
233
|
+
defaultMessage: 'Set by UserGuiding (Merchant Center). As per UserGuiding Cookie Policy: This cookie contains pages the user has seen. Its purpose is to improve the user guidance experience, like showing guides only once for each user, segmenting based on page view history, etc.'
|
|
234
|
+
},
|
|
235
|
+
performanceCookieDescription1: {
|
|
236
|
+
id: 'CookieConsentModal.cookieDetails.performanceCookieDescription1',
|
|
237
|
+
description: 'Description of cookie',
|
|
238
|
+
defaultMessage: 'Support multi-tab playback, provides a unique ID to each tab. Note that this is technically not a cookie, but a form of sessionStorage: https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage Set by FullStory within the commercetools Merchant Center.'
|
|
239
|
+
},
|
|
240
|
+
performanceCookieDescription2: {
|
|
241
|
+
id: 'CookieConsentModal.cookieDetails.performanceCookieDescription2',
|
|
242
|
+
description: 'Description of cookie',
|
|
243
|
+
defaultMessage: 'Stores the consent state for this device. For more on consent state see: https://help.fullstory.com/hc/en-us/articles/360020623254-FS-consent-Capture-elements-with-consent Set by FullStory within the commercetools Merchant Center.'
|
|
244
|
+
},
|
|
245
|
+
performanceCookieDescription3: {
|
|
246
|
+
id: 'CookieConsentModal.cookieDetails.performanceCookieDescription3',
|
|
247
|
+
description: 'Description of cookie',
|
|
248
|
+
defaultMessage: 'Captures the timestamp of the last user action. It is used to assist with the FullStory session lifecycle, ensuring user activity extends the session. See "What defines a session in FullStory?" for more info on the session lifecycle: https://help.fullstory.com/hc/en-us/articles/360020624614-What-defines-a-session-in-FullStory- Set by FullStory within the commercetools Merchant Center.'
|
|
249
|
+
},
|
|
250
|
+
performanceCookieDescription4: {
|
|
251
|
+
id: 'CookieConsentModal.cookieDetails.performanceCookieDescription4',
|
|
252
|
+
description: 'Description of cookie',
|
|
253
|
+
defaultMessage: "The 'fs_uid' cookie can be thought of as the capture cookie. When an end-user visits a customer's site, that cookie is used to track the user across sessions and pages. The same user may visit a site multiple times and may navigate to many pages within a single session. This cookie ensures that all captured session traffic is associated with one user. A session cannot be captured without this cookie and the users anonymized visit will not be logged. Set by FullStory within the commercetools Merchant Center."
|
|
254
|
+
},
|
|
255
|
+
performanceCookieDescription5: {
|
|
256
|
+
id: 'CookieConsentModal.cookieDetails.performanceCookieDescription5',
|
|
257
|
+
description: 'Description of cookie',
|
|
258
|
+
defaultMessage: "Set by UserGuiding (Merchant Center). As per UserGuiding Cookie Policy: This cookie is for storing in the current browser a long living random unique id, which is created at first load of the UserGuiding snippet. This ID is created randomly based on the timestamp of the first visit and does not relate to the user’s personal information including IP. The stated purpose of the cookie is to track UserGuiding users' monthly active user quota, storing users' usage history to UserGuiding databases, etc."
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
const HOSTNAME = 'commercetools.com';
|
|
263
|
+
const createCookieLink = cookieName => `https://cookiepedia.co.uk/cookies/${cookieName}`;
|
|
264
|
+
const createFunctionalCookieDetails = intl => [{
|
|
265
|
+
name: {
|
|
266
|
+
label: intl.formatMessage(cookieDetailLabels.nameLabel),
|
|
267
|
+
value: '__ug__',
|
|
268
|
+
to: COOKIE_CONSENT_LINKS.USER_GUIDING_COOKIE_POLICY
|
|
269
|
+
},
|
|
270
|
+
host: {
|
|
271
|
+
label: intl.formatMessage(cookieDetailLabels.hostLabel),
|
|
272
|
+
value: HOSTNAME
|
|
273
|
+
},
|
|
274
|
+
duration: {
|
|
275
|
+
label: intl.formatMessage(cookieDetailLabels.durationLabel),
|
|
276
|
+
value: intl.formatMessage(cookieDetailValues.durationSession)
|
|
277
|
+
},
|
|
278
|
+
type: {
|
|
279
|
+
label: intl.formatMessage(cookieDetailLabels.typeLabel),
|
|
280
|
+
value: intl.formatMessage(cookieDetailValues.typeFirstParty)
|
|
281
|
+
},
|
|
282
|
+
category: {
|
|
283
|
+
label: intl.formatMessage(cookieDetailLabels.categoryLabel),
|
|
284
|
+
value: intl.formatMessage(cookieDetailValues.categoryFunctional)
|
|
285
|
+
},
|
|
286
|
+
description: {
|
|
287
|
+
label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
|
|
288
|
+
value: intl.formatMessage(cookieDetailDescriptions.functionalCookieDescription1)
|
|
289
|
+
}
|
|
290
|
+
}];
|
|
291
|
+
const createPerformanceCookieDetails = intl => [{
|
|
292
|
+
name: {
|
|
293
|
+
label: intl.formatMessage(cookieDetailLabels.nameLabel),
|
|
294
|
+
value: '_fs_tab_id',
|
|
295
|
+
to: createCookieLink('_fs_tab_id')
|
|
296
|
+
},
|
|
297
|
+
host: {
|
|
298
|
+
label: intl.formatMessage(cookieDetailLabels.hostLabel),
|
|
299
|
+
value: HOSTNAME
|
|
300
|
+
},
|
|
301
|
+
duration: {
|
|
302
|
+
label: intl.formatMessage(cookieDetailLabels.durationLabel),
|
|
303
|
+
value: intl.formatMessage(cookieDetailValues.durationSession)
|
|
304
|
+
},
|
|
305
|
+
type: {
|
|
306
|
+
label: intl.formatMessage(cookieDetailLabels.typeLabel),
|
|
307
|
+
value: intl.formatMessage(cookieDetailValues.duration9Months)
|
|
308
|
+
},
|
|
309
|
+
category: {
|
|
310
|
+
label: intl.formatMessage(cookieDetailLabels.categoryLabel),
|
|
311
|
+
value: intl.formatMessage(cookieDetailValues.categoryPerformance)
|
|
312
|
+
},
|
|
313
|
+
description: {
|
|
314
|
+
label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
|
|
315
|
+
value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription1)
|
|
316
|
+
}
|
|
317
|
+
}, {
|
|
318
|
+
name: {
|
|
319
|
+
label: intl.formatMessage(cookieDetailLabels.nameLabel),
|
|
320
|
+
value: 'fs_cid',
|
|
321
|
+
to: createCookieLink('fs_cid')
|
|
322
|
+
},
|
|
323
|
+
host: {
|
|
324
|
+
label: intl.formatMessage(cookieDetailLabels.hostLabel),
|
|
325
|
+
value: HOSTNAME
|
|
326
|
+
},
|
|
327
|
+
duration: {
|
|
328
|
+
label: intl.formatMessage(cookieDetailLabels.durationLabel),
|
|
329
|
+
value: intl.formatMessage(cookieDetailValues.duration1Year)
|
|
330
|
+
},
|
|
331
|
+
type: {
|
|
332
|
+
label: intl.formatMessage(cookieDetailLabels.typeLabel),
|
|
333
|
+
value: intl.formatMessage(cookieDetailValues.typeFirstParty)
|
|
334
|
+
},
|
|
335
|
+
category: {
|
|
336
|
+
label: intl.formatMessage(cookieDetailLabels.categoryLabel),
|
|
337
|
+
value: intl.formatMessage(cookieDetailValues.categoryPerformance)
|
|
338
|
+
},
|
|
339
|
+
description: {
|
|
340
|
+
label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
|
|
341
|
+
value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription2)
|
|
342
|
+
}
|
|
343
|
+
}, {
|
|
344
|
+
name: {
|
|
345
|
+
label: intl.formatMessage(cookieDetailLabels.nameLabel),
|
|
346
|
+
value: 'fs_lua',
|
|
347
|
+
to: createCookieLink('fs_lua')
|
|
348
|
+
},
|
|
349
|
+
host: {
|
|
350
|
+
label: intl.formatMessage(cookieDetailLabels.hostLabel),
|
|
351
|
+
value: HOSTNAME
|
|
352
|
+
},
|
|
353
|
+
duration: {
|
|
354
|
+
label: intl.formatMessage(cookieDetailLabels.durationLabel),
|
|
355
|
+
value: intl.formatMessage(cookieDetailValues.duration1Day)
|
|
356
|
+
},
|
|
357
|
+
type: {
|
|
358
|
+
label: intl.formatMessage(cookieDetailLabels.typeLabel),
|
|
359
|
+
value: intl.formatMessage(cookieDetailValues.typeFirstParty)
|
|
360
|
+
},
|
|
361
|
+
category: {
|
|
362
|
+
label: intl.formatMessage(cookieDetailLabels.categoryLabel),
|
|
363
|
+
value: intl.formatMessage(cookieDetailValues.categoryPerformance)
|
|
364
|
+
},
|
|
365
|
+
description: {
|
|
366
|
+
label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
|
|
367
|
+
value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription3)
|
|
368
|
+
}
|
|
369
|
+
}, {
|
|
370
|
+
name: {
|
|
371
|
+
label: intl.formatMessage(cookieDetailLabels.nameLabel),
|
|
372
|
+
value: 'fs_uid',
|
|
373
|
+
to: createCookieLink('fs_uid')
|
|
374
|
+
},
|
|
375
|
+
host: {
|
|
376
|
+
label: intl.formatMessage(cookieDetailLabels.hostLabel),
|
|
377
|
+
value: HOSTNAME
|
|
378
|
+
},
|
|
379
|
+
duration: {
|
|
380
|
+
label: intl.formatMessage(cookieDetailLabels.durationLabel),
|
|
381
|
+
value: intl.formatMessage(cookieDetailValues.duration9Months)
|
|
382
|
+
},
|
|
383
|
+
type: {
|
|
384
|
+
label: intl.formatMessage(cookieDetailLabels.typeLabel),
|
|
385
|
+
value: intl.formatMessage(cookieDetailValues.typeFirstParty)
|
|
386
|
+
},
|
|
387
|
+
category: {
|
|
388
|
+
label: intl.formatMessage(cookieDetailLabels.categoryLabel),
|
|
389
|
+
value: intl.formatMessage(cookieDetailValues.categoryPerformance)
|
|
390
|
+
},
|
|
391
|
+
description: {
|
|
392
|
+
label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
|
|
393
|
+
value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription4)
|
|
394
|
+
}
|
|
395
|
+
}, {
|
|
396
|
+
name: {
|
|
397
|
+
label: intl.formatMessage(cookieDetailLabels.nameLabel),
|
|
398
|
+
value: '__UGS__uid',
|
|
399
|
+
to: COOKIE_CONSENT_LINKS.USER_GUIDING_COOKIE_POLICY
|
|
400
|
+
},
|
|
401
|
+
host: {
|
|
402
|
+
label: intl.formatMessage(cookieDetailLabels.hostLabel),
|
|
403
|
+
value: HOSTNAME
|
|
404
|
+
},
|
|
405
|
+
duration: {
|
|
406
|
+
label: intl.formatMessage(cookieDetailLabels.durationLabel),
|
|
407
|
+
value: intl.formatMessage(cookieDetailValues.durationSession)
|
|
408
|
+
},
|
|
409
|
+
type: {
|
|
410
|
+
label: intl.formatMessage(cookieDetailLabels.typeLabel),
|
|
411
|
+
value: intl.formatMessage(cookieDetailValues.typeFirstParty)
|
|
412
|
+
},
|
|
413
|
+
category: {
|
|
414
|
+
label: intl.formatMessage(cookieDetailLabels.categoryLabel),
|
|
415
|
+
value: intl.formatMessage(cookieDetailValues.categoryPerformance)
|
|
416
|
+
},
|
|
417
|
+
description: {
|
|
418
|
+
label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
|
|
419
|
+
value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription5)
|
|
420
|
+
}
|
|
421
|
+
}];
|
|
422
|
+
|
|
423
|
+
function ownKeys$1(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
424
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var _context2, _context3; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(t), !0)).call(_context2, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(t))).call(_context3, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
425
|
+
const View = {
|
|
426
|
+
Primary: 'Primary',
|
|
427
|
+
Secondary: 'Secondary',
|
|
428
|
+
Tertiary: 'Tertiary'
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* The design spec warranted text that _looks_ like a link, but isn't
|
|
432
|
+
*/
|
|
433
|
+
const NavigationLink = _ref4 => {
|
|
434
|
+
let onClick = _ref4.onClick,
|
|
435
|
+
label = _ref4.label;
|
|
436
|
+
return jsxRuntime.jsx(Link__default["default"], {
|
|
437
|
+
onClick: e => {
|
|
438
|
+
e.preventDefault();
|
|
439
|
+
onClick();
|
|
440
|
+
},
|
|
441
|
+
to: "",
|
|
442
|
+
children: label
|
|
443
|
+
});
|
|
444
|
+
};
|
|
445
|
+
var _ref3 = {
|
|
446
|
+
name: "1u8ems1",
|
|
447
|
+
styles: "& svg{display:none;}"
|
|
448
|
+
} ;
|
|
449
|
+
const InformationLink = _ref5 => {
|
|
450
|
+
let to = _ref5.to,
|
|
451
|
+
label = _ref5.label;
|
|
452
|
+
const removeDefaultSvg = _ref3;
|
|
453
|
+
return jsxRuntime.jsx("div", {
|
|
454
|
+
css: removeDefaultSvg,
|
|
455
|
+
children: jsxRuntime.jsx(Link__default["default"], {
|
|
456
|
+
isExternal: true,
|
|
457
|
+
to: to,
|
|
458
|
+
children: label
|
|
459
|
+
})
|
|
460
|
+
});
|
|
461
|
+
};
|
|
462
|
+
var _ref2 = {
|
|
463
|
+
name: "1u8ems1",
|
|
464
|
+
styles: "& svg{display:none;}"
|
|
465
|
+
} ;
|
|
466
|
+
const DetailLink = _ref6 => {
|
|
467
|
+
let to = _ref6.to,
|
|
468
|
+
label = _ref6.label;
|
|
469
|
+
const removeDefaultSvg = _ref2;
|
|
470
|
+
return jsxRuntime.jsx("div", {
|
|
471
|
+
css: removeDefaultSvg,
|
|
472
|
+
children: jsxRuntime.jsx(Link__default["default"], {
|
|
473
|
+
isExternal: true,
|
|
474
|
+
to: to,
|
|
475
|
+
children: jsxRuntime.jsx(Text__default["default"].Detail, {
|
|
476
|
+
tone: "primary",
|
|
477
|
+
children: label
|
|
478
|
+
})
|
|
479
|
+
})
|
|
480
|
+
});
|
|
481
|
+
};
|
|
482
|
+
var _ref$1 = {
|
|
483
|
+
name: "qzmnd2",
|
|
484
|
+
styles: "padding-right:10px"
|
|
485
|
+
} ;
|
|
486
|
+
const CookieConsentBodyPrimary = _ref7 => {
|
|
487
|
+
let togglePerformanceValue = _ref7.togglePerformanceValue,
|
|
488
|
+
toggleFunctionalValue = _ref7.toggleFunctionalValue,
|
|
489
|
+
onTogglePerformance = _ref7.onTogglePerformance,
|
|
490
|
+
onToggleFunctional = _ref7.onToggleFunctional,
|
|
491
|
+
onChangeView = _ref7.onChangeView,
|
|
492
|
+
panelState = _ref7.panelState,
|
|
493
|
+
setPanelState = _ref7.setPanelState;
|
|
494
|
+
const _useIntl = reactIntl.useIntl(),
|
|
495
|
+
formatMessage = _useIntl.formatMessage;
|
|
496
|
+
|
|
497
|
+
// The outline of the input is cut off; we shift it to the left to compensate
|
|
498
|
+
const bumpToggle = _ref$1;
|
|
499
|
+
return jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
500
|
+
scale: "xl",
|
|
501
|
+
children: [jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
502
|
+
scale: "m",
|
|
503
|
+
children: [jsxRuntime.jsx(Text__default["default"].Body, {
|
|
504
|
+
intlMessage: modalMessages.mainDescription
|
|
505
|
+
}), jsxRuntime.jsx(InformationLink, {
|
|
506
|
+
label: formatMessage(modalMessages.privacyPolicyLink),
|
|
507
|
+
to: COOKIE_CONSENT_LINKS.PRIVACY_POLICY
|
|
508
|
+
})]
|
|
509
|
+
}), jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
510
|
+
scale: "l",
|
|
511
|
+
children: [jsxRuntime.jsx(CollapsiblePanel__default["default"], {
|
|
512
|
+
condensed: true,
|
|
513
|
+
header: formatMessage(modalMessages.functionalCookiesHeader),
|
|
514
|
+
headerControls: jsxRuntime.jsx("div", {
|
|
515
|
+
css: bumpToggle,
|
|
516
|
+
children: jsxRuntime.jsx(ToggleInput__default["default"], {
|
|
517
|
+
isChecked: toggleFunctionalValue,
|
|
518
|
+
onChange: e => onToggleFunctional(e.target.checked),
|
|
519
|
+
size: "small"
|
|
520
|
+
})
|
|
521
|
+
}),
|
|
522
|
+
isClosed: panelState.functionalCookiesClosed,
|
|
523
|
+
onToggle: () => setPanelState(_objectSpread$1(_objectSpread$1({}, panelState), {}, {
|
|
524
|
+
functionalCookiesClosed: !panelState.functionalCookiesClosed
|
|
525
|
+
})),
|
|
526
|
+
theme: "light",
|
|
527
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
528
|
+
scale: "m",
|
|
529
|
+
children: [jsxRuntime.jsx(Text__default["default"].Body, {
|
|
530
|
+
intlMessage: modalMessages.functionalCookiesDescription
|
|
531
|
+
}), jsxRuntime.jsx(NavigationLink, {
|
|
532
|
+
label: formatMessage(modalMessages.cookieInformationLink),
|
|
533
|
+
onClick: () => onChangeView(View.Secondary)
|
|
534
|
+
})]
|
|
535
|
+
})
|
|
536
|
+
}), jsxRuntime.jsx(CollapsiblePanel__default["default"], {
|
|
537
|
+
condensed: true,
|
|
538
|
+
header: formatMessage(modalMessages.performanceCookiesHeader),
|
|
539
|
+
headerControls: jsxRuntime.jsx("div", {
|
|
540
|
+
css: bumpToggle,
|
|
541
|
+
children: jsxRuntime.jsx(ToggleInput__default["default"], {
|
|
542
|
+
isChecked: togglePerformanceValue,
|
|
543
|
+
onChange: e => onTogglePerformance(e.target.checked),
|
|
544
|
+
size: "small"
|
|
545
|
+
})
|
|
546
|
+
}),
|
|
547
|
+
isClosed: panelState.performanceCookiesClosed,
|
|
548
|
+
onToggle: () => setPanelState(_objectSpread$1(_objectSpread$1({}, panelState), {}, {
|
|
549
|
+
performanceCookiesClosed: !panelState.performanceCookiesClosed
|
|
550
|
+
})),
|
|
551
|
+
theme: "light",
|
|
552
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
553
|
+
scale: "m",
|
|
554
|
+
children: [jsxRuntime.jsx(Text__default["default"].Body, {
|
|
555
|
+
intlMessage: modalMessages.performanceCookiesDescription
|
|
556
|
+
}), jsxRuntime.jsx(NavigationLink, {
|
|
557
|
+
label: formatMessage(modalMessages.cookieInformationLink),
|
|
558
|
+
onClick: () => onChangeView(View.Tertiary)
|
|
559
|
+
})]
|
|
560
|
+
})
|
|
561
|
+
})]
|
|
562
|
+
})]
|
|
563
|
+
});
|
|
564
|
+
};
|
|
565
|
+
const CookieConsentBodyDetails = _ref8 => {
|
|
566
|
+
let onChangeView = _ref8.onChangeView,
|
|
567
|
+
cookieDetails = _ref8.cookieDetails;
|
|
568
|
+
const _useIntl2 = reactIntl.useIntl(),
|
|
569
|
+
formatMessage = _useIntl2.formatMessage;
|
|
570
|
+
const scrollRef = /*#__PURE__*/react.createRef();
|
|
571
|
+
react.useEffect(() => {
|
|
572
|
+
scrollRef.current?.scrollIntoView();
|
|
573
|
+
}, [scrollRef]);
|
|
574
|
+
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
575
|
+
children: [jsxRuntime.jsx("div", {
|
|
576
|
+
ref: scrollRef,
|
|
577
|
+
css: /*#__PURE__*/react$1.css("scroll-margin-top:", designSystem.designTokens.spacing40, ";" + ("" ), "" )
|
|
578
|
+
}), jsxRuntime.jsxs(Spacings__default["default"].Stack, {
|
|
579
|
+
scale: "l",
|
|
580
|
+
children: [jsxRuntime.jsx(NavigationLink, {
|
|
581
|
+
label: formatMessage(modalMessages.navigateBackLink),
|
|
582
|
+
onClick: () => onChangeView(View.Primary)
|
|
583
|
+
}), jsxRuntime.jsx(Spacings__default["default"].Stack, {
|
|
584
|
+
scale: "l",
|
|
585
|
+
children: _mapInstanceProperty__default["default"](cookieDetails).call(cookieDetails, detail => {
|
|
586
|
+
var _context;
|
|
587
|
+
return jsxRuntime.jsx(Grid__default["default"], {
|
|
588
|
+
gridGap: designSystem.designTokens.spacing40,
|
|
589
|
+
gridRowGap: "0px",
|
|
590
|
+
gridTemplateColumns: `${designSystem.designTokens.constraint2} 1fr`,
|
|
591
|
+
children: _mapInstanceProperty__default["default"](_context = _Object$values__default["default"](detail)).call(_context, value => jsxRuntime.jsxs(react.Fragment, {
|
|
592
|
+
children: [jsxRuntime.jsx(Grid__default["default"].Item, {
|
|
593
|
+
children: jsxRuntime.jsx(Text__default["default"].Detail, {
|
|
594
|
+
children: value.label
|
|
595
|
+
})
|
|
596
|
+
}), jsxRuntime.jsx(Grid__default["default"].Item, {
|
|
597
|
+
children: 'to' in value ? jsxRuntime.jsx(DetailLink, {
|
|
598
|
+
label: value.value,
|
|
599
|
+
to: value.to
|
|
600
|
+
}) : jsxRuntime.jsx(Text__default["default"].Detail, {
|
|
601
|
+
children: value.value
|
|
602
|
+
})
|
|
603
|
+
})]
|
|
604
|
+
}, value.value))
|
|
605
|
+
}, detail.name.value);
|
|
606
|
+
})
|
|
607
|
+
})]
|
|
608
|
+
})]
|
|
609
|
+
});
|
|
610
|
+
};
|
|
611
|
+
const CookieConsentModal = modalProps => {
|
|
612
|
+
const intl = reactIntl.useIntl();
|
|
613
|
+
const _useCookieConsent = useCookieConsent('performanceCookies'),
|
|
614
|
+
setConsent = _useCookieConsent.setConsent;
|
|
615
|
+
const _useState = react.useState(false),
|
|
616
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
617
|
+
enablePerformanceCookies = _useState2[0],
|
|
618
|
+
setEnablePerformanceCookies = _useState2[1];
|
|
619
|
+
const _useState3 = react.useState(false),
|
|
620
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
621
|
+
enableFunctionalCookies = _useState4[0],
|
|
622
|
+
setEnableFunctionalCookies = _useState4[1];
|
|
623
|
+
const _useState5 = react.useState(View.Primary),
|
|
624
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
625
|
+
currentView = _useState6[0],
|
|
626
|
+
setCurrentView = _useState6[1];
|
|
627
|
+
const _useState7 = react.useState({
|
|
628
|
+
functionalCookiesClosed: true,
|
|
629
|
+
performanceCookiesClosed: true
|
|
630
|
+
}),
|
|
631
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
632
|
+
panelState = _useState8[0],
|
|
633
|
+
setPanelState = _useState8[1];
|
|
634
|
+
const createConsentGroups = (functionalConsent, performanceConsent) => ({
|
|
635
|
+
functionalCookies: functionalConsent,
|
|
636
|
+
performanceCookies: performanceConsent
|
|
637
|
+
});
|
|
638
|
+
return jsxRuntime.jsxs(applicationComponents.ConfirmationDialog, {
|
|
639
|
+
isOpen: modalProps.isModalOpen,
|
|
640
|
+
labelPrimary: intl.formatMessage(modalMessages.primaryButtonLabel),
|
|
641
|
+
labelSecondary: intl.formatMessage(modalMessages.secondaryButtonLabel),
|
|
642
|
+
onCancel: () => {
|
|
643
|
+
setConsent(createConsentGroups(enableFunctionalCookies, enablePerformanceCookies));
|
|
644
|
+
modalProps.setBannerClosed(true);
|
|
645
|
+
modalProps.closeModal();
|
|
646
|
+
},
|
|
647
|
+
onClose: modalProps.closeModal,
|
|
648
|
+
onConfirm: () => {
|
|
649
|
+
setConsent(createConsentGroups(true, true));
|
|
650
|
+
modalProps.setBannerClosed(true);
|
|
651
|
+
modalProps.closeModal();
|
|
652
|
+
},
|
|
653
|
+
title: intl.formatMessage(modalMessages.title),
|
|
654
|
+
zIndex: 1000000,
|
|
655
|
+
children: [currentView === View.Primary && jsxRuntime.jsx(CookieConsentBodyPrimary, {
|
|
656
|
+
onChangeView: view => setCurrentView(view),
|
|
657
|
+
onToggleFunctional: value => setEnableFunctionalCookies(value),
|
|
658
|
+
onTogglePerformance: value => setEnablePerformanceCookies(value),
|
|
659
|
+
panelState: panelState,
|
|
660
|
+
setPanelState: state => setPanelState(state),
|
|
661
|
+
toggleFunctionalValue: enableFunctionalCookies,
|
|
662
|
+
togglePerformanceValue: enablePerformanceCookies
|
|
663
|
+
}), currentView === View.Secondary && jsxRuntime.jsx(CookieConsentBodyDetails, {
|
|
664
|
+
cookieDetails: createFunctionalCookieDetails(intl),
|
|
665
|
+
onChangeView: view => setCurrentView(view)
|
|
666
|
+
}), currentView === View.Tertiary && jsxRuntime.jsx(CookieConsentBodyDetails, {
|
|
667
|
+
cookieDetails: createPerformanceCookieDetails(intl),
|
|
668
|
+
onChangeView: view => setCurrentView(view)
|
|
669
|
+
})]
|
|
670
|
+
});
|
|
671
|
+
};
|
|
672
|
+
|
|
673
|
+
var messages = reactIntl.defineMessages({
|
|
674
|
+
bannerMessage: {
|
|
675
|
+
id: 'CookieConsentBanner.bannerMessage',
|
|
676
|
+
description: 'Text of the cookie consent banner.',
|
|
677
|
+
defaultMessage: 'This site uses cookies. See our {privacyLink} or manage your {modalLink} here.'
|
|
678
|
+
},
|
|
679
|
+
privacyPolicyLink: {
|
|
680
|
+
id: 'CookieConsentBanner.privacyPolicyLink',
|
|
681
|
+
description: 'Privacy policy link text in the cookie consent banner.',
|
|
682
|
+
defaultMessage: 'privacy policy'
|
|
683
|
+
},
|
|
684
|
+
bannerCookiesModalLink: {
|
|
685
|
+
id: 'CookieConsentBanner.bannerCookiesModalLink',
|
|
686
|
+
description: 'Cookie settings modal link text in the cookie consent banner.',
|
|
687
|
+
defaultMessage: 'cookies settings'
|
|
688
|
+
},
|
|
689
|
+
buttonLabel: {
|
|
690
|
+
id: 'CookieConsentBanner.buttonLabel',
|
|
691
|
+
description: 'Button text allowing the user to accept all ct cookies',
|
|
692
|
+
defaultMessage: 'Accept all cookies'
|
|
693
|
+
}
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
697
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
|
|
698
|
+
const BANNER_HEIGHT = 64;
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Define a fixed date to determine the validity of consent cookies. Update as required.
|
|
702
|
+
*
|
|
703
|
+
* Cookies set before this date are considered invalid due to new cookie regulations or changes.
|
|
704
|
+
*/
|
|
705
|
+
const COOKIE_REVOCATION_DATE = 'Wed May 01 2024 12:00:00 GMT-0400 (Eastern Daylight Time)';
|
|
706
|
+
var _ref = {
|
|
707
|
+
name: "1u6bcy9",
|
|
708
|
+
styles: "position:absolute;top:0;left:0;bottom:0;right:0;pointer-events:none;z-index:9999"
|
|
709
|
+
} ;
|
|
710
|
+
const CookieConsentBanner = bannerProps => {
|
|
711
|
+
react.useEffect(() => {
|
|
712
|
+
// Revoke cookies prior to a certain date to ensure user preferences are up-to-date with cookie configuration
|
|
713
|
+
core_dist_commercetoolsFrontendCookieConsentCore.unsetConsentCookie(new Date(COOKIE_REVOCATION_DATE));
|
|
714
|
+
}, []);
|
|
715
|
+
|
|
716
|
+
// Hide the banner once the accept button is clicked, until we can subscribe to the cookie
|
|
717
|
+
const _useState = react.useState(false),
|
|
718
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
719
|
+
bannerClosed = _useState2[0],
|
|
720
|
+
setBannerClosed = _useState2[1];
|
|
721
|
+
const _useModalState = applicationComponents.useModalState(),
|
|
722
|
+
closeModal = _useModalState.closeModal,
|
|
723
|
+
openModal = _useModalState.openModal,
|
|
724
|
+
isModalOpen = _useModalState.isModalOpen;
|
|
725
|
+
const _useIntl = reactIntl.useIntl(),
|
|
726
|
+
formatMessage = _useIntl.formatMessage;
|
|
727
|
+
const _useCookieConsent = useCookieConsent('performanceCookies', {
|
|
728
|
+
skipConsent: bannerProps.skipConsent
|
|
729
|
+
}),
|
|
730
|
+
setConsent = _useCookieConsent.setConsent,
|
|
731
|
+
hasGivenPerformanceCookieConsent = _useCookieConsent.givenConsent;
|
|
732
|
+
const _useCookieConsent2 = useCookieConsent('functionalCookies', {
|
|
733
|
+
skipConsent: bannerProps.skipConsent
|
|
734
|
+
}),
|
|
735
|
+
hasGivenFunctionalCookieConsent = _useCookieConsent2.givenConsent;
|
|
736
|
+
const createConsentGroups = () => ({
|
|
737
|
+
functionalCookies: true,
|
|
738
|
+
performanceCookies: true
|
|
739
|
+
});
|
|
740
|
+
if (bannerClosed || hasGivenFunctionalCookieConsent || hasGivenPerformanceCookieConsent) return null;
|
|
741
|
+
return (
|
|
742
|
+
// TODO: use lower z-index, prefer ranges per use-case
|
|
743
|
+
jsxRuntime.jsx("div", {
|
|
744
|
+
css: _ref,
|
|
745
|
+
children: jsxRuntime.jsxs("div", {
|
|
746
|
+
css: /*#__PURE__*/react$1.css("position:sticky;top:calc(100% - ", BANNER_HEIGHT, "px - ", designSystem.designTokens.spacingXl, ");display:flex;flex-direction:column;align-items:center;z-index:9999;width:100%;pointer-events:auto;" + ("" ), "" ),
|
|
747
|
+
children: [jsxRuntime.jsx("div", {
|
|
748
|
+
css: /*#__PURE__*/react$1.css("background-color:", designSystem.designTokens.colorAccent10, ";border-radius:", designSystem.designTokens.borderRadius4, ";box-shadow:", designSystem.designTokens.shadow8, ";margin:0 ", designSystem.designTokens.spacingXl, ";padding:", designSystem.designTokens.spacingM, " ", designSystem.designTokens.spacingL, ";width:fit-content;svg{display:none;}" + ("" ), "" ),
|
|
749
|
+
children: jsxRuntime.jsxs(Spacings__default["default"].Inline, {
|
|
750
|
+
alignItems: "center",
|
|
751
|
+
scale: "xl",
|
|
752
|
+
children: [jsxRuntime.jsx(Text__default["default"].Body, {
|
|
753
|
+
tone: "inverted",
|
|
754
|
+
children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread(_objectSpread({}, messages.bannerMessage), {}, {
|
|
755
|
+
values: {
|
|
756
|
+
privacyLink: jsxRuntime.jsx(Link__default["default"], {
|
|
757
|
+
intlMessage: messages.privacyPolicyLink,
|
|
758
|
+
isExternal: true,
|
|
759
|
+
to: COOKIE_CONSENT_LINKS.PRIVACY_POLICY,
|
|
760
|
+
tone: "inverted"
|
|
761
|
+
}),
|
|
762
|
+
modalLink: jsxRuntime.jsx(Link__default["default"], {
|
|
763
|
+
intlMessage: messages.bannerCookiesModalLink,
|
|
764
|
+
onClick: e => {
|
|
765
|
+
e.preventDefault();
|
|
766
|
+
openModal();
|
|
767
|
+
},
|
|
768
|
+
to: "",
|
|
769
|
+
tone: "inverted"
|
|
770
|
+
})
|
|
771
|
+
}
|
|
772
|
+
}))
|
|
773
|
+
}), jsxRuntime.jsx(PrimaryButton__default["default"], {
|
|
774
|
+
label: formatMessage(messages.buttonLabel),
|
|
775
|
+
onClick: () => {
|
|
776
|
+
setConsent(createConsentGroups());
|
|
777
|
+
setBannerClosed(true);
|
|
778
|
+
},
|
|
779
|
+
size: "medium"
|
|
780
|
+
})]
|
|
781
|
+
})
|
|
782
|
+
}), jsxRuntime.jsx(CookieConsentModal, {
|
|
783
|
+
closeModal: closeModal,
|
|
784
|
+
isModalOpen: isModalOpen,
|
|
785
|
+
setBannerClosed: setBannerClosed
|
|
786
|
+
})]
|
|
787
|
+
})
|
|
788
|
+
})
|
|
789
|
+
);
|
|
790
|
+
};
|
|
791
|
+
CookieConsentBanner.displayName = 'CookieConsentBanner';
|
|
792
|
+
|
|
793
|
+
exports.CookieConsentBanner = CookieConsentBanner;
|
|
794
|
+
exports.CookieConsentModal = CookieConsentModal;
|
|
795
|
+
exports.useCookieConsent = useCookieConsent;
|
|
796
|
+
exports.useSkipCookieConsent = useSkipCookieConsent;
|