lemnisk-react-native 0.1.27 → 0.2.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/README.md CHANGED
@@ -25,6 +25,87 @@ Please import Lemnisk native module in your react-native application.
25
25
  import LemniskSdk from 'lemnisk-react-native';
26
26
  ```
27
27
 
28
+ ## Initialization
29
+
30
+ The SDK supports two ways to initialize. **Use one — not both.**
31
+
32
+ ### Path 1 (recommended): native auto-init from config files
33
+
34
+ Because a React Native app is still a native iOS app and a native Android app, the Lemnisk SDK can initialize itself at **native launch — before the JS bundle loads** — by reading static config from the platform config files. This is the same model as Firebase (`GoogleService-Info.plist` / `google-services.json`): you add the keys once per platform and call **nothing** from JavaScript. This gives the earliest possible init and requires no wrapper code.
35
+
36
+ Add the following logical keys to each platform's config file:
37
+
38
+ | Logical key | Android — `AndroidManifest.xml` `<meta-data android:name=…>` | iOS — `Info.plist` key |
39
+ |---|---|---|
40
+ | Write key **(required — arms auto-init)** | `Lemnisk.WRITE_KEY` | `LemniskWriteKey` |
41
+ | Server URL **(required)** | `Lemnisk.SERVER_URL` | `LemniskServerUrl` |
42
+ | Consent URL | `Lemnisk.Consent_URL` | `LemniskConsentServerUrl` |
43
+ | Notification-center URL | `Lemnisk.NOTIFICATION_CENTER_URL` | `LemniskNotificationCenterUrl` |
44
+ | Auto-init opt-out (Bool) | `Lemnisk.AUTO_INIT` (`false` disables) | `LemniskAutoInit` (`false` disables) |
45
+ | Push enabled (Bool) | `Lemnisk.ENABLE_PUSH` | `LemniskPushEnabled` |
46
+ | Analytics enabled (Bool) | `Lemnisk.ENABLE_ANALYTICS` | `LemniskAnalyticsEnabled` |
47
+ | In-app enabled (Bool) | `Lemnisk.ENABLE_INAPP` | `LemniskInAppEnabled` |
48
+ | App Group ID (iOS only) | — | `LemniskAppGroupId` |
49
+ | Debug logs (Android only) | `Lemnisk.DEBUG_MODE` | — |
50
+
51
+ Android `AndroidManifest.xml` (inside `<application>`):
52
+ ```xml
53
+ <meta-data android:name="Lemnisk.WRITE_KEY" android:value="your_android_write_key" />
54
+ <meta-data android:name="Lemnisk.SERVER_URL" android:value="https://your.lemnisk.co/" />
55
+ <meta-data android:name="Lemnisk.NOTIFICATION_CENTER_URL" android:value="https://your-nc.lemnisk.co/" />
56
+ ```
57
+
58
+ iOS `Info.plist`:
59
+ ```xml
60
+ <key>LemniskWriteKey</key>
61
+ <string>your_ios_write_key</string>
62
+ <key>LemniskServerUrl</key>
63
+ <string>https://your.lemnisk.co</string>
64
+ <key>LemniskNotificationCenterUrl</key>
65
+ <string>https://your-nc.lemnisk.co</string>
66
+ ```
67
+
68
+ Auto-init runs whenever the write key is present. To opt out while keeping the keys in place, set `Lemnisk.AUTO_INIT` / `LemniskAutoInit` to `false`.
69
+
70
+ ### Path 2 (backward compatible): explicit JS init
71
+
72
+ If you prefer to configure at runtime from JavaScript (the pre-existing behaviour), do **not** add the write key to the native files, and call:
73
+
74
+ ```javascript
75
+ LemniskSdk.init({
76
+ writeKeyAndroid: '<android_write_key>',
77
+ writeKeyIOS: '<ios_write_key>',
78
+ serverUrl: 'https://your.lemnisk.co',
79
+ consentUrl: 'https://your-consent.lemnisk.co', // optional
80
+ notificationCenterUrl: 'https://your-nc.lemnisk.co', // optional
81
+ enablePush: true, // optional
82
+ enablePullNotifications: false, // optional
83
+ enableAnalytics: true, // optional
84
+ enableInApp: true, // optional
85
+ enableDebugMode: false, // optional
86
+ });
87
+ ```
88
+
89
+ > iOS App Group: set `LemniskAppGroupId` in your **Info.plist** (and the same value natively in your notification extensions) — it's build-time/entitlement-bound, so it is **not** a JS init option.
90
+
91
+ All options are passed to native as a single config object (not positional args), so new options can be added without changing the bridge. Omitted keys fall back to the SDK/manifest defaults. This initializes later than native auto-init (JS has to load first), but is fully supported.
92
+
93
+ ### Precedence rule
94
+
95
+ The native SDK arbitrates safely if both are present — you do not need to guard this yourself:
96
+
97
+ > **The first write key to arrive wins. A later `init()` with the same write key is a no-op. A later `init()` with a different write key reconfigures the SDK.**
98
+
99
+ So a client who adds native keys **and** also calls `LemniskSdk.init()` with the same key will not get a double init.
100
+
101
+ ### Checking init status
102
+
103
+ ```javascript
104
+ const ready = LemniskSdk.isInitialized(); // boolean
105
+ ```
106
+
107
+ Returns `true` once the SDK has configured at least once (via native auto-init or an explicit `init()`).
108
+
28
109
  Now, you can log an event to Lemnisk by using the following method call in your react-native application.
29
110
 
30
111
  #### <a id="react-native-identify"></a>Identify
@@ -111,6 +192,36 @@ LemniskSdk.screen('Home', {
111
192
  }, null)
112
193
  ```
113
194
 
195
+ #### <a id="react-native-setcontext"></a>In-App Context
196
+
197
+ Use `setContext` to tell the SDK which logical screen/flow the user is in (e.g. `"checkout_flow"`, `"kyc_step1"`). The context is attached to outbound track/screen events and is used by the in-app engine for `screen_load` context-membership checks when deciding which popup to show. Call `clearContext` to clear it.
198
+
199
+ ```javascript
200
+ LemniskSdk.setContext('checkout_flow');
201
+ // ...later
202
+ LemniskSdk.clearContext();
203
+ ```
204
+
205
+ | Method | Parameter | Description |
206
+ |--------|-----------|-------------|
207
+ | `setContext` | `context` (String) | Sets the current SDK context used as an in-app trigger selector. |
208
+ | `clearContext` | — | Clears the current context. |
209
+
210
+ #### <a id="react-native-pauseinapp"></a>Pausing In-App Messages
211
+
212
+ Use `pauseInApp` to temporarily suppress in-app popups (for example while a sensitive screen is on display) and `resumeInApp` to re-enable them. Popups stay suppressed until `resumeInApp` is called.
213
+
214
+ ```javascript
215
+ LemniskSdk.pauseInApp();
216
+ // ...later
217
+ LemniskSdk.resumeInApp();
218
+ ```
219
+
220
+ | Method | Description |
221
+ |--------|-------------|
222
+ | `pauseInApp` | Silences the in-app channel; popups stay suppressed until resumed. |
223
+ | `resumeInApp` | Re-enables the in-app channel after a `pauseInApp`. |
224
+
114
225
 
115
226
  ## Contributing
116
227
 
@@ -50,7 +50,7 @@ android {
50
50
  }
51
51
 
52
52
  android.defaultConfig {
53
- buildConfigField "String", "REACT_NATIVE_SDK_VERSION", "\"0.1.27\""
53
+ buildConfigField "String", "REACT_NATIVE_SDK_VERSION", "\"0.2.0\""
54
54
  }
55
55
 
