@scalebun/react-native 1.1.0 → 1.2.1
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/scalebun.full.js +33218 -0
- package/dist/scalebun.full.js.map +1 -0
- package/dist/scalebun.slim.js +30016 -0
- package/dist/scalebun.slim.js.map +1 -0
- package/lib/commonjs/bootstrap/FeatureRegistry.js +4 -4
- package/lib/commonjs/bootstrap/FeatureRegistry.js.map +1 -1
- package/lib/commonjs/bootstrap/SDKBootstrapper.js +8 -8
- package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/commonjs/core/config/schema.js +412 -232
- package/lib/commonjs/core/config/schema.js.map +1 -1
- package/lib/commonjs/core/constants/protocol.js +31 -0
- package/lib/commonjs/core/constants/protocol.js.map +1 -0
- package/lib/commonjs/core/constants/timings.js +4 -1
- package/lib/commonjs/core/constants/timings.js.map +1 -1
- package/lib/commonjs/core/lifecycle/appLifecycle.js +1 -1
- package/lib/commonjs/core/lifecycle/appLifecycle.js.map +1 -1
- package/lib/commonjs/debug/bootstrap.js +30 -10
- package/lib/commonjs/debug/bootstrap.js.map +1 -1
- package/lib/commonjs/debug/exportBridge.js +5 -3
- package/lib/commonjs/debug/exportBridge.js.map +1 -1
- package/lib/commonjs/debug/hostResolver.js +2 -2
- package/lib/commonjs/debug/hostResolver.js.map +1 -1
- package/lib/commonjs/debug/perfWiring.js +4 -4
- package/lib/commonjs/debug/perfWiring.js.map +1 -1
- package/lib/commonjs/debug/replayWiring.js +5 -5
- package/lib/commonjs/debug/replayWiring.js.map +1 -1
- package/lib/commonjs/debug/screenTracking.js +2 -2
- package/lib/commonjs/debug/screenTracking.js.map +1 -1
- package/lib/commonjs/debug/sessionWiring.js +2 -2
- package/lib/commonjs/debug/sessionWiring.js.map +1 -1
- package/lib/commonjs/features/crash/NativeCrashFeature.js +1 -1
- package/lib/commonjs/features/crash/NativeCrashFeature.js.map +1 -1
- package/lib/commonjs/features/crash/globalHandler.js +3 -3
- package/lib/commonjs/features/crash/globalHandler.js.map +1 -1
- package/lib/commonjs/features/crash/nativeCrashBridge.js +7 -7
- package/lib/commonjs/features/crash/nativeCrashBridge.js.map +1 -1
- package/lib/commonjs/features/crash/rejectionHandler.js +2 -2
- package/lib/commonjs/features/crash/rejectionHandler.js.map +1 -1
- package/lib/commonjs/features/engage/EngageArchetypeRenderers.js +0 -9
- package/lib/commonjs/features/engage/EngageArchetypeRenderers.js.map +1 -1
- package/lib/commonjs/features/engage/EngageInAppView.js +1 -1
- package/lib/commonjs/features/engage/EngageInAppView.js.map +1 -1
- package/lib/commonjs/features/engage/EngagePromptProvider.js +17 -17
- package/lib/commonjs/features/engage/EngagePromptProvider.js.map +1 -1
- package/lib/commonjs/features/engage/EngageTransport.js +5 -5
- package/lib/commonjs/features/engage/EngageTransport.js.map +1 -1
- package/lib/commonjs/features/engage/engagePushTokenBridge.js +4 -4
- package/lib/commonjs/features/engage/engagePushTokenBridge.js.map +1 -1
- package/lib/commonjs/features/engage/engageShakeBridge.js +2 -2
- package/lib/commonjs/features/engage/engageShakeBridge.js.map +1 -1
- package/lib/commonjs/features/engage/engageSignals.js +1 -1
- package/lib/commonjs/features/engage/engageSignals.js.map +1 -1
- package/lib/commonjs/features/engage/engageStoreReviewBridge.js +2 -2
- package/lib/commonjs/features/engage/engageStoreReviewBridge.js.map +1 -1
- package/lib/commonjs/features/engage/engageTestSeenStore.js +1 -1
- package/lib/commonjs/features/engage/engageTestSeenStore.js.map +1 -1
- package/lib/commonjs/features/engage/engageThrottle.js +4 -4
- package/lib/commonjs/features/engage/engageThrottle.js.map +1 -1
- package/lib/commonjs/features/engage/engageTriggerEngine.js +4 -4
- package/lib/commonjs/features/engage/engageTriggerEngine.js.map +1 -1
- package/lib/commonjs/features/engage/engageWindowInsets.js +1 -1
- package/lib/commonjs/features/engage/engageWindowInsets.js.map +1 -1
- package/lib/commonjs/features/install-referrer/installReferrer.js +3 -3
- package/lib/commonjs/features/install-referrer/installReferrer.js.map +1 -1
- package/lib/commonjs/features/journey/calibrationContext.js +0 -9
- package/lib/commonjs/features/journey/calibrationContext.js.map +1 -1
- package/lib/commonjs/features/journey/journeyManager.js +4 -1
- package/lib/commonjs/features/journey/journeyManager.js.map +1 -1
- package/lib/commonjs/features/navigation/AutoScreenDetector.js +4 -4
- package/lib/commonjs/features/navigation/AutoScreenDetector.js.map +1 -1
- package/lib/commonjs/features/ota/OtaOrchestrator.js +18 -18
- package/lib/commonjs/features/ota/OtaOrchestrator.js.map +1 -1
- package/lib/commonjs/features/ota/geoCountry.js +2 -2
- package/lib/commonjs/features/ota/geoCountry.js.map +1 -1
- package/lib/commonjs/features/ota/retry.js +2 -2
- package/lib/commonjs/features/ota/retry.js.map +1 -1
- package/lib/commonjs/features/performance/PerformanceFeature.js +121 -23
- package/lib/commonjs/features/performance/PerformanceFeature.js.map +1 -1
- package/lib/commonjs/features/replay/core/logger/logger.js +0 -4
- package/lib/commonjs/features/replay/core/logger/logger.js.map +1 -1
- package/lib/commonjs/features/replay/integrations/network/networkAdapter.js +1 -54
- package/lib/commonjs/features/replay/integrations/network/networkAdapter.js.map +1 -1
- package/lib/commonjs/features/replay/integrations/react-navigation/navigationIntegration.js +1 -1
- package/lib/commonjs/features/replay/integrations/react-navigation/navigationIntegration.js.map +1 -1
- package/lib/commonjs/features/replay/integrations/touch/ReplayRoot.js +1 -1
- package/lib/commonjs/features/replay/integrations/touch/ReplayRoot.js.map +1 -1
- package/lib/commonjs/features/replay/pipeline/batching/batchManager.js +1 -1
- package/lib/commonjs/features/replay/pipeline/batching/batchManager.js.map +1 -1
- package/lib/commonjs/features/replay/pipeline/retry/retryPolicy.js +1 -1
- package/lib/commonjs/features/replay/pipeline/retry/retryPolicy.js.map +1 -1
- package/lib/commonjs/features/replay/public/api.js +7 -7
- package/lib/commonjs/features/replay/public/api.js.map +1 -1
- package/lib/commonjs/features/replay/replay/session/sessionOrchestrator.js +9 -9
- package/lib/commonjs/features/replay/replay/session/sessionOrchestrator.js.map +1 -1
- package/lib/commonjs/features/session/BackendSessionAdapter.js +41 -41
- package/lib/commonjs/features/session/BackendSessionAdapter.js.map +1 -1
- package/lib/commonjs/features/session/DesktopSessionTransport.js +5 -2
- package/lib/commonjs/features/session/DesktopSessionTransport.js.map +1 -1
- package/lib/commonjs/features/session/JourneyEventPipeline.js +1 -1
- package/lib/commonjs/features/session/JourneyEventPipeline.js.map +1 -1
- package/lib/commonjs/features/session/ReplayCaptureManager.js +14 -14
- package/lib/commonjs/features/session/ReplayCaptureManager.js.map +1 -1
- package/lib/commonjs/features/session/SessionManager.js +9 -9
- package/lib/commonjs/features/session/SessionManager.js.map +1 -1
- package/lib/commonjs/features/session/SyncDecisionEngine.js +1 -1
- package/lib/commonjs/features/session/SyncDecisionEngine.js.map +1 -1
- package/lib/commonjs/features/skan/skanBridge.js +6 -15
- package/lib/commonjs/features/skan/skanBridge.js.map +1 -1
- package/lib/commonjs/features/skan/skanConversionManager.js +5 -5
- package/lib/commonjs/features/skan/skanConversionManager.js.map +1 -1
- package/lib/commonjs/integrations/fetch/fetchInterceptor.js +1 -1
- package/lib/commonjs/integrations/fetch/fetchInterceptor.js.map +1 -1
- package/lib/commonjs/integrations/xhr/xhrInterceptor.js +1 -1
- package/lib/commonjs/integrations/xhr/xhrInterceptor.js.map +1 -1
- package/lib/commonjs/metro/composeSourceMap.js +105 -0
- package/lib/commonjs/metro/composeSourceMap.js.map +1 -0
- package/lib/commonjs/metro/featureModules.js +131 -0
- package/lib/commonjs/metro/featureModules.js.map +1 -0
- package/lib/commonjs/metro/index.js +123 -2
- package/lib/commonjs/metro/index.js.map +1 -1
- package/lib/commonjs/metro/serializerCompose.js +129 -0
- package/lib/commonjs/metro/serializerCompose.js.map +1 -0
- package/lib/commonjs/pipeline/dispatcher/dispatcher.js +1 -1
- package/lib/commonjs/pipeline/dispatcher/dispatcher.js.map +1 -1
- package/lib/commonjs/pipeline/queue/flushQueue.js +2 -2
- package/lib/commonjs/pipeline/queue/flushQueue.js.map +1 -1
- package/lib/commonjs/pipeline/queue/persistentQueue.js +6 -37
- package/lib/commonjs/pipeline/queue/persistentQueue.js.map +1 -1
- package/lib/commonjs/pipeline/scheduler/flushScheduler.js +1 -1
- package/lib/commonjs/pipeline/scheduler/flushScheduler.js.map +1 -1
- package/lib/commonjs/public/ScaleBunFacade.js +15 -15
- package/lib/commonjs/public/ScaleBunFacade.js.map +1 -1
- package/lib/commonjs/push/PushManager.js +3 -3
- package/lib/commonjs/push/PushManager.js.map +1 -1
- package/lib/commonjs/push/adapters/NativeBridgeAdapter.js +1 -1
- package/lib/commonjs/push/adapters/NativeBridgeAdapter.js.map +1 -1
- package/lib/commonjs/push/native/nativeNotifications.js +7 -18
- package/lib/commonjs/push/native/nativeNotifications.js.map +1 -1
- package/lib/commonjs/storage/StorageBackend.js +1 -1
- package/lib/commonjs/storage/StorageBackend.js.map +1 -1
- package/lib/module/bootstrap/FeatureRegistry.js +4 -4
- package/lib/module/bootstrap/FeatureRegistry.js.map +1 -1
- package/lib/module/bootstrap/SDKBootstrapper.js +8 -8
- package/lib/module/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/module/core/config/schema.js +411 -231
- package/lib/module/core/config/schema.js.map +1 -1
- package/lib/module/core/constants/protocol.js +25 -0
- package/lib/module/core/constants/protocol.js.map +1 -0
- package/lib/module/core/constants/timings.js +3 -1
- package/lib/module/core/constants/timings.js.map +1 -1
- package/lib/module/core/lifecycle/appLifecycle.js +1 -1
- package/lib/module/core/lifecycle/appLifecycle.js.map +1 -1
- package/lib/module/debug/bootstrap.js +30 -9
- package/lib/module/debug/bootstrap.js.map +1 -1
- package/lib/module/debug/exportBridge.js +5 -3
- package/lib/module/debug/exportBridge.js.map +1 -1
- package/lib/module/debug/hostResolver.js +2 -2
- package/lib/module/debug/hostResolver.js.map +1 -1
- package/lib/module/debug/perfWiring.js +4 -4
- package/lib/module/debug/perfWiring.js.map +1 -1
- package/lib/module/debug/replayWiring.js +5 -5
- package/lib/module/debug/replayWiring.js.map +1 -1
- package/lib/module/debug/screenTracking.js +2 -2
- package/lib/module/debug/screenTracking.js.map +1 -1
- package/lib/module/debug/sessionWiring.js +2 -2
- package/lib/module/debug/sessionWiring.js.map +1 -1
- package/lib/module/features/crash/NativeCrashFeature.js +1 -1
- package/lib/module/features/crash/NativeCrashFeature.js.map +1 -1
- package/lib/module/features/crash/globalHandler.js +3 -3
- package/lib/module/features/crash/globalHandler.js.map +1 -1
- package/lib/module/features/crash/nativeCrashBridge.js +7 -7
- package/lib/module/features/crash/nativeCrashBridge.js.map +1 -1
- package/lib/module/features/crash/rejectionHandler.js +2 -2
- package/lib/module/features/crash/rejectionHandler.js.map +1 -1
- package/lib/module/features/engage/EngageArchetypeRenderers.js +0 -8
- package/lib/module/features/engage/EngageArchetypeRenderers.js.map +1 -1
- package/lib/module/features/engage/EngageInAppView.js +1 -1
- package/lib/module/features/engage/EngageInAppView.js.map +1 -1
- package/lib/module/features/engage/EngagePromptProvider.js +17 -17
- package/lib/module/features/engage/EngagePromptProvider.js.map +1 -1
- package/lib/module/features/engage/EngageTransport.js +5 -5
- package/lib/module/features/engage/EngageTransport.js.map +1 -1
- package/lib/module/features/engage/engagePushTokenBridge.js +4 -4
- package/lib/module/features/engage/engagePushTokenBridge.js.map +1 -1
- package/lib/module/features/engage/engageShakeBridge.js +2 -2
- package/lib/module/features/engage/engageShakeBridge.js.map +1 -1
- package/lib/module/features/engage/engageSignals.js +1 -1
- package/lib/module/features/engage/engageSignals.js.map +1 -1
- package/lib/module/features/engage/engageStoreReviewBridge.js +2 -2
- package/lib/module/features/engage/engageStoreReviewBridge.js.map +1 -1
- package/lib/module/features/engage/engageTestSeenStore.js +1 -1
- package/lib/module/features/engage/engageTestSeenStore.js.map +1 -1
- package/lib/module/features/engage/engageThrottle.js +4 -4
- package/lib/module/features/engage/engageThrottle.js.map +1 -1
- package/lib/module/features/engage/engageTriggerEngine.js +4 -4
- package/lib/module/features/engage/engageTriggerEngine.js.map +1 -1
- package/lib/module/features/engage/engageWindowInsets.js +1 -1
- package/lib/module/features/engage/engageWindowInsets.js.map +1 -1
- package/lib/module/features/install-referrer/installReferrer.js +3 -3
- package/lib/module/features/install-referrer/installReferrer.js.map +1 -1
- package/lib/module/features/journey/calibrationContext.js +0 -8
- package/lib/module/features/journey/calibrationContext.js.map +1 -1
- package/lib/module/features/journey/journeyManager.js +3 -1
- package/lib/module/features/journey/journeyManager.js.map +1 -1
- package/lib/module/features/navigation/AutoScreenDetector.js +4 -4
- package/lib/module/features/navigation/AutoScreenDetector.js.map +1 -1
- package/lib/module/features/ota/OtaOrchestrator.js +18 -18
- package/lib/module/features/ota/OtaOrchestrator.js.map +1 -1
- package/lib/module/features/ota/geoCountry.js +2 -2
- package/lib/module/features/ota/geoCountry.js.map +1 -1
- package/lib/module/features/ota/retry.js +2 -2
- package/lib/module/features/ota/retry.js.map +1 -1
- package/lib/module/features/performance/PerformanceFeature.js +122 -23
- package/lib/module/features/performance/PerformanceFeature.js.map +1 -1
- package/lib/module/features/replay/core/logger/logger.js +0 -3
- package/lib/module/features/replay/core/logger/logger.js.map +1 -1
- package/lib/module/features/replay/integrations/network/networkAdapter.js +1 -52
- package/lib/module/features/replay/integrations/network/networkAdapter.js.map +1 -1
- package/lib/module/features/replay/integrations/react-navigation/navigationIntegration.js +1 -1
- package/lib/module/features/replay/integrations/react-navigation/navigationIntegration.js.map +1 -1
- package/lib/module/features/replay/integrations/touch/ReplayRoot.js +1 -1
- package/lib/module/features/replay/integrations/touch/ReplayRoot.js.map +1 -1
- package/lib/module/features/replay/pipeline/batching/batchManager.js +1 -1
- package/lib/module/features/replay/pipeline/batching/batchManager.js.map +1 -1
- package/lib/module/features/replay/pipeline/retry/retryPolicy.js +1 -1
- package/lib/module/features/replay/pipeline/retry/retryPolicy.js.map +1 -1
- package/lib/module/features/replay/public/api.js +7 -7
- package/lib/module/features/replay/public/api.js.map +1 -1
- package/lib/module/features/replay/replay/session/sessionOrchestrator.js +9 -9
- package/lib/module/features/replay/replay/session/sessionOrchestrator.js.map +1 -1
- package/lib/module/features/session/BackendSessionAdapter.js +41 -41
- package/lib/module/features/session/BackendSessionAdapter.js.map +1 -1
- package/lib/module/features/session/DesktopSessionTransport.js +4 -2
- package/lib/module/features/session/DesktopSessionTransport.js.map +1 -1
- package/lib/module/features/session/JourneyEventPipeline.js +1 -1
- package/lib/module/features/session/JourneyEventPipeline.js.map +1 -1
- package/lib/module/features/session/ReplayCaptureManager.js +14 -14
- package/lib/module/features/session/ReplayCaptureManager.js.map +1 -1
- package/lib/module/features/session/SessionManager.js +9 -9
- package/lib/module/features/session/SessionManager.js.map +1 -1
- package/lib/module/features/session/SyncDecisionEngine.js +1 -1
- package/lib/module/features/session/SyncDecisionEngine.js.map +1 -1
- package/lib/module/features/skan/skanBridge.js +6 -14
- package/lib/module/features/skan/skanBridge.js.map +1 -1
- package/lib/module/features/skan/skanConversionManager.js +5 -5
- package/lib/module/features/skan/skanConversionManager.js.map +1 -1
- package/lib/module/integrations/fetch/fetchInterceptor.js +1 -1
- package/lib/module/integrations/fetch/fetchInterceptor.js.map +1 -1
- package/lib/module/integrations/xhr/xhrInterceptor.js +1 -1
- package/lib/module/integrations/xhr/xhrInterceptor.js.map +1 -1
- package/lib/module/metro/composeSourceMap.js +97 -0
- package/lib/module/metro/composeSourceMap.js.map +1 -0
- package/lib/module/metro/featureModules.js +123 -0
- package/lib/module/metro/featureModules.js.map +1 -0
- package/lib/module/metro/index.js +122 -2
- package/lib/module/metro/index.js.map +1 -1
- package/lib/module/metro/serializerCompose.js +120 -0
- package/lib/module/metro/serializerCompose.js.map +1 -0
- package/lib/module/pipeline/dispatcher/dispatcher.js +1 -1
- package/lib/module/pipeline/dispatcher/dispatcher.js.map +1 -1
- package/lib/module/pipeline/queue/flushQueue.js +2 -2
- package/lib/module/pipeline/queue/flushQueue.js.map +1 -1
- package/lib/module/pipeline/queue/persistentQueue.js +6 -36
- package/lib/module/pipeline/queue/persistentQueue.js.map +1 -1
- package/lib/module/pipeline/scheduler/flushScheduler.js +1 -1
- package/lib/module/pipeline/scheduler/flushScheduler.js.map +1 -1
- package/lib/module/public/ScaleBunFacade.js +15 -15
- package/lib/module/public/ScaleBunFacade.js.map +1 -1
- package/lib/module/push/PushManager.js +3 -3
- package/lib/module/push/PushManager.js.map +1 -1
- package/lib/module/push/adapters/NativeBridgeAdapter.js +1 -1
- package/lib/module/push/adapters/NativeBridgeAdapter.js.map +1 -1
- package/lib/module/push/native/nativeNotifications.js +7 -17
- package/lib/module/push/native/nativeNotifications.js.map +1 -1
- package/lib/module/storage/StorageBackend.js +1 -1
- package/lib/module/storage/StorageBackend.js.map +1 -1
- package/lib/typescript/core/config/schema.d.ts +61 -40
- package/lib/typescript/core/config/schema.d.ts.map +1 -1
- package/lib/typescript/core/constants/protocol.d.ts +23 -0
- package/lib/typescript/core/constants/protocol.d.ts.map +1 -0
- package/lib/typescript/core/constants/timings.d.ts +1 -1
- package/lib/typescript/core/constants/timings.d.ts.map +1 -1
- package/lib/typescript/debug/bootstrap.d.ts +0 -1
- package/lib/typescript/debug/bootstrap.d.ts.map +1 -1
- package/lib/typescript/debug/exportBridge.d.ts.map +1 -1
- package/lib/typescript/features/engage/EngageArchetypeRenderers.d.ts +0 -2
- package/lib/typescript/features/engage/EngageArchetypeRenderers.d.ts.map +1 -1
- package/lib/typescript/features/journey/calibrationContext.d.ts +0 -1
- package/lib/typescript/features/journey/calibrationContext.d.ts.map +1 -1
- package/lib/typescript/features/journey/journeyManager.d.ts.map +1 -1
- package/lib/typescript/features/performance/PerformanceFeature.d.ts +31 -0
- package/lib/typescript/features/performance/PerformanceFeature.d.ts.map +1 -1
- package/lib/typescript/features/replay/core/logger/logger.d.ts +0 -1
- package/lib/typescript/features/replay/core/logger/logger.d.ts.map +1 -1
- package/lib/typescript/features/replay/integrations/network/networkAdapter.d.ts +0 -10
- package/lib/typescript/features/replay/integrations/network/networkAdapter.d.ts.map +1 -1
- package/lib/typescript/features/session/DesktopSessionTransport.d.ts.map +1 -1
- package/lib/typescript/features/skan/skanBridge.d.ts +0 -2
- package/lib/typescript/features/skan/skanBridge.d.ts.map +1 -1
- package/lib/typescript/metro/composeSourceMap.d.ts +26 -0
- package/lib/typescript/metro/composeSourceMap.d.ts.map +1 -0
- package/lib/typescript/metro/featureModules.d.ts +49 -0
- package/lib/typescript/metro/featureModules.d.ts.map +1 -0
- package/lib/typescript/metro/index.d.ts +22 -0
- package/lib/typescript/metro/index.d.ts.map +1 -1
- package/lib/typescript/metro/serializerCompose.d.ts +46 -0
- package/lib/typescript/metro/serializerCompose.d.ts.map +1 -0
- package/lib/typescript/pipeline/queue/persistentQueue.d.ts +0 -10
- package/lib/typescript/pipeline/queue/persistentQueue.d.ts.map +1 -1
- package/lib/typescript/push/native/nativeNotifications.d.ts +0 -6
- package/lib/typescript/push/native/nativeNotifications.d.ts.map +1 -1
- package/package.json +15 -11
- package/src/bootstrap/FeatureRegistry.ts +4 -4
- package/src/bootstrap/SDKBootstrapper.ts +8 -8
- package/src/core/config/schema.ts +353 -235
- package/src/core/constants/protocol.ts +24 -0
- package/src/core/constants/timings.ts +3 -1
- package/src/core/lifecycle/appLifecycle.ts +1 -1
- package/src/debug/bootstrap.ts +40 -7
- package/src/debug/exportBridge.ts +5 -3
- package/src/debug/hostResolver.ts +2 -2
- package/src/debug/perfWiring.ts +4 -4
- package/src/debug/replayWiring.ts +5 -5
- package/src/debug/screenTracking.ts +2 -2
- package/src/debug/sessionWiring.ts +2 -2
- package/src/features/crash/NativeCrashFeature.ts +1 -1
- package/src/features/crash/globalHandler.ts +3 -3
- package/src/features/crash/nativeCrashBridge.ts +7 -7
- package/src/features/crash/rejectionHandler.ts +2 -2
- package/src/features/engage/EngageArchetypeRenderers.tsx +0 -11
- package/src/features/engage/EngageInAppView.tsx +1 -1
- package/src/features/engage/EngagePromptProvider.tsx +17 -17
- package/src/features/engage/EngageTransport.ts +5 -5
- package/src/features/engage/engagePushTokenBridge.ts +4 -4
- package/src/features/engage/engageShakeBridge.ts +2 -2
- package/src/features/engage/engageSignals.ts +1 -1
- package/src/features/engage/engageStoreReviewBridge.ts +2 -2
- package/src/features/engage/engageTestSeenStore.ts +1 -1
- package/src/features/engage/engageThrottle.ts +4 -4
- package/src/features/engage/engageTriggerEngine.ts +4 -4
- package/src/features/engage/engageWindowInsets.ts +1 -1
- package/src/features/install-referrer/installReferrer.ts +3 -3
- package/src/features/journey/calibrationContext.ts +0 -9
- package/src/features/journey/journeyManager.ts +3 -1
- package/src/features/navigation/AutoScreenDetector.ts +4 -4
- package/src/features/ota/OtaOrchestrator.ts +18 -18
- package/src/features/ota/geoCountry.ts +2 -2
- package/src/features/ota/retry.ts +2 -2
- package/src/features/performance/PerformanceFeature.ts +130 -20
- package/src/features/replay/core/logger/logger.ts +0 -4
- package/src/features/replay/integrations/network/networkAdapter.ts +1 -56
- package/src/features/replay/integrations/react-navigation/navigationIntegration.ts +1 -1
- package/src/features/replay/integrations/touch/ReplayRoot.tsx +1 -1
- package/src/features/replay/pipeline/batching/batchManager.ts +1 -1
- package/src/features/replay/pipeline/retry/retryPolicy.ts +1 -1
- package/src/features/replay/public/api.ts +7 -7
- package/src/features/replay/replay/session/sessionOrchestrator.ts +9 -9
- package/src/features/session/BackendSessionAdapter.ts +41 -41
- package/src/features/session/DesktopSessionTransport.ts +4 -2
- package/src/features/session/JourneyEventPipeline.ts +1 -1
- package/src/features/session/ReplayCaptureManager.ts +14 -14
- package/src/features/session/SessionManager.ts +9 -9
- package/src/features/session/SyncDecisionEngine.ts +1 -1
- package/src/features/skan/skanBridge.ts +6 -14
- package/src/features/skan/skanConversionManager.ts +5 -5
- package/src/integrations/fetch/fetchInterceptor.ts +1 -1
- package/src/integrations/xhr/xhrInterceptor.ts +1 -1
- package/src/metro/composeSourceMap.ts +104 -0
- package/src/metro/featureModules.ts +143 -0
- package/src/metro/index.ts +173 -1
- package/src/metro/serializerCompose.ts +157 -0
- package/src/pipeline/dispatcher/dispatcher.ts +1 -1
- package/src/pipeline/queue/flushQueue.ts +2 -2
- package/src/pipeline/queue/persistentQueue.ts +6 -35
- package/src/pipeline/scheduler/flushScheduler.ts +1 -1
- package/src/public/ScaleBunFacade.ts +15 -15
- package/src/push/PushManager.ts +3 -3
- package/src/push/adapters/NativeBridgeAdapter.ts +1 -1
- package/src/push/native/nativeNotifications.ts +7 -16
- package/src/storage/StorageBackend.ts +1 -1
|
@@ -1,241 +1,359 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ScaleBun SDK — init-config validation and normalization.
|
|
3
|
+
*
|
|
4
|
+
* Hand-rolled, table-driven replacement for the vendored mini-Zod this schema used to be built
|
|
5
|
+
* on. The generic validator cost ~6.7 KB of minified bundle to serve exactly one consumer —
|
|
6
|
+
* `SDKBootstrapper.safeParse(rawConfig)` — so the machinery is replaced by a field table and a
|
|
7
|
+
* ~1.5 KB engine with BEHAVIOUR PARITY, byte-for-byte on messages:
|
|
8
|
+
*
|
|
9
|
+
* - same accept/reject decisions (strict types, no coercion; min/max reject rather than clamp)
|
|
10
|
+
* - same normalized output (defaults filled, nested defaults via `{}`, unknown keys stripped,
|
|
11
|
+
* optional-and-absent keys omitted)
|
|
12
|
+
* - same error surface (`safeParse` → `{ success, data | error }`, error with `.issues`
|
|
13
|
+
* [{path, message}] and Zod-style `.format()`), with identical message strings
|
|
14
|
+
*
|
|
15
|
+
* The parity suite in __tests__/schemaParity.test.ts runs a generated matrix of configs against
|
|
16
|
+
* BOTH this implementation and a verbatim copy of the old vendored-z construction, and
|
|
17
|
+
* deep-compares every result. Changing behaviour here without failing that suite should be
|
|
18
|
+
* treated as impossible; if you extend the config, extend the parity suite's reference schema in
|
|
19
|
+
* the same commit.
|
|
20
|
+
*
|
|
21
|
+
* `apiBaseUrl` note: any value is accepted (`kind: 'any'`, backward compatibility) but the
|
|
22
|
+
* bootstrapper force-overwrites it with DEFAULT_API_BASE_URL immediately after parse — the
|
|
23
|
+
* endpoint is locked at build time by design.
|
|
24
|
+
*/
|
|
2
25
|
import { DEFAULT_TIER2_SAMPLE_RATE } from '../../features/performance/config';
|
|
3
26
|
import { DEFAULT_API_BASE_URL } from '../constants/endpoints';
|
|
4
27
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
28
|
+
// ─── Result surface (drop-in for the vendored validator's) ─────────────────────
|
|
29
|
+
|
|
30
|
+
export type ValidationIssue = { path: Array<string | number>; message: string };
|
|
31
|
+
|
|
32
|
+
export type FormattedError = {
|
|
33
|
+
_errors: string[];
|
|
34
|
+
[key: string]: FormattedError | string[];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export class ConfigValidationError extends Error {
|
|
38
|
+
readonly issues: ValidationIssue[];
|
|
39
|
+
|
|
40
|
+
constructor(issues: ValidationIssue[]) {
|
|
41
|
+
super(issues.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`).join('; '));
|
|
42
|
+
this.name = 'ValidationError';
|
|
43
|
+
this.issues = issues;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Nested error object keyed by path, matching Zod's `error.format()`. */
|
|
47
|
+
format(): FormattedError {
|
|
48
|
+
const root: FormattedError = { _errors: [] };
|
|
49
|
+
for (const issue of this.issues) {
|
|
50
|
+
if (issue.path.length === 0) {
|
|
51
|
+
root._errors.push(issue.message);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
let node = root;
|
|
55
|
+
for (let i = 0; i < issue.path.length; i++) {
|
|
56
|
+
const key = String(issue.path[i]);
|
|
57
|
+
const existing = node[key];
|
|
58
|
+
let child: FormattedError;
|
|
59
|
+
if (existing && !Array.isArray(existing)) {
|
|
60
|
+
child = existing;
|
|
61
|
+
} else {
|
|
62
|
+
child = { _errors: [] };
|
|
63
|
+
node[key] = child;
|
|
64
|
+
}
|
|
65
|
+
if (i === issue.path.length - 1) {
|
|
66
|
+
child._errors.push(issue.message);
|
|
67
|
+
}
|
|
68
|
+
node = child;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return root;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type SafeParseResult<T> =
|
|
76
|
+
| { success: true; data: T }
|
|
77
|
+
| { success: false; error: ConfigValidationError };
|
|
78
|
+
|
|
79
|
+
// ─── Field table ────────────────────────────────────────────────────────────────
|
|
80
|
+
//
|
|
81
|
+
// One row per config key. `def` present → the field always exists in the output (the default is
|
|
82
|
+
// itself validated, matching DefaultSchema semantics). `opt` → absent input stays absent.
|
|
83
|
+
|
|
84
|
+
type Field =
|
|
85
|
+
| { kind: 'bool'; def?: boolean; opt?: true }
|
|
86
|
+
| { kind: 'num'; min?: number; max?: number; int?: true; def?: number; opt?: true }
|
|
87
|
+
| { kind: 'str'; min?: number; opt?: true }
|
|
88
|
+
| { kind: 'enum'; values: readonly string[]; opt?: true }
|
|
89
|
+
| { kind: 'any'; def: () => unknown }
|
|
90
|
+
| { kind: 'obj'; shape: Record<string, Field>; def?: true; opt?: true };
|
|
91
|
+
|
|
92
|
+
const bool = (def?: boolean): Field => (def === undefined ? { kind: 'bool' } : { kind: 'bool', def });
|
|
93
|
+
const num = (o: { min?: number; max?: number; int?: true; def?: number; opt?: true }): Field => ({ kind: 'num', ...o });
|
|
94
|
+
|
|
95
|
+
const SHAPE: Record<string, Field> = {
|
|
96
|
+
projectId: { kind: 'str', min: 1, opt: true },
|
|
97
|
+
publishableKey: { kind: 'str', min: 1, opt: true },
|
|
98
|
+
apiBaseUrl: { kind: 'any', def: () => DEFAULT_API_BASE_URL },
|
|
99
|
+
debug: bool(false),
|
|
100
|
+
logLevel: { kind: 'enum', values: ['silent', 'error', 'warn', 'info', 'debug'], opt: true },
|
|
101
|
+
flushIntervalMs: num({ min: 1000, def: 5000 }),
|
|
102
|
+
finalizeOnBackground: bool(false),
|
|
103
|
+
idleThresholdMs: num({ min: 1000, def: 60_000 }),
|
|
104
|
+
sessionBackgroundCapMs: num({ min: 60_000, def: 30 * 60 * 1000 }),
|
|
105
|
+
maxQueueSize: num({ min: 1, def: 1000 }),
|
|
106
|
+
enableNetworkMonitoring: bool(true),
|
|
107
|
+
captureNetworkBodies: bool(false),
|
|
108
|
+
networkBodyMaxBytes: num({ min: 1, max: 1_048_576, def: 65_536 }),
|
|
109
|
+
persistence: {
|
|
110
|
+
kind: 'obj',
|
|
111
|
+
def: true,
|
|
112
|
+
shape: {
|
|
113
|
+
enabled: bool(true),
|
|
114
|
+
maxBytes: num({ min: 1024, def: 5_242_880 }),
|
|
115
|
+
maxEntries: num({ min: 10, def: 5_000 }),
|
|
116
|
+
redactBeforeWrite: bool(true),
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
clientKey: { kind: 'str', opt: true },
|
|
120
|
+
useObjectStorage: bool(false),
|
|
121
|
+
enableNativeFileOutbox: bool(false),
|
|
122
|
+
nativeOutboxUploadEnabled: bool(false),
|
|
123
|
+
useObjectStorageForFrames: bool(false),
|
|
124
|
+
nativeOutboxRetryIntervalMs: num({ min: 250, def: 3000 }),
|
|
125
|
+
nativeOutboxMaxUploadAttempts: num({ min: 1, def: 30 }),
|
|
126
|
+
nativeOutboxPoisonMaxAttempts: num({ min: 1, def: 2 }),
|
|
127
|
+
nativeOutboxRespectRetryAfter: bool(true),
|
|
128
|
+
nativeOutboxStrictThreeSecondRetry: bool(false),
|
|
129
|
+
nativeOutboxNetworkFailuresCountTowardDead: bool(false),
|
|
130
|
+
nativeOutboxMaxBytes: num({ min: 1024, def: 100 * 1024 * 1024 }),
|
|
131
|
+
nativeOutboxMaxAgeMs: num({ min: 1000, def: 7 * 24 * 60 * 60 * 1000 }),
|
|
132
|
+
performance: {
|
|
133
|
+
kind: 'obj',
|
|
134
|
+
def: true,
|
|
135
|
+
shape: {
|
|
136
|
+
enabled: bool(true),
|
|
137
|
+
tier1: {
|
|
138
|
+
kind: 'obj',
|
|
139
|
+
def: true,
|
|
140
|
+
shape: {
|
|
141
|
+
appLaunch: bool(true),
|
|
142
|
+
screenLoad: bool(true),
|
|
143
|
+
network: bool(true),
|
|
144
|
+
uiHang: bool(true),
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
tier2: {
|
|
148
|
+
kind: 'obj',
|
|
149
|
+
def: true,
|
|
150
|
+
shape: {
|
|
151
|
+
enabled: bool(true),
|
|
152
|
+
sampleRate: num({ min: 0, max: 1, def: DEFAULT_TIER2_SAMPLE_RATE }),
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
replay: {
|
|
158
|
+
kind: 'obj',
|
|
159
|
+
opt: true,
|
|
160
|
+
shape: {
|
|
161
|
+
// Auto-start frame recording in SaaS mode (clientKey set) at cold launch, so replay
|
|
162
|
+
// sessions carry frames out of the box. Default: true (undefined ⇒ record). Set false
|
|
163
|
+
// for events-only sessions — the host can still record via ScaleBun.startSession().
|
|
164
|
+
record: { kind: 'bool', opt: true },
|
|
165
|
+
captureMode: { kind: 'enum', values: ['navigation', 'interactions', 'frequency'], opt: true },
|
|
166
|
+
intervalMs: num({ min: 500, opt: true }),
|
|
167
|
+
quality: { kind: 'enum', values: ['high', 'normal', 'low', 'grayscale'], opt: true },
|
|
168
|
+
deltaEncoding: { kind: 'bool', opt: true },
|
|
169
|
+
deltaKeyframeInterval: num({ min: 1, int: true, opt: true }),
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
captureInteractionHeatmap: bool(true),
|
|
173
|
+
ota: {
|
|
174
|
+
kind: 'obj',
|
|
175
|
+
opt: true,
|
|
176
|
+
shape: {
|
|
177
|
+
enabled: bool(false),
|
|
178
|
+
checkOnForeground: bool(true),
|
|
179
|
+
channelOverride: { kind: 'str', opt: true },
|
|
180
|
+
publicSigningKey: { kind: 'str', opt: true },
|
|
181
|
+
mandatoryBlocksUi: bool(false),
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// ─── Engine ─────────────────────────────────────────────────────────────────────
|
|
187
|
+
|
|
188
|
+
const typeofName = (v: unknown): string =>
|
|
189
|
+
v === null ? 'null' : Array.isArray(v) ? 'array' : typeof v;
|
|
190
|
+
|
|
191
|
+
function parseField(
|
|
192
|
+
field: Field,
|
|
193
|
+
input: unknown,
|
|
194
|
+
path: Array<string | number>,
|
|
195
|
+
issues: ValidationIssue[],
|
|
196
|
+
): { ok: boolean; value?: unknown; present: boolean } {
|
|
197
|
+
const fail = (message: string) => {
|
|
198
|
+
issues.push({ path, message });
|
|
199
|
+
return { ok: false, present: true };
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
if (input === undefined) {
|
|
203
|
+
if ('opt' in field && field.opt) return { ok: true, present: false };
|
|
204
|
+
if (field.kind === 'any') return { ok: true, value: field.def(), present: true };
|
|
205
|
+
if (field.kind === 'obj' && field.def) return parseField({ ...field, def: undefined } as Field, {}, path, issues);
|
|
206
|
+
if ('def' in field && field.def !== undefined) return { ok: true, value: field.def, present: true };
|
|
207
|
+
// Required with no default (matches the base schemas' type errors on undefined).
|
|
208
|
+
return fail(
|
|
209
|
+
field.kind === 'bool'
|
|
210
|
+
? 'Expected boolean, received undefined'
|
|
211
|
+
: field.kind === 'num'
|
|
212
|
+
? 'Expected number, received undefined'
|
|
213
|
+
: field.kind === 'str'
|
|
214
|
+
? 'Expected string, received undefined'
|
|
215
|
+
: field.kind === 'enum'
|
|
216
|
+
? "Invalid enum value. Expected " + field.values.map((v) => `'${v}'`).join(' | ')
|
|
217
|
+
: 'Expected object, received undefined',
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
switch (field.kind) {
|
|
222
|
+
case 'any':
|
|
223
|
+
return { ok: true, value: input, present: true };
|
|
224
|
+
case 'bool':
|
|
225
|
+
if (typeof input !== 'boolean') return fail(`Expected boolean, received ${typeofName(input)}`);
|
|
226
|
+
return { ok: true, value: input, present: true };
|
|
227
|
+
case 'str':
|
|
228
|
+
if (typeof input !== 'string') return fail(`Expected string, received ${typeofName(input)}`);
|
|
229
|
+
if (field.min !== undefined && input.length < field.min) {
|
|
230
|
+
return fail(`String must contain at least ${field.min} character(s)`);
|
|
231
|
+
}
|
|
232
|
+
return { ok: true, value: input, present: true };
|
|
233
|
+
case 'num':
|
|
234
|
+
if (typeof input !== 'number' || Number.isNaN(input)) {
|
|
235
|
+
return fail(`Expected number, received ${typeofName(input)}`);
|
|
236
|
+
}
|
|
237
|
+
if (field.int && !Number.isInteger(input)) return fail('Expected integer, received float');
|
|
238
|
+
if (field.min !== undefined && input < field.min) {
|
|
239
|
+
return fail(`Number must be greater than or equal to ${field.min}`);
|
|
240
|
+
}
|
|
241
|
+
if (field.max !== undefined && input > field.max) {
|
|
242
|
+
return fail(`Number must be less than or equal to ${field.max}`);
|
|
243
|
+
}
|
|
244
|
+
return { ok: true, value: input, present: true };
|
|
245
|
+
case 'enum':
|
|
246
|
+
if (typeof input !== 'string' || !field.values.includes(input)) {
|
|
247
|
+
return fail(`Invalid enum value. Expected ${field.values.map((v) => `'${v}'`).join(' | ')}`);
|
|
248
|
+
}
|
|
249
|
+
return { ok: true, value: input, present: true };
|
|
250
|
+
case 'obj': {
|
|
251
|
+
if (typeofName(input) !== 'object') return fail(`Expected object, received ${typeofName(input)}`);
|
|
252
|
+
const src = input as Record<string, unknown>;
|
|
253
|
+
const out: Record<string, unknown> = {};
|
|
254
|
+
let ok = true;
|
|
255
|
+
for (const key of Object.keys(field.shape)) {
|
|
256
|
+
const r = parseField(field.shape[key]!, src[key], [...path, key], issues);
|
|
257
|
+
if (!r.ok) ok = false;
|
|
258
|
+
// Mirrors ObjectSchema: keep defined results, and explicit `key in input`
|
|
259
|
+
// occurrences even when the parsed value is undefined (optional present-but-
|
|
260
|
+
// undefined keys survive as own properties, exactly like the old parser).
|
|
261
|
+
else if (r.value !== undefined || key in src) {
|
|
262
|
+
if (r.present || key in src) out[key] = r.value;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// Unknown keys are stripped (Zod's default `.strip()` behaviour).
|
|
266
|
+
return ok ? { ok: true, value: out, present: true } : { ok: false, present: true };
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/** The one root-level cross-field rule (was `.refine(...)` on the old schema). */
|
|
272
|
+
const ROOT_REFINE_MESSAGE =
|
|
273
|
+
'Either clientKey (SaaS mode) or both projectId and publishableKey (legacy mode) are required';
|
|
274
|
+
|
|
275
|
+
export const ConfigSchema = {
|
|
276
|
+
safeParse(input: unknown): SafeParseResult<ScaleBunConfig> {
|
|
277
|
+
const issues: ValidationIssue[] = [];
|
|
278
|
+
const r = parseField({ kind: 'obj', shape: SHAPE }, input, [], issues);
|
|
279
|
+
if (r.ok && issues.length === 0) {
|
|
280
|
+
const data = r.value as ScaleBunConfig;
|
|
281
|
+
if (!(!!data.clientKey || (!!data.projectId && !!data.publishableKey))) {
|
|
282
|
+
issues.push({ path: [], message: ROOT_REFINE_MESSAGE });
|
|
283
|
+
return { success: false, error: new ConfigValidationError(issues) };
|
|
284
|
+
}
|
|
285
|
+
return { success: true, data };
|
|
286
|
+
}
|
|
287
|
+
return { success: false, error: new ConfigValidationError(issues) };
|
|
288
|
+
},
|
|
289
|
+
|
|
290
|
+
parse(input: unknown): ScaleBunConfig {
|
|
291
|
+
const r = this.safeParse(input);
|
|
292
|
+
if (!r.success) throw r.error;
|
|
293
|
+
return r.data;
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
// ─── Output type (was Infer<typeof ConfigSchema>) ──────────────────────────────
|
|
298
|
+
|
|
299
|
+
export interface ScaleBunConfig {
|
|
300
|
+
projectId?: string;
|
|
301
|
+
publishableKey?: string;
|
|
302
|
+
// `any`, not `unknown`: the old schema's z.any() inferred `any`, and the bootstrapper/facade
|
|
303
|
+
// assign and pass it as a string after force-locking it to DEFAULT_API_BASE_URL.
|
|
304
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
305
|
+
apiBaseUrl: any;
|
|
306
|
+
debug: boolean;
|
|
307
|
+
logLevel?: 'silent' | 'error' | 'warn' | 'info' | 'debug';
|
|
308
|
+
flushIntervalMs: number;
|
|
309
|
+
finalizeOnBackground: boolean;
|
|
310
|
+
idleThresholdMs: number;
|
|
311
|
+
sessionBackgroundCapMs: number;
|
|
312
|
+
maxQueueSize: number;
|
|
313
|
+
enableNetworkMonitoring: boolean;
|
|
314
|
+
captureNetworkBodies: boolean;
|
|
315
|
+
networkBodyMaxBytes: number;
|
|
316
|
+
persistence: {
|
|
317
|
+
enabled: boolean;
|
|
318
|
+
maxBytes: number;
|
|
319
|
+
maxEntries: number;
|
|
320
|
+
redactBeforeWrite: boolean;
|
|
321
|
+
};
|
|
322
|
+
clientKey?: string;
|
|
323
|
+
useObjectStorage: boolean;
|
|
324
|
+
enableNativeFileOutbox: boolean;
|
|
325
|
+
nativeOutboxUploadEnabled: boolean;
|
|
326
|
+
useObjectStorageForFrames: boolean;
|
|
327
|
+
nativeOutboxRetryIntervalMs: number;
|
|
328
|
+
nativeOutboxMaxUploadAttempts: number;
|
|
329
|
+
nativeOutboxPoisonMaxAttempts: number;
|
|
330
|
+
nativeOutboxRespectRetryAfter: boolean;
|
|
331
|
+
nativeOutboxStrictThreeSecondRetry: boolean;
|
|
332
|
+
nativeOutboxNetworkFailuresCountTowardDead: boolean;
|
|
333
|
+
nativeOutboxMaxBytes: number;
|
|
334
|
+
nativeOutboxMaxAgeMs: number;
|
|
335
|
+
performance: {
|
|
336
|
+
enabled: boolean;
|
|
337
|
+
tier1: { appLaunch: boolean; screenLoad: boolean; network: boolean; uiHang: boolean };
|
|
338
|
+
tier2: { enabled: boolean; sampleRate: number };
|
|
339
|
+
};
|
|
340
|
+
replay?: {
|
|
341
|
+
record?: boolean;
|
|
342
|
+
captureMode?: 'navigation' | 'interactions' | 'frequency';
|
|
343
|
+
intervalMs?: number;
|
|
344
|
+
quality?: 'high' | 'normal' | 'low' | 'grayscale';
|
|
345
|
+
deltaEncoding?: boolean;
|
|
346
|
+
deltaKeyframeInterval?: number;
|
|
347
|
+
};
|
|
348
|
+
captureInteractionHeatmap: boolean;
|
|
349
|
+
ota?: {
|
|
350
|
+
enabled: boolean;
|
|
351
|
+
checkOnForeground: boolean;
|
|
352
|
+
channelOverride?: string;
|
|
353
|
+
publicSigningKey?: string;
|
|
354
|
+
mandatoryBlocksUi: boolean;
|
|
355
|
+
};
|
|
356
|
+
}
|
|
239
357
|
|
|
240
358
|
// Re-export config types from contracts for consumers migrating to new import paths
|
|
241
359
|
export type {
|