@influto/react-native-sdk 1.0.0 → 1.1.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/lib/InfluTo.js +20 -1
- package/package.json +1 -1
- package/src/InfluTo.ts +20 -1
package/lib/InfluTo.js
CHANGED
|
@@ -37,7 +37,7 @@ const STORAGE_KEYS = {
|
|
|
37
37
|
class InfluToSDK {
|
|
38
38
|
constructor() {
|
|
39
39
|
this.config = null;
|
|
40
|
-
this.apiUrl = 'https://
|
|
40
|
+
this.apiUrl = 'https://influ.to/api';
|
|
41
41
|
this.isInitialized = false;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -117,6 +117,25 @@ class InfluToSDK {
|
|
|
117
117
|
// Store for future use
|
|
118
118
|
await async_storage_1.default.setItem(STORAGE_KEYS.ATTRIBUTION, JSON.stringify(attribution));
|
|
119
119
|
await async_storage_1.default.setItem(STORAGE_KEYS.REFERRAL_CODE, response.referral_code);
|
|
120
|
+
// 🎯 AUTO-INTEGRATION: Set RevenueCat attribute if available
|
|
121
|
+
try {
|
|
122
|
+
// @ts-ignore - RevenueCat might not be installed
|
|
123
|
+
const Purchases = require('react-native-purchases').default;
|
|
124
|
+
if (Purchases && Purchases.setAttributes) {
|
|
125
|
+
await Purchases.setAttributes({
|
|
126
|
+
referral_code: response.referral_code
|
|
127
|
+
});
|
|
128
|
+
if (this.config?.debug) {
|
|
129
|
+
console.log('[InfluTo] ✅ Referral code set in RevenueCat automatically');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
// RevenueCat not installed - that's okay, developer can set manually
|
|
135
|
+
if (this.config?.debug) {
|
|
136
|
+
console.log('[InfluTo] RevenueCat not found - set referral_code manually');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
120
139
|
if (this.config?.debug) {
|
|
121
140
|
console.log('[InfluTo] ✅ Attribution found:', response.referral_code);
|
|
122
141
|
}
|
package/package.json
CHANGED
package/src/InfluTo.ts
CHANGED
|
@@ -41,7 +41,7 @@ const STORAGE_KEYS = {
|
|
|
41
41
|
|
|
42
42
|
class InfluToSDK {
|
|
43
43
|
private config: InfluToConfig | null = null;
|
|
44
|
-
private apiUrl: string = 'https://
|
|
44
|
+
private apiUrl: string = 'https://influ.to/api';
|
|
45
45
|
private isInitialized: boolean = false;
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -132,6 +132,25 @@ class InfluToSDK {
|
|
|
132
132
|
await AsyncStorage.setItem(STORAGE_KEYS.ATTRIBUTION, JSON.stringify(attribution));
|
|
133
133
|
await AsyncStorage.setItem(STORAGE_KEYS.REFERRAL_CODE, response.referral_code);
|
|
134
134
|
|
|
135
|
+
// 🎯 AUTO-INTEGRATION: Set RevenueCat attribute if available
|
|
136
|
+
try {
|
|
137
|
+
// @ts-ignore - RevenueCat might not be installed
|
|
138
|
+
const Purchases = require('react-native-purchases').default;
|
|
139
|
+
if (Purchases && Purchases.setAttributes) {
|
|
140
|
+
await Purchases.setAttributes({
|
|
141
|
+
referral_code: response.referral_code
|
|
142
|
+
});
|
|
143
|
+
if (this.config?.debug) {
|
|
144
|
+
console.log('[InfluTo] ✅ Referral code set in RevenueCat automatically');
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} catch (e) {
|
|
148
|
+
// RevenueCat not installed - that's okay, developer can set manually
|
|
149
|
+
if (this.config?.debug) {
|
|
150
|
+
console.log('[InfluTo] RevenueCat not found - set referral_code manually');
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
135
154
|
if (this.config?.debug) {
|
|
136
155
|
console.log('[InfluTo] ✅ Attribution found:', response.referral_code);
|
|
137
156
|
}
|