@loyalytics/swan-react-native-sdk 2.7.1-beta.2 → 2.7.1-beta.4

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.
@@ -1876,6 +1876,12 @@ export default class SwanSDK {
1876
1876
  }
1877
1877
  }
1878
1878
  if (!clickData) return;
1879
+
1880
+ // Discard stale click data (>60s old) from a previous session
1881
+ if (clickData.timestamp && Date.now() / 1000 - clickData.timestamp > 60) {
1882
+ Logger.log('[SwanSDK] Stale carousel click data (>60s old), discarding');
1883
+ return;
1884
+ }
1879
1885
  Logger.log('[SwanSDK] Pending carousel click found:', JSON.stringify(clickData));
1880
1886
  const {
1881
1887
  messageId,
@@ -3823,12 +3829,6 @@ export function createNotificationOpenedHandler() {
3823
3829
  const customMessageId = notificationData.messageId;
3824
3830
  const dedupId = customMessageId || messageId;
3825
3831
 
3826
- // Deduplication: prevent double click handling
3827
- if (dedupId && !markClickProcessed(dedupId)) {
3828
- Logger.log('[SwanSDK] Click already processed for messageId:', dedupId);
3829
- return;
3830
- }
3831
-
3832
3832
  // If onNotificationOpenedApp fires, it means iOS displayed the notification
3833
3833
  // natively (aps.alert present). Notifee handlers won't fire for iOS-native
3834
3834
  // notifications, so this handler MUST process the click.
@@ -3888,6 +3888,14 @@ export function createNotificationOpenedHandler() {
3888
3888
  Logger.warn('[SwanSDK] Failed to peek Content Extension click data:', err);
3889
3889
  }
3890
3890
  }
3891
+
3892
+ // Deduplication: prevent double click handling.
3893
+ // Placed AFTER carousel defer check — if we defer to checkPendingCarouselClick,
3894
+ // we must NOT mark the ID as processed or checkPendingCarouselClick will skip it.
3895
+ if (dedupId && !markClickProcessed(dedupId)) {
3896
+ Logger.log('[SwanSDK] Click already processed for messageId:', dedupId);
3897
+ return;
3898
+ }
3891
3899
  const deepLinkPayload = {
3892
3900
  ...notificationData,
3893
3901
  route,