gomarketme-react-native 4.0.1 → 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.
Files changed (36) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +89 -51
  3. package/android/build.gradle +46 -0
  4. package/android/libs/core-5.0.0.jar +0 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/java/co/gomarketme/reactnative/GoMarketMeReactNativeModule.kt +184 -0
  7. package/android/src/main/java/co/gomarketme/reactnative/GoMarketMeReactNativePackage.kt +16 -0
  8. package/gomarketme-react-native.podspec +18 -0
  9. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/Info.plist +44 -0
  10. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/GoMarketMeAppleCoreKit +0 -0
  11. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Info.plist +0 -0
  12. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.abi.json +2932 -0
  13. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.package.swiftinterface +86 -0
  14. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.private.swiftinterface +86 -0
  15. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  16. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios.swiftinterface +86 -0
  17. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/GoMarketMeAppleCoreKit +0 -0
  18. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Info.plist +0 -0
  19. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.abi.json +2932 -0
  20. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.package.swiftinterface +86 -0
  21. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +86 -0
  22. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +86 -0
  24. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +2932 -0
  25. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.package.swiftinterface +86 -0
  26. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +86 -0
  27. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  28. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/Modules/GoMarketMeAppleCoreKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +86 -0
  29. package/ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework/_CodeSignature/CodeResources +101 -0
  30. package/ios/GoMarketMeReactNative.swift +133 -0
  31. package/ios/GoMarketMeReactNativeBridge.m +17 -0
  32. package/{dist → lib}/index.d.ts +27 -30
  33. package/lib/index.js +172 -0
  34. package/package.json +27 -17
  35. package/react-native.config.js +12 -0
  36. package/dist/index.js +0 -544
