@rork-ai/toolkit-sdk 0.2.37 → 0.2.39
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/module/agent.js +1 -1
- package/lib/module/agent.js.map +1 -1
- package/lib/module/dev/sdk53/index.js +0 -1
- package/lib/module/dev/sdk53/index.js.map +1 -1
- package/lib/module/dev/sdk54/index.js +0 -1
- package/lib/module/dev/sdk54/index.js.map +1 -1
- package/lib/module/metro/index.js +31 -3
- package/lib/module/metro/index.js.map +1 -1
- package/lib/module/metro/transformer.js +9 -10
- package/lib/module/metro/transformer.js.map +1 -1
- package/lib/module/polyfills/alert.web.js +1 -3
- package/lib/module/polyfills/alert.web.js.map +1 -1
- package/lib/module/{polyfills.js → polyfills/fetch.js} +1 -1
- package/lib/module/polyfills/fetch.js.map +1 -0
- package/lib/module/polyfills/fetch.web.js +4 -0
- package/lib/module/polyfills/{alert.js.map → fetch.web.js.map} +1 -1
- package/lib/module/polyfills/maps.web.js +37 -0
- package/lib/module/polyfills/maps.web.js.map +1 -0
- package/lib/module/polyfills/refresh-control-component.js +155 -0
- package/lib/module/polyfills/refresh-control-component.js.map +1 -0
- package/lib/module/polyfills/secure-store.web.js +72 -0
- package/lib/module/polyfills/secure-store.web.js.map +1 -0
- package/lib/typescript/src/agent.d.ts +1 -1
- package/lib/typescript/src/agent.d.ts.map +1 -1
- package/lib/typescript/src/dev/sdk53/index.d.ts +0 -1
- package/lib/typescript/src/dev/sdk53/index.d.ts.map +1 -1
- package/lib/typescript/src/dev/sdk54/index.d.ts +0 -1
- package/lib/typescript/src/dev/sdk54/index.d.ts.map +1 -1
- package/lib/typescript/src/polyfills/alert.web.d.ts +2 -1
- package/lib/typescript/src/polyfills/alert.web.d.ts.map +1 -1
- package/lib/typescript/src/polyfills/fetch.d.ts +2 -0
- package/lib/typescript/src/polyfills/fetch.d.ts.map +1 -0
- package/lib/typescript/src/polyfills/fetch.web.d.ts +2 -0
- package/lib/typescript/src/polyfills/fetch.web.d.ts.map +1 -0
- package/lib/typescript/src/polyfills/maps.web.d.ts +7 -0
- package/lib/typescript/src/polyfills/maps.web.d.ts.map +1 -0
- package/lib/typescript/src/polyfills/refresh-control-component.d.ts +9 -0
- package/lib/typescript/src/polyfills/refresh-control-component.d.ts.map +1 -0
- package/lib/typescript/src/polyfills/secure-store.web.d.ts +16 -0
- package/lib/typescript/src/polyfills/secure-store.web.d.ts.map +1 -0
- package/package.json +9 -5
- package/src/agent.ts +1 -1
- package/src/dev/sdk53/index.tsx +0 -2
- package/src/dev/sdk54/index.tsx +0 -2
- package/src/metro/index.js +42 -2
- package/src/metro/transformer.js +14 -11
- package/src/polyfills/alert.web.ts +1 -3
- package/src/polyfills/maps.web.tsx +42 -0
- package/src/polyfills/refresh-control-component.tsx +215 -0
- package/src/polyfills/secure-store.web.ts +111 -0
- package/lib/module/polyfills/alert.js +0 -4
- package/lib/module/polyfills.js.map +0 -1
- package/lib/module/polyfills.web.js +0 -4
- package/lib/module/polyfills.web.js.map +0 -1
- package/lib/typescript/src/polyfills/alert.d.ts +0 -2
- package/lib/typescript/src/polyfills/alert.d.ts.map +0 -1
- package/lib/typescript/src/polyfills.d.ts +0 -2
- package/lib/typescript/src/polyfills.d.ts.map +0 -1
- package/lib/typescript/src/polyfills.web.d.ts +0 -2
- package/lib/typescript/src/polyfills.web.d.ts.map +0 -1
- package/src/polyfills/alert.ts +0 -1
- /package/src/{polyfills.ts → polyfills/fetch.ts} +0 -0
- /package/src/{polyfills.web.ts → polyfills/fetch.web.ts} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type KeychainAccessibilityConstant = number;
|
|
2
|
+
export declare const AFTER_FIRST_UNLOCK: number, AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: number, ALWAYS: number, WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: number, ALWAYS_THIS_DEVICE_ONLY: number, WHEN_UNLOCKED: number, WHEN_UNLOCKED_THIS_DEVICE_ONLY: number;
|
|
3
|
+
export type SecureStoreOptions = {
|
|
4
|
+
keychainService?: string;
|
|
5
|
+
requireAuthentication?: boolean;
|
|
6
|
+
authenticationPrompt?: string;
|
|
7
|
+
keychainAccessible?: KeychainAccessibilityConstant;
|
|
8
|
+
};
|
|
9
|
+
export declare function isAvailableAsync(): Promise<boolean>;
|
|
10
|
+
export declare function deleteItemAsync(key: string, _options?: SecureStoreOptions): Promise<void>;
|
|
11
|
+
export declare function getItemAsync(key: string, _options?: SecureStoreOptions): Promise<string | null>;
|
|
12
|
+
export declare function setItemAsync(key: string, value: string, _options?: SecureStoreOptions): Promise<void>;
|
|
13
|
+
export declare function setItem(key: string, value: string, _options?: SecureStoreOptions): void;
|
|
14
|
+
export declare function getItem(key: string, _options?: SecureStoreOptions): string | null;
|
|
15
|
+
export declare function canUseBiometricAuthentication(): boolean;
|
|
16
|
+
//# sourceMappingURL=secure-store.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secure-store.web.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/secure-store.web.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC;AACnD,eAAO,MACL,kBAAkB,UAClB,mCAAmC,UACnC,MAAM,UACN,kCAAkC,UAClC,uBAAuB,UACvB,aAAa,UACb,8BAA8B,QACV,CAAC;AAEvB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kBAAkB,CAAC,EAAE,6BAA6B,CAAC;CACpD,CAAC;AAmBF,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAYzD;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,kBAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,kBAAuB,GAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAExB;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,kBAAuB,GAChC,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAgB,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,QAAQ,GAAE,kBAAuB,GAChC,IAAI,CAON;AAED,wBAAgB,OAAO,CACrB,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,kBAAuB,GAChC,MAAM,GAAG,IAAI,CAEf;AAED,wBAAgB,6BAA6B,IAAI,OAAO,CAEvD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rork-ai/toolkit-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.39",
|
|
4
4
|
"description": "toolkit-sdk",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -81,17 +81,18 @@
|
|
|
81
81
|
"eslint-config-prettier": "^10.1.8",
|
|
82
82
|
"eslint-plugin-prettier": "^5.5.4",
|
|
83
83
|
"expo": "54.0.8",
|
|
84
|
-
"expo-blur": "15.0.7",
|
|
85
|
-
"expo-router": "6.0.14",
|
|
86
|
-
"expo-web-browser": "15.0.9",
|
|
84
|
+
"expo-blur": "~15.0.7",
|
|
87
85
|
"expo-modules-core": "3.0.16",
|
|
86
|
+
"expo-router": "6.0.14",
|
|
87
|
+
"expo-web-browser": "~15.0.9",
|
|
88
88
|
"jest": "^29.7.0",
|
|
89
89
|
"lucide-react-native": "0.544.0",
|
|
90
90
|
"prettier": "3.6.2",
|
|
91
91
|
"react": "19.1.0",
|
|
92
92
|
"react-native": "0.81.4",
|
|
93
93
|
"react-native-builder-bob": "^0.40.13",
|
|
94
|
-
"react-native-safe-area-context": "~5.6.
|
|
94
|
+
"react-native-safe-area-context": "~5.6.2",
|
|
95
|
+
"react-native-web": "^0.21.2",
|
|
95
96
|
"typescript": "5.9.3",
|
|
96
97
|
"zod": "4.1.12"
|
|
97
98
|
},
|
|
@@ -103,8 +104,10 @@
|
|
|
103
104
|
"expo-router": "*",
|
|
104
105
|
"expo-web-browser": "*",
|
|
105
106
|
"lucide-react-native": "*",
|
|
107
|
+
"react": "*",
|
|
106
108
|
"react-native": "*",
|
|
107
109
|
"react-native-safe-area-context": "*",
|
|
110
|
+
"react-native-web": "*",
|
|
108
111
|
"zod": "^4"
|
|
109
112
|
},
|
|
110
113
|
"workspaces": [
|
|
@@ -151,6 +154,7 @@
|
|
|
151
154
|
"@ai-sdk/react": "^2.0.89",
|
|
152
155
|
"@blazejkustra/react-native-alert": "^1.0.0",
|
|
153
156
|
"@stardazed/streams-text-encoding": "^1.0.2",
|
|
157
|
+
"@teovilla/react-native-web-maps": "^0.9.5",
|
|
154
158
|
"@ungap/structured-clone": "^1.3.0",
|
|
155
159
|
"ai": "5.0.93",
|
|
156
160
|
"posthog-react-native": "4.13.0"
|
package/src/agent.ts
CHANGED
package/src/dev/sdk53/index.tsx
CHANGED
|
@@ -2,8 +2,6 @@ import { RorkErrorBoundary } from "../error-boundary";
|
|
|
2
2
|
import { RorkSafeInsets } from "../safe-insets-content";
|
|
3
3
|
import { BundleInspector } from "./inspector";
|
|
4
4
|
|
|
5
|
-
import "../../polyfills/alert";
|
|
6
|
-
|
|
7
5
|
export function RorkDevWrapper({ children }: { children: React.ReactNode }) {
|
|
8
6
|
return (
|
|
9
7
|
<RorkErrorBoundary>
|
package/src/dev/sdk54/index.tsx
CHANGED
|
@@ -2,8 +2,6 @@ import { RorkErrorBoundary } from "../error-boundary";
|
|
|
2
2
|
import { RorkSafeInsets } from "../safe-insets-content";
|
|
3
3
|
import { BundleInspector } from "./inspector";
|
|
4
4
|
|
|
5
|
-
import "../../polyfills/alert";
|
|
6
|
-
|
|
7
5
|
export function RorkDevWrapper({ children }: { children: React.ReactNode }) {
|
|
8
6
|
return (
|
|
9
7
|
<RorkErrorBoundary>
|
package/src/metro/index.js
CHANGED
|
@@ -30,12 +30,52 @@ function withRorkMetro(config) {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
if (moduleName === "expo-secure-store" && platform === "web") {
|
|
34
|
+
return {
|
|
35
|
+
filePath: path.resolve(libPath, "polyfills/secure-store.web.js"),
|
|
36
|
+
type: "sourceFile",
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Redirect react-native-maps to our web polyfill on web platform
|
|
41
|
+
if (moduleName === "react-native-maps" && platform === "web") {
|
|
42
|
+
return {
|
|
43
|
+
filePath: path.resolve(libPath, "polyfills/maps.web.js"),
|
|
44
|
+
type: "sourceFile",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Redirect react-native to our web polyfill on web platform
|
|
49
|
+
// This replaces RefreshControl with our web implementation
|
|
50
|
+
if (
|
|
51
|
+
moduleName === "react-native-web/dist/exports/RefreshControl" &&
|
|
52
|
+
platform === "web"
|
|
53
|
+
) {
|
|
54
|
+
return {
|
|
55
|
+
filePath: path.resolve(
|
|
56
|
+
libPath,
|
|
57
|
+
"polyfills/refresh-control-component.js",
|
|
58
|
+
),
|
|
59
|
+
type: "sourceFile",
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Redirect react-native to our web polyfill on web platform
|
|
64
|
+
// This replaces RefreshControl with our web implementation
|
|
65
|
+
if (
|
|
66
|
+
moduleName === "react-native-web/dist/exports/Alert" &&
|
|
67
|
+
platform === "web"
|
|
68
|
+
) {
|
|
69
|
+
return {
|
|
70
|
+
filePath: path.resolve(libPath, "polyfills/alert.web.js"),
|
|
71
|
+
type: "sourceFile",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
34
75
|
if (originalResolveRequest) {
|
|
35
76
|
return originalResolveRequest(context, moduleName, platform);
|
|
36
77
|
}
|
|
37
78
|
|
|
38
|
-
// Fall back to default resolution
|
|
39
79
|
return context.resolveRequest(context, moduleName, platform);
|
|
40
80
|
},
|
|
41
81
|
},
|
package/src/metro/transformer.js
CHANGED
|
@@ -9,21 +9,24 @@ const path = require("path");
|
|
|
9
9
|
const upstreamTransformer = require("@expo/metro-config/babel-transformer");
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Detects the Expo SDK version from package
|
|
12
|
+
* Detects the Expo SDK version from the installed expo package
|
|
13
|
+
* This approach works with all package managers (npm, yarn, pnpm)
|
|
13
14
|
*/
|
|
14
15
|
function detectExpoVersion() {
|
|
15
16
|
try {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
// Read version from installed expo package (works with pnpm, npm, yarn)
|
|
18
|
+
const expoPackagePath = path.join(
|
|
19
|
+
process.cwd(),
|
|
20
|
+
"node_modules",
|
|
21
|
+
"expo",
|
|
22
|
+
"package.json",
|
|
23
|
+
);
|
|
24
|
+
if (fs.existsSync(expoPackagePath)) {
|
|
25
|
+
const expoPackage = JSON.parse(fs.readFileSync(expoPackagePath, "utf8"));
|
|
26
|
+
const version = expoPackage.version;
|
|
22
27
|
if (version) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (cleanVersion.startsWith("54.")) return "54";
|
|
26
|
-
if (cleanVersion.startsWith("53.")) return "53";
|
|
28
|
+
if (version.startsWith("54.")) return "54";
|
|
29
|
+
if (version.startsWith("53.")) return "53";
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
} catch {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import WebMapView, * as WebMaps from "@teovilla/react-native-web-maps";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
export const PROVIDER_GOOGLE = "google";
|
|
6
|
+
export const PROVIDER_DEFAULT = undefined;
|
|
7
|
+
|
|
8
|
+
const GOOGLE_MAPS_API_KEY = process.env.EXPO_PUBLIC_GOOGLE_MAPS_API_KEY;
|
|
9
|
+
|
|
10
|
+
const MapView = React.forwardRef((props, ref) => {
|
|
11
|
+
return (
|
|
12
|
+
<WebMapView
|
|
13
|
+
ref={ref}
|
|
14
|
+
googleMapsApiKey={GOOGLE_MAPS_API_KEY}
|
|
15
|
+
{...props}
|
|
16
|
+
provider={PROVIDER_GOOGLE}
|
|
17
|
+
/>
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
MapView.displayName = "MapView";
|
|
22
|
+
|
|
23
|
+
Object.assign(MapView, {
|
|
24
|
+
...WebMaps,
|
|
25
|
+
PROVIDER_GOOGLE,
|
|
26
|
+
PROVIDER_DEFAULT,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const {
|
|
30
|
+
Marker,
|
|
31
|
+
Callout,
|
|
32
|
+
Polyline,
|
|
33
|
+
Polygon,
|
|
34
|
+
Circle,
|
|
35
|
+
Overlay,
|
|
36
|
+
Heatmap,
|
|
37
|
+
UrlTile,
|
|
38
|
+
WMSTile,
|
|
39
|
+
LocalTile,
|
|
40
|
+
} = WebMaps;
|
|
41
|
+
|
|
42
|
+
export default MapView;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
3
|
+
// Import from react-native-web directly to avoid infinite loop
|
|
4
|
+
// (metro redirects "react-native" to our polyfill on web)
|
|
5
|
+
import {
|
|
6
|
+
ActivityIndicator,
|
|
7
|
+
Animated,
|
|
8
|
+
PanResponder,
|
|
9
|
+
View,
|
|
10
|
+
type GestureResponderEvent,
|
|
11
|
+
type PanResponderGestureState,
|
|
12
|
+
type RefreshControlProps,
|
|
13
|
+
type StyleProp,
|
|
14
|
+
type ViewStyle,
|
|
15
|
+
} from "react-native-web";
|
|
16
|
+
|
|
17
|
+
interface WebRefreshControlProps extends Omit<RefreshControlProps, "style"> {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function WebRefreshControl({
|
|
23
|
+
refreshing,
|
|
24
|
+
tintColor,
|
|
25
|
+
colors,
|
|
26
|
+
style,
|
|
27
|
+
progressViewOffset,
|
|
28
|
+
children,
|
|
29
|
+
onRefresh,
|
|
30
|
+
enabled,
|
|
31
|
+
}: WebRefreshControlProps) {
|
|
32
|
+
const onRefreshRef = useRef(onRefresh);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
onRefreshRef.current = onRefresh;
|
|
35
|
+
}, [onRefresh]);
|
|
36
|
+
const enabledRef = useRef(enabled);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
enabledRef.current = enabled;
|
|
39
|
+
}, [enabled]);
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
|
+
const containerRef = useRef<any>(null);
|
|
43
|
+
const pullPosReachedState = useRef(0);
|
|
44
|
+
const pullDownSwipeMargin = useRef(new Animated.Value(0));
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
Animated.timing(pullDownSwipeMargin.current, {
|
|
48
|
+
toValue: refreshing ? 50 : 0,
|
|
49
|
+
duration: 350,
|
|
50
|
+
useNativeDriver: false,
|
|
51
|
+
}).start();
|
|
52
|
+
if (refreshing) {
|
|
53
|
+
pullPosReachedState.current = 0;
|
|
54
|
+
}
|
|
55
|
+
}, [refreshing]);
|
|
56
|
+
|
|
57
|
+
const onPanResponderFinish = useCallback(() => {
|
|
58
|
+
if (pullPosReachedState.current && onRefreshRef.current) {
|
|
59
|
+
onRefreshRef.current();
|
|
60
|
+
}
|
|
61
|
+
if (!pullPosReachedState.current) {
|
|
62
|
+
Animated.timing(pullDownSwipeMargin.current, {
|
|
63
|
+
toValue: 0,
|
|
64
|
+
duration: 350,
|
|
65
|
+
useNativeDriver: false,
|
|
66
|
+
}).start();
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
|
|
70
|
+
const panResponder = useRef(
|
|
71
|
+
PanResponder.create({
|
|
72
|
+
onStartShouldSetPanResponder: () => false,
|
|
73
|
+
onStartShouldSetPanResponderCapture: () => false,
|
|
74
|
+
onMoveShouldSetPanResponder: (
|
|
75
|
+
_: GestureResponderEvent,
|
|
76
|
+
gestureState: PanResponderGestureState,
|
|
77
|
+
) => {
|
|
78
|
+
if (!containerRef.current) return false;
|
|
79
|
+
// React 19 fix: use direct DOM traversal instead of findNodeHandle
|
|
80
|
+
const scrollContainer = (containerRef.current as unknown as HTMLElement)
|
|
81
|
+
?.firstChild as HTMLElement | null;
|
|
82
|
+
if (!scrollContainer) return false;
|
|
83
|
+
return (
|
|
84
|
+
scrollContainer.scrollTop === 0 &&
|
|
85
|
+
Math.abs(gestureState.dy) > Math.abs(gestureState.dx) * 2 &&
|
|
86
|
+
Math.abs(gestureState.vy) > Math.abs(gestureState.vx) * 2.5
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
onMoveShouldSetPanResponderCapture: () => false,
|
|
90
|
+
onPanResponderMove: (
|
|
91
|
+
_: GestureResponderEvent,
|
|
92
|
+
gestureState: PanResponderGestureState,
|
|
93
|
+
) => {
|
|
94
|
+
if (enabledRef.current !== undefined && !enabledRef.current) return;
|
|
95
|
+
|
|
96
|
+
const adjustedDy =
|
|
97
|
+
gestureState.dy <= 0
|
|
98
|
+
? 0
|
|
99
|
+
: (gestureState.dy * 150) / (gestureState.dy + 120); // Diminishing returns function
|
|
100
|
+
pullDownSwipeMargin.current.setValue(adjustedDy);
|
|
101
|
+
const newValue = adjustedDy > 45 ? 1 : 0;
|
|
102
|
+
if (newValue !== pullPosReachedState.current) {
|
|
103
|
+
pullPosReachedState.current = newValue;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
onPanResponderTerminationRequest: () => true,
|
|
107
|
+
onPanResponderRelease: onPanResponderFinish,
|
|
108
|
+
onPanResponderTerminate: onPanResponderFinish,
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const refreshIndicatorColor = useMemo(
|
|
113
|
+
() => (tintColor ? tintColor : colors && colors.length ? colors[0] : null),
|
|
114
|
+
[colors, tintColor],
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const containerStyle = useMemo(
|
|
118
|
+
(): StyleProp<ViewStyle> => [
|
|
119
|
+
style,
|
|
120
|
+
// @ts-ignore - overflowY is valid on web
|
|
121
|
+
{
|
|
122
|
+
overflowY: "hidden",
|
|
123
|
+
overflow: "hidden",
|
|
124
|
+
paddingTop: progressViewOffset,
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
[progressViewOffset, style],
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
const indicatorTransformStyle = useMemo(
|
|
131
|
+
() => ({
|
|
132
|
+
alignSelf: "center" as const,
|
|
133
|
+
justifyContent: "center" as const,
|
|
134
|
+
alignItems: "center" as const,
|
|
135
|
+
marginTop: -40,
|
|
136
|
+
height: 40,
|
|
137
|
+
transform: [{ translateY: pullDownSwipeMargin.current }],
|
|
138
|
+
}),
|
|
139
|
+
[],
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// This is messing with react-native-web's internal implementation
|
|
143
|
+
// Will probably break if anything changes on their end
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
145
|
+
const AnimatedContentContainer =
|
|
146
|
+
useMemo((): React.ComponentType<any> | null => {
|
|
147
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
148
|
+
const childElement = children as React.ReactElement<any>;
|
|
149
|
+
if (!childElement?.props?.children?.type) return null;
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
151
|
+
return withAnimated((childProps: any) =>
|
|
152
|
+
React.createElement(childElement.props.children.type, childProps),
|
|
153
|
+
);
|
|
154
|
+
}, [children]);
|
|
155
|
+
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
157
|
+
const childElement = children as React.ReactElement<any>;
|
|
158
|
+
const newContentContainerStyle = useMemo(
|
|
159
|
+
() => [
|
|
160
|
+
childElement?.props?.children?.props?.style,
|
|
161
|
+
{ transform: [{ translateY: pullDownSwipeMargin.current }] },
|
|
162
|
+
],
|
|
163
|
+
[childElement?.props?.children?.props?.style],
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
if (!childElement || !AnimatedContentContainer) {
|
|
167
|
+
return <>{children}</>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const newChildren = React.cloneElement(
|
|
171
|
+
childElement,
|
|
172
|
+
{},
|
|
173
|
+
<>
|
|
174
|
+
<Animated.View style={indicatorTransformStyle}>
|
|
175
|
+
<ActivityIndicator
|
|
176
|
+
color={refreshIndicatorColor || "#999999"}
|
|
177
|
+
size="small"
|
|
178
|
+
/>
|
|
179
|
+
</Animated.View>
|
|
180
|
+
<AnimatedContentContainer
|
|
181
|
+
{...childElement.props.children.props}
|
|
182
|
+
style={newContentContainerStyle}
|
|
183
|
+
/>
|
|
184
|
+
</>,
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<View
|
|
189
|
+
ref={containerRef}
|
|
190
|
+
style={containerStyle}
|
|
191
|
+
{...panResponder.current.panHandlers}
|
|
192
|
+
>
|
|
193
|
+
{newChildren}
|
|
194
|
+
</View>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
199
|
+
function withAnimated(
|
|
200
|
+
WrappedComponent: React.ComponentType<any>,
|
|
201
|
+
): React.ComponentType<any> {
|
|
202
|
+
const displayName =
|
|
203
|
+
WrappedComponent.displayName || WrappedComponent.name || "Component";
|
|
204
|
+
|
|
205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
206
|
+
class WithAnimated extends React.Component<any> {
|
|
207
|
+
static displayName = `WithAnimated(${displayName})`;
|
|
208
|
+
|
|
209
|
+
render() {
|
|
210
|
+
return <WrappedComponent {...this.props} />;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return Animated.createAnimatedComponent(WithAnimated);
|
|
215
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const VALUE_BYTES_LIMIT = 2048;
|
|
2
|
+
|
|
3
|
+
const KEYCHAIN_CONSTANTS = {
|
|
4
|
+
AFTER_FIRST_UNLOCK: 0,
|
|
5
|
+
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: 1,
|
|
6
|
+
ALWAYS: 2,
|
|
7
|
+
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: 3,
|
|
8
|
+
ALWAYS_THIS_DEVICE_ONLY: 4,
|
|
9
|
+
WHEN_UNLOCKED: 5,
|
|
10
|
+
WHEN_UNLOCKED_THIS_DEVICE_ONLY: 6,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type KeychainAccessibilityConstant = number;
|
|
14
|
+
export const {
|
|
15
|
+
AFTER_FIRST_UNLOCK,
|
|
16
|
+
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY,
|
|
17
|
+
ALWAYS,
|
|
18
|
+
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY,
|
|
19
|
+
ALWAYS_THIS_DEVICE_ONLY,
|
|
20
|
+
WHEN_UNLOCKED,
|
|
21
|
+
WHEN_UNLOCKED_THIS_DEVICE_ONLY,
|
|
22
|
+
} = KEYCHAIN_CONSTANTS;
|
|
23
|
+
|
|
24
|
+
export type SecureStoreOptions = {
|
|
25
|
+
keychainService?: string;
|
|
26
|
+
requireAuthentication?: boolean;
|
|
27
|
+
authenticationPrompt?: string;
|
|
28
|
+
keychainAccessible?: KeychainAccessibilityConstant;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function isValidValue(value: string) {
|
|
32
|
+
if (typeof value !== "string") {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (new Blob([value]).size > VALUE_BYTES_LIMIT) {
|
|
36
|
+
// biome-ignore lint/suspicious/noConsole: useful for debugging
|
|
37
|
+
console.warn(
|
|
38
|
+
`Value being stored in SecureStore is larger than ${VALUE_BYTES_LIMIT} bytes and it may not be stored successfully.`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getStorageKey(key: string): string {
|
|
45
|
+
return `_create_secure_store_${key}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function isAvailableAsync(): Promise<boolean> {
|
|
49
|
+
const testKey = "__SECURE_STORE_AVAILABILITY_TEST_KEY__";
|
|
50
|
+
try {
|
|
51
|
+
localStorage.setItem(testKey, "test");
|
|
52
|
+
if (localStorage.getItem(testKey) !== "test") {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
localStorage.removeItem(testKey);
|
|
56
|
+
return localStorage.getItem(testKey) === null;
|
|
57
|
+
} catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export async function deleteItemAsync(
|
|
63
|
+
key: string,
|
|
64
|
+
_options: SecureStoreOptions = {},
|
|
65
|
+
): Promise<void> {
|
|
66
|
+
localStorage.removeItem(getStorageKey(key));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function getItemAsync(
|
|
70
|
+
key: string,
|
|
71
|
+
_options: SecureStoreOptions = {},
|
|
72
|
+
): Promise<string | null> {
|
|
73
|
+
return localStorage.getItem(getStorageKey(key));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function setItemAsync(
|
|
77
|
+
key: string,
|
|
78
|
+
value: string,
|
|
79
|
+
_options: SecureStoreOptions = {},
|
|
80
|
+
): Promise<void> {
|
|
81
|
+
if (!isValidValue(value)) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
"Invalid value provided to SecureStore. Values must be strings; consider JSON-encoding your values if they are serializable.",
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
localStorage.setItem(getStorageKey(key), value);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function setItem(
|
|
90
|
+
key: string,
|
|
91
|
+
value: string,
|
|
92
|
+
_options: SecureStoreOptions = {},
|
|
93
|
+
): void {
|
|
94
|
+
if (!isValidValue(value)) {
|
|
95
|
+
throw new Error(
|
|
96
|
+
"Invalid value provided to SecureStore. Values must be strings; consider JSON-encoding your values if they are serializable.",
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
localStorage.setItem(getStorageKey(key), value);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function getItem(
|
|
103
|
+
key: string,
|
|
104
|
+
_options: SecureStoreOptions = {},
|
|
105
|
+
): string | null {
|
|
106
|
+
return localStorage.getItem(getStorageKey(key));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function canUseBiometricAuthentication(): boolean {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TextDecoderStream","TextEncoderStream","structuredClone","polyfillGlobal","globalThis","console","log"],"sourceRoot":"../../src","sources":["polyfills.ts"],"mappings":";;AAAA,SACEA,iBAAiB,EACjBC,iBAAiB,QACZ,kCAAkC;AACzC,OAAOC,eAAe,MAAM,yBAAyB;AACrD;AACA,SAASC,cAAc,QAAQ,oDAAoD;AAEnF,IAAI,EAAE,iBAAiB,IAAIC,UAAU,CAAC,EAAE;EACtCC,OAAO,CAACC,GAAG,CAAC,6BAA6B,CAAC;EAC1CH,cAAc,CAAC,iBAAiB,EAAE,MAAMD,eAAe,CAAC;AAC1D;AACAC,cAAc,CAAC,mBAAmB,EAAE,MAAMF,iBAAiB,CAAC;AAC5DE,cAAc,CAAC,mBAAmB,EAAE,MAAMH,iBAAiB,CAAC;AAE5D","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["polyfills.web.ts"],"mappings":";;AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../../src/polyfills/alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfills.d.ts","sourceRoot":"","sources":["../../../src/polyfills.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"polyfills.web.d.ts","sourceRoot":"","sources":["../../../src/polyfills.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
|
package/src/polyfills/alert.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|