@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.
- package/ios/SwanNotificationContentExtension/NotificationViewController.swift +50 -84
- package/ios/SwanNotificationContentExtension/templates/CarouselView.swift +1 -0
- package/lib/commonjs/index.js +16 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/index.js +16 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/module/index.js
CHANGED
|
@@ -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:
|
|
1924
|
+
route: normalizedRoute || undefined,
|
|
1910
1925
|
title: title || undefined,
|
|
1911
1926
|
body: body || undefined,
|
|
1912
1927
|
keyValuePairs: {}
|