clevertap-react-native 0.8.1 → 0.9.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  Change Log
2
2
  ==========
3
+
4
+ Version 0.9.1 *(21 September 2022)*
5
+ -------------------------------------------
6
+ - Supports CleverTap Android Core SDK [v4.6.3](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md) and associated enhancements
7
+ - Supports CleverTap Android Push Templates SDK [v1.0.5](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTPUSHTEMPLATESCHANGELOG.md) and associated enhancements
8
+ - Supports CleverTap Android HMS SDK [v1.3.1](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTHUAWEIPUSHCHANGELOG.md) and associated enhancements
9
+ - Supports CleverTap Android XPS SDK [v1.5.0](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTXIAOMIPUSHCHANGELOG.md) and associated Android 12, Region Changes and other enhancements
10
+
11
+ Version 0.9.0 *(23rd August 2022)*
12
+ -------------------------------------------
13
+ - Supports [CleverTap Android SDK v4.6.0](https://github.com/CleverTap/clevertap-android-sdk/releases/tag/corev4.6.0_ptv1.0.4)
14
+
3
15
  Version 0.8.1 *(7th March 2022)*
4
16
  -------------------------------------------
5
17
  - Supports CleverTap iOS SDK `v4.0.0`
@@ -21,8 +21,8 @@ android {
21
21
  defaultConfig {
22
22
  minSdkVersion 16
23
23
  targetSdkVersion 31
24
- versionCode 80
25
- versionName "0.8.0"
24
+ versionCode 91
25
+ versionName "0.9.1"
26
26
  }
27
27
  buildTypes {
28
28
  release {
@@ -39,7 +39,7 @@ dependencies {
39
39
  maven { url "$rootDir/../node_modules/react-native/android" }
40
40
  }
41
41
 
42
- api 'com.clevertap.android:clevertap-android-sdk:4.4.0'
42
+ api 'com.clevertap.android:clevertap-android-sdk:4.6.3'
43
43
  implementation 'com.android.installreferrer:installreferrer:2.2'
44
44
  //compile 'com.android.support:appcompat-v7:28.0.0'
45
45
  implementation 'com.facebook.react:react-native:+'
@@ -0,0 +1,8 @@
1
+ ## This file must *NOT* be checked into Version Control Systems,
2
+ # as it contains information specific to your local configuration.
3
+ #
4
+ # Location of the SDK. This is only used by Gradle.
5
+ # For customization when using a Version Control System, please read the
6
+ # header note.
7
+ #Wed Sep 07 13:41:26 IST 2022
8
+ sdk.dir=/Users/ansh/Library/Android/sdk
@@ -7,6 +7,7 @@ import android.net.Uri;
7
7
  import android.os.Build.VERSION;
8
8
  import android.os.Build.VERSION_CODES;
9
9
  import android.os.Bundle;
10
+ import android.text.TextUtils;
10
11
  import android.util.Log;
11
12
  import androidx.annotation.RequiresApi;
12
13
  import com.clevertap.android.sdk.CTFeatureFlagsListener;
@@ -16,6 +17,8 @@ import com.clevertap.android.sdk.CleverTapAPI;
16
17
  import com.clevertap.android.sdk.InAppNotificationButtonListener;
17
18
  import com.clevertap.android.sdk.InAppNotificationListener;
18
19
  import com.clevertap.android.sdk.InboxMessageButtonListener;
20
+ import com.clevertap.android.sdk.InboxMessageListener;
21
+ import com.clevertap.android.sdk.Logger;
19
22
  import com.clevertap.android.sdk.SyncListener;
20
23
  import com.clevertap.android.sdk.UTMDetail;
21
24
  import com.clevertap.android.sdk.displayunits.DisplayUnitListener;
@@ -55,7 +58,7 @@ import org.json.JSONObject;
55
58
  @SuppressWarnings({"unused", "RedundantSuppression"})
56
59
  public class CleverTapModule extends ReactContextBaseJavaModule implements SyncListener,
57
60
  InAppNotificationListener, CTInboxListener,
58
- InboxMessageButtonListener,
61
+ InboxMessageButtonListener, InboxMessageListener,
59
62
  InAppNotificationButtonListener, DisplayUnitListener, CTProductConfigListener,
60
63
  CTFeatureFlagsListener, CTPushNotificationListener {
61
64
 
@@ -114,6 +117,7 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
114
117
  private static final String CLEVERTAP_INBOX_MESSAGES_DID_UPDATE = "CleverTapInboxMessagesDidUpdate";
115
118
 
116
119
  private static final String CLEVERTAP_ON_INBOX_BUTTON_CLICK = "CleverTapInboxMessageButtonTapped";
120
+ private static final String CLEVERTAP_ON_INBOX_MESSAGE_CLICK = "CleverTapInboxMessageTapped";
117
121
 
118
122
  private static final String CLEVERTAP_ON_INAPP_BUTTON_CLICK = "CleverTapInAppNotificationButtonTapped";
119
123
 
@@ -459,6 +463,7 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
459
463
  constants.put(CLEVERTAP_INBOX_DID_INITIALIZE, CLEVERTAP_INBOX_DID_INITIALIZE);
460
464
  constants.put(CLEVERTAP_INBOX_MESSAGES_DID_UPDATE, CLEVERTAP_INBOX_MESSAGES_DID_UPDATE);
461
465
  constants.put(CLEVERTAP_ON_INBOX_BUTTON_CLICK, CLEVERTAP_ON_INBOX_BUTTON_CLICK);
466
+ constants.put(CLEVERTAP_ON_INBOX_MESSAGE_CLICK, CLEVERTAP_ON_INBOX_MESSAGE_CLICK);
462
467
  constants.put(CLEVERTAP_ON_DISPLAY_UNITS_LOADED, CLEVERTAP_ON_DISPLAY_UNITS_LOADED);
463
468
  constants.put(CLEVERTAP_ON_INAPP_BUTTON_CLICK, CLEVERTAP_ON_INAPP_BUTTON_CLICK);
464
469
  constants.put(CLEVERTAP_FEATURE_FLAGS_DID_UPDATE, CLEVERTAP_FEATURE_FLAGS_DID_UPDATE);
@@ -724,6 +729,15 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
724
729
  sendEvent(CLEVERTAP_ON_INBOX_BUTTON_CLICK, getWritableMapFromMap(payload));
725
730
 
726
731
  }
732
+ @Override
733
+ public void onInboxItemClicked(CTInboxMessage message){
734
+ WritableMap params = Arguments.createMap();
735
+ JSONObject data = message.getData();
736
+ if (data != null) {
737
+ params.putString("data", data.toString());
738
+ }
739
+ sendEvent(CLEVERTAP_ON_INBOX_MESSAGE_CLICK,params);
740
+ }
727
741
 
728
742
  //Product Config Callback
729
743
  @Override
@@ -1199,6 +1213,7 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
1199
1213
 
1200
1214
  @ReactMethod
1201
1215
  public void setPushTokenAsString(String token, String type) {
1216
+ Logger.v("setPushTokenAsString() called with: token = [" + token + "], type = [" + type + "]");
1202
1217
  CleverTapAPI clevertap = getCleverTapAPI();
1203
1218
  if (clevertap == null || token == null || type == null) {
1204
1219
  return;
@@ -1208,9 +1223,6 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
1208
1223
  case FCM:
1209
1224
  clevertap.pushFcmRegistrationId(token, true);
1210
1225
  break;
1211
- case XPS:
1212
- clevertap.pushXiaomiRegistrationId(token, true);
1213
- break;
1214
1226
  case BPS:
1215
1227
  clevertap.pushBaiduRegistrationId(token, true);
1216
1228
  break;
@@ -1223,6 +1235,26 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
1223
1235
  }
1224
1236
  }
1225
1237
 
1238
+ @ReactMethod
1239
+ public void setPushTokenAsStringWithRegion(String token, String type,String region) {
1240
+ Logger.v( "setPushTokenAsString() called with: token = [" + token + "], type = [" + type + "], region = [" + region + "]");
1241
+
1242
+ CleverTapAPI clevertap = getCleverTapAPI();
1243
+ if (clevertap == null || token == null || type == null || TextUtils.isEmpty(region)) {
1244
+ return;
1245
+ }
1246
+
1247
+ switch (type) {
1248
+ case XPS:
1249
+ clevertap.pushXiaomiRegistrationId(token,region,true);
1250
+ break;
1251
+ default:
1252
+ Log.e(TAG, "Unknown push token type " + type);
1253
+ break;
1254
+ }
1255
+ }
1256
+
1257
+
1226
1258
  @ReactMethod
1227
1259
  public void showInbox(ReadableMap styleConfig) {
1228
1260
  CTInboxStyleConfig inboxStyleConfig = styleConfigFromReadableMap(styleConfig);
@@ -1350,6 +1382,7 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
1350
1382
  clevertap.setSyncListener(this);
1351
1383
  clevertap.setCTNotificationInboxListener(this);
1352
1384
  clevertap.setInboxMessageButtonListener(this);
1385
+ clevertap.setCTInboxMessageListener(this);
1353
1386
  clevertap.setInAppNotificationButtonListener(this);
1354
1387
  clevertap.setDisplayUnitListener(this);
1355
1388
  clevertap.setCTProductConfigListener(this);
package/docs/install.md CHANGED
@@ -60,22 +60,38 @@ If you're on RN 0.60 or your project configuration doesn't allow to add `use_fra
60
60
  ```gradle
61
61
  dependencies {
62
62
  ...
63
- implementation 'com.clevertap.android:clevertap-android-sdk:4.4.0'
63
+ //androidx
64
+ implementation 'androidx.core:core:1.3.0'
65
+ implementation 'androidx.appcompat:appcompat:1.3.1' //Mandatory for App Inbox
66
+ implementation 'androidx.fragment:fragment:1.3.6' //Mandatory for InApp
67
+ implementation 'androidx.recyclerview:recyclerview:1.2.1' //Mandatory for App Inbox
68
+ implementation 'androidx.viewpager:viewpager:1.0.0' //Mandatory for App Inbox
69
+ implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
70
+
71
+ //com.android
72
+ implementation 'com.android.installreferrer:installreferrer:2.2' //Mandatory for React Native SDK v0.3.9+
73
+ implementation 'com.android.support:multidex:1.0.3'
74
+
75
+ //react-native libs
76
+ implementation "com.facebook.react:react-native:+"
77
+
78
+ //com.google
64
79
  implementation 'com.google.android.gms:play-services-base:17.6.0'
65
80
  implementation 'com.google.firebase:firebase-messaging:21.0.0'
66
- implementation 'com.google.android.exoplayer:exoplayer:2.15.1' //Optional for Audio/Video
67
- implementation 'com.google.android.exoplayer:exoplayer-hls:2.15.1' //Optional for Audio/Video
68
- implementation 'com.google.android.exoplayer:exoplayer-ui:2.15.1' //Optional for Audio/Video
69
- implementation 'com.github.bumptech.glide:glide:4.12.0' //Mandatory for App Inbox
70
- implementation 'androidx.recyclerview:recyclerview:1.2.1' //Mandatory for App Inbox
71
- implementation 'androidx.viewpager:viewpager:1.0.0' //Mandatory for App Inbox
72
- implementation 'com.google.android.material:material:1.4.0' //Mandatory for App Inbox
73
- implementation 'androidx.appcompat:appcompat:1.3.1' //Mandatory for App Inbox
74
- implementation 'androidx.core:core:1.3.0'
75
- implementation 'androidx.fragment:fragment:1.3.6' // InApp
76
- //Mandatory for React Native SDK v0.3.9 and above add the following -
77
- implementation 'com.android.installreferrer:installreferrer:2.2'
81
+ implementation 'com.google.android.material:material:1.4.0' //Mandatory for App Inbox
82
+ implementation 'com.google.android.exoplayer:exoplayer:2.17.1' //Optional for Audio/Video
83
+ implementation 'com.google.android.exoplayer:exoplayer-hls:2.17.1' //Optional for Audio/Video
84
+ implementation 'com.google.android.exoplayer:exoplayer-ui:2.17.1' //Optional for Audio/Video
85
+ //implementation 'com.google.android.gms:play-services-ads:19.0.1'
86
+
87
+
88
+ //clevertap
89
+ implementation 'com.clevertap.android:clevertap-android-sdk:4.6.3'
90
+
78
91
 
92
+ // other libs
93
+ implementation 'com.github.bumptech.glide:glide:4.12.0' //Mandatory for App Inbox
94
+
79
95
  //Note - ExoPlayer dependencies are optional but all 3 are required for Audio/Video Inbox and InApp Messages
80
96
  }
81
97
  ```
@@ -11,11 +11,11 @@ After [install](./install.md), you will need to integrate the CleverTap SDK into
11
11
  ```
12
12
  NOTE: Don't forget to add the CleverTap imports at the top of the file.
13
13
  ```objc
14
- #import <CleverTapSDK/CleverTap.h>
15
- #import <CleverTapReact/CleverTapReactManager.h>
14
+ #import <CleverTap-iOS-SDK/CleverTap.h>
15
+ #import <clevertap-react-native/CleverTapReactManager.h>
16
16
  ```
17
17
 
18
- Note: Need to use **@import CleverTapSDK;** instead of **#import <CleverTapSDK/CleverTap.h>** and **@import CleverTapReact;** instead of **#import <CleverTapReact/CleverTapReactManager.h>** in the AppDelegate class in case if using ```use_modular_headers!``` in the podfile.
18
+ Note: Need to use **@import CleverTapSDK;** instead of **#import <CleverTap-iOS-SDK/CleverTap.h>** and **@import CleverTapReact;** instead of **#import <clevertap-react-native/CleverTapReactManager.h>** in the AppDelegate class in case if using ```use_modular_headers!``` in the podfile.
19
19
 
20
20
  [See the Example Project](/Example/ios/Example/AppDelegate.m).
21
21
 
package/docs/usage.md CHANGED
@@ -74,6 +74,12 @@ CleverTap.profileDecrementValueForKey(1, "score");
74
74
  CleverTap.recordEvent('testEvent');
75
75
  ```
76
76
 
77
+ #### Record an event with event Properties
78
+
79
+ ```javascript
80
+ CleverTap.recordEvent('Product Viewed', {'Product Name': 'Dairy Milk','Category': 'Chocolate','Amount': 20.00});
81
+ ```
82
+
77
83
  #### Record Charged event
78
84
 
79
85
  ```javascript
package/index.d.ts CHANGED
@@ -64,10 +64,12 @@
64
64
  export function registerForPush(): void;
65
65
 
66
66
  /**
67
- * Sets the device's push token
68
- * @param token {string}
67
+ * Manually set the push token on the CleverTap user profile
68
+ * @param {string} token - the device token
69
+ * @param {string} type - for Android only, specifying the type of push service token. Values can be CleverTap.FCM for Firebase or CleverTap.XPS for Xiaomi or CleverTap.BPS for Baidu or CleverTap.HPS for Huawei,
70
+ * @param {string} region - for xps only ,to specify the region
69
71
  */
70
- export function setPushToken(token: string, type: string): void;
72
+ export function setPushToken(token: string, type: string,region?:string): void;
71
73
 
72
74
  /**
73
75
  * Create Notification Channel for Android O+
@@ -295,7 +297,8 @@
295
297
  export function getCleverTapID(callback: Callback): void;
296
298
 
297
299
  /**
298
- * Remove the property specified by key from the user profile
300
+ * Remove the property specified by key from the user profile. Alternatively this method
301
+ * can also be used to remove PII data (for eg. Email,Name,Phone), locally from database and shared prefs
299
302
  * @param key {string}
300
303
  */
301
304
  export function profileRemoveValueForKey(key: string): void;
package/index.js CHANGED
@@ -45,6 +45,7 @@ var CleverTap = {
45
45
  CleverTapInboxDidInitialize: CleverTapReact.CleverTapInboxDidInitialize,
46
46
  CleverTapInboxMessagesDidUpdate: CleverTapReact.CleverTapInboxMessagesDidUpdate,
47
47
  CleverTapInboxMessageButtonTapped: CleverTapReact.CleverTapInboxMessageButtonTapped,
48
+ CleverTapInboxMessageTapped:CleverTapReact.CleverTapInboxMessageTapped,
48
49
  CleverTapDisplayUnitsLoaded: CleverTapReact.CleverTapDisplayUnitsLoaded,
49
50
  CleverTapInAppNotificationButtonTapped: CleverTapReact.CleverTapInAppNotificationButtonTapped,
50
51
  CleverTapFeatureFlagsDidUpdate: CleverTapReact.CleverTapFeatureFlagsDidUpdate,
@@ -104,12 +105,19 @@ var CleverTap = {
104
105
  },
105
106
 
106
107
  /**
107
- * Manually set the push token on the CleverTap user profile
108
- * @param {string} token - the device token
109
- * @param {string} type - for Android only, specifying the type of push service token. Values can be CleverTap.FCM for Firebase or CleverTap.XPS for Xiaomi or CleverTap.BPS for Baidu or CleverTap.HPS for Huawei
110
- */
111
- setPushToken: function (token, type) {
112
- CleverTapReact.setPushTokenAsString(token, type);
108
+ * Manually set the push token on the CleverTap user profile
109
+ * @param {string} token - the device token
110
+ * @param {string} type - for Android only, specifying the type of push service token. Values can be CleverTap.FCM for Firebase or CleverTap.XPS for Xiaomi or CleverTap.BPS for Baidu or CleverTap.HPS for Huawei,
111
+ * @param {string} region - for xps only ,to specify the region
112
+ */
113
+ setPushToken: function (token, type,region="") {
114
+ console.log(`CleverTap RN | setPushToken | received : token: '${token}' | type:'${type}' | region:'${region}' `)
115
+ if(type === CleverTap.XPS){
116
+ CleverTapReact.setPushTokenAsStringWithRegion(token, type,region);
117
+ }
118
+ else {
119
+ CleverTapReact.setPushTokenAsString(token, type);
120
+ }
113
121
  },
114
122
 
115
123
  /**
@@ -379,7 +387,8 @@ var CleverTap = {
379
387
  },
380
388
 
381
389
  /**
382
- * Remove a key-value from the user profile
390
+ * Remove a key-value from the user profile. Alternatively this method can also be used to remove PII data
391
+ * (for eg. Email,Name,Phone), locally from database and shared prefs
383
392
  * @param {string} the key to remove
384
393
  */
385
394
  profileRemoveValueForKey: function (key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clevertap-react-native",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "description": "CleverTap React Native SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Workspace
3
- version = "1.0">
4
- <FileRef
5
- location = "self:">
6
- </FileRef>
7
- </Workspace>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>IDEDidComputeMac32BitWarning</key>
6
- <true/>
7
- </dict>
8
- </plist>
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>CleverTapReact.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>