catalyst-core 0.3.0-beta.5 → 0.3.0-canary.2
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/changelog.md +185 -71
- package/dist/errors/generateDocs.js +100 -0
- package/dist/errors/index.js +243 -0
- package/dist/errors/registry.js +483 -0
- package/dist/errors-index.json +506 -0
- package/dist/globals.d.ts +62 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.jsx +5 -8
- package/dist/logger.js +1 -1
- package/dist/native/androidProject/app/build.gradle.kts +142 -7
- package/dist/native/androidProject/app/src/main/AndroidManifest.xml +4 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/NativeBridge.kt +2 -2
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/BarcodeDetector.kt +3 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/camera/CameraSessionManager.kt +3 -0
- package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/FrameworkServerUtils.kt +43 -8
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/BridgeUtilsTest.kt +181 -1
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/CameraUtilsTest.kt +156 -236
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileSizeRouterUtilsTest.kt +471 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FileUtilsTest.kt +222 -226
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/FrameworkServerUtilsTest.kt +300 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/IntentUtilsTest.kt +244 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/MetricsMonitorTest.kt +359 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NativeBridgeTest.kt +108 -63
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/NotificationUtilsTest.kt +329 -385
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/OfflineCacheServiceTest.kt +302 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/PerfEventBufferTest.kt +133 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/UtilsKtTest.kt +152 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/WebCacheManagerTest.kt +145 -324
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/BarcodeDetectorTest.kt +132 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/HoldControllerTest.kt +155 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/TorchControllerTest.kt +150 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateMachineTest.kt +120 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/VideoStreamStateTest.kt +62 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ViewfinderMapperTest.kt +143 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/camera/ZoomControllerTest.kt +421 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/design/DesignTokensTest.kt +207 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/plugins/PluginBridgeTest.kt +368 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/FridaDetectorTest.kt +193 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckManagerTest.kt +260 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/security/SecurityCheckSchedulerTest.kt +166 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DeviceInfoUtilsTest.kt +167 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/DownloadUtilsTest.kt +197 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/NetworkMonitorTest.kt +271 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/PushNotificationUtilsTest.kt +119 -0
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/utils/SafeAreaUtilsTest.kt +108 -0
- package/dist/native/androidProject/build.gradle.kts +1 -0
- package/dist/native/androidProject/gradle/libs.versions.toml +26 -0
- package/dist/native/androidProject/settings.gradle.kts +11 -8
- package/dist/native/androidSetup.js +2 -2
- package/dist/native/bridge/WebBridge.d.ts +98 -0
- package/dist/native/bridge/WebBridge.js +40 -6
- package/dist/native/bridge/constants/NativeInterfaces.d.ts +391 -0
- package/dist/native/bridge/errors.d.ts +67 -0
- package/dist/native/bridge/errors.js +66 -151
- package/dist/native/bridge/hooks/index.d.ts +13 -0
- package/dist/native/bridge/hooks/index.js +0 -6
- package/dist/native/bridge/hooks/useAI.d.ts +1 -0
- package/dist/native/bridge/hooks/useAI.js +3 -1
- package/dist/native/bridge/hooks/useCamera.d.ts +86 -0
- package/dist/native/bridge/hooks/useCamera.js +35 -6
- package/dist/native/bridge/hooks/useDataProtection.d.ts +17 -0
- package/dist/native/bridge/hooks/useDeviceInfo.d.ts +34 -0
- package/dist/native/bridge/hooks/useDeviceInfo.js +5 -0
- package/dist/native/bridge/hooks/useFilePicker.d.ts +53 -0
- package/dist/native/bridge/hooks/useFilePicker.js +13 -0
- package/dist/native/bridge/hooks/useGoogleSignIn.d.ts +12 -0
- package/dist/native/bridge/hooks/useHapticFeedback.d.ts +76 -0
- package/dist/native/bridge/hooks/useHapticFeedback.js +6 -1
- package/dist/native/bridge/hooks/useIntent.d.ts +33 -0
- package/dist/native/bridge/hooks/useIntent.js +2 -0
- package/dist/native/bridge/hooks/useNativeTransition.d.ts +53 -0
- package/dist/native/bridge/hooks/useNativeTransition.js +12 -5
- package/dist/native/bridge/hooks/useNetworkStatus.d.ts +22 -0
- package/dist/native/bridge/hooks/useNetworkStatus.js +7 -0
- package/dist/native/bridge/hooks/useNotification.d.ts +83 -0
- package/dist/native/bridge/hooks/useNotification.js +81 -34
- package/dist/native/bridge/hooks/useSafeArea.d.ts +12 -0
- package/dist/native/bridge/hooks/useSafeArea.js +8 -0
- package/dist/native/bridge/hooks/useVideoStream.d.ts +67 -0
- package/dist/native/bridge/hooks/useVideoStream.js +38 -52
- package/dist/native/bridge/hooks/utils.d.ts +4 -0
- package/dist/native/bridge/hooks.d.ts +1 -0
- package/dist/native/bridge/perf/collectors/ApiCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/ApiCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/CacheCollector.d.ts +43 -0
- package/dist/native/bridge/perf/collectors/CacheCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/HookCollector.d.ts +37 -0
- package/dist/native/bridge/perf/collectors/HookCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/InsightsCollector.d.ts +103 -0
- package/dist/native/bridge/perf/collectors/InsightsCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/InteractionCollector.d.ts +53 -0
- package/dist/native/bridge/perf/collectors/InteractionCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/KeyboardCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/KeyboardCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/NavigationCollector.d.ts +37 -0
- package/dist/native/bridge/perf/collectors/NavigationCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.d.ts +30 -0
- package/dist/native/bridge/perf/collectors/NetworkTimingCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/RenderCollector.d.ts +47 -0
- package/dist/native/bridge/perf/collectors/RenderCollector.js +8 -0
- package/dist/native/bridge/perf/collectors/ScrollCollector.d.ts +29 -0
- package/dist/native/bridge/perf/collectors/ScrollCollector.js +4 -0
- package/dist/native/bridge/perf/collectors/ThreadCollector.d.ts +31 -0
- package/dist/native/bridge/perf/collectors/ThreadCollector.js +4 -0
- package/dist/native/bridge/perf/core/constants.d.ts +76 -0
- package/dist/native/bridge/perf/core/measure.d.ts +39 -0
- package/dist/native/bridge/perf/core/measure.js +4 -0
- package/dist/native/bridge/perf/core/session.d.ts +49 -0
- package/dist/native/bridge/perf/core/session.js +4 -0
- package/dist/native/bridge/perf/core/store.d.ts +37 -0
- package/dist/native/bridge/perf/core/store.js +4 -0
- package/dist/native/bridge/perf/core/summary.d.ts +60 -0
- package/dist/native/bridge/perf/core/traceExport.d.ts +10 -0
- package/dist/native/bridge/perf/core/waterfalls.d.ts +2 -0
- package/dist/native/bridge/perf/index.d.ts +63 -0
- package/dist/native/bridge/perf/index.js +4 -0
- package/dist/native/bridge/safeArea.d.ts +11 -0
- package/dist/native/bridge/safeArea.js +2 -0
- package/dist/native/bridge/useBaseHook.d.ts +137 -0
- package/dist/native/bridge/useBaseHook.js +34 -4
- package/dist/native/bridge/utils/CameraUtils.d.ts +94 -0
- package/dist/native/bridge/utils/CameraUtils.js +4 -0
- package/dist/native/bridge/utils/FileObjectConverter.d.ts +36 -0
- package/dist/native/bridge/utils/NativeBridge.d.ts +270 -0
- package/dist/native/bridge/utils/NativeBridge.js +10 -0
- package/dist/native/buildAndroid/index.js +1 -1
- package/dist/native/buildAppAndroid.js +9 -0
- package/dist/native/buildAppIos.js +16 -1
- package/dist/native/buildErrorFormat.js +57 -0
- package/dist/native/buildIos/config.js +15 -1
- package/dist/native/buildIos/index.js +1 -1
- package/dist/native/buildIos/plugins.js +10 -1
- package/dist/native/iosnativeWebView/CoreLogic/Package.swift +36 -0
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamState.swift +1 -1
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Camera/VideoStreamStateMachine.swift +6 -4
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/BootTimingUtility.swift +3 -3
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/FrameworkServerUtils.swift +14 -9
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NetworkMonitor.swift +11 -9
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NotificationHandlerProvider.swift +1 -1
- package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/URLWhitelistManager.swift +7 -7
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/AnyCodableTests.swift +154 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/BootTimingUtilityTests.swift +23 -5
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/CatalystConstantsTests.swift +192 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/ConfigMappingTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsErrorPathTests.swift +106 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/FrameworkServerUtilsLoopbackTests.swift +243 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/FrameworkServerUtilsTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NetworkMonitorTests.swift +119 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/NotificationHandlerProviderTests.swift +59 -0
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/NotificationHandlerTests.swift +1 -1
- package/dist/native/iosnativeWebView/{iosnativeWebViewTests → CoreLogic/Tests/CatalystCoreLogicTests}/URLWhitelistManagerTests.swift +1 -1
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateMachineTests.swift +171 -0
- package/dist/native/iosnativeWebView/CoreLogic/Tests/CatalystCoreLogicTests/VideoStreamStateTests.swift +91 -0
- package/dist/native/iosnativeWebView/Package.swift +10 -9
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/LocalNotificationHandler.swift +7 -2
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/NotificationManager.swift +1 -2
- package/dist/native/iosnativeWebView/Sources/CatalystNotifications/PushNotificationHandler.swift +5 -4
- package/dist/native/iosnativeWebView/Sources/Core/Camera/CameraSessionManager.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/HoldController.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Camera/NativeCameraManager.swift +6 -5
- package/dist/native/iosnativeWebView/Sources/Core/Camera/ZoomController.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Plugins/PluginBridge.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CacheManager.swift +31 -30
- package/dist/native/iosnativeWebView/Sources/Core/Utils/CameraTransportUtils.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/Utils/DeviceInfoUtils.swift +1 -1
- package/dist/native/iosnativeWebView/Sources/Core/Utils/FilePickerHandler.swift +22 -19
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ImageHandler.swift +40 -39
- package/dist/native/iosnativeWebView/Sources/Core/Utils/PerfEventBuffer.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/Utils/ResourceURLProtocol.swift +15 -15
- package/dist/native/iosnativeWebView/Sources/Core/Utils/WebKitConfig.swift +4 -3
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeCommandHandler.swift +6 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeDelegateHandler.swift +1 -0
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeFileHandler.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeJavaScriptInterface.swift +2 -1
- package/dist/native/iosnativeWebView/Sources/Core/WebView/BridgeMessageValidator.swift +3 -5
- package/dist/native/iosnativeWebView/Sources/Core/WebView/NativeBridge.swift +20 -13
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashView.swift +6 -5
- package/dist/native/iosnativeWebView/Sources/Core/WebView/SplashViewModel.swift +14 -13
- package/dist/native/iosnativeWebView/Sources/Core/WebView/TransitionManager.swift +3 -3
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebView.swift +9 -8
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewModel.swift +7 -6
- package/dist/native/iosnativeWebView/Sources/Core/WebView/WebViewNavigationDelegate.swift +24 -25
- package/dist/native/iosnativeWebView/iosnativeWebView/AppDelegate.swift +6 -1
- package/dist/native/iosnativeWebView/iosnativeWebView/ContentView.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebViewApp.swift +4 -0
- package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +2 -22
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/BridgeMessageValidatorTests.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/CacheManagerTests.swift +1 -0
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/FilePickerHandlerTests.swift +2 -1
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/NativeBridgeTests.swift +15 -9
- package/dist/native/iosnativeWebView/iosnativeWebViewTests/WebViewTests.swift +1 -0
- package/dist/native/setupEmulatorIos.js +2 -2
- package/dist/native/terminalProgress.js +17 -17
- package/dist/router/ClientRouter.d.ts +8 -0
- package/dist/router/ClientRouter.js +13 -11
- package/dist/router/ServerRouter.d.ts +13 -0
- package/dist/router/ServerRouter.js +19 -7
- package/dist/scripts/build.js +14 -2
- package/dist/scripts/loadEnvironmentVariables.js +3 -2
- package/dist/scripts/plugins.js +1 -1
- package/dist/scripts/preServerInit.js +49 -3
- package/dist/scripts/preflight.js +111 -0
- package/dist/scripts/scriptUtils.js +46 -1
- package/dist/scripts/serve.js +7 -3
- package/dist/scripts/start.js +8 -3
- package/dist/server/expressServer.d.ts +1 -0
- package/dist/server/expressServer.js +247 -271
- package/dist/server/manifestCache.d.ts +2 -0
- package/dist/server/manifestCache.js +25 -33
- package/dist/server/renderer/ChunkExtractor.d.ts +44 -0
- package/dist/server/renderer/ChunkExtractor.js +113 -125
- package/dist/server/renderer/document/Body.d.ts +21 -0
- package/dist/server/renderer/document/Body.jsx +45 -45
- package/dist/server/renderer/document/FastRefresh.d.ts +3 -0
- package/dist/server/renderer/document/FastRefresh.jsx +7 -13
- package/dist/server/renderer/document/Head.d.ts +20 -0
- package/dist/server/renderer/document/Head.jsx +32 -32
- package/dist/server/renderer/document/index.d.ts +2 -0
- package/dist/server/renderer/document/index.jsx +2 -2
- package/dist/server/renderer/extract.d.ts +67 -0
- package/dist/server/renderer/extract.js +92 -89
- package/dist/server/renderer/handler.d.ts +2 -0
- package/dist/server/renderer/handler.jsx +401 -404
- package/dist/server/renderer/index.d.ts +2 -0
- package/dist/server/renderer/index.js +5 -8
- package/dist/server/renderer/render.d.ts +35 -0
- package/dist/server/renderer/render.js +25 -32
- package/dist/server/utils/botDetectionMiddleware.d.ts +1 -0
- package/dist/server/utils/botDetectionMiddleware.js +33 -23
- package/dist/server/utils/cjsRequire.d.ts +8 -0
- package/dist/server/utils/cjsRequire.js +2 -2
- package/dist/server/utils/userAgentUtil.d.ts +7 -0
- package/dist/server/utils/userAgentUtil.js +68 -71
- package/dist/server/utils/validator.d.ts +31 -0
- package/dist/server/utils/validator.js +133 -158
- package/dist/vite/inject-cache-key-plugin.js +3 -27
- package/dist/vite/moduleAliases.js +36 -0
- package/dist/vite/node-loader.mjs +2 -29
- package/dist/vite/resolveDevServerConfig.js +4 -1
- package/dist/vite/vite.config.js +2 -29
- package/dist/web-router/components/MetaTag.d.ts +4 -0
- package/dist/web-router/components/MetaTag.jsx +26 -28
- package/dist/web-router/components/MetaTag.test.jsx +100 -0
- package/dist/web-router/components/RouterDataProvider.d.ts +96 -0
- package/dist/web-router/components/RouterDataProvider.jsx +260 -259
- package/dist/web-router/components/RouterDataProvider.server.test.jsx +98 -0
- package/dist/web-router/components/RouterDataProvider.test.jsx +310 -0
- package/dist/web-router/components/Split.d.ts +74 -0
- package/dist/web-router/components/Split.jsx +147 -156
- package/dist/web-router/components/Split.server.test.jsx +52 -0
- package/dist/web-router/components/Split.test.jsx +167 -0
- package/dist/web-router/components/SplitInview.d.ts +22 -0
- package/dist/web-router/components/SplitInview.jsx +78 -89
- package/dist/web-router/components/SplitInview.test.jsx +112 -0
- package/dist/web-router/components/SsrRequestContext.d.ts +20 -0
- package/dist/web-router/components/SsrRequestContext.jsx +17 -7
- package/dist/web-router/components/SsrRequestContext.test.jsx +53 -0
- package/dist/web-router/context.d.ts +15 -0
- package/dist/web-router/context.jsx +5 -5
- package/dist/web-router/context.test.jsx +10 -0
- package/dist/web-router/utils/metaDataUtils.d.ts +24 -0
- package/dist/web-router/utils/metaDataUtils.jsx +86 -86
- package/dist/web-router/utils/metaDataUtils.test.jsx +188 -0
- package/dist/web-router/vitest.setup.js +12 -0
- package/mcp_v2/knowledge-base.json +115 -17
- package/mcp_v2/mcp.js +141 -3
- package/mcp_v2/package-lock.json +2031 -0
- package/mcp_v2/package.json +13 -2
- package/mcp_v2/scripts/copyErrorsIndex.cjs +34 -0
- package/mcp_v2/test/errors.test.ts +123 -0
- package/mcp_v2/test/github.test.ts +177 -0
- package/mcp_v2/tools/errors.d.ts +20 -0
- package/mcp_v2/tools/errors.js +63 -0
- package/mcp_v2/tools/github.d.ts +41 -0
- package/mcp_v2/tools/github.js +231 -0
- package/mcp_v2/vitest.config.mjs +22 -0
- package/package.json +60 -11
- package/test/errors/docsDrift.test.ts +113 -0
- package/test/errors/index.test.ts +200 -0
- package/test/errors/registry.test.ts +108 -0
- package/test/scripts/preflight.test.ts +118 -0
- package/test/server/ChunkExtractor.test.ts +97 -0
- package/test/server/extract.test.ts +128 -0
- package/test/server/fixtures/template/server/document.jsx +19 -0
- package/test/server/fixtures/template/server/index.js +10 -0
- package/test/server/fixtures/template/src/js/containers/App/index.jsx +33 -0
- package/test/server/fixtures/template/src/js/routes/index.jsx +72 -0
- package/test/server/fixtures/template/src/js/routes/utils.jsx +39 -0
- package/test/server/fixtures/template/src/js/store/index.js +19 -0
- package/test/server/handler.assets.test.ts +330 -0
- package/test/server/handler.test.ts +208 -0
- package/test/server/manifestCache.test.ts +71 -0
- package/test/server/render.test.ts +71 -0
- package/test/server/scriptUtils.test.ts +103 -0
- package/test/server/userAgentUtil.test.ts +48 -0
- package/test/server/validator.test.ts +225 -0
- package/test/vite/resolveDevServerConfig.test.js +4 -1
- package/tsconfig.test.json +23 -0
- package/vitest.config.ts +93 -0
- package/dist/caching.js +0 -1
- package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/DeviceInfoUtilsTest.kt +0 -187
- package/dist/native/bridge/standardizedHooks.js +0 -611
- package/dist/router.js +0 -1
- package/dist/scripts/validator.js +0 -149
- package/dist/web-router/hooks.jsx +0 -72
- package/dist/web-router/types/components/MetaTag.d.ts +0 -2
- package/dist/web-router/types/components/RouterDataProvider.d.ts +0 -95
- package/dist/web-router/types/context.d.ts +0 -14
- package/dist/web-router/types/hooks.d.ts +0 -1
- package/dist/web-router/types/index.d.ts +0 -3
- package/dist/web-router/types/utils/metaDataUtils.d.ts +0 -40
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/CatalystConstants.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Constants/ConfigConstants.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Notifications/NotificationModels.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Protocols/NotificationHandlerProtocol.swift +0 -0
- /package/dist/native/iosnativeWebView/{Sources/Core → CoreLogic/Sources/CatalystCoreLogic}/Utils/NullNotificationHandler.swift +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { StandardError } from "./errors";
|
|
2
|
+
/**
|
|
3
|
+
* Progress of a long-running native operation, as reported through the
|
|
4
|
+
* `progress` key that every operation-carrying hook returns.
|
|
5
|
+
*/
|
|
6
|
+
export interface HookProgress {
|
|
7
|
+
/** Coarse lifecycle state — see {@link PROGRESS_STATES}. */
|
|
8
|
+
state: string;
|
|
9
|
+
/** Completion from 0-100, or null when the operation cannot report it. */
|
|
10
|
+
percentage: number | null;
|
|
11
|
+
/** Human-readable status message, or null. */
|
|
12
|
+
message: string | null;
|
|
13
|
+
/** Operation-specific phase, or null. */
|
|
14
|
+
phase: string | null;
|
|
15
|
+
/** Transport the native side chose for the payload, or null. */
|
|
16
|
+
transport: string | null;
|
|
17
|
+
/** Bytes transferred so far, or null. */
|
|
18
|
+
bytesLoaded: number | null;
|
|
19
|
+
/** Total bytes expected, or null. */
|
|
20
|
+
bytesTotal: number | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The runtime-context keys every native hook returns, whatever else it adds.
|
|
24
|
+
*
|
|
25
|
+
* `isNative` and `isWeb` are always complementary booleans, resolved live at
|
|
26
|
+
* render time rather than cached from SSR.
|
|
27
|
+
*/
|
|
28
|
+
export interface HookEnvironment {
|
|
29
|
+
/** True when running inside a native WebView with the bridge available. */
|
|
30
|
+
isNative: boolean;
|
|
31
|
+
/** True when running on the plain web. Always `!isNative`. */
|
|
32
|
+
isWeb: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The state contract shared by every native hook: the data/loading/error triple
|
|
36
|
+
* plus the runtime-context keys.
|
|
37
|
+
*
|
|
38
|
+
* Two hooks are exempt from the `error` half — `useNativeTransition` and
|
|
39
|
+
* `useSafeArea` return no `error` key at all — and two carry it with the wrong
|
|
40
|
+
* type: `error` on `useDeviceInfo` and `useNetworkStatus` is a plain string
|
|
41
|
+
* rather than a {@link StandardError}, and stays a string until 2.0.
|
|
42
|
+
*
|
|
43
|
+
* @typeParam TData - what the hook's `data` key holds.
|
|
44
|
+
*/
|
|
45
|
+
export interface HookState<TData = any> extends HookEnvironment {
|
|
46
|
+
/** The hook's payload, or null before it has one. */
|
|
47
|
+
data: TData | null;
|
|
48
|
+
/** True while a native operation is in flight. */
|
|
49
|
+
loading: boolean;
|
|
50
|
+
/** The last error, or null. */
|
|
51
|
+
error: StandardError | null;
|
|
52
|
+
}
|
|
53
|
+
/** Options accepted by hooks that can fall back to a web implementation. */
|
|
54
|
+
export interface WebFallbackOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Opt out of the hook's web fallback by passing `false`. When omitted, the
|
|
57
|
+
* fallback is controlled imperatively through `setWebFallback` instead.
|
|
58
|
+
*/
|
|
59
|
+
webFallback?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** The web-fallback control keys returned by hooks that declare a fallback. */
|
|
62
|
+
export interface WebFallbackState {
|
|
63
|
+
/** True when the hook is serving its web fallback implementation. */
|
|
64
|
+
webFallbackActive: boolean;
|
|
65
|
+
/** True when on web and the fallback has been turned off. */
|
|
66
|
+
webFallbackDisabled: boolean;
|
|
67
|
+
/** Imperatively enable or disable the web fallback. */
|
|
68
|
+
setWebFallback: (enabled: boolean) => void;
|
|
69
|
+
}
|
|
70
|
+
/** Configuration passed by a hook to {@link useBaseHook}. */
|
|
71
|
+
interface UseBaseHookOptions extends WebFallbackOptions {
|
|
72
|
+
/** Whether this hook implements a web fallback at all. */
|
|
73
|
+
hasWebFallback?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Base hook utility that provides standardized interface for all Catalyst hooks
|
|
77
|
+
* Handles environment detection, error standardization, and common state management
|
|
78
|
+
*
|
|
79
|
+
* @param hookName - Name of the hook for debugging purposes
|
|
80
|
+
* @returns Base hook interface with common functionality
|
|
81
|
+
*/
|
|
82
|
+
export declare const useBaseHook: (hookName: string, { hasWebFallback, webFallback }?: UseBaseHookOptions) => {
|
|
83
|
+
isWeb: boolean;
|
|
84
|
+
isNative: boolean;
|
|
85
|
+
data: any;
|
|
86
|
+
loading: boolean;
|
|
87
|
+
progress: HookProgress;
|
|
88
|
+
error: any;
|
|
89
|
+
webFallbackActive: boolean;
|
|
90
|
+
webFallbackDisabled: boolean;
|
|
91
|
+
setWebFallback: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
92
|
+
clear: () => void;
|
|
93
|
+
clearError: () => void;
|
|
94
|
+
setData: import("react").Dispatch<any>;
|
|
95
|
+
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
96
|
+
setError: import("react").Dispatch<any>;
|
|
97
|
+
setProgress: import("react").Dispatch<import("react").SetStateAction<HookProgress>>;
|
|
98
|
+
updateProgress: (updates: Partial<HookProgress>) => void;
|
|
99
|
+
resetProgress: () => void;
|
|
100
|
+
startProgress: (phase?: string | null, message?: string | null) => void;
|
|
101
|
+
completeProgress: () => void;
|
|
102
|
+
errorProgress: () => void;
|
|
103
|
+
setDataAndComplete: (newData: any) => void;
|
|
104
|
+
handleNativeError: (nativeError: any) => StandardError;
|
|
105
|
+
callNative: (fn: () => void) => void;
|
|
106
|
+
executeOperation: (operationCallback: () => void, operationName?: string) => void;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Hook for development debugging and testing
|
|
110
|
+
* @param hookName
|
|
111
|
+
* @returns Environment information and utilities
|
|
112
|
+
*/
|
|
113
|
+
export declare const useEnvironmentInfo: (hookName: string) => {
|
|
114
|
+
isNative: boolean;
|
|
115
|
+
isWeb: boolean;
|
|
116
|
+
environmentDetails: any;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Progress state constants for consistency across hooks
|
|
120
|
+
*/
|
|
121
|
+
export declare const PROGRESS_STATES: {
|
|
122
|
+
IDLE: string;
|
|
123
|
+
STARTING: string;
|
|
124
|
+
COMPLETE: string;
|
|
125
|
+
ERROR: string;
|
|
126
|
+
OPENING: string;
|
|
127
|
+
PROCESSING: string;
|
|
128
|
+
ROUTING: string;
|
|
129
|
+
REQUESTING: string;
|
|
130
|
+
CAPTURING: string;
|
|
131
|
+
DOWNLOADING: string;
|
|
132
|
+
OPENING_FILE: string;
|
|
133
|
+
CONNECTING: string;
|
|
134
|
+
UPLOADING: string;
|
|
135
|
+
SERVING: string;
|
|
136
|
+
};
|
|
137
|
+
export {};
|
|
@@ -8,12 +8,42 @@ var _react = require("react");
|
|
|
8
8
|
var _NativeBridge = _interopRequireDefault(require("./utils/NativeBridge.js"));
|
|
9
9
|
var _errors = require("./errors");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
/**
|
|
12
|
+
* Progress of a long-running native operation, as reported through the
|
|
13
|
+
* `progress` key that every operation-carrying hook returns.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The runtime-context keys every native hook returns, whatever else it adds.
|
|
18
|
+
*
|
|
19
|
+
* `isNative` and `isWeb` are always complementary booleans, resolved live at
|
|
20
|
+
* render time rather than cached from SSR.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The state contract shared by every native hook: the data/loading/error triple
|
|
25
|
+
* plus the runtime-context keys.
|
|
26
|
+
*
|
|
27
|
+
* Two hooks are exempt from the `error` half — `useNativeTransition` and
|
|
28
|
+
* `useSafeArea` return no `error` key at all — and two carry it with the wrong
|
|
29
|
+
* type: `error` on `useDeviceInfo` and `useNetworkStatus` is a plain string
|
|
30
|
+
* rather than a {@link StandardError}, and stays a string until 2.0.
|
|
31
|
+
*
|
|
32
|
+
* @typeParam TData - what the hook's `data` key holds.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/** Options accepted by hooks that can fall back to a web implementation. */
|
|
36
|
+
|
|
37
|
+
/** The web-fallback control keys returned by hooks that declare a fallback. */
|
|
38
|
+
|
|
39
|
+
/** Configuration passed by a hook to {@link useBaseHook}. */
|
|
40
|
+
|
|
11
41
|
/**
|
|
12
42
|
* Base hook utility that provides standardized interface for all Catalyst hooks
|
|
13
43
|
* Handles environment detection, error standardization, and common state management
|
|
14
44
|
*
|
|
15
|
-
* @param
|
|
16
|
-
* @returns
|
|
45
|
+
* @param hookName - Name of the hook for debugging purposes
|
|
46
|
+
* @returns Base hook interface with common functionality
|
|
17
47
|
*/
|
|
18
48
|
const useBaseHook = (hookName, {
|
|
19
49
|
hasWebFallback = false,
|
|
@@ -224,8 +254,8 @@ const useBaseHook = (hookName, {
|
|
|
224
254
|
|
|
225
255
|
/**
|
|
226
256
|
* Hook for development debugging and testing
|
|
227
|
-
* @param
|
|
228
|
-
* @returns
|
|
257
|
+
* @param hookName
|
|
258
|
+
* @returns Environment information and utilities
|
|
229
259
|
*/
|
|
230
260
|
exports.useBaseHook = useBaseHook;
|
|
231
261
|
const useEnvironmentInfo = hookName => {
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** Options accepted when opening the native camera. */
|
|
2
|
+
export interface CameraOptions {
|
|
3
|
+
/** Image quality: `"high"`, `"medium"` or `"low"`. */
|
|
4
|
+
quality?: string;
|
|
5
|
+
/** Image format: `"jpeg"` or `"png"`. */
|
|
6
|
+
format?: string;
|
|
7
|
+
/** Which camera to use: `"front"` or `"rear"`. */
|
|
8
|
+
cameraDevice?: string;
|
|
9
|
+
/** Flash behaviour: `"auto"`, `"on"` or `"off"`. */
|
|
10
|
+
flashMode?: string;
|
|
11
|
+
/** Whether to let the user edit the image after capture. */
|
|
12
|
+
allowEditing?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Configuration accepted when requesting camera permission. */
|
|
15
|
+
export interface CameraPermissionConfig {
|
|
16
|
+
/** Ask the native side for a detailed permission payload. */
|
|
17
|
+
includeDetails?: boolean;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Camera Utility Module
|
|
22
|
+
* Provides Promise-based camera operations with proper option validation
|
|
23
|
+
*/
|
|
24
|
+
declare class CameraUtils {
|
|
25
|
+
/**
|
|
26
|
+
* Open camera and capture image
|
|
27
|
+
* @param {Object} options - Camera options
|
|
28
|
+
* @param {string} options.quality - Image quality: 'high', 'medium', 'low'
|
|
29
|
+
* @param {string} options.format - Image format: 'jpeg', 'png'
|
|
30
|
+
* @param {string} options.cameraDevice - Camera device: 'front', 'rear'
|
|
31
|
+
* @param {string} options.flashMode - Flash mode: 'auto', 'on', 'off'
|
|
32
|
+
* @param {boolean} options.allowEditing - Allow image editing after capture
|
|
33
|
+
* @param {Function} registerCallback - Callback registration function
|
|
34
|
+
* @param {Function} unregisterCallback - Callback unregistration function
|
|
35
|
+
* @returns {Promise<Object>} - Promise that resolves with camera result or rejects with error
|
|
36
|
+
*/
|
|
37
|
+
static openCamera(options: CameraOptions, registerCallback: (event: string, handler: (data: any) => void) => void, unregisterCallback: (event: string) => void): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Request camera permission
|
|
40
|
+
* @param {Object} config - Permission configuration
|
|
41
|
+
* @param {boolean} config.includeDetails - Include detailed permission info in response
|
|
42
|
+
* @param {Function} registerCallback - Callback registration function
|
|
43
|
+
* @param {Function} unregisterCallback - Callback unregistration function
|
|
44
|
+
* @returns {Promise<Object>} - Promise that resolves with permission status or rejects with error
|
|
45
|
+
*/
|
|
46
|
+
static requestCameraPermission(config: CameraPermissionConfig, registerCallback: (event: string, handler: (data: any) => void) => void, unregisterCallback: (event: string) => void): Promise<any>;
|
|
47
|
+
/**
|
|
48
|
+
* Validate camera options and set defaults
|
|
49
|
+
* @param {Object} options - Raw camera options
|
|
50
|
+
* @returns {Object} - Validated camera options with defaults
|
|
51
|
+
*/
|
|
52
|
+
static validateCameraOptions(options: CameraOptions): CameraOptions;
|
|
53
|
+
/**
|
|
54
|
+
* Get default camera options
|
|
55
|
+
* @returns {Object} - Default camera options
|
|
56
|
+
*/
|
|
57
|
+
static getDefaultOptions(): {
|
|
58
|
+
quality: string;
|
|
59
|
+
format: string;
|
|
60
|
+
allowEditing: boolean;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Get default permission config
|
|
64
|
+
* @returns {Object} - Default permission config
|
|
65
|
+
*/
|
|
66
|
+
static getDefaultPermissionConfig(): {
|
|
67
|
+
includeDetails: boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Validate camera quality
|
|
71
|
+
* @param {string} quality - Quality string to validate
|
|
72
|
+
* @returns {boolean} - True if valid quality
|
|
73
|
+
*/
|
|
74
|
+
static isValidQuality(quality: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Validate camera format
|
|
77
|
+
* @param {string} format - Format string to validate
|
|
78
|
+
* @returns {boolean} - True if valid format
|
|
79
|
+
*/
|
|
80
|
+
static isValidFormat(format: string): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Validate camera device
|
|
83
|
+
* @param {string} device - Device string to validate
|
|
84
|
+
* @returns {boolean} - True if valid device
|
|
85
|
+
*/
|
|
86
|
+
static isValidDevice(device: string): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Validate flash mode
|
|
89
|
+
* @param {string} flashMode - Flash mode string to validate
|
|
90
|
+
* @returns {boolean} - True if valid flash mode
|
|
91
|
+
*/
|
|
92
|
+
static isValidFlashMode(flashMode: string): boolean;
|
|
93
|
+
}
|
|
94
|
+
export default CameraUtils;
|
|
@@ -7,6 +7,10 @@ exports.default = void 0;
|
|
|
7
7
|
var _NativeInterfaces = require("../constants/NativeInterfaces.js");
|
|
8
8
|
var _NativeBridge = _interopRequireDefault(require("./NativeBridge.js"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
/** Options accepted when opening the native camera. */
|
|
11
|
+
|
|
12
|
+
/** Configuration accepted when requesting camera permission. */
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* Camera Utility Module
|
|
12
16
|
* Provides Promise-based camera operations with proper option validation
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FileObjectConverter
|
|
3
|
+
* Converts base64 and URL file data to JavaScript File objects
|
|
4
|
+
* for direct use in FormData and POST API calls
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Convert base64 data URI to File object (synchronous)
|
|
8
|
+
* @param {string} base64String - Base64 data URI (e.g., "data:image/jpeg;base64,...")
|
|
9
|
+
* @param {string} filename - Desired filename for the File object
|
|
10
|
+
* @param {string} mimeType - MIME type (e.g., "image/jpeg")
|
|
11
|
+
* @returns {File} JavaScript File object
|
|
12
|
+
* @throws {Error} If base64 string is invalid or conversion fails
|
|
13
|
+
*/
|
|
14
|
+
export declare function base64ToFile(base64String: any, filename: any, mimeType: any): File;
|
|
15
|
+
/**
|
|
16
|
+
* Fetch file from URL and convert to File object (asynchronous)
|
|
17
|
+
* Used for Framework Server routes (localhost:8080)
|
|
18
|
+
* @param {string} url - File URL (e.g., "http://localhost:8080/file/xyz")
|
|
19
|
+
* @param {string} filename - Desired filename for the File object
|
|
20
|
+
* @param {string} mimeType - MIME type (e.g., "image/jpeg")
|
|
21
|
+
* @returns {Promise<File>} JavaScript File object
|
|
22
|
+
* @throws {Error} If fetch fails or conversion fails
|
|
23
|
+
*/
|
|
24
|
+
export declare function urlToFile(url: any, filename: any, mimeType: any): Promise<File>;
|
|
25
|
+
/**
|
|
26
|
+
* Check if a File object can be created from the given transport type
|
|
27
|
+
* @param {string} transport - Transport type (BRIDGE_BASE64, FRAMEWORK_SERVER, CONTENT_PROVIDER)
|
|
28
|
+
* @returns {boolean} True if File object can be created
|
|
29
|
+
*/
|
|
30
|
+
export declare function canCreateFileObject(transport: any): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Get user-friendly error message for unsupported transport
|
|
33
|
+
* @param {string} transport - Transport type
|
|
34
|
+
* @returns {string} Error message
|
|
35
|
+
*/
|
|
36
|
+
export declare function getUnsupportedTransportMessage(transport: any): string;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NativeBridge Utility
|
|
3
|
+
* Handles communication from Web to Native platforms
|
|
4
|
+
* Supports both Android (window.NativeBridge) and iOS (webkit.messageHandlers)
|
|
5
|
+
*/
|
|
6
|
+
declare class NativeBridgeUtil {
|
|
7
|
+
/**
|
|
8
|
+
* Platform detection, resolved once at construction.
|
|
9
|
+
*
|
|
10
|
+
* Declared without initializers so they erase at compile time — the
|
|
11
|
+
* constructor below stays the only thing that assigns them.
|
|
12
|
+
*
|
|
13
|
+
* These are a snapshot; `isAvailable()` re-detects live for callers that
|
|
14
|
+
* must not read a stale value.
|
|
15
|
+
*/
|
|
16
|
+
isAndroid: boolean;
|
|
17
|
+
isIOS: boolean;
|
|
18
|
+
isNativeEnvironment: boolean;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Detect if running on Android WebView
|
|
22
|
+
*/
|
|
23
|
+
_detectAndroid(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Detect if running on iOS WebView
|
|
26
|
+
*/
|
|
27
|
+
_detectIOS(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Log environment detection info for debugging
|
|
30
|
+
*/
|
|
31
|
+
_logEnvironmentInfo(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Validate command before execution
|
|
34
|
+
*/
|
|
35
|
+
_validateCommand(command: any): void;
|
|
36
|
+
/**
|
|
37
|
+
* Execute command on Android platform
|
|
38
|
+
*/
|
|
39
|
+
_executeAndroidCommand(command: any, data: any): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Execute command on iOS platform
|
|
42
|
+
*/
|
|
43
|
+
_executeIOSCommand(command: any, data: any): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Main method to call native commands
|
|
46
|
+
* @param {string} command - The command to execute (from NATIVE_COMMANDS)
|
|
47
|
+
* @param {any} data - Optional data to pass to the native side
|
|
48
|
+
* @returns {boolean} - Success status
|
|
49
|
+
*/
|
|
50
|
+
call(command: any, data?: any): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Video stream methods
|
|
53
|
+
*/
|
|
54
|
+
videoStream: {
|
|
55
|
+
/**
|
|
56
|
+
* Start native camera video stream
|
|
57
|
+
* @param {Object} options - Stream options
|
|
58
|
+
* facing: 'back' | 'front'
|
|
59
|
+
* format: 'qr' | 'barcode' | 'all' — format filter (default: 'all')
|
|
60
|
+
* zoom: { auto: true, initial: 1.0 } — auto-zoom via ML Kit, initial is multiplier (1.0=1x)
|
|
61
|
+
* zoom: { auto: false, initial: 2.0 } — manual, starts at 2x
|
|
62
|
+
*/
|
|
63
|
+
start: (options?: {}) => boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Stop native camera video stream
|
|
66
|
+
*/
|
|
67
|
+
stop: () => boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Set zoom level multiplier (e.g. 1.0 = 1x, 2.0 = 2x)
|
|
70
|
+
* @param {number} zoomPct - multiplier >= 1.0
|
|
71
|
+
*/
|
|
72
|
+
setZoom: (zoomPct: any) => boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Enable or disable torch (back camera only)
|
|
75
|
+
* @param {boolean} on
|
|
76
|
+
*/
|
|
77
|
+
setTorch: (on: any) => boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Set target FPS range — triggers session restart
|
|
80
|
+
* @param {number|null} min - minimum fps (e.g. 15), null to clear
|
|
81
|
+
* @param {number|null} max - maximum fps (e.g. 30), null to clear
|
|
82
|
+
*/
|
|
83
|
+
setFps: (min: any, max: any) => boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Flip between front and back camera — restarts the native session internally
|
|
86
|
+
* Torch resets to off after flip; ON_TORCH_CHANGED(false) fires automatically.
|
|
87
|
+
*/
|
|
88
|
+
flip: () => boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Camera-specific methods for easier usage
|
|
92
|
+
*/
|
|
93
|
+
camera: {
|
|
94
|
+
/**
|
|
95
|
+
* Open camera for photo capture
|
|
96
|
+
* @param {string} options - JSON string of camera options
|
|
97
|
+
*/
|
|
98
|
+
open: (options?: any) => boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Request camera permission
|
|
101
|
+
* @param {string} config - JSON string of permission config
|
|
102
|
+
*/
|
|
103
|
+
requestPermission: (config?: any) => boolean;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* File-specific methods for easier usage
|
|
107
|
+
*/
|
|
108
|
+
file: {
|
|
109
|
+
/**
|
|
110
|
+
* Open file picker
|
|
111
|
+
* @param {string|Object|null} options - MIME type string or options object with advanced config
|
|
112
|
+
*/
|
|
113
|
+
pick: (options?: string | Record<string, any> | null) => boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Open file with external app
|
|
116
|
+
* @param {string} fileUrl - URL of the file to open
|
|
117
|
+
* @param {string} mimeType - Optional MIME type
|
|
118
|
+
*/
|
|
119
|
+
openWithIntent: (fileUrl: any, mimeType?: any) => boolean;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Network helpers
|
|
123
|
+
*/
|
|
124
|
+
network: {
|
|
125
|
+
/**
|
|
126
|
+
* Request current network status from native side
|
|
127
|
+
*/
|
|
128
|
+
getStatus: () => boolean;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Haptic feedback methods
|
|
132
|
+
*/
|
|
133
|
+
haptic: {
|
|
134
|
+
/**
|
|
135
|
+
* Request haptic feedback
|
|
136
|
+
* @param {string} feedbackType - Type of haptic feedback
|
|
137
|
+
*/
|
|
138
|
+
feedback: (feedbackType?: string) => boolean;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Notification methods for local and push notifications
|
|
142
|
+
*/
|
|
143
|
+
notification: {
|
|
144
|
+
/**
|
|
145
|
+
* Schedule a local notification
|
|
146
|
+
* @param {Object} config - Notification configuration object
|
|
147
|
+
*/
|
|
148
|
+
scheduleLocal: (config: any) => boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Cancel a local notification
|
|
151
|
+
* @param {string} notificationId - ID of the notification to cancel
|
|
152
|
+
*/
|
|
153
|
+
cancelLocal: (notificationId: any) => boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Request notification permission
|
|
156
|
+
*/
|
|
157
|
+
requestPermission: () => boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Register for push notifications
|
|
160
|
+
*/
|
|
161
|
+
registerForPush: () => boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Update badge count
|
|
164
|
+
* @param {number} count - Badge count number
|
|
165
|
+
*/
|
|
166
|
+
updateBadge: (count: any) => boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Subscribe to push notification topic
|
|
169
|
+
* @param {string} topic - Topic name to subscribe to
|
|
170
|
+
*/
|
|
171
|
+
subscribeToTopic: (topic: any) => boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Unsubscribe from push notification topic
|
|
174
|
+
* @param {string} topic - Topic name to unsubscribe from
|
|
175
|
+
*/
|
|
176
|
+
unsubscribeFromTopic: (topic: any) => boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Get list of subscribed topics
|
|
179
|
+
*/
|
|
180
|
+
getSubscribedTopics: () => boolean;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Device info methods
|
|
184
|
+
*/
|
|
185
|
+
device: {
|
|
186
|
+
/**
|
|
187
|
+
* Get device information
|
|
188
|
+
* @returns {Promise} - Returns device info through callback
|
|
189
|
+
*/
|
|
190
|
+
getDeviceInfo: () => boolean;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Auth methods
|
|
194
|
+
*/
|
|
195
|
+
auth: {
|
|
196
|
+
/**
|
|
197
|
+
* Trigger Google Sign-In (Credential Manager)
|
|
198
|
+
* @param {Object} options - config (clientId, nonce, autoSelect, etc.)
|
|
199
|
+
*/
|
|
200
|
+
googleSignIn: (options?: {}) => boolean;
|
|
201
|
+
};
|
|
202
|
+
/** Safe area methods
|
|
203
|
+
*/
|
|
204
|
+
safeArea: {
|
|
205
|
+
/**
|
|
206
|
+
* Get current safe area insets
|
|
207
|
+
* Returns insets through ON_SAFE_AREA_INSETS_UPDATED callback
|
|
208
|
+
*/
|
|
209
|
+
get: () => boolean;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* Security methods
|
|
213
|
+
*/
|
|
214
|
+
security: {
|
|
215
|
+
/**
|
|
216
|
+
* Enable or disable FLAG_SECURE (prevents screenshots / app-switcher caching)
|
|
217
|
+
* @param {boolean} enable - true to secure, false to unsecure
|
|
218
|
+
*/
|
|
219
|
+
setScreenSecure: (enable: any) => boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Query current FLAG_SECURE status
|
|
222
|
+
* Returns result through ON_SCREEN_SECURE_SET callback
|
|
223
|
+
*/
|
|
224
|
+
getScreenSecure: () => boolean;
|
|
225
|
+
/**
|
|
226
|
+
* Clear all WebView data (cache, history, cookies, WebStorage)
|
|
227
|
+
* Returns result through ON_WEB_DATA_CLEARED / ON_WEB_DATA_CLEAR_ERROR callback
|
|
228
|
+
*/
|
|
229
|
+
clearWebData: () => boolean;
|
|
230
|
+
};
|
|
231
|
+
transition: {
|
|
232
|
+
/**
|
|
233
|
+
* Begin a native transition — native takes a snapshot/overlay of the current screen.
|
|
234
|
+
* @param {Object} options
|
|
235
|
+
* type: 'slide' | 'fade'
|
|
236
|
+
* direction: 'left' | 'right' | 'up' | 'down' (slide only)
|
|
237
|
+
* duration: number (ms, default 300)
|
|
238
|
+
* timeout: number (ms, safety timer — native force-fades overlay if commitTransition is never called)
|
|
239
|
+
*/
|
|
240
|
+
start: (options?: {}) => boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Commit the transition — native animates the snapshot overlay out, revealing the new page.
|
|
243
|
+
*/
|
|
244
|
+
commit: () => boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Cancel the transition — native removes the overlay immediately without animating.
|
|
247
|
+
*/
|
|
248
|
+
cancel: () => boolean;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* Get environment info
|
|
252
|
+
*/
|
|
253
|
+
getEnvironmentInfo(): {
|
|
254
|
+
isAndroid: boolean;
|
|
255
|
+
isIOS: boolean;
|
|
256
|
+
isNativeEnvironment: boolean;
|
|
257
|
+
platform: string;
|
|
258
|
+
};
|
|
259
|
+
/**
|
|
260
|
+
* Check if native bridge is available — live check, never stale
|
|
261
|
+
*/
|
|
262
|
+
isAvailable(): boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Debug method to test native bridge connectivity
|
|
265
|
+
*/
|
|
266
|
+
testConnection(): void;
|
|
267
|
+
}
|
|
268
|
+
declare const nativeBridge: NativeBridgeUtil;
|
|
269
|
+
export default nativeBridge;
|
|
270
|
+
export { NativeBridgeUtil };
|
|
@@ -11,6 +11,16 @@ var _NativeInterfaces = require("../constants/NativeInterfaces.js");
|
|
|
11
11
|
* Supports both Android (window.NativeBridge) and iOS (webkit.messageHandlers)
|
|
12
12
|
*/
|
|
13
13
|
class NativeBridgeUtil {
|
|
14
|
+
/**
|
|
15
|
+
* Platform detection, resolved once at construction.
|
|
16
|
+
*
|
|
17
|
+
* Declared without initializers so they erase at compile time — the
|
|
18
|
+
* constructor below stays the only thing that assigns them.
|
|
19
|
+
*
|
|
20
|
+
* These are a snapshot; `isAvailable()` re-detects live for callers that
|
|
21
|
+
* must not read a stale value.
|
|
22
|
+
*/
|
|
23
|
+
|
|
14
24
|
constructor() {
|
|
15
25
|
this.isAndroid = this._detectAndroid();
|
|
16
26
|
this.isIOS = this._detectIOS();
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
runCommand,
|
|
7
7
|
runInteractiveCommand
|
|
8
8
|
} = require("../utils.js");
|
|
9
|
-
const TerminalProgress = require("../
|
|
9
|
+
const TerminalProgress = require("../terminalProgress.js").default;
|
|
10
10
|
const {
|
|
11
11
|
composeAndroidPlugins
|
|
12
12
|
} = require("../pluginComposerAndroid.js");
|
|
@@ -4,6 +4,9 @@ const {
|
|
|
4
4
|
createAndroidBuild,
|
|
5
5
|
pwd
|
|
6
6
|
} = require("./buildAndroid/index.js");
|
|
7
|
+
const {
|
|
8
|
+
formatBuildError
|
|
9
|
+
} = require("./buildErrorFormat.js");
|
|
7
10
|
const {
|
|
8
11
|
WEBVIEW_CONFIG,
|
|
9
12
|
BUILD_OUTPUT_PATH
|
|
@@ -19,6 +22,12 @@ async function main() {
|
|
|
19
22
|
try {
|
|
20
23
|
await buildAndroidApp();
|
|
21
24
|
} catch (error) {
|
|
25
|
+
console.error(formatBuildError({
|
|
26
|
+
code: "ANDROID-000",
|
|
27
|
+
category: "ANDROID",
|
|
28
|
+
upstreamName: "Gradle",
|
|
29
|
+
error
|
|
30
|
+
}));
|
|
22
31
|
process.exit(1);
|
|
23
32
|
}
|
|
24
33
|
process.exit(0);
|
|
@@ -12,6 +12,9 @@ const {
|
|
|
12
12
|
resolveInternalPluginsRoot,
|
|
13
13
|
resolvePluginConfig
|
|
14
14
|
} = require("./internalPluginUtils.js");
|
|
15
|
+
const {
|
|
16
|
+
formatBuildError
|
|
17
|
+
} = require("./buildErrorFormat.js");
|
|
15
18
|
const catalystCorePath = path.dirname(require.resolve("catalyst-core/package.json"));
|
|
16
19
|
const {
|
|
17
20
|
WEBVIEW_CONFIG,
|
|
@@ -46,7 +49,19 @@ async function main() {
|
|
|
46
49
|
await syncPluginResources(pluginComposition);
|
|
47
50
|
await buildForIOS(pluginComposition);
|
|
48
51
|
} catch (error) {
|
|
49
|
-
progress.log(
|
|
52
|
+
// progress.log() prefixes every call with an icon/color and does a
|
|
53
|
+
// single console.log per invocation — it's built for single-line
|
|
54
|
+
// status messages, not our multi-line boxed verbose/debug output
|
|
55
|
+
// (piping a box through it would prefix an icon onto every border
|
|
56
|
+
// line and break the box shape). Bypass it here and use plain
|
|
57
|
+
// console.error instead, matching buildAppAndroid.js; progress.log
|
|
58
|
+
// is unaffected everywhere else in this build.
|
|
59
|
+
console.error(formatBuildError({
|
|
60
|
+
code: "IOS-000",
|
|
61
|
+
category: "IOS",
|
|
62
|
+
upstreamName: "Xcode/CocoaPods",
|
|
63
|
+
error
|
|
64
|
+
}));
|
|
50
65
|
process.exit(1);
|
|
51
66
|
}
|
|
52
67
|
process.exit(0);
|