@@ -38,101 +38,85 @@ export const assembleSecondaryButton = (
3838 secondaryButtonMode : Values < typeof SecondaryButtonMode > ,
3939 textAcceptNecessary : string ,
4040 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+ } ) ;
5048
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+ } ) ;
5464
5565export const assembleCategoryNecessary = (
5666 title : string ,
5767 description : string ,
5868 cookieTable : CookieTableCategories ,
59- ) : VanillaCookieConsent . ModalBlock => {
60- return assembleCategoryBlock (
69+ ) : VanillaCookieConsent . ModalBlock =>
70+ assembleCategoryBlock (
6171 CookieConsentCategory . NECESSARY ,
6272 title ,
6373 description ,
6474 true ,
6575 cookieTable [ CookieConsentCategory . NECESSARY ] ,
6676 ) ;
67- } ;
6877
6978export const assembleCategoryAd = (
7079 title : string ,
7180 description : string ,
7281 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 ] ) ;
8284
8385export const assembleCategoryAnalytics = (
8486 title : string ,
8587 description : string ,
8688 cookieTable : CookieTableCategories ,
87- ) : VanillaCookieConsent . ModalBlock => {
88- return assembleCategoryBlock (
89+ ) : VanillaCookieConsent . ModalBlock =>
90+ assembleCategoryBlock (
8991 CookieConsentCategory . ANALYTICS ,
9092 title ,
9193 description ,
9294 false ,
9395 cookieTable [ CookieConsentCategory . ANALYTICS ] ,
9496 ) ;
95- } ;
9697
9798export const assembleCategoryFunctionality = (
9899 title : string ,
99100 description : string ,
100101 cookieTable : CookieTableCategories ,
101- ) : VanillaCookieConsent . ModalBlock => {
102- return assembleCategoryBlock (
102+ ) : VanillaCookieConsent . ModalBlock =>
103+ assembleCategoryBlock (
103104 CookieConsentCategory . FUNCTIONALITY ,
104105 title ,
105106 description ,
106107 false ,
107108 cookieTable [ CookieConsentCategory . FUNCTIONALITY ] ,
108109 ) ;
109- } ;
110110
111111export const assembleCategoryPersonalization = (
112112 title : string ,
113113 description : string ,
114114 cookieTable : CookieTableCategories ,
115- ) : VanillaCookieConsent . ModalBlock => {
116- return assembleCategoryBlock (
115+ ) : VanillaCookieConsent . ModalBlock =>
116+ assembleCategoryBlock (
117117 CookieConsentCategory . PERSONALIZATION ,
118118 title ,
119119 description ,
120120 false ,
121121 cookieTable [ CookieConsentCategory . PERSONALIZATION ] ,
122122 ) ;
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