rampkit-expo-dev 0.0.72 → 0.0.73
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/build/RampKit.js +2 -0
- package/ios/RampKitModule.swift +29 -26
- package/package.json +1 -1
package/build/RampKit.js
CHANGED
|
@@ -308,6 +308,8 @@ class RampKitCore {
|
|
|
308
308
|
// Track onboarding completed - trigger: paywall_shown
|
|
309
309
|
EventManager_1.eventManager.trackOnboardingCompleted("paywall_shown", screens.length, // We don't know exact step, use total
|
|
310
310
|
screens.length, onboardingId);
|
|
311
|
+
// Auto-recheck transactions after paywall shown (catches purchases made during onboarding)
|
|
312
|
+
RampKitNative_1.TransactionObserver.recheck().catch(() => { });
|
|
311
313
|
// Call the original callback
|
|
312
314
|
const paywallCallback = (opts === null || opts === void 0 ? void 0 : opts.onShowPaywall) || (opts === null || opts === void 0 ? void 0 : opts.showPaywall) || this.onShowPaywall;
|
|
313
315
|
try {
|
package/ios/RampKitModule.swift
CHANGED
|
@@ -553,30 +553,34 @@ public class RampKitModule: Module {
|
|
|
553
553
|
|
|
554
554
|
// Check if we've already tracked this transaction
|
|
555
555
|
// "Tracked" means we successfully sent a purchase_completed event to the backend
|
|
556
|
-
// and received an HTTP 2xx response. We store the
|
|
557
|
-
|
|
556
|
+
// and received an HTTP 2xx response. We store the transactionId after success.
|
|
557
|
+
// NOTE: We track by transactionId (not originalTransactionId) so renewals are also sent.
|
|
558
|
+
if trackedTransactionIds.contains(transactionId) {
|
|
558
559
|
trackedCount += 1
|
|
559
560
|
txDetails["status"] = "already_sent"
|
|
560
561
|
alreadyTrackedDetails.append(txDetails)
|
|
561
562
|
print("[RampKit] ✅ STATUS: ALREADY SENT TO BACKEND")
|
|
562
|
-
print("[RampKit] (
|
|
563
|
+
print("[RampKit] (transactionId \(transactionId) is in our sent-transactions storage)")
|
|
563
564
|
print("[RampKit] This means we previously sent a purchase_completed event")
|
|
564
565
|
print("[RampKit] and received a successful HTTP 2xx response.")
|
|
565
566
|
print("[RampKit] ")
|
|
566
567
|
continue
|
|
567
568
|
}
|
|
568
569
|
|
|
569
|
-
// Skip renewals
|
|
570
|
-
|
|
571
|
-
transaction.revocationDate == nil else {
|
|
572
|
-
let reason = transaction.revocationDate != nil ? "revoked" : "renewal"
|
|
570
|
+
// Skip revocations only (NOT renewals - we want to track renewals too!)
|
|
571
|
+
if transaction.revocationDate != nil {
|
|
573
572
|
txDetails["status"] = "skipped"
|
|
574
|
-
txDetails["reason"] =
|
|
573
|
+
txDetails["reason"] = "revoked"
|
|
575
574
|
skippedReasons.append(txDetails)
|
|
576
|
-
print("[RampKit] ⏭️ STATUS: Skipped (
|
|
575
|
+
print("[RampKit] ⏭️ STATUS: Skipped (revoked)")
|
|
577
576
|
continue
|
|
578
577
|
}
|
|
579
578
|
|
|
579
|
+
// Log if this is a renewal
|
|
580
|
+
if transaction.originalID != transaction.id {
|
|
581
|
+
print("[RampKit] ℹ️ This is a RENEWAL (originalID != transactionID)")
|
|
582
|
+
}
|
|
583
|
+
|
|
580
584
|
// NEW transaction we haven't seen!
|
|
581
585
|
newCount += 1
|
|
582
586
|
newProductIds.append(transaction.productID)
|
|
@@ -588,10 +592,10 @@ public class RampKitModule: Module {
|
|
|
588
592
|
|
|
589
593
|
// Only mark as tracked if send succeeded
|
|
590
594
|
if let status = sendResult["status"] as? String, status == "sent" {
|
|
591
|
-
trackedTransactionIds.insert(
|
|
595
|
+
trackedTransactionIds.insert(transactionId)
|
|
592
596
|
saveTrackedTransactions()
|
|
593
597
|
print("[RampKit] ✅ Event sent successfully! HTTP status: \(sendResult["httpStatus"] ?? "unknown")")
|
|
594
|
-
print("[RampKit] ✅ Marked
|
|
598
|
+
print("[RampKit] ✅ Marked transactionId \(transactionId) as tracked")
|
|
595
599
|
} else {
|
|
596
600
|
print("[RampKit] ❌ Send failed: \(sendResult["error"] ?? "unknown error")")
|
|
597
601
|
print("[RampKit] ⚠️ Will retry on next app launch")
|
|
@@ -645,39 +649,38 @@ public class RampKitModule: Module {
|
|
|
645
649
|
continue
|
|
646
650
|
}
|
|
647
651
|
|
|
652
|
+
let transactionId = String(transaction.id)
|
|
648
653
|
let originalId = String(transaction.originalID)
|
|
649
654
|
|
|
650
|
-
// Skip if already tracked
|
|
651
|
-
if self.trackedTransactionIds.contains(
|
|
652
|
-
print("[RampKit] ✓ Transaction.updates: Already tracked \(transaction.productID)")
|
|
653
|
-
await transaction.finish()
|
|
654
|
-
continue
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
// Skip renewals - backend gets these from App Store S2S notifications
|
|
658
|
-
if transaction.originalID != transaction.id {
|
|
659
|
-
print("[RampKit] ⏭️ Transaction.updates: skipped (renewal) \(transaction.productID)")
|
|
655
|
+
// Skip if already tracked (by transactionId, not originalId - so renewals are tracked)
|
|
656
|
+
if self.trackedTransactionIds.contains(transactionId) {
|
|
657
|
+
print("[RampKit] ✓ Transaction.updates: Already tracked \(transaction.productID) (txId: \(transactionId))")
|
|
660
658
|
await transaction.finish()
|
|
661
659
|
continue
|
|
662
660
|
}
|
|
663
661
|
|
|
664
|
-
// Skip revocations -
|
|
662
|
+
// Skip revocations only (NOT renewals - we want to track renewals!)
|
|
665
663
|
if transaction.revocationDate != nil {
|
|
666
664
|
print("[RampKit] ⏭️ Transaction.updates: skipped (revoked) \(transaction.productID)")
|
|
667
665
|
await transaction.finish()
|
|
668
666
|
continue
|
|
669
667
|
}
|
|
670
668
|
|
|
671
|
-
|
|
669
|
+
// Log if this is a renewal
|
|
670
|
+
if transaction.originalID != transaction.id {
|
|
671
|
+
print("[RampKit] 🔄 Transaction.updates: RENEWAL detected for \(transaction.productID)")
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
print("[RampKit] 🆕 Transaction.updates: NEW transaction \(transaction.productID) (txId: \(transactionId))")
|
|
672
675
|
|
|
673
676
|
// Track it and check result
|
|
674
677
|
let sendResult = await self.handleTransactionWithResult(transaction)
|
|
675
678
|
|
|
676
|
-
// Only mark as tracked if send succeeded
|
|
679
|
+
// Only mark as tracked if send succeeded (use transactionId for renewals support)
|
|
677
680
|
if let status = sendResult["status"] as? String, status == "sent" {
|
|
678
|
-
self.trackedTransactionIds.insert(
|
|
681
|
+
self.trackedTransactionIds.insert(transactionId)
|
|
679
682
|
self.saveTrackedTransactions()
|
|
680
|
-
print("[RampKit] ✅ Transaction.updates: Sent and tracked \(transaction.productID)")
|
|
683
|
+
print("[RampKit] ✅ Transaction.updates: Sent and tracked \(transaction.productID) (txId: \(transactionId))")
|
|
681
684
|
} else {
|
|
682
685
|
print("[RampKit] ⚠️ Transaction.updates: Send failed, will retry \(transaction.productID)")
|
|
683
686
|
}
|
package/package.json
CHANGED