react-native-notifyvisitors 4.5.3 → 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 (56) hide show
  1. package/android/.classpath +1 -1
  2. package/android/.settings/org.eclipse.jdt.core.prefs +3 -3
  3. package/android/build.gradle +3 -3
  4. package/android/src/main/java/com/rn_notifyvisitors/RNNotifyVisitorsEmbedViewManager.java +40 -2
  5. package/android/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsModule.java +37 -37
  6. package/android/src/main/java/com/rn_notifyvisitors/RNNotifyvisitorsPackage.java +4 -5
  7. package/index.d.ts +15 -5
  8. package/index.js +47 -20
  9. package/ios/RNNotifyvisitors/RCTNVEventEmitter.m +17 -0
  10. package/ios/RNNotifyvisitors/RNNVNativeDisplayView.h +25 -0
  11. package/ios/RNNotifyvisitors/RNNVNativeDisplayView.m +92 -0
  12. package/ios/RNNotifyvisitors/RNNVNativeDisplayViewManager.h +1 -9
  13. package/ios/RNNotifyvisitors/RNNVNativeDisplayViewManager.m +8 -31
  14. package/ios/RNNotifyvisitors/RNNotifyvisitors.m +1 -1
  15. package/ios/RNNotifyvisitors.xcodeproj/project.pbxproj +8 -8
  16. package/ios/notifyvisitors.xcframework/Info.plist +9 -9
  17. package/ios/notifyvisitors.xcframework/ios-arm64/notifyvisitors.framework/Headers/notifyvisitors.h +3 -0
  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 +3 -0
  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 +3 -0
  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 +7 -7
  30. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Headers/notifyvisitorsNudges-Swift.h +2 -3
  31. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Info.plist +0 -0
  32. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios.abi.json +74 -49
  33. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios.private.swiftinterface +3 -2
  34. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios.swiftinterface +3 -2
  35. package/ios/notifyvisitorsNudges.xcframework/ios-arm64/notifyvisitorsNudges.framework/notifyvisitorsNudges +0 -0
  36. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Headers/notifyvisitorsNudges-Swift.h +4 -6
  37. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-macabi.abi.json +74 -49
  38. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-macabi.swiftinterface +3 -2
  39. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-macabi.abi.json +74 -49
  40. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-macabi.swiftinterface +3 -2
  41. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Resources/Info.plist +2 -2
  42. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/notifyvisitorsNudges +0 -0
  43. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Headers/notifyvisitorsNudges-Swift.h +4 -6
  44. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Info.plist +0 -0
  45. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-simulator.abi.json +74 -49
  46. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +3 -2
  47. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-simulator.swiftinterface +3 -2
  48. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-simulator.abi.json +74 -49
  49. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +3 -2
  50. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +3 -2
  51. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/_CodeSignature/CodeResources +19 -19
  52. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-simulator/notifyvisitorsNudges.framework/notifyvisitorsNudges +0 -0
  53. package/package.json +1 -1
  54. package/react-native-notifyvisitors.podspec +3 -3
  55. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/arm64-apple-ios-macabi.private.swiftinterface +0 -41
  56. package/ios/notifyvisitorsNudges.xcframework/ios-arm64_x86_64-maccatalyst/notifyvisitorsNudges.framework/Versions/A/Modules/notifyvisitorsNudges.swiftmodule/x86_64-apple-ios-macabi.private.swiftinterface +0 -41
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <classpath>
3
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-19/"/>
3
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-23/"/>
4
4
  <classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
5
5
  <classpathentry kind="output" path="bin/default"/>
6
6
  </classpath>
@@ -1,4 +1,4 @@
1
1
  eclipse.preferences.version=1
2
- org.eclipse.jdt.core.compiler.codegen.targetPlatform=19
3
- org.eclipse.jdt.core.compiler.compliance=19
4
- org.eclipse.jdt.core.compiler.source=19
2
+ org.eclipse.jdt.core.compiler.codegen.targetPlatform=23
3
+ org.eclipse.jdt.core.compiler.compliance=23
4
+ org.eclipse.jdt.core.compiler.source=23
@@ -35,9 +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.4')
39
- implementation("com.notifyvisitors.nudges:notifyvisitors-nudges:v0.0.3")
40
- implementation platform('com.google.firebase:firebase-bom:33.16.0')
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')
41
41
  implementation ('com.google.firebase:firebase-messaging')
42
42
  implementation ('com.google.android.gms:play-services-location')
43
43
  }
