gomarketme-react-native 4.0.0 → 5.0.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/LICENSE +21 -0
- package/README.md +89 -51
- package/android/build.gradle +46 -0
- package/android/libs/core-5.0.0.jar +0 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/co/gomarketme/reactnative/GoMarketMeReactNativeModule.kt +184 -0
- package/android/src/main/java/co/gomarketme/reactnative/GoMarketMeReactNativePackage.kt +16 -0
- package/gomarketme-react-native.podspec +18 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/Info.plist +44 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/GoMarketMeAppleCoreKit +0 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Info.plist +0 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.abi.json +2932 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.package.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.private.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/GoMarketMeAppleCoreKit +0 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Info.plist +0 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.abi.json +2932 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +2932 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +86 -0
- package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/_CodeSignature/CodeResources +101 -0
- package/ios/GoMarketMeReactNative.swift +133 -0
- package/ios/GoMarketMeReactNativeBridge.m +17 -0
- package/{dist → lib}/index.d.ts +27 -30
- package/lib/index.js +172 -0
- package/package.json +41 -18
- package/react-native.config.js +12 -0
- package/.editorconfig +0 -15
- package/.gitattributes +0 -3
- package/.github/actions/setup/action.yml +0 -27
- package/.github/workflows/ci.yml +0 -157
- package/.nvmrc +0 -1
- package/.watchmanconfig +0 -1
- package/.yarn/releases/yarn-4.3.1-git.20240705.hash-35167b2.cjs +0 -894
- package/.yarnrc.yml +0 -5
- package/dist/index.js +0 -544
- package/lefthook.yml +0 -35
- package/src/index.tsx +0 -392
- package/tsconfig.json +0 -19
package/.yarnrc.yml
DELETED
package/dist/index.js
DELETED
|
@@ -1,544 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
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;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.SaleDistribution = exports.Affiliate = exports.Campaign = exports.GoMarketMeAffiliateMarketingData = void 0;
|
|
43
|
-
var react_native_1 = require("react-native");
|
|
44
|
-
var react_native_device_info_1 = __importDefault(require("react-native-device-info"));
|
|
45
|
-
var get_user_locale_1 = __importDefault(require("get-user-locale"));
|
|
46
|
-
var async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
47
|
-
var axios_1 = __importDefault(require("axios"));
|
|
48
|
-
var react_native_iap_1 = require("react-native-iap");
|
|
49
|
-
var GoMarketMeAffiliateMarketingData = /** @class */ (function () {
|
|
50
|
-
function GoMarketMeAffiliateMarketingData(campaign, affiliate, saleDistribution, affiliateCampaignCode, deviceId, offerCode) {
|
|
51
|
-
this.campaign = campaign;
|
|
52
|
-
this.affiliate = affiliate;
|
|
53
|
-
this.saleDistribution = saleDistribution;
|
|
54
|
-
this.affiliateCampaignCode = affiliateCampaignCode;
|
|
55
|
-
this.deviceId = deviceId;
|
|
56
|
-
this.offerCode = offerCode;
|
|
57
|
-
}
|
|
58
|
-
GoMarketMeAffiliateMarketingData.fromJson = function (json) {
|
|
59
|
-
if (!json || Object.keys(json).length === 0)
|
|
60
|
-
return null;
|
|
61
|
-
return new GoMarketMeAffiliateMarketingData(Campaign.fromJson(json.campaign), Affiliate.fromJson(json.affiliate), SaleDistribution.fromJson(json.sale_distribution), json.affiliate_campaign_code || '', json.device_id || '', json.offer_code);
|
|
62
|
-
};
|
|
63
|
-
return GoMarketMeAffiliateMarketingData;
|
|
64
|
-
}());
|
|
65
|
-
exports.GoMarketMeAffiliateMarketingData = GoMarketMeAffiliateMarketingData;
|
|
66
|
-
var Campaign = /** @class */ (function () {
|
|
67
|
-
function Campaign(id, name, status, type, publicLinkUrl) {
|
|
68
|
-
this.id = id;
|
|
69
|
-
this.name = name;
|
|
70
|
-
this.status = status;
|
|
71
|
-
this.type = type;
|
|
72
|
-
this.publicLinkUrl = publicLinkUrl;
|
|
73
|
-
}
|
|
74
|
-
Campaign.fromJson = function (json) {
|
|
75
|
-
return new Campaign((json === null || json === void 0 ? void 0 : json.id) || '', (json === null || json === void 0 ? void 0 : json.name) || '', (json === null || json === void 0 ? void 0 : json.status) || '', (json === null || json === void 0 ? void 0 : json.type) || '', json === null || json === void 0 ? void 0 : json.public_link_url);
|
|
76
|
-
};
|
|
77
|
-
return Campaign;
|
|
78
|
-
}());
|
|
79
|
-
exports.Campaign = Campaign;
|
|
80
|
-
var Affiliate = /** @class */ (function () {
|
|
81
|
-
function Affiliate(id, firstName, lastName, countryCode, instagramAccount, tiktokAccount, xAccount) {
|
|
82
|
-
this.id = id;
|
|
83
|
-
this.firstName = firstName;
|
|
84
|
-
this.lastName = lastName;
|
|
85
|
-
this.countryCode = countryCode;
|
|
86
|
-
this.instagramAccount = instagramAccount;
|
|
87
|
-
this.tiktokAccount = tiktokAccount;
|
|
88
|
-
this.xAccount = xAccount;
|
|
89
|
-
}
|
|
90
|
-
Affiliate.fromJson = function (json) {
|
|
91
|
-
return new Affiliate((json === null || json === void 0 ? void 0 : json.id) || '', (json === null || json === void 0 ? void 0 : json.first_name) || '', (json === null || json === void 0 ? void 0 : json.last_name) || '', (json === null || json === void 0 ? void 0 : json.country_code) || '', (json === null || json === void 0 ? void 0 : json.instagram_account) || '', (json === null || json === void 0 ? void 0 : json.tiktok_account) || '', (json === null || json === void 0 ? void 0 : json.x_account) || '');
|
|
92
|
-
};
|
|
93
|
-
return Affiliate;
|
|
94
|
-
}());
|
|
95
|
-
exports.Affiliate = Affiliate;
|
|
96
|
-
var SaleDistribution = /** @class */ (function () {
|
|
97
|
-
function SaleDistribution(platformPercentage, affiliatePercentage) {
|
|
98
|
-
this.platformPercentage = platformPercentage;
|
|
99
|
-
this.affiliatePercentage = affiliatePercentage;
|
|
100
|
-
}
|
|
101
|
-
SaleDistribution.fromJson = function (json) {
|
|
102
|
-
return new SaleDistribution((json === null || json === void 0 ? void 0 : json.platform_percentage) || '', (json === null || json === void 0 ? void 0 : json.affiliate_percentage) || '');
|
|
103
|
-
};
|
|
104
|
-
return SaleDistribution;
|
|
105
|
-
}());
|
|
106
|
-
exports.SaleDistribution = SaleDistribution;
|
|
107
|
-
var GoMarketMe = /** @class */ (function () {
|
|
108
|
-
function GoMarketMe() {
|
|
109
|
-
this.sdkType = 'ReactNative';
|
|
110
|
-
this.sdkVersion = '4.0.0';
|
|
111
|
-
this.sdkInitializedKey = 'GOMARKETME_SDK_INITIALIZED';
|
|
112
|
-
this.sdkInitializationUrl = 'https://4v9008q1a5.execute-api.us-west-2.amazonaws.com/prod/v1/sdk-initialization';
|
|
113
|
-
this.systemInfoUrl = 'https://4v9008q1a5.execute-api.us-west-2.amazonaws.com/prod/v1/mobile/system-info';
|
|
114
|
-
this.eventUrl = 'https://4v9008q1a5.execute-api.us-west-2.amazonaws.com/prod/v1/event';
|
|
115
|
-
this._affiliateCampaignCode = '';
|
|
116
|
-
this._deviceId = '';
|
|
117
|
-
this._packageName = '';
|
|
118
|
-
}
|
|
119
|
-
GoMarketMe.getInstance = function () {
|
|
120
|
-
if (!GoMarketMe.instance)
|
|
121
|
-
GoMarketMe.instance = new GoMarketMe();
|
|
122
|
-
return GoMarketMe.instance;
|
|
123
|
-
};
|
|
124
|
-
GoMarketMe.prototype.initialize = function (apiKey) {
|
|
125
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
126
|
-
var isSDKInitialized, systemInfo, _a, e_1;
|
|
127
|
-
return __generator(this, function (_b) {
|
|
128
|
-
switch (_b.label) {
|
|
129
|
-
case 0:
|
|
130
|
-
_b.trys.push([0, 7, , 8]);
|
|
131
|
-
return [4 /*yield*/, this._isSDKInitialized()];
|
|
132
|
-
case 1:
|
|
133
|
-
isSDKInitialized = _b.sent();
|
|
134
|
-
if (!!isSDKInitialized) return [3 /*break*/, 3];
|
|
135
|
-
return [4 /*yield*/, this._postSDKInitialization(apiKey)];
|
|
136
|
-
case 2:
|
|
137
|
-
_b.sent();
|
|
138
|
-
_b.label = 3;
|
|
139
|
-
case 3:
|
|
140
|
-
this._packageName = react_native_device_info_1.default.getBundleId();
|
|
141
|
-
return [4 /*yield*/, this._getSystemInfo()];
|
|
142
|
-
case 4:
|
|
143
|
-
systemInfo = _b.sent();
|
|
144
|
-
_a = this;
|
|
145
|
-
return [4 /*yield*/, this._postSystemInfo(systemInfo, apiKey)];
|
|
146
|
-
case 5:
|
|
147
|
-
_a.affiliateMarketingData = _b.sent();
|
|
148
|
-
return [4 /*yield*/, this._addListeners(apiKey)];
|
|
149
|
-
case 6:
|
|
150
|
-
_b.sent();
|
|
151
|
-
this._fetchExistingPurchases(apiKey).catch(function (e) {
|
|
152
|
-
console.log('Error in background purchase fetch:', e);
|
|
153
|
-
});
|
|
154
|
-
return [3 /*break*/, 8];
|
|
155
|
-
case 7:
|
|
156
|
-
e_1 = _b.sent();
|
|
157
|
-
console.log('Error initializing GoMarketMe:', e_1);
|
|
158
|
-
return [3 /*break*/, 8];
|
|
159
|
-
case 8: return [2 /*return*/];
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
};
|
|
164
|
-
GoMarketMe.prototype.removeListeners = function () {
|
|
165
|
-
var _a, _b, _c, _d;
|
|
166
|
-
try {
|
|
167
|
-
(_b = (_a = this._purchaseUpdateUnsub) === null || _a === void 0 ? void 0 : _a.remove) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
168
|
-
(_d = (_c = this._purchaseErrorUnsub) === null || _c === void 0 ? void 0 : _c.remove) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
169
|
-
}
|
|
170
|
-
catch (e) {
|
|
171
|
-
console.log('Error removing listeners:', e);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
GoMarketMe.prototype._addListeners = function (apiKey) {
|
|
175
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
-
var _this = this;
|
|
177
|
-
return __generator(this, function (_a) {
|
|
178
|
-
if (!this._purchaseUpdateUnsub) {
|
|
179
|
-
this._purchaseUpdateUnsub = (0, react_native_iap_1.purchaseUpdatedListener)(function (purchase) { return __awaiter(_this, void 0, void 0, function () {
|
|
180
|
-
var e_2;
|
|
181
|
-
return __generator(this, function (_a) {
|
|
182
|
-
switch (_a.label) {
|
|
183
|
-
case 0:
|
|
184
|
-
_a.trys.push([0, 2, , 3]);
|
|
185
|
-
return [4 /*yield*/, this._fetchConsolidatedPurchases([purchase], apiKey)];
|
|
186
|
-
case 1:
|
|
187
|
-
_a.sent();
|
|
188
|
-
return [3 /*break*/, 3];
|
|
189
|
-
case 2:
|
|
190
|
-
e_2 = _a.sent();
|
|
191
|
-
console.log('purchaseUpdated error:', e_2);
|
|
192
|
-
return [3 /*break*/, 3];
|
|
193
|
-
case 3: return [2 /*return*/];
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
}); });
|
|
197
|
-
}
|
|
198
|
-
if (!this._purchaseErrorUnsub) {
|
|
199
|
-
this._purchaseErrorUnsub = (0, react_native_iap_1.purchaseErrorListener)(function (error) {
|
|
200
|
-
console.log('purchaseErrorListener:', error);
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
return [2 /*return*/];
|
|
204
|
-
});
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
GoMarketMe.prototype._getSystemInfo = function () {
|
|
208
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
209
|
-
var deviceData, _a, devicePixelRatio, dimension;
|
|
210
|
-
var _b;
|
|
211
|
-
return __generator(this, function (_c) {
|
|
212
|
-
switch (_c.label) {
|
|
213
|
-
case 0:
|
|
214
|
-
if (!(react_native_1.Platform.OS === 'ios')) return [3 /*break*/, 2];
|
|
215
|
-
return [4 /*yield*/, this._readIosDeviceInfo()];
|
|
216
|
-
case 1:
|
|
217
|
-
_a = _c.sent();
|
|
218
|
-
return [3 /*break*/, 4];
|
|
219
|
-
case 2: return [4 /*yield*/, this._readAndroidDeviceInfo()];
|
|
220
|
-
case 3:
|
|
221
|
-
_a = _c.sent();
|
|
222
|
-
_c.label = 4;
|
|
223
|
-
case 4:
|
|
224
|
-
deviceData = _a;
|
|
225
|
-
this._deviceId = deviceData['deviceId'] || '';
|
|
226
|
-
devicePixelRatio = react_native_1.PixelRatio.get();
|
|
227
|
-
dimension = react_native_1.Dimensions.get('window');
|
|
228
|
-
_b = {
|
|
229
|
-
device_info: deviceData,
|
|
230
|
-
window_info: {
|
|
231
|
-
devicePixelRatio: devicePixelRatio,
|
|
232
|
-
width: dimension.width * devicePixelRatio,
|
|
233
|
-
height: dimension.height * devicePixelRatio,
|
|
234
|
-
},
|
|
235
|
-
time_zone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
236
|
-
language_code: (0, get_user_locale_1.default)(),
|
|
237
|
-
sdk_type: this.sdkType,
|
|
238
|
-
sdk_version: this.sdkVersion,
|
|
239
|
-
package_name: this._packageName
|
|
240
|
-
};
|
|
241
|
-
return [4 /*yield*/, this._isProduction()];
|
|
242
|
-
case 5: return [2 /*return*/, (_b.is_production = _c.sent(),
|
|
243
|
-
_b)];
|
|
244
|
-
}
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
};
|
|
248
|
-
GoMarketMe.prototype._postSDKInitialization = function (apiKey) {
|
|
249
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
250
|
-
var res, e_3;
|
|
251
|
-
return __generator(this, function (_a) {
|
|
252
|
-
switch (_a.label) {
|
|
253
|
-
case 0:
|
|
254
|
-
_a.trys.push([0, 4, , 5]);
|
|
255
|
-
return [4 /*yield*/, axios_1.default.post(this.sdkInitializationUrl, {}, {
|
|
256
|
-
headers: { 'x-api-key': apiKey },
|
|
257
|
-
})];
|
|
258
|
-
case 1:
|
|
259
|
-
res = _a.sent();
|
|
260
|
-
if (!(res.status === 200)) return [3 /*break*/, 3];
|
|
261
|
-
return [4 /*yield*/, this._markSDKAsInitialized()];
|
|
262
|
-
case 2:
|
|
263
|
-
_a.sent();
|
|
264
|
-
_a.label = 3;
|
|
265
|
-
case 3: return [3 /*break*/, 5];
|
|
266
|
-
case 4:
|
|
267
|
-
e_3 = _a.sent();
|
|
268
|
-
console.log('Error posting SDK initialization:', e_3);
|
|
269
|
-
return [3 /*break*/, 5];
|
|
270
|
-
case 5: return [2 /*return*/];
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
GoMarketMe.prototype._postSystemInfo = function (data, apiKey) {
|
|
276
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
277
|
-
var res, obj, e_4;
|
|
278
|
-
return __generator(this, function (_a) {
|
|
279
|
-
switch (_a.label) {
|
|
280
|
-
case 0:
|
|
281
|
-
_a.trys.push([0, 2, , 3]);
|
|
282
|
-
return [4 /*yield*/, axios_1.default.post(this.systemInfoUrl, data, {
|
|
283
|
-
headers: { 'x-api-key': apiKey },
|
|
284
|
-
})];
|
|
285
|
-
case 1:
|
|
286
|
-
res = _a.sent();
|
|
287
|
-
if (res.status === 200) {
|
|
288
|
-
obj = GoMarketMeAffiliateMarketingData.fromJson(res.data);
|
|
289
|
-
if (obj)
|
|
290
|
-
this._affiliateCampaignCode = obj.affiliateCampaignCode;
|
|
291
|
-
return [2 /*return*/, obj];
|
|
292
|
-
}
|
|
293
|
-
return [3 /*break*/, 3];
|
|
294
|
-
case 2:
|
|
295
|
-
e_4 = _a.sent();
|
|
296
|
-
console.log('Error posting system info:', e_4);
|
|
297
|
-
return [3 /*break*/, 3];
|
|
298
|
-
case 3: return [2 /*return*/, null];
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
});
|
|
302
|
-
};
|
|
303
|
-
GoMarketMe.prototype._readAndroidDeviceInfo = function () {
|
|
304
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
305
|
-
var _a;
|
|
306
|
-
return __generator(this, function (_b) {
|
|
307
|
-
switch (_b.label) {
|
|
308
|
-
case 0:
|
|
309
|
-
_a = {};
|
|
310
|
-
return [4 /*yield*/, react_native_device_info_1.default.getAndroidId()];
|
|
311
|
-
case 1:
|
|
312
|
-
_a.deviceId = _b.sent();
|
|
313
|
-
return [4 /*yield*/, react_native_device_info_1.default.getBrand()];
|
|
314
|
-
case 2:
|
|
315
|
-
_a.brand = _b.sent();
|
|
316
|
-
return [4 /*yield*/, react_native_device_info_1.default.getModel()];
|
|
317
|
-
case 3:
|
|
318
|
-
_a.model = _b.sent();
|
|
319
|
-
return [4 /*yield*/, react_native_device_info_1.default.getManufacturer()];
|
|
320
|
-
case 4:
|
|
321
|
-
_a.manufacturer = _b.sent();
|
|
322
|
-
return [4 /*yield*/, react_native_device_info_1.default.getSystemName()];
|
|
323
|
-
case 5:
|
|
324
|
-
_a.systemName = _b.sent();
|
|
325
|
-
return [4 /*yield*/, react_native_device_info_1.default.getSystemVersion()];
|
|
326
|
-
case 6: return [2 /*return*/, (_a.systemVersion = _b.sent(),
|
|
327
|
-
_a)];
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
};
|
|
332
|
-
GoMarketMe.prototype._readIosDeviceInfo = function () {
|
|
333
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
334
|
-
var _a;
|
|
335
|
-
return __generator(this, function (_b) {
|
|
336
|
-
switch (_b.label) {
|
|
337
|
-
case 0:
|
|
338
|
-
_a = {};
|
|
339
|
-
return [4 /*yield*/, react_native_device_info_1.default.getUniqueId()];
|
|
340
|
-
case 1:
|
|
341
|
-
_a.deviceId = _b.sent();
|
|
342
|
-
return [4 /*yield*/, react_native_device_info_1.default.getBrand()];
|
|
343
|
-
case 2:
|
|
344
|
-
_a.brand = _b.sent();
|
|
345
|
-
return [4 /*yield*/, react_native_device_info_1.default.getModel()];
|
|
346
|
-
case 3:
|
|
347
|
-
_a.model = _b.sent();
|
|
348
|
-
return [4 /*yield*/, react_native_device_info_1.default.getManufacturer()];
|
|
349
|
-
case 4:
|
|
350
|
-
_a.manufacturer = _b.sent();
|
|
351
|
-
return [4 /*yield*/, react_native_device_info_1.default.getSystemName()];
|
|
352
|
-
case 5:
|
|
353
|
-
_a.systemName = _b.sent();
|
|
354
|
-
return [4 /*yield*/, react_native_device_info_1.default.getSystemVersion()];
|
|
355
|
-
case 6: return [2 /*return*/, (_a.systemVersion = _b.sent(),
|
|
356
|
-
_a)];
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
};
|
|
361
|
-
GoMarketMe.prototype._fetchConsolidatedPurchases = function (purchases, apiKey) {
|
|
362
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
363
|
-
var _i, purchases_1, purchase, receipt, data, pid, products, _a, products_1, p, e_5;
|
|
364
|
-
return __generator(this, function (_b) {
|
|
365
|
-
switch (_b.label) {
|
|
366
|
-
case 0:
|
|
367
|
-
_i = 0, purchases_1 = purchases;
|
|
368
|
-
_b.label = 1;
|
|
369
|
-
case 1:
|
|
370
|
-
if (!(_i < purchases_1.length)) return [3 /*break*/, 8];
|
|
371
|
-
purchase = purchases_1[_i];
|
|
372
|
-
receipt = purchase.purchaseToken;
|
|
373
|
-
if (!receipt)
|
|
374
|
-
return [3 /*break*/, 7];
|
|
375
|
-
data = this._serializePurchaseDetails(purchase);
|
|
376
|
-
data.products = [];
|
|
377
|
-
pid = data.productID || '';
|
|
378
|
-
if (!pid) return [3 /*break*/, 5];
|
|
379
|
-
_b.label = 2;
|
|
380
|
-
case 2:
|
|
381
|
-
_b.trys.push([2, 4, , 5]);
|
|
382
|
-
return [4 /*yield*/, (0, react_native_iap_1.fetchProducts)({ skus: [pid] })];
|
|
383
|
-
case 3:
|
|
384
|
-
products = _b.sent();
|
|
385
|
-
if (products && products.length) {
|
|
386
|
-
for (_a = 0, products_1 = products; _a < products_1.length; _a++) {
|
|
387
|
-
p = products_1[_a];
|
|
388
|
-
data.products.push(this._serializeProductDetails(p));
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
return [3 /*break*/, 5];
|
|
392
|
-
case 4:
|
|
393
|
-
e_5 = _b.sent();
|
|
394
|
-
console.warn('Error fetching products:', e_5);
|
|
395
|
-
return [3 /*break*/, 5];
|
|
396
|
-
case 5: return [4 /*yield*/, this._sendEventToServer(JSON.stringify(data), 'purchase_product', apiKey)];
|
|
397
|
-
case 6:
|
|
398
|
-
_b.sent();
|
|
399
|
-
_b.label = 7;
|
|
400
|
-
case 7:
|
|
401
|
-
_i++;
|
|
402
|
-
return [3 /*break*/, 1];
|
|
403
|
-
case 8: return [2 /*return*/];
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
};
|
|
408
|
-
GoMarketMe.prototype._sendEventToServer = function (body, eventType, apiKey) {
|
|
409
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
410
|
-
var e_6;
|
|
411
|
-
return __generator(this, function (_a) {
|
|
412
|
-
switch (_a.label) {
|
|
413
|
-
case 0:
|
|
414
|
-
_a.trys.push([0, 2, , 3]);
|
|
415
|
-
return [4 /*yield*/, axios_1.default.post(this.eventUrl, body, {
|
|
416
|
-
headers: {
|
|
417
|
-
'x-affiliate-campaign-code': this._affiliateCampaignCode,
|
|
418
|
-
'x-device-id': this._deviceId,
|
|
419
|
-
'x-event-type': eventType,
|
|
420
|
-
'x-product-type': react_native_1.Platform.OS,
|
|
421
|
-
'x-source-name': react_native_1.Platform.OS === 'android' ? 'google_play' : 'app_store',
|
|
422
|
-
'x-api-key': apiKey,
|
|
423
|
-
},
|
|
424
|
-
})];
|
|
425
|
-
case 1:
|
|
426
|
-
_a.sent();
|
|
427
|
-
console.log("".concat(eventType, " sent successfully"));
|
|
428
|
-
return [3 /*break*/, 3];
|
|
429
|
-
case 2:
|
|
430
|
-
e_6 = _a.sent();
|
|
431
|
-
console.log("Error sending ".concat(eventType, ":"), e_6);
|
|
432
|
-
return [3 /*break*/, 3];
|
|
433
|
-
case 3: return [2 /*return*/];
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
};
|
|
438
|
-
GoMarketMe.prototype._serializePurchaseDetails = function (purchase) {
|
|
439
|
-
return {
|
|
440
|
-
packageName: this._packageName,
|
|
441
|
-
productID: purchase.productId,
|
|
442
|
-
purchaseID: purchase.id,
|
|
443
|
-
transactionDate: purchase.transactionDate,
|
|
444
|
-
verificationData: {
|
|
445
|
-
localVerificationData: purchase.purchaseToken,
|
|
446
|
-
source: react_native_1.Platform.OS === 'android' ? 'google_play' : 'app_store',
|
|
447
|
-
},
|
|
448
|
-
};
|
|
449
|
-
};
|
|
450
|
-
GoMarketMe.prototype._serializeProductDetails = function (product) {
|
|
451
|
-
return {
|
|
452
|
-
packageName: this._packageName,
|
|
453
|
-
productID: product.id,
|
|
454
|
-
productTitle: product.title,
|
|
455
|
-
productDescription: product.description,
|
|
456
|
-
productPrice: product.displayPrice,
|
|
457
|
-
productRawPrice: product.price || '',
|
|
458
|
-
productCurrencyCode: product.currency,
|
|
459
|
-
};
|
|
460
|
-
};
|
|
461
|
-
GoMarketMe.prototype._markSDKAsInitialized = function () {
|
|
462
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
463
|
-
return __generator(this, function (_a) {
|
|
464
|
-
switch (_a.label) {
|
|
465
|
-
case 0: return [4 /*yield*/, async_storage_1.default.setItem(this.sdkInitializedKey, 'true')];
|
|
466
|
-
case 1:
|
|
467
|
-
_a.sent();
|
|
468
|
-
return [2 /*return*/];
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
});
|
|
472
|
-
};
|
|
473
|
-
GoMarketMe.prototype._isSDKInitialized = function () {
|
|
474
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
475
|
-
var val;
|
|
476
|
-
return __generator(this, function (_a) {
|
|
477
|
-
switch (_a.label) {
|
|
478
|
-
case 0: return [4 /*yield*/, async_storage_1.default.getItem(this.sdkInitializedKey)];
|
|
479
|
-
case 1:
|
|
480
|
-
val = _a.sent();
|
|
481
|
-
return [2 /*return*/, val === 'true'];
|
|
482
|
-
}
|
|
483
|
-
});
|
|
484
|
-
});
|
|
485
|
-
};
|
|
486
|
-
GoMarketMe.prototype._isProduction = function () {
|
|
487
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
488
|
-
var installer, error_1;
|
|
489
|
-
return __generator(this, function (_a) {
|
|
490
|
-
switch (_a.label) {
|
|
491
|
-
case 0:
|
|
492
|
-
if (__DEV__)
|
|
493
|
-
return [2 /*return*/, false];
|
|
494
|
-
_a.label = 1;
|
|
495
|
-
case 1:
|
|
496
|
-
_a.trys.push([1, 3, , 4]);
|
|
497
|
-
return [4 /*yield*/, react_native_device_info_1.default.getInstallerPackageName()];
|
|
498
|
-
case 2:
|
|
499
|
-
installer = _a.sent();
|
|
500
|
-
if (installer === 'com.android.vending' ||
|
|
501
|
-
installer === 'com.amazon.venezia') {
|
|
502
|
-
return [2 /*return*/, true];
|
|
503
|
-
}
|
|
504
|
-
if (installer == null && !__DEV__) {
|
|
505
|
-
return [2 /*return*/, true];
|
|
506
|
-
}
|
|
507
|
-
return [2 /*return*/, false];
|
|
508
|
-
case 3:
|
|
509
|
-
error_1 = _a.sent();
|
|
510
|
-
console.warn('Error determining production status:', error_1);
|
|
511
|
-
return [2 /*return*/, false];
|
|
512
|
-
case 4: return [2 /*return*/];
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
});
|
|
516
|
-
};
|
|
517
|
-
GoMarketMe.prototype._fetchExistingPurchases = function (apiKey) {
|
|
518
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
519
|
-
var purchases, e_7;
|
|
520
|
-
return __generator(this, function (_a) {
|
|
521
|
-
switch (_a.label) {
|
|
522
|
-
case 0:
|
|
523
|
-
_a.trys.push([0, 4, , 5]);
|
|
524
|
-
return [4 /*yield*/, (0, react_native_iap_1.getAvailablePurchases)()];
|
|
525
|
-
case 1:
|
|
526
|
-
purchases = _a.sent();
|
|
527
|
-
if (!(purchases && purchases.length > 0)) return [3 /*break*/, 3];
|
|
528
|
-
return [4 /*yield*/, this._fetchConsolidatedPurchases(purchases, apiKey)];
|
|
529
|
-
case 2:
|
|
530
|
-
_a.sent();
|
|
531
|
-
_a.label = 3;
|
|
532
|
-
case 3: return [3 /*break*/, 5];
|
|
533
|
-
case 4:
|
|
534
|
-
e_7 = _a.sent();
|
|
535
|
-
console.log('Error fetching existing purchases on app open:', e_7);
|
|
536
|
-
return [3 /*break*/, 5];
|
|
537
|
-
case 5: return [2 /*return*/];
|
|
538
|
-
}
|
|
539
|
-
});
|
|
540
|
-
});
|
|
541
|
-
};
|
|
542
|
-
return GoMarketMe;
|
|
543
|
-
}());
|
|
544
|
-
exports.default = GoMarketMe.getInstance();
|
package/lefthook.yml
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# EXAMPLE USAGE:
|
|
2
|
-
#
|
|
3
|
-
# Refer for explanation to following link:
|
|
4
|
-
# https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
|
|
5
|
-
#
|
|
6
|
-
# pre-push:
|
|
7
|
-
# commands:
|
|
8
|
-
# packages-audit:
|
|
9
|
-
# tags: frontend security
|
|
10
|
-
# run: yarn audit
|
|
11
|
-
# gems-audit:
|
|
12
|
-
# tags: backend security
|
|
13
|
-
# run: bundle audit
|
|
14
|
-
#
|
|
15
|
-
# pre-commit:
|
|
16
|
-
# parallel: true
|
|
17
|
-
# commands:
|
|
18
|
-
# eslint:
|
|
19
|
-
# glob: "*.{js,ts,jsx,tsx}"
|
|
20
|
-
# run: yarn eslint {staged_files}
|
|
21
|
-
# rubocop:
|
|
22
|
-
# tags: backend style
|
|
23
|
-
# glob: "*.rb"
|
|
24
|
-
# exclude: '(^|/)(application|routes)\.rb$'
|
|
25
|
-
# run: bundle exec rubocop --force-exclusion {all_files}
|
|
26
|
-
# govet:
|
|
27
|
-
# tags: backend style
|
|
28
|
-
# files: git ls-files -m
|
|
29
|
-
# glob: "*.go"
|
|
30
|
-
# run: go vet {files}
|
|
31
|
-
# scripts:
|
|
32
|
-
# "hello.js":
|
|
33
|
-
# runner: node
|
|
34
|
-
# "any.go":
|
|
35
|
-
# runner: go run
|