react-native-insider 6.5.0 → 6.5.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/index.d.ts ADDED
@@ -0,0 +1,102 @@
1
+ declare module 'react-native-insider' {
2
+ import RNInsiderProduct from '.src/InsiderProduct';
3
+ import RNInsiderUser from './src/InsiderUser';
4
+ import RNInsiderEvent from './src/InsiderEvent';
5
+
6
+ export default class RNInsider {
7
+ static init(partnerName: string, appGroup: string, insiderCallback: Function): void;
8
+ static initWithCustomEndpoint(partnerName: string, appGroup: string, endpoint: string, insiderCallback: Function): void;
9
+ static reinitWithPartnerName(partnerName: string): void;
10
+ static tagEvent(name: string): RNInsiderEvent;
11
+ static getCurrentUser(): RNInsiderUser;
12
+ static setGDPRConsent(gdprConsent: boolean): void;
13
+
14
+ static createNewProduct(
15
+ productID: string,
16
+ name: string,
17
+ taxonomy: Array<string>,
18
+ imageURL: string,
19
+ price: number,
20
+ currency: string
21
+ ): RNInsiderProduct;
22
+ static itemPurchased(uniqueSaleID: string, product: RNInsiderProduct): void;
23
+ static itemAddedToCart(product: RNInsiderProduct): void;
24
+ static itemRemovedFromCart(productID: string): void;
25
+ static cartCleared(): void;
26
+ static getMessageCenterData(
27
+ limit: number,
28
+ startDate: Date,
29
+ endDate: Date,
30
+ callback: (messageCenterData: any) => void
31
+ ): void;
32
+ static getSmartRecommendation(
33
+ recommendationID: number,
34
+ locale: string,
35
+ currency: string,
36
+ callback: (recommendation: any) => void
37
+ ): void;
38
+ static getSmartRecommendationWithProduct(
39
+ product: RNInsiderProduct,
40
+ recommendationID: number,
41
+ locale: string,
42
+ callback: (recommendation: any) => void
43
+ ): void;
44
+ static getSmartRecommendationWithProductIDs(
45
+ productIDs: string[],
46
+ recommendationID: number,
47
+ locale: string,
48
+ currency: string,
49
+ callback: (recommendation: any) => void
50
+ ): void;
51
+ static clickSmartRecommendationProduct(recommendationID: number, product: RNInsiderProduct): void;
52
+ static getContentStringWithName(
53
+ variableName: string,
54
+ defaultValue: string,
55
+ contentOptimizerDataType: number,
56
+ callback: (content: string) => void
57
+ ): void;
58
+ static getContentBoolWithName(
59
+ variableName: string,
60
+ defaultValue: boolean,
61
+ contentOptimizerDataType: number,
62
+ callback: (content: boolean) => void
63
+ ): void;
64
+ static getContentIntWithName(
65
+ variableName: string,
66
+ defaultValue: number,
67
+ contentOptimizerDataType: number,
68
+ callback: (content: number) => void
69
+ ): void;
70
+ static visitHomePage(): void;
71
+ static visitListingPage(taxonomy: Array<string>): void;
72
+ static visitProductDetailPage(product: RNInsiderProduct): void;
73
+ static visitCartPage(products: Array<RNInsiderProduct>): void;
74
+ static startTrackingGeofence(): void;
75
+ static handleNotification(notification: any): void;
76
+ static enableIDFACollection(enableIDFACollection: boolean): void;
77
+ static removeInapp(): void;
78
+ static registerWithQuietPermission(enabled: boolean): void;
79
+ static setHybridPushToken(token: string): void;
80
+ static showNativeAppReview(): void;
81
+ static enableLocationCollection(consentStatus: boolean): void;
82
+ static enableIpCollection(consentStatus: boolean): void;
83
+ static enableCarrierCollection(consentStatus: boolean): void;
84
+ static signUpConfirmation(): void;
85
+ static reenableTemplatesForIOS(): void;
86
+ static disableTemplatesForIOS(): void;
87
+ static setForegroundPushCallback(callback: (notification: any) => void): void;
88
+ static setActiveForegroundPushView(): void;
89
+ static handleUniversalLink(url: string): void;
90
+ static getInsiderID(): Promise<string>;
91
+ static insiderIDListener(callback: (insiderID: string) => void): void;
92
+ }
93
+
94
+ export const NOTIFICATION_OPEN: string;
95
+ export const INAPP_BUTTON_CLICK: string;
96
+ export const TEMP_STORE_PURCHASE: string;
97
+ export const TEMP_STORE_ADDED_TO_CART: string;
98
+ export const TEMP_STORE_CUSTOM_ACTION: string;
99
+ export const FOREGROUND_PUSH: string;
100
+ export const INAPP_SEEN: string;
101
+ export const INSIDER_ID_LISTENER: string;
102
+ }
package/index.js CHANGED
@@ -45,8 +45,9 @@ function registerInsiderCallback(insiderCallback) {
45
45
  Insider.putErrorLog(generateJSONErrorString(error));
46
46
  }
47
47
  }
