Skip to content

Commit 47860e2

Browse files
committed
refactor: update trackPurchase method to public in ReactIterableAPI and enhance Objective-C bridge for improved purchase tracking functionality
1 parent a41410c commit 47860e2

4 files changed

Lines changed: 15 additions & 7 deletions

File tree

ios/RNIterableAPI/RNIterableAPI.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ - (void)updateCart:(NSArray *)items
210210
[_swiftAPI updateCart:items];
211211
}
212212

213+
- (void)trackPurchase:(NSNumber *)total
214+
items:(NSArray *)items
215+
dataFields:(NSDictionary *)dataFields
216+
{
217+
NSLog(@"ReactNativeSdk trackPurchase");
218+
[_swiftAPI trackPurchase:total items:items dataFields:dataFields];
219+
}
220+
213221
@end
214222

215223

ios/RNIterableAPI/ReactIterableAPI.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ open class ReactIterableAPI: RCTEventEmitter {
206206
}
207207

208208
@objc(trackPurchase:items:dataFields:)
209-
func trackPurchase(
209+
public func trackPurchase(
210210
total: NSNumber,
211211
items: [[AnyHashable: Any]],
212212
dataFields: [AnyHashable: Any]?

src/api/NativeRNIterableAPI.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ export interface Spec extends TurboModule {
8181

8282
// Commerce
8383
updateCart(items: { [key: string]: string | number | boolean }[]): void;
84-
// trackPurchase(
85-
// total: number,
86-
// items: { [key: string]: string | number | boolean }[],
87-
// dataFields?: { [key: string]: string | number | boolean }
88-
// ): void;
84+
trackPurchase(
85+
total: number,
86+
items: { [key: string]: string | number | boolean }[],
87+
dataFields?: { [key: string]: string | number | boolean }
88+
): void;
8989

9090
// // User data
9191
// updateUser(

src/core/classes/Iterable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ export class Iterable {
499499
) {
500500
Iterable?.logger?.log('trackPurchase');
501501

502-
RNIterableAPI.trackPurchase(total, items, dataFields);
502+
api.trackPurchase(total, items, dataFields);
503503
}
504504

505505
/**

0 commit comments

Comments
 (0)