react-native-insider 5.3.0-nh → 5.4.0-nh

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/RNInsider.podspec CHANGED
@@ -9,11 +9,11 @@ Pod::Spec.new do |s|
9
9
  s.authors = package_json['author']
10
10
  s.license = 'MIT'
11
11
  s.platform = :ios, '10.0'
12
- s.source = {:http => 'https://mobilesdk.useinsider.com/iOS/12.5.2/InsiderMobileIOSFramework.zip'}
12
+ s.source = {:http => 'https://mobilesdk.useinsider.com/iOS/12.5.4/InsiderMobileIOSFramework.zip'}
13
13
  s.source_files = 'ios/RNInsider/*.{h,m}'
14
14
  s.requires_arc = true
15
15
  s.static_framework = true
16
16
  s.dependency 'React'
17
- s.dependency 'InsiderMobile', '12.5.2'
18
- s.dependency 'InsiderHybrid', '1.2.1'
17
+ s.dependency 'InsiderMobile', '12.5.4'
18
+ s.dependency 'InsiderHybrid', '1.4.0'
19
19
  end
@@ -35,8 +35,8 @@ repositories {
35
35
 
36
36
  dependencies {
37
37
  implementation "com.facebook.react:react-native:${getVersionFromPartner('reactNativeVersion', '+')}"
38
- implementation ('com.useinsider:insider:13.4.2-nh')
39
- implementation ('com.useinsider:insiderhybrid:1.1.4')
38
+ implementation ('com.useinsider:insider:13.6.0-nh')
39
+ implementation ('com.useinsider:insiderhybrid:1.1.5')
40
40
 
41
41
  implementation 'androidx.legacy:legacy-support-v4:1.0.0'
42
42
  implementation 'com.google.android.gms:play-services-location:20.0.0'
@@ -477,6 +477,27 @@ public class RNInsiderModule extends ReactContextBaseJavaModule {
477
477
  }
478
478
  }
479
479
 
480
+ @ReactMethod
481
+ public void getSmartRecommendationWithProductIDs(ReadableArray productIDs, int recommendationID, String locale, String currency, final Callback callback) {
482
+ try {
483
+ String[] productIDsOptions = RNUtils.convertReadableArrayToArray(productIDs);
484
+
485
+ Insider.Instance.getSmartRecommendationWithProductIDs(productIDsOptions, recommendationID, locale, currency,
486
+ new RecommendationEngine.SmartRecommendation() {
487
+ @Override
488
+ public void loadRecommendationData(JSONObject recommendation) {
489
+ try {
490
+ callback.invoke(RNUtils.convertJSONObjectToMap(recommendation));
491
+ } catch (Exception e) {
492
+ Insider.Instance.putException(e);
493
+ }
494
+ }
495
+ });
496
+ } catch (Exception e) {
497
+ Insider.Instance.putException(e);
498
+ }
499
+ }
500
+
480
501
  @ReactMethod
481
502
  public void clickSmartRecommendationProduct(int recommendationID, ReadableMap productMustMap,
482
503
  ReadableMap productOptMap) {
package/index.js CHANGED
@@ -195,6 +195,19 @@ export default class RNInsider {
195
195
  }
196
196
  }
197
197
 
198
+ static getSmartRecommendationWithProductIDs(productIDs: Array<string>, recommendationID: number, locale: string, currency: string, callback: Function) {
199
+ if (shouldNotProceed() || productIDs == null || recommendationID == null || locale == null || currency == null || callback == null) return;
200
+ try {
201
+ productIDs = productIDs.filter(value => value != null && typeof value == "string" && value.trim());
202
+
203
+ Insider.getSmartRecommendationWithProductIDs(productIDs, recommendationID, locale, currency, (recommendation) => {
204
+ callback(recommendation);
205
+ });
206
+ } catch (error) {
207
+ Insider.putErrorLog(generateJSONErrorString(error));
208
+ }
209
+ }
210
+
198
211
  static clickSmartRecommendationProduct(recommendationID: number, product: RNInsiderProduct) {
199
212
  if (shouldNotProceed() || product == null || recommendationID == null) return;
200
213
  try {
@@ -350,6 +350,16 @@ RCT_EXPORT_METHOD(getSmartRecommendationWithProduct:(NSDictionary *)productMustM
350
350
  }
351
351
  }
352
352
 
353
+ RCT_EXPORT_METHOD(getSmartRecommendationWithProductIDs:(NSArray *)productIDs recommendationID:(int)recommendationID locale:(NSString *)locale currency:(NSString *)currency smartRecommendation:(RCTResponseSenderBlock) smartRecommendation) {
354
+ @try {
355
+ [Insider getSmartRecommendationWithProductIDs:productIDs recommendationID:recommendationID locale:locale currency:currency smartRecommendation:^(NSDictionary *recommendation) {
356
+ smartRecommendation([NSArray arrayWithObject:recommendation]);
357
+ }];
358
+ } @catch (NSException *e) {
359
+ [Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
360
+ }
361
+ }
362
+
353
363
  RCT_EXPORT_METHOD(clickSmartRecommendationProduct:(int)recommendationID productMustMap:(NSDictionary *)productMustMap productOptMap:(NSDictionary *)productOptMap) {
354
364
  @try {
355
365
  InsiderProduct *product = [InsiderHybrid createProduct:productMustMap productOptMap:productOptMap];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-insider",
3
- "version": "5.3.0-nh",
3
+ "version": "5.4.0-nh",
4
4
  "description": "React Native Insider SDK",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -30,6 +30,7 @@ const VOUCHER_NAME = 'voucher_name';
30
30
  const VOUCHER_DISCOUNT = 'voucher_discount';
31
31
  const PROMOTION_NAME = 'promotion_name';
32
32
  const PROMOTION_DISCOUNT = 'promotion_discount';
33
+ const GROUP_CODE = 'groupcode';
33
34
 
34
35
  export default class RNInsiderProduct {
35
36
  productMustMap = {};
@@ -145,6 +146,16 @@ export default class RNInsiderProduct {
145
146
  return this;
146
147
  }
147
148
 
149
+ setGroupCode(groupCode: string) {
150
+ if (shouldNotProceed() || groupCode == null) return this;
151
+ try {
152
+ this.productOptMap[GROUP_CODE] = groupCode;
153
+ } catch (error) {
154
+ Insider.putErrorLog(generateJSONErrorString(error));
155
+ }
156
+ return this;
157
+ }
158
+
148
159
  setCustomAttributeWithString(key: string, value: string) {
149
160
  if (shouldNotProceed() || key == null || value == null) return this;
150
161
  try {