File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " pam-react-native" ,
3
- "version" : " 0.1.16 " ,
3
+ "version" : " 0.1.17 " ,
4
4
"description" : " Pam SDK for React Native" ,
5
5
"source" : " ./src/index.tsx" ,
6
6
"main" : " ./lib/commonjs/index.js" ,
Original file line number Diff line number Diff line change @@ -166,6 +166,21 @@ export class PamAPI {
166
166
return result ;
167
167
}
168
168
169
+ async loadPushNotifications (
170
+ database : string ,
171
+ contactID : string
172
+ ) : Promise < PamPushMessage [ ] | null > {
173
+ let response : any ;
174
+ try {
175
+ const url = `/api/app-notifications?_database=${ database } &_contact_id=${ contactID } ` ;
176
+ response = await this . http . get ( url , { } ) ;
177
+ } catch ( e ) { }
178
+ if ( response ) {
179
+ return PamPushMessage . parseFromResponse ( response . items ) ;
180
+ }
181
+ return null ;
182
+ }
183
+
169
184
async loadPushNotificationsFromCustomerID (
170
185
database : string ,
171
186
contactID : string ,
Original file line number Diff line number Diff line change @@ -177,6 +177,15 @@ export class Pam {
177
177
return undefined ;
178
178
}
179
179
180
+ static async loadPushNotifications ( ) : Promise < PamPushMessage [ ] | null > {
181
+ const contactID = Pam . shared ?. contactState ?. getContactId ( ) ;
182
+ const database = Pam . shared ?. contactState ?. getDatabase ( ) ;
183
+ if ( ! contactID || ! database ) {
184
+ return null ;
185
+ }
186
+ return await Pam . pamApi . loadPushNotifications ( database , contactID ) ;
187
+ }
188
+
180
189
static async loadPushNotificationsFromCustomerID (
181
190
customerID : string
182
191
) : Promise < PamPushMessage [ ] | null > {
You can’t perform that action at this time.
0 commit comments