lemnisk-react-native 0.1.21 → 0.1.23
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 +29 -19
- package/android/src/main/java/com/reactnativelemnisksdk/LemniskSdkModule.java +77 -17
- 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
|
+
mavenCentral()
|
|
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,48 +26,58 @@ 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.23\""
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
repositories {
|
|
47
|
-
mavenLocal()
|
|
48
57
|
maven {
|
|
49
58
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
50
59
|
url("$rootDir/../node_modules/react-native/android")
|
|
51
60
|
}
|
|
52
61
|
google()
|
|
53
|
-
|
|
62
|
+
mavenCentral()
|
|
63
|
+
maven { url 'https://developer.huawei.com/repo/' }
|
|
54
64
|
}
|
|
55
65
|
|
|
56
66
|
dependencies {
|
|
57
67
|
//noinspection GradleDynamicVersion
|
|
58
68
|
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.
|
|
69
|
+
implementation 'co.lemnisk.app.android:AndroidSDK:1.1.58'
|
|
70
|
+
implementation 'org.apache.commons:commons-text:1.11.0'
|
|
61
71
|
//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:
|
|
72
|
+
implementation group: 'joda-time', name: 'joda-time', version: '2.12.5'
|
|
73
|
+
implementation 'com.google.android.gms:play-services-base:18.5.0'
|
|
74
|
+
implementation platform('com.google.firebase:firebase-bom:33.14.0')
|
|
65
75
|
implementation 'com.google.firebase:firebase-messaging'
|
|
66
|
-
implementation 'com.google.android.gms:play-services-ads-identifier:18.0
|
|
76
|
+
implementation 'com.google.android.gms:play-services-ads-identifier:18.1.0'
|
|
67
77
|
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.
|
|
78
|
+
implementation 'androidx.work:work-runtime:2.10.1'
|
|
79
|
+
implementation 'com.google.code.gson:gson:2.11.0'
|
|
80
|
+
implementation 'androidx.lifecycle:lifecycle-process:2.9.0'
|
|
81
|
+
implementation 'androidx.lifecycle:lifecycle-common-java8:2.9.0'
|
|
72
82
|
|
|
73
83
|
}
|
|
@@ -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
|
});
|
|
@@ -76,7 +87,6 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
76
87
|
return NAME;
|
|
77
88
|
}
|
|
78
89
|
|
|
79
|
-
@ReactMethod
|
|
80
90
|
private AttributeBuilder getAttributeBuilderFromMap(ReadableMap object) {
|
|
81
91
|
try {
|
|
82
92
|
JSONObject attr = new JSONObject(object.toString());
|
|
@@ -86,14 +96,16 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
86
96
|
Iterator<String> keys = nativeMap.keys();
|
|
87
97
|
while (keys.hasNext()) {
|
|
88
98
|
String key = keys.next();
|
|
89
|
-
|
|
99
|
+
Object value = nativeMap.get(key);
|
|
100
|
+
addAttributeValue(builder, key, value);
|
|
90
101
|
}
|
|
91
102
|
}
|
|
92
103
|
else{
|
|
93
104
|
Iterator<String> keys = attr.keys();
|
|
94
105
|
while (keys.hasNext()) {
|
|
95
106
|
String key = keys.next();
|
|
96
|
-
|
|
107
|
+
Object value = attr.get(key);
|
|
108
|
+
addAttributeValue(builder, key, value);
|
|
97
109
|
}
|
|
98
110
|
}
|
|
99
111
|
return builder.build();
|
|
@@ -105,14 +117,44 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
105
117
|
}
|
|
106
118
|
}
|
|
107
119
|
|
|
120
|
+
private void addAttributeValue(AttributeBuilder.Builder builder, String key, Object value) {
|
|
121
|
+
if (value instanceof JSONObject) {
|
|
122
|
+
// Keep as JSONObject for nested objects
|
|
123
|
+
builder.addAttribute(key, (JSONObject) value);
|
|
124
|
+
} else if (value instanceof JSONArray) {
|
|
125
|
+
// Keep as JSONArray for arrays
|
|
126
|
+
builder.addAttribute(key, (JSONArray) value);
|
|
127
|
+
} else if (value instanceof String) {
|
|
128
|
+
builder.addAttribute(key, (String) value);
|
|
129
|
+
} else if (value instanceof Integer) {
|
|
130
|
+
builder.addAttribute(key, (Integer) value);
|
|
131
|
+
} else if (value instanceof Double) {
|
|
132
|
+
builder.addAttribute(key, (Double) value);
|
|
133
|
+
} else if (value instanceof Boolean) {
|
|
134
|
+
builder.addAttribute(key, (Boolean) value);
|
|
135
|
+
} else if (value != null) {
|
|
136
|
+
// Fallback to string for other types
|
|
137
|
+
builder.addAttribute(key, value.toString());
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
108
141
|
@ReactMethod
|
|
109
|
-
public void track(String eventName, ReadableMap propertiesObject
|
|
142
|
+
public void track(String eventName, ReadableMap propertiesObject) {
|
|
143
|
+
trackWithIds(eventName, propertiesObject, null);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@ReactMethod
|
|
147
|
+
public void trackWithIds(String eventName, ReadableMap propertiesObject, @Nullable ReadableMap otherIdsObject) {
|
|
110
148
|
Log.d("TAG: ", "eventLogging: track: ");
|
|
111
|
-
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + otherIdsObject.toString());
|
|
149
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + (otherIdsObject != null ? otherIdsObject.toString() : "null"));
|
|
112
150
|
try {
|
|
113
151
|
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
|
114
|
-
|
|
115
|
-
|
|
152
|
+
if (otherIdsObject != null) {
|
|
153
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
|
154
|
+
LemniskHelper.getInstance(getReactApplicationContext()).track(eventName,propertiesBuilder,otherIdsBuilder);
|
|
155
|
+
} else {
|
|
156
|
+
LemniskHelper.getInstance(getReactApplicationContext()).track(eventName,propertiesBuilder);
|
|
157
|
+
}
|
|
116
158
|
}
|
|
117
159
|
catch (Exception e) {
|
|
118
160
|
Log.e("TAG", "Exception in track event", e);
|
|
@@ -120,13 +162,22 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
120
162
|
}
|
|
121
163
|
|
|
122
164
|
@ReactMethod
|
|
123
|
-
public void screen(String name, ReadableMap propertiesObject
|
|
124
|
-
|
|
125
|
-
|
|
165
|
+
public void screen(String name, ReadableMap propertiesObject) {
|
|
166
|
+
screenWithIds(name, propertiesObject, null);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@ReactMethod
|
|
170
|
+
public void screenWithIds(String name, ReadableMap propertiesObject, @Nullable ReadableMap otherIdsObject) {
|
|
171
|
+
Log.d("TAG: ", "eventLogging: screen: ");
|
|
172
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + (otherIdsObject != null ? otherIdsObject.toString() : "null"));
|
|
126
173
|
try {
|
|
127
174
|
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
|
128
|
-
|
|
129
|
-
|
|
175
|
+
if (otherIdsObject != null) {
|
|
176
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
|
177
|
+
LemniskHelper.getInstance(getReactApplicationContext()).screen(name,propertiesBuilder,otherIdsBuilder);
|
|
178
|
+
} else {
|
|
179
|
+
LemniskHelper.getInstance(getReactApplicationContext()).screen(name,propertiesBuilder);
|
|
180
|
+
}
|
|
130
181
|
}
|
|
131
182
|
catch (Exception e) {
|
|
132
183
|
Log.e("TAG", "Exception in screen event", e);
|
|
@@ -134,13 +185,22 @@ public class LemniskSdkModule extends ReactContextBaseJavaModule {
|
|
|
134
185
|
}
|
|
135
186
|
|
|
136
187
|
@ReactMethod
|
|
137
|
-
public void identify(String userId, ReadableMap propertiesObject
|
|
138
|
-
|
|
139
|
-
|
|
188
|
+
public void identify(String userId, ReadableMap propertiesObject) {
|
|
189
|
+
identifyWithIds(userId, propertiesObject, null);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@ReactMethod
|
|
193
|
+
public void identifyWithIds(String userId, ReadableMap propertiesObject, @Nullable ReadableMap otherIdsObject) {
|
|
194
|
+
Log.d("TAG: ", "eventLogging: identify: ");
|
|
195
|
+
Log.d("TAG: ", "eventLogging: properties: " + propertiesObject.toString() + " otherIds: " + (otherIdsObject != null ? otherIdsObject.toString() : "null"));
|
|
140
196
|
try {
|
|
141
197
|
AttributeBuilder propertiesBuilder = getAttributeBuilderFromMap(propertiesObject);
|
|
142
|
-
|
|
143
|
-
|
|
198
|
+
if (otherIdsObject != null) {
|
|
199
|
+
AttributeBuilder otherIdsBuilder = getAttributeBuilderFromMap(otherIdsObject);
|
|
200
|
+
LemniskHelper.getInstance(getReactApplicationContext()).identify(userId,propertiesBuilder,otherIdsBuilder);
|
|
201
|
+
} else {
|
|
202
|
+
LemniskHelper.getInstance(getReactApplicationContext()).identify(userId,propertiesBuilder);
|
|
203
|
+
}
|
|
144
204
|
}
|
|
145
205
|
catch (Exception e) {
|
|
146
206
|
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":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAM;EAAEC;AAAW,CAAC,GAAGC,0BAAa;AAiCpC;AACA,MAAMC,iBAAiB,GAAG;EACxB;EACAC,KAAK,EAAE,SAAAA,CAASC,SAAiB,EAAEC,UAAkB,EAAEC,QAAiB,EAAO;IAC7E,IAAIA,QAAQ,KAAKC,SAAS,EAAE;MAC1B,OAAOP,UAAU,CAACQ,YAAY,CAACJ,SAAS,EAAEC,UAAU,EAAEC,QAAQ,CAAC;IACjE,CAAC,MAAM;MACL,OAAON,UAAU,CAACG,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,OAAOP,UAAU,CAACW,aAAa,CAACD,IAAI,EAAEL,UAAU,EAAEC,QAAQ,CAAC;IAC7D,CAAC,MAAM;MACL,OAAON,UAAU,CAACS,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,OAAOP,UAAU,CAACc,eAAe,CAACD,MAAM,EAAER,UAAU,EAAEC,QAAQ,CAAC;IACjE,CAAC,MAAM;MACL,OAAON,UAAU,CAACY,QAAQ,CAACC,MAAM,EAAER,UAAU,CAAC;IAChD;EACF,CAAC;EAED;EACAU,4BAA4B,EAAEA,CAACC,KAAc,EAAEC,OAAgB,KAAK;IAClE,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;MAC7B,OAAOnB,UAAU,CAACoB,eAAe,CAACJ,KAAK,EAAEC,OAAO,CAAC;IACnD,CAAC,MAAM,IAAIC,qBAAQ,CAACC,EAAE,KAAK,KAAK,EAAE;MAChC,OAAOnB,UAAU,CAACoB,eAAe,CAAC,CAAC;IACrC;EACF,CAAC;EAED;EACAC,gBAAgB,EAAGC,OAAuB,IAAK;IAC7C,OAAOtB,UAAU,CAACqB,gBAAgB,CAACC,OAAO,CAACC,aAAa,EAAED,OAAO,CAACE,WAAW,CAAC;EAChF,CAAC;EAED;EACAC,gBAAgB,EAAGC,QAA2F,IAAK;IACjH1B,UAAU,CAACyB,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,EAAE5B,UAAU,CAAC4B,kBAAkB;EACjDC,eAAe,EAAE7B,UAAU,CAAC6B,eAAe;EAC3CC,eAAe,EAAE9B,UAAU,CAAC8B,eAAe;EAC3CC,YAAY,EAAE/B,UAAU,CAAC+B,YAAY;EACrCC,mBAAmB,EAAEhC,UAAU,CAACgC,mBAAmB;EACnDC,gBAAgB,EAAEjC,UAAU,CAACiC,gBAAgB;EAC7CC,cAAc,EAAElC,UAAU,CAACkC,cAAc;EACzCC,QAAQ,EAAEnC,UAAU,CAACmC,QAAQ;EAC7BC,YAAY,EAAEpC,UAAU,CAACoC,YAAY;EACrCC,UAAU,EAAErC,UAAU,CAACqC,UAAU;EACjCC,cAAc,EAAEtC,UAAU,CAACsC,cAAc;EACzCC,OAAO,EAAEvC,UAAU,CAACuC,OAAO;EAC3BC,SAAS,EAAExC,UAAU,CAACwC,SAAS;EAC/BC,SAAS,EAAEzC,UAAU,CAACyC;AACxB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa1C,iBAAiB","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":"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","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;
|