@loyalytics/swan-react-native-sdk 2.3.1-beta.2 → 2.4.0
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/android/src/main/res/layout/swan_carousel_expanded.xml +1 -3
- package/ios/SwanNotificationContentExtension/NotificationViewController.swift +15 -15
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/commonjs/src/version.d.ts +1 -1
- package/lib/typescript/commonjs/src/version.d.ts.map +1 -1
- package/lib/typescript/module/src/version.d.ts +1 -1
- package/lib/typescript/module/src/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/setup-ios-extension.js +1 -1
|
@@ -41,9 +41,7 @@
|
|
|
41
41
|
<RelativeLayout
|
|
42
42
|
android:id="@+id/swan_carousel_image_section"
|
|
43
43
|
android:layout_width="match_parent"
|
|
44
|
-
android:layout_height="
|
|
45
|
-
android:layout_weight="1"
|
|
46
|
-
android:minHeight="144dp">
|
|
44
|
+
android:layout_height="144dp">
|
|
47
45
|
|
|
48
46
|
<!-- Center ViewFlipper (all images pre-loaded) -->
|
|
49
47
|
<ViewFlipper
|
|
@@ -13,7 +13,7 @@ import UserNotificationsUI
|
|
|
13
13
|
* User interaction:
|
|
14
14
|
* - Swipe left/right on the carousel to navigate between items
|
|
15
15
|
* - Tap on the carousel image to open the deep link for the current item
|
|
16
|
-
* - Deep link uses extensionContext.open(URL) with
|
|
16
|
+
* - Deep link uses extensionContext.open(URL) with full URLs from carousel item routes
|
|
17
17
|
*
|
|
18
18
|
* Action button identifiers (reserved for future use if categories are registered):
|
|
19
19
|
* - swan_prev: Navigate to previous carousel item
|
|
@@ -157,13 +157,12 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
|
|
157
157
|
// MARK: - Deep Link via URL (CleverTap pattern)
|
|
158
158
|
|
|
159
159
|
/// Try to open a deep link URL directly from the Content Extension.
|
|
160
|
-
/// If the
|
|
161
|
-
///
|
|
162
|
-
/// On failure, falls back to saving click data to App Group.
|
|
160
|
+
/// If the route is a full URL (contains "://"), appends swan_ tracking params and opens it.
|
|
161
|
+
/// On failure or relative routes, falls back to saving click data to App Group.
|
|
163
162
|
///
|
|
164
163
|
/// - Parameters:
|
|
165
164
|
/// - itemIndex: Current carousel item index
|
|
166
|
-
/// - itemRoute: Route from the tapped carousel item (e.g., "
|
|
165
|
+
/// - itemRoute: Route from the tapped carousel item (e.g., "swanexample://product/123")
|
|
167
166
|
/// - userInfo: Push notification payload
|
|
168
167
|
/// - completion: Called with `true` if openURL succeeded, `false` if fell back
|
|
169
168
|
private func openDeepLink(
|
|
@@ -180,15 +179,14 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
|
|
180
179
|
// Writing before the async call guarantees the data is persisted.
|
|
181
180
|
saveClickData(messageId: messageId, itemIndex: itemIndex, route: route)
|
|
182
181
|
|
|
183
|
-
// Try openURL if
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
components.scheme = scheme
|
|
182
|
+
// Try openURL if route is a full URL (contains "://")
|
|
183
|
+
// URL construction logic mirrors SwanParsers.buildCarouselDeepLinkURL()
|
|
184
|
+
// If changing this logic, update SwanParsers.swift too (and vice versa)
|
|
185
|
+
if !route.isEmpty, route.contains("://") {
|
|
186
|
+
guard var components = URLComponents(string: route) else {
|
|
187
|
+
completion(false)
|
|
188
|
+
return
|
|
189
|
+
}
|
|
192
190
|
|
|
193
191
|
// Merge swan_ tracking params with any existing query params from the route
|
|
194
192
|
var queryItems = components.queryItems ?? []
|
|
@@ -201,7 +199,9 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
|
|
|
201
199
|
|
|
202
200
|
if let url = components.url {
|
|
203
201
|
self.extensionContext?.open(url) { success in
|
|
204
|
-
|
|
202
|
+
DispatchQueue.main.async {
|
|
203
|
+
completion(success)
|
|
204
|
+
}
|
|
205
205
|
}
|
|
206
206
|
return
|
|
207
207
|
}
|
package/lib/commonjs/version.js
CHANGED
|
@@ -8,5 +8,5 @@ exports.SDK_VERSION = void 0;
|
|
|
8
8
|
// This file is generated from package.json version during build.
|
|
9
9
|
// See scripts/generate-version.js
|
|
10
10
|
|
|
11
|
-
const SDK_VERSION = exports.SDK_VERSION = '2.
|
|
11
|
+
const SDK_VERSION = exports.SDK_VERSION = '2.4.0';
|
|
12
12
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SDK_VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,
|
|
1
|
+
{"version":3,"names":["SDK_VERSION","exports"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEO,MAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,OAAO","ignoreList":[]}
|
package/lib/module/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SDK_VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,OAAO,MAAMA,WAAW,GAAG,
|
|
1
|
+
{"version":3,"names":["SDK_VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,OAAO,MAAMA,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,UAAU,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.
|
|
1
|
+
export declare const SDK_VERSION = "2.4.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/version.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -340,7 +340,7 @@ function setup() {
|
|
|
340
340
|
|
|
341
341
|
log('If carousel click routing does not work:', colors.yellow);
|
|
342
342
|
log(
|
|
343
|
-
' •
|
|
343
|
+
' • Carousel items must contain full deep link URLs in "route" (e.g., "swanexample://product/123")'
|
|
344
344
|
);
|
|
345
345
|
log(
|
|
346
346
|
' • Verify CODE_SIGN_ENTITLEMENTS is set for the Content Extension target in Build Settings'
|