@edge-markets/connect-react-native 1.3.0 → 1.4.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/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +40 -0
- package/dist/index.mjs +47 -8
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EdgeLinkConfigBase, EdgeEnvironment, EdgeScope, EdgeLinkSuccess, EdgeLinkEvent, PKCEPair } from '@edge-markets/connect';
|
|
2
|
-
export { ALL_EDGE_SCOPES, Balance, EDGE_ENVIRONMENTS, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, EdgeEnvironment, EdgeError, EdgeLinkEvent, EdgeLinkEventName, EdgeLinkExit, EdgeLinkSuccess, EdgeNetworkError, EdgePopupBlockedError, EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, EdgeTokens, PKCEPair, SCOPE_DESCRIPTIONS, Transfer, User, formatScopesForEnvironment, getEnvironmentConfig, isApiError, isAuthenticationError, isConsentRequiredError, isNetworkError } from '@edge-markets/connect';
|
|
1
|
+
import { EdgeLinkConfigBase, EdgeEnvironment, EdgeScope, EdgeLinkSuccess, EdgeLinkEvent, SdkGeolocation, PKCEPair } from '@edge-markets/connect';
|
|
2
|
+
export { ALL_EDGE_SCOPES, Balance, EDGE_ENVIRONMENTS, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, EdgeEnvironment, EdgeError, EdgeLinkEvent, EdgeLinkEventName, EdgeLinkExit, EdgeLinkSuccess, EdgeNetworkError, EdgePopupBlockedError, EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, EdgeTokens, PKCEPair, SCOPE_DESCRIPTIONS, SdkGeolocation, Transfer, User, formatScopesForEnvironment, getEnvironmentConfig, isApiError, isAuthenticationError, isConsentRequiredError, isNetworkError } from '@edge-markets/connect';
|
|
3
3
|
|
|
4
4
|
interface EdgeLinkConfig extends EdgeLinkConfigBase {
|
|
5
5
|
redirectUri: string;
|
|
@@ -177,8 +177,41 @@ declare function useEdgeLinkHandler(config: UseEdgeLinkHandlerConfig): UseEdgeLi
|
|
|
177
177
|
*/
|
|
178
178
|
declare function useEdgeLinkEvents(onEvent: (event: EdgeLinkEvent) => void, deps?: React.DependencyList): void;
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* React Native Geolocation Collector for EDGE Connect
|
|
182
|
+
*
|
|
183
|
+
* Collects the device's geolocation using available React Native geolocation
|
|
184
|
+
* libraries. Supports multiple libraries via dynamic import fallback chain:
|
|
185
|
+
*
|
|
186
|
+
* 1. `@react-native-community/geolocation` (most common)
|
|
187
|
+
* 2. `expo-location` (Expo projects)
|
|
188
|
+
* 3. Returns `null` if neither is available
|
|
189
|
+
*
|
|
190
|
+
* This function **never throws** — it returns `null` on permission denial,
|
|
191
|
+
* timeout, or library unavailability.
|
|
192
|
+
*
|
|
193
|
+
* @module @edge-markets/connect-react-native
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Collects the device's geolocation using available React Native libraries.
|
|
198
|
+
*
|
|
199
|
+
* @returns The device's geolocation, or `null` if unavailable
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* import { collectGeolocation } from '@edge-markets/connect-react-native'
|
|
204
|
+
*
|
|
205
|
+
* const geo = await collectGeolocation()
|
|
206
|
+
* if (geo) {
|
|
207
|
+
* console.log(`Location: ${geo.latitude}, ${geo.longitude}`)
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
declare function collectGeolocation(): Promise<SdkGeolocation | null>;
|
|
212
|
+
|
|
180
213
|
declare function generatePKCE(): Promise<PKCEPair>;
|
|
181
214
|
declare function generateState(): Promise<string>;
|
|
182
215
|
declare function isSecureCryptoAvailable(): Promise<boolean>;
|
|
183
216
|
|
|
184
|
-
export { EdgeLink, type EdgeLinkConfig, type UseEdgeLinkConfig, type UseEdgeLinkHandlerConfig, type UseEdgeLinkHandlerReturn, type UseEdgeLinkReturn, generatePKCE, generateState, isSecureCryptoAvailable, useEdgeLink, useEdgeLinkEvents, useEdgeLinkHandler };
|
|
217
|
+
export { EdgeLink, type EdgeLinkConfig, type UseEdgeLinkConfig, type UseEdgeLinkHandlerConfig, type UseEdgeLinkHandlerReturn, type UseEdgeLinkReturn, collectGeolocation, generatePKCE, generateState, isSecureCryptoAvailable, useEdgeLink, useEdgeLinkEvents, useEdgeLinkHandler };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EdgeLinkConfigBase, EdgeEnvironment, EdgeScope, EdgeLinkSuccess, EdgeLinkEvent, PKCEPair } from '@edge-markets/connect';
|
|
2
|
-
export { ALL_EDGE_SCOPES, Balance, EDGE_ENVIRONMENTS, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, EdgeEnvironment, EdgeError, EdgeLinkEvent, EdgeLinkEventName, EdgeLinkExit, EdgeLinkSuccess, EdgeNetworkError, EdgePopupBlockedError, EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, EdgeTokens, PKCEPair, SCOPE_DESCRIPTIONS, Transfer, User, formatScopesForEnvironment, getEnvironmentConfig, isApiError, isAuthenticationError, isConsentRequiredError, isNetworkError } from '@edge-markets/connect';
|
|
1
|
+
import { EdgeLinkConfigBase, EdgeEnvironment, EdgeScope, EdgeLinkSuccess, EdgeLinkEvent, SdkGeolocation, PKCEPair } from '@edge-markets/connect';
|
|
2
|
+
export { ALL_EDGE_SCOPES, Balance, EDGE_ENVIRONMENTS, EdgeApiError, EdgeAuthenticationError, EdgeConsentRequiredError, EdgeEnvironment, EdgeError, EdgeLinkEvent, EdgeLinkEventName, EdgeLinkExit, EdgeLinkSuccess, EdgeNetworkError, EdgePopupBlockedError, EdgeScope, EdgeStateMismatchError, EdgeTokenExchangeError, EdgeTokens, PKCEPair, SCOPE_DESCRIPTIONS, SdkGeolocation, Transfer, User, formatScopesForEnvironment, getEnvironmentConfig, isApiError, isAuthenticationError, isConsentRequiredError, isNetworkError } from '@edge-markets/connect';
|
|
3
3
|
|
|
4
4
|
interface EdgeLinkConfig extends EdgeLinkConfigBase {
|
|
5
5
|
redirectUri: string;
|
|
@@ -177,8 +177,41 @@ declare function useEdgeLinkHandler(config: UseEdgeLinkHandlerConfig): UseEdgeLi
|
|
|
177
177
|
*/
|
|
178
178
|
declare function useEdgeLinkEvents(onEvent: (event: EdgeLinkEvent) => void, deps?: React.DependencyList): void;
|
|
179
179
|
|
|
180
|
+
/**
|
|
181
|
+
* React Native Geolocation Collector for EDGE Connect
|
|
182
|
+
*
|
|
183
|
+
* Collects the device's geolocation using available React Native geolocation
|
|
184
|
+
* libraries. Supports multiple libraries via dynamic import fallback chain:
|
|
185
|
+
*
|
|
186
|
+
* 1. `@react-native-community/geolocation` (most common)
|
|
187
|
+
* 2. `expo-location` (Expo projects)
|
|
188
|
+
* 3. Returns `null` if neither is available
|
|
189
|
+
*
|
|
190
|
+
* This function **never throws** — it returns `null` on permission denial,
|
|
191
|
+
* timeout, or library unavailability.
|
|
192
|
+
*
|
|
193
|
+
* @module @edge-markets/connect-react-native
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Collects the device's geolocation using available React Native libraries.
|
|
198
|
+
*
|
|
199
|
+
* @returns The device's geolocation, or `null` if unavailable
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* import { collectGeolocation } from '@edge-markets/connect-react-native'
|
|
204
|
+
*
|
|
205
|
+
* const geo = await collectGeolocation()
|
|
206
|
+
* if (geo) {
|
|
207
|
+
* console.log(`Location: ${geo.latitude}, ${geo.longitude}`)
|
|
208
|
+
* }
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
declare function collectGeolocation(): Promise<SdkGeolocation | null>;
|
|
212
|
+
|
|
180
213
|
declare function generatePKCE(): Promise<PKCEPair>;
|
|
181
214
|
declare function generateState(): Promise<string>;
|
|
182
215
|
declare function isSecureCryptoAvailable(): Promise<boolean>;
|
|
183
216
|
|
|
184
|
-
export { EdgeLink, type EdgeLinkConfig, type UseEdgeLinkConfig, type UseEdgeLinkHandlerConfig, type UseEdgeLinkHandlerReturn, type UseEdgeLinkReturn, generatePKCE, generateState, isSecureCryptoAvailable, useEdgeLink, useEdgeLinkEvents, useEdgeLinkHandler };
|
|
217
|
+
export { EdgeLink, type EdgeLinkConfig, type UseEdgeLinkConfig, type UseEdgeLinkHandlerConfig, type UseEdgeLinkHandlerReturn, type UseEdgeLinkReturn, collectGeolocation, generatePKCE, generateState, isSecureCryptoAvailable, useEdgeLink, useEdgeLinkEvents, useEdgeLinkHandler };
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,7 @@ __export(index_exports, {
|
|
|
42
42
|
EdgeStateMismatchError: () => import_connect2.EdgeStateMismatchError,
|
|
43
43
|
EdgeTokenExchangeError: () => import_connect2.EdgeTokenExchangeError,
|
|
44
44
|
SCOPE_DESCRIPTIONS: () => import_connect2.SCOPE_DESCRIPTIONS,
|
|
45
|
+
collectGeolocation: () => collectGeolocation,
|
|
45
46
|
formatScopesForEnvironment: () => import_connect2.formatScopesForEnvironment,
|
|
46
47
|
generatePKCE: () => generatePKCE,
|
|
47
48
|
generateState: () => generateState,
|
|
@@ -655,6 +656,44 @@ function useEdgeLinkEvents(onEvent, deps = []) {
|
|
|
655
656
|
(0, import_react.useEffect)(() => {
|
|
656
657
|
}, [onEvent, ...deps]);
|
|
657
658
|
}
|
|
659
|
+
|
|
660
|
+
// src/geolocation.ts
|
|
661
|
+
async function collectGeolocation() {
|
|
662
|
+
try {
|
|
663
|
+
const Geolocation = (await import("@react-native-community/geolocation")).default;
|
|
664
|
+
return new Promise((resolve) => {
|
|
665
|
+
Geolocation.getCurrentPosition(
|
|
666
|
+
(position) => {
|
|
667
|
+
resolve({
|
|
668
|
+
latitude: position.coords.latitude,
|
|
669
|
+
longitude: position.coords.longitude,
|
|
670
|
+
accuracy: position.coords.accuracy,
|
|
671
|
+
timestamp: new Date(position.timestamp).toISOString()
|
|
672
|
+
});
|
|
673
|
+
},
|
|
674
|
+
() => resolve(null),
|
|
675
|
+
{ timeout: 1e4, maximumAge: 6e4, enableHighAccuracy: false }
|
|
676
|
+
);
|
|
677
|
+
});
|
|
678
|
+
} catch {
|
|
679
|
+
}
|
|
680
|
+
try {
|
|
681
|
+
const Location = await import("expo-location");
|
|
682
|
+
const { status } = await Location.requestForegroundPermissionsAsync();
|
|
683
|
+
if (status !== "granted") return null;
|
|
684
|
+
const position = await Location.getCurrentPositionAsync({
|
|
685
|
+
accuracy: Location.Accuracy?.Balanced
|
|
686
|
+
});
|
|
687
|
+
return {
|
|
688
|
+
latitude: position.coords.latitude,
|
|
689
|
+
longitude: position.coords.longitude,
|
|
690
|
+
accuracy: position.coords.accuracy,
|
|
691
|
+
timestamp: new Date(position.timestamp).toISOString()
|
|
692
|
+
};
|
|
693
|
+
} catch {
|
|
694
|
+
}
|
|
695
|
+
return null;
|
|
696
|
+
}
|
|
658
697
|
// Annotate the CommonJS export names for ESM import in node:
|
|
659
698
|
0 && (module.exports = {
|
|
660
699
|
ALL_EDGE_SCOPES,
|
|
@@ -669,6 +708,7 @@ function useEdgeLinkEvents(onEvent, deps = []) {
|
|
|
669
708
|
EdgeStateMismatchError,
|
|
670
709
|
EdgeTokenExchangeError,
|
|
671
710
|
SCOPE_DESCRIPTIONS,
|
|
711
|
+
collectGeolocation,
|
|
672
712
|
formatScopesForEnvironment,
|
|
673
713
|
generatePKCE,
|
|
674
714
|
generateState,
|
package/dist/index.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import {
|
|
3
|
-
getEnvironmentConfig as getEnvironmentConfig2,
|
|
4
|
-
EDGE_ENVIRONMENTS,
|
|
5
3
|
ALL_EDGE_SCOPES as ALL_EDGE_SCOPES2,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
EdgeError,
|
|
4
|
+
EDGE_ENVIRONMENTS,
|
|
5
|
+
EdgeApiError,
|
|
9
6
|
EdgeAuthenticationError,
|
|
10
7
|
EdgeConsentRequiredError,
|
|
11
|
-
|
|
12
|
-
EdgeApiError,
|
|
8
|
+
EdgeError,
|
|
13
9
|
EdgeNetworkError,
|
|
14
10
|
EdgePopupBlockedError,
|
|
15
11
|
EdgeStateMismatchError,
|
|
12
|
+
EdgeTokenExchangeError,
|
|
13
|
+
SCOPE_DESCRIPTIONS,
|
|
14
|
+
formatScopesForEnvironment as formatScopesForEnvironment2,
|
|
15
|
+
getEnvironmentConfig as getEnvironmentConfig2,
|
|
16
|
+
isApiError,
|
|
16
17
|
isAuthenticationError,
|
|
17
18
|
isConsentRequiredError,
|
|
18
|
-
isApiError,
|
|
19
19
|
isNetworkError
|
|
20
20
|
} from "@edge-markets/connect";
|
|
21
21
|
|
|
@@ -620,6 +620,44 @@ function useEdgeLinkEvents(onEvent, deps = []) {
|
|
|
620
620
|
useEffect(() => {
|
|
621
621
|
}, [onEvent, ...deps]);
|
|
622
622
|
}
|
|
623
|
+
|
|
624
|
+
// src/geolocation.ts
|
|
625
|
+
async function collectGeolocation() {
|
|
626
|
+
try {
|
|
627
|
+
const Geolocation = (await import("@react-native-community/geolocation")).default;
|
|
628
|
+
return new Promise((resolve) => {
|
|
629
|
+
Geolocation.getCurrentPosition(
|
|
630
|
+
(position) => {
|
|
631
|
+
resolve({
|
|
632
|
+
latitude: position.coords.latitude,
|
|
633
|
+
longitude: position.coords.longitude,
|
|
634
|
+
accuracy: position.coords.accuracy,
|
|
635
|
+
timestamp: new Date(position.timestamp).toISOString()
|
|
636
|
+
});
|
|
637
|
+
},
|
|
638
|
+
() => resolve(null),
|
|
639
|
+
{ timeout: 1e4, maximumAge: 6e4, enableHighAccuracy: false }
|
|
640
|
+
);
|
|
641
|
+
});
|
|
642
|
+
} catch {
|
|
643
|
+
}
|
|
644
|
+
try {
|
|
645
|
+
const Location = await import("expo-location");
|
|
646
|
+
const { status } = await Location.requestForegroundPermissionsAsync();
|
|
647
|
+
if (status !== "granted") return null;
|
|
648
|
+
const position = await Location.getCurrentPositionAsync({
|
|
649
|
+
accuracy: Location.Accuracy?.Balanced
|
|
650
|
+
});
|
|
651
|
+
return {
|
|
652
|
+
latitude: position.coords.latitude,
|
|
653
|
+
longitude: position.coords.longitude,
|
|
654
|
+
accuracy: position.coords.accuracy,
|
|
655
|
+
timestamp: new Date(position.timestamp).toISOString()
|
|
656
|
+
};
|
|
657
|
+
} catch {
|
|
658
|
+
}
|
|
659
|
+
return null;
|
|
660
|
+
}
|
|
623
661
|
export {
|
|
624
662
|
ALL_EDGE_SCOPES2 as ALL_EDGE_SCOPES,
|
|
625
663
|
EDGE_ENVIRONMENTS,
|
|
@@ -633,6 +671,7 @@ export {
|
|
|
633
671
|
EdgeStateMismatchError,
|
|
634
672
|
EdgeTokenExchangeError,
|
|
635
673
|
SCOPE_DESCRIPTIONS,
|
|
674
|
+
collectGeolocation,
|
|
636
675
|
formatScopesForEnvironment2 as formatScopesForEnvironment,
|
|
637
676
|
generatePKCE,
|
|
638
677
|
generateState,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edge-markets/connect-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "React Native SDK for EDGE Connect authentication flow for mobile apps",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"author": "EdgeBoost",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@edge-markets/connect": "1.
|
|
33
|
+
"@edge-markets/connect": "1.5.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=18.0.0",
|