File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " pam-react-native" ,
3- "version" : " 0.1.16 " ,
3+ "version" : " 0.1.17 " ,
44 "description" : " Pam SDK for React Native" ,
55 "source" : " ./src/index.tsx" ,
66 "main" : " ./lib/commonjs/index.js" ,
Original file line number Diff line number Diff line change @@ -166,6 +166,21 @@ export class PamAPI {
166166 return result ;
167167 }
168168
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+
169184 async loadPushNotificationsFromCustomerID (
170185 database : string ,
171186 contactID : string ,
Original file line number Diff line number Diff line change @@ -177,6 +177,15 @@ export class Pam {
177177 return undefined ;
178178 }
179179
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+
180189 static async loadPushNotificationsFromCustomerID (
181190 customerID : string
182191 ) : Promise < PamPushMessage [ ] | null > {
You can’t perform that action at this time.
0 commit comments