reactnative-plugin-appice 1.6.4 → 1.6.5
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/android/build.gradle +3 -3
- package/android/src/main/AndroidManifest.xml +47 -127
- package/android/src/main/java/com/reactlibrary/AppICEUtils.java +15 -98
- package/android/src/main/java/com/reactlibrary/AppIceReactPluginModule.java +190 -118
- package/android/src/main/java/com/reactlibrary/CampaignCampsReceiver.java +4 -16
- package/android/src/main/java/com/reactlibrary/EnumConstants.java +251 -0
- package/android/src/main/java/com/reactlibrary/NotificationEventService.java +2 -4
- package/index.js +138 -86
- package/ios/AppIceReactPlugin.h +25 -0
- package/ios/AppIceReactPlugin.m +56 -1
- package/ios/AppIceReactPlugin.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +1 -1
- package/ios/AppIceReactPlugin.xcworkspace/xcuserdata/artherajesh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Pods/Pods.xcodeproj/xcuserdata/artherajesh.xcuserdatad/xcschemes/xcschememanagement.plist +1 -1
- package/package.json +1 -1
- package/android/src/main/java/com/reactlibrary/Constants.java +0 -42
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
package com.reactlibrary;
|
|
2
|
+
|
|
3
|
+
//Common place for constant and SDK constants
|
|
4
|
+
public enum EnumConstants {
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// TODO: 02/01/24 once iOS will ready to rename it we will rename the key, because right now key and value are same.
|
|
8
|
+
//=========================
|
|
9
|
+
//USER-PROFILE
|
|
10
|
+
//=========================
|
|
11
|
+
APPICE_USER_NAME("n"),
|
|
12
|
+
APPICE_USER_PHONE("ph"),
|
|
13
|
+
APPICE_USER_EMAIL("em"),
|
|
14
|
+
APPICE_DATE_OF_BIRTH("APPICE_DATE_OF_BIRTH"),
|
|
15
|
+
APPICE_USER_AGE("a"),
|
|
16
|
+
APPICE_USER_EDUCATION("ed"),
|
|
17
|
+
APPICE_USER_GENDER("g"),
|
|
18
|
+
APPICE_USER_IS_EMPLOYED("is_emp"),
|
|
19
|
+
APPICE_USER_EMPLOYMENT_TYPE ("et"),
|
|
20
|
+
APPICE_USER_MARRIED("m"),
|
|
21
|
+
|
|
22
|
+
//===========================
|
|
23
|
+
//PUSH
|
|
24
|
+
//============================
|
|
25
|
+
APPICE_PUSH_NOTIFICATION_CLICKED("AppICEPushNotificationClicked"),
|
|
26
|
+
|
|
27
|
+
//===========================
|
|
28
|
+
//IN-APP
|
|
29
|
+
//============================
|
|
30
|
+
APPICE_INAPP_NOTIFICATION_CLICKED("AppICEInAppClicked"),
|
|
31
|
+
|
|
32
|
+
//============================
|
|
33
|
+
//INBOX
|
|
34
|
+
//=============================
|
|
35
|
+
INBOX_MESSAGE("INBOX_MESSAGE"),
|
|
36
|
+
INBOX_TITLE("INBOX_TITLE"),
|
|
37
|
+
INBOX_MESSAGE_STATUS("INBOX_MESSAGE_STATUS"),
|
|
38
|
+
INBOX_CAMPAIGN_TYPE("INBOX_CAMPAIGN_TYPE"),
|
|
39
|
+
INBOX_MESSAGE_LANGUAGE("INBOX_MESSAGE_LANGUAGE"),
|
|
40
|
+
INBOX_MESSAGE_ID("INBOX_MESSAGE_ID"),
|
|
41
|
+
INBOX_CAMPAIGN_ID("INBOX_CAMPAIGN_ID"),
|
|
42
|
+
INBOX_MESSAGE_CATEGORY("INBOX_MESSAGE_CATEGORY"),
|
|
43
|
+
INBOX_MESSAGE_ICON("INBOX_MESSAGE_ICON"),
|
|
44
|
+
INBOX_CUSTOM_DATA("INBOX_CUSTOM_DATA"),
|
|
45
|
+
|
|
46
|
+
//==================================
|
|
47
|
+
// custom user data
|
|
48
|
+
//==================================
|
|
49
|
+
|
|
50
|
+
FIRST_SEEN("FIRST_SEEN"),
|
|
51
|
+
LAST_SEEN("LAST_SEEN"),
|
|
52
|
+
TOP_N_PRODUCTS_VIEWED("TOP_N_PRODUCTS_VIEWED"),
|
|
53
|
+
N_COMPLAINTS_RAISED("N_COMPLAINTS_RAISED"),
|
|
54
|
+
PREF_LOGIN_DEVICE("PREF_LOGIN_DEVICE"),
|
|
55
|
+
REFERRAL_CAMPAIGN("REFERRAL_CAMPAIGN"),
|
|
56
|
+
DEMOGRAPHIC_INFO("DEMOGRAPHIC_INFO"),
|
|
57
|
+
|
|
58
|
+
//================
|
|
59
|
+
// ECOMMERCE
|
|
60
|
+
//================
|
|
61
|
+
TOTAL_ORDER_VALUE("TOTAL_ORDER_VALUE"),
|
|
62
|
+
ADD_TO_CART_N_DAYS("ADD_TO_CART_N_DAYS"),
|
|
63
|
+
|
|
64
|
+
//====================
|
|
65
|
+
// FinancialServices
|
|
66
|
+
//====================
|
|
67
|
+
FINANCIAL_SERVICES("FINANCIAL_SERVICES"),
|
|
68
|
+
CREDIT_SCORE("CREDIT_SCORE"),
|
|
69
|
+
DEBT_TO_INCOME_RATIO("DEBT_TO_INCOME_RATIO"),
|
|
70
|
+
SAVINGS_BALANCE("SAVINGS_BALANCE"),
|
|
71
|
+
CHECKING_BALANCE("CHECKING_BALANCE"),
|
|
72
|
+
AVERAGE_TRANSACTION_AMOUNT("AVERAGE_TRANSACTION_AMOUNT"),
|
|
73
|
+
FREQUENCY_OF_TRANSACTION("FREQUENCY_OF_TRANSACTION"),
|
|
74
|
+
TYPE_OF_TRANSACTION("TYPE_OF_TRANSACTION");
|
|
75
|
+
|
|
76
|
+
private String constants;
|
|
77
|
+
|
|
78
|
+
EnumConstants(String constants) {
|
|
79
|
+
this.constants = constants;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public String getConstants() {
|
|
83
|
+
return constants;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// TODO: 29/12/23 {
|
|
87
|
+
// replace static value with sdk value
|
|
88
|
+
// }
|
|
89
|
+
public String getValue(){
|
|
90
|
+
switch (constants){
|
|
91
|
+
case "APPICE_USER_NAME":{
|
|
92
|
+
return "n";
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
case "APPICE_USER_PHONE":{
|
|
96
|
+
return "ph";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
case "APPICE_USER_EMAIL":{
|
|
100
|
+
return "em";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
case "APPICE_DATE_OF_BIRTH":{
|
|
104
|
+
return "dob";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
case "APPICE_USER_AGE":{
|
|
108
|
+
return "a";
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
case "APPICE_USER_EDUCATION":{
|
|
112
|
+
return "ed";
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
case "APPICE_USER_GENDER":{
|
|
116
|
+
return "g";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
case "APPICE_USER_IS_EMPLOYED":{
|
|
120
|
+
return "is_emp";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
case "APPICE_USER_EMPLOYMENT_TYPE":{
|
|
124
|
+
return "et";
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
case "APPICE_USER_MARRIED":{
|
|
128
|
+
return "m";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
case "APPICE_PUSH_NOTIFICATION_CLICKED":{
|
|
132
|
+
return "AppICEPushNotificationClicked";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
case "APPICE_INAPP_NOTIFICATION_CLICKED":{
|
|
136
|
+
return "AppICEInAppClicked";
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
case "INBOX_MESSAGE":{
|
|
140
|
+
return "message";
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
case "INBOX_TITLE":{
|
|
144
|
+
return "title";
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
case "INBOX_MESSAGE_STATUS":{
|
|
148
|
+
return "messageStatus";
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
case "INBOX_CAMPAIGN_TYPE":{
|
|
152
|
+
return "campType";
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
case "INBOX_MESSAGE_LANGUAGE":{
|
|
156
|
+
return "messageLanguage";
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
case "INBOX_MESSAGE_ID":{
|
|
160
|
+
return "id";
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
case "INBOX_CAMPAIGN_ID":{
|
|
164
|
+
return "campId";
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
case "INBOX_MESSAGE_CATEGORY":{
|
|
168
|
+
return "category";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
case "INBOX_MESSAGE_ICON":{
|
|
172
|
+
return "icon";
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
case "INBOX_CUSTOM_DATA":{
|
|
176
|
+
return "cdata";
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
case "FIRST_SEEN":{
|
|
180
|
+
return "fsn";
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
case "LAST_SEEN":{
|
|
184
|
+
return "lsn";
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
case "TOP_N_PRODUCTS_VIEWED":{
|
|
188
|
+
return "tn";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
case "N_COMPLAINTS_RAISED":{
|
|
192
|
+
return "nc";
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
case "PREF_LOGIN_DEVICE":{
|
|
196
|
+
return "pl";
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
case "REFERRAL_CAMPAIGN":{
|
|
200
|
+
return "rc";
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
case "DEMOGRAPHIC_INFO":{
|
|
204
|
+
return "customProperties";
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
case "TOTAL_ORDER_VALUE":{
|
|
208
|
+
return "tv";
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
case "ADD_TO_CART_N_DAYS":{
|
|
212
|
+
return "an";
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
case "FINANCIAL_SERVICES":{
|
|
216
|
+
return "fs";
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
case "CREDIT_SCORE":{
|
|
220
|
+
return "cs";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
case "DEBT_TO_INCOME_RATIO":{
|
|
224
|
+
return "di";
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
case "SAVINGS_BALANCE":{
|
|
228
|
+
return "sb";
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
case "CHECKING_BALANCE":{
|
|
232
|
+
return "cb";
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
case "AVERAGE_TRANSACTION_AMOUNT":{
|
|
236
|
+
return "at";
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
case "FREQUENCY_OF_TRANSACTION":{
|
|
240
|
+
return "ft";
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
case "TYPE_OF_TRANSACTION":{
|
|
244
|
+
return "tt";
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
default:
|
|
248
|
+
return "";
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
@@ -15,7 +15,6 @@ import java.util.concurrent.atomic.AtomicReference;
|
|
|
15
15
|
|
|
16
16
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
|
17
17
|
public class NotificationEventService extends JobService {
|
|
18
|
-
|
|
19
18
|
@Override
|
|
20
19
|
public boolean onStartJob(final JobParameters params) {
|
|
21
20
|
if (params != null) {
|
|
@@ -27,7 +26,7 @@ public class NotificationEventService extends JobService {
|
|
|
27
26
|
@Override
|
|
28
27
|
public void run() {
|
|
29
28
|
CampaignCampsReceiver rc = new CampaignCampsReceiver();
|
|
30
|
-
|
|
29
|
+
AppICEUtils.printLog("NotificationEventService"," data "+bundle1);
|
|
31
30
|
rc.sendCallback(bundle1, getApplicationContext());
|
|
32
31
|
jobFinished(params,false);
|
|
33
32
|
}
|
|
@@ -58,5 +57,4 @@ public class NotificationEventService extends JobService {
|
|
|
58
57
|
public boolean onStopJob(JobParameters params) {
|
|
59
58
|
return false;
|
|
60
59
|
}
|
|
61
|
-
}
|
|
62
|
-
|
|
60
|
+
}
|
package/index.js
CHANGED
|
@@ -3,22 +3,42 @@ import { Platform, Component } from 'react-native';
|
|
|
3
3
|
|
|
4
4
|
const AppIceReactPlugin = NativeModules.AppIceReactPlugin;
|
|
5
5
|
var eventEmitter;
|
|
6
|
-
if(Platform.OS === 'ios')
|
|
7
|
-
{
|
|
6
|
+
if (Platform.OS === 'ios') {
|
|
8
7
|
eventEmitter = NativeModules.AppICEReactEvent ? new NativeEventEmitter(NativeModules.AppICEReactEvent) : DeviceEventEmitter;
|
|
9
8
|
}
|
|
10
|
-
else
|
|
11
|
-
|
|
12
|
-
eventEmitter = new NativeEventEmitter(NativeModules.AppIceReactPlugin);
|
|
9
|
+
else {
|
|
10
|
+
eventEmitter = new NativeEventEmitter(NativeModules.AppIceReactPlugin);
|
|
13
11
|
}
|
|
14
12
|
var AppICEReact = {
|
|
15
|
-
|
|
13
|
+
|
|
14
|
+
validateIntegration: AppIceReactPlugin.validateIntegration,
|
|
15
|
+
|
|
16
|
+
//========================
|
|
17
|
+
// PUSH
|
|
18
|
+
//========================
|
|
16
19
|
AppICEPushNotificationClicked: AppIceReactPlugin.AppICEPushNotificationClicked,
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
//==========================
|
|
22
|
+
// IN-APP
|
|
23
|
+
//==========================
|
|
19
24
|
AppICEInAppClicked: AppIceReactPlugin.AppICEInAppClicked,
|
|
20
25
|
|
|
21
|
-
|
|
26
|
+
//========================
|
|
27
|
+
// APP-INBOX
|
|
28
|
+
//========================
|
|
29
|
+
INBOX_MESSAGE: AppIceReactPlugin.INBOX_MESSAGE,
|
|
30
|
+
INBOX_TITLE: AppIceReactPlugin.INBOX_TITLE,
|
|
31
|
+
INBOX_MESSAGE_STATUS: AppIceReactPlugin.INBOX_MESSAGE_STATUS,
|
|
32
|
+
INBOX_CAMPAIGN_TYPE: AppIceReactPlugin.INBOX_CAMPAIGN_TYPE,
|
|
33
|
+
INBOX_MESSAGE_LANGUAGE: AppIceReactPlugin.INBOX_MESSAGE_LANGUAGE,
|
|
34
|
+
INBOX_MESSAGE_ID: AppIceReactPlugin.INBOX_MESSAGE_ID,
|
|
35
|
+
INBOX_CAMPAIGN_ID: AppIceReactPlugin.INBOX_CAMPAIGN_ID,
|
|
36
|
+
INBOX_MESSAGE_ICON: AppIceReactPlugin.INBOX_MESSAGE_ICON,
|
|
37
|
+
INBOX_CUSTOM_DATA: AppIceReactPlugin.INBOX_CUSTOM_DATA,
|
|
38
|
+
|
|
39
|
+
//=======================
|
|
40
|
+
// USER-PROFILE SETTING
|
|
41
|
+
//=======================
|
|
22
42
|
name: AppIceReactPlugin.n,
|
|
23
43
|
email: AppIceReactPlugin.em,
|
|
24
44
|
phone: AppIceReactPlugin.ph,
|
|
@@ -28,26 +48,43 @@ var AppICEReact = {
|
|
|
28
48
|
employmentType: AppIceReactPlugin.et,
|
|
29
49
|
married: AppIceReactPlugin.m,
|
|
30
50
|
isEmployed: AppIceReactPlugin.is_emp,
|
|
31
|
-
validateIntegration: AppIceReactPlugin.validateIntegration,
|
|
32
|
-
|
|
33
|
-
// App Inbox
|
|
34
|
-
INBOX_MESSAGE: AppIceReactPlugin.INBOX_MESSAGE,
|
|
35
|
-
INBOX_TITLE : AppIceReactPlugin.INBOX_TITLE,
|
|
36
|
-
INBOX_MESSAGE_STATUS: AppIceReactPlugin.INBOX_MESSAGE_STATUS,
|
|
37
|
-
INBOX_CAMPAIGN_TYPE :AppIceReactPlugin.INBOX_CAMPAIGN_TYPE,
|
|
38
|
-
INBOX_MESSAGE_LANGUAGE: AppIceReactPlugin.INBOX_MESSAGE_LANGUAGE,
|
|
39
|
-
INBOX_MESSAGE_ID : AppIceReactPlugin.INBOX_MESSAGE_ID,
|
|
40
|
-
INBOX_CAMPAIGN_ID : AppIceReactPlugin.INBOX_CAMPAIGN_ID,
|
|
41
|
-
INBOX_MESSAGE_ICON : AppIceReactPlugin.INBOX_MESSAGE_ICON,
|
|
42
|
-
INBOX_CUSTOM_DATA: AppIceReactPlugin.INBOX_CUSTOM_DATA,
|
|
43
51
|
|
|
44
52
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
TOP_N_PRODUCTS_VIEWED: AppIceReactPlugin.TOP_N_PRODUCTS_VIEWED,
|
|
54
|
+
N_COMPLAINTS_RAISED: AppIceReactPlugin.N_COMPLAINTS_RAISED,
|
|
55
|
+
PREF_LOGIN_DEVICE: AppIceReactPlugin.PREF_LOGIN_DEVICE,
|
|
56
|
+
REFERRAL_CAMPAIGN: AppIceReactPlugin.REFERRAL_CAMPAIGN,
|
|
57
|
+
FIRST_SEEN: AppIceReactPlugin.FIRST_SEEN,
|
|
58
|
+
LAST_SEEN: AppIceReactPlugin.LAST_SEEN,
|
|
59
|
+
DEMOGRAPHIC_INFO: AppIceReactPlugin.DEMOGRAPHIC_INFO,
|
|
60
|
+
|
|
61
|
+
//================
|
|
62
|
+
// ECOMMERCE
|
|
63
|
+
//================
|
|
64
|
+
TOTAL_ORDER_VALUE: AppIceReactPlugin.TOTAL_ORDER_VALUE,
|
|
65
|
+
ADD_TO_CART_N_DAYS: AppIceReactPlugin.ADD_TO_CART_N_DAYS,
|
|
66
|
+
|
|
67
|
+
//====================
|
|
68
|
+
// FinancialServices
|
|
69
|
+
//====================
|
|
70
|
+
FINANCIAL_SERVICES: AppIceReactPlugin.FINANCIAL_SERVICES,
|
|
71
|
+
CREDIT_SCORE: AppIceReactPlugin.CREDIT_SCORE,
|
|
72
|
+
DEBT_TO_INCOME_RATIO: AppIceReactPlugin.DEBT_TO_INCOME_RATIO,
|
|
73
|
+
SAVINGS_BALANCE: AppIceReactPlugin.SAVINGS_BALANCE,
|
|
74
|
+
CHECKING_BALANCE: AppIceReactPlugin.CHECKING_BALANCE,
|
|
75
|
+
AVERAGE_TRANSACTION_AMOUNT: AppIceReactPlugin.AVERAGE_TRANSACTION_AMOUNT,
|
|
76
|
+
FREQUENCY_OF_TRANSACTION: AppIceReactPlugin.FREQUENCY_OF_TRANSACTION,
|
|
77
|
+
TYPE_OF_TRANSACTION: AppIceReactPlugin.TYPE_OF_TRANSACTION,
|
|
78
|
+
|
|
79
|
+
//======================
|
|
80
|
+
// LISTENER
|
|
81
|
+
//======================
|
|
82
|
+
/**
|
|
83
|
+
* add all of the registered listeners for given eventName.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} eventName - name of the event whose registered listeners to remove
|
|
86
|
+
* @param {callback} handler - handler for events
|
|
87
|
+
*/
|
|
51
88
|
addListener: function (eventName, handler) {
|
|
52
89
|
if (eventEmitter) {
|
|
53
90
|
eventEmitter.addListener(eventName, handler);
|
|
@@ -65,13 +102,17 @@ var AppICEReact = {
|
|
|
65
102
|
}
|
|
66
103
|
},
|
|
67
104
|
|
|
105
|
+
|
|
106
|
+
//=========================
|
|
107
|
+
// SDK CONFIG
|
|
108
|
+
//========================
|
|
109
|
+
|
|
68
110
|
/**
|
|
69
111
|
* call this function before clearing old data from db/keychain
|
|
70
112
|
*/
|
|
71
|
-
preInitialise: function(){
|
|
72
|
-
this.getDeviceId((
|
|
73
|
-
|
|
74
|
-
if(res){
|
|
113
|
+
preInitialise: function () {
|
|
114
|
+
this.getDeviceId((res) => {
|
|
115
|
+
if (res) {
|
|
75
116
|
this.setInternalId(res);
|
|
76
117
|
}
|
|
77
118
|
});
|
|
@@ -89,17 +130,26 @@ var AppICEReact = {
|
|
|
89
130
|
* startContext executes after getDeviceId callback
|
|
90
131
|
* if res exist assign the value of res else assign deviceID
|
|
91
132
|
*/
|
|
92
|
-
startContext: function (appID, appKey, apiKey, deviceID, region, baseUrl, certs){
|
|
93
|
-
this.getDeviceId((
|
|
94
|
-
|
|
95
|
-
if(res){
|
|
133
|
+
startContext: function (appID, appKey, apiKey, deviceID, region, baseUrl, certs) {
|
|
134
|
+
this.getDeviceId((res) => {
|
|
135
|
+
if (res) {
|
|
96
136
|
AppIceReactPlugin.startContext(appID, appKey, apiKey, res, region, baseUrl, certs)
|
|
97
|
-
}else{
|
|
137
|
+
} else {
|
|
98
138
|
AppIceReactPlugin.startContext(appID, appKey, apiKey, deviceID, region, baseUrl, certs)
|
|
99
139
|
}
|
|
100
140
|
});
|
|
101
141
|
},
|
|
102
142
|
|
|
143
|
+
/**
|
|
144
|
+
* call this function to register the lifeCycle state of the app
|
|
145
|
+
*/
|
|
146
|
+
registerLifeCycle: function () {
|
|
147
|
+
AppIceReactPlugin.registerLifeCycle();
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
//===========================
|
|
151
|
+
// EVENTS AND VARIABLES
|
|
152
|
+
//===========================
|
|
103
153
|
/**
|
|
104
154
|
* Record an event with optional event properties
|
|
105
155
|
* @param {string} eventName - the name of the event
|
|
@@ -111,23 +161,39 @@ var AppICEReact = {
|
|
|
111
161
|
},
|
|
112
162
|
|
|
113
163
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
164
|
+
* to store custom varibles like fcm token..
|
|
165
|
+
* @param {string} eventName - the name of the event
|
|
166
|
+
* @param {string} props - the name of the event
|
|
116
167
|
*/
|
|
117
|
-
|
|
118
|
-
AppIceReactPlugin.
|
|
168
|
+
setCustomVariable: function (eventName, props) {
|
|
169
|
+
AppIceReactPlugin.setCustomVariable(eventName, props);
|
|
119
170
|
},
|
|
120
171
|
|
|
172
|
+
|
|
173
|
+
//===========================
|
|
174
|
+
// CAMPAIGN SETTING
|
|
175
|
+
//===========================
|
|
121
176
|
/**
|
|
122
|
-
*
|
|
177
|
+
* Record an click event
|
|
123
178
|
* @param {string} eventName - the name of the event
|
|
124
|
-
* @param {string} props - the name of the event
|
|
125
179
|
*/
|
|
126
|
-
|
|
127
|
-
AppIceReactPlugin.
|
|
180
|
+
pushNotificationClicked: function (payload) {
|
|
181
|
+
AppIceReactPlugin.pushNotificationClicked(payload);
|
|
128
182
|
},
|
|
129
183
|
|
|
184
|
+
getCustomDataFromPayload: function (object) {
|
|
185
|
+
let userObj = JSON.parse(object, (key, value) => {
|
|
186
|
+
return value;
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
let map = new Map(Object.entries(userObj.cdata));
|
|
190
|
+
|
|
191
|
+
return map;
|
|
192
|
+
},
|
|
130
193
|
|
|
194
|
+
//=======================
|
|
195
|
+
// USER-PROFILE SETTING
|
|
196
|
+
//=======================
|
|
131
197
|
/**
|
|
132
198
|
* Set key-value properties on a user profile
|
|
133
199
|
* @param {object} profile - key-value profile properties. keys are strings and values can be string, number or boolean.
|
|
@@ -136,6 +202,14 @@ var AppICEReact = {
|
|
|
136
202
|
AppIceReactPlugin.setUser(profile);
|
|
137
203
|
},
|
|
138
204
|
|
|
205
|
+
/**
|
|
206
|
+
* get the properties of a user profile
|
|
207
|
+
* return JSONObject
|
|
208
|
+
*/
|
|
209
|
+
getUser: function (callback) {
|
|
210
|
+
callWithCallback('getUser', null, callback);
|
|
211
|
+
},
|
|
212
|
+
|
|
139
213
|
//===============================================
|
|
140
214
|
// User id setting
|
|
141
215
|
//===============================================
|
|
@@ -152,43 +226,19 @@ var AppICEReact = {
|
|
|
152
226
|
* Getuser id
|
|
153
227
|
* @param {object} values - array of userids
|
|
154
228
|
*/
|
|
155
|
-
getUserId: function(callback){
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
getCustomDataFromPayload: function (object) {
|
|
160
|
-
let userObj = JSON.parse(object, (key, value) => {
|
|
161
|
-
return value;
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
let map = new Map(Object.entries(userObj.cdata));
|
|
165
|
-
|
|
166
|
-
return map;
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* call this function before clearing old data from db/keychain
|
|
171
|
-
*/
|
|
172
|
-
preInitialise: function(){
|
|
173
|
-
|
|
174
|
-
this.getDeviceId(( res ) =>
|
|
175
|
-
{
|
|
176
|
-
if(res){
|
|
177
|
-
this.setInternalId(res);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
229
|
+
getUserId: function (callback) {
|
|
230
|
+
callWithCallback('getUserId', null, callback);
|
|
180
231
|
},
|
|
181
232
|
|
|
182
233
|
//===============================================
|
|
183
234
|
// Device id setting
|
|
184
235
|
//===============================================
|
|
185
236
|
|
|
186
|
-
getDeviceId: function(callback){
|
|
187
|
-
|
|
188
|
-
|
|
237
|
+
getDeviceId: function (callback) {
|
|
238
|
+
callWithCallback('getDeviceId', null, callback)
|
|
189
239
|
},
|
|
190
240
|
|
|
191
|
-
setInternalId: function (deviceId){
|
|
241
|
+
setInternalId: function (deviceId) {
|
|
192
242
|
AppIceReactPlugin.setInternalId(deviceId);
|
|
193
243
|
},
|
|
194
244
|
|
|
@@ -208,7 +258,7 @@ var AppICEReact = {
|
|
|
208
258
|
* @param userIds the same way we are passing the value in setUserId same value we need here. ie. [ "useridA" ]
|
|
209
259
|
* @callback will have the string json array
|
|
210
260
|
*/
|
|
211
|
-
|
|
261
|
+
getInboxMessages: function (type, userIds, callback) {
|
|
212
262
|
callWithCallback('getInboxMessages', [type, userIds], callback);
|
|
213
263
|
},
|
|
214
264
|
|
|
@@ -225,7 +275,7 @@ var AppICEReact = {
|
|
|
225
275
|
* @param userIds the same way we are passing the value in setUserId same value we need here. ie. [ "useridA" ]
|
|
226
276
|
* @callback will have the integer
|
|
227
277
|
*/
|
|
228
|
-
getMessageCount: function(type, userIds, callback){
|
|
278
|
+
getMessageCount: function (type, userIds, callback) {
|
|
229
279
|
callWithCallback('getMessageCount', [type, userIds], callback);
|
|
230
280
|
},
|
|
231
281
|
|
|
@@ -236,30 +286,32 @@ var AppICEReact = {
|
|
|
236
286
|
* @param userId - single userid in string ie. "useridA"
|
|
237
287
|
* @callback will have the json object
|
|
238
288
|
*/
|
|
239
|
-
getInboxMessageForId: function(messageId, userId, callback){
|
|
289
|
+
getInboxMessageForId: function (messageId, userId, callback) {
|
|
240
290
|
callWithCallback('getMessageCount', [messageId, userId], callback);
|
|
241
291
|
},
|
|
242
292
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
updateInboxMessage: function(messageId, type, userId, callback){
|
|
293
|
+
/**
|
|
294
|
+
* update message status ex. UNREAD to READ.
|
|
295
|
+
*
|
|
296
|
+
* @param messageId - message id of the notification
|
|
297
|
+
* @param type - integer value for status
|
|
298
|
+
* @param userId - single userid in string
|
|
299
|
+
* @callback will have the boolean
|
|
300
|
+
*/
|
|
301
|
+
updateInboxMessage: function (messageId, type, userId, callback) {
|
|
252
302
|
callWithCallback('updateInboxMessage', [messageId, type, userId], callback);
|
|
253
303
|
},
|
|
254
304
|
|
|
255
|
-
synchronizeInbox: function(
|
|
305
|
+
synchronizeInbox: function (timeout, callback) {
|
|
256
306
|
callWithCallback('synchronizeInbox', [timeout], callback)
|
|
257
307
|
}
|
|
258
308
|
|
|
259
309
|
//========================================
|
|
260
310
|
|
|
261
311
|
};
|
|
262
|
-
|
|
312
|
+
//================================
|
|
313
|
+
// INTERNAL COMMON APIS
|
|
314
|
+
//=================================
|
|
263
315
|
// internal function for callback
|
|
264
316
|
function callWithCallback(method, args, callback) {
|
|
265
317
|
if (typeof callback === 'undefined' || callback == null || typeof callback !== 'function') {
|
package/ios/AppIceReactPlugin.h
CHANGED
|
@@ -13,6 +13,9 @@ static NSString *const ket = @"et";
|
|
|
13
13
|
static NSString *const km = @"m";
|
|
14
14
|
static NSString *const kis_emp = @"is_emp";
|
|
15
15
|
static NSString *const kappICEToken = @"appICEToken";
|
|
16
|
+
static NSString *const kdob = @"d";
|
|
17
|
+
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
static NSString *const INBOX_MESSAGE = @"INBOX_MESSAGE";
|
|
18
21
|
static NSString *const INBOX_TITLE = @"INBOX_TITLE";
|
|
@@ -25,6 +28,28 @@ static NSString *const INBOX_MESSAGE_CATEGORY = @"INBOX_MESSAGE_CATEGORY";
|
|
|
25
28
|
static NSString *const INBOX_MESSAGE_ICON = @"INBOX_MESSAGE_ICON";
|
|
26
29
|
static NSString *const INBOX_CUSTOM_DATA = @"INBOX_CUSTOM_DATA";
|
|
27
30
|
|
|
31
|
+
// Custom data
|
|
32
|
+
static NSString *const DEMOGRAPHIC_INFO = @"DEMOGRAPHIC_INFO";
|
|
33
|
+
static NSString *TOP_N_PRODUCTS_VIEWED;
|
|
34
|
+
static NSString *N_COMPLAINTS_RAISED;
|
|
35
|
+
static NSString *PREF_LOGIN_DEVICE;
|
|
36
|
+
static NSString *REFERRAL_CAMPAIGN;
|
|
37
|
+
static NSString *FIRST_SEEN;
|
|
38
|
+
static NSString *LAST_SEEN;
|
|
39
|
+
|
|
40
|
+
// Ecommerce
|
|
41
|
+
static NSString *TOTAL_ORDER_VALUE;
|
|
42
|
+
static NSString *ADD_TO_CART_N_DAYS;
|
|
43
|
+
|
|
44
|
+
// Financial Services
|
|
45
|
+
static NSString *CREDIT_SCORE;
|
|
46
|
+
static NSString *DEBT_TO_INCOME_RATIO;
|
|
47
|
+
static NSString *SAVINGS_BALANCE;
|
|
48
|
+
static NSString *CHECKING_BALANCE;
|
|
49
|
+
static NSString *AVERAGE_TRANSACTION_AMOUNT;
|
|
50
|
+
static NSString *FREQUENCY_OF_TRANSACTION;
|
|
51
|
+
static NSString *TYPE_OF_TRANSACTION;
|
|
52
|
+
|
|
28
53
|
@interface AppIceReactPlugin : NSObject <RCTBridgeModule,UNUserNotificationCenterDelegate>
|
|
29
54
|
+(void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken;
|
|
30
55
|
+ (void)pushNotificationClicked:(NSDictionary *)userInfo;
|