cordova-plugin-insider 1.2.2 → 1.4.0

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.
@@ -5,7 +5,7 @@ on:
5
5
  inputs:
6
6
  version_name:
7
7
  required: true
8
- description: The new version name of the SDK to be released (1.0.0)
8
+ description: The new version name of the SDK to be released (1.3.0)
9
9
 
10
10
  jobs:
11
11
  release:
@@ -30,32 +30,6 @@ jobs:
30
30
  npm publish
31
31
  text=":iphone: Cordova SDK is published with version: ${{ github.event.inputs.version_name }}"
32
32
  ./slack_notifier.sh mob-deployment mob-sdk-releaser "$text"
33
- env:
34
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35
- SLACK_NOTIFIER_AUTH_KEY: ${{ secrets.SLACK_NOTIFIER_AUTH_KEY }}
36
-
37
- release-nh:
38
- needs: release
39
- name: Create NH Release
40
- runs-on: ubuntu-latest
41
-
42
- steps:
43
- - name: Checkout code
44
- uses: actions/checkout@v3
45
- with:
46
- ref: develop-nh
47
-
48
- - name: Publish Cordova SDK
49
- uses: actions/setup-node@v3.2.0
50
- with:
51
- node-version: 12
52
- registry-url: https://registry.npmjs.org/
53
- run: |
54
- npm ci
55
- npm test
56
- npm publish
57
- text=":iphone: Cordova NH SDK is published with version: ${{ github.event.inputs.version_name }}-nh"
58
- ./slack_notifier.sh mob-deployment mob-sdk-releaser "$text"
59
33
  env:
60
34
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61
35
  SLACK_NOTIFIER_AUTH_KEY: ${{ secrets.SLACK_NOTIFIER_AUTH_KEY }}
@@ -5,11 +5,11 @@ on:
5
5
  inputs:
6
6
  version_name:
7
7
  required: true
8
- description: The new version name of the SDK to be released (1.0.0)
8
+ description: The new version name of the SDK to be released (1.3.0)
9
9
 
10
10
  jobs:
11
11
  sdk_releaser:
12
- if: github.actor == 'sonerdm' || github.actor == 'MahammadMD' || github.actor == 'melih-useinsider'
12
+ if: github.actor == 'sonerdm' || github.actor == 'melih-useinsider'
13
13
  name: Trigger mobile-devops repository task merger
14
14
  runs-on: ubuntu-latest
15
15
  steps:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-insider",
3
- "version": "1.2.2",
3
+ "version": "1.4.0",
4
4
  "description": "A plugin that you can use Insider SDK with Cordova and Ionic",
5
5
  "cordova_name": "Insider Cordova Plugin",
