44 * Uses centralized state management from scripts/store
55 */
66
7+ import { LitElement } from 'lit'
78import type { WebComponentModule } from '@components/scripts/@types/webComponentModule'
89import { isInputElement } from '@components/scripts/assertions/elements'
910import { addButtonEventListeners } from '@components/scripts/elementListeners'
@@ -28,7 +29,9 @@ const COMPONENT_TAG_NAME = 'consent-preferences' as const
2829const COMPONENT_SCRIPT_NAME = 'ConsentPreferencesElement'
2930export const CONSENT_PREFERENCES_READY_EVENT = 'consent-preferences:ready'
3031
31- export class ConsentPreferencesElement extends HTMLElement {
32+ export class ConsentPreferencesElement extends LitElement {
33+ static registeredName = COMPONENT_TAG_NAME
34+
3235 private allowAllBtn ! : HTMLButtonElement
3336 private denyAllBtn ! : HTMLButtonElement
3437 private saveBtn ! : HTMLButtonElement
@@ -38,7 +41,12 @@ export class ConsentPreferencesElement extends HTMLElement {
3841 private unsubscribeConsent : ( ( ) => void ) | null = null
3942 private isInitialized = false
4043
41- connectedCallback ( ) : void {
44+ protected override createRenderRoot ( ) : HTMLElement {
45+ return this
46+ }
47+
48+ override connectedCallback ( ) : void {
49+ super . connectedCallback ( )
4250 if ( typeof document === 'undefined' || this . isInitialized ) {
4351 return
4452 }
@@ -63,7 +71,8 @@ export class ConsentPreferencesElement extends HTMLElement {
6371 }
6472 }
6573
66- disconnectedCallback ( ) : void {
74+ override disconnectedCallback ( ) : void {
75+ super . disconnectedCallback ( )
6776 if ( this . domReadyHandler ) {
6877 document . removeEventListener ( 'DOMContentLoaded' , this . domReadyHandler )
6978 this . domReadyHandler = null
@@ -283,8 +292,10 @@ export const registerConsentPreferencesWebComponent = (tagName: string = COMPONE
283292 defineCustomElement ( tagName , ConsentPreferencesElement )
284293}
285294
295+ export const registerWebComponent = registerConsentPreferencesWebComponent
296+
286297export const webComponentModule : WebComponentModule < ConsentPreferencesElement > = {
287298 registeredName : COMPONENT_TAG_NAME ,
288299 componentCtor : ConsentPreferencesElement ,
289- registerWebComponent : registerConsentPreferencesWebComponent ,
300+ registerWebComponent,
290301}
0 commit comments