@@ -15,6 +15,8 @@ export type Event =
15
15
| 'userUpdated'
16
16
| 'personalized'
17
17
| 'depersonalized'
18
+ | 'inAppChat.availabilityUpdated'
19
+ | 'inAppChat.unreadMessageCounterUpdated'
18
20
| 'deeplink' ;
19
21
20
22
export interface CustomEvent {
@@ -32,7 +34,7 @@ export interface Configuration {
32
34
/**
33
35
* Message storage save callback
34
36
*/
35
- messageStorage ?: string ;
37
+ messageStorage ?: CustomMessageStorage ;
36
38
defaultMessageStorage ?: boolean ;
37
39
ios ?: {
38
40
notificationTypes ?: string [ ] ; // ['alert', 'badge', 'sound']
@@ -43,6 +45,15 @@ export interface Configuration {
43
45
notificationIcon ?: string ; // a resource name for a status bar icon (without extension), located in '/platforms/android/app/src/main/res/mipmap'
44
46
multipleNotifications ?: boolean ; // set to 'true' to enable multiple notifications
45
47
notificationAccentColor ?: string ; // set to hex color value in format '#RRGGBB' or '#AARRGGBB'
48
+ firebaseOptions ?: {
49
+ apiKey : string ;
50
+ applicationId : string ;
51
+ databaseUrl ?: string ;
52
+ gaTrackingId ?: string ;
53
+ gcmSenderId ?: string ;
54
+ storageBucket ?: string ;
55
+ projectId : string ;
56
+ } ;
46
57
} ;
47
58
privacySettings ?: {
48
59
applicationCodePersistingDisabled ?: boolean ;
@@ -52,10 +63,10 @@ export interface Configuration {
52
63
} ;
53
64
notificationCategories ?: [
54
65
{
55
- identifier ? : string ;
66
+ identifier : string ;
56
67
actions ?: [
57
68
{
58
- identifier ? : string ;
69
+ identifier : string ;
59
70
title ?: string ;
60
71
foreground ?: boolean ;
61
72
authenticationRequired ?: boolean ;
@@ -71,7 +82,7 @@ export interface Configuration {
71
82
}
72
83
73
84
export interface UserData {
74
- externalUserId : string ;
85
+ externalUserId ? : string ;
75
86
firstName ?: string ;
76
87
lastName ?: string ;
77
88
middleName ?: string ;
@@ -117,6 +128,22 @@ export interface PersonalizeContext {
117
128
forceDepersonalize ?: boolean ;
118
129
}
119
130
131
+ export interface GeoData {
132
+ area : GeoArea ;
133
+ }
134
+
135
+ export interface GeoArea {
136
+ id : string ;
137
+ center : GeoCenter ;
138
+ radius : number ;
139
+ title : string ;
140
+ }
141
+
142
+ export interface GeoCenter {
143
+ lat : number ;
144
+ lon : number ;
145
+ }
146
+
120
147
export interface Message {
121
148
messageId : string ;
122
149
title ?: string ;
@@ -138,12 +165,14 @@ export interface Message {
138
165
browserUrl ?: string ;
139
166
deeplink ?: string ;
140
167
webViewUrl ?: string ;
168
+ inAppOpenTitle ?: string | undefined ;
141
169
inAppDismissTitle ?: string ;
142
170
}
143
171
144
172
export interface MobileMessagingError {
145
173
code : string ;
146
- message : string ;
174
+ description : string ;
175
+ domain ?: string ;
147
176
}
148
177
149
178
export interface ChatConfig {
@@ -174,6 +203,62 @@ export class DefaultMessageStorage {
174
203
}
175
204
}
176
205
206
+ export class CustomMessageStorage {
207
+ /**
208
+ * Will be called by the plugin when messages are received and it's time to save them to the storage
209
+ *
210
+ * @param array of message objects to save to storage
211
+ */
212
+ @Cordova ( { sync : true } )
213
+ save ( messages : Message [ ] ) {
214
+ return ;
215
+ }
216
+
217
+ /**
218
+ * Will be called by the plugin to find a message by message id
219
+ *
220
+ * @param callback has to be called on completion with one parameter - found message object
221
+ */
222
+ @Cordova ( { sync : true } )
223
+ find ( messageId : string , callback : ( message : Message ) => void ) {
224
+ return ;
225
+ }
226
+
227
+ /**
228
+ * Will be called by the plugin to find all messages in the storage
229
+ *
230
+ * @param callback has to be called on completion with one parameter - an array of available messages
231
+ */
232
+ @Cordova ( { sync : true } )
233
+ findAll ( callback : ( messages : Message [ ] ) => void ) {
234
+ return ;
235
+ }
236
+
237
+ /**
238
+ * Will be called by the plugin when its time to initialize the storage
239
+ */
240
+ @Cordova ( { sync : true } )
241
+ start ( ) {
242
+ return ;
243
+ }
244
+
245
+ /**
246
+ * Will be called by the plugin when its time to deinitialize the storage
247
+ */
248
+ @Cordova ( { sync : true } )
249
+ stop ( ) {
250
+ return ;
251
+ }
252
+ }
253
+
254
+ export interface ChatSettingsIOS {
255
+ title : string ;
256
+ sendButtonColor : string ;
257
+ navigationBarItemsColor : string ;
258
+ navigationBarColor : string ;
259
+ navigationBarTitleColor : string ;
260
+ }
261
+
177
262
/**
178
263
* @name Mobile Messaging
179
264
* @description
@@ -472,4 +557,33 @@ export class MobileMessaging extends AwesomeCordovaNativePlugin {
472
557
showChat ( config ?: ChatConfig ) : Promise < any > {
473
558
return ;
474
559
}
560
+
561
+ /**
562
+ * Setup chat settings for iOS only
563
+ *
564
+ * @param settings
565
+ */
566
+ @Cordova ( )
567
+ setupiOSChatSettings ( settings : ChatSettingsIOS ) : Promise < any > {
568
+ return ;
569
+ }
570
+
571
+ /**
572
+ * Returns unread in-app chat push messages counter.
573
+ * The counter increments each time the application receives in-app chat push message
574
+ * (this usually happens when chat screen is inactive or the application is in background/terminated state).
575
+ */
576
+ @Cordova ( { sync : true } )
577
+ getMessageCounter ( onResult : ( counter : number ) => void ) {
578
+ return ;
579
+ }
580
+
581
+ /**
582
+ * MobileMessaging plugin automatically resets the counter to 0 whenever user opens the in-app chat screen.
583
+ * However, use the following API in case you need to manually reset the counter.
584
+ */
585
+ @Cordova ( )
586
+ resetMessageCounter ( ) {
587
+ return ;
588
+ }
475
589
}
0 commit comments