gomarketme-react-native 1.0.15 → 1.0.17

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.
Files changed (3) hide show
  1. package/dist/index.js +23 -60
  2. package/package.json +5 -12
  3. package/src/index.tsx +20 -20
package/dist/index.js CHANGED
@@ -1,27 +1,4 @@
1
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
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -32,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
9
  });
33
10
  };
34
11
  var __generator = (this && this.__generator) || function (thisArg, body) {
35
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
14
  function verb(n) { return function (v) { return step([n, v]); }; }
38
15
  function step(op) {
39
16
  if (f) throw new TypeError("Generator is already executing.");
@@ -64,8 +41,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
64
41
  Object.defineProperty(exports, "__esModule", { value: true });
65
42
  var react_native_1 = require("react-native");
66
43
  var react_native_device_info_1 = __importDefault(require("react-native-device-info"));
67
- var RNLocalize = __importStar(require("react-native-localize"));
68
- var async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
69
44
  var react_native_iap_1 = __importDefault(require("react-native-iap"));
70
45
  var axios_1 = __importDefault(require("axios"));
71
46
  var GoMarketMe = /** @class */ (function () {
@@ -335,9 +310,9 @@ var GoMarketMe = /** @class */ (function () {
335
310
  return "GMT".concat(sign).concat(String(hours).padStart(2, '0'), ":").concat(String(minutes).padStart(2, '0')); // Return GMT format
336
311
  };
337
312
  GoMarketMe.prototype.getLanguageCode = function () {
338
- var locales = RNLocalize.getLocales();
339
- // Check if there are any locales available and return the first one or default to 'en-US'
340
- return locales.length > 0 ? locales[0].languageTag : 'en-US';
313
+ //const locales = RNLocalize.getLocales();
314
+ //return locales.length > 0 ? locales[0].languageTag : 'en-US';
315
+ return 'en-US';
341
316
  };
342
317
  GoMarketMe.prototype.fetchPurchases = function (purchaseDetailsList, apiKey) {
343
318
  return __awaiter(this, void 0, void 0, function () {
@@ -374,7 +349,7 @@ var GoMarketMe = /** @class */ (function () {
374
349
  switch (_a.label) {
375
350
  case 0:
376
351
  _a.trys.push([0, 9, , 10]);
377
- return [4 /*yield*/, react_native_iap_1.default.getProducts(productIds)];
352
+ return [4 /*yield*/, react_native_iap_1.default.getProducts({ skus: productIds })];
378
353
  case 1:
379
354
  products = _a.sent();
380
355
  if (!(products.length > 0)) return [3 /*break*/, 6];
@@ -447,7 +422,7 @@ var GoMarketMe = /** @class */ (function () {
447
422
  purchaseID: purchase.transactionId || '',
448
423
  transactionDate: purchase.transactionDate || '',
449
424
  status: react_native_1.Platform.select({
450
- ios: purchase.transactionStateIOS,
425
+ ios: purchase.transactionStateIOS, // Removed non-existent properties
451
426
  android: purchase.purchaseStateAndroid,
452
427
  }),
453
428
  verificationData: {
@@ -467,41 +442,29 @@ var GoMarketMe = /** @class */ (function () {
467
442
  };
468
443
  GoMarketMe.prototype.markSDKAsInitialized = function () {
469
444
  return __awaiter(this, void 0, void 0, function () {
470
- var e_6;
471
445
  return __generator(this, function (_a) {
472
- switch (_a.label) {
473
- case 0:
474
- _a.trys.push([0, 2, , 3]);
475
- return [4 /*yield*/, async_storage_1.default.setItem(this.sdkInitializedKey, 'true')];
476
- case 1:
477
- _a.sent();
478
- return [2 /*return*/, true];
479
- case 2:
480
- e_6 = _a.sent();
481
- console.error('Failed to save SDK initialization:', e_6);
482
- return [2 /*return*/, false];
483
- case 3: return [2 /*return*/];
484
- }
446
+ // try {
447
+ // await AsyncStorage.setItem(this.sdkInitializedKey, 'true');
448
+ // return true;
449
+ // } catch (e) {
450
+ // console.error('Failed to save SDK initialization:', e);
451
+ // return false;
452
+ // }
453
+ return [2 /*return*/, true];
485
454
  });
486
455
  });
487
456
  };
488
457
  GoMarketMe.prototype.isSDKInitialized = function () {
489
458
  return __awaiter(this, void 0, void 0, function () {
490
- var value, e_7;
491
459
  return __generator(this, function (_a) {
492
- switch (_a.label) {
493
- case 0:
494
- _a.trys.push([0, 2, , 3]);
495
- return [4 /*yield*/, async_storage_1.default.getItem(this.sdkInitializedKey)];
496
- case 1:
497
- value = _a.sent();
498
- return [2 /*return*/, value === 'true'];
499
- case 2:
500
- e_7 = _a.sent();
501
- console.error('Failed to load SDK initialization:', e_7);
502
- return [2 /*return*/, false];
503
- case 3: return [2 /*return*/];
504
- }
460
+ // try {
461
+ // const value = await AsyncStorage.getItem(this.sdkInitializedKey);
462
+ // return value === 'true';
463
+ // } catch (e) {
464
+ // console.error('Failed to load SDK initialization:', e);
465
+ // return false;
466
+ // }
467
+ return [2 /*return*/, false];
505
468
  });
506
469
  });
507
470
  };
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "gomarketme-react-native",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "description": "Affiliate Marketing for React Native-Based iOS and Android Apps.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
- "prepublishOnly": "yarn build",
9
+ "prepublishOnly": "npm run build",
10
10
  "test": "echo \"Error: no test specified\" && exit 1"
11
11
  },
12
12
  "homepage": "https://gomarketme.co",
@@ -18,19 +18,12 @@
18
18
  "author": "GoMarketMe",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@react-native-async-storage/async-storage": "^1.15.6",
22
21
  "axios": "^1.7.7",
23
22
  "react-native-device-info": "^14.0.0",
24
- "react-native-iap": "^7.0.0",
25
- "react-native-localize": "^3.2.1"
26
- },
27
- "devDependencies": {
28
- "@types/node": "^15.12.5",
29
- "@types/react-native": "^0.64.12",
30
- "typescript": "^4.3.5"
23
+ "react-native-iap": ">=7.0.0"
31
24
  },
32
25
  "peerDependencies": {
33
- "react": "*",
34
- "react-native": "*"
26
+ "react": "^18.3.1",
27
+ "react-native": "^0.76.1"
35
28
  }
36
29
  }
package/src/index.tsx CHANGED
@@ -1,7 +1,5 @@
1
1
  import { Platform, Dimensions, PixelRatio } from 'react-native';
2
2
  import DeviceInfo from 'react-native-device-info';
3
- import * as RNLocalize from 'react-native-localize';
4
- import AsyncStorage from '@react-native-async-storage/async-storage';
5
3
  import InAppPurchase, { Purchase, Product, ProductPurchase } from 'react-native-iap';
6
4
  import axios from 'axios';
7
5
 
@@ -151,9 +149,9 @@ class GoMarketMe {
151
149
  }
152
150
 
153
151
  private getLanguageCode(): string {
154
- const locales = RNLocalize.getLocales();
155
- // Check if there are any locales available and return the first one or default to 'en-US'
156
- return locales.length > 0 ? locales[0].languageTag : 'en-US';
152
+ //const locales = RNLocalize.getLocales();
153
+ //return locales.length > 0 ? locales[0].languageTag : 'en-US';
154
+ return 'en-US';
157
155
  }
158
156
 
159
157
  private async fetchPurchases(purchaseDetailsList: Purchase[], apiKey: string): Promise<string[]> {
@@ -171,7 +169,7 @@ class GoMarketMe {
171
169
 
172
170
  private async fetchPurchaseProducts(productIds: string[], apiKey: string): Promise<void> {
173
171
  try {
174
- const products = await InAppPurchase.getProducts(productIds);
172
+ const products = await InAppPurchase.getProducts({skus:productIds});
175
173
  if (products.length > 0) {
176
174
  for (const product of products) {
177
175
  await this.sendEventToServer(JSON.stringify(this.serializeProductDetails(product)), 'product', apiKey);
@@ -234,23 +232,25 @@ class GoMarketMe {
234
232
  }
235
233
 
236
234
  private async markSDKAsInitialized(): Promise<boolean> {
237
- try {
238
- await AsyncStorage.setItem(this.sdkInitializedKey, 'true');
239
- return true;
240
- } catch (e) {
241
- console.error('Failed to save SDK initialization:', e);
242
- return false;
243
- }
235
+ // try {
236
+ // await AsyncStorage.setItem(this.sdkInitializedKey, 'true');
237
+ // return true;
238
+ // } catch (e) {
239
+ // console.error('Failed to save SDK initialization:', e);
240
+ // return false;
241
+ // }
242
+ return true;
244
243
  }
245
244
 
246
245
  private async isSDKInitialized(): Promise<boolean> {
247
- try {
248
- const value = await AsyncStorage.getItem(this.sdkInitializedKey);
249
- return value === 'true';
250
- } catch (e) {
251
- console.error('Failed to load SDK initialization:', e);
252
- return false;
253
- }
246
+ // try {
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
+ // }
253
+ return false;
254
254
  }
255
255
  }
256
256