cordova-plugin-insider 2.3.0 → 2.4.1
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/babel.config.json +9 -0
- package/package.json +14 -3
- package/plugin.xml +2 -2
- package/src/android/Constants.java +9 -0
- package/src/android/InsiderPlugin.java +51 -16
- package/src/android/build-extras.gradle +6 -5
- package/src/ios/InsiderPlugin.m +5 -1
- package/www/CallbackType.js +9 -7
- package/www/Constants.js +112 -101
- package/www/ContentOptimizerDataType.js +4 -2
- package/www/Event.js +140 -103
- package/www/Gender.js +5 -3
- package/www/Identifier.js +84 -66
- package/www/InsiderPlugin.js +739 -679
- package/www/Product.js +429 -236
- package/www/User.js +410 -324
- package/www/Utils.js +18 -16
package/www/User.js
CHANGED
|
@@ -1,375 +1,461 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
6
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
8
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
9
|
+
var Utils = require("./Utils");
|
|
10
|
+
var InsiderConstants = require("./Constants");
|
|
11
|
+
var User = /*#__PURE__*/function () {
|
|
12
|
+
function User() {
|
|
13
|
+
_classCallCheck(this, User);
|
|
14
|
+
}
|
|
15
|
+
return _createClass(User, [{
|
|
16
|
+
key: "setGender",
|
|
17
|
+
value: function setGender(gender) {
|
|
18
|
+
if (Utils.checkParameters([{
|
|
19
|
+
type: 'number',
|
|
20
|
+
value: gender
|
|
21
|
+
}])) {
|
|
22
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setGender');
|
|
21
23
|
return this;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_GENDER, [gender]);
|
|
27
|
+
} catch (error) {
|
|
28
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
29
|
+
}
|
|
30
|
+
return this;
|
|
22
31
|
}
|
|
23
|
-
|
|
24
|
-
setBirthday
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_BIRTDAY, [birthday.toISOString()]);
|
|
32
|
-
} catch (error) {
|
|
33
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
34
|
-
}
|
|
32
|
+
}, {
|
|
33
|
+
key: "setBirthday",
|
|
34
|
+
value: function setBirthday(birthday) {
|
|
35
|
+
if (Utils.checkParameters([{
|
|
36
|
+
type: 'string',
|
|
37
|
+
value: birthday
|
|
38
|
+
}])) {
|
|
39
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setBirthday');
|
|
35
40
|
return this;
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_BIRTDAY, [birthday.toISOString()]);
|
|
44
|
+
} catch (error) {
|
|
45
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
46
|
+
}
|
|
47
|
+
return this;
|
|
36
48
|
}
|
|
37
|
-
|
|
38
|
-
setName
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_NAME, [name]);
|
|
46
|
-
} catch (error) {
|
|
47
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
48
|
-
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "setName",
|
|
51
|
+
value: function setName(name) {
|
|
52
|
+
if (Utils.checkParameters([{
|
|
53
|
+
type: 'string',
|
|
54
|
+
value: name
|
|
55
|
+
}])) {
|
|
56
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setName');
|
|
49
57
|
return this;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_NAME, [name]);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
63
|
+
}
|
|
64
|
+
return this;
|
|
50
65
|
}
|
|
51
|
-
|
|
52
|
-
setSurname
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_SURNAME, [surname]);
|
|
60
|
-
} catch (error) {
|
|
61
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
62
|
-
}
|
|
63
|
-
|
|
66
|
+
}, {
|
|
67
|
+
key: "setSurname",
|
|
68
|
+
value: function setSurname(surname) {
|
|
69
|
+
if (Utils.checkParameters([{
|
|
70
|
+
type: 'string',
|
|
71
|
+
value: surname
|
|
72
|
+
}])) {
|
|
73
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setSurname');
|
|
64
74
|
return this;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_SURNAME, [surname]);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
80
|
+
}
|
|
81
|
+
return this;
|
|
65
82
|
}
|
|
66
|
-
|
|
67
|
-
setAge
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_AGE, [age]);
|
|
75
|
-
} catch (error) {
|
|
76
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
77
|
-
}
|
|
78
|
-
|
|
83
|
+
}, {
|
|
84
|
+
key: "setAge",
|
|
85
|
+
value: function setAge(age) {
|
|
86
|
+
if (Utils.checkParameters([{
|
|
87
|
+
type: 'string',
|
|
88
|
+
value: age
|
|
89
|
+
}])) {
|
|
90
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setAge');
|
|
79
91
|
return this;
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_AGE, [age]);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
97
|
+
}
|
|
98
|
+
return this;
|
|
80
99
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
setEmail(email) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_EMAIL, [email]);
|
|
91
|
-
} catch (error) {
|
|
92
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
93
|
-
}
|
|
94
|
-
|
|
100
|
+
}, {
|
|
101
|
+
key: "setEmail",
|
|
102
|
+
value: function setEmail(email) {
|
|
103
|
+
if (Utils.checkParameters([{
|
|
104
|
+
type: 'string',
|
|
105
|
+
value: email
|
|
106
|
+
}])) {
|
|
107
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setEmail');
|
|
95
108
|
return this;
|
|
109
|
+
}
|
|
110
|
+
try {
|
|
111
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_EMAIL, [email]);
|
|
112
|
+
} catch (error) {
|
|
113
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
114
|
+
}
|
|
115
|
+
return this;
|
|
96
116
|
}
|
|
97
|
-
|
|
98
|
-
setPhoneNumber
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_PHONE_NUMBER, [phone]);
|
|
106
|
-
} catch (error) {
|
|
107
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
108
|
-
}
|
|
109
|
-
|
|
117
|
+
}, {
|
|
118
|
+
key: "setPhoneNumber",
|
|
119
|
+
value: function setPhoneNumber(phone) {
|
|
120
|
+
if (Utils.checkParameters([{
|
|
121
|
+
type: 'string',
|
|
122
|
+
value: phone
|
|
123
|
+
}])) {
|
|
124
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setPhoneNumber');
|
|
110
125
|
return this;
|
|
126
|
+
}
|
|
127
|
+
try {
|
|
128
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_PHONE_NUMBER, [phone]);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
131
|
+
}
|
|
132
|
+
return this;
|
|
111
133
|
}
|
|
112
|
-
|
|
113
|
-
setLanguage
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_LANGUAGE, [language]);
|
|
121
|
-
} catch (error) {
|
|
122
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
123
|
-
}
|
|
124
|
-
|
|
134
|
+
}, {
|
|
135
|
+
key: "setLanguage",
|
|
136
|
+
value: function setLanguage(language) {
|
|
137
|
+
if (Utils.checkParameters([{
|
|
138
|
+
type: 'string',
|
|
139
|
+
value: language
|
|
140
|
+
}])) {
|
|
141
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setLanguage');
|
|
125
142
|
return this;
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_LANGUAGE, [language]);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
148
|
+
}
|
|
149
|
+
return this;
|
|
126
150
|
}
|
|
127
|
-
|
|
128
|
-
setLocale
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_LOCALE, [locale]);
|
|
136
|
-
} catch (error) {
|
|
137
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
138
|
-
}
|
|
139
|
-
|
|
151
|
+
}, {
|
|
152
|
+
key: "setLocale",
|
|
153
|
+
value: function setLocale(locale) {
|
|
154
|
+
if (Utils.checkParameters([{
|
|
155
|
+
type: 'string',
|
|
156
|
+
value: locale
|
|
157
|
+
}])) {
|
|
158
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setLocale');
|
|
140
159
|
return this;
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_LOCALE, [locale]);
|
|
163
|
+
} catch (error) {
|
|
164
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
165
|
+
}
|
|
166
|
+
return this;
|
|
141
167
|
}
|
|
142
|
-
|
|
143
|
-
setFacebookID
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_FACEBOOK_ID, [facebookID]);
|
|
151
|
-
} catch (error) {
|
|
152
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
153
|
-
}
|
|
154
|
-
|
|
168
|
+
}, {
|
|
169
|
+
key: "setFacebookID",
|
|
170
|
+
value: function setFacebookID(facebookID) {
|
|
171
|
+
if (Utils.checkParameters([{
|
|
172
|
+
type: 'string',
|
|
173
|
+
value: facebookID
|
|
174
|
+
}])) {
|
|
175
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setFacebookID');
|
|
155
176
|
return this;
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_FACEBOOK_ID, [facebookID]);
|
|
180
|
+
} catch (error) {
|
|
181
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
182
|
+
}
|
|
183
|
+
return this;
|
|
156
184
|
}
|
|
157
|
-
|
|
158
|
-
setTwitterID
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_TWITTER_ID, [twitterID]);
|
|
166
|
-
} catch (error) {
|
|
167
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
168
|
-
}
|
|
169
|
-
|
|
185
|
+
}, {
|
|
186
|
+
key: "setTwitterID",
|
|
187
|
+
value: function setTwitterID(twitterID) {
|
|
188
|
+
if (Utils.checkParameters([{
|
|
189
|
+
type: 'string',
|
|
190
|
+
value: twitterID
|
|
191
|
+
}])) {
|
|
192
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setTwitterID');
|
|
170
193
|
return this;
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_TWITTER_ID, [twitterID]);
|
|
197
|
+
} catch (error) {
|
|
198
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
199
|
+
}
|
|
200
|
+
return this;
|
|
171
201
|
}
|
|
172
|
-
|
|
173
|
-
setEmailOptin
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_EMAIL_OPTIN, [emailOptIn]);
|
|
181
|
-
} catch (error) {
|
|
182
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
183
|
-
}
|
|
184
|
-
|
|
202
|
+
}, {
|
|
203
|
+
key: "setEmailOptin",
|
|
204
|
+
value: function setEmailOptin(emailOptIn) {
|
|
205
|
+
if (Utils.checkParameters([{
|
|
206
|
+
type: 'boolean',
|
|
207
|
+
value: emailOptIn
|
|
208
|
+
}])) {
|
|
209
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setEmailOptin');
|
|
185
210
|
return this;
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_EMAIL_OPTIN, [emailOptIn]);
|
|
214
|
+
} catch (error) {
|
|
215
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
216
|
+
}
|
|
217
|
+
return this;
|
|
186
218
|
}
|
|
187
|
-
|
|
188
|
-
setSMSOptin
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_SMS_OPTIN, [smsOptIn]);
|
|
196
|
-
} catch (error) {
|
|
197
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
198
|
-
}
|
|
219
|
+
}, {
|
|
220
|
+
key: "setSMSOptin",
|
|
221
|
+
value: function setSMSOptin(smsOptIn) {
|
|
222
|
+
if (Utils.checkParameters([{
|
|
223
|
+
type: 'boolean',
|
|
224
|
+
value: smsOptIn
|
|
225
|
+
}])) {
|
|
226
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setSMSOptin');
|
|
199
227
|
return this;
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_SMS_OPTIN, [smsOptIn]);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
233
|
+
}
|
|
234
|
+
return this;
|
|
200
235
|
}
|
|
201
|
-
|
|
202
|
-
setPushOptin
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_PUSH_OPTIN, [pushOptIn]);
|
|
210
|
-
} catch (error) {
|
|
211
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
212
|
-
}
|
|
213
|
-
|
|
236
|
+
}, {
|
|
237
|
+
key: "setPushOptin",
|
|
238
|
+
value: function setPushOptin(pushOptIn) {
|
|
239
|
+
if (Utils.checkParameters([{
|
|
240
|
+
type: 'boolean',
|
|
241
|
+
value: pushOptIn
|
|
242
|
+
}])) {
|
|
243
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setPushOptin');
|
|
214
244
|
return this;
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_PUSH_OPTIN, [pushOptIn]);
|
|
248
|
+
} catch (error) {
|
|
249
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
250
|
+
}
|
|
251
|
+
return this;
|
|
215
252
|
}
|
|
216
|
-
|
|
217
|
-
setLocationOptin
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_LOCATION_OPTIN, [locationOptIn]);
|
|
225
|
-
} catch (error) {
|
|
226
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
227
|
-
}
|
|
228
|
-
|
|
253
|
+
}, {
|
|
254
|
+
key: "setLocationOptin",
|
|
255
|
+
value: function setLocationOptin(locationOptIn) {
|
|
256
|
+
if (Utils.checkParameters([{
|
|
257
|
+
type: 'boolean',
|
|
258
|
+
value: locationOptIn
|
|
259
|
+
}])) {
|
|
260
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setLocationOptin');
|
|
229
261
|
return this;
|
|
262
|
+
}
|
|
263
|
+
try {
|
|
264
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_LOCATION_OPTIN, [locationOptIn]);
|
|
265
|
+
} catch (error) {
|
|
266
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
267
|
+
}
|
|
268
|
+
return this;
|
|
230
269
|
}
|
|
231
|
-
|
|
232
|
-
setWhatsappOptin
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_WHATSAPP_OPTIN, [whatsappOptin]);
|
|
240
|
-
} catch (error) {
|
|
241
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
242
|
-
}
|
|
243
|
-
|
|
270
|
+
}, {
|
|
271
|
+
key: "setWhatsappOptin",
|
|
272
|
+
value: function setWhatsappOptin(whatsappOptin) {
|
|
273
|
+
if (Utils.checkParameters([{
|
|
274
|
+
type: 'boolean',
|
|
275
|
+
value: whatsappOptin
|
|
276
|
+
}])) {
|
|
277
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setWhatsappOptin');
|
|
244
278
|
return this;
|
|
279
|
+
}
|
|
280
|
+
try {
|
|
281
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_WHATSAPP_OPTIN, [whatsappOptin]);
|
|
282
|
+
} catch (error) {
|
|
283
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
284
|
+
}
|
|
285
|
+
return this;
|
|
245
286
|
}
|
|
246
|
-
|
|
247
|
-
login
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
287
|
+
}, {
|
|
288
|
+
key: "login",
|
|
289
|
+
value: function login(identifiers, insiderIDResult) {
|
|
290
|
+
try {
|
|
291
|
+
if (!Utils.checkParameters([{
|
|
292
|
+
type: 'function',
|
|
293
|
+
value: insiderIDResult
|
|
294
|
+
}, {
|
|
295
|
+
type: 'object',
|
|
296
|
+
value: identifiers
|
|
297
|
+
}])) {
|
|
298
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.LOGIN, [identifiers, insiderIDResult]).then(function (id) {
|
|
299
|
+
return insiderIDResult(id);
|
|
300
|
+
});
|
|
301
|
+
} else if (!Utils.checkParameters([{
|
|
302
|
+
type: 'object',
|
|
303
|
+
value: identifiers
|
|
304
|
+
}])) {
|
|
305
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.LOGIN, [identifiers]);
|
|
306
|
+
} else {
|
|
307
|
+
Utils.showParameterWarningLog(this.constructor.name + '-login');
|
|
308
|
+
}
|
|
309
|
+
} catch (error) {
|
|
310
|
+
Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
311
|
+
}
|
|
259
312
|
}
|
|
260
|
-
|
|
261
|
-
logout
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
313
|
+
}, {
|
|
314
|
+
key: "logout",
|
|
315
|
+
value: function logout() {
|
|
316
|
+
try {
|
|
317
|
+
return Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.LOGOUT, []);
|
|
318
|
+
} catch (error) {
|
|
319
|
+
Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
320
|
+
}
|
|
267
321
|
}
|
|
268
|
-
|
|
269
|
-
setCustomAttributeWithString
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
|
|
322
|
+
}, {
|
|
323
|
+
key: "setCustomAttributeWithString",
|
|
324
|
+
value: function setCustomAttributeWithString(key, value) {
|
|
325
|
+
if (Utils.checkParameters([{
|
|
326
|
+
type: 'string',
|
|
327
|
+
value: key
|
|
328
|
+
}, {
|
|
329
|
+
type: 'string',
|
|
330
|
+
value: value
|
|
331
|
+
}])) {
|
|
332
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithString');
|
|
281
333
|
return this;
|
|
334
|
+
}
|
|
335
|
+
try {
|
|
336
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_CUSTOM_ATTRIBUTE_WITH_STRING, [key, value]);
|
|
337
|
+
} catch (error) {
|
|
338
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
339
|
+
}
|
|
340
|
+
return this;
|
|
282
341
|
}
|
|
283
|
-
|
|
284
|
-
setCustomAttributeWithInt
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
295
|
-
|
|
342
|
+
}, {
|
|
343
|
+
key: "setCustomAttributeWithInt",
|
|
344
|
+
value: function setCustomAttributeWithInt(key, value) {
|
|
345
|
+
if (Utils.checkParameters([{
|
|
346
|
+
type: 'string',
|
|
347
|
+
value: key
|
|
348
|
+
}, {
|
|
349
|
+
type: 'number',
|
|
350
|
+
value: value
|
|
351
|
+
}])) {
|
|
352
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithInt');
|
|
296
353
|
return this;
|
|
354
|
+
}
|
|
355
|
+
try {
|
|
356
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_CUSTOM_ATTRIBUTE_WITH_INT, [key, value]);
|
|
357
|
+
} catch (error) {
|
|
358
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
359
|
+
}
|
|
360
|
+
return this;
|
|
297
361
|
}
|
|
298
|
-
|
|
299
|
-
setCustomAttributeWithDouble
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
362
|
+
}, {
|
|
363
|
+
key: "setCustomAttributeWithDouble",
|
|
364
|
+
value: function setCustomAttributeWithDouble(key, value) {
|
|
365
|
+
if (Utils.checkParameters([{
|
|
366
|
+
type: 'string',
|
|
367
|
+
value: key
|
|
368
|
+
}, {
|
|
369
|
+
type: 'number',
|
|
370
|
+
value: value
|
|
371
|
+
}])) {
|
|
372
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithDouble');
|
|
311
373
|
return this;
|
|
374
|
+
}
|
|
375
|
+
try {
|
|
376
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_CUSTOM_ATTRIBUTE_WITH_DOUBLE, [key, value]);
|
|
377
|
+
} catch (error) {
|
|
378
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
379
|
+
}
|
|
380
|
+
return this;
|
|
312
381
|
}
|
|
313
|
-
|
|
314
|
-
setCustomAttributeWithBoolean
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
325
|
-
|
|
382
|
+
}, {
|
|
383
|
+
key: "setCustomAttributeWithBoolean",
|
|
384
|
+
value: function setCustomAttributeWithBoolean(key, value) {
|
|
385
|
+
if (Utils.checkParameters([{
|
|
386
|
+
type: 'string',
|
|
387
|
+
value: key
|
|
388
|
+
}, {
|
|
389
|
+
type: 'boolean',
|
|
390
|
+
value: value
|
|
391
|
+
}])) {
|
|
392
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithBoolean');
|
|
326
393
|
return this;
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_CUSTOM_ATTRIBUTE_WITH_BOOLEAN, [key, value]);
|
|
397
|
+
} catch (error) {
|
|
398
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
399
|
+
}
|
|
400
|
+
return this;
|
|
327
401
|
}
|
|
328
|
-
|
|
329
|
-
setCustomAttributeWithDate
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
402
|
+
}, {
|
|
403
|
+
key: "setCustomAttributeWithDate",
|
|
404
|
+
value: function setCustomAttributeWithDate(key, value) {
|
|
405
|
+
if (Utils.checkParameters([{
|
|
406
|
+
type: 'string',
|
|
407
|
+
value: key
|
|
408
|
+
}, {
|
|
409
|
+
type: 'object',
|
|
410
|
+
value: value
|
|
411
|
+
}])) {
|
|
412
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithDate');
|
|
341
413
|
return this;
|
|
414
|
+
}
|
|
415
|
+
try {
|
|
416
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_CUSTOM_ATTRIBUTE_WITH_DATE, [key, value.toISOString()]);
|
|
417
|
+
} catch (error) {
|
|
418
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
419
|
+
}
|
|
420
|
+
return this;
|
|
342
421
|
}
|
|
343
|
-
|
|
344
|
-
setCustomAttributeWithArray
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
|
|
422
|
+
}, {
|
|
423
|
+
key: "setCustomAttributeWithArray",
|
|
424
|
+
value: function setCustomAttributeWithArray(key, value) {
|
|
425
|
+
if (Utils.checkParameters([{
|
|
426
|
+
type: 'string',
|
|
427
|
+
value: key
|
|
428
|
+
}, {
|
|
429
|
+
type: 'object',
|
|
430
|
+
value: value
|
|
431
|
+
}])) {
|
|
432
|
+
Utils.showParameterWarningLog(this.constructor.name + '-setCustomAttributeWithArray');
|
|
356
433
|
return this;
|
|
434
|
+
}
|
|
435
|
+
try {
|
|
436
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.SET_CUSTOM_ATTRIBUTE_WITH_ARRAY, [key, value]);
|
|
437
|
+
} catch (error) {
|
|
438
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
439
|
+
}
|
|
440
|
+
return this;
|
|
357
441
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.UNSET_CUSTOM_ATTRIBUTE, [key]);
|
|
367
|
-
} catch (error) {
|
|
368
|
-
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
369
|
-
}
|
|
370
|
-
|
|
442
|
+
}, {
|
|
443
|
+
key: "unsetCustomAttribute",
|
|
444
|
+
value: function unsetCustomAttribute(key) {
|
|
445
|
+
if (Utils.checkParameters([{
|
|
446
|
+
type: 'string',
|
|
447
|
+
value: key
|
|
448
|
+
}])) {
|
|
449
|
+
Utils.showParameterWarningLog(this.constructor.name + '-unsetCustomAttribute');
|
|
371
450
|
return this;
|
|
451
|
+
}
|
|
452
|
+
try {
|
|
453
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.UNSET_CUSTOM_ATTRIBUTE, [key]);
|
|
454
|
+
} catch (error) {
|
|
455
|
+
Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
|
|
456
|
+
}
|
|
457
|
+
return this;
|
|
372
458
|
}
|
|
373
|
-
}
|
|
374
|
-
|
|
459
|
+
}]);
|
|
460
|
+
}();
|
|
375
461
|
module.exports = User;
|