@@ -1,15 +1,27 @@
1
1
  package com.rn_notifyvisitors;
2
2
 
3
3
  import android.util.Log;
4
+ import android.view.View;
5
+ import android.view.ViewGroup;
4
6
 
5
7
  import androidx.annotation.NonNull;
6
8
 
9
+ import com.facebook.react.bridge.Arguments;
10
+ import com.facebook.react.bridge.WritableMap;
11
+ import com.facebook.react.common.MapBuilder;
7
12
  import com.facebook.react.uimanager.SimpleViewManager;
8
13
  import com.facebook.react.uimanager.ThemedReactContext;
9
14
  import com.facebook.react.uimanager.annotations.ReactProp;
15
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
16
+ import com.facebook.react.uimanager.events.RCTEventEmitter;
10
17
 
18
+ import com.notifyvisitors.notifyvisitors.NotifyVisitorsApi;
11
19
  import com.notifyvisitors.nudges.NotifyVisitorsNativeDisplay;
12
20
 
21
+ import java.util.HashMap;
22
+ import java.util.Map;
23
+
24
+
13
25
  public class RNNotifyVisitorsEmbedViewManager extends SimpleViewManager<NotifyVisitorsNativeDisplay> {
14
26
  public static final String REACT_CLASS = "NotifyvisitorsNativeDisplay";
15
27
 
@@ -22,14 +34,40 @@ public class RNNotifyVisitorsEmbedViewManager extends SimpleViewManager<NotifyVi
22
34
  @NonNull
23
35
  @Override
24
36
  protected NotifyVisitorsNativeDisplay createViewInstance(@NonNull ThemedReactContext themedReactContext) {
25
- // default valueKey; will set via @ReactProp later
26
37
  NotifyVisitorsNativeDisplay nativeDisplay = new NotifyVisitorsNativeDisplay(themedReactContext);
27
- //nativeDisplay.loadContent("home");
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
+
28
54
  return nativeDisplay;
55
+
29
56
  }
30
57
 
31
58
  @ReactProp(name = "propertyName")
32
59
  public void setPropertyName(NotifyVisitorsNativeDisplay view, String propertyName) {
33
60
  view.loadContent(propertyName);
34
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
+
35
73
  }
@@ -50,7 +50,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
50
50
 
51
51
  private final ReactApplicationContext reactContext;
52
52
  private static final String TAG = "RN-NotifyVisitors";
53
- private static final String PLUGIN_VERSION = "4.5.3";
53
+ private static final String PLUGIN_VERSION = "4.6.0";
54
54
 
55
55
  private String PUSH_BANNER_CLICK_EVENT = "nv_push_banner_click";
56
56
  private String CHAT_BOT_BUTTON_CLICK = "nv_chat_bot_button_click";
@@ -225,6 +225,41 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
225
225
  }
226
226
  }
227
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
+
228
263
  @ReactMethod
