@@ -38,101 +38,85 @@ export const assembleSecondaryButton = (
38
38
secondaryButtonMode : Values < typeof SecondaryButtonMode > ,
39
39
textAcceptNecessary : string ,
40
40
textShowSettings : string ,
41
- ) : VanillaCookieConsent . ModalSecondaryButton => {
42
- return {
43
- text : secondaryButtonMode === SecondaryButtonMode . ACCEPT_NECESSARY ? textAcceptNecessary : textShowSettings ,
44
- role :
45
- secondaryButtonMode === SecondaryButtonMode . ACCEPT_NECESSARY
46
- ? VanillaCookieConsent . SecondaryButtonRole . ACCEPT_NECESSARY
47
- : VanillaCookieConsent . SecondaryButtonRole . SETTINGS ,
48
- } ;
49
- } ;
41
+ ) : VanillaCookieConsent . ModalSecondaryButton => ( {
42
+ text : secondaryButtonMode === SecondaryButtonMode . ACCEPT_NECESSARY ? textAcceptNecessary : textShowSettings ,
43
+ role :
44
+ secondaryButtonMode === SecondaryButtonMode . ACCEPT_NECESSARY
45
+ ? VanillaCookieConsent . SecondaryButtonRole . ACCEPT_NECESSARY
46
+ : VanillaCookieConsent . SecondaryButtonRole . SETTINGS ,
47
+ } ) ;
50
48
51
- export const isSettingsButtonNotShown = ( secondaryButtonMode : Values < typeof SecondaryButtonMode > ) : boolean => {
52
- return secondaryButtonMode !== SecondaryButtonMode . SHOW_SETTINGS ;
53
- } ;
49
+ export const isSettingsButtonNotShown = ( secondaryButtonMode : Values < typeof SecondaryButtonMode > ) : boolean =>
50
+ secondaryButtonMode !== SecondaryButtonMode . SHOW_SETTINGS ;
51
+
52
+ const assembleCategoryBlock = (
53
+ category : CookieConsentCategoryValues ,
54
+ title : string ,
55
+ description : string ,
56
+ readonly : boolean ,
57
+ cookieTableItems : VanillaCookieConsent . CookieTableItem [ ] | undefined ,
58
+ ) : VanillaCookieConsent . ModalBlock => ( {
59
+ title,
60
+ description,
61
+ toggle : { value : category , enabled : readonly , readonly } ,
62
+ ...( typeof cookieTableItems !== 'undefined' && { cookie_table : cookieTableItems } ) ,
63
+ } ) ;
54
64
55
65
export const assembleCategoryNecessary = (
56
66
title : string ,
57
67
description : string ,
58
68
cookieTable : CookieTableCategories ,
59
- ) : VanillaCookieConsent . ModalBlock => {
60
- return assembleCategoryBlock (
69
+ ) : VanillaCookieConsent . ModalBlock =>
70
+ assembleCategoryBlock (
61
71
CookieConsentCategory . NECESSARY ,
62
72
title ,
63
73
description ,
64
74
true ,
65
75
cookieTable [ CookieConsentCategory . NECESSARY ] ,
66
76
) ;
67
- } ;
68
77
69
78
export const assembleCategoryAd = (
70
79
title : string ,
71
80
description : string ,
72
81
cookieTable : CookieTableCategories ,
73
- ) : VanillaCookieConsent . ModalBlock => {
74
- return assembleCategoryBlock (
75
- CookieConsentCategory . AD ,
76
- title ,
77
- description ,
78
- false ,
79
- cookieTable [ CookieConsentCategory . AD ] ,
80
- ) ;
81
- } ;
82
+ ) : VanillaCookieConsent . ModalBlock =>
83
+ assembleCategoryBlock ( CookieConsentCategory . AD , title , description , false , cookieTable [ CookieConsentCategory . AD ] ) ;
82
84
83
85
export const assembleCategoryAnalytics = (
84
86
title : string ,
85
87
description : string ,
86
88
cookieTable : CookieTableCategories ,
87
- ) : VanillaCookieConsent . ModalBlock => {
88
- return assembleCategoryBlock (
89
+ ) : VanillaCookieConsent . ModalBlock =>
90
+ assembleCategoryBlock (
89
91
CookieConsentCategory . ANALYTICS ,
90
92
title ,
91
93
description ,
92
94
false ,
93
95
cookieTable [ CookieConsentCategory . ANALYTICS ] ,
94
96
) ;
95
- } ;
96
97
97
98
export const assembleCategoryFunctionality = (
98
99
title : string ,
99
100
description : string ,
100
101
cookieTable : CookieTableCategories ,
101
- ) : VanillaCookieConsent . ModalBlock => {
102
- return assembleCategoryBlock (
102
+ ) : VanillaCookieConsent . ModalBlock =>
103
+ assembleCategoryBlock (
103
104
CookieConsentCategory . FUNCTIONALITY ,
104
105
title ,
105
106
description ,
106
107
false ,
107
108
cookieTable [ CookieConsentCategory . FUNCTIONALITY ] ,
108
109
) ;
109
- } ;
110
110
111
111
export const assembleCategoryPersonalization = (
112
112
title : string ,
113
113
description : string ,
114
114
cookieTable : CookieTableCategories ,
115
- ) : VanillaCookieConsent . ModalBlock => {
116
- return assembleCategoryBlock (
115
+ ) : VanillaCookieConsent . ModalBlock =>
116
+ assembleCategoryBlock (
117
117
CookieConsentCategory . PERSONALIZATION ,
118
118
title ,
119
119
description ,
120
120
false ,
121
121
cookieTable [ CookieConsentCategory . PERSONALIZATION ] ,
122
122
) ;
123
- } ;
124
-
125
- const assembleCategoryBlock = (
126
- category : CookieConsentCategoryValues ,
127
- title : string ,
128
- description : string ,
129
- readonly : boolean ,
130
- cookieTableItems : VanillaCookieConsent . CookieTableItem [ ] | undefined ,
131
- ) : VanillaCookieConsent . ModalBlock => {
132
- return {
133
- title,
134
- description,
135
- toggle : { value : category , enabled : readonly , readonly } ,
136
- ...( cookieTableItems !== undefined && { cookie_table : cookieTableItems } ) ,
137
- } ;
138
- } ;
0 commit comments