cordova-plugin-insider 2.2.1 → 2.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.
package/www/Event.js CHANGED
@@ -1,113 +1,150 @@
1
1
  "use strict";
2
2
 
3
- const Utils = require("./Utils");
4
- const InsiderConstants = require("./Constants");
5
-
6
- class Event {
7
- name = '';
8
- parameters = {};
9
-
10
- constructor(name) {
11
- this.name = name;
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 _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
9
+ 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); }
10
+ var Utils = require("./Utils");
11
+ var InsiderConstants = require("./Constants");
12
+ var Event = /*#__PURE__*/function () {
13
+ function Event(name) {
14
+ _classCallCheck(this, Event);
15
+ _defineProperty(this, "name", '');
16
+ _defineProperty(this, "parameters", {});
17
+ this.name = name;
18
+ }
19
+ return _createClass(Event, [{
20
+ key: "addParameterWithString",
21
+ value: function addParameterWithString(key, value) {
22
+ if (Utils.checkParameters([{
23
+ type: 'string',
24
+ value: key
25
+ }, {
26
+ type: 'string',
27
+ value: value
28
+ }])) {
29
+ Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithString');
30
+ return this;
31
+ }
32
+ try {
33
+ this.parameters[key] = value;
34
+ return this;
35
+ } catch (error) {
36
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
37
+ }
12
38
  }
13
-
14
- addParameterWithString(key, value) {
15
- if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'string', value: value }])) {
16
- Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithString');
17
- return this;
18
- }
19
-
20
- try {
21
- this.parameters[key] = value;
22
-
23
- return this;
24
- } catch (error) {
25
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
26
- }
39
+ }, {
40
+ key: "addParameterWithInt",
41
+ value: function addParameterWithInt(key, value) {
42
+ if (Utils.checkParameters([{
43
+ type: 'string',
44
+ value: key
45
+ }, {
46
+ type: 'number',
47
+ value: value
48
+ }])) {
49
+ Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithInt');
50
+ return this;
51
+ }
52
+ try {
53
+ this.parameters[key] = value;
54
+ return this;
55
+ } catch (error) {
56
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
57
+ }
27
58
  }
28
-
29
- addParameterWithInt(key, value) {
30
- if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'number', value: value }])) {
31
- Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithInt');
32
- return this;
33
- }
34
-
35
- try {
36
- this.parameters[key] = value;
37
-
38
- return this;
39
- } catch (error) {
40
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
41
- }
59
+ }, {
60
+ key: "addParameterWithDouble",
61
+ value: function addParameterWithDouble(key, value) {
62
+ if (Utils.checkParameters([{
63
+ type: 'string',
64
+ value: key
65
+ }, {
66
+ type: 'number',
67
+ value: value
68
+ }])) {
69
+ Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithDouble');
70
+ return this;
71
+ }
72
+ try {
73
+ this.parameters[key] = value;
74
+ return this;
75
+ } catch (error) {
76
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
77
+ }
42
78
  }
43
-
44
- addParameterWithDouble(key, value) {
45
- if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'number', value: value }])) {
46
- Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithDouble');
47
- return this;
48
- }
49
-
50
- try {
51
- this.parameters[key] = value;
52
-
53
- return this;
54
- } catch (error) {
55
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
56
- }
79
+ }, {
80
+ key: "addParameterWithBoolean",
81
+ value: function addParameterWithBoolean(key, value) {
82
+ if (Utils.checkParameters([{
83
+ type: 'string',
84
+ value: key
85
+ }, {
86
+ type: 'boolean',
87
+ value: value
88
+ }])) {
89
+ Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithBoolean');
90
+ return this;
91
+ }
92
+ try {
93
+ this.parameters[key] = value;
94
+ return this;
95
+ } catch (error) {
96
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
97
+ }
57
98
  }
58
-
59
- addParameterWithBoolean(key, value) {
60
- if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'boolean', value: value }])) {
61
- Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithBoolean');
62
- return this;
63
- }
64
-
65
- try {
66
- this.parameters[key] = value;
67
-
68
- return this;
69
- } catch (error) {
70
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
71
- }
99
+ }, {
100
+ key: "addParameterWithDate",
101
+ value: function addParameterWithDate(key, value) {
102
+ if (Utils.checkParameters([{
103
+ type: 'string',
104
+ value: key
105
+ }, {
106
+ type: 'object',
107
+ value: value
108
+ }])) {
109
+ Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithDate');
110
+ return this;
111
+ }
112
+ try {
113
+ this.parameters[key] = value.toISOString();
114
+ return this;
115
+ } catch (error) {
116
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
117
+ }
72
118
  }
73
-
74
- addParameterWithDate(key, value) {
75
- if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'object', value: value }])) {
76
- Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithDate');
77
- return this;
78
- }
79
-
80
- try {
81
- this.parameters[key] = value.toISOString();
82
-
83
- return this;
84
- } catch (error) {
85
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
86
- }
119
+ }, {
120
+ key: "addParameterWithArray",
121
+ value: function addParameterWithArray(key, value) {
122
+ if (Utils.checkParameters([{
123
+ type: 'string',
124
+ value: key
125
+ }, {
126
+ type: 'object',
127
+ value: value
128
+ }])) {
129
+ Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithArray');
130
+ return this;
131
+ }
132
+ try {
133
+ this.parameters[key] = value;
134
+ return this;
135
+ } catch (error) {
136
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
137
+ }
87
138
  }
88
-
89
- addParameterWithArray(key, value) {
90
- if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'object', value: value }])) {
91
- Utils.showParameterWarningLog(this.constructor.name + '-addParameterWithArray');
92
- return this;
93
- }
94
-
95
- try {
96
- this.parameters[key] = value;
97
-
98
- return this;
99
- } catch (error) {
100
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
101
- }
139
+ }, {
140
+ key: "build",
141
+ value: function build() {
142
+ try {
143
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.TAG_EVENT, [this.name, this.parameters]);
144
+ } catch (error) {
145
+ Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
146
+ }
102
147
  }
