87
87
getCookieIds(localCookiesEnabled)?.includes(
88
88
getCookieId(cookie)
89
89
) ||
90
- (Cookies.get(
91
- moduleOptions.cookieNameIsConsentGiven
92
- ) !== 'true' &&
90
+ (getCookie(moduleOptions.cookieNameIsConsentGiven) !==
91
+ 'true' &&
93
92
typeof moduleOptions.isIframeBlocked === 'object' &&
94
93
moduleOptions.isIframeBlocked.initialState)
95
94
"
162
161
</template >
163
162
164
163
<script setup lang="ts">
165
- import Cookies from ' js-cookie'
166
164
import { ref , computed , onBeforeMount , watch } from ' vue'
167
165
168
166
import { Cookie , CookieType , Locale , Translatable } from ' ../types'
169
- import { getCookieId , getCookieIds , useResolveTranslatable } from ' ../methods'
167
+ import {
168
+ getCookie ,
169
+ getCookieId ,
170
+ getCookieIds ,
171
+ removeCookie ,
172
+ setCookie ,
173
+ useResolveTranslatable ,
174
+ } from ' ../methods'
170
175
171
176
import { useCookieControl } from ' #imports'
172
177
@@ -301,7 +306,7 @@ onBeforeMount(async () => {
301
306
isColorsSet .value = true
302
307
}
303
308
304
- if (Cookies . get (moduleOptions .cookieNameIsConsentGiven ) === ' true' ) {
309
+ if (getCookie (moduleOptions .cookieNameIsConsentGiven ) === ' true' ) {
305
310
for (const cookieOptional of moduleOptions .cookies .optional ) {
306
311
if (
307
312
typeof moduleOptions .isIframeBlocked === ' boolean'
@@ -319,7 +324,7 @@ watch(
319
324
localCookiesEnabled .value = [... (current || [])]
320
325
321
326
if (isConsentGiven .value ) {
322
- Cookies . set (
327
+ setCookie (
323
328
moduleOptions .cookieNameCookiesEnabledIds ,
324
329
getCookieIds (current || []).join (' ,' ),
325
330
{
@@ -335,7 +340,7 @@ watch(
335
340
document .getElementsByTagName (' head' )[0 ].appendChild (script )
336
341
}
337
342
} else {
338
- Cookies . remove (moduleOptions .cookieNameCookiesEnabledIds )
343
+ removeCookie (moduleOptions .cookieNameCookiesEnabledIds )
339
344
}
340
345
341
346
// delete formerly enabled cookies that are now disabled
@@ -347,7 +352,7 @@ watch(
347
352
if (! cookieOptionalDisabled .targetCookieIds ) continue
348
353
349
354
for (const cookieOptionalDisabledId of cookieOptionalDisabled .targetCookieIds ) {
350
- Cookies . remove (cookieOptionalDisabledId )
355
+ removeCookie (cookieOptionalDisabledId )
351
356
}
352
357
353
358
if (cookieOptionalDisabled .src ) {
@@ -365,9 +370,9 @@ watch(
365
370
)
366
371
watch (isConsentGiven , (current , _previous ) => {
367
372
if (current === undefined ) {
368
- Cookies . remove (moduleOptions .cookieNameIsConsentGiven )
373
+ removeCookie (moduleOptions .cookieNameIsConsentGiven )
369
374
} else {
370
- Cookies . set (moduleOptions .cookieNameIsConsentGiven , current .toString (), {
375
+ setCookie (moduleOptions .cookieNameIsConsentGiven , current .toString (), {
371
376
expires ,
372
377
})
373
378
}
0 commit comments