insert-affiliate-react-native-sdk 1.13.0 → 1.14.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/dist/DeepLinkIapProvider.js +17 -14
- package/package.json +1 -1
- package/src/DeepLinkIapProvider.tsx +16 -12
|
@@ -56,6 +56,7 @@ const ASYNC_KEYS = {
|
|
|
56
56
|
AFFILIATE_STORED_DATE: '@app_affiliate_stored_date',
|
|
57
57
|
SDK_INIT_REPORTED: '@app_sdk_init_reported',
|
|
58
58
|
REPORTED_AFFILIATE_ASSOCIATIONS: '@app_reported_affiliate_associations',
|
|
59
|
+
SYSTEM_INFO_SENT: '@app_system_info_sent',
|
|
59
60
|
};
|
|
60
61
|
// STARTING CONTEXT IMPLEMENTATION
|
|
61
62
|
exports.DeepLinkIapContext = (0, react_1.createContext)({
|
|
@@ -151,12 +152,20 @@ const DeepLinkIapProvider = ({ children, }) => {
|
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
if (insertLinksEnabledParam && react_native_1.Platform.OS === 'ios') {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
const systemInfoSent = yield getValueFromAsync(ASYNC_KEYS.SYSTEM_INFO_SENT);
|
|
156
|
+
verboseLog(`System info sent flag: ${systemInfoSent ? 'true (skipping)' : 'false (will send)'}`);
|
|
157
|
+
if (!systemInfoSent) {
|
|
158
|
+
// Set flag immediately to prevent concurrent init calls from sending twice
|
|
159
|
+
yield saveValueInAsync(ASYNC_KEYS.SYSTEM_INFO_SENT, 'pending');
|
|
160
|
+
try {
|
|
161
|
+
const enhancedSystemInfo = yield getEnhancedSystemInfo();
|
|
162
|
+
yield sendSystemInfoToBackend(enhancedSystemInfo);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
// Remove flag on failure so it retries next launch
|
|
166
|
+
yield async_storage_1.default.removeItem(ASYNC_KEYS.SYSTEM_INFO_SENT);
|
|
167
|
+
verboseLog(`Error sending system info for clipboard check: ${error}`);
|
|
168
|
+
}
|
|
160
169
|
}
|
|
161
170
|
}
|
|
162
171
|
});
|
|
@@ -561,14 +570,7 @@ const DeepLinkIapProvider = ({ children, }) => {
|
|
|
561
570
|
}
|
|
562
571
|
// If URL scheme is used, we can straight away store the short code as the referring link
|
|
563
572
|
yield storeInsertAffiliateIdentifier({ link: shortCode, source: 'deep_link_ios' });
|
|
564
|
-
//
|
|
565
|
-
try {
|
|
566
|
-
const enhancedSystemInfo = yield getEnhancedSystemInfo();
|
|
567
|
-
yield sendSystemInfoToBackend(enhancedSystemInfo);
|
|
568
|
-
}
|
|
569
|
-
catch (error) {
|
|
570
|
-
verboseLog(`Error sending system info for deep link: ${error}`);
|
|
571
|
-
}
|
|
573
|
+
// System info not needed here - affiliate code already received via URL scheme
|
|
572
574
|
return true;
|
|
573
575
|
}
|
|
574
576
|
catch (error) {
|
|
@@ -1162,6 +1164,7 @@ const DeepLinkIapProvider = ({ children, }) => {
|
|
|
1162
1164
|
}
|
|
1163
1165
|
// Check for a successful response
|
|
1164
1166
|
if (response.status >= 200 && response.status <= 299) {
|
|
1167
|
+
yield saveValueInAsync(ASYNC_KEYS.SYSTEM_INFO_SENT, 'true');
|
|
1165
1168
|
verboseLog('System info sent successfully');
|
|
1166
1169
|
}
|
|
1167
1170
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insert-affiliate-react-native-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "A package for connecting with the Insert Affiliate Platform to add app based affiliate marketing.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -83,6 +83,7 @@ const ASYNC_KEYS = {
|
|
|
83
83
|
AFFILIATE_STORED_DATE: '@app_affiliate_stored_date',
|
|
84
84
|
SDK_INIT_REPORTED: '@app_sdk_init_reported',
|
|
85
85
|
REPORTED_AFFILIATE_ASSOCIATIONS: '@app_reported_affiliate_associations',
|
|
86
|
+
SYSTEM_INFO_SENT: '@app_system_info_sent',
|
|
86
87
|
};
|
|
87
88
|
|
|
88
89
|
// Source types for affiliate association tracking
|
|
@@ -207,11 +208,19 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
if (insertLinksEnabledParam && Platform.OS === 'ios') {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
const systemInfoSent = await getValueFromAsync(ASYNC_KEYS.SYSTEM_INFO_SENT);
|
|
212
|
+
verboseLog(`System info sent flag: ${systemInfoSent ? 'true (skipping)' : 'false (will send)'}`);
|
|
213
|
+
if (!systemInfoSent) {
|
|
214
|
+
// Set flag immediately to prevent concurrent init calls from sending twice
|
|
215
|
+
await saveValueInAsync(ASYNC_KEYS.SYSTEM_INFO_SENT, 'pending');
|
|
216
|
+
try {
|
|
217
|
+
const enhancedSystemInfo = await getEnhancedSystemInfo();
|
|
218
|
+
await sendSystemInfoToBackend(enhancedSystemInfo);
|
|
219
|
+
} catch (error) {
|
|
220
|
+
// Remove flag on failure so it retries next launch
|
|
221
|
+
await AsyncStorage.removeItem(ASYNC_KEYS.SYSTEM_INFO_SENT);
|
|
222
|
+
verboseLog(`Error sending system info for clipboard check: ${error}`);
|
|
223
|
+
}
|
|
215
224
|
}
|
|
216
225
|
}
|
|
217
226
|
};
|
|
@@ -664,13 +673,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
664
673
|
// If URL scheme is used, we can straight away store the short code as the referring link
|
|
665
674
|
await storeInsertAffiliateIdentifier({ link: shortCode, source: 'deep_link_ios' });
|
|
666
675
|
|
|
667
|
-
//
|
|
668
|
-
try {
|
|
669
|
-
const enhancedSystemInfo = await getEnhancedSystemInfo();
|
|
670
|
-
await sendSystemInfoToBackend(enhancedSystemInfo);
|
|
671
|
-
} catch (error) {
|
|
672
|
-
verboseLog(`Error sending system info for deep link: ${error}`);
|
|
673
|
-
}
|
|
676
|
+
// System info not needed here - affiliate code already received via URL scheme
|
|
674
677
|
|
|
675
678
|
return true;
|
|
676
679
|
} catch (error) {
|
|
@@ -1347,6 +1350,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
1347
1350
|
|
|
1348
1351
|
// Check for a successful response
|
|
1349
1352
|
if (response.status >= 200 && response.status <= 299) {
|
|
1353
|
+
await saveValueInAsync(ASYNC_KEYS.SYSTEM_INFO_SENT, 'true');
|
|
1350
1354
|
verboseLog('System info sent successfully');
|
|
1351
1355
|
} else {
|
|
1352
1356
|
verboseLog(`Failed to send system info with status code: ${response.status}`);
|