Skip to content

Commit

Permalink
fix: imports
Browse files Browse the repository at this point in the history
  • Loading branch information
VmMad committed Oct 7, 2024
1 parent fdbec73 commit 17bab9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { initServices, stopServices } from '$lib/app/services'
import { showCookieDisclaimer, setNecessaryCookies } from '$lib/app/store'
import { showCookieDisclaimer, submitNecessaryCookies } from '$lib/app/store'
import type { SKCMConfiguration } from '$core/types'
import { getInlineStyle } from '$core/utils'
import { AdditionalCookies, Button, NecessaryCookies } from '../'
Expand All @@ -17,7 +17,7 @@
function updatePreferences(): void {
if (hasAllowedCookies !== undefined) {
setNecessaryCookies(hasAllowedCookies)
submitNecessaryCookies(hasAllowedCookies)
hasAllowedCookies === 'true' ? initServices() : stopServices()
showCookieDisclaimer.set(false)
}
Expand Down
22 changes: 9 additions & 13 deletions cookie-manager/sveltekit/src/lib/components/CookieManager.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@
showCookieDisclaimer,
hasAllNeededNecessaryCookies,
isServiceEnabled,
setNecessaryCookies,
configuredServices,
necessaryCookies
necessaryCookies,
submitNecessaryCookies
} from '$lib/app/store'
import { onMount } from 'svelte'
import { Disclaimer } from './'
import { initConfiguredServices } from '$core/services'
import { initializeConfiguredServices } from '$core/services'
export let configuration: SKCMConfiguration
$: ({ googleAnalyticsUniversalId, googleAnalytics4Id, customNecessaryCookies, adCookiesEnabled } =
configuration?.services ?? {})
$: ({ googleAnalyticsUniversalId, googleAnalytics4Id } = configuration?.services ?? {})
// TODO: improve this
$: if ($page?.url.pathname) {
Expand All @@ -34,17 +33,14 @@
}
onMount(() => {
function onServicesInitialized(services: Service[], cookies: ServiceCookie[]): void {
function onConfiguredServicesInitialized(services: Service[], cookies: ServiceCookie[]): void {
configuredServices.set(services)
necessaryCookies.set(cookies)
}
initConfiguredServices({
googleAnalyticsUniversalId,
googleAnalytics4Id,
customNecessaryCookies,
adCookiesEnabled,
onServicesInitialized
initializeConfiguredServices({
services: configuration.services,
onConfiguredServicesInitialized
})
if (hasAllNeededNecessaryCookies()) {
Expand All @@ -55,7 +51,7 @@
})
function handleSubmitNecessaryCookies(value: 'true' | 'false'): void {
setNecessaryCookies(value)
submitNecessaryCookies(value)
if (value === 'true') {
initServices()
}
Expand Down

0 comments on commit 17bab9c

Please sign in to comment.