@@ -7,6 +7,7 @@ import { persistentAtom } from '@nanostores/persistent'
77import { StoreController } from '@nanostores/lit'
88import type { ReactiveControllerHost } from 'lit'
99import { validate as uuidValidate } from 'uuid'
10+ import type { ConsentPurpose , ConsentRequest , ConsentSource } from '@actions/gdpr/@types'
1011import { getCookie , removeCookie , setCookie } from '@components/scripts/utils/cookies'
1112import { ClientScriptError } from '@components/scripts/errors'
1213import { handleScriptError } from '@components/scripts/errors/handler'
@@ -377,13 +378,7 @@ export function initConsentSideEffects(): void {
377378 scriptName : 'cookieConsent' ,
378379 operation : 'logConsentToAPI' ,
379380 } as const
380- type ConsentLogPayload = {
381- DataSubjectId : string
382- purposes : string [ ]
383- source : string
384- userAgent : string
385- verified : boolean
386- }
381+ type ConsentLogPayload = Pick < ConsentRequest , 'DataSubjectId' | 'purposes' | 'source' | 'userAgent' | 'verified' >
387382 let queuedConsentLogPayload : ConsentLogPayload | null = null
388383 let hasConsentLoggingFailure = false
389384 let isConsentLogProcessing = false
@@ -564,7 +559,7 @@ export function initConsentSideEffects(): void {
564559 return
565560 }
566561
567- const purposes : string [ ] = [ ]
562+ const purposes : ConsentPurpose [ ] = [ ]
568563 if ( consentState . analytics ) purposes . push ( 'analytics' )
569564 if ( consentState . marketing ) purposes . push ( 'marketing' )
570565 if ( consentState . functional ) purposes . push ( 'functional' )
@@ -579,7 +574,7 @@ export function initConsentSideEffects(): void {
579574 enqueueConsentPayload ( {
580575 DataSubjectId : dataSubjectId ,
581576 purposes,
582- source : 'cookies_modal' ,
577+ source : 'cookies_modal' as ConsentSource ,
583578 userAgent,
584579 verified : false ,
585580 } )
0 commit comments