@loyalytics/swan-react-native-sdk 2.7.1-beta.1 → 2.7.1-beta.3

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,
@@ -1904,9 +1910,18 @@ export default class SwanSDK {
1904
1910
  this.sendNotificationAck(messageId, 'clicked');
1905
1911
  }
1906
1912
 
1913
+ // Normalize route: strip custom URL schemes (e.g., "swanexample://offer/999" → "offer/999")
1914
+ // iOS carousel routes must be full URLs for Content Extension's extensionContext.open(),
1915
+ // but host apps expect consistent relative routes across all platforms and notification types.
1916
+ // Preserve http:// and https:// — those are web links the host app may open in a browser.
1917
+ let normalizedRoute = route;
1918
+ if (normalizedRoute && normalizedRoute.includes('://') && !normalizedRoute.startsWith('http://') && !normalizedRoute.startsWith('https://')) {
1919
+ normalizedRoute = normalizedRoute.split('://').slice(1).join('://');
1920
+ }
1921
+
1907
1922
  // Emit NOTIFICATION_OPENED event (same as Notifee click handler)
1908
1923
  const deepLinkPayload = {
1909
- route: route || undefined,
1924
+ route: normalizedRoute || undefined,
1910
1925
  title: title || undefined,
1911
1926
  body: body || undefined,
1912
1927
  keyValuePairs: {}