6
6
  "cordova": {
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version='1.0' encoding='utf-8'?>
2
- <plugin id="cordova-plugin-insider" version="1.2.2" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
2
+ <plugin id="cordova-plugin-insider" version="1.4.0" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
3
3
  <name>Insider</name>
4
4
  <description>Insider Cordova Plugin</description>
5
5
  <keywords>insider,cordova,cordova-ios,cordova-android</keywords>
@@ -71,8 +71,8 @@
71
71
  <source url="https://cdn.cocoapods.org/" />
72
72
  </config>
73
73
  <pods use-frameworks="true">
74
- <pod name="InsiderMobile" spec="12.5.0" />
75
- <pod name="InsiderHybrid" spec="1.1.2" />
74
+ <pod name="InsiderMobile" spec="12.5.4" />
75
+ <pod name="InsiderHybrid" spec="1.4.0" />
76
76
  </pods>
77
77
  </podspec>
78
78
 
@@ -4,24 +4,34 @@ NEW_CV_VERSION_NAME=$1
4
4
 
5
5
  packagejson_file_path="package.json"
6
6
  gradle_file_path="src/android/build-extras.gradle"
7
+ pluginxml_file_path="plugin.xml"
8
+ constants_file_path="www/Constants.js"
7
9
 
8
10
  CURRENT_CV_SDK_VERSION=$(sed -n 3p $packagejson_file_path | cut -d '"' -f 4)
9
11
 
10
-
11
12
  CURRENT_ANDROID_VERSION=$(sed -n 22p $gradle_file_path | awk '{print $2}' | awk -F : '{print $3}' | cut -d "'" -f 1)
12
13
  CURRENT_ANDROID_HYBRID_VERSION=$(sed -n 23p $gradle_file_path | awk '{print $2}' | awk -F : '{print $3}' | cut -d "'" -f 1)
13
14
 
15
+ CURRENT_iOS_VERSION=$(sed -n 74p $pluginxml_file_path | awk '{print $3}' | cut -d '"' -f 2)
16
+ CURRENT_iOS_HYBRID_VERSION=$(sed -n 75p $pluginxml_file_path | awk '{print $3}' | cut -d '"' -f 2)
17
+
14
18
  LATEST_iOS_VERSION=$(aws s3 ls s3://mobilesdk.useinsider.com/iOS/ --recursive | sort | tail -n 1 | awk '{print $4}' | awk -F / '{print $2}')
15
19
  LATEST_iOS_HYBRID_VERSION=$(aws s3 ls s3://mobilesdk.useinsider.com/iOSHybrid/ --recursive | sort | tail -n 1 | awk '{print $4}' | awk -F / '{print $2}')
16
20
 
17
21
  LATEST_ANDROID_VERSION=$(aws s3 ls s3://mobilesdk.useinsider.com/android/com/useinsider/insider/ --recursive | sort | tail -n 1 | awk '{print $4}' | awk -F / '{print $5}' | cut -d "-" -f 1)
18
22
  LATEST_ANDROID_HYBRID_VERSION=$(aws s3 ls s3://mobilesdk.useinsider.com/android/com/useinsider/insiderhybrid/ --recursive | sort | tail -n 1 | awk '{print $4}' | awk -F / '{print $5}')
19
23
 
20
- # # Set new version in package.json
21
- # sed -i "s/$CURRENT_CV_SDK_VERSION/$NEW_CV_VERSION_NAME/" $packagejson_file_path
24
+ # Set new version in plugin.xml
25
+ sed -i "s/$CURRENT_CV_SDK_VERSION/$NEW_CV_VERSION_NAME/" $pluginxml_file_path
26
+
27
+ # Set new sdk version in Constant.js
28
+ sed -i "s/$CURRENT_CV_SDK_VERSION/$NEW_CV_VERSION_NAME/" $constants_file_path
29
+
30
+ # Set new version in package.json
31
+ sed -i "s/$CURRENT_CV_SDK_VERSION/$NEW_CV_VERSION_NAME/" $packagejson_file_path
22
32
 
23
- # # Set new version in podspec
24
- # sed -i "s/$CURRENT_iOS_VERSION/$LATEST_iOS_VERSION/;s/$CURRENT_iOS_HYBRID_VERSION/$LATEST_iOS_HYBRID_VERSION/" $podspec_file_path
33
+ # Set new version in plugin.xml for ios
34
+ sed -i "s/$CURRENT_iOS_VERSION/$LATEST_iOS_VERSION/;s/$CURRENT_iOS_HYBRID_VERSION/$LATEST_iOS_HYBRID_VERSION/" $pluginxml_file_path
25
35
 
26
- # # Set new version in build.gradle
27
- # sed -i "s/$CURRENT_ANDROID_VERSION/$LATEST_ANDROID_VERSION/;s/$CURRENT_ANDROID_HYBRID_VERSION/$LATEST_ANDROID_HYBRID_VERSION/" $gradle_file_path
36
+ # Set new version in build.gradle
37
+ sed -i "s/$CURRENT_ANDROID_VERSION/$LATEST_ANDROID_VERSION/;s/$CURRENT_ANDROID_HYBRID_VERSION/$LATEST_ANDROID_HYBRID_VERSION/" $gradle_file_path
@@ -38,4 +38,5 @@ class Constants {
38
38
  static final String VOUCHER_DISCOUNT = "voucher_discount";
39
39
  static final String PROMOTION_NAME = "promotion_name";
40
40
  static final String PROMOTION_DISCOUNT = "promotion_discount";
41
+ static final String GROUP_CODE = "groupcode";
41
42
  }
@@ -273,6 +273,32 @@ public class InsiderPlugin extends CordovaPlugin {
273
273
  }
274
274
  }
275
275
  });
276
+ } else if (action.equals("getSmartRecommendationWithProductIDs")) {
277
+ if (args.get(0) == null || args.get(1) == null || args.get(2) == null || args.get(3) == null)
278
+ return false;
279
+
280
+ cordova.getThreadPool().execute(new Runnable() {
281
+ @Override
282
+ public void run() {
283
+ try {
284
+ String[] productIDs = (CDVUtils.convertJSONToArrayList(args.get(0).toString())).toArray(new String[0]);
285
+
286
+ Insider.Instance.getSmartRecommendationWithProductIDs(productIDs,
287
+ args.getInt(1),
288
+ args.getString(2),
289
+ args.getString(3),
290
+ new RecommendationEngine.SmartRecommendation() {
291
+ @Override
292
+ public void loadRecommendationData(JSONObject jsonObject) {
293
+ callbackSuccess(callbackContext, jsonObject.toString());
294
+ }
295
+ });
296
+ } catch (JSONException e) {
297
+ callbackFailure(callbackContext, "ERROR:" + e.toString());
298
+ e.printStackTrace();
299
+ }
300
+ }
301
+ });
276
302
  } else if (action.equals(InsiderHybridMethods.CLICK_SMART_RECOMMENDATION_PRODUCT)) {
277
303
  if (args.get(0) == null || args.get(1) == null || args.get(2) == null)
278
304
  return false;
@@ -770,6 +796,9 @@ public class InsiderPlugin extends CordovaPlugin {
770
796
  case Constants.PROMOTION_DISCOUNT:
771
797
  product.setPromotionDiscount((double) value);
772
798
  break;
799
+ case Constants.GROUP_CODE:
800
+ product.setGroupCode((String) value);
801
+ break;
773
802
  default:
774
803
  setProductCustomAttribute(product, entry.getKey(), value);
775
804
  break;
@@ -19,8 +19,8 @@ android {
19
19
  }
20
20
 
21
21
  dependencies {
22
- implementation 'com.useinsider:insider:13.4.2'
23
- implementation 'com.useinsider:insiderhybrid:1.1.4'
22
+ implementation 'com.useinsider:insider:13.6.0'
23
+ implementation 'com.useinsider:insiderhybrid:1.1.6'
24
24
 
25
25
  implementation 'com.fasterxml.jackson.core:jackson-core:2.12.4'
26
26
  implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.4'
@@ -30,6 +30,7 @@
30
30
  - (void) cartCleared:(CDVInvokedUrlCommand *)command;
31
31
  - (void) getSmartRecommendation:(CDVInvokedUrlCommand *)command;
32
32
  - (void) getSmartRecommendationWithProduct:(CDVInvokedUrlCommand *)command;
33
+ - (void) getSmartRecommendationWithProductIDs:(CDVInvokedUrlCommand *)command;
33
34
  - (void) clickSmartRecommendationProduct:(CDVInvokedUrlCommand *)command;
34
35
  - (void) getMessageCenterData:(CDVInvokedUrlCommand *)command;
35
36
  - (void) setGender:(CDVInvokedUrlCommand *)command;
@@ -390,6 +390,20 @@
390
390
  }
391
391
  }
392
392
 
393
+ - (void)getSmartRecommendationWithProductIDs:(CDVInvokedUrlCommand *)command {
394
+ @try {
395
+ [self.commandDelegate runInBackground:^{
396
+ if (![command.arguments objectAtIndex:0] || ![command.arguments objectAtIndex:1] || ![command.arguments objectAtIndex:2] || ![command.arguments objectAtIndex:3]) return;
397
+
398
+ [Insider getSmartRecommendationWithProductIDs:[command.arguments objectAtIndex:0] recommendationID:[[command.arguments objectAtIndex:1] intValue] locale:[command.arguments objectAtIndex:2] currency:[command.arguments objectAtIndex:3] smartRecommendation:^(NSDictionary *recommendation) {
399
+ [self sendSuccessResultWithDictionary:recommendation andCommand:command];
400
+ }];
401
+ }];
402
+ } @catch (NSException *e) {
403
+ [Insider sendError:e desc:[NSString stringWithFormat:@"%s:%d", __func__, __LINE__]];
404
+ }
405
+ }
406
+
393
407
  - (void)clickSmartRecommendationProduct:(CDVInvokedUrlCommand *)command {
394
408
  @try {
395
409
  dispatch_async(dispatch_get_main_queue(), ^{
@@ -19,6 +19,7 @@ interface InsiderPlugin {
19
19
  getMessageCenterData(limit: number, startDate: Date, endDate: Date): Promise <any>;
20
20
  getSmartRecommendation(recommendationID: number, locale: string, currency: string): Promise <any>;
21
21
  getSmartRecommendationWithProduct(product: object, recommendationID: number, locale: string): Promise <any>;
22
+ getSmartRecommendationWithProductIDs(product: Array<string>, recommendationID: number, locale: string): Promise <any>;
22
23
  clickSmartRecommendationProduct(product: object, recommendationID: number);
23
24
  getContentStringWithName(variableName: string, defaultValue: any, contentOptimizerDataType: number): Promise <any>;
24
25
  getContentBoolWithName(variableName: string, defaultValue: boolean, contentOptimizerDataType: number): Promise <any>;
@@ -9,6 +9,7 @@ export interface Product {
9
9
  setPromotionDiscount(promotionDiscount: number):Product;
10
10
  setStock(setStock: number):Product;
11
11
  setQuantity(quantity: number):Product;
12
+ setGroupCode(groupCode: string):Product;
12
13
  setCustomAttributeWithString(key: string, value: string):Product;
13
14
  setCustomAttributeWithInt(key: string, value: number):Product;
14
15
  setCustomAttributeWithBoolean(key: string, value: boolean):Product;
package/www/Constants.js CHANGED
@@ -42,6 +42,7 @@ module.exports = {
42
42
  GET_MESSAGE_CENTER_DATA: 'getMessageCenterData',
43
43
  GET_SMART_RECOMMENDATION: 'getSmartRecommendation',
44
44
  GET_SMART_RECOMMENDATION_WITH_PRODUCT: 'getSmartRecommendationWithProduct',
45
+ GET_SMART_RECOMMENDATION_WITH_PRODUCT_IDS: 'getSmartRecommendationWithProductIDs',
45
46
  CLICK_SMART_RECOMMENDATION_PRODUCT: 'clickSmartRecommendationProduct',
46
47
  GET_CONTENT_STRING_WITH_NAME: 'getContentStringWithName',
47
48
  GET_CONTENT_BOOL_WITH_NAME: 'getContentBoolWithName',
@@ -76,11 +77,12 @@ module.exports = {
76
77
  VOUCHER_DISCOUNT: 'voucher_discount',
77
78
  PROMOTION_NAME: 'promotion_name',
78
79
  PROMOTION_DISCOUNT: 'promotion_discount',
80
+ GROUP_CODE: 'groupcode',
79
81
  // Error
80
82
  PUT_ERROR_LOG: 'putErrorLog',
81
83
  // Platform
82
84
  ANDROID: 'android',
83
85
  IOS: 'ios',
84
86
  // SDK Version
85
- SDK_VERSION: 'CDV-1.2.2',
87
+ SDK_VERSION: 'CDV-1.4.0',
86
88
  };
@@ -150,6 +150,18 @@ class InsiderPlugin {
150
150
  }
151
151
  }
152
152
 
153
+ getSmartRecommendationWithProductIDs = (productIDs, recommendationID, locale, currency) => {
154
+ if (productIDs === null || recommendationID === null || locale === null || currency === null) return;
155
+
156
+ productIDs = productIDs.filter(value => value != null && typeof value == "string" && value.trim());
157
+
158
+ try {
159
+ return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.GET_SMART_RECOMMENDATION_WITH_PRODUCT_IDS, [productIDs, recommendationID, locale, currency]);
160
+ } catch (error) {
161
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
162
+ }
163
+ }
164
+
153
165
  clickSmartRecommendationProduct = (product, recommendationID) => {
154
166
  if (product === null || recommendationID === null) return;
155
167
 
package/www/Product.js CHANGED
@@ -66,6 +66,18 @@ class Product {
66
66
  return this;
67
67
  }
68
68
 
69
+ setGroupCode(groupCode) {
70
+ if (!groupCode) { Utils.showWarning(this.constructor.name + '-groupCode'); return this; }
71
+
72
+ try {
73
+ this.productOptMap[InsiderConstants.GROUP_CODE] = groupCode;
74
+ } catch (error) {
75
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
76
+ }
77
+
78
+ return this;
79
+ }
80
+
69
81
  setSalePrice(salePrice) {
70
82
  if (salePrice === null|| Utils.isEmpty(salePrice)){ Utils.showWarning(this.constructor.name + '-salePrice'); return this;}
71
83