rn-prodeeplinks 0.0.3 → 0.0.4
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 +1 -1
- package/lib/api.js +18 -8
- package/lib/fingerprint.js +3 -3
- package/lib/index.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> ⚠️ **License Required**: This package requires a valid license key purchased from our portal. Without a license key, the package will not function.
|
|
6
6
|
|
|
7
|
-
> ℹ️ **Versioning**: Current version is 0.0.
|
|
7
|
+
> ℹ️ **Versioning**: Current version is 0.0.4 (in-progress). It will move to 1.x after stable.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
package/lib/api.js
CHANGED
|
@@ -26,7 +26,7 @@ async function fetchDeepLinkUrl(licenseKey, fingerprint, apiEndpoint, timeout =
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
const PACKAGE_NAME = 'react-native-pro-deeplink';
|
|
29
|
-
const PACKAGE_VERSION = '0.0.
|
|
29
|
+
const PACKAGE_VERSION = '0.0.4';
|
|
30
30
|
const payload = {
|
|
31
31
|
licenseKey,
|
|
32
32
|
fingerprint: fingerprint,
|
|
@@ -39,7 +39,7 @@ async function fetchDeepLinkUrl(licenseKey, fingerprint, apiEndpoint, timeout =
|
|
|
39
39
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
40
40
|
try {
|
|
41
41
|
const PACKAGE_NAME = 'react-native-pro-deeplink';
|
|
42
|
-
const PACKAGE_VERSION = '0.0.
|
|
42
|
+
const PACKAGE_VERSION = '0.0.4';
|
|
43
43
|
const response = await fetch(endpoint, {
|
|
44
44
|
method: 'POST',
|
|
45
45
|
headers: {
|
|
@@ -60,12 +60,22 @@ async function fetchDeepLinkUrl(licenseKey, fingerprint, apiEndpoint, timeout =
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
const data = await response.json();
|
|
63
|
-
if (data.success
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
if (data.success) {
|
|
64
|
+
if (data.url) {
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
url: data.url,
|
|
68
|
+
message: data.message,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// Success true but no URL means no match found - this is not an error
|
|
73
|
+
return {
|
|
74
|
+
success: true,
|
|
75
|
+
url: null,
|
|
76
|
+
message: data.message || 'No deep link available',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
69
79
|
}
|
|
70
80
|
else {
|
|
71
81
|
return {
|
package/lib/fingerprint.js
CHANGED
|
@@ -27,9 +27,9 @@ async function generateDeviceFingerprint() {
|
|
|
27
27
|
? (await (react_native_device_info_1.default.isDeviceRooted?.() ?? false))
|
|
28
28
|
: false;
|
|
29
29
|
const deviceLocales = react_native_device_info_1.default.getDeviceLocales?.();
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const primaryLocale = Array.isArray(deviceLocales) && deviceLocales.length > 0 ? deviceLocales[0] : undefined;
|
|
31
|
+
const legacyLocale = react_native_device_info_1.default.getDeviceLocale?.();
|
|
32
|
+
const locale = (primaryLocale || legacyLocale || Intl.DateTimeFormat().resolvedOptions().locale) || 'en';
|
|
33
33
|
const language = (locale || '').split('-')[0] || 'en';
|
|
34
34
|
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
35
35
|
// Get network info
|
package/lib/index.js
CHANGED
|
@@ -142,7 +142,8 @@ async function getDeepLink(callback) {
|
|
|
142
142
|
callback(result.url);
|
|
143
143
|
}
|
|
144
144
|
// If API didn't return a usable URL, return null as per requirements
|
|
145
|
-
if
|
|
145
|
+
// But if success is false, propagate the error
|
|
146
|
+
if (result.success && !result.url) {
|
|
146
147
|
return { success: true, url: null, message: 'No deep link available' };
|
|
147
148
|
}
|
|
148
149
|
return result;
|
package/package.json
CHANGED