103
-
104
- build() {
105
- try {
106
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.TAG_EVENT, [this.name, this.parameters]);
107
- } catch (error) {
108
- Utils.asyncExec(InsiderConstants.CLASS, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
109
- }
110
- }
111
- }
112
-
148
+ }]);
149
+ }();
113
150
  module.exports = Event;
package/www/Gender.js CHANGED
@@ -1,5 +1,7 @@
1
+ "use strict";
2
+
1
3
  module.exports = {
2
- MALE: 0,
3
- FEMALE: 1,
4
- OTHER: 2,
4
+ MALE: 0,
5
+ FEMALE: 1,
6
+ OTHER: 2
5
7
  };
package/www/Identifier.js CHANGED
@@ -1,78 +1,96 @@
1
1
  "use strict";
2
2
 
3
- const Utils = require("./Utils");
4
- const InsiderConstants = require("./Constants");
5
-
6
- class Identifier {
7
- identifiers = {};
8
-
9
- constructor() {
10
- this.identifiers = {};
11
- }
12
-
13
- addEmail(email) {
14
- if (Utils.checkParameters([{ type: 'string', value: email }])) {
15
- Utils.showParameterWarningLog(this.constructor.name + '-addEmail');
16
- return this;
17
- }
18
-
19
- try {
20
- this.identifiers[InsiderConstants.ADD_EMAIL] = email;
21
- } catch (error) {
22
- Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
23
- }
24
-
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 _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
9
+ 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); }
10
+ var Utils = require("./Utils");
11
+ var InsiderConstants = require("./Constants");
12
+ var Identifier = /*#__PURE__*/function () {
13
+ function Identifier() {
14
+ _classCallCheck(this, Identifier);
15
+ _defineProperty(this, "identifiers", {});
16
+ this.identifiers = {};
17
+ }
18
+ return _createClass(Identifier, [{
19
+ key: "addEmail",
20
+ value: function addEmail(email) {
21
+ if (Utils.checkParameters([{
22
+ type: 'string',
23
+ value: email
24
+ }])) {
25
+ Utils.showParameterWarningLog(this.constructor.name + '-addEmail');
25
26
  return this;
27
+ }
28
+ try {
29
+ this.identifiers[InsiderConstants.ADD_EMAIL] = email;
30
+ } catch (error) {
31
+ Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
32
+ }
33
+ return this;
26
34
  }
27
-
28
- addPhoneNumber(phoneNumber) {
29
- if (Utils.checkParameters([{ type: 'string', value: phoneNumber }])) {
30
- Utils.showParameterWarningLog(this.constructor.name + '-addPhoneNumber');
31
- return this;
32
- }
33
-
34
- try {
35
- this.identifiers[InsiderConstants.ADD_PHONE_NUMBER] = phoneNumber;
36
- } catch (error) {
37
- Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
38
- }
39
-
35
+ }, {
36
+ key: "addPhoneNumber",
37
+ value: function addPhoneNumber(phoneNumber) {
38
+ if (Utils.checkParameters([{
39
+ type: 'string',
40
+ value: phoneNumber
41
+ }])) {
42
+ Utils.showParameterWarningLog(this.constructor.name + '-addPhoneNumber');
40
43
  return this;
44
+ }
45
+ try {
46
+ this.identifiers[InsiderConstants.ADD_PHONE_NUMBER] = phoneNumber;
47
+ } catch (error) {
48
+ Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
49
+ }
50
+ return this;
41
51
  }
42
-
43
- addUserID(userID) {
44
- if (Utils.checkParameters([{ type: 'string', value: userID }])) {
45
- Utils.showParameterWarningLog(this.constructor.name + '-addUserID');
46
- return this;
47
- }
48
-
49
- try {
50
- this.identifiers[InsiderConstants.ADD_USER_ID] = userID;
51
- } catch (error) {
52
- Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
53
- }
54
-
52
+ }, {
53
+ key: "addUserID",
54
+ value: function addUserID(userID) {
55
+ if (Utils.checkParameters([{
56
+ type: 'string',
57
+ value: userID
58
+ }])) {
59
+ Utils.showParameterWarningLog(this.constructor.name + '-addUserID');
55
60
  return this;
61
+ }
62
+ try {
63
+ this.identifiers[InsiderConstants.ADD_USER_ID] = userID;
64
+ } catch (error) {
65
+ Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
66
+ }
67
+ return this;
56
68
  }
57
-
58
- addCustomIdentifier(key, value) {
59
- if (Utils.checkParameters([{ type: 'string', value: key }, { type: 'string', value: value }])) {
60
- Utils.showParameterWarningLog(this.constructor.name + '-addCustomIdentifier');
61
- return this;
62
- }
63
-
64
- try {
65
- this.identifiers[key] = value;
66
- } catch (error) {
67
- Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
68
- }
69
-
69
+ }, {
70
+ key: "addCustomIdentifier",
71
+ value: function addCustomIdentifier(key, value) {
72
+ if (Utils.checkParameters([{
73
+ type: 'string',
74
+ value: key
75
+ }, {
76
+ type: 'string',
77
+ value: value
78
+ }])) {
79
+ Utils.showParameterWarningLog(this.constructor.name + '-addCustomIdentifier');
70
80
  return this;
81
+ }
82
+ try {
83
+ this.identifiers[key] = value;
84
+ } catch (error) {
85
+ Utils.asyncExec(InsiderCordovaPlugin, InsiderConstants.PUT_ERROR_LOG, [Utils.generateJSONErrorString(error)]);
86
+ }
87
+ return this;
71
88
  }
72
-
73
- getIdentifiers() {
74
- return this.identifiers;
89
+ }, {
90
+ key: "getIdentifiers",
91
+ value: function getIdentifiers() {
92
+ return this.identifiers;
75
93
  }
76
- }
77
-
94
+ }]);
95
+ }();
78
96
  module.exports = Identifier;