react-native-notifyvisitors 4.5.2 → 4.6.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.
Files changed (72) hide show
  1. package/android/build.gradle +5 -6
  2. package/android/src/main/java/com/rn_notifyvisitors/RNNotifyVisitorsEmbedViewManager.java +73 -0
  3. package/android/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsModule.java +41 -3
  4. package/android/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsPackage.java +5 -2
  5. package/index.d.ts +15 -0
  6. package/index.js +48 -1
  7. package/ios/RNNotifyvisitors/RCTNVEventEmitter.m +79 -1
  8. package/ios/RNNotifyvisitors/RNNVExtensionService.h +0 -1
  9. package/ios/RNNotifyvisitors/RNNVNativeDisplayView.h +25 -0
  10. package/ios/RNNotifyvisitors/RNNVNativeDisplayView.m +92 -0
  11. package/ios/RNNotifyvisitors/RNNVNativeDisplayViewManager.h +14 -0
  12. package/ios/RNNotifyvisitors/RNNVNativeDisplayViewManager.m +27 -0
  13. package/ios/RNNotifyvisitors/RNNotifyvisitors.h +0 -2
  14. package/ios/RNNotifyvisitors/RNNotifyvisitors.m +2 -2
  15. package/ios/RNNotifyvisitors.xcodeproj/project.pbxproj +8 -4
  16. package/ios/notifyvisitors.xcframework/Info.plist +5 -5
  17. package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/Headers/notifyvisitors.h +6 -1
  18. package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/Info.plist +0 -0
  19. package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/_CodeSignature/CodeResources +3 -3
  20. package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/notifyvisitors +0 -0
  21. package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/Headers/notifyvisitors.h +6 -1
  22. package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/Resources/Info.plist +2 -2
  23. package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/_CodeSignature/CodeResources +3 -3
  24. package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitors.framework/Versions/A/notifyvisitors +0 -0
  25. package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/Headers/notifyvisitors.h +6 -1
  26. package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/Info.plist +0 -0
  27. package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/_CodeSignature/CodeResources +3 -3
  28. package/ios/notifyvisitors.xcframework/ios-arm64_x86_64-simulator/notifyvisitors.framework/notifyvisitors +0 -0
  29. package/ios/notifyvisitorsNudges.xcframework/Info.plist +61 -0
  30. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Headers/notifyvisitorsNudges-Swift.h +354 -0
  31. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Headers/notifyvisitorsNudges.h +18 -0
  32. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Info.plist +0 -0
  33. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Modules/module.modulemap +11 -0
  34. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios.abi.json +2155 -0
  35. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios.private.swiftinterface +42 -0
  36. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  37. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios.swiftinterface +42 -0
  38. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/notifyvisitorsNudges +0 -0
  39. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Headers/notifyvisitorsNudges-Swift.h +704 -0
  40. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Headers/notifyvisitorsNudges.h +18 -0
  41. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/module.modulemap +11 -0
  42. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-macabi.abi.json +2155 -0
  43. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-macabi.swiftdoc +0 -0
  44. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-macabi.swiftinterface +42 -0
  45. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-macabi.abi.json +2155 -0
  46. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-macabi.swiftdoc +0 -0
  47. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-macabi.swiftinterface +42 -0
  48. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Resources/Info.plist +50 -0
  49. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/notifyvisitorsNudges +0 -0
  50. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Headers/notifyvisitorsNudges-Swift.h +704 -0
  51. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Headers/notifyvisitorsNudges.h +18 -0
  52. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Info.plist +0 -0
  53. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/module.modulemap +11 -0
  54. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-simulator.abi.json +2155 -0
  55. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +42 -0
  56. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  57. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-simulator.swiftinterface +42 -0
  58. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-simulator.abi.json +2155 -0
  59. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +42 -0
  60. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  61. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +42 -0
  62. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/_CodeSignature/CodeResources +245 -0
  63. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/notifyvisitorsNudges +0 -0
  64. package/package.json +1 -1
  65. package/react-native-notifyvisitors.podspec +3 -1
  66. package/android/bin/.project +0 -34
  67. package/android/bin/.settings/org.eclipse.buildship.core.prefs +0 -13
  68. package/android/bin/build.gradle +0 -45
  69. package/android/bin/src/main/AndroidManifest.xml +0 -24
  70. package/android/bin/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsModule.class +0 -0
  71. package/android/bin/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsPackage.class +0 -0
  72. package/android/bin/src/main/res/values/strings.xml +0 -3
@@ -12,12 +12,12 @@ buildscript {
12
12
  }
13
13
 