56
56
  repositories {
@@ -66,7 +66,7 @@ repositories {
66
66
  dependencies {
67
67
  //noinspection GradleDynamicVersion
68
68
  implementation "com.facebook.react:react-native:+" // From node_modules
69
- implementation 'co.lemnisk.app.android:AndroidSDK:1.1.59'
69
+ implementation 'co.lemnisk.app.android:AndroidSDK:1.2.0'
70
70
  implementation 'org.apache.commons:commons-text:1.11.0'
71
71
  //implementation(name:'AndroidSDK-release', ext:'aar')
72
72
  implementation group: 'joda-time', name: 'joda-time', version: '2.12.5'
@@ -75,7 +75,7 @@ dependencies {
75
75
  implementation 'com.google.firebase:firebase-messaging'
76
76
  implementation 'com.google.android.gms:play-services-ads-identifier:18.1.0'
77
77
  implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
78
- implementation 'androidx.work:work-runtime:2.10.1'
78
+ implementation 'androidx.work:work-runtime:2.10.5'
79
79
  implementation 'com.google.code.gson:gson:2.11.0'
80
80
  implementation 'androidx.lifecycle:lifecycle-process:2.9.0'
81
81
  implementation 'androidx.lifecycle:lifecycle-common-java8:2.9.0'
@@ -47,38 +47,22 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
47
47
 
48
48
  LemniskHelper helper = LemniskHelper.getInstance(reactContext);
49
49
 
50
+ // Do NOT call helper.init() here. Native auto-init (LemniskInitProvider)
51
+ // owns initialization when manifest keys are present; the JS init(config)
52
+ // drives the runtime path when they aren't. This mirrors iOS, which has
53
+ // no constructor-init. We only tag the cross-platform SDK version so
54
+ // outbound events carry "react-native-<version>".
50
55
  new Handler(Looper.getMainLooper()).post(new Runnable() {
51
56
  @Override
52
57
  public void run() {
53
58
  try {
54
- android.content.pm.ApplicationInfo ai = reactContext.getPackageManager().getApplicationInfo(
55
- reactContext.getPackageName(),
56
- android.content.pm.PackageManager.GET_META_DATA
57
- );
58
- String notificationCenterUrl = ai.metaData.getString(NOTIFICATION_CENTER_URL);
59
-
60
- if (notificationCenterUrl != null && !notificationCenterUrl.isEmpty()) {
61
- helper.init(null, null, null, notificationCenterUrl, null, null);
62
- } else {
63
- helper.init();
64
- }
65
-
66
- // Set cross-platform SDK version for React Native
67
59
  helper.setCrossPlatformSDKVersion("react-native-" + BuildConfig.REACT_NATIVE_SDK_VERSION);
68
-
69
60
  } catch (Exception e) {
70
- Log.e("LemniskSdk", "Failed to load meta-data: " + e.getMessage());
71
- helper.init();
72
- // Still set cross-platform SDK version even if init fails
73
- try {
74
- helper.setCrossPlatformSDKVersion("react-native-" + BuildConfig.REACT_NATIVE_SDK_VERSION);
75
- } catch (Exception ex) {
76
- Log.e("LemniskSdk", "Failed to set cross-platform SDK version: " + ex.getMessage());
77
- }
61
+ Log.e("LemniskSdk", "Failed to set cross-platform SDK version: " + e.getMessage());
78
62
  }
79
63
  }
80
64
  });
81
-
65
+
82
66
  }
83
67
 
84
68
  @Override
@@ -87,28 +71,25 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
87
71
  return NAME;
88
72
  }
89
73
 
74
+ // Runtime init (backward-compat / no-manifest path). Accepts a single config
75
+ // object of friendly keys (writeKey, serverUrl, consentUrl,
76
+ // notificationCenterUrl, enablePush, enableAnalytics, enableInApp,
77
+ // enableDebugMode). The native SDK maps these to its own config keys.
78
+ // Adding a new config = add a key in JS + native mapping; no signature churn.
79
+ // No-op when native auto-init already owns initialization (Lemnisk.AUTO_INIT).
90
80
  @ReactMethod
91
- public void init(String writeKey, String serverUrl, @Nullable String consentUrl, @Nullable String notificationCenterUrl, boolean enablePush, boolean enableDebugMode, boolean enableAnalytics) {
92
- Log.d("LemniskSdk", "init called from JS bridge with writeKey: " + writeKey);
81
+ public void init(ReadableMap config) {
82
+ Log.d("LemniskSdk", "init(config) called from JS bridge");
93
83
  // Must run on main thread because lifecycle.addObserver requires main thread
94
84
  new Handler(Looper.getMainLooper()).post(new Runnable() {
95
85
  @Override
96
86
  public void run() {
97
87
  try {
98
88
  android.app.Application application = (android.app.Application) getReactApplicationContext().getApplicationContext();
99
- LemniskHelper helper = LemniskHelper.getInstance(getReactApplicationContext());
100
- helper.init(
101
- application,
102
- writeKey,
103
- serverUrl,
104
- consentUrl != null ? consentUrl : serverUrl,
105
- notificationCenterUrl != null ? notificationCenterUrl : "",
106
- enablePush,
107
- enableDebugMode,
108
- enableAnalytics
109
- );
89
+ JSONObject configJson = new JSONObject(config.toHashMap());
90
+ LemniskHelper.getInstance(getReactApplicationContext()).init(application, configJson);
110
91
  } catch (Exception e) {
111
- Log.e("LemniskSdk", "Exception in init", e);
92
+ Log.e("LemniskSdk", "Exception in init(config)", e);
112
93
  }
113
94
  }
114
95
  });
@@ -234,6 +215,48 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
234
215
  }
235
216
  }
236
217
 
218
+ // --- InApp context & channel control (app-172) ---
219
+
220
+ @ReactMethod
221
+ public void setContext(String context) {
222
+ Log.d("Lemnisk: ", "setContext: " + context);
223
+ try {
224
+ LemniskHelper.getInstance(getReactApplicationContext()).setContext(context);
225
+ } catch (Exception e) {
226
+ Log.e("Lemnisk", "Exception in setContext", e);
227
+ }
228
+ }
229
+
230
+ @ReactMethod
231
+ public void clearContext() {
232
+ Log.d("Lemnisk: ", "clearContext");
233
+ try {
234
+ LemniskHelper.getInstance(getReactApplicationContext()).clearContext();
235
+ } catch (Exception e) {
236
+ Log.e("Lemnisk", "Exception in clearContext", e);
237
+ }
238
+ }
239
+
240
+ @ReactMethod
241
+ public void pauseInApp() {
242
+ Log.d("Lemnisk: ", "pauseInApp");
243
+ try {
244
+ LemniskHelper.getInstance(getReactApplicationContext()).pauseInApp();
245
+ } catch (Exception e) {
246
+ Log.e("Lemnisk", "Exception in pauseInApp", e);
247
+ }
248
+ }
249
+
250
+ @ReactMethod
251
+ public void resumeInApp() {
252
+ Log.d("Lemnisk: ", "resumeInApp");
253
+ try {
254
+ LemniskHelper.getInstance(getReactApplicationContext()).resumeInApp();
255
+ } catch (Exception e) {
256
+ Log.e("Lemnisk", "Exception in resumeInApp", e);
257
+ }
258
+ }
259
+
237
260
  @ReactMethod
238
261
  public void registerForPush( String title, String message){
239
262
  Activity activity = reactContext.getCurrentActivity();
@@ -297,6 +320,21 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
297
320
  }
298
321
  }
299
322
 
323
+ // Returns true once the SDK has configured at least once — via native
324
+ // manifest auto-init (LemniskInitProvider) OR an explicit init() call.
325
+ // Informational only: it does NOT need to gate init(), because the native
326
+ // ConfigManager already treats a same-writeKey re-init as a no-op and a
327
+ // different-writeKey init as a reconfigure.
328
+ @ReactMethod(isBlockingSynchronousMethod = true)
329
+ public boolean isInitialized() {
330
+ try {
331
+ return LemniskHelper.getInstance(getReactApplicationContext()).isInitialized();
332
+ } catch (Exception e) {
333
+ Log.e("Lemnisk", "Exception in isInitialized", e);
334
+ return false;
335
+ }
336
+ }
337
+
300
338
  @ReactMethod(isBlockingSynchronousMethod = true)
301
339
  public String getUniqueUserId() {
302
340
  Log.d("Lemnisk: ", "getUniqueUserId");
package/ios/LemniskSdk.m CHANGED
@@ -25,38 +25,16 @@ RCT_EXPORT_MODULE()
25
25
  return sdkVersion;
26
26
  }
27
27
 
28
- // Init method - configure SDK from JavaScript
29
- RCT_EXPORT_METHOD(init:(NSString *)writeKey
30
- serverUrl:(NSString *)serverUrl
31
- consentUrl:(NSString * _Nullable)consentUrl
32
- notificationCenterUrl:(NSString * _Nullable)notificationCenterUrl
33
- enablePush:(BOOL)enablePush
34
- enableDebugMode:(BOOL)enableDebugMode
35
- enableAnalytics:(BOOL)enableAnalytics) {
36
- RCTLogInfo(@"LemniskSdk init called from JS bridge with writeKey: %@", writeKey);
37
-
38
- // Set log level based on enableDebugMode
39
- if (enableDebugMode) {
40
- [[Lemnisk shared] setLogLevel:@"DEBUG"];
41
- } else {
42
- [[Lemnisk shared] setLogLevel:@"OFF"];
43
- }
44
-
45
- // Configure with writeKey, serverUrl, and notificationCenterUrl
46
- NSString *notifCenterUrl = (notificationCenterUrl != nil && notificationCenterUrl.length > 0) ? notificationCenterUrl : serverUrl;
47
- [[Lemnisk shared] configureWithWriteKey:writeKey serverUrl:serverUrl notifcationCenterUrl:notifCenterUrl];
48
-
49
- if (consentUrl != nil && consentUrl.length > 0) {
50
- NSString *finalConsentUrl = consentUrl;
51
- if (![finalConsentUrl hasSuffix:@"/consent/"] && ![finalConsentUrl hasSuffix:@"/consent"]) {
52
- if ([finalConsentUrl hasSuffix:@"/"]) {
53
- finalConsentUrl = [finalConsentUrl stringByAppendingString:@"consent/"];
54
- } else {
55
- finalConsentUrl = [finalConsentUrl stringByAppendingString:@"/consent/"];
56
- }
57
- }
58
- [[Lemnisk shared] setConsentServerUrlWithServerUrl:finalConsentUrl];
59
- }
28
+ // Runtime init (backward-compat / no-Info.plist path). Accepts a single config
29
+ // dictionary of friendly keys (writeKey, serverUrl, consentUrl,
30
+ // notificationCenterUrl, enablePush, enableAnalytics, enableInApp,
31
+ // enableDebugMode, appGroupId). The native SDK maps these to its own config and
32
+ // runs the runtime configure path. Adding a new config = add a key in JS +
33
+ // native mapping; no bridge signature change. No-op when native auto-init
34
+ // already owns initialization (LemniskAutoInit).
35
+ RCT_EXPORT_METHOD(init:(NSDictionary *)config) {
36
+ RCTLogInfo(@"LemniskSdk init(config) called from JS bridge");
37
+ [[Lemnisk shared] configureWithConfig:config];
60
38
  }
61
39
 
62
40
  // Example method
@@ -114,6 +92,27 @@ RCT_EXPORT_METHOD(registerForPush) {
114
92
  [[Lemnisk shared] registerForPushNotifications];
115
93
  }
116
94
 
95
+ // --- InApp context & channel control (app-172) ---
96
+ RCT_EXPORT_METHOD(setContext:(NSString * _Nullable)context) {
97
+ RCTLogInfo(@"setContext: %@", context);
98
+ [[Lemnisk shared] setContext:context];
99
+ }
100
+
101
+ RCT_EXPORT_METHOD(clearContext) {
102
+ RCTLogInfo(@"clearContext");
103
+ [[Lemnisk shared] clearContext];
104
+ }
105
+
106
+ RCT_EXPORT_METHOD(pauseInApp) {
107
+ RCTLogInfo(@"pauseInApp");
108
+ [[Lemnisk shared] pauseInApp];
109
+ }
110
+
111
+ RCT_EXPORT_METHOD(resumeInApp) {
112
+ RCTLogInfo(@"resumeInApp");
113
+ [[Lemnisk shared] resumeInApp];
114
+ }
115
+
117
116
  RCT_EXPORT_METHOD(setUniqueUserId:(NSString *) tokenized_cid) {
118
117
  RCTLogInfo(@"calling setUniqueUserId");
119
118
  [[Lemnisk shared] setUniqueUserId:tokenized_cid];
@@ -130,6 +129,14 @@ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, getUniqueUserId) {
130
129
  return uniqueUserId ?: @"";
131
130
  }
132
131
 
132
+ // Returns true once the SDK has configured at least once — via native
133
+ // Info.plist auto-init OR an explicit init() call. Informational only: it does
134
+ // NOT need to gate init(), because configureBasic already treats a same-writeKey
135
+ // re-configure as a no-op and a different-writeKey configure as a reconfigure.
136
+ RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSNumber *, isInitialized) {
137
+ return @([[Lemnisk shared] isConfigured]);
138
+ }
139
+
133
140
  // Set Custom Consent method
134
141
  RCT_EXPORT_METHOD(setCustomConsent:(BOOL)transConsent promoConsent:(BOOL)promoConsent) {
135
142
  RCTLogInfo(@"Setting custom consent: transConsent=%d, promoConsent=%d", transConsent, promoConsent);
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -21,6 +21,8 @@ Pod::Spec.new do |s|
21
21
  }
22
22
 
23
23
  s.dependency 'React-Core'
24
- s.dependency 'Lemnisk-iOS-SDK', '3.9.13'
24
+ s.dependency 'Lemnisk-iOS-SDK', '3.10.0'
25
+ # LOCAL TEST (swap in for on-device work against the local xcframework via the
26
+ # example Podfile's `pod 'Lemnisk-iOS-SDK-Local', :path => '../../../../ios-swift-sdk'`):
25
27
  # s.dependency 'Lemnisk-iOS-SDK-Local'
26
28
  end
@@ -16,16 +16,40 @@ const LemniskSdkWrapper = {
16
16
  writeKeyAndroid,
17
17
  writeKeyIOS,
18
18
  serverUrl,
19
- consentUrl = null,
20
- notificationCenterUrl = null,
21
- enablePush = true,
22
- enableDebugMode = false,
23
- enableAnalytics = true
19
+ consentUrl,
20
+ notificationCenterUrl,
21
+ enablePush,
22
+ enablePullNotifications,
23
+ enableDebugMode,
24
+ enableAnalytics,
25
+ enableInApp
24
26
  } = options;
25
27
 
26
28
  // Use platform-specific writeKey
27
29
  const writeKey = _reactNative.Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;
28
- return LemniskSdk.init(writeKey, serverUrl, consentUrl, notificationCenterUrl, enablePush, enableDebugMode, enableAnalytics);
30
+
31
+ // Send ONE config object over the bridge. Native maps these friendly keys
32
+ // to its own config keys and runs the runtime init/configure path. To add a
33
+ // new config, add a key here (+ InitOptions + docs) — no bridge signature
34
+ // change. Omitted keys mean "leave the SDK/manifest default".
35
+ const config = {
36
+ writeKey,
37
+ serverUrl
38
+ };
39
+ if (consentUrl != null) config.consentUrl = consentUrl;
40
+ if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;
41
+ // Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on
42
+ // the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,
43
+ // which won because NS_RT > NS_MFST on Android. The native default for
44
+ // push on Android is false (opt-in via manifest), so omitting the key
45
+ // here would silently disable push for existing RN hosts on upgrade.
46
+ // Default to true and let the caller pass false explicitly to opt out.
47
+ config.enablePush = enablePush ?? true;
48
+ config.enableAnalytics = enableAnalytics ?? true;
49
+ if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;
50
+ if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;
51
+ if (enableInApp != null) config.enableInApp = enableInApp;
52
+ return LemniskSdk.init(config);
29
53
  },
