clevertap-react-native 0.9.4 → 0.9.6

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,6 +1,28 @@
1
1
  Change Log
2
2
  ==========
3
3
 
4
+ Version 0.9.6 *(3 April 2023)*
5
+ -------------------------------------------
6
+ - Supports [CleverTap Android SDK v4.6.9](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-468-march-22-2023)
7
+ - Supports [CleverTap iOS SDK v4.2.2](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-422-april-03-2023)
8
+ - **[Breaking Change]**: Renames the `itemIndex` field with the `contentPageIndex` field in the payload of the `CleverTap.CleverTapInboxMessageTapped` callback.
9
+ - **[Parity with iOS platform]**:
10
+ The `CleverTap.CleverTapInboxMessageTapped` callback now provides a different value for `contentPageIndex`(ex-`itemIndex`) compared to before. Previously, it used to indicate the position of the clicked item within the list container of the App Inbox. However, now it indicates the page index of the content, which ranges from 0 to the total number of pages for carousel templates. For non-carousel templates, the value is always 0, as they only have one page of content.
11
+ - **[Type Definitions support in typescript]**: Supports type definitions for the event names that are available for Javascript.
12
+
13
+ Version 0.9.5 *(27 March 2023)*
14
+ -------------------------------------------
15
+ - Supports [CleverTap Android SDK v4.6.8](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md#version-468-march-22-2023)
16
+ - Supports [CleverTap iOS SDK v4.2.1](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-421-march-22-2023)
17
+ - Supports [CleverTap Android RenderMax SDK v1.0.3](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTRENDERMAXCHANGELOG.md#version-103-march-6-2023)
18
+ - Supports [CleverTap Push Templates SDK v1.0.5.1](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTPUSHTEMPLATESCHANGELOG.md#version-1051-march-15-2023).
19
+ - Make sure you update all four above versions for compatibility and smooth working.
20
+ - **Note:** This release is being done for Android 12 targeted users.
21
+ - **[Android and iOS platforms]**:
22
+ Adds `itemIndex` and `buttonIndex` arguments to the payload sent via App Inbox Message tapped listener: `CleverTap.CleverTapInboxMessageTapped`. The `itemIndex` corresponds the index of the item clicked in the list whereas the `buttonIndex` for the App Inbox button clicked (0, 1, or 2). A value of -1 in `buttonIndex` indicates the App Inbox item is clicked.
23
+ - **[Android Platform] Behavioral change of `CleverTap.CleverTapInboxMessageTapped` listener**:
24
+ Previously, the callback was raised when the App Inbox item is clicked. Now, it is also raised when the App Inbox button is clicked. It matches the behavior in iOS platform.
25
+
4
26
  Version 0.9.4 *(28 November 2022)*
5
27
  -------------------------------------------
6
28
  - Supports [CleverTap iOS SDK v4.1.5](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-415-november-15-2022)
@@ -21,8 +21,8 @@ android {
21
21
  defaultConfig {
22
22
  minSdkVersion 16
23
23
  targetSdkVersion 31
24
- versionCode 93
25
- versionName "0.9.3"
24
+ versionCode 95
25
+ versionName "0.9.6"
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.6.6'
42
+ api 'com.clevertap.android:clevertap-android-sdk:4.6.9'
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:+'
@@ -729,14 +729,17 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
729
729
  sendEvent(CLEVERTAP_ON_INBOX_BUTTON_CLICK, getWritableMapFromMap(payload));
730
730
 
731
731
  }
732
+
732
733
  @Override
733
- public void onInboxItemClicked(CTInboxMessage message){
734
+ public void onInboxItemClicked(CTInboxMessage message, int contentPageIndex, int buttonIndex) {
734
735
  WritableMap params = Arguments.createMap();
735
736
  JSONObject data = message.getData();
736
737
  if (data != null) {
737
738
  params.putString("data", data.toString());
738
739
  }
739
- sendEvent(CLEVERTAP_ON_INBOX_MESSAGE_CLICK,params);
740
+ params.putInt("contentPageIndex", contentPageIndex);
741
+ params.putInt("buttonIndex", buttonIndex);
742
+ sendEvent(CLEVERTAP_ON_INBOX_MESSAGE_CLICK, params);
740
743
  }
741
744
 
742
745
  //Product Config Callback
@@ -1264,6 +1267,14 @@ public class CleverTapModule extends ReactContextBaseJavaModule implements SyncL
1264
1267
  }
1265
1268
  }
1266
1269
 
1270
+ @ReactMethod
1271
+ public void dismissInbox() {
1272
+ CleverTapAPI cleverTap = getCleverTapAPI();
1273
+ if (cleverTap != null) {
1274
+ cleverTap.dismissAppInbox();
1275
+ }
1276
+ }
1277
+
1267
1278
  // Increment/Decrement Operator
1268
1279
 
1269
1280
  @ReactMethod
@@ -18,6 +18,6 @@ Pod::Spec.new do |s|
18
18
  s.preserve_paths = 'LICENSE.md', 'README.md', 'package.json', 'index.js'
19
19
  s.source_files = 'ios/CleverTapReact/*.{h,m}'
20
20
 
21
- s.dependency 'CleverTap-iOS-SDK', '4.1.5'
21
+ s.dependency 'CleverTap-iOS-SDK', '4.2.2'
22
22
  s.dependency 'React-Core'
23
23
  end
package/docs/install.md CHANGED
@@ -86,7 +86,9 @@ dependencies {
86
86
 
87
87
 
88
88
  //clevertap
89
- implementation 'com.clevertap.android:clevertap-android-sdk:4.6.6'
89
+ implementation 'com.clevertap.android:clevertap-android-sdk:4.6.9'
90
+ implementation "com.clevertap.android:push-templates:1.0.5.1" //Optional for push templates SDK support
91
+ implementation "com.clevertap.android:clevertap-rendermax-sdk:1.0.3" //Optional for renderMax SDK support
90
92
 
91
93
 
92
94
  // other libs
package/docs/usage.md CHANGED
@@ -104,6 +104,28 @@ CleverTap.showInbox({'tabs':['Offers','Promotions'],'navBarTitle':'My App Inbox'
104
104
  'noMessageText':'No message(s)','noMessageTextColor':'#FF0000'});
105
105
  ```
106
106
 
107
+ #### App Inbox Item Click Callback
108
+
109
+ ```javascript
110
+ CleverTap.addListener(CleverTap.CleverTapInboxMessageTapped, (event) => {
111
+ console.log("App Inbox item : ", event.data);
112
+ //following contentPageIndex and buttonIndex fields are available from CleverTap React Native SDK v0.9.6 onwards and below v1.0.0
113
+ console.log("Item index : " + event.contentPageIndex);
114
+ console.log("Button index : " + event.buttonIndex);
115
+ });
116
+ ```
117
+
118
+
119
+ #### App Inbox Button Click Callback
120
+ ```javascript
121
+ CleverTap.addListener(CleverTap.CleverTapInboxMessageButtonTapped, (event) => {/*consume the payload*/});
122
+ ```
123
+
124
+ #### Dismiss the App Inbox
125
+ ```javascript
126
+ CleverTap.dismissInbox();
127
+ ```
128
+
107
129
  #### Get Total message count
108
130
 
109
131
  ```javascript
package/index.d.ts CHANGED
@@ -430,6 +430,11 @@
430
430
  * @param styleConfig : any or empty object
431
431
  */
432
432
  export function showInbox(styleConfig: any): void;
433
+
434
+ /**
435
+ * Call this method to dismiss the App Inbox
436
+ */
437
+ export function dismissInbox(): void;
433
438
 
434
439
  /**
435
440
  * Call this method to get all inbox messages
@@ -634,7 +639,21 @@
634
639
  type Callback = (err: object, res: object) => void;
635
640
  type CallbackString = (err: object, res: string) => void;
636
641
 
637
- export const FCM : string;
638
- export const XPS : string;
639
- export const BPS : string;
640
- export const HPS : string;
642
+ export const FCM: string;
643
+ export const XPS: string;
644
+ export const BPS: string;
645
+ export const HPS: string;
646
+ export const CleverTapProfileDidInitialize: string;
647
+ export const CleverTapProfileSync: string;
648
+ export const CleverTapInAppNotificationDismissed: string;
649
+ export const CleverTapInboxDidInitialize: string;
650
+ export const CleverTapInboxMessagesDidUpdate: string;
651
+ export const CleverTapInboxMessageButtonTapped: string;
652
+ export const CleverTapInboxMessageTapped: string;
653
+ export const CleverTapDisplayUnitsLoaded: string;
654
+ export const CleverTapInAppNotificationButtonTapped: string;
655
+ export const CleverTapFeatureFlagsDidUpdate: string;
656
+ export const CleverTapProductConfigDidInitialize: string;
657
+ export const CleverTapProductConfigDidFetch: string;
658
+ export const CleverTapProductConfigDidActivate: string;
659
+ export const CleverTapPushNotificationClicked: string;
package/index.js CHANGED
@@ -45,7 +45,7 @@ var CleverTap = {
45
45
  CleverTapInboxDidInitialize: CleverTapReact.CleverTapInboxDidInitialize,
46
46
  CleverTapInboxMessagesDidUpdate: CleverTapReact.CleverTapInboxMessagesDidUpdate,
47
47
  CleverTapInboxMessageButtonTapped: CleverTapReact.CleverTapInboxMessageButtonTapped,
48
- CleverTapInboxMessageTapped:CleverTapReact.CleverTapInboxMessageTapped,
48
+ CleverTapInboxMessageTapped: CleverTapReact.CleverTapInboxMessageTapped,
49
49
  CleverTapDisplayUnitsLoaded: CleverTapReact.CleverTapDisplayUnitsLoaded,
50
50
  CleverTapInAppNotificationButtonTapped: CleverTapReact.CleverTapInAppNotificationButtonTapped,
51
51
  CleverTapFeatureFlagsDidUpdate: CleverTapReact.CleverTapFeatureFlagsDidUpdate,
@@ -525,6 +525,13 @@ var CleverTap = {
525
525
  CleverTapReact.showInbox(styleConfig);
526
526
  },
527
527
 
528
+ /**
529
+ * Method to dismiss the App Inbox
530
+ */
531
+ dismissInbox: function () {
532
+ CleverTapReact.dismissInbox();
533
+ },
534
+
528
535
  /**
529
536
  * Get the total number of Inbox Messages
530
537
  * @param {function(err, res)} callback that returns a res of count of inbox messages or -1
@@ -539,6 +539,11 @@ RCT_EXPORT_METHOD(deleteInboxMessageForId:(NSString*)messageId) {
539
539
  [[self cleverTapInstance] deleteInboxMessageForID:messageId];
540
540
  }
541
541
 
542
+ RCT_EXPORT_METHOD(dismissInbox) {
543
+ RCTLogInfo(@"[CleverTap dismissAppInbox]");
544
+ [[self cleverTapInstance] dismissAppInbox];
545
+ }
546
+
542
547
  RCT_EXPORT_METHOD(initializeInbox) {
543
548
  RCTLogInfo(@"[CleverTap Inbox Initialize]");
544
549
  [[self cleverTapInstance] initializeInboxWithCallback:^(BOOL success) {
@@ -640,13 +645,11 @@ RCT_EXPORT_METHOD(showInbox:(NSDictionary*)styleConfig) {
640
645
  - (void)messageDidSelect:(CleverTapInboxMessage *_Nonnull)message atIndex:(int)index withButtonIndex:(int)buttonIndex {
641
646
  NSMutableDictionary *body = [NSMutableDictionary new];
642
647
  if ([message json] != nil) {
643
- NSError *error;
644
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:[message json]
645
- options:0
646
- error:&error];
647
- NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
648
- body[@"data"] = jsonString;
648
+ body[@"data"] = [NSMutableDictionary dictionaryWithDictionary:[message json]];
649
649
  }
650
+ body[@"contentPageIndex"] = @(index);
651
+ body[@"buttonIndex"] = @(buttonIndex);
652
+
650
653
  [[NSNotificationCenter defaultCenter] postNotificationName:kCleverTapInboxMessageTapped object:nil userInfo:body];
651
654
  }
652
655
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clevertap-react-native",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "CleverTap React Native SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
File without changes
@@ -1,2 +0,0 @@
1
- #Wed Sep 28 11:39:15 IST 2022
2
- gradle.version=6.1.1
File without changes