@loyalytics/swan-react-native-sdk 2.3.1-beta.2 → 2.3.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.
@@ -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="0dp"
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 the deepLinkScheme from the push payload
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 push payload includes `deepLinkScheme`, constructs a URL like
161
- /// `swanexample://product/123?swan_carousel=1&swan_comm_id=abc` and opens it.
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., "/product/123")
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 deepLinkScheme is provided
184
- if let scheme = userInfo["deepLinkScheme"] as? String, !scheme.isEmpty, !route.isEmpty {
185
- // Strip leading "/" from route
186
- let path = route.hasPrefix("/") ? String(route.dropFirst()) : route
187
-
188
- // Parse route to preserve any existing query params (e.g., /product/123?ref=push)
189
- // Use a dummy scheme to make URLComponents parse it correctly
190
- var components = URLComponents(string: "dummy://\(path)") ?? URLComponents()
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
- completion(success)
202
+ DispatchQueue.main.async {
203
+ completion(success)
204
+ }
205
205
  }
206
206
  return
207
207
  }
@@ -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.3.1-beta.2';
11
+ const SDK_VERSION = exports.SDK_VERSION = '2.3.1-beta.3';
12
12
  //# sourceMappingURL=version.js.map
@@ -4,5 +4,5 @@
4
4
  // This file is generated from package.json version during build.
5
5
  // See scripts/generate-version.js
6
6
 
7
- export const SDK_VERSION = '2.3.1-beta.2';
7
+ export const SDK_VERSION = '2.3.1-beta.3';
8
8
  //# sourceMappingURL=version.js.map
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.3.1-beta.2";
1
+ export declare const SDK_VERSION = "2.3.1-beta.3";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.3.1-beta.2";
1
+ export declare const SDK_VERSION = "2.3.1-beta.3";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loyalytics/swan-react-native-sdk",
3
- "version": "2.3.1-beta.2",
3
+ "version": "2.3.1-beta.3",
4
4
  "description": "React Native SDK for Swan",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -340,7 +340,7 @@ function setup() {
340
340
 
341
341
  log('If carousel click routing does not work:', colors.yellow);
342
342
  log(
343
- ' • Push payload must include "deepLinkScheme" (e.g., "swanexample") for per-item routing'
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'