Skip to content
3 changes: 2 additions & 1 deletion frontend/common/types/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ export type SubscriptionMeta = {
export type Account = {
first_name: string
last_name: string
date_joined: string
sign_up_type: SignupType
id: number
email: string
Expand Down Expand Up @@ -800,7 +801,7 @@ export type Webhook = {
updated_at: string
}

export type AccountModel = User & {
export type AccountModel = Account & {
organisations: Organisation[]
}

Expand Down
7 changes: 5 additions & 2 deletions frontend/common/utils/getUserDisplayName.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { User } from 'common/types/responses'
import { AccountModel, User } from 'common/types/responses'

export default function (user: User | undefined, defaultName = 'Unknown') {
export default function (
user: AccountModel | undefined,
defaultName = 'Unknown',
) {
if (!user) {
return defaultName
}
Expand Down
27 changes: 26 additions & 1 deletion frontend/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,30 @@ type Crisp = {
// The push method accepts a CrispCommand array.
push: (command: CrispCommand) => void
}

declare namespace UniversalAnalytics {
interface PageviewFieldsObject {
hitType: 'pageview' | 'event'
location?: string
page?: string
title?: string
[key: string]: any
}
}
export declare const openModal: (name?: string) => Promise<void>
declare global {
function ga(
command: 'send',
fields: UniversalAnalytics.PageviewFieldsObject,
): void
const $crisp: Crisp
const delighted: {
survey: (opts: {
createdAt: string
email: string
name: string
properties: Record<string, any>
}) => void
}
const openModal: (
title: ReactNode,
body?: ReactNode,
Expand Down Expand Up @@ -52,5 +72,10 @@ declare global {
const Tooltip: FC<TooltipProps>
interface Window {
$crisp: Crisp
engagement: {
init(apiKey: string, options?: InitOptions): void
plugin(): unknown
boot(options: BootOptions): Promise<void>
}
}
}
Loading
Loading