-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
150 lines (132 loc) · 3.85 KB
/
Copy pathindex.d.ts
File metadata and controls
150 lines (132 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
// Type definitions for @hellotext/hellotext
export interface HellotextConfig {
forms?: {
autoMount?: boolean
successMessage?: boolean | string
}
webchat?: false | HellotextWebchatConfig
session?: string
autoGenerateSession?: boolean
}
export type HellotextWebchatMode = 'modal' | 'popover'
export type HellotextWebchatStrategy = 'absolute' | 'fixed'
export type HellotextWebchatBehaviourTrigger = 'onClick' | 'onLoad'
export interface HellotextWebchatBehaviour {
trigger: HellotextWebchatBehaviourTrigger
delaySeconds: 0 | 5 | 10 | 30
firstVisitOnly: boolean
oncePerSession: boolean
}
export interface HellotextWebchatAppearance {
header?: {
name?: string | null
}
launcher?: {
iconUrl?: string | null
}
}
export interface HellotextWebchatWhatsApp {
number?: string | null
restrictToChannel?: boolean | null
}
export interface HellotextWebchatConfig {
id?: string
container?: string
placement?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
mode?: HellotextWebchatMode
behaviour?: HellotextWebchatBehaviour
style?: {
primaryColor?: string
secondaryColor?: string
typography?: string
}
appearance?: HellotextWebchatAppearance
whatsapp?: HellotextWebchatWhatsApp
strategy?: HellotextWebchatStrategy
}
export interface HellotextBusinessCountry {
code?: string
prefix?: string
[key: string]: any
}
export interface HellotextBusinessData {
id?: string
country?: HellotextBusinessCountry | string
features?: Record<string, any>
locale?: string
style_url?: string
webchat?: HellotextWebchatConfig | null
whitelist?: string | string[] | null
subscription?: string | null
[key: string]: any
}
export interface HellotextBusiness {
id: string
data: HellotextBusinessData | null
readonly subscription: string | null | undefined
readonly country: HellotextBusinessCountry | string | undefined
readonly enabledWhitelist: boolean
readonly locale: any
readonly features: Record<string, any> | null | undefined
hydrate(): Promise<HellotextBusinessData | null>
setData(data: HellotextBusinessData): void
setLocale(locale: string): void
}
export interface TrackingParams {
amount?: number
currency?: string
metadata?: Record<string, any>
tracked_at?: number
url?: string
headers?: Record<string, string>
object?: string
object_parameters?: Record<string, any>
object_type?: string
}
export interface IdentificationOptions {
email?: string
phone?: string
name?: string
source?: string
}
export interface IdentificationData {
id: string
source?: string
}
export interface Response {
data: any
succeeded: boolean
failed: boolean
}
declare class Hellotext {
static initialize(businessId: string, config?: HellotextConfig): Promise<void>
static track(action: string, params?: TrackingParams): Promise<Response>
static identify(userId: string, options?: IdentificationOptions): Promise<Response>
static forget(): void
static on(event: string, callback: (data: any) => void): void
static removeEventListener(event: string, callback: (data: any) => void): void
static get session(): string
static get isInitialized(): boolean
static forms: any
static business: HellotextBusiness
static webchat: any
}
export declare class User {
static get id(): string | undefined
static get source(): string | undefined
static get fingerprint(): string | undefined
static remember(id: string, source?: string, fingerprint?: string): void
static forget(): void
static get identificationData(): IdentificationData | Record<string, never>
}
export declare class Cookies {
static get(name: string): string | undefined
static set(name: string, value: string): string
static delete(name: string): void
}
export default Hellotext
// Declare the CSS module
declare module '@hellotext/hellotext/styles/index.css' {
const styles: string
export default styles
}