@turtleclub/hooks 0.5.0-beta.93 → 0.5.0-beta.94
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.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/v2/geocheck/hooks.ts +5 -4
- package/src/v2/lib/api-client.ts +1 -0
- package/src/v2/lib/turtle-provider.tsx +2 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turtleclub/hooks",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.0-beta.
|
|
4
|
+
"version": "0.5.0-beta.94",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "f7b206b904156b60fad200f803741d81d00cf71b"
|
|
58
58
|
}
|
package/src/v2/geocheck/hooks.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
2
2
|
import type { UseQueryResult } from "@tanstack/react-query";
|
|
3
3
|
import { geocheckQueries } from "./queries";
|
|
4
4
|
import { queryDefaults } from "../lib/query-config";
|
|
5
|
+
import { apiClient } from "../lib/api-client";
|
|
5
6
|
import type { GeoCheckResponse } from "./schema";
|
|
6
7
|
|
|
7
8
|
export interface UseGeocheckOptions {
|
|
@@ -21,15 +22,15 @@ export interface UseGeocheckOptions {
|
|
|
21
22
|
* if (!geocheck?.canInteract) return <div>Service not available in your region</div>;
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
|
-
export function useGeocheck(
|
|
25
|
-
options: UseGeocheckOptions = {}
|
|
26
|
-
): UseQueryResult<GeoCheckResponse> {
|
|
25
|
+
export function useGeocheck(options: UseGeocheckOptions = {}): UseQueryResult<GeoCheckResponse> {
|
|
27
26
|
const { enabled = true, staleTime, gcTime } = options;
|
|
27
|
+
const { disableGeocheck } = apiClient.getConfig();
|
|
28
28
|
|
|
29
29
|
return useQuery({
|
|
30
30
|
...geocheckQueries.check,
|
|
31
31
|
...queryDefaults,
|
|
32
|
-
enabled,
|
|
32
|
+
enabled: enabled && !disableGeocheck,
|
|
33
|
+
...(disableGeocheck && { initialData: { canInteract: true } }),
|
|
33
34
|
staleTime: staleTime ?? 5 * 60 * 1000, // 5 minutes
|
|
34
35
|
gcTime: gcTime ?? 10 * 60 * 1000, // 10 minutes
|
|
35
36
|
});
|
package/src/v2/lib/api-client.ts
CHANGED
|
@@ -36,8 +36,9 @@ export function TurtleHooksProvider({
|
|
|
36
36
|
getToken,
|
|
37
37
|
earnApiKey,
|
|
38
38
|
debug,
|
|
39
|
+
disableGeocheck,
|
|
39
40
|
}: TurtleHooksProviderProps) {
|
|
40
|
-
apiClient.configure({ apiUrl, earnUrl, getToken, earnApiKey, debug });
|
|
41
|
+
apiClient.configure({ apiUrl, earnUrl, getToken, earnApiKey, debug, disableGeocheck });
|
|
41
42
|
|
|
42
43
|
return <>{children}</>;
|
|
43
44
|
}
|