229
264
  public void showInAppMessage(ReadableMap tokens, ReadableMap customObjects, final String fragmentName, Callback callback) {
230
265
  try {
@@ -727,7 +762,7 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
727
762
  if (screenName == null || screenName.equalsIgnoreCase("empty")) {
728
763
  Log.i(TAG, "SCREEN NAME IS MISSING");
729
764
  } else {
730
- // mActivity = getCurrentActivity();
765
+ //mActivity = getCurrentActivity();
731
766
  mActivity = reactContext.getCurrentActivity();
732
767
  if (mActivity != null) {
733
768
  mActivity.runOnUiThread(new Runnable() {
@@ -995,22 +1030,6 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
995
1030
  }
996
1031
  }
997
1032
 
998
- @ReactMethod
999
- public void getSessionData(final Callback callback) {
1000
- try {
1001
- Log.i(TAG, "GET SESSION DATA !!");
1002
- JSONObject data = NotifyVisitorsApi.getInstance(reactContext).getSessionData();
1003
- if (data != null) {
1004
- callback.invoke(data.toString());
1005
- } else {
1006
- callback.invoke("unavailable");
1007
- }
1008
-
1009
- } catch (Exception e) {
1010
- Log.i(TAG, "GET SESSION DATA ERROR : " + e);
1011
- }
1012
- }
1013
-
1014
1033
  /* 12 - Play Store / App Store Rating */
1015
1034
  @ReactMethod
1016
1035
  public void requestInAppReview(final Callback callback) {
@@ -1087,25 +1106,6 @@ public class RNNotifyvisitorsModule extends ReactContextBaseJavaModule implement
1087
1106
  }
1088
1107
  }
1089
1108
 
1090
- @ReactMethod
1091
- public void notificationClickCallback(final Callback callback) {
1092
- onNotificationClickCallback = callback;
1093
-
1094
- try {
1095
- Log.i(TAG, "NOTIFICATION CLICK CALLBACK !!");
1096
- NotifyVisitorsApi.getInstance(reactContext).notificationClickCallback(new OnNotificationClicksHandler() {
1097
- @Override
1098
- public void onClick(JSONObject jsonObject) {
1099
- if (jsonObject != null) {
1100
- sendEvent(NV_NOTIFICATION_CLICK_CALLBACK, jsonObject.toString());
1101
- }
1102
- }
1103
- });
1104
- } catch (Exception e) {
1105
- Log.i(TAG, "NOTIFICATION CLICK CALLBACK ERROR : " + e);
1106
- }
1107
- }
1108
-
1109
1109
  /* 15 - Unique NotifyVisitors Identification */
1110
1110
  @ReactMethod
1111
1111
  public void getNvUID(final Callback callback) {
@@ -1,7 +1,5 @@
1
1
  package com.rn_notifyvisitors;
2
2
 
3
- import androidx.annotation.NonNull;
4
-
5
3
  import java.util.Arrays;
6
4
  import java.util.Collections;
7
5
  import java.util.List;
@@ -11,6 +9,7 @@ import com.facebook.react.bridge.NativeModule;
11
9
  import com.facebook.react.bridge.ReactApplicationContext;
12
10
  import com.facebook.react.uimanager.ViewManager;
13
11
  import com.facebook.react.bridge.JavaScriptModule;
12
+ import androidx.annotation.NonNull;
14
13
 
15
14
  public class RNNotifyvisitorsPackage implements ReactPackage {
16
15
  @Override
@@ -23,10 +22,10 @@ public class RNNotifyvisitorsPackage implements ReactPackage {
23
22
  return Collections.emptyList();
24
23
  }
25
24
 
26
- @NonNull
27
25
  @Override
28
26
  public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
29
- //return Collections.emptyList();
30
- return List.of(new RNNotifyVisitorsEmbedViewManager());
27
+ return Arrays.asList(
28
+ new RNNotifyVisitorsEmbedViewManager() // This should include NotifyvisitorsNativeDisplay
29
+ );
31
30
  }
32
31
  }
package/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- import { ViewProps } from "react-native";
2
- import * as React from "react";
3
-
4
1
  export default class Notifyvisitors {
5
2
  /* 1 - inApp-Banner & inApp-Surveys */
6
3
  static show(
@@ -96,8 +93,10 @@ export default class Notifyvisitors {
96
93
  static isPayloadFromNvPlatform(pushPayload: any, callback: any): void;
97
94
  static getNV_FCMPayload(pushPayload: any): void;
98
95
 
99
- /* 3 - Track Screen */
100
- static trackScreen(screenName: String): void;
96
+ /* 3 - Track Screen */
97
+ static trackScreen(
98
+ screenName: String
99
+ ): void;
101
100
 
102
101
  static getSessionData(nvCallback: any): void;
103
102
 
@@ -129,3 +128,14 @@ export class PushPromptInfo {
129
128
  resumeInDays: String;
130
129
  numberOfTimesPerSession: String;
131
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);
@@ -106,6 +108,25 @@ export default class Notifyvisitors {
106
108
  }
107
109
  }
108
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
+
109
130
  /* 3 - Event Tracking */
110
131
  static event(eventName, attributes, ltv, scope, nvCallback) {
111
132
  console.log("NV- Events !!");
@@ -272,16 +293,6 @@ export default class Notifyvisitors {
272
293
  }
273
294
  }
274
295
 
275
- static notificationClickCallback(nvCallback) {
276
- console.log("NV- Notification Click Callback !!");
277
- try {
278
- CALLBACKS_STACK[NV_CALLBACKS.NV_NOTIFICATION_CLICK_CALLBACK] = nvCallback;
279
- RNNotifyvisitors.notificationClickCallback(nvCallback);
280
- } catch (e) {
281
- console.log(e);
282
- }
283
- }
284
-
285
296
  /* 15 - Unique NotifyVisitors Identification */
286
297
  static getNvUID(callback) {
287
298
  console.log("NV- Get NV UID !!");
@@ -315,15 +326,6 @@ export default class Notifyvisitors {
315
326
  }
316
327
  }
317
328
 
318
- static getSessionData(nvCallback) {
319
- console.log("NV- Get Session Data !!");
320
- try {
321
- RNNotifyvisitors.getSessionData(nvCallback);
322
- } catch (e) {
323
- console.log(e);
324
- }
325
- }
326
-
327
329
  /* 17 - Auto Start Library Android */
328
330
  static setAutoStartPermission_android_only() {
329
331
  console.log("NV- Auto Start Permission Android !!");
@@ -545,3 +547,28 @@ export class PushPromptInfo {
545
547
  this.numberOfTimesPerSession = "2";
546
548
  }
547
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 };
@@ -886,6 +886,23 @@ RCT_EXPORT_METHOD(getLinkInfo) {
886
886
  }
887
887
  }
888
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
+
889
906
  /* 20 - known user identified */
890
907
  RCT_EXPORT_METHOD(notificationClickCallback:(RCTResponseSenderBlock)nvcallback) {
891
908
  @try{
@@ -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
@@ -7,16 +7,8 @@
7
7
 
8
8
  #import "RCTViewManager.h"
9
9
 
10
- #if __has_include(<notifyvisitorsNudges/notifyvisitorsNudges-Swift.h>)
11
- #import <notifyvisitorsNudges/notifyvisitorsNudges-Swift.h>
12
- #else
13
- #import "../notifyvisitorsNudges-Swift.h"
14
- #endif
15
-
16
-
17
10
  @interface RNNVNativeDisplayViewManager : RCTViewManager
18
11
 
19
- @property(nonatomic, strong) notifyvisitorsNativeDisplay * _Nullable nvNudgesNativeDisplay;
20
- @property(nonatomic, strong) UIView * _Nullable nvContainerView;
12
+
21
13
 
22
14
  @end
@@ -6,45 +6,22 @@
6
6
  //
7
7
 
8
8
  #import "RNNVNativeDisplayViewManager.h"
9
+ #import "RNNVNativeDisplayView.h"
9
10
 
10
11
 
11
12
  @implementation RNNVNativeDisplayViewManager
12
13
 
13
14
  RCT_EXPORT_MODULE(NotifyvisitorsNativeDisplay) // Name used in JS class
14
15
 
16
+ // Create the native view
15
17
  - (UIView *)view {
16
- NSLog(@"RCT_EXPORT_MODULE(NotifyvisitorsNativeDisplay)");
17
- self.nvContainerView = [[UIView alloc] initWithFrame: CGRectZero];
18
- self.nvContainerView.backgroundColor = [UIColor clearColor];
19
- self.nvNudgesNativeDisplay = [notifyvisitorsNativeDisplay sharedInstance];
20
- [self.nvContainerView setUserInteractionEnabled: YES];
21
- return self.nvContainerView;
18
+ return [[RNNVNativeDisplayView alloc] initWithFrame: CGRectZero];
22
19
  }
23
20
 
24
- RCT_CUSTOM_VIEW_PROPERTY(propertyName, NSString, UIView)
25
- {
26
- NSLog(@"RCT_CUSTOM_VIEW_PROPERTY(propertyName)");
27
- NSString *nvPropertyName = [NSString stringWithFormat: @"%@", json];
28
- if ([nvPropertyName length] > 0 && ![nvPropertyName isEqualToString: @""] && ![nvPropertyName isEqual: [NSNull null]]) {
29
- NSLog(@"[notifyvisitors]-[ReactNative]-[nudges]: property name found for native display");
30
- UIView *nvNativeDisplayView = [self.nvNudgesNativeDisplay loadContentForPropertyName: nvPropertyName];
31
- nvNativeDisplayView.backgroundColor = [UIColor clearColor];
32
- nvNativeDisplayView.translatesAutoresizingMaskIntoConstraints = YES; // ✅ VERY IMPORTANT
33
- // Match parent bounds dynamically
34
- nvNativeDisplayView.frame = self.nvContainerView.bounds;
35
- nvNativeDisplayView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
36
- [self.nvContainerView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
37
- [self.nvContainerView addSubview: nvNativeDisplayView];
38
- } else {
39
- NSLog(@"[notifyvisitors]-[ReactNative]-[nudges]: missing parameter propertyName not found or empty.");
40
- UIView *nvEmptyDisplayView = [[UIView alloc] init];
41
- nvEmptyDisplayView.backgroundColor = [UIColor clearColor];
42
- // Match parent bounds dynamically
43
- nvEmptyDisplayView.frame = self.nvContainerView.bounds;
44
- nvEmptyDisplayView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
45
- [self.nvContainerView.subviews makeObjectsPerformSelector: @selector(removeFromSuperview)];
46
- [self.nvContainerView addSubview: nvEmptyDisplayView];
47
- }
48
- }
21
+ // Expose prop to JS
22
+ RCT_EXPORT_VIEW_PROPERTY(propertyName, NSString)
23
+
24
+ // Expose the callback
25
+ RCT_EXPORT_VIEW_PROPERTY(onNudgeUiFinalized, RCTDirectEventBlock)
49
26
 
50
27
  @end
@@ -23,7 +23,7 @@ int nvCheckPushClickTimeCounter = 0;
23
23
 
24
24
  @implementation RNNotifyvisitors
25
25
 
26
- static NSString *const kNVPluginVersion = @"4.5.3";
26
+ static NSString *const kNVPluginVersion = @"4.6.0";
27
27
 
28
28
  - (dispatch_queue_t)methodQueue{
29
29
  return dispatch_get_main_queue();
@@ -9,8 +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
- 356D58DD2E4C407900A0ED29 /* notifyvisitors.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 356D58DC2E4C407900A0ED29 /* notifyvisitors.xcframework */; };
13
- 356D58DF2E4C408100A0ED29 /* notifyvisitorsNudges.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 356D58DE2E4C408100A0ED29 /* notifyvisitorsNudges.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 */; };
14
14
  B3E7B58A1CC2AC0600A0062D /* RNNotifyvisitors.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNNotifyvisitors.m */; };
15
15
  DC31F4E523BC9CC900AAB2DB /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC31F4E423BC9CC900AAB2DB /* SystemConfiguration.framework */; };
16
16
  /* End PBXBuildFile section */
@@ -33,8 +33,8 @@
33
33
  138AE09E22A7ACA600F403E1 /* RNNVExtensionService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNVExtensionService.m; sourceTree = "<group>"; };
34
34
  13B25F2B22BA35B000C4D0B7 /* RCTNVEventEmitter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTNVEventEmitter.h; sourceTree = "<group>"; };
35
35
  13B25F2C22BA35B000C4D0B7 /* RCTNVEventEmitter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTNVEventEmitter.m; sourceTree = "<group>"; };
36
- 356D58DC2E4C407900A0ED29 /* notifyvisitors.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = notifyvisitors.xcframework; sourceTree = "<group>"; };
37
- 356D58DE2E4C408100A0ED29 /* notifyvisitorsNudges.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = notifyvisitorsNudges.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>"; };
38
38
  B3E7B5881CC2AC0600A0062D /* RNNotifyvisitors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNotifyvisitors.h; sourceTree = "<group>"; };
39
39
  B3E7B5891CC2AC0600A0062D /* RNNotifyvisitors.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNotifyvisitors.m; sourceTree = "<group>"; };
40
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; };
@@ -46,8 +46,8 @@
46
46
  buildActionMask = 2147483647;
47
47
  files = (
48
48
  DC31F4E523BC9CC900AAB2DB /* SystemConfiguration.framework in Frameworks */,
49
- 356D58DF2E4C408100A0ED29 /* notifyvisitorsNudges.xcframework in Frameworks */,
50
- 356D58DD2E4C407900A0ED29 /* notifyvisitors.xcframework in Frameworks */,
49
+ 35C6A6D82E657CC000A5DEF6 /* notifyvisitorsNudges.xcframework in Frameworks */,
50
+ 35C6A6D62E657CB800A5DEF6 /* notifyvisitors.xcframework in Frameworks */,
51
51
  );
52
52
  runOnlyForDeploymentPostprocessing = 0;
53
53
  };
@@ -65,8 +65,8 @@
65
65
  58B511D21A9E6C8500147676 = {
66
66
  isa = PBXGroup;
67
67
  children = (
68
- 356D58DC2E4C407900A0ED29 /* notifyvisitors.xcframework */,
69
- 356D58DE2E4C408100A0ED29 /* notifyvisitorsNudges.xcframework */,
68
+ 35C6A6D52E657CB800A5DEF6 /* notifyvisitors.xcframework */,
69
+ 35C6A6D72E657CC000A5DEF6 /* notifyvisitorsNudges.xcframework */,
70
70
  DC4962D123BE131B005E63F5 /* RNNotifyvisitors */,
71
71
  134814211AA4EA7D00B7C361 /* Products */,
72
72
  DC31F4E323BC9CC900AAB2DB /* Frameworks */,