Skip to content

Commit

Permalink
fix typescript types
Browse files Browse the repository at this point in the history
  • Loading branch information
walsh9 committed Oct 19, 2023
1 parent 76dcba6 commit 534ae77
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
10 changes: 8 additions & 2 deletions plugins/4.analytics.client.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { useMembershipStatus } from '~~/composables/states'

type WindowWithDataLayer = Window & {
dataLayer: Record<string, any>[]
}

declare const window: WindowWithDataLayer
declare const dataLayer: Record<string, any>[]

export default defineNuxtPlugin(() => {
const config = useRuntimeConfig()
const membershipStatus = useMembershipStatus()
const { $experiments } = useNuxtApp()

window.dataLayer = window.dataLayer || []
const dataLayer = (window as any).dataLayer

// init gtag function
function gtag(...args) {
dataLayer.push(args)
Expand Down
16 changes: 15 additions & 1 deletion plugins/5.htlbid.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
interface htlbidType {
cmd: (() => void)[]
layout: (string) => void
setTargeting: (keys: string, targetingParams: string[]) => void
clearTargeting: (string) => void
forceRefresh: () => void
}

type WindowWithHtlbid = Window & {
htlbid: htlbidType
}

declare const window: WindowWithHtlbid
declare const htlbid: htlbidType

export default defineNuxtPlugin(() => {
const config = useRuntimeConfig()
useHead({
Expand All @@ -13,7 +28,6 @@ export default defineNuxtPlugin(() => {
})
if (!process.server) {
window.htlbid = window.htlbid || {}
const htlbid = (window as any).htlbid
htlbid.cmd = htlbid.cmd || []

const init = () => {
Expand Down

0 comments on commit 534ae77

Please sign in to comment.