gomarketme-react-native 1.1.1 → 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,44 +10,87 @@
10
10
  ### Using npm
11
11
 
12
12
  ```bash
13
- npm install gomarketme-react-native
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
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
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 = () => {
37
- const apiKey = 'YOUR_API_KEY_HERE';
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.
38
53
 
39
- useEffect(() => {
40
- const initializeGoMarketMe = async () => {
41
- await GoMarketMe.initialize(apiKey);
42
- };
54
+ ⚙️ OR - Advanced Integration
43
55
 
44
- initializeGoMarketMe();
45
- }, []);
46
- };
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.
59
+
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
+ }, []);
47
86
  ```
48
87
 
49
- 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).
50
91
 
51
92
  ## Support
52
93
 
53
- 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
@@ -1,30 +1,71 @@
1
+ export declare class GoMarketMeAffiliateMarketingData {
2
+ campaign: Campaign;
3
+ affiliate: Affiliate;
4
+ saleDistribution: SaleDistribution;
5
+ affiliateCampaignCode: string;
6
+ deviceId: string;
7
+ offerCode?: string;
8
+ constructor(campaign: Campaign, affiliate: Affiliate, saleDistribution: SaleDistribution, affiliateCampaignCode: string, deviceId: string, offerCode?: string);
9
+ static fromJson(json: Record<string, any>): GoMarketMeAffiliateMarketingData | null;
10
+ }
11
+ export declare class Campaign {
12
+ id: string;
13
+ name: string;
14
+ status: string;
15
+ type: string;
16
+ publicLinkUrl?: string;
17
+ constructor(id: string, name: string, status: string, type: string, publicLinkUrl?: string);
18
+ static fromJson(json: Record<string, any>): Campaign;
19
+ }
20
+ export declare class Affiliate {
21
+ id: string;
22
+ firstName: string;
23
+ lastName: string;
24
+ countryCode: string;
25
+ instagramAccount: string;
26
+ tiktokAccount: string;
27
+ xAccount: string;
28
+ constructor(id: string, firstName: string, lastName: string, countryCode: string, instagramAccount: string, tiktokAccount: string, xAccount: string);
29
+ static fromJson(json: Record<string, any>): Affiliate;
30
+ }
31
+ export declare class SaleDistribution {
32
+ platformPercentage: string;
33
+ affiliatePercentage: string;
34
+ constructor(platformPercentage: string, affiliatePercentage: string);
35
+ static fromJson(json: Record<string, any>): SaleDistribution;
36
+ }
1
37
  declare class GoMarketMe {
2
38
  private static instance;
39
+ private sdkType;
40
+ private sdkVersion;
3
41
  private sdkInitializedKey;
4
- private affiliateCampaignCode;
5
- private deviceId;
6
42
  private sdkInitializationUrl;
7
43
  private systemInfoUrl;
8
44
  private eventUrl;
45
+ private _affiliateCampaignCode;
46
+ private _deviceId;
47
+ private _packageName;
48
+ private _purchaseUpdateUnsub?;
49
+ private _purchaseErrorUnsub?;
50
+ affiliateMarketingData?: GoMarketMeAffiliateMarketingData | null;
9
51
  private constructor();
10
52
  static getInstance(): GoMarketMe;
11
53
  initialize(apiKey: string): Promise<void>;
12
- private addListener;
13
- private getSystemInfo;
14
- private postSDKInitialization;
15
- private postSystemInfo;
16
- private readAndroidDeviceInfo;
17
- private readIosDeviceInfo;
18
- private getTimeZone;
19
- private getLanguageCode;
20
- private fetchPurchases;
21
- private fetchPurchaseProducts;
22
- private sendEventToServer;
23
- private serializePurchaseDetails;
24
- private serializeProductDetails;
25
- private serializeSubscriptionDetails;
26
- private markSDKAsInitialized;
27
- private isSDKInitialized;
54
+ removeListeners(): void;
55
+ private _addListeners;
56
+ private _getSystemInfo;
57
+ private _postSDKInitialization;
58
+ private _postSystemInfo;
59
+ private _readAndroidDeviceInfo;
60
+ private _readIosDeviceInfo;
61
+ private _fetchConsolidatedPurchases;
62
+ private _sendEventToServer;
63
+ private _serializePurchaseDetails;
64
+ private _serializeProductDetails;
65
+ private _markSDKAsInitialized;
66
+ private _isSDKInitialized;
67
+ private _isProduction;
68
+ private _fetchExistingPurchases;
28
69
  }
29
70
  declare const _default: GoMarketMe;
30
71
  export default _default;