30
54
  // Track method with overloads
31
55
  track: function (eventName, properties, otherIds) {
@@ -86,7 +110,14 @@ const LemniskSdkWrapper = {
86
110
  markBulkDelete: LemniskSdk.markBulkDelete,
87
111
  readAll: LemniskSdk.readAll,
88
112
  deleteAll: LemniskSdk.deleteAll,
89
- resetUser: LemniskSdk.resetUser
113
+ resetUser: LemniskSdk.resetUser,
114
+ // InApp context & channel control
115
+ setContext: LemniskSdk.setContext,
116
+ clearContext: LemniskSdk.clearContext,
117
+ pauseInApp: LemniskSdk.pauseInApp,
118
+ resumeInApp: LemniskSdk.resumeInApp,
119
+ // Auto-init status (native manifest/Info.plist auto-init OR explicit init)
120
+ isInitialized: LemniskSdk.isInitialized
90
121
  };
91
122
  var _default = exports.default = LemniskSdkWrapper;
92
123
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","LemniskSdkWrapper","init","options","writeKeyAndroid","writeKeyIOS","serverUrl","consentUrl","notificationCenterUrl","enablePush","enableDebugMode","enableAnalytics","writeKey","Platform","OS","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","registerForPush","setCustomConsent","transactional","promotional","getCustomConsent","callback","consent","createLemniskEvent","setUniqueUserId","getUniqueUserId","getOSConsent","setCustomerDeviceId","overrideDeviceId","getUnreadCount","markRead","markBulkRead","markDelete","markBulkDelete","readAll","deleteAll","resetUser","_default","exports","default"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\ntype ConsentOptions = {\n transactional: boolean;\n promotional: boolean;\n};\n\ntype InitOptions = {\n writeKeyAndroid: string;\n writeKeyIOS: string;\n serverUrl: string;\n consentUrl?: string;\n notificationCenterUrl?: string;\n enablePush?: boolean;\n enableDebugMode?: boolean;\n enableAnalytics?: boolean;\n};\n\ntype LemniskSdkType = {\n init(options: InitOptions): void;\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(title?: string, message?: string): any;\n setUniqueUserId(tokenizedCid: string): void;\n getUniqueUserId(): string;\n setCustomConsent(options: ConsentOptions): void;\n getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;\n getOSConsent(callback: (consent: number) => void): void;\n setCustomerDeviceId(deviceId: string): void;\n overrideDeviceId(deviceId: string): void;\n getUnreadCount(tokenizedCid: string): Promise<number>;\n markRead(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;\n markDelete(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;\n readAll(tokenizedCid: string, type: string): Promise<boolean>;\n deleteAll(tokenizedCid: string, type: string): Promise<boolean>;\n resetUser(): void;\n};\n\n// Create wrapper with overloaded methods\nconst LemniskSdkWrapper = {\n // Init method to configure SDK from JavaScript\n init: function(options: InitOptions): void {\n const {\n writeKeyAndroid,\n writeKeyIOS,\n serverUrl,\n consentUrl = null,\n notificationCenterUrl = null,\n enablePush = true,\n enableDebugMode = false,\n enableAnalytics = true,\n } = options;\n \n // Use platform-specific writeKey\n const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;\n \n return LemniskSdk.init(\n writeKey,\n serverUrl,\n consentUrl,\n notificationCenterUrl,\n enablePush,\n enableDebugMode,\n enableAnalytics\n );\n },\n\n // Track method with overloads\n track: function(eventName: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.trackWithIds(eventName, properties, otherIds);\n } else {\n return LemniskSdk.track(eventName, properties);\n }\n },\n\n // Screen method with overloads\n screen: function(name: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.screenWithIds(name, properties, otherIds);\n } else {\n return LemniskSdk.screen(name, properties);\n }\n },\n\n // Identify method with overloads\n identify: function(userId: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.identifyWithIds(userId, properties, otherIds);\n } else {\n return LemniskSdk.identify(userId, properties);\n }\n },\n\n // Platform-specific push notification registration\n registerForPushNotifications: (title?: string, message?: string) => {\n if (Platform.OS === \"android\") {\n return LemniskSdk.registerForPush(title, message);\n } else if (Platform.OS === \"ios\") {\n return LemniskSdk.registerForPush();\n }\n },\n\n // Custom consent with object parameter\n setCustomConsent: (options: ConsentOptions) => {\n return LemniskSdk.setCustomConsent(options.transactional, options.promotional);\n },\n\n // Custom consent getter with transformed callback\n getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n },\n\n // Pass-through methods (no modification needed)\n createLemniskEvent: LemniskSdk.createLemniskEvent,\n setUniqueUserId: LemniskSdk.setUniqueUserId,\n getUniqueUserId: LemniskSdk.getUniqueUserId,\n getOSConsent: LemniskSdk.getOSConsent,\n setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,\n overrideDeviceId: LemniskSdk.overrideDeviceId,\n getUnreadCount: LemniskSdk.getUnreadCount,\n markRead: LemniskSdk.markRead,\n markBulkRead: LemniskSdk.markBulkRead,\n markDelete: LemniskSdk.markDelete,\n markBulkDelete: LemniskSdk.markBulkDelete,\n readAll: LemniskSdk.readAll,\n deleteAll: LemniskSdk.deleteAll,\n resetUser: LemniskSdk.resetUser,\n};\n\nexport default LemniskSdkWrapper as LemniskSdkType;"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAW,CAAC,GAAGC,0BAAa;AA6CpC;AACA,MAAMC,iBAAiB,GAAG;EACxB;EACAC,IAAI,EAAE,SAAAA,CAASC,OAAoB,EAAQ;I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CC,cAAc,EAAEhD,UAAU,CAACgD,cAAc;EACzCC,OAAO,EAAEjD,UAAU,CAACiD,OAAO;EAC3BC,SAAS,EAAElD,UAAU,CAACkD,SAAS;EAC/BC,SAAS,EAAEnD,UAAU,CAACmD;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEapD,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","LemniskSdkWrapper","init","options","writeKeyAndroid","writeKeyIOS","serverUrl","consentUrl","notificationCenterUrl","enablePush","enablePullNotifications","enableDebugMode","enableAnalytics","enableInApp","writeKey","Platform","OS","config","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","registerForPush","setCustomConsent","transactional","promotional","getCustomConsent","callback","consent","createLemniskEvent","setUniqueUserId","getUniqueUserId","getOSConsent","setCustomerDeviceId","overrideDeviceId","getUnreadCount","markRead","markBulkRead","markDelete","markBulkDelete","readAll","deleteAll","resetUser","setContext","clearContext","pauseInApp","resumeInApp","isInitialized","_default","exports","default"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\ntype ConsentOptions = {\n transactional: boolean;\n promotional: boolean;\n};\n\ntype InitOptions = {\n writeKeyAndroid: string;\n writeKeyIOS: string;\n serverUrl: string;\n consentUrl?: string;\n notificationCenterUrl?: string;\n enablePush?: boolean;\n enablePullNotifications?: boolean;\n enableDebugMode?: boolean;\n enableAnalytics?: boolean;\n enableInApp?: boolean;\n};\n\ntype LemniskSdkType = {\n init(options: InitOptions): void;\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(title?: string, message?: string): any;\n setUniqueUserId(tokenizedCid: string): void;\n getUniqueUserId(): string;\n setCustomConsent(options: ConsentOptions): void;\n getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;\n getOSConsent(callback: (consent: number) => void): void;\n setCustomerDeviceId(deviceId: string): void;\n overrideDeviceId(deviceId: string): void;\n getUnreadCount(tokenizedCid: string): Promise<number>;\n markRead(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;\n markDelete(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;\n readAll(tokenizedCid: string, type: string): Promise<boolean>;\n deleteAll(tokenizedCid: string, type: string): Promise<boolean>;\n resetUser(): void;\n setContext(context: string): void;\n clearContext(): void;\n pauseInApp(): void;\n resumeInApp(): void;\n isInitialized(): boolean;\n};\n\n// Create wrapper with overloaded methods\nconst LemniskSdkWrapper = {\n // Init method to configure SDK from JavaScript\n init: function(options: InitOptions): void {\n const {\n writeKeyAndroid,\n writeKeyIOS,\n serverUrl,\n consentUrl,\n notificationCenterUrl,\n enablePush,\n enablePullNotifications,\n enableDebugMode,\n enableAnalytics,\n enableInApp,\n } = options;\n\n // Use platform-specific writeKey\n const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;\n\n // Send ONE config object over the bridge. Native maps these friendly keys\n // to its own config keys and runs the runtime init/configure path. To add a\n // new config, add a key here (+ InitOptions + docs) — no bridge signature\n // change. Omitted keys mean \"leave the SDK/manifest default\".\n const config: { [key: string]: string | boolean } = { writeKey, serverUrl };\n if (consentUrl != null) config.consentUrl = consentUrl;\n if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;\n // Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on\n // the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,\n // which won because NS_RT > NS_MFST on Android. The native default for\n // push on Android is false (opt-in via manifest), so omitting the key\n // here would silently disable push for existing RN hosts on upgrade.\n // Default to true and let the caller pass false explicitly to opt out.\n config.enablePush = enablePush ?? true;\n config.enableAnalytics = enableAnalytics ?? true;\n if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;\n if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;\n if (enableInApp != null) config.enableInApp = enableInApp;\n\n return LemniskSdk.init(config);\n },\n\n // Track method with overloads\n track: function(eventName: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.trackWithIds(eventName, properties, otherIds);\n } else {\n return LemniskSdk.track(eventName, properties);\n }\n },\n\n // Screen method with overloads\n screen: function(name: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.screenWithIds(name, properties, otherIds);\n } else {\n return LemniskSdk.screen(name, properties);\n }\n },\n\n // Identify method with overloads\n identify: function(userId: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.identifyWithIds(userId, properties, otherIds);\n } else {\n return LemniskSdk.identify(userId, properties);\n }\n },\n\n // Platform-specific push notification registration\n registerForPushNotifications: (title?: string, message?: string) => {\n if (Platform.OS === \"android\") {\n return LemniskSdk.registerForPush(title, message);\n } else if (Platform.OS === \"ios\") {\n return LemniskSdk.registerForPush();\n }\n },\n\n // Custom consent with object parameter\n setCustomConsent: (options: ConsentOptions) => {\n return LemniskSdk.setCustomConsent(options.transactional, options.promotional);\n },\n\n // Custom consent getter with transformed callback\n getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n },\n\n // Pass-through methods (no modification needed)\n createLemniskEvent: LemniskSdk.createLemniskEvent,\n setUniqueUserId: LemniskSdk.setUniqueUserId,\n getUniqueUserId: LemniskSdk.getUniqueUserId,\n getOSConsent: LemniskSdk.getOSConsent,\n setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,\n overrideDeviceId: LemniskSdk.overrideDeviceId,\n getUnreadCount: LemniskSdk.getUnreadCount,\n markRead: LemniskSdk.markRead,\n markBulkRead: LemniskSdk.markBulkRead,\n markDelete: LemniskSdk.markDelete,\n markBulkDelete: LemniskSdk.markBulkDelete,\n readAll: LemniskSdk.readAll,\n deleteAll: LemniskSdk.deleteAll,\n resetUser: LemniskSdk.resetUser,\n\n // InApp context & channel control\n setContext: LemniskSdk.setContext,\n clearContext: LemniskSdk.clearContext,\n pauseInApp: LemniskSdk.pauseInApp,\n resumeInApp: LemniskSdk.resumeInApp,\n\n // Auto-init status (native manifest/Info.plist auto-init OR explicit init)\n isInitialized: LemniskSdk.isInitialized,\n};\n\nexport default LemniskSdkWrapper as LemniskSdkType;"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAW,CAAC,GAAGC,0BAAa;AAoDpC;AACA,MAAMC,iBAAiB,GAAG;EACxB;EACAC,IAAI,EAAE,SAAAA,CAASC,OAAoB,EAAQ;IACzC,MAAM;MACJC,eAAe;MACfC,WAAW;MACXC,SAAS;MACTC,UAAU;MACVC,qBAAqB;MACrBC,UAAU;MACVC,uBAAuB;MACvBC,eAAe;MACfC,eAAe;MACfC;IACF,CAAC,GAAGV,OAAO;;IAEX;IACA,MAAMW,QAAQ,GAAGC,qBAAQ,CAACC,EAAE,KAAK,KAAK,GAAGX,WAAW,GAAGD,eAAe;;IAEtE;IACA;IACA;IACA;IACA,MAAMa,MAA2C,GAAG;MAAEH,QAAQ;MAAER;IAAU,CAAC;IAC3E,IAAIC,UAAU,IAAI,IAAI,EAAEU,MAAM,CAACV,UAAU,GAAGA,UAAU;IACtD,IAAIC,qBAAqB,IAAI,IAAI,EAAES,MAAM,CAACT,qBAAqB,GAAGA,qBAAqB;IACvF;IACA;IACA;IACA;IACA;IACA;IACAS,MAAM,CAACR,UAAU,GAAOA,UAAU,IAAQ,IAAI;IAC9CQ,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AAU,CAACqD,SAAS;EAC/BC,SAAS,EAAEtD,UAAU,CAACsD,SAAS;EAE/B;EACAC,UAAU,EAAEvD,UAAU,CAACuD,UAAU;EACjCC,YAAY,EAAExD,UAAU,CAACwD,YAAY;EACrCC,UAAU,EAAEzD,UAAU,CAACyD,UAAU;EACjCC,WAAW,EAAE1D,UAAU,CAAC0D,WAAW;EAEnC;EACAC,aAAa,EAAE3D,UAAU,CAAC2D;AAC5B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa5D,iBAAiB","ignoreList":[]}
@@ -10,16 +10,40 @@ const LemniskSdkWrapper = {
10
10
  writeKeyAndroid,
11
11
  writeKeyIOS,
12
12
  serverUrl,
13
- consentUrl = null,
14
- notificationCenterUrl = null,
15
- enablePush = true,
16
- enableDebugMode = false,
17
- enableAnalytics = true
13
+ consentUrl,
14
+ notificationCenterUrl,
15
+ enablePush,
16
+ enablePullNotifications,
17
+ enableDebugMode,
18
+ enableAnalytics,
19
+ enableInApp
18
20
  } = options;
19
21
 
20
22
  // Use platform-specific writeKey
21
23
  const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;
22
- return LemniskSdk.init(writeKey, serverUrl, consentUrl, notificationCenterUrl, enablePush, enableDebugMode, enableAnalytics);
24
+
25
+ // Send ONE config object over the bridge. Native maps these friendly keys
26
+ // to its own config keys and runs the runtime init/configure path. To add a
27
+ // new config, add a key here (+ InitOptions + docs) — no bridge signature
28
+ // change. Omitted keys mean "leave the SDK/manifest default".
29
+ const config = {
30
+ writeKey,
31
+ serverUrl
32
+ };
33
+ if (consentUrl != null) config.consentUrl = consentUrl;
34
+ if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;
35
+ // Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on
36
+ // the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,
37
+ // which won because NS_RT > NS_MFST on Android. The native default for
38
+ // push on Android is false (opt-in via manifest), so omitting the key
39
+ // here would silently disable push for existing RN hosts on upgrade.
40
+ // Default to true and let the caller pass false explicitly to opt out.
41
+ config.enablePush = enablePush ?? true;
42
+ config.enableAnalytics = enableAnalytics ?? true;
43
+ if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;
44
+ if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;
45
+ if (enableInApp != null) config.enableInApp = enableInApp;
46
+ return LemniskSdk.init(config);
23
47
  },
