gomarketme-react-native 2.0.0 → 4.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  <img src="https://static.gomarketme.net/assets/gmm-icon.png" alt="GoMarketMe"/>
3
3
  <br>
4
4
  <h1>gomarketme-react-native</h1>
5
- <p>Affiliate Marketing for React Native-Based iOS and Android Apps.</p>
5
+ <p>Affiliate marketing for React Native apps on iOS and Android.</p>
6
6
  </div>
7
7
 
8
8
  ## Installation
@@ -10,41 +10,87 @@
10
10
  ### Using npm
11
11
 
12
12
  ```bash
13
- npm install gomarketme-react-native@2.0.0
13
+ npm install gomarketme-react-native@4.0.0
14
14
  ```
15
15
 
16
16
  ### Using yarn
17
17
 
18
18
  ```bash
19
- yarn add gomarketme-react-native@2.0.0
19
+ yarn add gomarketme-react-native@4.0.0
20
20
  ```
21
21
 
22
22
  ### Using pnpm
23
23
 
24
24
  ```bash
25
- pnpm add gomarketme-react-native@2.0.0
25
+ pnpm add gomarketme-react-native@4.0.0
26
26
  ```
27
+ ##
27
28
 
29
+ GoMarketMe is built on top of react-native-iap, so you may also need to install the following packages:
30
+ ```bash
31
+ npm install react-native-iap react-native-nitro-modules
32
+ (or yarn add react-native-iap react-native-nitro-modules)
33
+ (or pnpm add react-native-iap react-native-nitro-modules)
34
+ ```
28
35
 
29
36
  ## Usage
30
37
 
31
- To initialize GoMarketMe, import the `gomarketme` package and create a new instance of `GoMarketMe`:
38
+ ⚙️ Basic Integration
39
+
40
+ To initialize GoMarketMe, import the `gomarketme` package and initialize the SDK with your API key:
32
41
 
33
42
  ```tsx
34
43
  import GoMarketMe from 'gomarketme-react-native';
35
44
 
36
- const App: React.FC = () => {
45
+ useEffect(() => {
46
+
47
+ GoMarketMe.initialize('API_KEY'); // Initialize with your API key
48
+
49
+ }, []);
50
+ ```
51
+
52
+ No further steps needed. The SDK automatically attributes and reports your affiliate sales in real time.
37
53
 
38
- useEffect(() => {
54
+ ⚙️ OR - Advanced Integration
39
55
 
40
- GoMarketMe.initialize('API_KEY'); // Initialize with your API key
56
+ Use this approach for more advanced scenarios, such as:
57
+ - Affiliate-aware paywalls: Offer exclusive pricing or promotions to users acquired through affiliate campaigns.
58
+ - Personalized onboarding: For example, a social or fitness app can automatically make new users follow the influencer who referred them, strengthening engagement and maximizing the affiliate’s impact.
41
59
 
42
- }, []);
43
- };
60
+ ```tsx
61
+ import GoMarketMe from 'gomarketme-react-native';
62
+
63
+ const goMarketMeSDK = GoMarketMe;
64
+ const [affiliateData, setAffiliateData] = useState<GoMarketMeAffiliateMarketingData | null>(null);
65
+
66
+ useEffect(() => {
67
+
68
+ const initGoMarketMe = async () => {
69
+
70
+ await goMarketMeSDK.initialize('API_KEY'); // Initialize with your API key
71
+ const data = goMarketMeSDK.affiliateMarketingData;
72
+
73
+ if (data) { // user acquired through affiliate campaign
74
+
75
+ console.log('Affiliate ID:', data.affiliate?.id); // maps to GoMarketMe > Affiliates > Export > id column
76
+ console.log('Affiliate %:', data.saleDistribution?.affiliatePercentage); // maps to GoMarketMe > Campaigns > [Name] > Affiliate's Revenue Split (%)
77
+ console.log('Campaign ID:', data.campaign?.id); // maps to GoMarketMe > Campaigns > [Name] > id in the URL
78
+
79
+ setAffiliateData(data);
80
+ }
81
+
82
+ };
83
+
84
+ initGoMarketMe();
85
+ }, []);
44
86
  ```
45
87
 
46
- Make sure to replace API_KEY with your actual GoMarketMe API key. You can find it on the product onboarding page and under Profile > API Key.
88
+ Make sure to replace `API_KEY` with your actual GoMarketMe API key. You can find it on the product onboarding page and under **Profile > API Key**.
89
+
90
+ For Expo, go to [https://www.npmjs.com/package/gomarketme-react-native-expo](https://www.npmjs.com/package/gomarketme-react-native-expo).
47
91
 
48
92
  ## Support
49
93
 
50
- If you encounter any problems or issues, please contact us at [integrations@gomarketme.co](mailto:integrations@gomarketme.co) or visit [https://gomarketme.co](https://gomarketme.co).
94
+ Check out our sample React Native app at [https://github.com/GoMarketMe/gomarketme-react-native-sample-app](https://github.com/GoMarketMe/gomarketme-react-native-sample-app).
95
+
96
+ If you run into any issues, please reach out to us at [integrations@gomarketme.co](mailto:integrations@gomarketme.co) or visit [https://gomarketme.co](https://gomarketme.co).
package/dist/index.d.ts CHANGED
@@ -45,25 +45,27 @@ declare class GoMarketMe {
45
45
  private _affiliateCampaignCode;
46
46
  private _deviceId;
47
47
  private _packageName;
48
+ private _purchaseUpdateUnsub?;
49
+ private _purchaseErrorUnsub?;
48
50
  affiliateMarketingData?: GoMarketMeAffiliateMarketingData | null;
49
51
  private constructor();
50
52
  static getInstance(): GoMarketMe;
51
53
  initialize(apiKey: string): Promise<void>;
52
- private _addListener;
54
+ removeListeners(): void;
55
+ private _addListeners;
53
56
  private _getSystemInfo;
54
57
  private _postSDKInitialization;
55
58
  private _postSystemInfo;
56
59
  private _readAndroidDeviceInfo;
57
60
  private _readIosDeviceInfo;
58
- private _getTimeZone;
59
- private _getLanguageCode;
60
61
  private _fetchConsolidatedPurchases;
61
62
  private _sendEventToServer;
62
63
  private _serializePurchaseDetails;
63
64
  private _serializeProductDetails;
64
- private _serializeSubscriptionDetails;
65
65
  private _markSDKAsInitialized;
66
66
  private _isSDKInitialized;
67
+ private _isProduction;
68
+ private _fetchExistingPurchases;
67
69
  }
68
70
  declare const _default: GoMarketMe;
69
71
  export default _default;