@primer-io/react-native 2.46.0 → 2.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/Sources/RNTPrimer.swift +17 -11
- package/ios/Sources/version.swift +1 -1
- package/package.json +1 -1
|
@@ -67,7 +67,7 @@ enum PrimerEvents: Int, CaseIterable {
|
|
|
67
67
|
// MARK: - INITIALIZATION & REACT NATIVE SUPPORT
|
|
68
68
|
|
|
69
69
|
// In RNTPrimer.swift, add this property
|
|
70
|
-
@objc public weak var eventDelegate: RCTNativePrimer
|
|
70
|
+
@objc public weak var eventDelegate: RCTNativePrimer?
|
|
71
71
|
|
|
72
72
|
deinit {
|
|
73
73
|
print("🧨 deinit: \(self) \(Unmanaged.passUnretained(self).toOpaque())")
|
|
@@ -308,7 +308,7 @@ enum PrimerEvents: Int, CaseIterable {
|
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
private func detectImplemetedCallbacks() {
|
|
311
|
-
eventDelegate
|
|
311
|
+
eventDelegate?.sendEvent(withName: PrimerEvents.detectImplementedRNCallbacks.stringValue, body: nil)
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
@objc
|
|
@@ -351,7 +351,7 @@ enum PrimerEvents: Int, CaseIterable {
|
|
|
351
351
|
let json = try? JSONSerialization.jsonObject(with: data) {
|
|
352
352
|
body["checkoutData"] = json
|
|
353
353
|
}
|
|
354
|
-
self.eventDelegate
|
|
354
|
+
self.eventDelegate?.sendEvent(withName: PrimerEvents.onError.stringValue, body: body)
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
}
|
|
@@ -367,7 +367,10 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
367
367
|
do {
|
|
368
368
|
let checkoutData = try JSONEncoder().encode(data)
|
|
369
369
|
let checkoutJson = try JSONSerialization.jsonObject(with: checkoutData, options: .allowFragments)
|
|
370
|
-
self.eventDelegate
|
|
370
|
+
self.eventDelegate?.sendEvent(
|
|
371
|
+
withName: PrimerEvents.onCheckoutComplete.stringValue,
|
|
372
|
+
body: checkoutJson
|
|
373
|
+
)
|
|
371
374
|
} catch {
|
|
372
375
|
self.handleRNBridgeError(error, checkoutData: data, stopOnDebug: true)
|
|
373
376
|
}
|
|
@@ -390,7 +393,7 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
390
393
|
with: checkoutAdditionalInfo,
|
|
391
394
|
options: .allowFragments
|
|
392
395
|
)
|
|
393
|
-
self.eventDelegate
|
|
396
|
+
self.eventDelegate?.sendEvent(
|
|
394
397
|
withName: PrimerHeadlessUniversalCheckoutEvents.onCheckoutPending.stringValue,
|
|
395
398
|
body: checkoutAdditionalInfoJson
|
|
396
399
|
)
|
|
@@ -432,7 +435,7 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
432
435
|
let checkoutPaymentmethodJson = try data
|
|
433
436
|
.toPrimerCheckoutPaymentMethodDataRN()
|
|
434
437
|
.toJsonObject()
|
|
435
|
-
self.eventDelegate
|
|
438
|
+
self.eventDelegate?.sendEvent(
|
|
436
439
|
withName: PrimerEvents.onBeforePaymentCreate.stringValue,
|
|
437
440
|
body: checkoutPaymentmethodJson
|
|
438
441
|
)
|
|
@@ -451,7 +454,7 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
451
454
|
public func primerClientSessionWillUpdate() {
|
|
452
455
|
if self.implementedRNCallbacks?.isOnBeforeClientSessionUpdateImplemented == true {
|
|
453
456
|
DispatchQueue.main.async {
|
|
454
|
-
self.eventDelegate
|
|
457
|
+
self.eventDelegate?.sendEvent(withName: PrimerEvents.onBeforeClientSessionUpdate.stringValue, body: nil)
|
|
455
458
|
}
|
|
456
459
|
} else {
|
|
457
460
|
// RN Dev hasn't implemented this callback, ignore.
|
|
@@ -464,7 +467,7 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
464
467
|
let data = try JSONEncoder().encode(clientSession)
|
|
465
468
|
let json = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
|
|
466
469
|
DispatchQueue.main.async {
|
|
467
|
-
self.eventDelegate
|
|
470
|
+
self.eventDelegate?.sendEvent(withName: PrimerEvents.onClientSessionUpdate.stringValue, body: json)
|
|
468
471
|
}
|
|
469
472
|
} catch {
|
|
470
473
|
self.handleRNBridgeError(error, checkoutData: nil, stopOnDebug: true)
|
|
@@ -495,7 +498,7 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
495
498
|
let data = try JSONEncoder().encode(paymentMethodTokenData)
|
|
496
499
|
let json = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
|
|
497
500
|
DispatchQueue.main.async {
|
|
498
|
-
self.eventDelegate
|
|
501
|
+
self.eventDelegate?.sendEvent(withName: PrimerEvents.onTokenizeSuccess.stringValue, body: json)
|
|
499
502
|
}
|
|
500
503
|
} catch {
|
|
501
504
|
self.handleRNBridgeError(error, checkoutData: nil, stopOnDebug: true)
|
|
@@ -522,7 +525,10 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
522
525
|
}
|
|
523
526
|
|
|
524
527
|
DispatchQueue.main.async {
|
|
525
|
-
self.eventDelegate
|
|
528
|
+
self.eventDelegate?.sendEvent(
|
|
529
|
+
withName: PrimerEvents.onResumeSuccess.stringValue,
|
|
530
|
+
body: ["resumeToken": resumeToken]
|
|
531
|
+
)
|
|
526
532
|
}
|
|
527
533
|
} else {
|
|
528
534
|
// RN dev hasn't opted in on listening the tokenization callback.
|
|
@@ -533,7 +539,7 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
533
539
|
public func primerDidDismiss() {
|
|
534
540
|
if self.implementedRNCallbacks?.isOnDismissImplemented == true {
|
|
535
541
|
DispatchQueue.main.async {
|
|
536
|
-
self.eventDelegate
|
|
542
|
+
self.eventDelegate?.sendEvent(withName: PrimerEvents.onDismiss.stringValue, body: nil)
|
|
537
543
|
}
|
|
538
544
|
} else {
|
|
539
545
|
// RN dev hasn't opted in on listening SDK dismiss.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// swiftlint:disable:next identifier_name
|
|
2
|
-
public let PrimerReactNativeSDKVersion = "2.46.
|
|
2
|
+
public let PrimerReactNativeSDKVersion = "2.46.1"
|