@commercetools-frontend/cookie-consent 1.0.2 → 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.
Files changed (23) hide show
  1. package/README.md +59 -0
  2. package/core/dist/commercetools-frontend-cookie-consent-core.cjs.d.ts +1 -1
  3. package/core/dist/commercetools-frontend-cookie-consent-core.cjs.dev.js +16 -10
  4. package/core/dist/commercetools-frontend-cookie-consent-core.cjs.prod.js +16 -10
  5. package/dist/declarations/constants/links.d.ts +3 -0
  6. package/dist/declarations/src/{core.d.ts → core/index.d.ts} +5 -2
  7. package/dist/declarations/src/react/cookie-consent-banner/cookie-consent-banner.d.ts +8 -0
  8. package/dist/declarations/src/react/cookie-consent-banner/index.d.ts +1 -0
  9. package/dist/declarations/src/react/cookie-consent-banner/messages.d.ts +23 -0
  10. package/dist/declarations/src/react/cookie-consent-modal/cookie-consent-modal.d.ts +7 -0
  11. package/dist/declarations/src/react/cookie-consent-modal/cookie-details.d.ts +19 -0
  12. package/dist/declarations/src/react/cookie-consent-modal/index.d.ts +1 -0
  13. package/dist/declarations/src/react/cookie-consent-modal/messages.d.ts +173 -0
  14. package/dist/declarations/src/react/index.d.ts +4 -0
  15. package/dist/declarations/src/react/use-cookie-consent/index.d.ts +1 -0
  16. package/dist/declarations/src/react/use-cookie-consent/use-cookie-consent.d.ts +10 -0
  17. package/dist/declarations/src/react/use-skip-cookie-consent/index.d.ts +1 -0
  18. package/dist/declarations/src/react/use-skip-cookie-consent/use-skip-cookie-consent.d.ts +2 -0
  19. package/package.json +23 -18
  20. package/react/dist/commercetools-frontend-cookie-consent-react.cjs.d.ts +1 -1
  21. package/react/dist/commercetools-frontend-cookie-consent-react.cjs.dev.js +796 -15
  22. package/react/dist/commercetools-frontend-cookie-consent-react.cjs.prod.js +780 -15
  23. package/dist/declarations/src/react.d.ts +0 -6
@@ -4,34 +4,799 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var react = require('react');
6
6
  var core_dist_commercetoolsFrontendCookieConsentCore = require('../../core/dist/commercetools-frontend-cookie-consent-core.cjs.prod.js');
7
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols');
8
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor');
9
- require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
10
- require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
11
- require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
12
- require('@babel/runtime-corejs3/core-js-stable/object/define-property');
13
- require('@babel/runtime-corejs3/helpers/defineProperty');
14
- require('@babel/runtime-corejs3/helpers/slicedToArray');
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 react$1 = require('@emotion/react');
21
+ var reactIntl = require('react-intl');
22
+ var uiKit = require('@commercetools-frontend/ui-kit');
23
+ var applicationComponents = require('@commercetools-frontend/application-components');
24
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
15
25
  require('@babel/runtime-corejs3/core-js-stable/instance/find');
16
26
  require('@babel/runtime-corejs3/core-js-stable/object/from-entries');
17
- require('@babel/runtime-corejs3/core-js-stable/instance/map');
18
- require('@babel/runtime-corejs3/core-js-stable/object/keys');
19
27
  require('@babel/runtime-corejs3/core-js-stable/object/entries');
20
28
  require('@babel/runtime-corejs3/core-js-stable/url-search-params');
21
- require('@babel/runtime-corejs3/core-js-stable/instance/filter');
22
29
  require('@babel/runtime-corejs3/core-js-stable/instance/concat');
23
30
 
31
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
32
+
33
+ var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
34
+ var _Object$getOwnPropertySymbols__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertySymbols);
35
+ var _filterInstanceProperty__default = /*#__PURE__*/_interopDefault(_filterInstanceProperty);
36
+ var _Object$getOwnPropertyDescriptor__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptor);
37
+ var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
38
+ var _Object$getOwnPropertyDescriptors__default = /*#__PURE__*/_interopDefault(_Object$getOwnPropertyDescriptors);
39
+ var _Object$defineProperties__default = /*#__PURE__*/_interopDefault(_Object$defineProperties);
40
+ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defineProperty);
41
+ var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
42
+ var _Object$values__default = /*#__PURE__*/_interopDefault(_Object$values);
43
+
44
+ var defaultConsentOptions = {
45
+ skipConsent: false,
46
+ cookieName: 'OptanonConsent'
47
+ };
24
48
  function useCookieConsent(consentGroup) {
25
- var cookieName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'OptanonConsent';
49
+ var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultConsentOptions,
50
+ skipConsent = _ref.skipConsent,
51
+ cookieName = _ref.cookieName;
26
52
  var consentCookieGroups = react.useMemo(function () {
27
53
  var rawConsentCookie = core_dist_commercetoolsFrontendCookieConsentCore.getRawConsentCookie(cookieName);
28
- var consentCookieGroups = core_dist_commercetoolsFrontendCookieConsentCore.getParsedConsentCookieGroups(rawConsentCookie);
54
+ var consentCookieGroups = core_dist_commercetoolsFrontendCookieConsentCore.getParsedConsentCookieGroups(rawConsentCookie, {
55
+ skipConsent: skipConsent
56
+ });
29
57
  return consentCookieGroups;
30
- }, [cookieName]);
58
+ }, [cookieName, skipConsent]);
31
59
  return {
32
- givenConsent: Boolean(consentCookieGroups[consentGroup]),
60
+ givenConsent: skipConsent || Boolean(consentCookieGroups[consentGroup]),
33
61
  setConsent: core_dist_commercetoolsFrontendCookieConsentCore.setConsentCookie
34
62
  };
