cordova-plugin-insider 1.2.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.
- package/.github/CODEOWNERS +8 -0
- package/.github/workflows/git-leak.yml +25 -0
- package/.github/workflows/insider-cordova-SDK_release.yml +61 -0
- package/.github/workflows/release_task_merger.yml +22 -0
- package/.github/workflows/release_version_setter.yml +43 -0
- package/README.md +104 -0
- package/hooks/FSUtils.js +28 -0
- package/hooks/after_plugin_install.js +81 -0
- package/hooks/before_plugin_uninstall.js +49 -0
- package/package.json +19 -0
- package/plugin.xml +91 -0
- package/release_version.sh +27 -0
- package/slack_notifier.sh +20 -0
- package/src/android/CDVUtils.java +120 -0
- package/src/android/Constants.java +41 -0
- package/src/android/InsiderPlugin.java +814 -0
- package/src/android/build-extras.gradle +38 -0
- package/src/android/res/values/dimens.xml +4 -0
- package/src/android/res/values-sw600dp/dimens.xml +3 -0
- package/src/android/res/values-sw720dp/dimens.xml +3 -0
- package/src/android/res/values-xhdpi/dimens.xml +4 -0
- package/src/android/res/values-xxhdpi/dimens.xml +4 -0
- package/src/android/res/values-xxxhdpi/dimens.xml +4 -0
- package/src/ios/IDFAHelper.h +7 -0
- package/src/ios/IDFAHelper.m +19 -0
- package/src/ios/InsiderPlugin.h +58 -0
- package/src/ios/InsiderPlugin.m +758 -0
- package/types/CallbackType.d.ts +7 -0
- package/types/ContentOptimizerDataType.d.ts +4 -0
- package/types/Event.d.ts +9 -0
- package/types/Gender.d.ts +5 -0
- package/types/Identifier.d.ts +7 -0
- package/types/InsiderPlugin.d.ts +51 -0
- package/types/Product.d.ts +18 -0
- package/types/User.d.ts +27 -0
- package/www/CallbackType.js +7 -0
- package/www/Constants.js +86 -0
- package/www/ContentOptimizerDataType.js +4 -0
- package/www/Event.js +96 -0
- package/www/Gender.js +5 -0
- package/www/Identifier.js +66 -0
- package/www/InsiderPlugin.js +364 -0
- package/www/Product.js +211 -0
- package/www/User.js +303 -0
- package/www/Utils.js +18 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
package com.useinsider.cordova;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.core.type.TypeReference;
|
|
4
|
+
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
5
|
+
import com.useinsider.insider.Insider;
|
|
6
|
+
import com.useinsider.insider.InsiderProduct;
|
|
7
|
+
|
|
8
|
+
import org.json.JSONArray;
|
|
9
|
+
import org.json.JSONException;
|
|
10
|
+
import org.json.JSONObject;
|
|
11
|
+
|
|
12
|
+
import java.lang.reflect.Array;
|
|
13
|
+
import java.lang.reflect.Type;
|
|
14
|
+
import java.text.DateFormat;
|
|
15
|
+
import java.text.SimpleDateFormat;
|
|
16
|
+
import java.util.ArrayList;
|
|
17
|
+
import java.util.Date;
|
|
18
|
+
import java.util.HashMap;
|
|
19
|
+
import java.util.Iterator;
|
|
20
|
+
import java.util.Map;
|
|
21
|
+
|
|
22
|
+
public class CDVUtils {
|
|
23
|
+
public static Map<String, Object> convertJSONToMap(String jsonString) {
|
|
24
|
+
Map<String, Object> convertedData = null;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
convertedData = new ObjectMapper().readValue(jsonString, HashMap.class);
|
|
28
|
+
|
|
29
|
+
} catch (Exception e) {
|
|
30
|
+
Insider.Instance.putException(e);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return convertedData;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static Map<String, String> convertJSONToStringMap(String jsonString) {
|
|
37
|
+
Map<String, String> convertedData = null;
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
convertedData = new ObjectMapper().readValue(jsonString, HashMap.class);
|
|
41
|
+
} catch (Exception e) {
|
|
42
|
+
Insider.Instance.putException(e);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return convertedData;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
public static ArrayList<String> convertJSONToArrayList(String jsonString) {
|
|
50
|
+
ArrayList<String> listdata = new ArrayList<String>();
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
listdata = new ObjectMapper().readValue(jsonString, ArrayList.class);
|
|
54
|
+
} catch (Exception e) {
|
|
55
|
+
Insider.Instance.putException(e);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return listdata;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public static Map convertJSONObjectToMap(JSONObject jsonObject) throws JSONException {
|
|
62
|
+
HashMap map = new HashMap();
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
Iterator<String> iterator = jsonObject.keys();
|
|
66
|
+
while (iterator.hasNext()) {
|
|
67
|
+
String key = iterator.next();
|
|
68
|
+
Object value = jsonObject.get(key);
|
|
69
|
+
if (value instanceof JSONObject) {
|
|
70
|
+
map.put(key, convertJSONObjectToMap((JSONObject) value));
|
|
71
|
+
} else if (value instanceof JSONArray) {
|
|
72
|
+
map.put(key, convertJSONArrayToArray((JSONArray) value));
|
|
73
|
+
} else if (value instanceof Boolean) {
|
|
74
|
+
map.put(key, (Boolean) value);
|
|
75
|
+
} else if (value instanceof Integer) {
|
|
76
|
+
map.put(key, (Integer) value);
|
|
77
|
+
} else if (value instanceof Double) {
|
|
78
|
+
map.put(key, (Double) value);
|
|
79
|
+
} else if (value instanceof String) {
|
|
80
|
+
map.put(key, (String) value);
|
|
81
|
+
} else {
|
|
82
|
+
map.put(key, value.toString());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} catch (Exception e) {
|
|
86
|
+
Insider.Instance.putException(e);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return map;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public static ArrayList convertJSONArrayToArray(JSONArray jsonArray) throws JSONException {
|
|
93
|
+
ArrayList array = new ArrayList();
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
for (int i = 0; i < jsonArray.length(); i++) {
|
|
97
|
+
Object value = jsonArray.get(i);
|
|
98
|
+
if (value instanceof JSONObject) {
|
|
99
|
+
array.add(convertJSONObjectToMap((JSONObject) value));
|
|
100
|
+
} else if (value instanceof JSONArray) {
|
|
101
|
+
array.add(convertJSONArrayToArray((JSONArray) value));
|
|
102
|
+
} else if (value instanceof Boolean) {
|
|
103
|
+
array.add((Boolean) value);
|
|
104
|
+
} else if (value instanceof Integer) {
|
|
105
|
+
array.add((Integer) value);
|
|
106
|
+
} else if (value instanceof Double) {
|
|
107
|
+
array.add((Double) value);
|
|
108
|
+
} else if (value instanceof String) {
|
|
109
|
+
array.add((String) value);
|
|
110
|
+
} else {
|
|
111
|
+
array.add(value.toString());
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} catch (Exception e) {
|
|
115
|
+
Insider.Instance.putException(e);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return array;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
package com.useinsider.cordova;
|
|
2
|
+
|
|
3
|
+
class Constants {
|
|
4
|
+
private Constants() {
|
|
5
|
+
throw new IllegalStateException("Utility class");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
static final String HANDLE_NOTIFICATION = "handleNotification";
|
|
9
|
+
static final String ERROR = "error";
|
|
10
|
+
static final String DEFAULT_VALUE = "defaultValue";
|
|
11
|
+
static final String VARIABLE_NAME = "variableName";
|
|
12
|
+
static final String KEY = "key";
|
|
13
|
+
static final String VALUE = "value";
|
|
14
|
+
static final String DATA_TYPE = "dataType";
|
|
15
|
+
static final String RECOMMENDATION_ID = "recommendationID";
|
|
16
|
+
static final String LOCALE = "locale";
|
|
17
|
+
static final String RECOMMENDATION_LOG = "[INSIDER][loadRecommendationData]";
|
|
18
|
+
static final String MESSAGE_CENTER_LOG = "[INSIDER][messageCenterData]";
|
|
19
|
+
static final String EXCEPTION = "exception";
|
|
20
|
+
static final String ENDPOINT = "endpoint";
|
|
21
|
+
static final String CURRENCY = "currency";
|
|
22
|
+
static final String START_DATE = "startDate";
|
|
23
|
+
static final String END_DATE = "endDate";
|
|
24
|
+
static final String LIMIT = "limit";
|
|
25
|
+
|
|
26
|
+
static final String PRODUCT_ID = "product_id";
|
|
27
|
+
static final String NAME = "name";
|
|
28
|
+
static final String TAXONOMY = "taxonomy";
|
|
29
|
+
static final String UNIT_PRICE = "unit_price";
|
|
30
|
+
static final String IMAGE_URL = "image_url";
|
|
31
|
+
static final String SALE_PRICE = "sale_price";
|
|
32
|
+
static final String STOCK = "stock";
|
|
33
|
+
static final String COLOR = "color";
|
|
34
|
+
static final String SIZE = "size";
|
|
35
|
+
static final String QUANTITY = "quantity";
|
|
36
|
+
static final String SHIPPING_COST = "shipping_cost";
|
|
37
|
+
static final String VOUCHER_NAME = "voucher_name";
|
|
38
|
+
static final String VOUCHER_DISCOUNT = "voucher_discount";
|
|
39
|
+
static final String PROMOTION_NAME = "promotion_name";
|
|
40
|
+
static final String PROMOTION_DISCOUNT = "promotion_discount";
|
|
41
|
+
}
|