clevertap-react-native 0.9.1 → 0.9.2

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,11 @@
1
1
  Change Log
2
2
  ==========
3
3
 
4
+ Version 0.9.2 *(7 October 2022)*
5
+ -------------------------------------------
6
+ - Supports [CleverTap iOS SDK v4.1.2](https://github.com/CleverTap/clevertap-ios-sdk/blob/master/CHANGELOG.md#version-412-september-16-2022) and associated enhancements
7
+ - Supports App Inbox Message tapped listener: `CleverTap.CleverTapInboxMessageTapped`
8
+
4
9
  Version 0.9.1 *(21 September 2022)*
5
10
  -------------------------------------------
6
11
  - Supports CleverTap Android Core SDK [v4.6.3](https://github.com/CleverTap/clevertap-android-sdk/blob/master/docs/CTCORECHANGELOG.md) and associated enhancements
@@ -21,8 +21,8 @@ android {
21
21
  defaultConfig {
22
22
  minSdkVersion 16
23
23
  targetSdkVersion 31
24
- versionCode 91
25
- versionName "0.9.1"
24
+ versionCode 92
25
+ versionName "0.9.2"
26
26
  }
27
27
  buildTypes {
28
28
  release {
@@ -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.0.0'
21
+ s.dependency 'CleverTap-iOS-SDK', '4.1.2'
22
22
  s.dependency 'React-Core'
23
23
  end
@@ -7,12 +7,14 @@ static NSString *const kCleverTapInAppNotificationButtonTapped = @"CleverTapInAp
7
7
  static NSString *const kCleverTapInboxDidInitialize = @"CleverTapInboxDidInitialize";
8
8
  static NSString *const kCleverTapInboxMessagesDidUpdate = @"CleverTapInboxMessagesDidUpdate";
9
9
  static NSString *const kCleverTapInboxMessageButtonTapped = @"CleverTapInboxMessageButtonTapped";
10
+ static NSString *const kCleverTapInboxMessageTapped = @"CleverTapInboxMessageTapped";
10
11
  static NSString *const kCleverTapDisplayUnitsLoaded = @"CleverTapDisplayUnitsLoaded";
11
12
  static NSString *const kCleverTapFeatureFlagsDidUpdate = @"CleverTapFeatureFlagsDidUpdate";
12
13
  static NSString *const kCleverTapProductConfigDidFetch = @"CleverTapProductConfigDidFetch";
13
14
  static NSString *const kCleverTapProductConfigDidActivate = @"CleverTapProductConfigDidActivate";
14
15
  static NSString *const kCleverTapProductConfigDidInitialize = @"CleverTapProductConfigDidInitialize";
15
16
  static NSString *const kCleverTapPushNotificationClicked = @"CleverTapPushNotificationClicked";
17
+ static NSString *const kXPS = @"XPS";
16
18
 
17
19
 
18
20
  @interface CleverTapReact : NSObject <RCTBridgeModule>
@@ -33,13 +33,15 @@ RCT_EXPORT_MODULE();
33
33
  kCleverTapInboxDidInitialize: kCleverTapInboxDidInitialize,
34
34
  kCleverTapInboxMessagesDidUpdate: kCleverTapInboxMessagesDidUpdate,
35
35
  kCleverTapInboxMessageButtonTapped: kCleverTapInboxMessageButtonTapped,
36
+ kCleverTapInboxMessageTapped: kCleverTapInboxMessageTapped,
36
37
  kCleverTapInAppNotificationButtonTapped: kCleverTapInAppNotificationButtonTapped,
37
38
  kCleverTapDisplayUnitsLoaded: kCleverTapDisplayUnitsLoaded,
38
39
  kCleverTapFeatureFlagsDidUpdate: kCleverTapFeatureFlagsDidUpdate,
39
40
  kCleverTapProductConfigDidFetch: kCleverTapProductConfigDidFetch,
40
41
  kCleverTapProductConfigDidActivate: kCleverTapProductConfigDidActivate,
41
42
  kCleverTapProductConfigDidInitialize: kCleverTapProductConfigDidInitialize,
42
- kCleverTapPushNotificationClicked: kCleverTapPushNotificationClicked
43
+ kCleverTapPushNotificationClicked: kCleverTapPushNotificationClicked,
44
+ kXPS: kXPS
43
45
  };
44
46
  }
45
47
 
@@ -90,6 +92,10 @@ RCT_EXPORT_METHOD(setPushTokenAsString:(NSString*)token withType:(NSString *)typ
90
92
  [[CleverTap sharedInstance] setPushTokenAsString:token];
91
93
  }
92
94
 
95
+ // setPushTokenAsStringWithRegion is a no-op in iOS
96
+ RCT_EXPORT_METHOD(setPushTokenAsStringWithRegion:(NSString*)token withType:(NSString *)type withRegion:(NSString *)region){
97
+ RCTLogInfo(@"[CleverTap setPushTokenAsStringWithRegion is no-op in iOS]");
98
+ }
93
99
 
94
100
  #pragma mark - Personalization
95
101
 
@@ -595,11 +601,24 @@ RCT_EXPORT_METHOD(showInbox:(NSDictionary*)styleConfig) {
595
601
  - (void)messageButtonTappedWithCustomExtras:(NSDictionary *)customExtras {
596
602
  NSMutableDictionary *body = [NSMutableDictionary new];
597
603
  if (customExtras != nil) {
598
- body[@"customExtras"] = customExtras;
604
+ body = [NSMutableDictionary dictionaryWithDictionary:customExtras];
599
605
  }
600
606
  [[NSNotificationCenter defaultCenter] postNotificationName:kCleverTapInboxMessageButtonTapped object:nil userInfo:body];
601
607
  }
602
608
 
609
+ - (void)messageDidSelect:(CleverTapInboxMessage *_Nonnull)message atIndex:(int)index withButtonIndex:(int)buttonIndex {
610
+ NSMutableDictionary *body = [NSMutableDictionary new];
611
+ if ([message json] != nil) {
612
+ NSError *error;
613
+ NSData *jsonData = [NSJSONSerialization dataWithJSONObject:[message json]
614
+ options:0
615
+ error:&error];
616
+ NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
617
+ body[@"data"] = jsonString;
618
+ }
619
+ [[NSNotificationCenter defaultCenter] postNotificationName:kCleverTapInboxMessageTapped object:nil userInfo:body];
620
+ }
621
+
603
622
 
604
623
  #pragma mark - Display Units
605
624
 
@@ -10,7 +10,7 @@
10
10
  RCT_EXPORT_MODULE();
11
11
 
12
12
  - (NSArray<NSString *> *)supportedEvents {
13
- return @[kCleverTapProfileDidInitialize, kCleverTapProfileSync, kCleverTapInAppNotificationDismissed, kCleverTapInboxDidInitialize, kCleverTapInboxMessagesDidUpdate, kCleverTapInAppNotificationButtonTapped, kCleverTapInboxMessageButtonTapped, kCleverTapDisplayUnitsLoaded, kCleverTapFeatureFlagsDidUpdate, kCleverTapProductConfigDidFetch, kCleverTapProductConfigDidActivate, kCleverTapProductConfigDidInitialize, kCleverTapPushNotificationClicked];
13
+ return @[kCleverTapProfileDidInitialize, kCleverTapProfileSync, kCleverTapInAppNotificationDismissed, kCleverTapInboxDidInitialize, kCleverTapInboxMessagesDidUpdate, kCleverTapInAppNotificationButtonTapped, kCleverTapInboxMessageButtonTapped, kCleverTapInboxMessageTapped, kCleverTapDisplayUnitsLoaded, kCleverTapFeatureFlagsDidUpdate, kCleverTapProductConfigDidFetch, kCleverTapProductConfigDidActivate, kCleverTapProductConfigDidInitialize, kCleverTapPushNotificationClicked];
14
14
  }
15
15
 
16
16
 
@@ -54,7 +54,12 @@ RCT_EXPORT_MODULE();
54
54
  selector:@selector(emitEventInternal:)
55
55
  name:kCleverTapInboxMessageButtonTapped
56
56
  object:nil];
57
-
57
+
58
+ [[NSNotificationCenter defaultCenter] addObserver:self
59
+ selector:@selector(emitEventInternal:)
60
+ name:kCleverTapInboxMessageTapped
61
+ object:nil];
62
+
58
63
  [[NSNotificationCenter defaultCenter] addObserver:self
59
64
  selector:@selector(emitEventInternal:)
60
65
  name:kCleverTapFeatureFlagsDidUpdate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clevertap-react-native",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "CleverTap React Native SDK.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",