TypeScript Types
Complete TypeScript type definitions for Raven Client.
Core Types
RavenClientOptions
interface RavenClientOptions {
listeners: RavenClientListeners
config: RavenClientConfig
}
RavenClientConfig
interface RavenClientConfig {
baseUrl: string
userId: string | number
appVersion: string
codepushVersion?: string
platform: string
packageName: string
tenantId?: string
}
RavenClientListeners
interface RavenClientListeners {
appEvent: (eventName: string, props?: unknown) => void
getAccessToken: () => AccessToken
}
AccessToken
interface AccessToken {
token: string
tokenType: string
}
Event Types
CTAEvent
type CTAEvent = {
eventName: string
} & {[key: string]: boolean | string | number}
Properties:
eventName: string- Required: The name of the event- Any additional properties of type
boolean | string | numbercan be added as needed
Note: The type allows any properties beyond eventName. You can add any context properties needed for filtering, analytics, or state machine transitions. All properties must be of type boolean | string | number.
CTA Types
Cta
interface Cta {
ctaId: string
rule: {
actions: CtaActionType[]
contextParams: string[]
priority: number
frequency: FrequencyRules
groupByConfig?: GroupByConfig
stateToAction: Record<string, string>
resetStates: string[]
resetCTAonFirstLaunch: boolean
stateTransition: StateTransition
stateMachineTTL: number | null
ctaValidTill: number | null
}
resetAt: number[]
actionDoneAt: number[]
activeStateMachines: ActiveStateMachines
behaviourTagName?: string
}
CtaActionType
type CtaActionType =
| CtaUIAction
| CtaEventAction
| CtaPopupAction
| CtaTooltipAction
ActionType
enum ActionType {
NUDGE = 'NUDGE_UI',
ACTION = 'NUDGE_ACTION',
NUDGE_POPUP = 'POPUP',
TOOLTIP = 'TOOLTIP',
}
State Machine Types
StateMachineObject
interface StateMachineObject {
currentState: string
lastTransitionAt: number
context: Context
createdAt: number
reset: boolean
}
StateTransition
type StateTransition = Record<string, Record<string, Transition[]>>
Transition
interface Transition {
transitionTo: string
filters?: Filters
}
Filter Types
Filters
interface Filters {
operator: OperatorType
filter: (Filter | FilterGroup)[]
}
Filter
interface Filter {
propertyName: string
propertyType: string
comparisonType: ComparisonType
comparisonValue: string | boolean | number
functions?: FilterFunctions
}
ComparisonType
type ComparisonType = '=' | '>' | '<' | '>=' | '<=' | '!='
OperatorType
type OperatorType = 'AND' | 'OR'
Tooltip Types
TooltipOptions
interface TooltipOptions {
title: string
subTitle?: string
targetId: string
position?: 'top' | 'bottom' | 'left' | 'right'
backgroundColor?: string
titleColor?: string
subTitleColor?: string
titleFontSize?: number
subTitleFontSize?: number
titleFontFamily?: string
subTitleFontFamily?: string
titleFontWeight?: 'Bold' | 'Medium' | 'Regular'
subTitleFontWeight?: 'Bold' | 'Medium' | 'Regular'
targetScreen?: string
triggerType?: 'mount' | 'click' | 'event'
triggerDelay?: number
autoDismissMs?: number
dismissOnOutsideTouch?: boolean
titleAlignment?: 'left' | 'center' | 'right'
subTitleAlignment?: 'left' | 'center' | 'right'
arrowSize?: number
borderRadius?: number
paddingLeft?: number
paddingRight?: number
paddingTop?: number
paddingBottom?: number
marginTop?: number
marginBottom?: number
marginLeft?: number
marginRight?: number
}
Storage Types
IStorage
interface IStorage {
get(key: string): Promise<string | null>
set(key: string, value: string): Promise<void>
remove(key: string): Promise<void>
clear(): Promise<void>
}
StorageConfig
interface StorageConfig {
// Storage configuration options
}
Nudge Types
RavenParams
interface RavenParams {
// Nudge parameters
}
Usage
Import types as needed:
import type {
RavenClientOptions,
RavenClientConfig,
CTAEvent,
TooltipOptions,
IStorage,
} from '@dreamhorizonorg/raven-client'
Next Steps
- API Reference - See API documentation
- Quick Start - Use types in your app