package/lib/index.js ADDED
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SaleDistribution = exports.Affiliate = exports.Campaign = exports.GoMarketMeAffiliateMarketingData = void 0;
4
+ const react_native_1 = require("react-native");
5
+ const LINKING_ERROR = "The native GoMarketMe module is not linked. Make sure you rebuilt your app after installing gomarketme-react-native.";
6
+ class GoMarketMeAffiliateMarketingData {
7
+ constructor(campaign, affiliate, saleDistribution, affiliateCampaignCode, deviceId, offerCode) {
8
+ this.campaign = campaign;
9
+ this.affiliate = affiliate;
10
+ this.saleDistribution = saleDistribution;
11
+ this.affiliateCampaignCode = affiliateCampaignCode;
12
+ this.deviceId = deviceId;
13
+ this.offerCode = offerCode;
14
+ }
15
+ static fromJson(json) {
16
+ if (!json || Object.keys(json).length === 0) {
17
+ return null;
18
+ }
19
+ return new GoMarketMeAffiliateMarketingData(Campaign.fromJson(asRecord(json.campaign)), Affiliate.fromJson(asRecord(json.affiliate)), SaleDistribution.fromJson(asRecord(json.sale_distribution)), asString(json.affiliate_campaign_code), asString(json.device_id), json.offer_code == null ? undefined : String(json.offer_code));
20
+ }
21
+ toJson() {
22
+ return {
23
+ campaign: this.campaign.toJson(),
24
+ affiliate: this.affiliate.toJson(),
25
+ sale_distribution: this.saleDistribution.toJson(),
26
+ affiliate_campaign_code: this.affiliateCampaignCode,
27
+ device_id: this.deviceId,
28
+ offer_code: this.offerCode,
29
+ };
30
+ }
31
+ }
32
+ exports.GoMarketMeAffiliateMarketingData = GoMarketMeAffiliateMarketingData;
33
+ class Campaign {
34
+ constructor(id, name, status, type, publicLinkUrl) {
35
+ this.id = id;
36
+ this.name = name;
37
+ this.status = status;
38
+ this.type = type;
39
+ this.publicLinkUrl = publicLinkUrl;
40
+ }
41
+ static fromJson(json) {
42
+ return new Campaign(asString(json.id), asString(json.name), asString(json.status), asString(json.type), json.public_link_url == null ? undefined : String(json.public_link_url));
43
+ }
44
+ toJson() {
45
+ return {
46
+ id: this.id,
47
+ name: this.name,
48
+ status: this.status,
49
+ type: this.type,
50
+ public_link_url: this.publicLinkUrl,
51
+ };
52
+ }
53
+ }
54
+ exports.Campaign = Campaign;
55
+ class Affiliate {
56
+ constructor(id, firstName, lastName, countryCode, instagramAccount, tiktokAccount, xAccount) {
57
+ this.id = id;
58
+ this.firstName = firstName;
59
+ this.lastName = lastName;
60
+ this.countryCode = countryCode;
61
+ this.instagramAccount = instagramAccount;
62
+ this.tiktokAccount = tiktokAccount;
63
+ this.xAccount = xAccount;
64
+ }
65
+ static fromJson(json) {
66
+ return new Affiliate(asString(json.id), asString(json.first_name), asString(json.last_name), asString(json.country_code), asString(json.instagram_account), asString(json.tiktok_account), asString(json.x_account));
67
+ }
68
+ toJson() {
69
+ return {
70
+ id: this.id,
71
+ first_name: this.firstName,
72
+ last_name: this.lastName,
73
+ country_code: this.countryCode,
74
+ instagram_account: this.instagramAccount,
75
+ tiktok_account: this.tiktokAccount,
76
+ x_account: this.xAccount,
77
+ };
78
+ }
79
+ }
80
+ exports.Affiliate = Affiliate;
81
+ class SaleDistribution {
82
+ constructor(platformPercentage, affiliatePercentage) {
83
+ this.platformPercentage = platformPercentage;
84
+ this.affiliatePercentage = affiliatePercentage;
85
+ }
86
+ static fromJson(json) {
87
+ return new SaleDistribution(asString(json.platform_percentage), asString(json.affiliate_percentage));
88
+ }
89
+ toJson() {
90
+ return {
91
+ platform_percentage: this.platformPercentage,
92
+ affiliate_percentage: this.affiliatePercentage,
93
+ };
94
+ }
95
+ }
96
+ exports.SaleDistribution = SaleDistribution;
97
+ class GoMarketMe {
98
+ constructor() {
99
+ this.sdkType = 'ReactNative';
100
+ this.sdkVersion = '5.0.0';
101
+ this.isInitializing = false;
102
+ this.isInitialized = false;
103
+ }
104
+ static getInstance() {
105
+ if (!GoMarketMe.instance) {
106
+ GoMarketMe.instance = new GoMarketMe();
107
+ }
108
+ return GoMarketMe.instance;
109
+ }
110
+ get initialized() {
111
+ return this.isInitialized;
112
+ }
113
+ async initialize(apiKey) {
114
+ var _a;
115
+ const trimmedApiKey = apiKey.trim();
116
+ if (!trimmedApiKey) {
117
+ log('Initialization skipped because apiKey is empty.');
118
+ return;
119
+ }
120
+ if (this.isInitialized || this.isInitializing) {
121
+ log('Initialization skipped because SDK is already initialized or initializing.');
122
+ return;
123
+ }
124
+ this.isInitializing = true;
125
+ try {
126
+ const response = await nativeModule().initialize(trimmedApiKey, this.sdkType, this.sdkVersion, !__DEV__);
127
+ this.affiliateMarketingData = GoMarketMeAffiliateMarketingData.fromJson((_a = response.affiliateMarketingData) !== null && _a !== void 0 ? _a : null);
128
+ this.isInitialized = true;
129
+ }
130
+ catch (error) {
131
+ log(`Error initializing GoMarketMe: ${String(error)}`);
132
+ }
133
+ finally {
134
+ this.isInitializing = false;
135
+ }
136
+ }
137
+ async syncAllTransactions() {
138
+ if (!this.isInitialized) {
139
+ throw new Error('GoMarketMe SDK must be initialized before syncing transactions.');
140
+ }
141
+ const syncAllTransactions = nativeModule().syncAllTransactions;
142
+ if (typeof syncAllTransactions !== 'function') {
143
+ throw new Error('GoMarketMe transaction sync is not available in the linked native module.');
144
+ }
145
+ return syncAllTransactions();
146
+ }
147
+ stop() {
148
+ var _a, _b;
149
+ (_b = (_a = nativeModule()).stop) === null || _b === void 0 ? void 0 : _b.call(_a);
150
+ this.isInitialized = false;
151
+ this.isInitializing = false;
152
+ }
153
+ }
154
+ function nativeModule() {
155
+ const module = react_native_1.NativeModules.GoMarketMeReactNative;
156
+ if (!module) {
157
+ throw new Error(LINKING_ERROR);
158
+ }
159
+ return module;
160
+ }
161
+ function log(message) {
162
+ if (__DEV__) {
163
+ console.log(`[GoMarketMe] ${message}`);
164
+ }
165
+ }
166
+ function asRecord(value) {
167
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
168
+ }
169
+ function asString(value) {
170
+ return value == null ? '' : String(value);
171
+ }
172
+ exports.default = GoMarketMe.getInstance();
package/package.json CHANGED
@@ -1,21 +1,38 @@
1
1
  {
2
2
  "name": "gomarketme-react-native",
3
- "version": "4.0.1",
4
- "description": "Affiliate Marketing for React Native-Based iOS and Android Apps.",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
3
+ "version": "5.0.0",
4
+ "description": "Affiliate Marketing for React Native and Expo iOS and Android apps.",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "react-native": "lib/index.js",
8
+ "files": [
9
+ "lib",
10
+ "ios/GoMarketMeReactNative.swift",
11
+ "ios/GoMarketMeReactNativeBridge.m",
12
+ "ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/Info.plist",
13
+ "ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64/GoMarketMeAppleCoreKit.framework",
14
+ "ios/Frameworks/GoMarketMeAppleCoreKit.xcframework/ios-arm64_x86_64-simulator/GoMarketMeAppleCoreKit.framework",
15
+ "android/build.gradle",
16
+ "android/src",
17
+ "android/libs/core-5.0.0.jar",
18
+ "gomarketme-react-native.podspec",
19
+ "react-native.config.js",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
7
23
  "repository": {
8
24
  "type": "git",
9
25
  "url": "https://github.com/GoMarketMe/gomarketme-react-native.git"
10
26
  },
11
27
  "scripts": {
12
28
  "build": "tsc",
13
- "prepublishOnly": "npm run build",
14
- "test": "echo \"Error: no test specified\" && exit 1"
29
+ "clean": "rm -rf lib",
30
+ "prepack": "npm run build"
15
31
  },
16
32
  "homepage": "https://gomarketme.co",
17
33
  "keywords": [
18
34
  "react-native",
35
+ "expo",
19
36
  "affiliate-marketing",
20
37
  "influencer-marketing",
21
38
  "in-app-purchases",
@@ -30,21 +47,14 @@
30
47
  ],
31
48
  "author": "GoMarketMe",
32
49
  "license": "MIT",
33
- "dependencies": {
34
- "@react-native-async-storage/async-storage": "^2.2.0",
35
- "axios": "^1.13.2",
36
- "get-user-locale": "^3.0.0",
37
- "react-native-device-info": "^14.1.1",
38
- "react-native-iap": "^14.4.38",
39
- "react-native-nitro-modules": "^0.31.4"
40
- },
41
50
  "devDependencies": {
42
- "@types/node": "^24.10.0",
43
- "@types/react-native": "^0.73.0",
51
+ "@types/react": "*",
52
+ "react": "*",
53
+ "react-native": "*",
44
54
  "typescript": "^5.9.3"
45
55
  },
46
56
  "peerDependencies": {
47
57
  "react": "*",
48
58
  "react-native": "*"
49
59
  }
50
- }
60
+ }
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ sourceDir: './android',
6
+ packageImportPath: 'import co.gomarketme.reactnative.GoMarketMeReactNativePackage;',
7
+ packageInstance: 'new GoMarketMeReactNativePackage()',
8
+ },
9
+ ios: {},
10
+ },
11
+ },
12
+ };