14
14
  android {
15
- compileSdk safeExtGet('compileSdk', 34)
15
+ compileSdk safeExtGet('compileSdk', 35)
16
16
  namespace = "com.rn_notifyvisitors"
17
17
 
18
18
  defaultConfig {
19
19
  minSdkVersion safeExtGet('minSdkVersion', 23)
20
- targetSdkVersion safeExtGet('targetSdkVersion', 34)
20
+ targetSdkVersion safeExtGet('targetSdkVersion', 35)
21
21
  }
22
22
 
23
23
  buildTypes {
@@ -35,10 +35,9 @@ android {
35
35
  dependencies {
36
36
  implementation fileTree(dir: 'libs', include: ['*.jar'])
37
37
  implementation 'com.facebook.react:react-native:+'
38
- implementation('com.notifyvisitors.notifyvisitors:notifyvisitors:v5.5.3.1') {
39
- exclude group: 'com.google.firebase', module: 'firebase-core'
40
- }
41
- implementation platform('com.google.firebase:firebase-bom:30.3.1')
38
+ implementation('com.notifyvisitors.notifyvisitors:notifyvisitors:v5.6.0')
39
+ implementation("com.notifyvisitors.nudges:notifyvisitors-nudges:v0.0.8")
40
+ implementation platform('com.google.firebase:firebase-bom:33.16.0')
42
41
  implementation ('com.google.firebase:firebase-messaging')
43
42
  implementation ('com.google.android.gms:play-services-location')
44
43
  }
@@ -0,0 +1,73 @@
1
+ package com.rn_notifyvisitors;
2
+
3
+ import android.util.Log;
4
+ import android.view.View;
5
+ import android.view.ViewGroup;
6
+
7
+ import androidx.annotation.NonNull;
8
+
9
+ import com.facebook.react.bridge.Arguments;
10
+ import com.facebook.react.bridge.WritableMap;
11
+ import com.facebook.react.common.MapBuilder;
12
+ import com.facebook.react.uimanager.SimpleViewManager;
13
+ import com.facebook.react.uimanager.ThemedReactContext;
14
+ import com.facebook.react.uimanager.annotations.ReactProp;
15
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
16
+ import com.facebook.react.uimanager.events.RCTEventEmitter;
17
+
18
+ import com.notifyvisitors.notifyvisitors.NotifyVisitorsApi;
19
+ import com.notifyvisitors.nudges.NotifyVisitorsNativeDisplay;
20
+
21
+ import java.util.HashMap;
22
+ import java.util.Map;
23
+
24
+
25
+ public class RNNotifyVisitorsEmbedViewManager extends SimpleViewManager<NotifyVisitorsNativeDisplay> {
26
+ public static final String REACT_CLASS = "NotifyvisitorsNativeDisplay";
27
+
28
+ @NonNull
29
+ @Override
30
+ public String getName() {
31
+ return REACT_CLASS;
32
+ }
33
+
34
+ @NonNull
35
+ @Override
36
+ protected NotifyVisitorsNativeDisplay createViewInstance(@NonNull ThemedReactContext themedReactContext) {
37
+ NotifyVisitorsNativeDisplay nativeDisplay = new NotifyVisitorsNativeDisplay(themedReactContext);
38
+ nativeDisplay.setVisibility(View.INVISIBLE);
39
+ nativeDisplay.setLayoutParams(new ViewGroup.LayoutParams(0, 0));
40
+
41
+ NotifyVisitorsApi.getInstance(themedReactContext).nudgeUiFinalized(info -> {
42
+ WritableMap event = Arguments.createMap();
43
+ event.putString("data", info.toString());
44
+ // Log.d("RNNotifyVisitors", "Nudge UI finalized with info: " + info.toString());
45
+
46
+ // 🔑 Ensure event fires only after view is mounted
47
+ nativeDisplay.post(() -> {
48
+ themedReactContext
49
+ .getJSModule(RCTEventEmitter.class)
50
+ .receiveEvent(nativeDisplay.getId(), "onNudgeUiFinalized", event);
51
+ });
52
+ });
53
+
54
+ return nativeDisplay;
55
+
56
+ }
57
+
58
+ @ReactProp(name = "propertyName")
59
+ public void setPropertyName(NotifyVisitorsNativeDisplay view, String propertyName) {
60
+ view.loadContent(propertyName);
61
+ }
62
+
63
+ @Override
64
+ public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
65
+ final Map<String, Object> eventMap = new HashMap<>();
66
+ final Map<String, String> registration = new HashMap<>();
67
+ registration.put("registrationName", "onNudgeUiFinalized");
68
+
69
+ eventMap.put("topNudgeUiFinalized", registration);
70
+ return eventMap;
71
+ }
72
+
73
+ }
@@ -26,6 +26,7 @@ import com.notifyvisitors.notifyvisitors.interfaces.NotificationListDetailsCallb
26
26
  import com.notifyvisitors.notifyvisitors.interfaces.OnCenterCountListener;
27
27
  import com.notifyvisitors.notifyvisitors.interfaces.OnCenterDataListener;
28
28
  import com.notifyvisitors.notifyvisitors.interfaces.OnEventTrackListener;
29
+ import com.notifyvisitors.notifyvisitors.interfaces.OnNotificationClicksHandler;
29
30
  import com.notifyvisitors.notifyvisitors.interfaces.OnPushRuntimePermission;
30
31
  import com.notifyvisitors.notifyvisitors.permission.NVPopupDesign;
31
32
  import com.notifyvisitors.notifyvisitors.push.NVNotificationChannels;
@@ -49,7 +50,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
49
50
 
50
51
  private final ReactApplicationContext reactContext;
51
52
  private static final String TAG = "RN-NotifyVisitors";
52
- private static final String PLUGIN_VERSION = "4.5.2";
53
+ private static final String PLUGIN_VERSION = "4.6.0";
53
54
 
54
55
  private String PUSH_BANNER_CLICK_EVENT = "nv_push_banner_click";
55
56
  private String CHAT_BOT_BUTTON_CLICK = "nv_chat_bot_button_click";
@@ -59,6 +60,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
59
60
  private String COMMON_SHOW_EVENT_CALLBACK = "nv_common_show_event_callback";
60
61
  private String CENTER_CALLBACK = "nv_center_callback";
61
62
  private String KNOWN_USER_IDENTIFIED_CALLBACK = "nv_known_user_identified_callback";
63
+ private String NV_NOTIFICATION_CLICK_CALLBACK = "nv_notification_click_callback";
62
64
 
63
65
  String finalData;
64
66
 
@@ -67,6 +69,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
67
69
  Callback commonCallback;
68
70
  Callback centerCallback;
69
71
  Callback onKnownUserIdentifiedCallback;
72
+ Callback onNotificationClickCallback;
70
73
 
71
74
  private String tab1Label, tab1Name;
72
75
  private String tab2Label, tab2Name;
@@ -105,7 +108,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
105
108
  try {
106
109
  Log.i(TAG, "INITIALIZE");
107
110
  Log.i(TAG, "RN-NV PLUGIN VERSION : " + PLUGIN_VERSION);
108
- Activity currentActivity = getCurrentActivity();
111
+ Activity currentActivity = reactContext.getCurrentActivity();
109
112
  if (currentActivity != null) {
110
113
  Intent intent = currentActivity.getIntent();
111
114
  if (intent != null) {
@@ -222,6 +225,41 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
222
225
  }
223
226
  }
224
227
 
228
+ @ReactMethod
229
+ public void getSessionData(final Callback callback) {
230
+ try {
231
+ Log.i(TAG, "GET SESSION DATA !!");
232
+ JSONObject data = NotifyVisitorsApi.getInstance(reactContext).getSessionData();
233
+ if (data != null) {
234
+ callback.invoke(data.toString());
235
+ } else {
236
+ callback.invoke("unavailable");
237
+ }
238
+
239
+ } catch (Exception e) {
240
+ Log.i(TAG, "GET SESSION DATA ERROR : " + e);
241
+ }
242
+ }
243
+
244
+ @ReactMethod
245
+ public void notificationClickCallback(final Callback callback) {
246
+ onNotificationClickCallback = callback;
247
+
248
+ try {
249
+ Log.i(TAG, "NOTIFICATION CLICK CALLBACK !!");
250
+ NotifyVisitorsApi.getInstance(reactContext).notificationClickCallback(new OnNotificationClicksHandler() {
251
+ @Override
252
+ public void onClick(JSONObject jsonObject) {
253
+ if (jsonObject != null) {
254
+ sendEvent(NV_NOTIFICATION_CLICK_CALLBACK, jsonObject.toString());
255
+ }
256
+ }
257
+ });
258
+ } catch (Exception e) {
259
+ Log.i(TAG, "NOTIFICATION CLICK CALLBACK ERROR : " + e);
260
+ }
261
+ }
262
+
225
263
  @ReactMethod
226
264
  public void showInAppMessage(ReadableMap tokens, ReadableMap customObjects, final String fragmentName, Callback callback) {
227
265
  try {
@@ -724,7 +762,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
724
762
  if (screenName == null || screenName.equalsIgnoreCase("empty")) {
725
763
  Log.i(TAG, "SCREEN NAME IS MISSING");
726
764
  } else {
727
- mActivity = getCurrentActivity();
765
+ //mActivity = getCurrentActivity();
728
766
  mActivity = reactContext.getCurrentActivity();
729
767
  if (mActivity != null) {
730
768
  mActivity.runOnUiThread(new Runnable() {
@@ -9,6 +9,7 @@ import com.facebook.react.bridge.NativeModule;
9
9
  import com.facebook.react.bridge.ReactApplicationContext;
10
10
  import com.facebook.react.uimanager.ViewManager;
11
11
  import com.facebook.react.bridge.JavaScriptModule;
12
+ import androidx.annotation.NonNull;
12
13
 
13
14
  public class RNNotifyvisitorsPackage implements ReactPackage {
14
15
  @Override
@@ -22,7 +23,9 @@ public class RNNotifyvisitorsPackage implements ReactPackage {
22
23
  }
23
24
 
24
25
  @Override
25
- public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
26
- return Collections.emptyList();
26
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
27
+ return Arrays.asList(
28
+ new RNNotifyVisitorsEmbedViewManager() // This should include NotifyvisitorsNativeDisplay
29
+ );
27
30
  }
28
31
  }
package/index.d.ts CHANGED
@@ -98,6 +98,10 @@ export default class Notifyvisitors {
98
98
  screenName: String
99
99
  ): void;
100
100
 
101
+ static getSessionData(nvCallback: any): void;
102
+
103
+ static notificationClickCallback(callback: any): void;
104
+
101
105
  /* 10 - iOS Specific methods */
102
106
  static scrollViewDidScroll_iOS_only(): void;
103
107
  // static promptForPushNotificationsWithUserResponse(callback: any): void;
@@ -124,3 +128,14 @@ export class PushPromptInfo {
124
128
  resumeInDays: String;
125
129
  numberOfTimesPerSession: String;
126
130
  }
131
+
132
+ export type NudgeUiFinalizedEvent = {
133
+ data: string; // Always present (stringified JSON from native)
134
+ };
135
+
136
+ export type NotifyvisitorsNativeDisplayProps = ViewProps & {
137
+ propertyName: string;
138
+ onNudgeUiFinalized?: (event: { response: NudgeUiFinalizedEvent }) => void;
139
+ };
140
+
141
+ export declare const NotifyvisitorsNativeDisplay: React.FC<NotifyvisitorsNativeDisplayProps>;
package/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- import { NativeModules, NativeEventEmitter, Platform } from "react-native";
3
+ import { NativeModules, NativeEventEmitter, Platform, requireNativeComponent } from "react-native";
4
+
5
+ const NotifyvisitorsNativeDisplayView = requireNativeComponent('NotifyvisitorsNativeDisplay');
4
6
 
5
7
  const { RNNotifyvisitors } = NativeModules;
6
8
  const nvEventEmitter = new NativeEventEmitter(RNNotifyvisitors);
@@ -13,6 +15,7 @@ const NV_CALLBACKS = {
13
15
  NV_EVENT_SURVEY: "nv_common_show_event_callback",
14
16
  NV_CENTER: "nv_center_callback",
15
17
  NV_KNOWN_USER_IDENTIFIED: "nv_known_user_identified_callback",
18
+ NV_NOTIFICATION_CLICK_CALLBACK: "nv_notification_click_callback",
16
19
  };
17
20
 
18
21
  const CALLBACKS_STACK = {};
@@ -105,6 +108,25 @@ export default class Notifyvisitors {
105
108
  }
106
109
  }
107
110
 
111
+ static notificationClickCallback(nvCallback) {
112
+ console.log("NV- Notification Click Callback !!");
113
+ try {
114
+ CALLBACKS_STACK[NV_CALLBACKS.NV_NOTIFICATION_CLICK_CALLBACK] = nvCallback;
115
+ RNNotifyvisitors.notificationClickCallback(nvCallback);
116
+ } catch (e) {
117
+ console.log(e);
118
+ }
119
+ }
120
+
121
+ static getSessionData(nvCallback) {
122
+ console.log("NV- Get Session Data !!");
123
+ try {
124
+ RNNotifyvisitors.getSessionData(nvCallback);
125
+ } catch (e) {
126
+ console.log(e);
127
+ }
128
+ }
129
+
108
130
  /* 3 - Event Tracking */
109
131
  static event(eventName, attributes, ltv, scope, nvCallback) {
110
132
  console.log("NV- Events !!");
@@ -525,3 +547,28 @@ export class PushPromptInfo {
525
547
  this.numberOfTimesPerSession = "2";
526
548
  }
527
549
  }
550
+
551
+ const NotifyvisitorsNativeDisplay = (props) => {
552
+ const { onNudgeUiFinalized, ...rest } = props;
553
+
554
+ const handleEvent = (event) => {
555
+ let data = event.nativeEvent?.data;
556
+ //console.log("Nudge UI finalized with event: ", event);
557
+ //console.log("Nudge UI finalized with event.nativeEvent: ", event.nativeEvent);
558
+ console.log("Nudge UI finalized with data: ", data);
559
+
560
+ const finalEvent = {
561
+ data,
562
+ };
563
+ console.log("Final Event: ", finalEvent);
564
+
565
+ if (onNudgeUiFinalized) {
566
+ onNudgeUiFinalized({ response: finalEvent });
567
+ }
568
+ };
569
+ return (<NotifyvisitorsNativeDisplayView {...rest}
570
+ onNudgeUiFinalized={handleEvent} />);
571
+ };
572
+
573
+ // Wrapper component
574
+ export { NotifyvisitorsNativeDisplay };
@@ -10,6 +10,7 @@ RCTResponseSenderBlock eventCallback;
10
10
  RCTResponseSenderBlock commonCallback;
11
11
  RCTResponseSenderBlock onKnownUserFoundCallback = NULL;
12
12
  RCTResponseSenderBlock notificationCenterCallback = NULL;
13
+ RCTResponseSenderBlock onNotificationClickCallback = NULL;
13
14
 
14
15
  BOOL nvInAppFound = false;
15
16
 
@@ -49,7 +50,7 @@ RCT_EXPORT_MODULE(RNNotifyvisitors);
49
50
  #pragma mark - React-Native List of supported callback names
50
51
 
51
52
  - (NSArray<NSString *> *)supportedEvents {
52
- return @[@"nv_push_banner_click", @"nv_chat_bot_button_click", @"nv_show_callback", @"nv_event_callback", @"nv_common_show_event_callback", @"nv_center_callback", @"nv_known_user_identified_callback"];
53
+ return @[@"nv_push_banner_click", @"nv_chat_bot_button_click", @"nv_show_callback", @"nv_event_callback", @"nv_common_show_event_callback", @"nv_center_callback", @"nv_known_user_identified_callback", @"nv_notification_click_callback"];
53
54
  }
54
55
 
55
56
  // Will be called when this module's first listener is added.
@@ -885,6 +886,64 @@ RCT_EXPORT_METHOD(getLinkInfo) {
885
886
  }
886
887
  }
887
888
 
889
+ -(void)notifyvisitorsNudgeUiFinalized:(NSDictionary *)callback {
890
+ NSLog(@"RN-NotifyVisitors : NUDGE-UI-FINALIZED !!");
891
+ @try {
892
+ if([callback count] > 0){
893
+ NSError *nvError = nil;
894
+ NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: callback options: NSJSONWritingPrettyPrinted error: &nvError];
895
+ NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
896
+ if ([nvJsonString length] > 0 && ![nvJsonString isEqualToString: @""] && ![nvJsonString isEqual: [NSNull null]]) {
897
+ [[NSNotificationCenter defaultCenter] postNotificationName: @"nv_rn_nudges_ui_finalized" object: nil userInfo: @{@"data": nvJsonString}];
898
+ }
899
+ }
900
+ }
901
+ @catch (NSException *exception) {
902
+ NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
903
+ }
904
+ }
905
+
906
+ /* 20 - known user identified */
907
+ RCT_EXPORT_METHOD(notificationClickCallback:(RCTResponseSenderBlock)nvcallback) {
908
+ @try{
909
+ NSLog(@"RN-NotifyVisitors : NOTIFICATION CLICK CALLBACK !!");
910
+ onNotificationClickCallback = nvcallback;
911
+ nvPushObserverReady = YES;
912
+ [[NSNotificationCenter defaultCenter] addObserverForName: @"nvNotificationClickCallback" object: nil queue: nil usingBlock: ^(NSNotification *notification) {
913
+ NSDictionary *nvUserInfo = [notification userInfo];
914
+ if ([nvUserInfo count] > 0) {
915
+ NSError *nvError = nil;
916
+ NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: nvUserInfo options: NSJSONWritingPrettyPrinted error: &nvError];
917
+ NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
918
+ [self sendEventWithName:@"nv_notification_click_callback" body: @{@"data": nvJsonString}];
919
+ }
920
+ }];
921
+ }
922
+ @catch(NSException *exception){
923
+ NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
924
+ }
925
+ }
926
+
927
+ //RCT_EXPORT_METHOD(notificationClickCallback) {
928
+ // @try{
929
+ // NSLog(@"RN-NotifyVisitors : notificationClickCallback() !!");
930
+ // nvPushObserverReady = YES;
931
+ // [[NSNotificationCenter defaultCenter] addObserverForName: @"nvNotificationClickCallback" object: nil queue: nil usingBlock: ^(NSNotification *notification) {
932
+ // NSDictionary *nvUserInfo = [notification userInfo];
933
+ // if ([nvUserInfo count] > 0) {
934
+ // NSError *nvError = nil;
935
+ // NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: nvUserInfo options: NSJSONWritingPrettyPrinted error: &nvError];
936
+ // NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
937
+ // [self sendEventWithName:@"nv_notification_click_callback" body: @{@"data": nvJsonString}];
938
+ // }
939
+ // }];
940
+ //
941
+ // }
942
+ // @catch(NSException *exception){
943
+ // NSLog(@"RN-NotifyVisitors ERROR : %@", exception.reason);
944
+ // }
945
+ //}
946
+
888
947
  #pragma mark - Other Methods
889
948
 
890
949
  /* 23 - REQUEST INAPP REVIEW */
@@ -898,6 +957,25 @@ RCT_EXPORT_METHOD(requestInAppReview: (RCTResponseSenderBlock) callback) {
898
957
  }
899
958
  }
900
959
 
960
+ /* 24 - Get Session Data */
961
+ RCT_EXPORT_METHOD(getSessionData: (RCTResponseSenderBlock)callback) {
962
+ @try{
963
+ NSLog(@"RN-NotifyVisitors : GET SESSION DATA !!");
964
+ NSDictionary * nvSessionDataResponse = [notifyvisitors getSessionData];
965
+ if ([nvSessionDataResponse count] > 0) {
966
+ NSError *nvError = nil;
967
+ NSData *nvJsonData = [NSJSONSerialization dataWithJSONObject: nvSessionDataResponse options: NSJSONWritingPrettyPrinted error: &nvError];
968
+ NSString *nvJsonString = [[NSString alloc] initWithData: nvJsonData encoding: NSUTF8StringEncoding];
969
+ callback(@[nvJsonString, [NSNull null]]);
970
+ } else {
971
+ callback(@[@"null", [NSNull null]]);
972
+ }
973
+ }
974
+ @catch(NSException *exception){
975
+ NSLog(@"RN-NotifyVisitors GET SESSION DATA ERROR : %@", exception.reason);
976
+ }
977
+ }
978
+
901
979
  -(UIColor*)GetColor:(NSString *)ColorString {
902
980
  if ([[ColorString substringToIndex:1]isEqualToString:@"#"]) {
903
981
  unsigned int c;
@@ -5,5 +5,4 @@
5
5
 
6
6
  +(void)LoadAttachmentWithRequest: (UNNotificationRequest *_Nullable)request BestAttemptContent: (UNMutableNotificationContent *_Nullable)bestAttemptContent withContentHandler: (void (^_Nullable)(UNNotificationContent * _Nonnull))contentHandler API_AVAILABLE(ios(10.0));
7
7
 
8
-
9
8
  @end
@@ -0,0 +1,25 @@
1
+ //
2
+ // RNNVNativeDisplayView.h
3
+ // react-native-notifyvisitors
4
+ //
5
+ // Created by Notifyvisitors Macbook Air 4 on 30/08/25.
6
+ //
7
+
8
+ #import <React/RCTComponent.h>
9
+ #import <UIKit/UIKit.h>
10
+
11
+ #if __has_include(<notifyvisitorsNudges/notifyvisitorsNudges-Swift.h>)
12
+ #import <notifyvisitorsNudges/notifyvisitorsNudges-Swift.h>
13
+ #else
14
+ #import "../notifyvisitorsNudges-Swift.h"
15
+ #endif
16
+
17
+
18
+ @interface RNNVNativeDisplayView : UIView
19
+
20
+ @property (nonatomic, copy) RCTDirectEventBlock onNudgeUiFinalized;
21
+ @property (strong, nonatomic) NSString * propertyName;
22
+ @property(nonatomic, strong) notifyvisitorsNativeDisplay *nvNudgesNativeDisplay;
23
+ //@property(nonatomic, strong) UIView * _Nullable nvContainerView;
24
+
25
+ @end
@@ -0,0 +1,92 @@
1
+ //
2
+ // RNNVNativeDisplayView.m
3
+ // react-native-notifyvisitors
4
+ //
5
+ // Created by Notifyvisitors Macbook Air 4 on 30/08/25.
6
+ //
7
+
8
+ #import "RNNVNativeDisplayView.h"
9
+
10
+ NSInteger nvIsDataReadyTimerCount = 0;
11
+ @implementation RNNVNativeDisplayView
12
+
13
+ - (instancetype)initWithFrame:(CGRect)frame {
14
+ self = [super initWithFrame:frame];
15
+ if (self) {
16
+ self.backgroundColor = [UIColor clearColor];
17
+ self.nvNudgesNativeDisplay = [[notifyvisitorsNativeDisplay alloc] init];
18
+ // Register for your custom notification
19
+ [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(handleNotification:) name: @"nv_rn_nudges_ui_finalized" object: nil];
20
+ }
21
+ return self;
22
+ }
23
+
24
+ - (void)dealloc {
25
+ [[NSNotificationCenter defaultCenter] removeObserver: self];
26
+ }
27
+
28
+ -(void)setPropertyName:(NSString *)propertyName {
29
+ _propertyName = propertyName;
30
+ NSString *rnNVUserDefaultSuitName = @"com.notifyvisitors.ios.sdk";
31
+ NSUserDefaults *rnNVUserDefaults = [[NSUserDefaults alloc] initWithSuiteName: rnNVUserDefaultSuitName];
32
+ if ([rnNVUserDefaults boolForKey: @"nv_BrandSettingsFileUpdated"]) {
33
+ NSLog(@"RN-NotifyVisitors : Native Display Data found load content now");
34
+ [self loadContentForNativeDisplay];
35
+ } else {
36
+ NSLog(@"RN-NotifyVisitors : Native Display Data not found, retry getting it and load content");
37
+ dispatch_time_t delay = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC));
38
+ dispatch_after(delay, dispatch_get_main_queue(), ^{
39
+ [self loadContentForNativeDisplay];
40
+ });
41
+ }
42
+ }
43
+
44
+ - (void)loadContentForNativeDisplay {
45
+ if ([self.propertyName length] > 0 && ![self.propertyName isEqualToString: @""] && ![self.propertyName isEqual: [NSNull null]]) {
46
+ dispatch_async(dispatch_get_main_queue(), ^{
47
+ NSLog(@"RN-NotifyVisitors : load Native Display for property name = %@", self.propertyName);
48
+ UIView *nvNativeDisplayCardView = [self.nvNudgesNativeDisplay loadContentForPropertyName: self.propertyName];
49
+ nvNativeDisplayCardView.translatesAutoresizingMaskIntoConstraints = YES; // ✅ VERY IMPORTANT
50
+ // Match parent bounds dynamically
51
+ nvNativeDisplayCardView.frame = self.bounds;
52
+ nvNativeDisplayCardView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
53
+ [self.subviews makeObjectsPerformSelector: @selector(removeFromSuperview)];
54
+ [self setUserInteractionEnabled: YES];
55
+ [self addSubview: nvNativeDisplayCardView];
56
+ });
57
+ } else {
58
+ NSLog(@"RN-NotifyVisitors : missing parameter propertyName not found or empty");
59
+ dispatch_async(dispatch_get_main_queue(), ^{
60
+ UIView *nvEmptyDisplayView = [[UIView alloc] init];
61
+ nvEmptyDisplayView.backgroundColor = [UIColor clearColor];
62
+ // Match parent bounds dynamically
63
+ nvEmptyDisplayView.frame = self.bounds;
64
+ nvEmptyDisplayView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
65
+ [self.subviews makeObjectsPerformSelector: @selector(removeFromSuperview)];
66
+ [self setUserInteractionEnabled: YES];
67
+ [self addSubview: nvEmptyDisplayView];
68
+ });
69
+ }
70
+ }
71
+
72
+
73
+ // Handle the notification
74
+ - (void)handleNotification:(NSNotification *)notification {
75
+ NSLog(@"RN-NotifyVisitors : native Display UI Finalized");
76
+ if (self.onNudgeUiFinalized) {
77
+ NSDictionary *nvNativeDisplayOnUIFinished = notification.userInfo;
78
+ NSString *nvJsonString = @"";
79
+ if ([nvNativeDisplayOnUIFinished count] > 0) {
80
+
81
+ if (nvNativeDisplayOnUIFinished[@"data"]) {
82
+ nvJsonString = [NSString stringWithFormat: @"%@", nvNativeDisplayOnUIFinished[@"data"]];
83
+ }
84
+ if ([nvJsonString length] > 0 && ![nvJsonString isEqualToString: @""] && ![nvJsonString isEqual: [NSNull null]]) {
85
+ self.onNudgeUiFinalized(@{@"data": nvJsonString});
86
+ }
87
+ }
88
+
89
+ }
90
+ }
91
+
92
+ @end
@@ -0,0 +1,14 @@
1
+ //
2
+ // RNNVNativeDisplayViewManager.h
3
+ // react-native-notifyvisitors
4
+ //
5
+ // Created by Notifyvisitors Macbook Air 4 on 02/08/25.
6
+ //
7
+
8
+ #import "RCTViewManager.h"
9
+
10
+ @interface RNNVNativeDisplayViewManager : RCTViewManager
11
+
12
+
13
+
14
+ @end
@@ -0,0 +1,27 @@
1
+ //
2
+ // RNNVNativeDisplayViewManager.m
3
+ // react-native-notifyvisitors
4
+ //
5
+ // Created by Notifyvisitors Macbook Air 4 on 02/08/25.
6
+ //
7
+
8
+ #import "RNNVNativeDisplayViewManager.h"
9
+ #import "RNNVNativeDisplayView.h"
10
+
11
+
12
+ @implementation RNNVNativeDisplayViewManager
13
+
14
+ RCT_EXPORT_MODULE(NotifyvisitorsNativeDisplay) // Name used in JS class
15
+
16
+ // Create the native view
17
+ - (UIView *)view {
18
+ return [[RNNVNativeDisplayView alloc] initWithFrame: CGRectZero];
19
+ }
20
+
21
+ // Expose prop to JS
22
+ RCT_EXPORT_VIEW_PROPERTY(propertyName, NSString)
23
+
24
+ // Expose the callback
25
+ RCT_EXPORT_VIEW_PROPERTY(onNudgeUiFinalized, RCTDirectEventBlock)
26
+
27
+ @end
@@ -9,8 +9,6 @@
9
9
  #import "UserNotifications.h"
10
10
  #endif
11
11
 
12
-
13
-
14
12
  extern BOOL nvPushObserverReady;
15
13
 
16
14
  @interface RNNotifyvisitors : NSObject <UNUserNotificationCenterDelegate>
@@ -23,7 +23,7 @@ int nvCheckPushClickTimeCounter = 0;
23
23
 
24
24
  @implementation RNNotifyvisitors
25
25
 
26
- static NSString *const kNVPluginVersion = @"4.5.2";
26
+ static NSString *const kNVPluginVersion = @"4.6.0";
27
27
 
28
28
  - (dispatch_queue_t)methodQueue{
29
29
  return dispatch_get_main_queue();
@@ -56,7 +56,7 @@ NSLog(@"RN-NotifyVisitors PLUGIN VERSION : %@ !!", kNVPluginVersion);
56
56
  [notifyvisitors initializeWithBrandId: brandID secretKey: secretKey appMode: nvMode launchingOptions: launchingOptions];
57
57
  }
58
58
 
59
- +(void)Initialize{
59
+ +(void)Initialize {
60
60
  NSLog(@"RN-NotifyVisitors : INITIALIZE !!");
61
61
  NSLog(@"RN-NotifyVisitors PLUGIN VERSION : %@ !!", kNVPluginVersion);
62
62
 
@@ -9,7 +9,8 @@
9
9
  /* Begin PBXBuildFile section */
10
10
  138AE09F22A7ACA600F403E1 /* RNNVExtensionService.m in Sources */ = {isa = PBXBuildFile; fileRef = 138AE09E22A7ACA600F403E1 /* RNNVExtensionService.m */; };
11
11
  13B25F2D22BA35B000C4D0B7 /* RCTNVEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B25F2C22BA35B000C4D0B7 /* RCTNVEventEmitter.m */; };
12
- 352527672E019B11002B0622 /* notifyvisitors.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 352527662E019B11002B0622 /* notifyvisitors.xcframework */; };
12
+ 35C6A6D62E657CB800A5DEF6 /* notifyvisitors.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35C6A6D52E657CB800A5DEF6 /* notifyvisitors.xcframework */; };
13
+ 35C6A6D82E657CC000A5DEF6 /* notifyvisitorsNudges.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35C6A6D72E657CC000A5DEF6 /* notifyvisitorsNudges.xcframework */; };
13
14
  B3E7B58A1CC2AC0600A0062D /* RNNotifyvisitors.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNNotifyvisitors.m */; };