24
48
  // Track method with overloads
25
49
  track: function (eventName, properties, otherIds) {
@@ -80,7 +104,14 @@ const LemniskSdkWrapper = {
80
104
  markBulkDelete: LemniskSdk.markBulkDelete,
81
105
  readAll: LemniskSdk.readAll,
82
106
  deleteAll: LemniskSdk.deleteAll,
83
- resetUser: LemniskSdk.resetUser
107
+ resetUser: LemniskSdk.resetUser,
108
+ // InApp context & channel control
109
+ setContext: LemniskSdk.setContext,
110
+ clearContext: LemniskSdk.clearContext,
111
+ pauseInApp: LemniskSdk.pauseInApp,
112
+ resumeInApp: LemniskSdk.resumeInApp,
113
+ // Auto-init status (native manifest/Info.plist auto-init OR explicit init)
114
+ isInitialized: LemniskSdk.isInitialized
84
115
  };
85
116
  export default LemniskSdkWrapper;
86
117
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LemniskSdk","LemniskSdkWrapper","init","options","writeKeyAndroid","writeKeyIOS","serverUrl","consentUrl","notificationCenterUrl","enablePush","enableDebugMode","enableAnalytics","writeKey","OS","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","registerForPush","setCustomConsent","transactional","promotional","getCustomConsent","callback","consent","createLemniskEvent","setUniqueUserId","getUniqueUserId","getOSConsent","setCustomerDeviceId","overrideDeviceId","getUnreadCount","markRead","markBulkRead","markDelete","markBulkDelete","readAll","deleteAll","resetUser"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\ntype ConsentOptions = {\n transactional: boolean;\n promotional: boolean;\n};\n\ntype InitOptions = {\n writeKeyAndroid: string;\n writeKeyIOS: string;\n serverUrl: string;\n consentUrl?: string;\n notificationCenterUrl?: string;\n enablePush?: boolean;\n enableDebugMode?: boolean;\n enableAnalytics?: boolean;\n};\n\ntype LemniskSdkType = {\n init(options: InitOptions): void;\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(title?: string, message?: string): any;\n setUniqueUserId(tokenizedCid: string): void;\n getUniqueUserId(): string;\n setCustomConsent(options: ConsentOptions): void;\n getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;\n getOSConsent(callback: (consent: number) => void): void;\n setCustomerDeviceId(deviceId: string): void;\n overrideDeviceId(deviceId: string): void;\n getUnreadCount(tokenizedCid: string): Promise<number>;\n markRead(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;\n markDelete(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;\n readAll(tokenizedCid: string, type: string): Promise<boolean>;\n deleteAll(tokenizedCid: string, type: string): Promise<boolean>;\n resetUser(): void;\n};\n\n// Create wrapper with overloaded methods\nconst LemniskSdkWrapper = {\n // Init method to configure SDK from JavaScript\n init: function(options: InitOptions): void {\n const {\n writeKeyAndroid,\n writeKeyIOS,\n serverUrl,\n consentUrl = null,\n notificationCenterUrl = null,\n enablePush = true,\n enableDebugMode = false,\n enableAnalytics = true,\n } = options;\n \n // Use platform-specific writeKey\n const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;\n \n return LemniskSdk.init(\n writeKey,\n serverUrl,\n consentUrl,\n notificationCenterUrl,\n enablePush,\n enableDebugMode,\n enableAnalytics\n );\n },\n\n // Track method with overloads\n track: function(eventName: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.trackWithIds(eventName, properties, otherIds);\n } else {\n return LemniskSdk.track(eventName, properties);\n }\n },\n\n // Screen method with overloads\n screen: function(name: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.screenWithIds(name, properties, otherIds);\n } else {\n return LemniskSdk.screen(name, properties);\n }\n },\n\n // Identify method with overloads\n identify: function(userId: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.identifyWithIds(userId, properties, otherIds);\n } else {\n return LemniskSdk.identify(userId, properties);\n }\n },\n\n // Platform-specific push notification registration\n registerForPushNotifications: (title?: string, message?: string) => {\n if (Platform.OS === \"android\") {\n return LemniskSdk.registerForPush(title, message);\n } else if (Platform.OS === \"ios\") {\n return LemniskSdk.registerForPush();\n }\n },\n\n // Custom consent with object parameter\n setCustomConsent: (options: ConsentOptions) => {\n return LemniskSdk.setCustomConsent(options.transactional, options.promotional);\n },\n\n // Custom consent getter with transformed callback\n getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n },\n\n // Pass-through methods (no modification needed)\n createLemniskEvent: LemniskSdk.createLemniskEvent,\n setUniqueUserId: LemniskSdk.setUniqueUserId,\n getUniqueUserId: LemniskSdk.getUniqueUserId,\n getOSConsent: LemniskSdk.getOSConsent,\n setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,\n overrideDeviceId: LemniskSdk.overrideDeviceId,\n getUnreadCount: LemniskSdk.getUnreadCount,\n markRead: LemniskSdk.markRead,\n markBulkRead: LemniskSdk.markBulkRead,\n markDelete: LemniskSdk.markDelete,\n markBulkDelete: LemniskSdk.markBulkDelete,\n readAll: LemniskSdk.readAll,\n deleteAll: LemniskSdk.deleteAll,\n resetUser: LemniskSdk.resetUser,\n};\n\nexport default LemniskSdkWrapper as LemniskSdkType;"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAM;EAAEC;AAAW,CAAC,GAAGF,aAAa;AA6CpC;AACA,MAAMG,iBAAiB,GAAG;EACxB;EACAC,IAAI,EAAE,SAAAA,CAASC,OAAoB,EAAQ;IACzC,MAAM;MACJC,eAAe;MACfC,WAAW;MACXC,SAAS;MACTC,UAAU,GAAG,IAAI;MACjBC,qBAAqB,GAAG,IAAI;MAC5BC,UAAU,GAAG,IAAI;MACjBC,eAAe,GAAG,KAAK;MACvBC,eAAe,GAAG;IACpB,CAAC,GAAGR,OAAO;;IAEX;IACA,MAAMS,QAAQ,GAAGb,QAAQ,CAACc,EAAE,KAAK,KAAK,GAAGR,WAAW,GAAGD,eAAe;IAEtE,OAAOJ,UAAU,CAACE,IAAI,CACpBU,QAAQ,EACRN,SAAS,EACTC,UAAU,EACVC,qBAAqB,EACrBC,UAAU,EACVC,eAAe,EACfC,eACF,CAAC;EACH,CAAC;EAED;EACAG,KAAK,EAAE,SAAAA,CAASC,SAAiB,EAAEC,UAAkB,EAAEC,QAAiB,EAAO;IAC7E,IAAIA,QAAQ,KAAKC,SAAS,EAAE;MAC1B,OAAOlB,UAAU,CAACmB,YAAY,CAACJ,SAAS,EAAEC,UAAU,EAAEC,QAAQ,CAAC;IACjE,CAAC,MAAM;MACL,OAAOjB,UAAU,CAACc,KAAK,CAACC,SAAS,EAAEC,UAAU,CAAC;IAChD;EACF,CAAC;EAED;EACAI,MAAM,EAAE,SAAAA,CAASC,IAAY,EAAEL,UAAkB,EAAEC,QAAiB,EAAO;IACzE,IAAIA,QAAQ,KAAKC,SAAS,EAAE;MAC1B,OAAOlB,UAAU,CAACsB,aAAa,CAACD,IAAI,EAAEL,UAAU,EAAEC,QAAQ,CAAC;IAC7D,C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AAEvC,UAAU,CAACuC,YAAY;EACrCC,mBAAmB,EAAExC,UAAU,CAACwC,mBAAmB;EACnDC,gBAAgB,EAAEzC,UAAU,CAACyC,gBAAgB;EAC7CC,cAAc,EAAE1C,UAAU,CAAC0C,cAAc;EACzCC,QAAQ,EAAE3C,UAAU,CAAC2C,QAAQ;EAC7BC,YAAY,EAAE5C,UAAU,CAAC4C,YAAY;EACrCC,UAAU,EAAE7C,UAAU,CAAC6C,UAAU;EACjCC,cAAc,EAAE9C,UAAU,CAAC8C,cAAc;EACzCC,OAAO,EAAE/C,UAAU,CAAC+C,OAAO;EAC3BC,SAAS,EAAEhD,UAAU,CAACgD,SAAS;EAC/BC,SAAS,EAAEjD,UAAU,CAACiD;AACxB,CAAC;AAED,eAAehD,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","Platform","LemniskSdk","LemniskSdkWrapper","init","options","writeKeyAndroid","writeKeyIOS","serverUrl","consentUrl","notificationCenterUrl","enablePush","enablePullNotifications","enableDebugMode","enableAnalytics","enableInApp","writeKey","OS","config","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","registerForPush","setCustomConsent","transactional","promotional","getCustomConsent","callback","consent","createLemniskEvent","setUniqueUserId","getUniqueUserId","getOSConsent","setCustomerDeviceId","overrideDeviceId","getUnreadCount","markRead","markBulkRead","markDelete","markBulkDelete","readAll","deleteAll","resetUser","setContext","clearContext","pauseInApp","resumeInApp","isInitialized"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst { LemniskSdk } = NativeModules;\n\ntype ConsentOptions = {\n transactional: boolean;\n promotional: boolean;\n};\n\ntype InitOptions = {\n writeKeyAndroid: string;\n writeKeyIOS: string;\n serverUrl: string;\n consentUrl?: string;\n notificationCenterUrl?: string;\n enablePush?: boolean;\n enablePullNotifications?: boolean;\n enableDebugMode?: boolean;\n enableAnalytics?: boolean;\n enableInApp?: boolean;\n};\n\ntype LemniskSdkType = {\n init(options: InitOptions): void;\n createLemniskEvent(name: string, object: object): any;\n track(eventName: string, properties: object): any;\n track(eventName: string, properties: object, otherIds: object): any;\n screen(name: string, properties: object): any;\n screen(name: string, properties: object, otherIds: object): any;\n identify(userId: string, properties: object): any;\n identify(userId: string, properties: object, otherIds: object): any;\n registerForPushNotifications(title?: string, message?: string): any;\n setUniqueUserId(tokenizedCid: string): void;\n getUniqueUserId(): string;\n setCustomConsent(options: ConsentOptions): void;\n getCustomConsent(callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void): void;\n getOSConsent(callback: (consent: number) => void): void;\n setCustomerDeviceId(deviceId: string): void;\n overrideDeviceId(deviceId: string): void;\n getUnreadCount(tokenizedCid: string): Promise<number>;\n markRead(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkRead(tokenizedCid: string, pids: string[]): Promise<boolean>;\n markDelete(tokenizedCid: string, pid: string): Promise<boolean>;\n markBulkDelete(tokenizedCid: string, pids: string[]): Promise<boolean>;\n readAll(tokenizedCid: string, type: string): Promise<boolean>;\n deleteAll(tokenizedCid: string, type: string): Promise<boolean>;\n resetUser(): void;\n setContext(context: string): void;\n clearContext(): void;\n pauseInApp(): void;\n resumeInApp(): void;\n isInitialized(): boolean;\n};\n\n// Create wrapper with overloaded methods\nconst LemniskSdkWrapper = {\n // Init method to configure SDK from JavaScript\n init: function(options: InitOptions): void {\n const {\n writeKeyAndroid,\n writeKeyIOS,\n serverUrl,\n consentUrl,\n notificationCenterUrl,\n enablePush,\n enablePullNotifications,\n enableDebugMode,\n enableAnalytics,\n enableInApp,\n } = options;\n\n // Use platform-specific writeKey\n const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;\n\n // Send ONE config object over the bridge. Native maps these friendly keys\n // to its own config keys and runs the runtime init/configure path. To add a\n // new config, add a key here (+ InitOptions + docs) — no bridge signature\n // change. Omitted keys mean \"leave the SDK/manifest default\".\n const config: { [key: string]: string | boolean } = { writeKey, serverUrl };\n if (consentUrl != null) config.consentUrl = consentUrl;\n if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;\n // Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on\n // the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,\n // which won because NS_RT > NS_MFST on Android. The native default for\n // push on Android is false (opt-in via manifest), so omitting the key\n // here would silently disable push for existing RN hosts on upgrade.\n // Default to true and let the caller pass false explicitly to opt out.\n config.enablePush = enablePush ?? true;\n config.enableAnalytics = enableAnalytics ?? true;\n if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;\n if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;\n if (enableInApp != null) config.enableInApp = enableInApp;\n\n return LemniskSdk.init(config);\n },\n\n // Track method with overloads\n track: function(eventName: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.trackWithIds(eventName, properties, otherIds);\n } else {\n return LemniskSdk.track(eventName, properties);\n }\n },\n\n // Screen method with overloads\n screen: function(name: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.screenWithIds(name, properties, otherIds);\n } else {\n return LemniskSdk.screen(name, properties);\n }\n },\n\n // Identify method with overloads\n identify: function(userId: string, properties: object, otherIds?: object): any {\n if (otherIds !== undefined) {\n return LemniskSdk.identifyWithIds(userId, properties, otherIds);\n } else {\n return LemniskSdk.identify(userId, properties);\n }\n },\n\n // Platform-specific push notification registration\n registerForPushNotifications: (title?: string, message?: string) => {\n if (Platform.OS === \"android\") {\n return LemniskSdk.registerForPush(title, message);\n } else if (Platform.OS === \"ios\") {\n return LemniskSdk.registerForPush();\n }\n },\n\n // Custom consent with object parameter\n setCustomConsent: (options: ConsentOptions) => {\n return LemniskSdk.setCustomConsent(options.transactional, options.promotional);\n },\n\n // Custom consent getter with transformed callback\n getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {\n LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {\n callback({\n transactional: consent[0],\n promotional: consent[1]\n });\n });\n },\n\n // Pass-through methods (no modification needed)\n createLemniskEvent: LemniskSdk.createLemniskEvent,\n setUniqueUserId: LemniskSdk.setUniqueUserId,\n getUniqueUserId: LemniskSdk.getUniqueUserId,\n getOSConsent: LemniskSdk.getOSConsent,\n setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,\n overrideDeviceId: LemniskSdk.overrideDeviceId,\n getUnreadCount: LemniskSdk.getUnreadCount,\n markRead: LemniskSdk.markRead,\n markBulkRead: LemniskSdk.markBulkRead,\n markDelete: LemniskSdk.markDelete,\n markBulkDelete: LemniskSdk.markBulkDelete,\n readAll: LemniskSdk.readAll,\n deleteAll: LemniskSdk.deleteAll,\n resetUser: LemniskSdk.resetUser,\n\n // InApp context & channel control\n setContext: LemniskSdk.setContext,\n clearContext: LemniskSdk.clearContext,\n pauseInApp: LemniskSdk.pauseInApp,\n resumeInApp: LemniskSdk.resumeInApp,\n\n // Auto-init status (native manifest/Info.plist auto-init OR explicit init)\n isInitialized: LemniskSdk.isInitialized,\n};\n\nexport default LemniskSdkWrapper as LemniskSdkType;"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAM;EAAEC;AAAW,CAAC,GAAGF,aAAa;AAoDpC;AACA,MAAMG,iBAAiB,GAAG;EACxB;EACAC,IAAI,EAAE,SAAAA,CAASC,OAAoB,EAAQ;IACzC,MAAM;MACJC,eAAe;MACfC,WAAW;MACXC,SAAS;MACTC,UAAU;MACVC,qBAAqB;MACrBC,UAAU;MACVC,uBAAuB;MACvBC,eAAe;MACfC,eAAe;MACfC;IACF,CAAC,GAAGV,OAAO;;IAEX;IACA,MAAMW,QAAQ,GAAGf,QAAQ,CAACgB,EAAE,KAAK,KAAK,GAAGV,WAAW,GAAGD,eAAe;;IAEtE;IACA;IACA;IACA;IACA,MAAMY,MAA2C,GAAG;MAAEF,QAAQ;MAAER;IAAU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C,cAAc;EACzCC,QAAQ,EAAE9C,UAAU,CAAC8C,QAAQ;EAC7BC,YAAY,EAAE/C,UAAU,CAAC+C,YAAY;EACrCC,UAAU,EAAEhD,UAAU,CAACgD,UAAU;EACjCC,cAAc,EAAEjD,UAAU,CAACiD,cAAc;EACzCC,OAAO,EAAElD,UAAU,CAACkD,OAAO;EAC3BC,SAAS,EAAEnD,UAAU,CAACmD,SAAS;EAC/BC,SAAS,EAAEpD,UAAU,CAACoD,SAAS;EAE/B;EACAC,UAAU,EAAErD,UAAU,CAACqD,UAAU;EACjCC,YAAY,EAAEtD,UAAU,CAACsD,YAAY;EACrCC,UAAU,EAAEvD,UAAU,CAACuD,UAAU;EACjCC,WAAW,EAAExD,UAAU,CAACwD,WAAW;EAEnC;EACAC,aAAa,EAAEzD,UAAU,CAACyD;AAC5B,CAAC;AAED,eAAexD,iBAAiB","ignoreList":[]}
@@ -9,8 +9,10 @@ type InitOptions = {
9
9
  consentUrl?: string;
10
10
  notificationCenterUrl?: string;
11
11
  enablePush?: boolean;
12
+ enablePullNotifications?: boolean;
12
13
  enableDebugMode?: boolean;
13
14
  enableAnalytics?: boolean;
15
+ enableInApp?: boolean;
14
16
  };
15
17
  type LemniskSdkType = {
16
18
  init(options: InitOptions): void;
@@ -40,6 +42,11 @@ type LemniskSdkType = {
40
42
  readAll(tokenizedCid: string, type: string): Promise<boolean>;
41
43
  deleteAll(tokenizedCid: string, type: string): Promise<boolean>;
42
44
  resetUser(): void;
45
+ setContext(context: string): void;
46
+ clearContext(): void;
47
+ pauseInApp(): void;
48
+ resumeInApp(): void;
49
+ isInitialized(): boolean;
43
50
  };
44
51
  declare const _default: LemniskSdkType;
45
52
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lemnisk-react-native",
3
- "version": "0.1.27",
3
+ "version": "0.2.0",
4
4
  "description": "plugin to setup the lemnisk sdk on both android and ios platform",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -29,6 +29,7 @@
29
29
  "!**/*.class",
30
30
  "!**/*.jar",
31
31
  "!ios/build",
32
+ "!ios/**/xcuserdata",
32
33
  "!**/__tests__",
33
34
  "!**/__fixtures__",
34
35
  "!**/__mocks__",
@@ -54,6 +55,7 @@
54
55
  "url": "git+https://github.com/Immensitas/lemnisk-app-sdk"
55
56
  },
56
57
  "author": "Lemnisk",
58
+ "license": "MIT",
57
59
  "bugs": {
58
60
  "url": "https://github.com/Immensitas/lemnisk-app-sdk/issues"
59
61
  },
package/src/index.tsx CHANGED
@@ -14,8 +14,10 @@ type InitOptions = {
14
14
  consentUrl?: string;
15
15
  notificationCenterUrl?: string;
16
16
  enablePush?: boolean;
17
+ enablePullNotifications?: boolean;
17
18
  enableDebugMode?: boolean;
18
19
  enableAnalytics?: boolean;
20
+ enableInApp?: boolean;
19
21
  };
20
22
 
21
23
  type LemniskSdkType = {
@@ -43,6 +45,11 @@ type LemniskSdkType = {
43
45
  readAll(tokenizedCid: string, type: string): Promise<boolean>;
44
46
  deleteAll(tokenizedCid: string, type: string): Promise<boolean>;
45
47
  resetUser(): void;
48
+ setContext(context: string): void;
49
+ clearContext(): void;
50
+ pauseInApp(): void;
51
+ resumeInApp(): void;
52
+ isInitialized(): boolean;
46
53
  };
47
54
 
48
55
  // Create wrapper with overloaded methods
@@ -53,25 +60,38 @@ const LemniskSdkWrapper = {
53
60
  writeKeyAndroid,
54
61
  writeKeyIOS,
55
62
  serverUrl,
56
- consentUrl = null,
57
- notificationCenterUrl = null,
58
- enablePush = true,
59
- enableDebugMode = false,
60
- enableAnalytics = true,
61
- } = options;
62
-
63
- // Use platform-specific writeKey
64
- const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;
65
-
66
- return LemniskSdk.init(
67
- writeKey,
68
- serverUrl,
69
63
  consentUrl,
70
64
  notificationCenterUrl,
71
65
  enablePush,
66
+ enablePullNotifications,
72
67
  enableDebugMode,
73
- enableAnalytics
74
- );
68
+ enableAnalytics,
69
+ enableInApp,
70
+ } = options;
71
+
72
+ // Use platform-specific writeKey
73
+ const writeKey = Platform.OS === 'ios' ? writeKeyIOS : writeKeyAndroid;
74
+
75
+ // Send ONE config object over the bridge. Native maps these friendly keys
76
+ // to its own config keys and runs the runtime init/configure path. To add a
77
+ // new config, add a key here (+ InitOptions + docs) — no bridge signature
78
+ // change. Omitted keys mean "leave the SDK/manifest default".
79
+ const config: { [key: string]: string | boolean } = { writeKey, serverUrl };
80
+ if (consentUrl != null) config.consentUrl = consentUrl;
81
+ if (notificationCenterUrl != null) config.notificationCenterUrl = notificationCenterUrl;
82
+ // Preserve pre-1.2.0 wrapper behaviour: `init({writeKey, serverUrl})` on
83
+ // the old wrapper implicitly forwarded enablePush=true / enableAnalytics=true,
84
+ // which won because NS_RT > NS_MFST on Android. The native default for
85
+ // push on Android is false (opt-in via manifest), so omitting the key
86
+ // here would silently disable push for existing RN hosts on upgrade.
87
+ // Default to true and let the caller pass false explicitly to opt out.
88
+ config.enablePush = enablePush ?? true;
89
+ config.enableAnalytics = enableAnalytics ?? true;
90
+ if (enablePullNotifications != null) config.enablePullNotifications = enablePullNotifications;
91
+ if (enableDebugMode != null) config.enableDebugMode = enableDebugMode;
92
+ if (enableInApp != null) config.enableInApp = enableInApp;
93
+
94
+ return LemniskSdk.init(config);
75
95
  },
76
96
 
77
97
  // Track method with overloads
@@ -140,6 +160,15 @@ const LemniskSdkWrapper = {
140
160
  readAll: LemniskSdk.readAll,
141
161
  deleteAll: LemniskSdk.deleteAll,
142
162
  resetUser: LemniskSdk.resetUser,
163
+
164
+ // InApp context & channel control
165
+ setContext: LemniskSdk.setContext,
166
+ clearContext: LemniskSdk.clearContext,
167
+ pauseInApp: LemniskSdk.pauseInApp,
168
+ resumeInApp: LemniskSdk.resumeInApp,
169
+
170
+ // Auto-init status (native manifest/Info.plist auto-init OR explicit init)
171
+ isInitialized: LemniskSdk.isInitialized,
143
172
  };
144
173
 
145
174
  export default LemniskSdkWrapper as LemniskSdkType;