lemnisk-react-native 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/.gradle/7.5/checksums/checksums.lock +0 -0
- package/android/.gradle/7.5/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/7.5/checksums/sha1-checksums.bin +0 -0
- package/android/build.gradle +27 -16
- package/android/src/main/java/com/reactnativelemnisksdk/LemniskSdkModule.java +77 -16
- package/ios/LemniskSdk.m +49 -6
- package/lemnisk-react-native.podspec +7 -2
- package/lib/commonjs/index.js +62 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +62 -19
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -0
- package/package.json +1 -1
- package/src/index.tsx +69 -21
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/build.gradle
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
1
|
buildscript {
|
|
3
2
|
if (project == rootProject) {
|
|
4
3
|
repositories {
|
|
5
4
|
google()
|
|
6
5
|
jcenter()
|
|
6
|
+
maven { url 'https://developer.huawei.com/repo/' }
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
dependencies {
|
|
10
|
-
classpath 'com.android.tools.build:gradle:
|
|
10
|
+
classpath 'com.android.tools.build:gradle:8.6.1'
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -26,23 +26,33 @@ android {
|
|
|
26
26
|
targetSdkVersion safeExtGet('LemniskSdk_targetSdkVersion', 34)
|
|
27
27
|
versionCode 1
|
|
28
28
|
versionName "1.0"
|
|
29
|
-
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
buildTypes {
|
|
33
32
|
release {
|
|
34
33
|
minifyEnabled false
|
|
34
|
+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
|
|
38
|
+
buildFeatures {
|
|
39
|
+
buildConfig true
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
lintOptions {
|
|
38
|
-
disable
|
|
43
|
+
disable "GradleCompatible"
|
|
39
44
|
}
|
|
45
|
+
|
|
40
46
|
compileOptions {
|
|
41
|
-
sourceCompatibility JavaVersion.
|
|
42
|
-
targetCompatibility JavaVersion.
|
|
47
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
48
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
|
|
52
|
+
android.defaultConfig {
|
|
53
|
+
buildConfigField "String", "REACT_NATIVE_SDK_VERSION", "\"0.1.22\""
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
repositories {
|
|
47
57
|
mavenLocal()
|
|
48
58
|
maven {
|
|
@@ -51,23 +61,24 @@ repositories {
|
|
|
51
61
|
}
|
|
52
62
|
google()
|
|
53
63
|
jcenter()
|
|
64
|
+
maven { url 'https://developer.huawei.com/repo/' }
|
|
54
65
|
}
|
|
55
66
|
|
|
56
67
|
dependencies {
|
|
57
68
|
//noinspection GradleDynamicVersion
|
|
58
69
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
59
|
-
implementation 'co.lemnisk.app.android:AndroidSDK:1.1.
|
|
60
|
-
implementation 'org.apache.commons:commons-text:1.
|
|
70
|
+
implementation 'co.lemnisk.app.android:AndroidSDK:1.1.56'
|
|
71
|
+
implementation 'org.apache.commons:commons-text:1.11.0'
|
|
61
72
|
//implementation(name:'AndroidSDK-release', ext:'aar')
|
|
62
|
-
implementation group: 'joda-time', name: 'joda-time', version: '2.
|
|
63
|
-
implementation 'com.google.android.gms:play-services-base:18.
|
|
64
|
-
implementation platform('com.google.firebase:firebase-bom:
|
|
73
|
+
implementation group: 'joda-time', name: 'joda-time', version: '2.12.5'
|
|
74
|
+
implementation 'com.google.android.gms:play-services-base:18.5.0'
|
|
75
|
+
implementation platform('com.google.firebase:firebase-bom:33.14.0')
|
|
65
76
|
implementation 'com.google.firebase:firebase-messaging'
|
|
66
|
-
implementation 'com.google.android.gms:play-services-ads-identifier:18.0
|
|
77
|
+
implementation 'com.google.android.gms:play-services-ads-identifier:18.1.0'
|
|
67
78
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
|
68
|
-
implementation 'androidx.work:work-runtime:2.
|
|
69
|
-
implementation 'com.google.code.gson:gson:2.
|
|
70
|
-
implementation 'androidx.lifecycle:lifecycle-process:2.
|
|
71
|
-
implementation 'androidx.lifecycle:lifecycle-common-java8:2.
|
|
79
|
+
implementation 'androidx.work:work-runtime:2.10.1'
|
|
80
|
+
implementation 'com.google.code.gson:gson:2.11.0'
|
|
81
|
+
implementation 'androidx.lifecycle:lifecycle-process:2.9.0'
|
|
82
|
+
implementation 'androidx.lifecycle:lifecycle-common-java8:2.9.0'
|
|
72
83
|
|
|
73
84
|
}
|
|
@@ -16,6 +16,7 @@ import com.google.android.gms.tasks.Task;
|
|
|
16
16
|
import com.google.firebase.messaging.FirebaseMessaging;
|
|
17
17
|
import javax.annotation.Nullable;
|
|
18
18
|
import org.json.JSONObject;
|
|
19
|
+
import org.json.JSONArray;
|
|
19
20
|
import java.util.Iterator;
|
|
20
21
|
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
|
21
22
|
|
|
@@ -61,9 +62,19 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
61
62
|
} else {
|
|
62
63
|
helper.init();
|
|
63
64
|
}
|
|
65
|
+
|
|
66
|
+
// Set cross-platform SDK version for React Native
|
|
67
|
+
helper.setCrossPlatformSDKVersion("react-native-" + BuildConfig.REACT_NATIVE_SDK_VERSION);
|
|
68
|
+
|
|
64
69
|
} catch (Exception e) {
|
|
65
70
|
Log.e("LemniskSdk", "Failed to load meta-data: " + e.getMessage());
|
|
66
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
|
+
}
|
|
67
78
|
}
|
|
68
79
|
}
|
|
69
80
|
});
|
|
@@ -86,14 +97,16 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
86
97
|
Iterator<String> keys = nativeMap.keys();
|
|
87
98
|
while (keys.hasNext()) {
|
|
88
99
|
String key = keys.next();
|
|
89
|
-
|
|
100
|
+
Object value = nativeMap.get(key);
|
|
101
|
+
addAttributeValue(builder, key, value);
|
|
90
102
|
}
|
|
91
103
|
}
|
|
92
104
|
else{
|
|
93
105
|
Iterator<String> keys = attr.keys();
|
|
94
106
|
while (keys.hasNext()) {
|
|
95
107
|
String key = keys.next();
|
|
96
|
-
|
|
108
|
+
Object value = attr.get(key);
|
|
109
|
+
addAttributeValue(builder, key, value);
|
|
97
110
|
}
|
|
98
111
|
}
|
|
99
112
|
return builder.build();
|
|
@@ -105,14 +118,44 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
105
118
|
}
|
|
106
119
|
}
|
|
107
120
|
|
|
121
|
+
private void addAttributeValue(AttributeBuilder.Builder builder, String key, Object value) {
|
|
122
|
+
if (value instanceof JSONObject) {
|
|
123
|
+
// Keep as JSONObject for nested objects
|
|
124
|
+
builder.addAttribute(key, (JSONObject) value);
|
|
125
|
+
} else if (value instanceof JSONArray) {
|
|
126
|
+
// Keep as JSONArray for arrays
|
|
127
|
+
builder.addAttribute(key, (JSONArray) value);
|
|
128
|
+
} else if (value instanceof String) {
|
|
129
|
+
builder.addAttribute(key, (String) value);
|
|
130
|
+
} else if (value instanceof Integer) {
|
|
131
|
+
builder.addAttribute(key, (Integer) value);
|
|
132
|
+
} else if (value instanceof Double) {
|
|
133
|
+
builder.addAttribute(key, (Double) value);
|
|
134
|
+
} else if (value instanceof Boolean) {
|
|
135
|
+
builder.addAttribute(key, (Boolean) value);
|
|
136
|
+
} else if (value != null) {
|
|
137
|
+
// Fallback to string for other types
|
|
138
|
+
builder.addAttribute(key, value.toString());
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
108
142
|
@ReactMethod
|
|
109
|
-
public void track(String eventName, ReadableMap propertiesObject
|
|
143
|
+
public void track(String eventName, ReadableMap propertiesObject) {
|
|
144
|
+
trackWithIds(eventName, propertiesObject, null);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@ReactMethod
|
|
148
|
+
public void trackWithIds(String eventName, ReadableMap propertiesObject, @Nullable ReadableMap otherIdsObject) {
|
|
110
149
|
Log.d("TAG: ", "eventLogging: track: ");
|
|
111
|
-
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + otherIdsObject.toString());
|
|
150
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + (otherIdsObject != null ? otherIdsObject.toString() : "null"));
|
|
112
151
|
try {
|
|
113
152
|
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
|
114
|
-
|
|
115
|
-
|
|
153
|
+
if (otherIdsObject != null) {
|
|
154
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
|
155
|
+
LemniskHelper.getInstance(getReactApplicationContext()).track(eventName,propertiesBuilder,otherIdsBuilder);
|
|
156
|
+
} else {
|
|
157
|
+
LemniskHelper.getInstance(getReactApplicationContext()).track(eventName,propertiesBuilder);
|
|
158
|
+
}
|
|
116
159
|
}
|
|
117
160
|
catch (Exception e) {
|
|
118
161
|
Log.e("TAG", "Exception in track event", e);
|
|
@@ -120,13 +163,22 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
120
163
|
}
|
|
121
164
|
|
|
122
165
|
@ReactMethod
|
|
123
|
-
public void screen(String name, ReadableMap propertiesObject
|
|
124
|
-
|
|
125
|
-
|
|
166
|
+
public void screen(String name, ReadableMap propertiesObject) {
|
|
167
|
+
screenWithIds(name, propertiesObject, null);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@ReactMethod
|
|
171
|
+
public void screenWithIds(String name, ReadableMap propertiesObject, @Nullable ReadableMap otherIdsObject) {
|
|
172
|
+
Log.d("TAG: ", "eventLogging: screen: ");
|
|
173
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + (otherIdsObject != null ? otherIdsObject.toString() : "null"));
|
|
126
174
|
try {
|
|
127
175
|
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
|
128
|
-
|
|
129
|
-
|
|
176
|
+
if (otherIdsObject != null) {
|
|
177
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
|
178
|
+
LemniskHelper.getInstance(getReactApplicationContext()).screen(name,propertiesBuilder,otherIdsBuilder);
|
|
179
|
+
} else {
|
|
180
|
+
LemniskHelper.getInstance(getReactApplicationContext()).screen(name,propertiesBuilder);
|
|
181
|
+
}
|
|
130
182
|
}
|
|
131
183
|
catch (Exception e) {
|
|
132
184
|
Log.e("TAG", "Exception in screen event", e);
|
|
@@ -134,13 +186,22 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
134
186
|
}
|
|
135
187
|
|
|
136
188
|
@ReactMethod
|
|
137
|
-
public void identify(String userId, ReadableMap propertiesObject
|
|
138
|
-
|
|
139
|
-
|
|
189
|
+
public void identify(String userId, ReadableMap propertiesObject) {
|
|
190
|
+
identifyWithIds(userId, propertiesObject, null);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@ReactMethod
|
|
194
|
+
public void identifyWithIds(String userId, ReadableMap propertiesObject, @Nullable ReadableMap otherIdsObject) {
|
|
195
|
+
Log.d("TAG: ", "eventLogging: identify: ");
|
|
196
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + (otherIdsObject != null ? otherIdsObject.toString() : "null"));
|
|
140
197
|
try {
|
|
141
198
|
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
|
142
|
-
|
|
143
|
-
|
|
199
|
+
if (otherIdsObject != null) {
|
|
200
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
|
201
|
+
LemniskHelper.getInstance(getReactApplicationContext()).identify(userId,propertiesBuilder,otherIdsBuilder);
|
|
202
|
+
} else {
|
|
203
|
+
LemniskHelper.getInstance(getReactApplicationContext()).identify(userId,propertiesBuilder);
|
|
204
|
+
}
|
|
144
205
|
}
|
|
145
206
|
catch (Exception e) {
|
|
146
207
|
Log.e("TAG", "Exception in identify event", e);
|
package/ios/LemniskSdk.m
CHANGED
|
@@ -7,6 +7,23 @@
|
|
|
7
7
|
|
|
8
8
|
RCT_EXPORT_MODULE()
|
|
9
9
|
|
|
10
|
+
+ (void)initialize {
|
|
11
|
+
if (self == [LemniskSdk class]) {
|
|
12
|
+
// Set cross-platform SDK version for React Native
|
|
13
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
14
|
+
NSString *version = [self getReactNativeSDKVersion];
|
|
15
|
+
[[Lemnisk shared] setCrossPlatformSDKVersion:[NSString stringWithFormat:@"react-native-%@", version]];
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
+ (NSString *)getReactNativeSDKVersion {
|
|
21
|
+
// Use the version injected from package.json via preprocessor macro
|
|
22
|
+
NSString *sdkVersion = REACT_NATIVE_SDK_VERSION;
|
|
23
|
+
NSLog(@"[LemniskSDK] Using preprocessor macro version: %@", sdkVersion);
|
|
24
|
+
return sdkVersion;
|
|
25
|
+
}
|
|
26
|
+
|
|
10
27
|
// Example method
|
|
11
28
|
// See // https://reactnative.dev/docs/native-modules-ios
|
|
12
29
|
// RCT_REMAP_METHOD
|
|
@@ -16,19 +33,45 @@ RCT_EXPORT_METHOD(createLemniskEvent:(NSString *)name object:(NSDictionary *)obj
|
|
|
16
33
|
[lemAnalytics logActivityWithName:name traits:object];
|
|
17
34
|
}
|
|
18
35
|
|
|
19
|
-
|
|
36
|
+
// Optional: Add 2-parameter versions for consistency with Android
|
|
37
|
+
RCT_EXPORT_METHOD(identify:(NSString *)userId object:(NSDictionary *)traits) {
|
|
38
|
+
[self identifyWithIds:userId object:traits object:nil];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
RCT_EXPORT_METHOD(track:(NSString *)event object:(NSDictionary *)properties) {
|
|
42
|
+
[self trackWithIds:event object:properties object:nil];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
RCT_EXPORT_METHOD(screen:(NSString *)name object:(NSDictionary *)properties) {
|
|
46
|
+
[self screenWithIds:name object:properties object:nil];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Keep your existing 3-parameter methods and rename them
|
|
50
|
+
RCT_EXPORT_METHOD(identifyWithIds:(NSString *)userId object:(NSDictionary *)traits object:(NSDictionary * _Nullable)otherIds) {
|
|
20
51
|
RCTLogInfo(@"Logging Lemnisk Identify event with userId %@, properties: %@, otherIds: %@", userId, traits, otherIds);
|
|
21
|
-
|
|
52
|
+
if (otherIds != nil) {
|
|
53
|
+
[[Lemnisk shared] identify:userId traits:traits otherIds:otherIds];
|
|
54
|
+
} else {
|
|
55
|
+
[[Lemnisk shared] identify:userId traits:traits];
|
|
56
|
+
}
|
|
22
57
|
}
|
|
23
58
|
|
|
24
|
-
RCT_EXPORT_METHOD(
|
|
59
|
+
RCT_EXPORT_METHOD(trackWithIds:(NSString *)event object:(NSDictionary *)properties object:(NSDictionary * _Nullable)otherIds) {
|
|
25
60
|
RCTLogInfo(@"Logging Lemnisk Track event with event %@, properties: %@, otherIds: %@", event, properties, otherIds);
|
|
26
|
-
|
|
61
|
+
if (otherIds != nil) {
|
|
62
|
+
[[Lemnisk shared] track:event properties:properties otherIds:otherIds];
|
|
63
|
+
} else {
|
|
64
|
+
[[Lemnisk shared] track:event properties:properties];
|
|
65
|
+
}
|
|
27
66
|
}
|
|
28
67
|
|
|
29
|
-
RCT_EXPORT_METHOD(
|
|
68
|
+
RCT_EXPORT_METHOD(screenWithIds:(NSString *)name object:(NSDictionary *)properties object:(NSDictionary * _Nullable)otherIds) {
|
|
30
69
|
RCTLogInfo(@"Logging Lemnisk Screen event with name %@, properties: %@, otherIds: %@", name, properties, otherIds);
|
|
31
|
-
|
|
70
|
+
if (otherIds != nil) {
|
|
71
|
+
[[Lemnisk shared] screen:name properties:properties otherIds:otherIds];
|
|
72
|
+
} else {
|
|
73
|
+
[[Lemnisk shared] screen:name properties:properties];
|
|
74
|
+
}
|
|
32
75
|
}
|
|
33
76
|
|
|
34
77
|
RCT_EXPORT_METHOD(registerForPush) {
|
|
@@ -11,11 +11,16 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.authors = package['author']
|
|
12
12
|
|
|
13
13
|
s.requires_arc = true
|
|
14
|
-
s.platforms = { :ios => '
|
|
14
|
+
s.platforms = { :ios => '12.0' }
|
|
15
15
|
s.source = { :git => 'https://github.com/Immensitas/lemnisk-react', :tag => s.version }
|
|
16
16
|
|
|
17
17
|
s.source_files = 'ios/**/*.{h,m,mm}'
|
|
18
18
|
|
|
19
|
+
# Inject the SDK version as a preprocessor macro
|
|
20
|
+
s.pod_target_xcconfig = {
|
|
21
|
+
'GCC_PREPROCESSOR_DEFINITIONS' => "REACT_NATIVE_SDK_VERSION=@\\\"#{package['version']}\\\""
|
|
22
|
+
}
|
|
23
|
+
|
|
19
24
|
s.dependency 'React-Core'
|
|
20
|
-
s.dependency 'Lemnisk-iOS-SDK', '3.9.
|
|
25
|
+
s.dependency 'Lemnisk-iOS-SDK', '3.9.10'
|
|
21
26
|
end
|
package/lib/commonjs/index.js
CHANGED
|
@@ -8,25 +8,68 @@ var _reactNative = require("react-native");
|
|
|
8
8
|
const {
|
|
9
9
|
LemniskSdk
|
|
10
10
|
} = _reactNative.NativeModules;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
// Create wrapper with overloaded methods
|
|
12
|
+
const LemniskSdkWrapper = {
|
|
13
|
+
// Track method with overloads
|
|
14
|
+
track: function (eventName, properties, otherIds) {
|
|
15
|
+
if (otherIds !== undefined) {
|
|
16
|
+
return LemniskSdk.trackWithIds(eventName, properties, otherIds);
|
|
17
|
+
} else {
|
|
18
|
+
return LemniskSdk.track(eventName, properties);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
// Screen method with overloads
|
|
22
|
+
screen: function (name, properties, otherIds) {
|
|
23
|
+
if (otherIds !== undefined) {
|
|
24
|
+
return LemniskSdk.screenWithIds(name, properties, otherIds);
|
|
25
|
+
} else {
|
|
26
|
+
return LemniskSdk.screen(name, properties);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
// Identify method with overloads
|
|
30
|
+
identify: function (userId, properties, otherIds) {
|
|
31
|
+
if (otherIds !== undefined) {
|
|
32
|
+
return LemniskSdk.identifyWithIds(userId, properties, otherIds);
|
|
33
|
+
} else {
|
|
34
|
+
return LemniskSdk.identify(userId, properties);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
// Platform-specific push notification registration
|
|
38
|
+
registerForPushNotifications: (title, message) => {
|
|
39
|
+
if (_reactNative.Platform.OS === "android") {
|
|
40
|
+
return LemniskSdk.registerForPush(title, message);
|
|
41
|
+
} else if (_reactNative.Platform.OS === "ios") {
|
|
42
|
+
return LemniskSdk.registerForPush();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
// Custom consent with object parameter
|
|
46
|
+
setCustomConsent: options => {
|
|
47
|
+
return LemniskSdk.setCustomConsent(options.transactional, options.promotional);
|
|
48
|
+
},
|
|
49
|
+
// Custom consent getter with transformed callback
|
|
50
|
+
getCustomConsent: callback => {
|
|
51
|
+
LemniskSdk.getCustomConsent(consent => {
|
|
52
|
+
callback({
|
|
53
|
+
transactional: consent[0],
|
|
54
|
+
promotional: consent[1]
|
|
55
|
+
});
|
|
28
56
|
});
|
|
29
|
-
}
|
|
57
|
+
},
|
|
58
|
+
// Pass-through methods (no modification needed)
|
|
59
|
+
createLemniskEvent: LemniskSdk.createLemniskEvent,
|
|
60
|
+
setUniqueUserId: LemniskSdk.setUniqueUserId,
|
|
61
|
+
getUniqueUserId: LemniskSdk.getUniqueUserId,
|
|
62
|
+
getOSConsent: LemniskSdk.getOSConsent,
|
|
63
|
+
setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,
|
|
64
|
+
overrideDeviceId: LemniskSdk.overrideDeviceId,
|
|
65
|
+
getUnreadCount: LemniskSdk.getUnreadCount,
|
|
66
|
+
markRead: LemniskSdk.markRead,
|
|
67
|
+
markBulkRead: LemniskSdk.markBulkRead,
|
|
68
|
+
markDelete: LemniskSdk.markDelete,
|
|
69
|
+
markBulkDelete: LemniskSdk.markBulkDelete,
|
|
70
|
+
readAll: LemniskSdk.readAll,
|
|
71
|
+
deleteAll: LemniskSdk.deleteAll,
|
|
72
|
+
resetUser: LemniskSdk.resetUser
|
|
30
73
|
};
|
|
31
|
-
var _default = exports.default =
|
|
74
|
+
var _default = exports.default = LemniskSdkWrapper;
|
|
32
75
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","registerForPushNotifications","title","message","Platform","OS","registerForPush","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LemniskSdk","NativeModules","LemniskSdkWrapper","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","Platform","OS","registerForPush","setCustomConsent","options","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 LemniskSdkType = {\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 // 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":"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","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -2,25 +2,68 @@ import { NativeModules, Platform } from 'react-native';
|
|
|
2
2
|
const {
|
|
3
3
|
LemniskSdk
|
|
4
4
|
} = NativeModules;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
// Create wrapper with overloaded methods
|
|
6
|
+
const LemniskSdkWrapper = {
|
|
7
|
+
// Track method with overloads
|
|
8
|
+
track: function (eventName, properties, otherIds) {
|
|
9
|
+
if (otherIds !== undefined) {
|
|
10
|
+
return LemniskSdk.trackWithIds(eventName, properties, otherIds);
|
|
11
|
+
} else {
|
|
12
|
+
return LemniskSdk.track(eventName, properties);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
// Screen method with overloads
|
|
16
|
+
screen: function (name, properties, otherIds) {
|
|
17
|
+
if (otherIds !== undefined) {
|
|
18
|
+
return LemniskSdk.screenWithIds(name, properties, otherIds);
|
|
19
|
+
} else {
|
|
20
|
+
return LemniskSdk.screen(name, properties);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
// Identify method with overloads
|
|
24
|
+
identify: function (userId, properties, otherIds) {
|
|
25
|
+
if (otherIds !== undefined) {
|
|
26
|
+
return LemniskSdk.identifyWithIds(userId, properties, otherIds);
|
|
27
|
+
} else {
|
|
28
|
+
return LemniskSdk.identify(userId, properties);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
// Platform-specific push notification registration
|
|
32
|
+
registerForPushNotifications: (title, message) => {
|
|
33
|
+
if (Platform.OS === "android") {
|
|
34
|
+
return LemniskSdk.registerForPush(title, message);
|
|
35
|
+
} else if (Platform.OS === "ios") {
|
|
36
|
+
return LemniskSdk.registerForPush();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
// Custom consent with object parameter
|
|
40
|
+
setCustomConsent: options => {
|
|
41
|
+
return LemniskSdk.setCustomConsent(options.transactional, options.promotional);
|
|
42
|
+
},
|
|
43
|
+
// Custom consent getter with transformed callback
|
|
44
|
+
getCustomConsent: callback => {
|
|
45
|
+
LemniskSdk.getCustomConsent(consent => {
|
|
46
|
+
callback({
|
|
47
|
+
transactional: consent[0],
|
|
48
|
+
promotional: consent[1]
|
|
49
|
+
});
|
|
22
50
|
});
|
|
23
|
-
}
|
|
51
|
+
},
|
|
52
|
+
// Pass-through methods (no modification needed)
|
|
53
|
+
createLemniskEvent: LemniskSdk.createLemniskEvent,
|
|
54
|
+
setUniqueUserId: LemniskSdk.setUniqueUserId,
|
|
55
|
+
getUniqueUserId: LemniskSdk.getUniqueUserId,
|
|
56
|
+
getOSConsent: LemniskSdk.getOSConsent,
|
|
57
|
+
setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,
|
|
58
|
+
overrideDeviceId: LemniskSdk.overrideDeviceId,
|
|
59
|
+
getUnreadCount: LemniskSdk.getUnreadCount,
|
|
60
|
+
markRead: LemniskSdk.markRead,
|
|
61
|
+
markBulkRead: LemniskSdk.markBulkRead,
|
|
62
|
+
markDelete: LemniskSdk.markDelete,
|
|
63
|
+
markBulkDelete: LemniskSdk.markBulkDelete,
|
|
64
|
+
readAll: LemniskSdk.readAll,
|
|
65
|
+
deleteAll: LemniskSdk.deleteAll,
|
|
66
|
+
resetUser: LemniskSdk.resetUser
|
|
24
67
|
};
|
|
25
|
-
export default
|
|
68
|
+
export default LemniskSdkWrapper;
|
|
26
69
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LemniskSdk","registerForPushNotifications","title","message","OS","registerForPush","
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LemniskSdk","LemniskSdkWrapper","track","eventName","properties","otherIds","undefined","trackWithIds","screen","name","screenWithIds","identify","userId","identifyWithIds","registerForPushNotifications","title","message","OS","registerForPush","setCustomConsent","options","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 LemniskSdkType = {\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 // 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;AAiCpC;AACA,MAAMG,iBAAiB,GAAG;EACxB;EACAC,KAAK,EAAE,SAAAA,CAASC,SAAiB,EAAEC,UAAkB,EAAEC,QAAiB,EAAO;IAC7E,IAAIA,QAAQ,KAAKC,SAAS,EAAE;MAC1B,OAAON,UAAU,CAACO,YAAY,CAACJ,SAAS,EAAEC,UAAU,EAAEC,QAAQ,CAAC;IACjE,CAAC,MAAM;MACL,OAAOL,UAAU,CAACE,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,OAAON,UAAU,CAACU,aAAa,CAACD,IAAI,EAAEL,UAAU,EAAEC,QAAQ,CAAC;IAC7D,CAAC,MAAM;MACL,OAAOL,UAAU,CAACQ,MAAM,CAACC,IAAI,EAAEL,UAAU,CAAC;IAC5C;EACF,CAAC;EAED;EACAO,QAAQ,EAAE,SAAAA,CAASC,MAAc,EAAER,UAAkB,EAAEC,QAAiB,EAAO;IAC7E,IAAIA,QAAQ,KAAKC,SAAS,EAAE;MAC1B,OAAON,UAAU,CAACa,eAAe,CAACD,MAAM,EAAER,UAAU,EAAEC,QAAQ,CAAC;IACjE,CAAC,MAAM;MACL,OAAOL,UAAU,CAACW,QAAQ,CAACC,MAAM,EAAER,UAAU,CAAC;IAChD;EACF,CAAC;EAED;EACAU,4BAA4B,EAAEA,CAACC,KAAc,EAAEC,OAAgB,KAAK;IAClE,IAAIjB,QAAQ,CAACkB,EAAE,KAAK,SAAS,EAAE;MAC7B,OAAOjB,UAAU,CAACkB,eAAe,CAACH,KAAK,EAAEC,OAAO,CAAC;IACnD,CAAC,MAAM,IAAIjB,QAAQ,CAACkB,EAAE,KAAK,KAAK,EAAE;MAChC,OAAOjB,UAAU,CAACkB,eAAe,CAAC,CAAC;IACrC;EACF,CAAC;EAED;EACAC,gBAAgB,EAAGC,OAAuB,IAAK;IAC7C,OAAOpB,UAAU,CAACmB,gBAAgB,CAACC,OAAO,CAACC,aAAa,EAAED,OAAO,CAACE,WAAW,CAAC;EAChF,CAAC;EAED;EACAC,gBAAgB,EAAGC,QAA2F,IAAK;IACjHxB,UAAU,CAACuB,gBAAgB,CAAEE,OAAyC,IAAK;MACzED,QAAQ,CAAC;QACPH,aAAa,EAAEI,OAAO,CAAC,CAAC,CAAC;QACzBH,WAAW,EAAEG,OAAO,CAAC,CAAC;MACxB,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC;EAED;EACAC,kBAAkB,EAAE1B,UAAU,CAAC0B,kBAAkB;EACjDC,eAAe,EAAE3B,UAAU,CAAC2B,eAAe;EAC3CC,eAAe,EAAE5B,UAAU,CAAC4B,eAAe;EAC3CC,YAAY,EAAE7B,UAAU,CAAC6B,YAAY;EACrCC,mBAAmB,EAAE9B,UAAU,CAAC8B,mBAAmB;EACnDC,gBAAgB,EAAE/B,UAAU,CAAC+B,gBAAgB;EAC7CC,cAAc,EAAEhC,UAAU,CAACgC,cAAc;EACzCC,QAAQ,EAAEjC,UAAU,CAACiC,QAAQ;EAC7BC,YAAY,EAAElC,UAAU,CAACkC,YAAY;EACrCC,UAAU,EAAEnC,UAAU,CAACmC,UAAU;EACjCC,cAAc,EAAEpC,UAAU,CAACoC,cAAc;EACzCC,OAAO,EAAErC,UAAU,CAACqC,OAAO;EAC3BC,SAAS,EAAEtC,UAAU,CAACsC,SAAS;EAC/BC,SAAS,EAAEvC,UAAU,CAACuC;AACxB,CAAC;AAED,eAAetC,iBAAiB","ignoreList":[]}
|
|
@@ -4,8 +4,11 @@ type ConsentOptions = {
|
|
|
4
4
|
};
|
|
5
5
|
type LemniskSdkType = {
|
|
6
6
|
createLemniskEvent(name: string, object: object): any;
|
|
7
|
+
track(eventName: string, properties: object): any;
|
|
7
8
|
track(eventName: string, properties: object, otherIds: object): any;
|
|
9
|
+
screen(name: string, properties: object): any;
|
|
8
10
|
screen(name: string, properties: object, otherIds: object): any;
|
|
11
|
+
identify(userId: string, properties: object): any;
|
|
9
12
|
identify(userId: string, properties: object, otherIds: object): any;
|
|
10
13
|
registerForPushNotifications(title?: string, message?: string): any;
|
|
11
14
|
setUniqueUserId(tokenizedCid: string): void;
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -7,19 +7,13 @@ type ConsentOptions = {
|
|
|
7
7
|
promotional: boolean;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
LemniskSdk.registerForPushNotifications = (title: string, message: string)=>{
|
|
11
|
-
if(Platform.OS == "android"){
|
|
12
|
-
LemniskSdk.registerForPush(title, message);
|
|
13
|
-
}
|
|
14
|
-
else if(Platform.OS == "ios"){
|
|
15
|
-
LemniskSdk.registerForPush();
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
10
|
type LemniskSdkType = {
|
|
20
11
|
createLemniskEvent(name: string, object: object): any;
|
|
12
|
+
track(eventName: string, properties: object): any;
|
|
21
13
|
track(eventName: string, properties: object, otherIds: object): any;
|
|
14
|
+
screen(name: string, properties: object): any;
|
|
22
15
|
screen(name: string, properties: object, otherIds: object): any;
|
|
16
|
+
identify(userId: string, properties: object): any;
|
|
23
17
|
identify(userId: string, properties: object, otherIds: object): any;
|
|
24
18
|
registerForPushNotifications(title?: string, message?: string): any;
|
|
25
19
|
setUniqueUserId(tokenizedCid: string): void;
|
|
@@ -39,20 +33,74 @@ type LemniskSdkType = {
|
|
|
39
33
|
resetUser(): void;
|
|
40
34
|
};
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
// Create wrapper with overloaded methods
|
|
37
|
+
const LemniskSdkWrapper = {
|
|
38
|
+
// Track method with overloads
|
|
39
|
+
track: function(eventName: string, properties: object, otherIds?: object): any {
|
|
40
|
+
if (otherIds !== undefined) {
|
|
41
|
+
return LemniskSdk.trackWithIds(eventName, properties, otherIds);
|
|
42
|
+
} else {
|
|
43
|
+
return LemniskSdk.track(eventName, properties);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
// Screen method with overloads
|
|
48
|
+
screen: function(name: string, properties: object, otherIds?: object): any {
|
|
49
|
+
if (otherIds !== undefined) {
|
|
50
|
+
return LemniskSdk.screenWithIds(name, properties, otherIds);
|
|
51
|
+
} else {
|
|
52
|
+
return LemniskSdk.screen(name, properties);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
46
55
|
|
|
56
|
+
// Identify method with overloads
|
|
57
|
+
identify: function(userId: string, properties: object, otherIds?: object): any {
|
|
58
|
+
if (otherIds !== undefined) {
|
|
59
|
+
return LemniskSdk.identifyWithIds(userId, properties, otherIds);
|
|
60
|
+
} else {
|
|
61
|
+
return LemniskSdk.identify(userId, properties);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
47
64
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
65
|
+
// Platform-specific push notification registration
|
|
66
|
+
registerForPushNotifications: (title?: string, message?: string) => {
|
|
67
|
+
if (Platform.OS === "android") {
|
|
68
|
+
return LemniskSdk.registerForPush(title, message);
|
|
69
|
+
} else if (Platform.OS === "ios") {
|
|
70
|
+
return LemniskSdk.registerForPush();
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// Custom consent with object parameter
|
|
75
|
+
setCustomConsent: (options: ConsentOptions) => {
|
|
76
|
+
return LemniskSdk.setCustomConsent(options.transactional, options.promotional);
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
// Custom consent getter with transformed callback
|
|
80
|
+
getCustomConsent: (callback: (consent: { transactional: boolean | null; promotional: boolean | null }) => void) => {
|
|
81
|
+
LemniskSdk.getCustomConsent((consent: [boolean | null, boolean | null]) => {
|
|
82
|
+
callback({
|
|
83
|
+
transactional: consent[0],
|
|
84
|
+
promotional: consent[1]
|
|
85
|
+
});
|
|
54
86
|
});
|
|
55
|
-
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// Pass-through methods (no modification needed)
|
|
90
|
+
createLemniskEvent: LemniskSdk.createLemniskEvent,
|
|
91
|
+
setUniqueUserId: LemniskSdk.setUniqueUserId,
|
|
92
|
+
getUniqueUserId: LemniskSdk.getUniqueUserId,
|
|
93
|
+
getOSConsent: LemniskSdk.getOSConsent,
|
|
94
|
+
setCustomerDeviceId: LemniskSdk.setCustomerDeviceId,
|
|
95
|
+
overrideDeviceId: LemniskSdk.overrideDeviceId,
|
|
96
|
+
getUnreadCount: LemniskSdk.getUnreadCount,
|
|
97
|
+
markRead: LemniskSdk.markRead,
|
|
98
|
+
markBulkRead: LemniskSdk.markBulkRead,
|
|
99
|
+
markDelete: LemniskSdk.markDelete,
|
|
100
|
+
markBulkDelete: LemniskSdk.markBulkDelete,
|
|
101
|
+
readAll: LemniskSdk.readAll,
|
|
102
|
+
deleteAll: LemniskSdk.deleteAll,
|
|
103
|
+
resetUser: LemniskSdk.resetUser,
|
|
56
104
|
};
|
|
57
105
|
|
|
58
|
-
export default
|
|
106
|
+
export default LemniskSdkWrapper as LemniskSdkType;
|