48
+
48
49
  export default class RNInsider {
49
- static init(partnerName: string, appGroup: string, insiderCallback: Function) {
50
+ static init(partnerName, appGroup, insiderCallback) {
50
51
  if (shouldNotProceed() || partnerName == null || appGroup == null || insiderCallback == null) return;
51
52
  try {
52
53
  registerInsiderCallback(insiderCallback);
@@ -61,7 +62,7 @@ export default class RNInsider {
61
62
  }
62
63
  }
63
64
 
64
- static initWithCustomEndpoint(partnerName: string, appGroup: string, endpoint: string, insiderCallback: Function) {
65
+ static initWithCustomEndpoint(partnerName, appGroup, endpoint, insiderCallback) {
65
66
  if (shouldNotProceed() || partnerName == null || appGroup == null || endpoint == null || insiderCallback == null) return;
66
67
  try {
67
68
  registerInsiderCallback(insiderCallback);
@@ -77,7 +78,7 @@ export default class RNInsider {
77
78
  }
78
79
  }
79
80
 
80
- static reinitWithPartnerName(partnerName: string) {
81
+ static reinitWithPartnerName(partnerName) {
81
82
  if (shouldNotProceed() || partnerName == null) return;
82
83
 
83
84
  try {
@@ -87,12 +88,12 @@ export default class RNInsider {
87
88
  }
88
89
  }
89
90
 
90
- static tagEvent(name: string): ?RNInsiderEvent {
91
+ static tagEvent(name) {
91
92
  if (shouldNotProceed() || name == null) return new RNInsiderEvent('');
92
93
  return new RNInsiderEvent(name);
93
94
  }
94
95
 
95
- static getCurrentUser(): ?RNInsiderUser {
96
+ static getCurrentUser() {
96
97
  if (shouldNotProceed()) return;
97
98
  return InsiderUser;
98
99
  }
@@ -108,20 +109,13 @@ export default class RNInsider {
108
109
 
109
110
  // Product
110
111
 
111
- static createNewProduct(
112
- productID: string,
113
- name: string,
114
- taxonomy: Array<string>,
115
- imageURL: string,
116
- price: number,
117
- currency: string
118
- ): ?RNInsiderProduct {
112
+ static createNewProduct(productID, name, taxonomy, imageURL, price, currency) {
119
113
  if (shouldNotProceed() || productID == null || name == null || taxonomy == null || imageURL == null || price == null || currency == null)
120
114
  return new RNInsiderProduct('', '', [], '', 0, '');
121
115
  return new RNInsiderProduct(productID, name, taxonomy, imageURL, price, currency);
122
116
  }
123
117
 
124
- static itemPurchased(uniqueSaleID: string, product: RNInsiderProduct) {
118
+ static itemPurchased(uniqueSaleID, product) {
125
119
  if (shouldNotProceed() || uniqueSaleID == null || product == null) return;
126
120
  try {
127
121
  Insider.itemPurchased(uniqueSaleID, product.productMustMap, product.productOptMap);
@@ -130,7 +124,7 @@ export default class RNInsider {
130
124
  }
131
125
  }
132
126
 
133
- static itemAddedToCart(product: RNInsiderProduct) {
127
+ static itemAddedToCart(product) {
134
128
  if (shouldNotProceed() || product == null) return;
135
129
  try {
136
130
  Insider.itemAddedToCart(product.productMustMap, product.productOptMap);
@@ -139,7 +133,7 @@ export default class RNInsider {
139
133
  }
140
134
  }
141
135
 
142
- static itemRemovedFromCart(productID: string) {
136
+ static itemRemovedFromCart(productID) {
143
137
  if (shouldNotProceed() || productID == null) return;
144
138
  try {
145
139
  Insider.itemRemovedFromCart(productID);
@@ -158,7 +152,7 @@ export default class RNInsider {
158
152
  }
159
153
 
160
154
  // Message Center & Smart Recommendation
161
- static getMessageCenterData(limit: number, startDate: Date, endDate: Date, callback: Function) {
155
+ static getMessageCenterData(limit, startDate, endDate, callback) {
162
156
  if (shouldNotProceed() || limit == null || startDate == null || endDate == null || callback == null || startDate.getTime() === endDate.getTime() ||
163
157
  startDate.getTime() > endDate.getTime()) return;
164
158
  try {
@@ -174,7 +168,7 @@ export default class RNInsider {
174
168
  }
175
169
  }
176
170
 
177
- static getMessageCenterDataArray(limit: number, startDate: Date, endDate: Date, callback: Function) {
171
+ static getMessageCenterDataArray(limit, startDate, endDate, callback) {
178
172
  if (shouldNotProceed() || limit == null || startDate == null || endDate == null || callback == null || startDate.getTime() === endDate.getTime() ||
179
173
  startDate.getTime() > endDate.getTime()) return;
180
174
  try {
@@ -190,7 +184,7 @@ export default class RNInsider {
190
184
  }
191
185
  }
192
186
 
193
- static getSmartRecommendation(recommendationID: number, locale: string, currency: string, callback: Function) {
187
+ static getSmartRecommendation(recommendationID, locale, currency, callback) {
194
188
  if (shouldNotProceed() || recommendationID == null || locale == null || currency == null || callback == null) return;
195
189
  try {
196
190
  Insider.getSmartRecommendation(recommendationID, locale, currency, (recommendation) => {
@@ -201,7 +195,7 @@ export default class RNInsider {
201
195
  }
202
196
  }
203
197
 
204
- static getSmartRecommendationWithProduct(product: RNInsiderProduct, recommendationID: number, locale: string, callback: Function) {
198
+ static getSmartRecommendationWithProduct(product, recommendationID, locale, callback) {
205
199
  if (shouldNotProceed() || product == null || recommendationID == null || locale == null || callback == null) return;
206
200
  try {
207
201
  Insider.getSmartRecommendationWithProduct(product.productMustMap, product.productOptMap, recommendationID, locale, (recommendation) => {
@@ -212,7 +206,7 @@ export default class RNInsider {
212
206
  }
213
207
  }
214
208
 
215
- static getSmartRecommendationWithProductIDs(productIDs: Array<string>, recommendationID: number, locale: string, currency: string, callback: Function) {
209
+ static getSmartRecommendationWithProductIDs(productIDs, recommendationID, locale, currency, callback) {
216
210
  if (shouldNotProceed() || productIDs == null || recommendationID == null || locale == null || currency == null || callback == null) return;
217
211
  try {
218
212
  productIDs = productIDs.filter(value => value != null && typeof value == "string" && value.trim());
@@ -225,7 +219,7 @@ export default class RNInsider {
225
219
  }
226
220
  }
227
221
 
228
- static clickSmartRecommendationProduct(recommendationID: number, product: RNInsiderProduct) {
222
+ static clickSmartRecommendationProduct(recommendationID, product) {
229
223
  if (shouldNotProceed() || product == null || recommendationID == null) return;
230
224
  try {
231
225
  Insider.clickSmartRecommendationProduct(recommendationID, product.productMustMap, product.productOptMap);
@@ -235,7 +229,7 @@ export default class RNInsider {
235
229
  }
236
230
 
237
231
  // Content Optimizer
238
- static getContentStringWithName(variableName: string, defaultValue: string, contentOptimizerDataType: number, callback: Function) {
232
+ static getContentStringWithName(variableName, defaultValue, contentOptimizerDataType, callback) {
239
233
  if (shouldNotProceed() || variableName == null || defaultValue == null || contentOptimizerDataType == null || callback == null) return;
240
234
  try {
241
235
  Insider.getContentStringWithName(variableName, defaultValue, contentOptimizerDataType, callback);
@@ -244,7 +238,7 @@ export default class RNInsider {
244
238
  }
245
239
  }
246
240
 
247
- static getContentBoolWithName(variableName: string, defaultValue: boolean, contentOptimizerDataType: number, callback: Function) {
241
+ static getContentBoolWithName(variableName, defaultValue, contentOptimizerDataType, callback) {
248
242
  if (shouldNotProceed() || variableName == null || defaultValue == null || contentOptimizerDataType == null || callback == null) return;
249
243
  try {
250
244
  Insider.getContentBoolWithName(variableName, defaultValue, contentOptimizerDataType, callback);
@@ -253,7 +247,7 @@ export default class RNInsider {
253
247
  }
254
248
  }
255
249
 
256
- static getContentIntWithName(variableName: string, defaultValue: number, contentOptimizerDataType: number, callback: Function) {
250
+ static getContentIntWithName(variableName, defaultValue, contentOptimizerDataType, callback) {
257
251
  if (shouldNotProceed() || variableName == null || defaultValue == null || contentOptimizerDataType == null || callback == null) return;
258
252
  try {
259
253
  Insider.getContentIntWithName(variableName, defaultValue, contentOptimizerDataType, callback);
@@ -272,7 +266,7 @@ export default class RNInsider {
272
266
  }
273
267
  }
274
268
 
275
- static visitListingPage(taxonomy: Array<string>) {
269
+ static visitListingPage(taxonomy) {
276
270
  if (shouldNotProceed() || taxonomy == null) return;
277
271
  try {
278
272
  Insider.visitListingPage(taxonomy);
@@ -281,7 +275,7 @@ export default class RNInsider {
281
275
  }
282
276
  }
283
277
 
284
- static visitProductDetailPage(product: RNInsiderProduct) {
278
+ static visitProductDetailPage(product) {
285
279
  if (shouldNotProceed() || product == null) return;
286
280
  try {
287
281
  Insider.visitProductDetailPage(product.productMustMap, product.productOptMap);
@@ -290,7 +284,7 @@ export default class RNInsider {
290
284
  }
291
285
  }
292
286
 
293
- static visitCartPage(products: Array<RNInsiderProduct>) {
287
+ static visitCartPage(products) {
294
288
  if (shouldNotProceed() || products == null) return;
295
289
  let mappedProducts = new Array(products.length);
296
290
  try {
@@ -324,7 +318,7 @@ export default class RNInsider {
324
318
  }
325
319
  }
326
320
 
327
- static enableIDFACollection(enableIDFACollection: boolean) {
321
+ static enableIDFACollection(enableIDFACollection) {
328
322
  if (shouldNotProceed() || enableIDFACollection == null) return;
329
323
  try {
330
324
  Insider.enableIDFACollection(enableIDFACollection);
@@ -352,7 +346,7 @@ export default class RNInsider {
352
346
  }
353
347
  }
354
348
 
355
- static setHybridPushToken(token: string) {
349
+ static setHybridPushToken(token) {
356
350
  if (shouldNotProceed() || token == null) return;
357
351
  try {
358
352
  if (Platform.OS !== 'android') return;
@@ -455,7 +449,7 @@ export default class RNInsider {
455
449
  }
456
450
  }
457
451
 
458
- static handleUniversalLink(url: string) {
452
+ static handleUniversalLink(url) {
459
453
  try {
460
454
  if (Platform.OS !== 'android' || url == null || shouldNotProceed()) return;
461
455
 
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "react-native-insider",
3
- "version": "6.5.0",
3
+ "version": "6.5.1",
4
4
  "description": "React Native Insider SDK",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
6
7
  "keywords": [
7
8
  "react-native",
8
9
  "ios",
@@ -0,0 +1,6 @@
1
+ declare const ContentOptimizerDataType: {
2
+ Content: 0;
3
+ Element: 1;
4
+ };
5
+
6
+ export default ContentOptimizerDataType;
@@ -0,0 +1,10 @@
1
+ declare const InsiderCallbackType: {
2
+ NOTIFICATION_OPEN: 0;
3
+ INAPP_BUTTON_CLICK: 1;
4
+ TEMP_STORE_PURCHASE: 2;
5
+ TEMP_STORE_ADDED_TO_CART: 3;
6
+ TEMP_STORE_CUSTOM_ACTION: 4;
7
+ INAPP_SEEN: 5;
8
+ };
9
+
10
+ export default InsiderCallbackType;
@@ -0,0 +1,14 @@
1
+ declare class RNInsiderEvent {
2
+ constructor(name: string);
3
+
4
+ addParameterWithString(key: string, value: string): this;
5
+ addParameterWithInt(key: string, value: number): this;
6
+ addParameterWithDouble(key: string, value: number): this;
7
+ addParameterWithBoolean(key: string, value: boolean): this;
8
+ addParameterWithDate(key: string, value: Date): this;
9
+ addParameterWithArray(key: string, value: Array<string>): this;
10
+
11
+ build(): void;
12
+ }
13
+
14
+ export default RNInsiderEvent;
@@ -13,11 +13,12 @@ function generateJSONErrorString(error) {
13
13
  export default class RNInsiderEvent {
14
14
  name = '';
15
15
  parameters = {};
16
- constructor(name: string) {
16
+
17
+ constructor(name) {
17
18
  this.name = name;
18
19
  }
19
20
 
20
- addParameterWithString(key: string, value: string) {
21
+ addParameterWithString(key, value) {
21
22
  if (shouldNotProceed() || key == null || value == null) return this;
22
23
  try {
23
24
  this.parameters[key] = value;
@@ -28,7 +29,7 @@ export default class RNInsiderEvent {
28
29
  return this;
29
30
  }
30
31
 
31
- addParameterWithInt(key: string, value: number) {
32
+ addParameterWithInt(key, value) {
32
33
  if (shouldNotProceed() || key == null || value == null) return this;
33
34
  try {
34
35
  this.parameters[key] = value;
@@ -39,7 +40,7 @@ export default class RNInsiderEvent {
39
40
  return this;
40
41
  }
41
42
 
42
- addParameterWithDouble(key: string, value: number) {
43
+ addParameterWithDouble(key, value) {
43
44
  if (shouldNotProceed() || key == null || value == null) return this;
44
45
  try {
45
46
  this.parameters[key] = value;
@@ -50,7 +51,7 @@ export default class RNInsiderEvent {
50
51
  return this;
51
52
  }
52
53
 
53
- addParameterWithBoolean(key: string, value: boolean) {
54
+ addParameterWithBoolean(key, value) {
54
55
  if (shouldNotProceed() || key == null || value == null) return this;
55
56
  try {
56
57
  this.parameters[key] = value;
@@ -61,7 +62,7 @@ export default class RNInsiderEvent {
61
62
  return this;
62
63
  }
63
64
 
64
- addParameterWithDate(key: string, value: Date) {
65
+ addParameterWithDate(key, value) {
65
66
  if (shouldNotProceed() || key == null || value == null) return this;
66
67
  try {
67
68
  this.parameters[key] = value.toISOString();
@@ -72,7 +73,7 @@ export default class RNInsiderEvent {
72
73
  return this;
73
74
  }
74
75
 
75
- addParameterWithArray(key: string, value: Array<string>) {
76
+ addParameterWithArray(key, value) {
76
77
  if (shouldNotProceed() || key == null || value == null) return this;
77
78
  try {
78
79
  this.parameters[key] = value;
@@ -91,4 +92,4 @@ export default class RNInsiderEvent {
91
92
  Insider.putErrorLog(generateJSONErrorString(error));
92
93
  }
93
94
  }
94
- }
95
+ }
@@ -0,0 +1,7 @@
1
+ declare const InsiderGender: {
2
+ Male: 0;
3
+ Female: 1;
4
+ Other: 2;
5
+ };
6
+
7
+ export default InsiderGender;
@@ -0,0 +1,10 @@
1
+ declare class RNInsiderIdentifier {
2
+ constructor();
3
+
4
+ addEmail(email: string): this;
5
+ addPhoneNumber(phoneNumber: string): this;
6
+ addUserID(userID: string): this;
7
+ addCustomIdentifier(key: string, value: string): this;
8
+ }
9
+
10
+ export default RNInsiderIdentifier;
@@ -22,7 +22,7 @@ export default class RNInsiderIdentifier {
22
22
  this.identifiers = {};
23
23
  }
24
24
 
25
- addEmail(email: string) {
25
+ addEmail(email) {
26
26
  if (shouldNotProceed() || email == null) return this;
27
27
  try {
28
28
  this.identifiers[ADD_EMAIL] = email.toString();
@@ -32,7 +32,7 @@ export default class RNInsiderIdentifier {
32
32
  return this;
33
33
  }
34
34
 
35
- addPhoneNumber(phoneNumber: string) {
35
+ addPhoneNumber(phoneNumber) {
36
36
  if (shouldNotProceed() || phoneNumber == null) return this;
37
37
  try {
38
38
  this.identifiers[ADD_PHONE_NUMBER] = phoneNumber.toString();
@@ -42,7 +42,7 @@ export default class RNInsiderIdentifier {
42
42
  return this;
43
43
  }
44
44
 
45
- addUserID(userID: string) {
45
+ addUserID(userID) {
46
46
  if (shouldNotProceed() || userID == null) return this;
47
47
  try {
48
48
  this.identifiers[ADD_USER_ID] = userID.toString();
@@ -52,7 +52,7 @@ export default class RNInsiderIdentifier {
52
52
  return this;
53
53
  }
54
54
 
55
- addCustomIdentifier(key: string, value: string) {
55
+ addCustomIdentifier(key, value) {
56
56
  if (shouldNotProceed() || key == null || value == null) return this;
57
57
  try {
58
58
  this.identifiers[key.toString()] = value.toString();
@@ -0,0 +1,31 @@
1
+ declare class RNInsiderProduct {
2
+ constructor(
3
+ productID: string,
4
+ name: string,
5
+ taxonomy: Array<string>,
6
+ imageURL: string,
7
+ price: number,
8
+ currency: string
9
+ );
10
+
11
+ setColor(color: string): this;
12
+ setVoucherName(voucherName: string): this;
13
+ setPromotionName(promotionName: string): this;
14
+ setSize(size: string): this;
15
+ setSalePrice(salePrice: number): this;
16
+ setShippingCost(shippingCost: number): this;
17
+ setVoucherDiscount(voucherDiscount: number): this;
18
+ setPromotionDiscount(promotionDiscount: number): this;
19
+ setStock(stock: number): this;
20
+ setQuantity(quantity: number): this;
21
+ setGroupCode(groupCode: string): this;
22
+
23
+ setCustomAttributeWithString(key: string, value: string): this;
24
+ setCustomAttributeWithInt(key: string, value: number): this;
25
+ setCustomAttributeWithBoolean(key: string, value: boolean): this;
26
+ setCustomAttributeWithDouble(key: string, value: number): this;
27
+ setCustomAttributeWithDate(key: string, value: Date): this;
28
+ setCustomAttributeWithArray(key: string, value: Array<string>): this;
29
+ }
30
+
31
+ export default RNInsiderProduct;
@@ -35,7 +35,7 @@ const GROUP_CODE = 'groupcode';
35
35
  export default class RNInsiderProduct {
36
36
  productMustMap = {};
37
37
  productOptMap = {};
38
- constructor(productID: string, name: string, taxonomy: Array<string>, imageURL: string, price: number, currency: string) {
38
+ constructor(productID, name, taxonomy, imageURL, price, currency) {
39
39
  this.productMustMap = {
40
40
  product_id: productID,
41
41
  name: name,
@@ -46,7 +46,7 @@ export default class RNInsiderProduct {
46
46
  };
47
47
  }
48
48
 
49
- setColor(color: string) {
49
+ setColor(color) {
50
50
  if (shouldNotProceed() || color == null) return this;
51
51
  try {
52
52
  this.productOptMap[COLOR] = color;
@@ -56,7 +56,7 @@ export default class RNInsiderProduct {
56
56
  return this;
57
57
  }
58
58
 
59
- setVoucherName(voucherName: string) {
59
+ setVoucherName(voucherName) {
60
60
  if (shouldNotProceed() || voucherName == null) return this;
61
61
  try {
62
62
  this.productOptMap[VOUCHER_NAME] = voucherName;
@@ -66,7 +66,7 @@ export default class RNInsiderProduct {
66
66
  return this;
67
67
  }
68
68
 
69
- setPromotionName(promotionName: string) {
69
+ setPromotionName(promotionName) {
70
70
  if (shouldNotProceed() || promotionName == null) return this;
71
71
  try {
72
72
  this.productOptMap[PROMOTION_NAME] = promotionName;
@@ -76,7 +76,7 @@ export default class RNInsiderProduct {
76
76
  return this;
77
77
  }
78
78
 
79
- setSize(size: string) {
79
+ setSize(size) {
80
80
  if (shouldNotProceed() || size == null) return this;
81
81
  try {
82
82
  this.productOptMap[SIZE] = size;
@@ -86,7 +86,7 @@ export default class RNInsiderProduct {
86
86
  return this;
87
87
  }
88
88
 
89
- setSalePrice(salePrice: number) {
89
+ setSalePrice(salePrice) {
90
90
  if (shouldNotProceed() || salePrice == null) return this;
91
91
  try {
92
92
  this.productOptMap[SALE_PRICE] = salePrice;
@@ -96,7 +96,7 @@ export default class RNInsiderProduct {
96
96
  return this;
97
97
  }
98
98
 
99
- setShippingCost(shippingCost: number) {
99
+ setShippingCost(shippingCost) {
100
100
  if (shouldNotProceed() || shippingCost == null) return this;
101
101
  try {
102
102
  this.productOptMap[SHIPPING_COST] = shippingCost;
@@ -106,7 +106,7 @@ export default class RNInsiderProduct {
106
106
  return this;
107
107
  }
108
108
 
109
- setVoucherDiscount(voucherDiscount: number) {
109
+ setVoucherDiscount(voucherDiscount) {
110
110
  if (shouldNotProceed() || voucherDiscount == null) return this;
111
111
  try {
112
112
  this.productOptMap[VOUCHER_DISCOUNT] = voucherDiscount;
@@ -116,7 +116,7 @@ export default class RNInsiderProduct {
116
116
  return this;
117
117
  }
118
118
 
119
- setPromotionDiscount(promotionDiscount: number) {
119
+ setPromotionDiscount(promotionDiscount) {
120
120
  if (shouldNotProceed() || promotionDiscount == null) return this;
121
121
  try {
122
122
  this.productOptMap[PROMOTION_DISCOUNT] = promotionDiscount;
@@ -126,7 +126,7 @@ export default class RNInsiderProduct {
126
126
  return this;
127
127
  }
128
128
 
129
- setStock(stock: number) {
129
+ setStock(stock) {
130
130
  if (shouldNotProceed() || stock == null) return this;
131
131
  try {
132
132
  this.productOptMap[STOCK] = stock;
@@ -136,7 +136,7 @@ export default class RNInsiderProduct {
136
136
  return this;
137
137
  }
138
138
 
139
- setQuantity(quantity: number) {
139
+ setQuantity(quantity) {
140
140
  if (shouldNotProceed() || quantity == null) return this;
141
141
  try {
142
142
  this.productOptMap[QUANTITY] = quantity;
@@ -146,7 +146,7 @@ export default class RNInsiderProduct {
146
146
  return this;
147
147
  }
148
148
 
149
- setGroupCode(groupCode: string) {
149
+ setGroupCode(groupCode) {
150
150
  if (shouldNotProceed() || groupCode == null) return this;
151
151
  try {
152
152
  this.productOptMap[GROUP_CODE] = groupCode;
@@ -156,7 +156,7 @@ export default class RNInsiderProduct {
156
156
  return this;
157
157
  }
158
158
 
159
- setCustomAttributeWithString(key: string, value: string) {
159
+ setCustomAttributeWithString(key, value) {
160
160
  if (shouldNotProceed() || key == null || value == null) return this;
161
161
  try {
162
162
  this.productOptMap[key] = value;
@@ -166,7 +166,7 @@ export default class RNInsiderProduct {
166
166
  return this;
167
167
  }
168
168
 
169
- setCustomAttributeWithInt(key: string, value: number) {
169
+ setCustomAttributeWithInt(key, value) {
170
170
  if (shouldNotProceed() || key == null || value == null) return this;
171
171
  try {
172
172
  this.productOptMap[key] = value;
@@ -176,7 +176,7 @@ export default class RNInsiderProduct {
176
176
  return this;
177
177
  }
178
178
 
179
- setCustomAttributeWithBoolean(key: string, value: boolean) {
179
+ setCustomAttributeWithBoolean(key, value) {
180
180
  if (shouldNotProceed() || key == null || value == null) return this;
181
181
  try {
182
182
  this.productOptMap[key] = value;
@@ -186,7 +186,7 @@ export default class RNInsiderProduct {
186
186
  return this;
187
187
  }
188
188
 
189
- setCustomAttributeWithDouble(key: string, value: number) {
189
+ setCustomAttributeWithDouble(key, value) {
190
190
  if (shouldNotProceed() || key == null || value == null) return this;
191
191
  try {
192
192
  this.productOptMap[key] = value;
@@ -196,7 +196,7 @@ export default class RNInsiderProduct {
196
196
  return this;
197
197
  }
198
198
 
199
- setCustomAttributeWithDate(key: string, value: Date) {
199
+ setCustomAttributeWithDate(key, value) {
200
200
  if (shouldNotProceed() || key == null || value == null) return this;
201
201
  try {
202
202
  this.productOptMap[key] = value.toISOString();
@@ -206,7 +206,7 @@ export default class RNInsiderProduct {
206
206
  return this;
207
207
  }
208
208
 
209
- setCustomAttributeWithArray(key: string, value: Array<string>) {
209
+ setCustomAttributeWithArray(key, value) {
210
210
  if (shouldNotProceed() || key == null || value == null) return this;
211
211
  try {
212
212
  this.productOptMap[key] = value;
@@ -0,0 +1,33 @@
1
+ import RNInsiderIdentifier from './InsiderIdentifier';
2
+
3
+ declare class RNInsiderUser {
4
+ setGender(value: number): this;
5
+ setBirthday(value: Date): this;
6
+ setName(value: string): this;
7
+ setSurname(value: string): this;
8
+ setAge(value: number): this;
9
+ setEmail(value: string): this;
10
+ setPhoneNumber(value: string): this;
11
+ setLanguage(value: string): this;
12
+ setLocale(value: string): this;
13
+ setFacebookID(value: string): this;
14
+ setTwitterID(value: string): this;
15
+ setEmailOptin(value: boolean): this;
16
+ setSMSOptin(value: boolean): this;
17
+ setPushOptin(value: boolean): this;
18
+ setLocationOptin(value: boolean): this;
19
+ setWhatsappOptin(value: boolean): this;
20
+
21
+ login(identifiers: RNInsiderIdentifier, insiderIDResult?: (insiderID: string) => void): this;
22
+ logout(): this;
23
+
24
+ setCustomAttributeWithString(key: string, value: string): this;
25
+ setCustomAttributeWithInt(key: string, value: number): this;
26
+ setCustomAttributeWithDouble(key: string, value: number): this;
27
+ setCustomAttributeWithBoolean(key: string, value: boolean): this;
28
+ setCustomAttributeWithDate(key: string, value: Date): this;
29
+ setCustomAttributeWithArray(key: string, value: string[]): this;
30
+ unsetCustomAttribute(key: string): this;
31
+ }
32
+
33
+ export default RNInsiderUser;
@@ -1,5 +1,4 @@
1
1
  import { NativeModules } from 'react-native';
2
- import RNInsiderIdentifier from 'react-native-insider/src/InsiderIdentifier';
3
2
 
4
3
  const Insider = NativeModules.RNInsider;
5
4
 
@@ -12,7 +11,7 @@ function generateJSONErrorString(error) {
12
11
  }
13
12
 
14
13
  export default class RNInsiderUser {
15
- setGender(value: number) {
14
+ setGender(value) {
16
15
  if (shouldNotProceed() || value == null) return this;
17
16
  try {
18
17
  Insider.setGender(value);
@@ -22,7 +21,7 @@ export default class RNInsiderUser {
22
21
  return this;
23
22
  }
24
23
 
25
- setBirthday(value: Date) {
24
+ setBirthday(value) {
26
25
  if (shouldNotProceed() || value == null) return this;
27
26
  try {
28
27
  Insider.setBirthday(value.toISOString());
@@ -32,7 +31,7 @@ export default class RNInsiderUser {
32
31
  return this;
33
32
  }
34
33
 
35
- setName(value: string) {
34
+ setName(value) {
36
35
  if (shouldNotProceed() || value == null) return this;
37
36
  try {
38
37
  Insider.setName(value);
@@ -42,7 +41,7 @@ export default class RNInsiderUser {
42
41
  return this;
43
42
  }
44
43
 
45
- setSurname(value: string) {
44
+ setSurname(value) {
46
45
  if (shouldNotProceed() || value == null) return this;
47
46
  try {
48
47
  Insider.setSurname(value);
@@ -52,7 +51,7 @@ export default class RNInsiderUser {
52
51
  return this;
53
52
  }
54
53
 
55
- setAge(value: number) {
54
+ setAge(value) {
56
55
  if (shouldNotProceed() || value == null) return this;
57
56
  try {
58
57
  Insider.setAge(value);
@@ -62,27 +61,27 @@ export default class RNInsiderUser {
62
61
  return this;
63
62
  }
64
63
 
65
- setEmail(value: string) {
66
- if (shouldNotProceed() || value == null) return this;
67
- try {
68
- Insider.setEmail(value);
69
- } catch (error) {
70
- Insider.putErrorLog(generateJSONErrorString(error));
71
- }
72
- return this;
73
- }
64
+ setEmail(value) {
65
+ if (shouldNotProceed() || value == null) return this;
66
+ try {
67
+ Insider.setEmail(value);
68
+ } catch (error) {
69
+ Insider.putErrorLog(generateJSONErrorString(error));
70
+ }
71
+ return this;
72
+ }
74
73
 
75
- setPhoneNumber(value: string) {
76
- if (shouldNotProceed() || value == null) return this;
77
- try {
78
- Insider.setPhoneNumber(value);
79
- } catch (error) {
80
- Insider.putErrorLog(generateJSONErrorString(error));
81
- }
82
- return this;
83
- }
74
+ setPhoneNumber(value) {
75
+ if (shouldNotProceed() || value == null) return this;
76
+ try {
77
+ Insider.setPhoneNumber(value);
78
+ } catch (error) {
79
+ Insider.putErrorLog(generateJSONErrorString(error));
80
+ }
81
+ return this;
82
+ }
84
83
 
85
- setLanguage(value: string) {
84
+ setLanguage(value) {
86
85
  if (shouldNotProceed() || value == null) return this;
87
86
  try {
88
87
  Insider.setLanguage(value);
@@ -92,7 +91,7 @@ export default class RNInsiderUser {
92
91
  return this;
93
92
  }
94
93
 
95
- setLocale(value: string) {
94
+ setLocale(value) {
96
95
  if (shouldNotProceed() || value == null) return this;
97
96
  try {
98
97
  Insider.setLocale(value);
@@ -102,7 +101,7 @@ export default class RNInsiderUser {
102
101
  return this;
103
102
  }
104
103
 
105
- setFacebookID(value: string) {
104
+ setFacebookID(value) {
106
105
  if (shouldNotProceed() || value == null) return this;
107
106
  try {
108
107
  Insider.setFacebookID(value);
@@ -112,7 +111,7 @@ export default class RNInsiderUser {
112
111
  return this;
113
112
  }
114
113
 
115
- setTwitterID(value: string) {
114
+ setTwitterID(value) {
116
115
  if (shouldNotProceed() || value == null) return this;
117
116
  try {
118
117
  Insider.setTwitterID(value);
@@ -122,7 +121,7 @@ export default class RNInsiderUser {
122
121
  return this;
123
122
  }
124
123
 
125
- setEmailOptin(value: boolean) {
124
+ setEmailOptin(value) {
126
125
  if (shouldNotProceed() || value == null) return this;
127
126
  try {
128
127
  Insider.setEmailOptin(value);
@@ -132,7 +131,7 @@ export default class RNInsiderUser {
132
131
  return this;
133
132
  }
134
133
 
135
- setSMSOptin(value: boolean) {
134
+ setSMSOptin(value) {
136
135
  if (shouldNotProceed() || value == null) return this;
137
136
  try {
138
137
  Insider.setSMSOptin(value);
@@ -142,7 +141,7 @@ export default class RNInsiderUser {
142
141
  return this;
143
142
  }
144
143
 
145
- setPushOptin(value: boolean) {
144
+ setPushOptin(value) {
146
145
  if (shouldNotProceed() || value == null) return this;
147
146
  try {
148
147
  Insider.setPushOptin(value);
@@ -152,7 +151,7 @@ export default class RNInsiderUser {
152
151
  return this;
153
152
  }
154
153
 
155
- setLocationOptin(value: boolean) {
154
+ setLocationOptin(value) {
156
155
  if (shouldNotProceed() || value == null) return this;
157
156
  try {
158
157
  Insider.setLocationOptin(value);
@@ -162,7 +161,7 @@ export default class RNInsiderUser {
162
161
  return this;
163
162
  }
164
163
 
165
- setWhatsappOptin(value: boolean) {
164
+ setWhatsappOptin(value) {
166
165
  if (shouldNotProceed() || value == null) return this;
167
166
  try {
168
167
  Insider.setWhatsappOptin(value);
@@ -172,7 +171,7 @@ export default class RNInsiderUser {
172
171
  return this;
173
172
  }
174
173
 
175
- login(identifiers: RNInsiderIdentifier, insiderIDResult: Function) {
174
+ login(identifiers, insiderIDResult) {
176
175
  if (shouldNotProceed()) { return this; }
177
176
  try {
178
177
  if (insiderIDResult != null) {
@@ -198,7 +197,7 @@ export default class RNInsiderUser {
198
197
  return this;
199
198
  }
200
199
 
201
- setCustomAttributeWithString(key: string, value: string) {
200
+ setCustomAttributeWithString(key, value) {
202
201
  if (shouldNotProceed() || key == null || value == null) return this;
203
202
  try {
204
203
  Insider.setCustomAttributeWithString(key, value);
@@ -208,7 +207,7 @@ export default class RNInsiderUser {
208
207
  return this;
209
208
  }
210
209
 
211
- setCustomAttributeWithInt(key: string, value: number) {
210
+ setCustomAttributeWithInt(key, value) {
212
211
  if (shouldNotProceed() || key == null || value == null) return this;
213
212
  try {
214
213
  Insider.setCustomAttributeWithInt(key, value);
@@ -218,7 +217,7 @@ export default class RNInsiderUser {
218
217
  return this;
219
218
  }
220
219
 
221
- setCustomAttributeWithDouble(key: string, value: number) {
220
+ setCustomAttributeWithDouble(key, value) {
222
221
  if (shouldNotProceed() || key == null || value == null) return this;
223
222
  try {
224
223
  Insider.setCustomAttributeWithDouble(key, value);
@@ -228,7 +227,7 @@ export default class RNInsiderUser {
228
227
  return this;
229
228
  }
230
229
 
231
- setCustomAttributeWithBoolean(key: string, value: boolean) {
230
+ setCustomAttributeWithBoolean(key, value) {
232
231
  if (shouldNotProceed() || key == null || value == null) return this;
233
232
  try {
234
233
  Insider.setCustomAttributeWithBoolean(key, value);
@@ -238,7 +237,7 @@ export default class RNInsiderUser {
238
237
  return this;
239
238
  }
240
239
 
241
- setCustomAttributeWithDate(key: string, value: Date) {
240
+ setCustomAttributeWithDate(key, value) {
242
241
  if (shouldNotProceed() || key == null || value == null) return this;
243
242
  try {
244
243
  Insider.setCustomAttributeWithDate(key, value.toISOString());
@@ -248,7 +247,7 @@ export default class RNInsiderUser {
248
247
  return this;
249
248
  }
250
249
 
251
- setCustomAttributeWithArray(key: string, value: string[]) {
250
+ setCustomAttributeWithArray(key, value) {
252
251
  if (shouldNotProceed() || key == null || value == null) return this;
253
252
  try {
254
253
  Insider.setCustomAttributeWithArray(key, value);
@@ -258,7 +257,7 @@ export default class RNInsiderUser {
258
257
  return this;
259
258
  }
260
259
 
261
- unsetCustomAttribute(key: string) {
260
+ unsetCustomAttribute(key) {
262
261
  if (shouldNotProceed() || key == null) return this;
263
262
  try {
264
263
  Insider.unsetCustomAttribute(key);