14
15
  DC31F4E523BC9CC900AAB2DB /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC31F4E423BC9CC900AAB2DB /* SystemConfiguration.framework */; };
15
16
  /* End PBXBuildFile section */
@@ -32,7 +33,8 @@
32
33
  138AE09E22A7ACA600F403E1 /* RNNVExtensionService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNVExtensionService.m; sourceTree = "<group>"; };
33
34
  13B25F2B22BA35B000C4D0B7 /* RCTNVEventEmitter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTNVEventEmitter.h; sourceTree = "<group>"; };
34
35
  13B25F2C22BA35B000C4D0B7 /* RCTNVEventEmitter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTNVEventEmitter.m; sourceTree = "<group>"; };
35
- 352527662E019B11002B0622 /* notifyvisitors.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = notifyvisitors.xcframework; sourceTree = "<group>"; };
36
+ 35C6A6D52E657CB800A5DEF6 /* notifyvisitors.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = notifyvisitors.xcframework; sourceTree = "<group>"; };
37
+ 35C6A6D72E657CC000A5DEF6 /* notifyvisitorsNudges.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = notifyvisitorsNudges.xcframework; sourceTree = "<group>"; };
36
38
  B3E7B5881CC2AC0600A0062D /* RNNotifyvisitors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNotifyvisitors.h; sourceTree = "<group>"; };
37
39
  B3E7B5891CC2AC0600A0062D /* RNNotifyvisitors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNotifyvisitors.m; sourceTree = "<group>"; };
38
40
  DC31F4E423BC9CC900AAB2DB /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/SystemConfiguration.framework; sourceTree = DEVELOPER_DIR; };
@@ -44,7 +46,8 @@
44
46
  buildActionMask = 2147483647;
45
47
  files = (
46
48
  DC31F4E523BC9CC900AAB2DB /* SystemConfiguration.framework in Frameworks */,
47
- 352527672E019B11002B0622 /* notifyvisitors.xcframework in Frameworks */,
49
+ 35C6A6D82E657CC000A5DEF6 /* notifyvisitorsNudges.xcframework in Frameworks */,
50
+ 35C6A6D62E657CB800A5DEF6 /* notifyvisitors.xcframework in Frameworks */,
48
51
  );
49
52
  runOnlyForDeploymentPostprocessing = 0;
50
53
  };
@@ -62,7 +65,8 @@
62
65
  58B511D21A9E6C8500147676 = {
63
66
  isa = PBXGroup;
64
67
  children = (
65
- 352527662E019B11002B0622 /* notifyvisitors.xcframework */,
68
+ 35C6A6D52E657CB800A5DEF6 /* notifyvisitors.xcframework */,
69
+ 35C6A6D72E657CC000A5DEF6 /* notifyvisitorsNudges.xcframework */,
66
70
  DC4962D123BE131B005E63F5 /* RNNotifyvisitors */,
67
71
  134814211AA4EA7D00B7C361 /* Products */,
68
72
  DC31F4E323BC9CC900AAB2DB /* Frameworks */,