gomarketme-react-native 1.0.6 → 1.0.8
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/dist/index.js +280 -0
- package/package.json +9 -4
- package/src/{index.ts → index.tsx} +13 -36
- package/tsconfig.json +10 -8
package/dist/index.js
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const react_native_device_info_1 = __importDefault(require("react-native-device-info"));
|
|
40
|
+
const RNLocalize = __importStar(require("react-native-localize"));
|
|
41
|
+
const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
42
|
+
const react_native_iap_1 = __importDefault(require("react-native-iap"));
|
|
43
|
+
const axios_1 = __importDefault(require("axios"));
|
|
44
|
+
class GoMarketMe {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.sdkInitializedKey = 'GOMARKETME_SDK_INITIALIZED';
|
|
47
|
+
this.affiliateCampaignCode = '';
|
|
48
|
+
this.deviceId = '';
|
|
49
|
+
this.sdkInitializationUrl = 'https://api.gomarketme.net/v1/sdk-initialization';
|
|
50
|
+
this.systemInfoUrl = 'https://api.gomarketme.net/v1/mobile/system-info';
|
|
51
|
+
this.eventUrl = 'https://api.gomarketme.net/v1/event';
|
|
52
|
+
}
|
|
53
|
+
static getInstance() {
|
|
54
|
+
if (!GoMarketMe.instance) {
|
|
55
|
+
GoMarketMe.instance = new GoMarketMe();
|
|
56
|
+
}
|
|
57
|
+
return GoMarketMe.instance;
|
|
58
|
+
}
|
|
59
|
+
initialize(apiKey) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
try {
|
|
62
|
+
const isSDKInitialized = yield this.isSDKInitialized();
|
|
63
|
+
if (!isSDKInitialized) {
|
|
64
|
+
yield this.postSDKInitialization(apiKey);
|
|
65
|
+
}
|
|
66
|
+
const systemInfo = yield this.getSystemInfo();
|
|
67
|
+
yield this.postSystemInfo(systemInfo, apiKey);
|
|
68
|
+
yield this.addListener(apiKey);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
console.error('Error initializing GoMarketMe:', e);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
addListener(apiKey) {
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
react_native_iap_1.default.purchaseUpdatedListener((purchase) => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
if (this.affiliateCampaignCode) {
|
|
79
|
+
const productIds = yield this.fetchPurchases([purchase], apiKey);
|
|
80
|
+
yield this.fetchPurchaseProducts(productIds, apiKey);
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
getSystemInfo() {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const deviceData = react_native_1.Platform.select({
|
|
88
|
+
ios: yield this.readIosDeviceInfo(),
|
|
89
|
+
android: yield this.readAndroidDeviceInfo(),
|
|
90
|
+
});
|
|
91
|
+
const devicePixelRatio = react_native_1.PixelRatio.get();
|
|
92
|
+
const windowData = {
|
|
93
|
+
devicePixelRatio,
|
|
94
|
+
width: react_native_1.Dimensions.get('window').width * devicePixelRatio,
|
|
95
|
+
height: react_native_1.Dimensions.get('window').height * devicePixelRatio,
|
|
96
|
+
};
|
|
97
|
+
return {
|
|
98
|
+
device_info: deviceData,
|
|
99
|
+
window_info: windowData,
|
|
100
|
+
time_zone_code: this.getTimeZoneCode(),
|
|
101
|
+
language_code: this.getLanguageCode(),
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
postSDKInitialization(apiKey) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
+
try {
|
|
108
|
+
const response = yield axios_1.default.post(this.sdkInitializationUrl, {}, {
|
|
109
|
+
headers: {
|
|
110
|
+
'Content-Type': 'application/json',
|
|
111
|
+
'x-api-key': apiKey,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
if (response.status === 200) {
|
|
115
|
+
yield this.markSDKAsInitialized();
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
console.error('Failed to mark SDK as Initialized. Status code:', response.status);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
console.error('Error sending SDK information to server:', e);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
postSystemInfo(systemInfo, apiKey) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
try {
|
|
129
|
+
const response = yield axios_1.default.post(this.systemInfoUrl, systemInfo, {
|
|
130
|
+
headers: {
|
|
131
|
+
'Content-Type': 'application/json',
|
|
132
|
+
'x-api-key': apiKey,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
if (response.status === 200) {
|
|
136
|
+
const responseData = response.data;
|
|
137
|
+
this.affiliateCampaignCode = responseData.affiliate_campaign_code || this.affiliateCampaignCode;
|
|
138
|
+
this.deviceId = responseData.device_id || this.deviceId;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
console.error('Failed to send system info. Status code:', response.status);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch (e) {
|
|
145
|
+
console.error('Error sending system info to server:', e);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
readAndroidDeviceInfo() {
|
|
150
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
151
|
+
return {
|
|
152
|
+
deviceId: yield react_native_device_info_1.default.getAndroidId(),
|
|
153
|
+
systemName: yield react_native_device_info_1.default.getSystemName(),
|
|
154
|
+
systemVersion: yield react_native_device_info_1.default.getSystemVersion(),
|
|
155
|
+
brand: yield react_native_device_info_1.default.getBrand(),
|
|
156
|
+
model: yield react_native_device_info_1.default.getModel(),
|
|
157
|
+
manufacturer: yield react_native_device_info_1.default.getManufacturer(),
|
|
158
|
+
isEmulator: yield react_native_device_info_1.default.isEmulator(),
|
|
159
|
+
uniqueId: yield react_native_device_info_1.default.getUniqueId(),
|
|
160
|
+
};
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
readIosDeviceInfo() {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
return {
|
|
166
|
+
deviceId: yield react_native_device_info_1.default.getUniqueId(),
|
|
167
|
+
systemName: yield react_native_device_info_1.default.getSystemName(),
|
|
168
|
+
systemVersion: yield react_native_device_info_1.default.getSystemVersion(),
|
|
169
|
+
brand: yield react_native_device_info_1.default.getBrand(),
|
|
170
|
+
model: yield react_native_device_info_1.default.getModel(),
|
|
171
|
+
manufacturer: yield react_native_device_info_1.default.getManufacturer(),
|
|
172
|
+
isEmulator: yield react_native_device_info_1.default.isEmulator(),
|
|
173
|
+
uniqueId: yield react_native_device_info_1.default.getUniqueId(),
|
|
174
|
+
};
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
getTimeZoneCode() {
|
|
178
|
+
const timezoneOffset = new Date().getTimezoneOffset();
|
|
179
|
+
const absOffset = Math.abs(timezoneOffset);
|
|
180
|
+
const hours = Math.floor(absOffset / 60);
|
|
181
|
+
const minutes = absOffset % 60;
|
|
182
|
+
const sign = timezoneOffset > 0 ? '-' : '+';
|
|
183
|
+
return `GMT${sign}${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`;
|
|
184
|
+
}
|
|
185
|
+
getLanguageCode() {
|
|
186
|
+
const locales = RNLocalize.getLocales();
|
|
187
|
+
return locales.length > 0 ? locales[0].languageTag : 'en-US';
|
|
188
|
+
}
|
|
189
|
+
fetchPurchases(purchaseDetailsList, apiKey) {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
191
|
+
const productIds = [];
|
|
192
|
+
for (const purchase of purchaseDetailsList) {
|
|
193
|
+
if (purchase.transactionReceipt) {
|
|
194
|
+
yield this.sendEventToServer(JSON.stringify(this.serializePurchaseDetails(purchase)), 'purchase', apiKey);
|
|
195
|
+
if (purchase.productId && !productIds.includes(purchase.productId)) {
|
|
196
|
+
productIds.push(purchase.productId);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return productIds;
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
fetchPurchaseProducts(productIds, apiKey) {
|
|
204
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
try {
|
|
206
|
+
const products = yield react_native_iap_1.default.getProducts({ skus: productIds });
|
|
207
|
+
if (products.length > 0) {
|
|
208
|
+
for (const product of products) {
|
|
209
|
+
yield this.sendEventToServer(JSON.stringify(this.serializeProductDetails(product)), 'product', apiKey);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
yield this.sendEventToServer(JSON.stringify({ notFoundIDs: productIds.join(',') }), 'product', apiKey);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch (e) {
|
|
217
|
+
console.error('Error fetching products:', e);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
sendEventToServer(body, eventType, apiKey) {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
try {
|
|
224
|
+
const response = yield axios_1.default.post(this.eventUrl, body, {
|
|
225
|
+
headers: {
|
|
226
|
+
'Content-Type': 'application/json',
|
|
227
|
+
'x-affiliate-campaign-code': this.affiliateCampaignCode,
|
|
228
|
+
'x-device-id': this.deviceId,
|
|
229
|
+
'x-event-type': eventType,
|
|
230
|
+
'x-product-type': react_native_1.Platform.OS,
|
|
231
|
+
'x-source-name': react_native_1.Platform.OS === 'android' ? 'google_play' : 'app_store',
|
|
232
|
+
'x-api-key': apiKey,
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
if (response.status === 200) {
|
|
236
|
+
console.log(`${eventType} sent successfully`);
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
console.error(`Failed to send ${eventType}. Status code:`, response.status);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
console.error(`Error sending ${eventType} to server:`, e);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
serializePurchaseDetails(purchase) {
|
|
248
|
+
return {
|
|
249
|
+
productID: purchase.productId,
|
|
250
|
+
purchaseID: purchase.transactionId || '',
|
|
251
|
+
transactionDate: purchase.transactionDate || '',
|
|
252
|
+
status: react_native_1.Platform.select({
|
|
253
|
+
ios: purchase.transactionStateIOS,
|
|
254
|
+
android: purchase.purchaseStateAndroid,
|
|
255
|
+
}),
|
|
256
|
+
verificationData: {
|
|
257
|
+
localVerificationData: purchase.transactionReceipt,
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
serializeProductDetails(product) {
|
|
262
|
+
return {
|
|
263
|
+
productID: product.productId,
|
|
264
|
+
productTitle: product.title,
|
|
265
|
+
productPrice: product.price,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
isSDKInitialized() {
|
|
269
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
const value = yield async_storage_1.default.getItem(this.sdkInitializedKey);
|
|
271
|
+
return value === 'true';
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
markSDKAsInitialized() {
|
|
275
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
276
|
+
yield async_storage_1.default.setItem(this.sdkInitializedKey, 'true');
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
exports.default = GoMarketMe.getInstance();
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gomarketme-react-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Affiliate Marketing for React Native-Based iOS and Android Apps.",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"homepage": "https://gomarketme.co",
|
|
7
8
|
"keywords": [
|
|
8
9
|
"react-native",
|
|
@@ -18,12 +19,16 @@
|
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
20
21
|
"axios": "^1.7.7",
|
|
21
|
-
"react-native": "^0.76.1",
|
|
22
22
|
"react-native-device-info": "^14.0.0",
|
|
23
23
|
"react-native-iap": "^12.15.6",
|
|
24
24
|
"react-native-localize": "^3.2.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"
|
|
27
|
+
"@types/node": "^15.12.5",
|
|
28
|
+
"@types/react-native": "^0.64.12",
|
|
29
|
+
"typescript": "^4.9.5"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": "*"
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -39,7 +39,7 @@ class GoMarketMe {
|
|
|
39
39
|
|
|
40
40
|
private async addListener(apiKey: string): Promise<void> {
|
|
41
41
|
InAppPurchase.purchaseUpdatedListener(async (purchase: Purchase) => {
|
|
42
|
-
if (this.affiliateCampaignCode
|
|
42
|
+
if (this.affiliateCampaignCode) {
|
|
43
43
|
const productIds = await this.fetchPurchases([purchase], apiKey);
|
|
44
44
|
await this.fetchPurchaseProducts(productIds, apiKey);
|
|
45
45
|
}
|
|
@@ -55,7 +55,7 @@ class GoMarketMe {
|
|
|
55
55
|
const devicePixelRatio = PixelRatio.get();
|
|
56
56
|
|
|
57
57
|
const windowData = {
|
|
58
|
-
devicePixelRatio
|
|
58
|
+
devicePixelRatio,
|
|
59
59
|
width: Dimensions.get('window').width * devicePixelRatio,
|
|
60
60
|
height: Dimensions.get('window').height * devicePixelRatio,
|
|
61
61
|
};
|
|
@@ -96,12 +96,8 @@ class GoMarketMe {
|
|
|
96
96
|
});
|
|
97
97
|
if (response.status === 200) {
|
|
98
98
|
const responseData = response.data;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
if (responseData.device_id) {
|
|
103
|
-
this.deviceId = responseData.device_id;
|
|
104
|
-
}
|
|
99
|
+
this.affiliateCampaignCode = responseData.affiliate_campaign_code || this.affiliateCampaignCode;
|
|
100
|
+
this.deviceId = responseData.device_id || this.deviceId;
|
|
105
101
|
} else {
|
|
106
102
|
console.error('Failed to send system info. Status code:', response.status);
|
|
107
103
|
}
|
|
@@ -113,7 +109,6 @@ class GoMarketMe {
|
|
|
113
109
|
private async readAndroidDeviceInfo(): Promise<any> {
|
|
114
110
|
return {
|
|
115
111
|
deviceId: await DeviceInfo.getAndroidId(),
|
|
116
|
-
_deviceId: await DeviceInfo.getDeviceId(),
|
|
117
112
|
systemName: await DeviceInfo.getSystemName(),
|
|
118
113
|
systemVersion: await DeviceInfo.getSystemVersion(),
|
|
119
114
|
brand: await DeviceInfo.getBrand(),
|
|
@@ -125,9 +120,8 @@ class GoMarketMe {
|
|
|
125
120
|
}
|
|
126
121
|
|
|
127
122
|
private async readIosDeviceInfo(): Promise<any> {
|
|
128
|
-
|
|
123
|
+
return {
|
|
129
124
|
deviceId: await DeviceInfo.getUniqueId(),
|
|
130
|
-
_deviceId: await DeviceInfo.getDeviceId(),
|
|
131
125
|
systemName: await DeviceInfo.getSystemName(),
|
|
132
126
|
systemVersion: await DeviceInfo.getSystemVersion(),
|
|
133
127
|
brand: await DeviceInfo.getBrand(),
|
|
@@ -139,15 +133,12 @@ class GoMarketMe {
|
|
|
139
133
|
}
|
|
140
134
|
|
|
141
135
|
private getTimeZoneCode(): string {
|
|
142
|
-
|
|
143
|
-
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
144
|
-
const date = new Date();
|
|
145
|
-
const timezoneOffset = date.getTimezoneOffset(); // in minutes
|
|
136
|
+
const timezoneOffset = new Date().getTimezoneOffset();
|
|
146
137
|
const absOffset = Math.abs(timezoneOffset);
|
|
147
138
|
const hours = Math.floor(absOffset / 60);
|
|
148
139
|
const minutes = absOffset % 60;
|
|
149
140
|
const sign = timezoneOffset > 0 ? '-' : '+';
|
|
150
|
-
return `GMT${sign}${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`;
|
|
141
|
+
return `GMT${sign}${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}`;
|
|
151
142
|
}
|
|
152
143
|
|
|
153
144
|
private getLanguageCode(): string {
|
|
@@ -212,7 +203,7 @@ class GoMarketMe {
|
|
|
212
203
|
purchaseID: purchase.transactionId || '',
|
|
213
204
|
transactionDate: purchase.transactionDate || '',
|
|
214
205
|
status: Platform.select({
|
|
215
|
-
ios: (purchase as any).transactionStateIOS,
|
|
206
|
+
ios: (purchase as any).transactionStateIOS,
|
|
216
207
|
android: (purchase as any).purchaseStateAndroid,
|
|
217
208
|
}),
|
|
218
209
|
verificationData: {
|
|
@@ -225,31 +216,17 @@ class GoMarketMe {
|
|
|
225
216
|
return {
|
|
226
217
|
productID: product.productId,
|
|
227
218
|
productTitle: product.title,
|
|
228
|
-
productDescription: product.description,
|
|
229
219
|
productPrice: product.price,
|
|
230
|
-
productRawPrice: product.price,
|
|
231
|
-
productCurrencyCode: product.currency,
|
|
232
220
|
};
|
|
233
221
|
}
|
|
234
222
|
|
|
235
|
-
private async
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return true;
|
|
239
|
-
} catch (e) {
|
|
240
|
-
console.error('Failed to save SDK initialization:', e);
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
223
|
+
private async isSDKInitialized(): Promise<boolean> {
|
|
224
|
+
const value = await AsyncStorage.getItem(this.sdkInitializedKey);
|
|
225
|
+
return value === 'true';
|
|
243
226
|
}
|
|
244
227
|
|
|
245
|
-
private async
|
|
246
|
-
|
|
247
|
-
const value = await AsyncStorage.getItem(this.sdkInitializedKey);
|
|
248
|
-
return value === 'true';
|
|
249
|
-
} catch (e) {
|
|
250
|
-
console.error('Failed to load SDK initialization:', e);
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
228
|
+
private async markSDKAsInitialized(): Promise<void> {
|
|
229
|
+
await AsyncStorage.setItem(this.sdkInitializedKey, 'true');
|
|
253
230
|
}
|
|
254
231
|
}
|
|
255
232
|
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"outDir": "./dist",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"emitDeclarationOnly": false,
|
|
6
|
+
"declarationMap": true,
|
|
7
|
+
"declarationDir": "./dist",
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"target": "ES6",
|
|
10
|
+
"module": "CommonJS",
|
|
7
11
|
"strict": true,
|
|
8
12
|
"esModuleInterop": true,
|
|
9
13
|
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true
|
|
11
|
-
"outDir": "./dist"
|
|
14
|
+
"forceConsistentCasingInFileNames": true
|
|
12
15
|
},
|
|
13
|
-
"include": ["src/**/*"]
|
|
14
|
-
"exclude": ["node_modules", "**/*.spec.ts"]
|
|
16
|
+
"include": ["src/**/*"]
|
|
15
17
|
}
|