35
63
  }
36
64
 
65
+ function useSkipCookieConsent() {
66
+ var skipCookieConsent = applicationShellConnectors.useApplicationContext(function (context) {
67
+ return context.environment.skipCookieConsent;
68
+ });
69
+ return Boolean(skipCookieConsent);
70
+ }
71
+
72
+ var modalMessages = reactIntl.defineMessages({
73
+ title: {
74
+ id: 'CookieConsentModal.title',
75
+ description: 'Confirmation dialog title',
76
+ defaultMessage: 'Privacy Preference Center'
77
+ },
78
+ primaryButtonLabel: {
79
+ id: 'CookieConsentModal.primaryButtonLabel',
80
+ description: 'Primary button text',
81
+ defaultMessage: 'Accept all cookies'
82
+ },
83
+ secondaryButtonLabel: {
84
+ id: 'CookieConsentModal.secondaryButtonLabel',
85
+ description: 'Secondary button text',
86
+ defaultMessage: 'Confirm my choices'
87
+ },
88
+ mainDescription: {
89
+ id: 'CookieConsentModal.primary.mainDescription',
90
+ description: 'Main body copy',
91
+ 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.'
92
+ },
93
+ privacyPolicyLink: {
94
+ id: 'CookieConsentModal.primary.privacyPolicyLink',
95
+ description: 'Link to privacy policy',
96
+ defaultMessage: 'More information'
97
+ },
98
+ necessaryCookiesHeader: {
99
+ id: 'CookieConsentModal.primary.necessaryCookiesHeader',
100
+ description: 'Header for first collapsible content block',
101
+ defaultMessage: 'Strictly necessary cookies'
102
+ },
103
+ necessaryCookiesDescription: {
104
+ id: 'CookieConsentModal.primary.necessaryCookiesDescription',
105
+ description: 'Description of content from first collapsible header',
106
+ defaultMessage: 'These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.'
107
+ },
108
+ necessaryCookiesHeaderState: {
109
+ id: 'CookieConsentModal.primary.necessaryCookiesHeaderState',
110
+ description: 'State of the cookies described in the header',
111
+ defaultMessage: 'Always active'
112
+ },
113
+ performanceCookiesHeader: {
114
+ id: 'CookieConsentModal.primary.performanceCookiesHeader',
115
+ description: 'Header for second collapsible content block',
116
+ defaultMessage: 'Performance cookies'
117
+ },
118
+ performanceCookiesDescription: {
119
+ id: 'CookieConsentModal.primary.performanceCookiesDescription',
120
+ description: 'Description of content from second collapsible header',
121
+ 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.'
122
+ },
123
+ cookieInformationLink: {
124
+ id: 'CookieConsentModal.primary.cookieInformationLink',
125
+ description: 'Link to additional cookie information',
126
+ defaultMessage: 'Cookies details'
127
+ },
128
+ navigateBackLink: {
129
+ id: 'CookieConsentModal.primary.navigateBackLink',
130
+ description: 'Link to go back to primary view',
131
+ defaultMessage: 'Back to Privacy Preference Center'
132
+ }
133
+ });
134
+ var cookieDetailLabels = reactIntl.defineMessages({
135
+ nameLabel: {
136
+ id: 'CookieConsentModal.cookieDetails.nameLabel',
137
+ description: 'Name - category identifier',
138
+ defaultMessage: 'Name'
139
+ },
140
+ hostLabel: {
141
+ id: 'CookieConsentModal.cookieDetails.hostLabel',
142
+ description: 'Host - category identifier',
143
+ defaultMessage: 'Host'
144
+ },
145
+ durationLabel: {
146
+ id: 'CookieConsentModal.cookieDetails.durationLabel',
147
+ description: 'Duration - category identifier',
148
+ defaultMessage: 'Duration'
149
+ },
150
+ typeLabel: {
151
+ id: 'CookieConsentModal.cookieDetails.typeLabel',
152
+ description: 'Type - category identifier',
153
+ defaultMessage: 'Type'
154
+ },
155
+ categoryLabel: {
156
+ id: 'CookieConsentModal.cookieDetails.categoryLabel',
157
+ description: 'Category - category identifier',
158
+ defaultMessage: 'Category'
159
+ },
160
+ descriptionLabel: {
161
+ id: 'CookieConsentModal.cookieDetails.descriptionLabel',
162
+ description: 'Description - category identifier',
163
+ defaultMessage: 'Description'
164
+ }
165
+ });
166
+ var cookieDetailValues = reactIntl.defineMessages({
167
+ duration9Months: {
168
+ id: 'CookieConsentModal.cookieDetails.duration9Months',
169
+ description: 'Length of time',
170
+ defaultMessage: '9 Months'
171
+ },
172
+ duration1Week: {
173
+ id: 'CookieConsentModal.cookieDetails.duration1Week',
174
+ description: 'Length of time',
175
+ defaultMessage: '1 Week'
176
+ },
177
+ durationSession: {
178
+ id: 'CookieConsentModal.cookieDetails.durationSession',
179
+ description: 'Length of time for cookie to expire in the browser',
180
+ defaultMessage: 'Session'
181
+ },
182
+ duration1Year: {
183
+ id: 'CookieConsentModal.cookieDetails.duration1Year',
184
+ description: 'Length of time',
185
+ defaultMessage: '1 Year'
186
+ },
187
+ duration1Day: {
188
+ id: 'CookieConsentModal.cookieDetails.duration1Day',
189
+ description: 'Length of time',
190
+ defaultMessage: '1 Day'
191
+ },
192
+ typeFirstParty: {
193
+ id: 'CookieConsentModal.cookieDetails.typeFirstParty',
194
+ description: 'Type of cookie',
195
+ defaultMessage: 'First party'
196
+ },
197
+ categoryStrictlyNecessary: {
198
+ id: 'CookieConsentModal.cookieDetails.categoryStrictlyNecessary',
199
+ description: 'Type of cookie',
200
+ defaultMessage: 'Strictly Necessary Cookies'
201
+ },
202
+ categoryPerformance: {
203
+ id: 'CookieConsentModal.cookieDetails.categoryPerformance',
204
+ description: 'Type of cookie',
205
+ defaultMessage: 'Performance Cookies'
206
+ }
207
+ });
208
+ var cookieDetailDescriptions = reactIntl.defineMessages({
209
+ essentialCookieDescription1: {
210
+ id: 'CookieConsentModal.cookieDetails.essentialCookieDescription1',
211
+ description: 'Description of cookie',
212
+ defaultMessage: 'Identifier for each unique device that interacts with Intercom. It is refreshed on each successful ping, extending it another 9 months. Set by Intercom Messenger within the commercetools Merchant Center.'
213
+ },
214
+ essentialCookieDescription2: {
215
+ id: 'CookieConsentModal.cookieDetails.essentialCookieDescription2',
216
+ description: 'Description of cookie',
217
+ defaultMessage: 'Anonymous visitor identifier cookie. Set by Intercom Messenger within the commercetools Merchant Center.'
218
+ },
219
+ essentialCookieDescription3: {
220
+ id: 'CookieConsentModal.cookieDetails.essentialCookieDescription3',
221
+ description: 'Description of cookie',
222
+ defaultMessage: 'Identifier for each unique browser session. This session cookie is refreshed on each successfully logged-in ping, extending it one week from this moment. Set by Intercom Messenger within the commercetools Merchant Center.'
223
+ },
224
+ performanceCookieDescription1: {
225
+ id: 'CookieConsentModal.cookieDetails.performanceCookieDescription1',
226
+ description: 'Description of cookie',
227
+ 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.'
228
+ },
229
+ performanceCookieDescription2: {
230
+ id: 'CookieConsentModal.cookieDetails.performanceCookieDescription2',
231
+ description: 'Description of cookie',
232
+ 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.'
233
+ },
234
+ performanceCookieDescription3: {
235
+ id: 'CookieConsentModal.cookieDetails.performanceCookieDescription3',
236
+ description: 'Description of cookie',
237
+ 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.'
238
+ },
239
+ performanceCookieDescription4: {
240
+ id: 'CookieConsentModal.cookieDetails.performanceCookieDescription4',
241
+ description: 'Description of cookie',
242
+ 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."
243
+ }
244
+ });
245
+
246
+ var COOKIE_CONSENT_LINKS = {
247
+ PRIVACY_POLICY: 'https://commercetools.com/privacy#website'
248
+ };
249
+
250
+ var HOSTNAME = 'commercetools.com';
251
+ var createCookieLink = function createCookieLink(cookieName) {
252
+ return "https://cookiepedia.co.uk/cookies/".concat(cookieName);
253
+ };
254
+ var createEssentialCookieDetails = function createEssentialCookieDetails(intl) {
255
+ return [{
256
+ name: {
257
+ label: intl.formatMessage(cookieDetailLabels.nameLabel),
258
+ value: 'intercom-device-id-b74wbpa8',
259
+ to: createCookieLink('intercom-device-id-b74wbpa8')
260
+ },
261
+ host: {
262
+ label: intl.formatMessage(cookieDetailLabels.hostLabel),
263
+ value: HOSTNAME
264
+ },
265
+ duration: {
266
+ label: intl.formatMessage(cookieDetailLabels.durationLabel),
267
+ value: intl.formatMessage(cookieDetailValues.duration9Months)
268
+ },
269
+ type: {
270
+ label: intl.formatMessage(cookieDetailLabels.typeLabel),
271
+ value: intl.formatMessage(cookieDetailValues.typeFirstParty)
272
+ },
273
+ category: {
274
+ label: intl.formatMessage(cookieDetailLabels.categoryLabel),
275
+ value: intl.formatMessage(cookieDetailValues.categoryStrictlyNecessary)
276
+ },
277
+ description: {
278
+ label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
279
+ value: intl.formatMessage(cookieDetailDescriptions.essentialCookieDescription1)
280
+ }
281
+ }, {
282
+ name: {
283
+ label: intl.formatMessage(cookieDetailLabels.nameLabel),
284
+ value: 'intercom-id-b74wbpa8',
285
+ to: createCookieLink('intercom-id-b74wbpa8')
286
+ },
287
+ host: {
288
+ label: intl.formatMessage(cookieDetailLabels.hostLabel),
289
+ value: HOSTNAME
290
+ },
291
+ duration: {
292
+ label: intl.formatMessage(cookieDetailLabels.durationLabel),
293
+ value: intl.formatMessage(cookieDetailValues.duration9Months)
294
+ },
295
+ type: {
296
+ label: intl.formatMessage(cookieDetailLabels.typeLabel),
297
+ value: intl.formatMessage(cookieDetailValues.typeFirstParty)
298
+ },
299
+ category: {
300
+ label: intl.formatMessage(cookieDetailLabels.categoryLabel),
301
+ value: intl.formatMessage(cookieDetailValues.categoryStrictlyNecessary)
302
+ },
303
+ description: {
304
+ label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
305
+ value: intl.formatMessage(cookieDetailDescriptions.essentialCookieDescription2)
306
+ }
307
+ }, {
308
+ name: {
309
+ label: intl.formatMessage(cookieDetailLabels.nameLabel),
310
+ value: 'intercom-session-b74wbpa8',
311
+ to: createCookieLink('intercom-session-b74wbpa8')
312
+ },
313
+ host: {
314
+ label: intl.formatMessage(cookieDetailLabels.hostLabel),
315
+ value: HOSTNAME
316
+ },
317
+ duration: {
318
+ label: intl.formatMessage(cookieDetailLabels.durationLabel),
319
+ value: intl.formatMessage(cookieDetailValues.duration1Week)
320
+ },
321
+ type: {
322
+ label: intl.formatMessage(cookieDetailLabels.typeLabel),
323
+ value: intl.formatMessage(cookieDetailValues.typeFirstParty)
324
+ },
325
+ category: {
326
+ label: intl.formatMessage(cookieDetailLabels.categoryLabel),
327
+ value: intl.formatMessage(cookieDetailValues.categoryStrictlyNecessary)
328
+ },
329
+ description: {
330
+ label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
331
+ value: intl.formatMessage(cookieDetailDescriptions.essentialCookieDescription3)
332
+ }
333
+ }];
334
+ };
335
+ var createPerformanceCookieDetails = function createPerformanceCookieDetails(intl) {
336
+ return [{
337
+ name: {
338
+ label: intl.formatMessage(cookieDetailLabels.nameLabel),
339
+ value: '_fs_tab_id',
340
+ to: createCookieLink('_fs_tab_id')
341
+ },
342
+ host: {
343
+ label: intl.formatMessage(cookieDetailLabels.hostLabel),
344
+ value: HOSTNAME
345
+ },
346
+ duration: {
347
+ label: intl.formatMessage(cookieDetailLabels.durationLabel),
348
+ value: intl.formatMessage(cookieDetailValues.durationSession)
349
+ },
350
+ type: {
351
+ label: intl.formatMessage(cookieDetailLabels.typeLabel),
352
+ value: intl.formatMessage(cookieDetailValues.duration9Months)
353
+ },
354
+ category: {
355
+ label: intl.formatMessage(cookieDetailLabels.categoryLabel),
356
+ value: intl.formatMessage(cookieDetailValues.categoryPerformance)
357
+ },
358
+ description: {
359
+ label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
360
+ value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription1)
361
+ }
362
+ }, {
363
+ name: {
364
+ label: intl.formatMessage(cookieDetailLabels.nameLabel),
365
+ value: 'fs_cid',
366
+ to: createCookieLink('fs_cid')
367
+ },
368
+ host: {
369
+ label: intl.formatMessage(cookieDetailLabels.hostLabel),
370
+ value: HOSTNAME
371
+ },
372
+ duration: {
373
+ label: intl.formatMessage(cookieDetailLabels.durationLabel),
374
+ value: intl.formatMessage(cookieDetailValues.duration1Year)
375
+ },
376
+ type: {
377
+ label: intl.formatMessage(cookieDetailLabels.typeLabel),
378
+ value: intl.formatMessage(cookieDetailValues.typeFirstParty)
379
+ },
380
+ category: {
381
+ label: intl.formatMessage(cookieDetailLabels.categoryLabel),
382
+ value: intl.formatMessage(cookieDetailValues.categoryPerformance)
383
+ },
384
+ description: {
385
+ label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
386
+ value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription2)
387
+ }
388
+ }, {
389
+ name: {
390
+ label: intl.formatMessage(cookieDetailLabels.nameLabel),
391
+ value: 'fs_lua',
392
+ to: createCookieLink('fs_lua')
393
+ },
394
+ host: {
395
+ label: intl.formatMessage(cookieDetailLabels.hostLabel),
396
+ value: HOSTNAME
397
+ },
398
+ duration: {
399
+ label: intl.formatMessage(cookieDetailLabels.durationLabel),
400
+ value: intl.formatMessage(cookieDetailValues.duration1Day)
401
+ },
402
+ type: {
403
+ label: intl.formatMessage(cookieDetailLabels.typeLabel),
404
+ value: intl.formatMessage(cookieDetailValues.typeFirstParty)
405
+ },
406
+ category: {
407
+ label: intl.formatMessage(cookieDetailLabels.categoryLabel),
408
+ value: intl.formatMessage(cookieDetailValues.categoryPerformance)
409
+ },
410
+ description: {
411
+ label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
412
+ value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription3)
413
+ }
414
+ }, {
415
+ name: {
416
+ label: intl.formatMessage(cookieDetailLabels.nameLabel),
417
+ value: 'fs_uid',
418
+ to: createCookieLink('fs_uid')
419
+ },
420
+ host: {
421
+ label: intl.formatMessage(cookieDetailLabels.hostLabel),
422
+ value: HOSTNAME
423
+ },
424
+ duration: {
425
+ label: intl.formatMessage(cookieDetailLabels.durationLabel),
426
+ value: intl.formatMessage(cookieDetailValues.duration9Months)
427
+ },
428
+ type: {
429
+ label: intl.formatMessage(cookieDetailLabels.typeLabel),
430
+ value: intl.formatMessage(cookieDetailValues.typeFirstParty)
431
+ },
432
+ category: {
433
+ label: intl.formatMessage(cookieDetailLabels.categoryLabel),
434
+ value: intl.formatMessage(cookieDetailValues.categoryPerformance)
435
+ },
436
+ description: {
437
+ label: intl.formatMessage(cookieDetailLabels.descriptionLabel),
438
+ value: intl.formatMessage(cookieDetailDescriptions.performanceCookieDescription4)
439
+ }
440
+ }];
441
+ };
442
+
443
+ function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
444
+ function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context2, _context3; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context2 = ownKeys$1(Object(source), !0)).call(_context2, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
445
+ var View = {
446
+ Primary: 'Primary',
447
+ Secondary: 'Secondary',
448
+ Tertiary: 'Tertiary'
449
+ };
450
+ /**
451
+ * The design spec warranted text that _looks_ like a link, but isn't
452
+ */
453
+ var NavigationLink = function NavigationLink(_ref4) {
454
+ var _onClick = _ref4.onClick,
455
+ label = _ref4.label;
456
+ return jsxRuntime.jsx(uiKit.Link, {
457
+ onClick: function onClick(e) {
458
+ e.preventDefault();
459
+ _onClick();
460
+ },
461
+ to: "",
462
+ children: label
463
+ });
464
+ };
465
+ var _ref3 = {
466
+ name: "1u8ems1",
467
+ styles: "& svg{display:none;}"
468
+ } ;
469
+ var InformationLink = function InformationLink(_ref5) {
470
+ var to = _ref5.to,
471
+ label = _ref5.label;
472
+ var removeDefaultSvg = _ref3;
473
+ return jsxRuntime.jsx("div", {
474
+ css: removeDefaultSvg,
475
+ children: jsxRuntime.jsx(uiKit.Link, {
476
+ isExternal: true,
477
+ to: to,
478
+ children: label
479
+ })
480
+ });
481
+ };
482
+ var _ref2 = {
483
+ name: "1u8ems1",
484
+ styles: "& svg{display:none;}"
485
+ } ;
486
+ var DetailLink = function DetailLink(_ref6) {
487
+ var to = _ref6.to,
488
+ label = _ref6.label;
489
+ var removeDefaultSvg = _ref2;
490
+ return jsxRuntime.jsx("div", {
491
+ css: removeDefaultSvg,
492
+ children: jsxRuntime.jsx(uiKit.Link, {
493
+ isExternal: true,
494
+ to: to,
495
+ children: jsxRuntime.jsx(uiKit.Text.Detail, {
496
+ tone: "primary",
497
+ children: label
498
+ })
499
+ })
500
+ });
501
+ };
502
+ var _ref = {
503
+ name: "qzmnd2",
504
+ styles: "padding-right:10px"
505
+ } ;
506
+ var CookieConsentBodyPrimary = function CookieConsentBodyPrimary(_ref7) {
507
+ var toggleValue = _ref7.toggleValue,
508
+ onToggle = _ref7.onToggle,
509
+ onChangeView = _ref7.onChangeView,
510
+ panelState = _ref7.panelState,
511
+ setPanelState = _ref7.setPanelState;
512
+ var _useIntl = reactIntl.useIntl(),
513
+ formatMessage = _useIntl.formatMessage;
514
+
515
+ // The outline of the input is cut off; we shift it to the left to compensate
516
+ var bumpToggle = _ref;
517
+ return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
518
+ scale: "xl",
519
+ children: [jsxRuntime.jsxs(uiKit.Spacings.Stack, {
520
+ scale: "m",
521
+ children: [jsxRuntime.jsx(uiKit.Text.Body, {
522
+ intlMessage: modalMessages.mainDescription
523
+ }), jsxRuntime.jsx(InformationLink, {
524
+ label: formatMessage(modalMessages.privacyPolicyLink),
525
+ to: COOKIE_CONSENT_LINKS.PRIVACY_POLICY
526
+ })]
527
+ }), jsxRuntime.jsxs(uiKit.Spacings.Stack, {
528
+ scale: "l",
529
+ children: [jsxRuntime.jsx(uiKit.CollapsiblePanel, {
530
+ condensed: true,
531
+ header: formatMessage(modalMessages.necessaryCookiesHeader),
532
+ headerControls: jsxRuntime.jsx(uiKit.Text.Detail, {
533
+ intlMessage: modalMessages.necessaryCookiesHeaderState,
534
+ tone: "information"
535
+ }),
536
+ isClosed: panelState.essentialCookiesClosed,
537
+ onToggle: function onToggle() {
538
+ return setPanelState(_objectSpread$1(_objectSpread$1({}, panelState), {}, {
539
+ essentialCookiesClosed: !panelState.essentialCookiesClosed
540
+ }));
541
+ },
542
+ theme: "light",
543
+ children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
544
+ scale: "m",
545
+ children: [jsxRuntime.jsx(uiKit.Text.Body, {
546
+ intlMessage: modalMessages.necessaryCookiesDescription
547
+ }), jsxRuntime.jsx(NavigationLink, {
548
+ label: formatMessage(modalMessages.cookieInformationLink),
549
+ onClick: function onClick() {
550
+ return onChangeView(View.Secondary);
551
+ }
552
+ })]
553
+ })
554
+ }), jsxRuntime.jsx(uiKit.CollapsiblePanel, {
555
+ condensed: true,
556
+ header: formatMessage(modalMessages.performanceCookiesHeader),
557
+ headerControls: jsxRuntime.jsx("div", {
558
+ css: bumpToggle,
559
+ children: jsxRuntime.jsx(uiKit.ToggleInput, {
560
+ isChecked: toggleValue,
561
+ onChange: function onChange(e) {
562
+ return onToggle(e.target.checked);
563
+ },
564
+ size: "small"
565
+ })
566
+ }),
567
+ isClosed: panelState.performanceCookiesClosed,
568
+ onToggle: function onToggle() {
569
+ return setPanelState(_objectSpread$1(_objectSpread$1({}, panelState), {}, {
570
+ performanceCookiesClosed: !panelState.performanceCookiesClosed
571
+ }));
572
+ },
573
+ theme: "light",
574
+ children: jsxRuntime.jsxs(uiKit.Spacings.Stack, {
575
+ scale: "m",
576
+ children: [jsxRuntime.jsx(uiKit.Text.Body, {
577
+ intlMessage: modalMessages.performanceCookiesDescription
578
+ }), jsxRuntime.jsx(NavigationLink, {
579
+ label: formatMessage(modalMessages.cookieInformationLink),
580
+ onClick: function onClick() {
581
+ return onChangeView(View.Tertiary);
582
+ }
583
+ })]
584
+ })
585
+ })]
586
+ })]
587
+ });
588
+ };
589
+ var CookieConsentBodyDetails = function CookieConsentBodyDetails(_ref8) {
590
+ var onChangeView = _ref8.onChangeView,
591
+ cookieDetails = _ref8.cookieDetails;
592
+ var _useIntl2 = reactIntl.useIntl(),
593
+ formatMessage = _useIntl2.formatMessage;
594
+ return jsxRuntime.jsxs(uiKit.Spacings.Stack, {
595
+ scale: "l",
596
+ children: [jsxRuntime.jsx(NavigationLink, {
597
+ label: formatMessage(modalMessages.navigateBackLink),
598
+ onClick: function onClick() {
599
+ return onChangeView(View.Primary);
600
+ }
601
+ }), jsxRuntime.jsx(uiKit.Spacings.Stack, {
602
+ scale: "l",
603
+ children: _mapInstanceProperty__default["default"](cookieDetails).call(cookieDetails, function (detail) {
604
+ var _context;
605
+ return jsxRuntime.jsx(uiKit.Grid, {
606
+ gridGap: "24px",
607
+ gridRowGap: "0px",
608
+ gridTemplateColumns: "80px 1fr",
609
+ children: _mapInstanceProperty__default["default"](_context = _Object$values__default["default"](detail)).call(_context, function (value) {
610
+ return jsxRuntime.jsxs(react.Fragment, {
611
+ children: [jsxRuntime.jsx(uiKit.Grid.Item, {
612
+ children: jsxRuntime.jsx(uiKit.Text.Detail, {
613
+ children: value.label
614
+ })
615
+ }), jsxRuntime.jsx(uiKit.Grid.Item, {
616
+ children: 'to' in value ? jsxRuntime.jsx(DetailLink, {
617
+ label: value.value,
618
+ to: value.to
619
+ }) : jsxRuntime.jsx(uiKit.Text.Detail, {
620
+ children: value.value
621
+ })
622
+ })]
623
+ }, value.value);
624
+ })
625
+ }, detail.name.value);
626
+ })
627
+ })]
628
+ });
629
+ };
630
+ var CookieConsentModal = function CookieConsentModal(modalProps) {
631
+ var intl = reactIntl.useIntl();
632
+ var _useCookieConsent = useCookieConsent('performanceCookies'),
633
+ setConsent = _useCookieConsent.setConsent;
634
+ var _useState = react.useState(false),
635
+ _useState2 = _slicedToArray(_useState, 2),
636
+ enablePerformanceCookies = _useState2[0],
637
+ setEnablePerformanceCookies = _useState2[1];
638
+ var _useState3 = react.useState(View.Primary),
639
+ _useState4 = _slicedToArray(_useState3, 2),
640
+ currentView = _useState4[0],
641
+ setCurrentView = _useState4[1];
642
+ var _useState5 = react.useState({
643
+ essentialCookiesClosed: true,
644
+ performanceCookiesClosed: true
645
+ }),
646
+ _useState6 = _slicedToArray(_useState5, 2),
647
+ panelState = _useState6[0],
648
+ _setPanelState = _useState6[1];
649
+ var createConsentGroups = function createConsentGroups(performanceConsent) {
650
+ return {
651
+ essentialCookies: true,
652
+ performanceCookies: performanceConsent
653
+ };
654
+ };
655
+ return jsxRuntime.jsxs(applicationComponents.ConfirmationDialog, {
656
+ isOpen: modalProps.isModalOpen,
657
+ labelPrimary: intl.formatMessage(modalMessages.primaryButtonLabel),
658
+ labelSecondary: intl.formatMessage(modalMessages.secondaryButtonLabel),
659
+ onCancel: function onCancel() {
660
+ setConsent(createConsentGroups(enablePerformanceCookies));
661
+ modalProps.setBannerClosed(true);
662
+ modalProps.closeModal();
663
+ },
664
+ onClose: modalProps.closeModal,
665
+ onConfirm: function onConfirm() {
666
+ setConsent(createConsentGroups(true));
667
+ modalProps.setBannerClosed(true);
668
+ modalProps.closeModal();
669
+ },
670
+ title: intl.formatMessage(modalMessages.title),
671
+ children: [currentView === View.Primary && jsxRuntime.jsx(CookieConsentBodyPrimary, {
672
+ onChangeView: function onChangeView(view) {
673
+ return setCurrentView(view);
674
+ },
675
+ onToggle: function onToggle(value) {
676
+ return setEnablePerformanceCookies(value);
677
+ },
678
+ panelState: panelState,
679
+ setPanelState: function setPanelState(state) {
680
+ return _setPanelState(state);
681
+ },
682
+ toggleValue: enablePerformanceCookies
683
+ }), currentView === View.Secondary && jsxRuntime.jsx(CookieConsentBodyDetails, {
684
+ cookieDetails: createEssentialCookieDetails(intl),
685
+ onChangeView: function onChangeView(view) {
686
+ return setCurrentView(view);
687
+ }
688
+ }), currentView === View.Tertiary && jsxRuntime.jsx(CookieConsentBodyDetails, {
689
+ cookieDetails: createPerformanceCookieDetails(intl),
690
+ onChangeView: function onChangeView(view) {
691
+ return setCurrentView(view);
692
+ }
693
+ })]
694
+ });
695
+ };
696
+
697
+ var messages = reactIntl.defineMessages({
698
+ bannerMessage: {
699
+ id: 'CookieConsentBanner.bannerMessage',
700
+ description: 'Text of the cookie consent banner.',
701
+ defaultMessage: 'This site uses cookies. See our {privacyLink} or manage your {modalLink} here.'
702
+ },
703
+ privacyPolicyLink: {
704
+ id: 'CookieConsentBanner.privacyPolicyLink',
705
+ description: 'Privacy policy link text in the cookie consent banner.',
706
+ defaultMessage: 'privacy policy'
707
+ },
708
+ bannerCookiesModalLink: {
709
+ id: 'CookieConsentBanner.bannerCookiesModalLink',
710
+ description: 'Cookie settings modal link text in the cookie consent banner.',
711
+ defaultMessage: 'cookies settings'
712
+ },
713
+ buttonLabel: {
714
+ id: 'CookieConsentBanner.buttonLabel',
715
+ description: 'Button text allowing the user to accept all ct cookies',
716
+ defaultMessage: 'Accept all cookies'
717
+ }
718
+ });
719
+
720
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
721
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
722
+ var CookieConsentBanner = function CookieConsentBanner(bannerProps) {
723
+ // Hide the banner once the accept button is clicked, until we can subscribe to the cookie
724
+ var _useState = react.useState(false),
725
+ _useState2 = _slicedToArray(_useState, 2),
726
+ bannerClosed = _useState2[0],
727
+ setBannerClosed = _useState2[1];
728
+ var _useModalState = applicationComponents.useModalState(),
729
+ closeModal = _useModalState.closeModal,
730
+ openModal = _useModalState.openModal,
731
+ isModalOpen = _useModalState.isModalOpen;
732
+ var _useIntl = reactIntl.useIntl(),
733
+ formatMessage = _useIntl.formatMessage;
734
+ var _useCookieConsent = useCookieConsent('performanceCookies', {
735
+ skipConsent: bannerProps.skipConsent
736
+ }),
737
+ setConsent = _useCookieConsent.setConsent,
738
+ hasGivenPerformanceCookieConsent = _useCookieConsent.givenConsent;
739
+ var _useCookieConsent2 = useCookieConsent('essentialCookies', {
740
+ skipConsent: bannerProps.skipConsent
741
+ }),
742
+ hasGivenEssentialCookieConsent = _useCookieConsent2.givenConsent;
743
+ var createConsentGroups = function createConsentGroups() {
744
+ return {
745
+ essentialCookies: true,
746
+ performanceCookies: true
747
+ };
748
+ };
749
+ if (bannerClosed || hasGivenEssentialCookieConsent || hasGivenPerformanceCookieConsent) return null;
750
+ return (
751
+ // TODO: use lower z-index, prefer ranges per use-case
752
+ jsxRuntime.jsxs("div", {
753
+ css: /*#__PURE__*/react$1.css("display:flex;flex-direction:column;align-items:center;position:absolute;bottom:", uiKit.designTokens.spacingXl, ";z-index:1000000;width:100%;" + ("" ), "" ),
754
+ children: [jsxRuntime.jsx("div", {
755
+ css: /*#__PURE__*/react$1.css("background-color:", uiKit.designTokens.colorAccent10, ";border-radius:", uiKit.designTokens.borderRadius4, ";box-shadow:", uiKit.designTokens.shadow8, ";margin:0 ", uiKit.designTokens.spacingXl, ";padding:", uiKit.designTokens.spacingM, " ", uiKit.designTokens.spacingL, ";width:fit-content;svg{display:none;}" + ("" ), "" ),
756
+ children: jsxRuntime.jsxs(uiKit.Spacings.Inline, {
757
+ alignItems: "center",
758
+ scale: "xl",
759
+ children: [jsxRuntime.jsx(uiKit.Text.Body, {
760
+ tone: "inverted",
761
+ children: jsxRuntime.jsx(reactIntl.FormattedMessage, _objectSpread(_objectSpread({}, messages.bannerMessage), {}, {
762
+ values: {
763
+ privacyLink: jsxRuntime.jsx(uiKit.Link, {
764
+ intlMessage: messages.privacyPolicyLink,
765
+ isExternal: true,
766
+ to: COOKIE_CONSENT_LINKS.PRIVACY_POLICY,
767
+ tone: "inverted"
768
+ }),
769
+ modalLink: jsxRuntime.jsx(uiKit.Link, {
770
+ intlMessage: messages.bannerCookiesModalLink,
771
+ onClick: function onClick(e) {
772
+ e.preventDefault();
773
+ openModal();
774
+ },
775
+ to: "",
776
+ tone: "inverted"
777
+ })
778
+ }
779
+ }))
780
+ }), jsxRuntime.jsx(uiKit.PrimaryButton, {
781
+ label: formatMessage(messages.buttonLabel),
782
+ onClick: function onClick() {
783
+ setConsent(createConsentGroups());
784
+ setBannerClosed(true);
785
+ },
786
+ size: "small"
787
+ })]
788
+ })
789
+ }), jsxRuntime.jsx(CookieConsentModal, {
790
+ closeModal: closeModal,
791
+ isModalOpen: isModalOpen,
792
+ setBannerClosed: setBannerClosed
793
+ })]
794
+ })
795
+ );
796
+ };
797
+ CookieConsentBanner.displayName = 'CookieConsentBanner';
798
+
799
+ exports.CookieConsentBanner = CookieConsentBanner;
800
+ exports.CookieConsentModal = CookieConsentModal;
37
801
  exports.useCookieConsent = useCookieConsent;
802
+ exports.useSkipCookieConsent = useSkipCookieConsent;