@@ -159,7 +159,7 @@ class ReactIterableAPI: RCTEventEmitter {
159159 IterableAPI . track ( pushOpen: campaignId, templateId: templateId, messageId: messageId, appAlreadyRunning: appAlreadyRunning, dataFields: dataFields)
160160 }
161161
162- @objc ( trackPurchaseWithTotal : items: dataFields: )
162+ @objc ( trackPurchase : items: dataFields: )
163163 func trackPurchase( total: NSNumber ,
164164 items: [ [ AnyHashable : Any ] ] ,
165165 dataFields: [ AnyHashable : Any ] ? ) {
@@ -169,14 +169,68 @@ class ReactIterableAPI: RCTEventEmitter {
169169 dataFields: dataFields)
170170 }
171171
172- @objc ( trackInAppOpenWithMessageId: location: )
173- func trackInAppOpen( messageId: String , location number: NSNumber ) {
172+ @objc ( trackInAppOpen: location: )
173+ func trackInAppOpen( messageId: String ,
174+ location locationNumber: NSNumber ) {
174175 ITBInfo ( )
175176 guard let message = IterableAPI . inAppManager. getMessage ( withId: messageId) else {
176177 ITBError ( " Could not find message with id: \( messageId) " )
177178 return
178179 }
179- IterableAPI . track ( inAppOpen: message, location: InAppLocation . from ( number: number) )
180+ IterableAPI . track ( inAppOpen: message, location: InAppLocation . from ( number: locationNumber) )
181+ }
182+
183+ @objc ( trackInAppClick: location: clickedUrl: )
184+ func trackInAppClick( messageId: String ,
185+ location locationNumber: NSNumber ,
186+ clickedUrl: String ) {
187+ ITBInfo ( )
188+ guard let message = IterableAPI . inAppManager. getMessage ( withId: messageId) else {
189+ ITBError ( " Could not find message with id: \( messageId) " )
190+ return
191+ }
192+ IterableAPI . track ( inAppClick: message, location: InAppLocation . from ( number: locationNumber) , clickedUrl: clickedUrl)
193+ }
194+
195+ @objc ( trackInAppClose: location: source: clickedUrl: )
196+ func trackInAppClose( messageId: String ,
197+ location locationNumber: NSNumber ,
198+ source sourceNumber: NSNumber ,
199+ clickedUrl: String ) {
200+ ITBInfo ( )
201+ guard let message = IterableAPI . inAppManager. getMessage ( withId: messageId) else {
202+ ITBError ( " Could not find message with id: \( messageId) " )
203+ return
204+ }
205+ if let inAppCloseSource = InAppCloseSource . from ( number: sourceNumber) {
206+ IterableAPI . track ( inAppClose: message,
207+ location: InAppLocation . from ( number: locationNumber) ,
208+ source: inAppCloseSource,
209+ clickedUrl: clickedUrl)
210+ } else {
211+ IterableAPI . track ( inAppClose: message,
212+ location: InAppLocation . from ( number: locationNumber) ,
213+ clickedUrl: clickedUrl)
214+ }
215+ }
216+
217+ @objc ( inAppConsume: location: source: )
218+ func inAppConsume( messageId: String ,
219+ location locationNumber: NSNumber ,
220+ source sourceNumber: NSNumber ) {
221+ ITBInfo ( )
222+ guard let message = IterableAPI . inAppManager. getMessage ( withId: messageId) else {
223+ ITBError ( " Could not find message with id: \( messageId) " )
224+ return
225+ }
226+ if let inAppDeleteSource = InAppDeleteSource . from ( number: sourceNumber) {
227+ IterableAPI . inAppConsume ( message: message,
228+ location: InAppLocation . from ( number: locationNumber) ,
229+ source: inAppDeleteSource)
230+ } else {
231+ IterableAPI . inAppConsume ( message: message,
232+ location: InAppLocation . from ( number: locationNumber) )
233+ }
180234 }
181235
182236 @objc ( getInAppMessages: rejecter: )
0 commit comments