@scalebun/react-native 1.0.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/android/src/main/java/com/scalebun/rn/ota/SlotManager.kt +70 -4
  2. package/dist/scalebun.full.js +33132 -0
  3. package/dist/scalebun.full.js.map +1 -0
  4. package/dist/scalebun.slim.js +29930 -0
  5. package/dist/scalebun.slim.js.map +1 -0
  6. package/lib/commonjs/bootstrap/FeatureRegistry.js +4 -4
  7. package/lib/commonjs/bootstrap/FeatureRegistry.js.map +1 -1
  8. package/lib/commonjs/bootstrap/SDKBootstrapper.js +20 -17
  9. package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
  10. package/lib/commonjs/compat/codepush.js +78 -15
  11. package/lib/commonjs/compat/codepush.js.map +1 -1
  12. package/lib/commonjs/core/config/schema.js +412 -219
  13. package/lib/commonjs/core/config/schema.js.map +1 -1
  14. package/lib/commonjs/core/constants/endpoints.js +9 -6
  15. package/lib/commonjs/core/constants/endpoints.js.map +1 -1
  16. package/lib/commonjs/core/constants/protocol.js +31 -0
  17. package/lib/commonjs/core/constants/protocol.js.map +1 -0
  18. package/lib/commonjs/core/constants/timings.js +4 -1
  19. package/lib/commonjs/core/constants/timings.js.map +1 -1
  20. package/lib/commonjs/core/lifecycle/appLifecycle.js +1 -1
  21. package/lib/commonjs/core/lifecycle/appLifecycle.js.map +1 -1
  22. package/lib/commonjs/debug/bootstrap.js +30 -10
  23. package/lib/commonjs/debug/bootstrap.js.map +1 -1
  24. package/lib/commonjs/debug/exportBridge.js +5 -3
  25. package/lib/commonjs/debug/exportBridge.js.map +1 -1
  26. package/lib/commonjs/debug/hostResolver.js +2 -2
  27. package/lib/commonjs/debug/hostResolver.js.map +1 -1
  28. package/lib/commonjs/debug/perfWiring.js +4 -4
  29. package/lib/commonjs/debug/perfWiring.js.map +1 -1
  30. package/lib/commonjs/debug/replayWiring.js +5 -5
  31. package/lib/commonjs/debug/replayWiring.js.map +1 -1
  32. package/lib/commonjs/debug/screenTracking.js +2 -2
  33. package/lib/commonjs/debug/screenTracking.js.map +1 -1
  34. package/lib/commonjs/debug/sessionWiring.js +2 -2
  35. package/lib/commonjs/debug/sessionWiring.js.map +1 -1
  36. package/lib/commonjs/features/crash/NativeCrashFeature.js +1 -1
  37. package/lib/commonjs/features/crash/NativeCrashFeature.js.map +1 -1
  38. package/lib/commonjs/features/crash/globalHandler.js +3 -3
  39. package/lib/commonjs/features/crash/globalHandler.js.map +1 -1
  40. package/lib/commonjs/features/crash/nativeCrashBridge.js +7 -7
  41. package/lib/commonjs/features/crash/nativeCrashBridge.js.map +1 -1
  42. package/lib/commonjs/features/crash/rejectionHandler.js +2 -2
  43. package/lib/commonjs/features/crash/rejectionHandler.js.map +1 -1
  44. package/lib/commonjs/features/engage/EngageArchetypeRenderers.js +0 -9
  45. package/lib/commonjs/features/engage/EngageArchetypeRenderers.js.map +1 -1
  46. package/lib/commonjs/features/engage/EngageInAppView.js +1 -1
  47. package/lib/commonjs/features/engage/EngageInAppView.js.map +1 -1
  48. package/lib/commonjs/features/engage/EngagePromptProvider.js +17 -17
  49. package/lib/commonjs/features/engage/EngagePromptProvider.js.map +1 -1
  50. package/lib/commonjs/features/engage/EngageTransport.js +5 -5
  51. package/lib/commonjs/features/engage/EngageTransport.js.map +1 -1
  52. package/lib/commonjs/features/engage/engagePushTokenBridge.js +4 -4
  53. package/lib/commonjs/features/engage/engagePushTokenBridge.js.map +1 -1
  54. package/lib/commonjs/features/engage/engageShakeBridge.js +2 -2
  55. package/lib/commonjs/features/engage/engageShakeBridge.js.map +1 -1
  56. package/lib/commonjs/features/engage/engageSignals.js +1 -1
  57. package/lib/commonjs/features/engage/engageSignals.js.map +1 -1
  58. package/lib/commonjs/features/engage/engageStoreReviewBridge.js +2 -2
  59. package/lib/commonjs/features/engage/engageStoreReviewBridge.js.map +1 -1
  60. package/lib/commonjs/features/engage/engageTestSeenStore.js +1 -1
  61. package/lib/commonjs/features/engage/engageTestSeenStore.js.map +1 -1
  62. package/lib/commonjs/features/engage/engageThrottle.js +4 -4
  63. package/lib/commonjs/features/engage/engageThrottle.js.map +1 -1
  64. package/lib/commonjs/features/engage/engageTriggerEngine.js +4 -4
  65. package/lib/commonjs/features/engage/engageTriggerEngine.js.map +1 -1
  66. package/lib/commonjs/features/engage/engageWindowInsets.js +1 -1
  67. package/lib/commonjs/features/engage/engageWindowInsets.js.map +1 -1
  68. package/lib/commonjs/features/install-referrer/installReferrer.js +3 -3
  69. package/lib/commonjs/features/install-referrer/installReferrer.js.map +1 -1
  70. package/lib/commonjs/features/journey/calibrationContext.js +0 -9
  71. package/lib/commonjs/features/journey/calibrationContext.js.map +1 -1
  72. package/lib/commonjs/features/journey/journeyManager.js +4 -1
  73. package/lib/commonjs/features/journey/journeyManager.js.map +1 -1
  74. package/lib/commonjs/features/navigation/AutoScreenDetector.js +4 -4
  75. package/lib/commonjs/features/navigation/AutoScreenDetector.js.map +1 -1
  76. package/lib/commonjs/features/ota/OtaOrchestrator.js +27 -18
  77. package/lib/commonjs/features/ota/OtaOrchestrator.js.map +1 -1
  78. package/lib/commonjs/features/ota/geoCountry.js +2 -2
  79. package/lib/commonjs/features/ota/geoCountry.js.map +1 -1
  80. package/lib/commonjs/features/ota/retry.js +2 -2
  81. package/lib/commonjs/features/ota/retry.js.map +1 -1
  82. package/lib/commonjs/features/replay/core/logger/logger.js +0 -4
  83. package/lib/commonjs/features/replay/core/logger/logger.js.map +1 -1
  84. package/lib/commonjs/features/replay/integrations/network/networkAdapter.js +1 -54
  85. package/lib/commonjs/features/replay/integrations/network/networkAdapter.js.map +1 -1
  86. package/lib/commonjs/features/replay/integrations/react-navigation/navigationIntegration.js +1 -1
  87. package/lib/commonjs/features/replay/integrations/react-navigation/navigationIntegration.js.map +1 -1
  88. package/lib/commonjs/features/replay/integrations/touch/ReplayRoot.js +1 -1
  89. package/lib/commonjs/features/replay/integrations/touch/ReplayRoot.js.map +1 -1
  90. package/lib/commonjs/features/replay/pipeline/batching/batchManager.js +1 -1
  91. package/lib/commonjs/features/replay/pipeline/batching/batchManager.js.map +1 -1
  92. package/lib/commonjs/features/replay/pipeline/retry/retryPolicy.js +1 -1
  93. package/lib/commonjs/features/replay/pipeline/retry/retryPolicy.js.map +1 -1
  94. package/lib/commonjs/features/replay/public/api.js +7 -7
  95. package/lib/commonjs/features/replay/public/api.js.map +1 -1
  96. package/lib/commonjs/features/replay/replay/session/sessionOrchestrator.js +9 -9
  97. package/lib/commonjs/features/replay/replay/session/sessionOrchestrator.js.map +1 -1
  98. package/lib/commonjs/features/session/BackendSessionAdapter.js +41 -41
  99. package/lib/commonjs/features/session/BackendSessionAdapter.js.map +1 -1
  100. package/lib/commonjs/features/session/DesktopSessionTransport.js +5 -2
  101. package/lib/commonjs/features/session/DesktopSessionTransport.js.map +1 -1
  102. package/lib/commonjs/features/session/JourneyEventPipeline.js +1 -1
  103. package/lib/commonjs/features/session/JourneyEventPipeline.js.map +1 -1
  104. package/lib/commonjs/features/session/ReplayCaptureManager.js +14 -14
  105. package/lib/commonjs/features/session/ReplayCaptureManager.js.map +1 -1
  106. package/lib/commonjs/features/session/SessionManager.js +9 -9
  107. package/lib/commonjs/features/session/SessionManager.js.map +1 -1
  108. package/lib/commonjs/features/session/SyncDecisionEngine.js +1 -1
  109. package/lib/commonjs/features/session/SyncDecisionEngine.js.map +1 -1
  110. package/lib/commonjs/features/skan/skanBridge.js +6 -15
  111. package/lib/commonjs/features/skan/skanBridge.js.map +1 -1
  112. package/lib/commonjs/features/skan/skanConversionManager.js +5 -5
  113. package/lib/commonjs/features/skan/skanConversionManager.js.map +1 -1
  114. package/lib/commonjs/integrations/fetch/fetchInterceptor.js +1 -1
  115. package/lib/commonjs/integrations/fetch/fetchInterceptor.js.map +1 -1
  116. package/lib/commonjs/integrations/xhr/xhrInterceptor.js +1 -1
  117. package/lib/commonjs/integrations/xhr/xhrInterceptor.js.map +1 -1
  118. package/lib/commonjs/metro/composeSourceMap.js +105 -0
  119. package/lib/commonjs/metro/composeSourceMap.js.map +1 -0
  120. package/lib/commonjs/metro/featureModules.js +131 -0
  121. package/lib/commonjs/metro/featureModules.js.map +1 -0
  122. package/lib/commonjs/metro/index.js +123 -2
  123. package/lib/commonjs/metro/index.js.map +1 -1
  124. package/lib/commonjs/metro/serializerCompose.js +129 -0
  125. package/lib/commonjs/metro/serializerCompose.js.map +1 -0
  126. package/lib/commonjs/pipeline/dispatcher/dispatcher.js +1 -1
  127. package/lib/commonjs/pipeline/dispatcher/dispatcher.js.map +1 -1
  128. package/lib/commonjs/pipeline/queue/flushQueue.js +2 -2
  129. package/lib/commonjs/pipeline/queue/flushQueue.js.map +1 -1
  130. package/lib/commonjs/pipeline/queue/persistentQueue.js +6 -37
  131. package/lib/commonjs/pipeline/queue/persistentQueue.js.map +1 -1
  132. package/lib/commonjs/pipeline/scheduler/flushScheduler.js +1 -1
  133. package/lib/commonjs/pipeline/scheduler/flushScheduler.js.map +1 -1
  134. package/lib/commonjs/public/ScaleBunFacade.js +64 -15
  135. package/lib/commonjs/public/ScaleBunFacade.js.map +1 -1
  136. package/lib/commonjs/push/PushManager.js +3 -3
  137. package/lib/commonjs/push/PushManager.js.map +1 -1
  138. package/lib/commonjs/push/adapters/NativeBridgeAdapter.js +1 -1
  139. package/lib/commonjs/push/adapters/NativeBridgeAdapter.js.map +1 -1
  140. package/lib/commonjs/push/native/nativeNotifications.js +7 -18
  141. package/lib/commonjs/push/native/nativeNotifications.js.map +1 -1
  142. package/lib/commonjs/storage/StorageBackend.js +1 -1
  143. package/lib/commonjs/storage/StorageBackend.js.map +1 -1
  144. package/lib/module/bootstrap/FeatureRegistry.js +4 -4
  145. package/lib/module/bootstrap/FeatureRegistry.js.map +1 -1
  146. package/lib/module/bootstrap/SDKBootstrapper.js +20 -17
  147. package/lib/module/bootstrap/SDKBootstrapper.js.map +1 -1
  148. package/lib/module/compat/codepush.js +77 -14
  149. package/lib/module/compat/codepush.js.map +1 -1
  150. package/lib/module/core/config/schema.js +411 -218
  151. package/lib/module/core/config/schema.js.map +1 -1
  152. package/lib/module/core/constants/endpoints.js +9 -6
  153. package/lib/module/core/constants/endpoints.js.map +1 -1
  154. package/lib/module/core/constants/protocol.js +25 -0
  155. package/lib/module/core/constants/protocol.js.map +1 -0
  156. package/lib/module/core/constants/timings.js +3 -1
  157. package/lib/module/core/constants/timings.js.map +1 -1
  158. package/lib/module/core/lifecycle/appLifecycle.js +1 -1
  159. package/lib/module/core/lifecycle/appLifecycle.js.map +1 -1
  160. package/lib/module/debug/bootstrap.js +30 -9
  161. package/lib/module/debug/bootstrap.js.map +1 -1
  162. package/lib/module/debug/exportBridge.js +5 -3
  163. package/lib/module/debug/exportBridge.js.map +1 -1
  164. package/lib/module/debug/hostResolver.js +2 -2
  165. package/lib/module/debug/hostResolver.js.map +1 -1
  166. package/lib/module/debug/perfWiring.js +4 -4
  167. package/lib/module/debug/perfWiring.js.map +1 -1
  168. package/lib/module/debug/replayWiring.js +5 -5
  169. package/lib/module/debug/replayWiring.js.map +1 -1
  170. package/lib/module/debug/screenTracking.js +2 -2
  171. package/lib/module/debug/screenTracking.js.map +1 -1
  172. package/lib/module/debug/sessionWiring.js +2 -2
  173. package/lib/module/debug/sessionWiring.js.map +1 -1
  174. package/lib/module/features/crash/NativeCrashFeature.js +1 -1
  175. package/lib/module/features/crash/NativeCrashFeature.js.map +1 -1
  176. package/lib/module/features/crash/globalHandler.js +3 -3
  177. package/lib/module/features/crash/globalHandler.js.map +1 -1
  178. package/lib/module/features/crash/nativeCrashBridge.js +7 -7
  179. package/lib/module/features/crash/nativeCrashBridge.js.map +1 -1
  180. package/lib/module/features/crash/rejectionHandler.js +2 -2
  181. package/lib/module/features/crash/rejectionHandler.js.map +1 -1
  182. package/lib/module/features/engage/EngageArchetypeRenderers.js +0 -8
  183. package/lib/module/features/engage/EngageArchetypeRenderers.js.map +1 -1
  184. package/lib/module/features/engage/EngageInAppView.js +1 -1
  185. package/lib/module/features/engage/EngageInAppView.js.map +1 -1
  186. package/lib/module/features/engage/EngagePromptProvider.js +17 -17
  187. package/lib/module/features/engage/EngagePromptProvider.js.map +1 -1
  188. package/lib/module/features/engage/EngageTransport.js +5 -5
  189. package/lib/module/features/engage/EngageTransport.js.map +1 -1
  190. package/lib/module/features/engage/engagePushTokenBridge.js +4 -4
  191. package/lib/module/features/engage/engagePushTokenBridge.js.map +1 -1
  192. package/lib/module/features/engage/engageShakeBridge.js +2 -2
  193. package/lib/module/features/engage/engageShakeBridge.js.map +1 -1
  194. package/lib/module/features/engage/engageSignals.js +1 -1
  195. package/lib/module/features/engage/engageSignals.js.map +1 -1
  196. package/lib/module/features/engage/engageStoreReviewBridge.js +2 -2
  197. package/lib/module/features/engage/engageStoreReviewBridge.js.map +1 -1
  198. package/lib/module/features/engage/engageTestSeenStore.js +1 -1
  199. package/lib/module/features/engage/engageTestSeenStore.js.map +1 -1
  200. package/lib/module/features/engage/engageThrottle.js +4 -4
  201. package/lib/module/features/engage/engageThrottle.js.map +1 -1
  202. package/lib/module/features/engage/engageTriggerEngine.js +4 -4
  203. package/lib/module/features/engage/engageTriggerEngine.js.map +1 -1
  204. package/lib/module/features/engage/engageWindowInsets.js +1 -1
  205. package/lib/module/features/engage/engageWindowInsets.js.map +1 -1
  206. package/lib/module/features/install-referrer/installReferrer.js +3 -3
  207. package/lib/module/features/install-referrer/installReferrer.js.map +1 -1
  208. package/lib/module/features/journey/calibrationContext.js +0 -8
  209. package/lib/module/features/journey/calibrationContext.js.map +1 -1
  210. package/lib/module/features/journey/journeyManager.js +3 -1
  211. package/lib/module/features/journey/journeyManager.js.map +1 -1
  212. package/lib/module/features/navigation/AutoScreenDetector.js +4 -4
  213. package/lib/module/features/navigation/AutoScreenDetector.js.map +1 -1
  214. package/lib/module/features/ota/OtaOrchestrator.js +27 -18
  215. package/lib/module/features/ota/OtaOrchestrator.js.map +1 -1
  216. package/lib/module/features/ota/geoCountry.js +2 -2
  217. package/lib/module/features/ota/geoCountry.js.map +1 -1
  218. package/lib/module/features/ota/retry.js +2 -2
  219. package/lib/module/features/ota/retry.js.map +1 -1
  220. package/lib/module/features/replay/core/logger/logger.js +0 -3
  221. package/lib/module/features/replay/core/logger/logger.js.map +1 -1
  222. package/lib/module/features/replay/integrations/network/networkAdapter.js +1 -52
  223. package/lib/module/features/replay/integrations/network/networkAdapter.js.map +1 -1
  224. package/lib/module/features/replay/integrations/react-navigation/navigationIntegration.js +1 -1
  225. package/lib/module/features/replay/integrations/react-navigation/navigationIntegration.js.map +1 -1
  226. package/lib/module/features/replay/integrations/touch/ReplayRoot.js +1 -1
  227. package/lib/module/features/replay/integrations/touch/ReplayRoot.js.map +1 -1
  228. package/lib/module/features/replay/pipeline/batching/batchManager.js +1 -1
  229. package/lib/module/features/replay/pipeline/batching/batchManager.js.map +1 -1
  230. package/lib/module/features/replay/pipeline/retry/retryPolicy.js +1 -1
  231. package/lib/module/features/replay/pipeline/retry/retryPolicy.js.map +1 -1
  232. package/lib/module/features/replay/public/api.js +7 -7
  233. package/lib/module/features/replay/public/api.js.map +1 -1
  234. package/lib/module/features/replay/replay/session/sessionOrchestrator.js +9 -9
  235. package/lib/module/features/replay/replay/session/sessionOrchestrator.js.map +1 -1
  236. package/lib/module/features/session/BackendSessionAdapter.js +41 -41
  237. package/lib/module/features/session/BackendSessionAdapter.js.map +1 -1
  238. package/lib/module/features/session/DesktopSessionTransport.js +4 -2
  239. package/lib/module/features/session/DesktopSessionTransport.js.map +1 -1
  240. package/lib/module/features/session/JourneyEventPipeline.js +1 -1
  241. package/lib/module/features/session/JourneyEventPipeline.js.map +1 -1
  242. package/lib/module/features/session/ReplayCaptureManager.js +14 -14
  243. package/lib/module/features/session/ReplayCaptureManager.js.map +1 -1
  244. package/lib/module/features/session/SessionManager.js +9 -9
  245. package/lib/module/features/session/SessionManager.js.map +1 -1
  246. package/lib/module/features/session/SyncDecisionEngine.js +1 -1
  247. package/lib/module/features/session/SyncDecisionEngine.js.map +1 -1
  248. package/lib/module/features/skan/skanBridge.js +6 -14
  249. package/lib/module/features/skan/skanBridge.js.map +1 -1
  250. package/lib/module/features/skan/skanConversionManager.js +5 -5
  251. package/lib/module/features/skan/skanConversionManager.js.map +1 -1
  252. package/lib/module/index.js +1 -1
  253. package/lib/module/integrations/fetch/fetchInterceptor.js +1 -1
  254. package/lib/module/integrations/fetch/fetchInterceptor.js.map +1 -1
  255. package/lib/module/integrations/xhr/xhrInterceptor.js +1 -1
  256. package/lib/module/integrations/xhr/xhrInterceptor.js.map +1 -1
  257. package/lib/module/metro/composeSourceMap.js +97 -0
  258. package/lib/module/metro/composeSourceMap.js.map +1 -0
  259. package/lib/module/metro/featureModules.js +123 -0
  260. package/lib/module/metro/featureModules.js.map +1 -0
  261. package/lib/module/metro/index.js +122 -2
  262. package/lib/module/metro/index.js.map +1 -1
  263. package/lib/module/metro/serializerCompose.js +120 -0
  264. package/lib/module/metro/serializerCompose.js.map +1 -0
  265. package/lib/module/pipeline/dispatcher/dispatcher.js +1 -1
  266. package/lib/module/pipeline/dispatcher/dispatcher.js.map +1 -1
  267. package/lib/module/pipeline/queue/flushQueue.js +2 -2
  268. package/lib/module/pipeline/queue/flushQueue.js.map +1 -1
  269. package/lib/module/pipeline/queue/persistentQueue.js +6 -36
  270. package/lib/module/pipeline/queue/persistentQueue.js.map +1 -1
  271. package/lib/module/pipeline/scheduler/flushScheduler.js +1 -1
  272. package/lib/module/pipeline/scheduler/flushScheduler.js.map +1 -1
  273. package/lib/module/public/ScaleBunFacade.js +64 -15
  274. package/lib/module/public/ScaleBunFacade.js.map +1 -1
  275. package/lib/module/push/PushManager.js +3 -3
  276. package/lib/module/push/PushManager.js.map +1 -1
  277. package/lib/module/push/adapters/NativeBridgeAdapter.js +1 -1
  278. package/lib/module/push/adapters/NativeBridgeAdapter.js.map +1 -1
  279. package/lib/module/push/native/nativeNotifications.js +7 -17
  280. package/lib/module/push/native/nativeNotifications.js.map +1 -1
  281. package/lib/module/storage/StorageBackend.js +1 -1
  282. package/lib/module/storage/StorageBackend.js.map +1 -1
  283. package/lib/typescript/bootstrap/SDKBootstrapper.d.ts.map +1 -1
  284. package/lib/typescript/compat/codepush.d.ts +27 -4
  285. package/lib/typescript/compat/codepush.d.ts.map +1 -1
  286. package/lib/typescript/core/config/schema.d.ts +61 -37
  287. package/lib/typescript/core/config/schema.d.ts.map +1 -1
  288. package/lib/typescript/core/constants/endpoints.d.ts +9 -6
  289. package/lib/typescript/core/constants/endpoints.d.ts.map +1 -1
  290. package/lib/typescript/core/constants/protocol.d.ts +23 -0
  291. package/lib/typescript/core/constants/protocol.d.ts.map +1 -0
  292. package/lib/typescript/core/constants/timings.d.ts +1 -1
  293. package/lib/typescript/core/constants/timings.d.ts.map +1 -1
  294. package/lib/typescript/debug/bootstrap.d.ts +0 -1
  295. package/lib/typescript/debug/bootstrap.d.ts.map +1 -1
  296. package/lib/typescript/debug/exportBridge.d.ts.map +1 -1
  297. package/lib/typescript/features/engage/EngageArchetypeRenderers.d.ts +0 -2
  298. package/lib/typescript/features/engage/EngageArchetypeRenderers.d.ts.map +1 -1
  299. package/lib/typescript/features/engage/EngageTransport.d.ts +1 -1
  300. package/lib/typescript/features/engage/EngageTransport.d.ts.map +1 -1
  301. package/lib/typescript/features/journey/calibrationContext.d.ts +0 -1
  302. package/lib/typescript/features/journey/calibrationContext.d.ts.map +1 -1
  303. package/lib/typescript/features/journey/journeyManager.d.ts.map +1 -1
  304. package/lib/typescript/features/ota/OtaOrchestrator.d.ts +6 -0
  305. package/lib/typescript/features/ota/OtaOrchestrator.d.ts.map +1 -1
  306. package/lib/typescript/features/replay/core/logger/logger.d.ts +0 -1
  307. package/lib/typescript/features/replay/core/logger/logger.d.ts.map +1 -1
  308. package/lib/typescript/features/replay/integrations/network/networkAdapter.d.ts +0 -10
  309. package/lib/typescript/features/replay/integrations/network/networkAdapter.d.ts.map +1 -1
  310. package/lib/typescript/features/session/DesktopSessionTransport.d.ts.map +1 -1
  311. package/lib/typescript/features/skan/skanBridge.d.ts +0 -2
  312. package/lib/typescript/features/skan/skanBridge.d.ts.map +1 -1
  313. package/lib/typescript/metro/composeSourceMap.d.ts +26 -0
  314. package/lib/typescript/metro/composeSourceMap.d.ts.map +1 -0
  315. package/lib/typescript/metro/featureModules.d.ts +49 -0
  316. package/lib/typescript/metro/featureModules.d.ts.map +1 -0
  317. package/lib/typescript/metro/index.d.ts +22 -0
  318. package/lib/typescript/metro/index.d.ts.map +1 -1
  319. package/lib/typescript/metro/serializerCompose.d.ts +46 -0
  320. package/lib/typescript/metro/serializerCompose.d.ts.map +1 -0
  321. package/lib/typescript/pipeline/queue/persistentQueue.d.ts +0 -10
  322. package/lib/typescript/pipeline/queue/persistentQueue.d.ts.map +1 -1
  323. package/lib/typescript/public/ScaleBunFacade.d.ts +11 -0
  324. package/lib/typescript/public/ScaleBunFacade.d.ts.map +1 -1
  325. package/lib/typescript/public/types.d.ts +34 -8
  326. package/lib/typescript/public/types.d.ts.map +1 -1
  327. package/lib/typescript/push/native/nativeNotifications.d.ts +0 -6
  328. package/lib/typescript/push/native/nativeNotifications.d.ts.map +1 -1
  329. package/package.json +15 -11
  330. package/src/bootstrap/FeatureRegistry.ts +4 -4
  331. package/src/bootstrap/SDKBootstrapper.ts +20 -17
  332. package/src/compat/codepush.ts +87 -16
  333. package/src/core/config/schema.ts +353 -222
  334. package/src/core/constants/endpoints.ts +9 -6
  335. package/src/core/constants/protocol.ts +24 -0
  336. package/src/core/constants/timings.ts +3 -1
  337. package/src/core/lifecycle/appLifecycle.ts +1 -1
  338. package/src/debug/bootstrap.ts +40 -7
  339. package/src/debug/exportBridge.ts +5 -3
  340. package/src/debug/hostResolver.ts +2 -2
  341. package/src/debug/perfWiring.ts +4 -4
  342. package/src/debug/replayWiring.ts +5 -5
  343. package/src/debug/screenTracking.ts +2 -2
  344. package/src/debug/sessionWiring.ts +2 -2
  345. package/src/features/crash/NativeCrashFeature.ts +1 -1
  346. package/src/features/crash/globalHandler.ts +3 -3
  347. package/src/features/crash/nativeCrashBridge.ts +7 -7
  348. package/src/features/crash/rejectionHandler.ts +2 -2
  349. package/src/features/engage/EngageArchetypeRenderers.tsx +0 -11
  350. package/src/features/engage/EngageInAppView.tsx +1 -1
  351. package/src/features/engage/EngagePromptProvider.tsx +17 -17
  352. package/src/features/engage/EngageTransport.ts +6 -6
  353. package/src/features/engage/engagePushTokenBridge.ts +4 -4
  354. package/src/features/engage/engageShakeBridge.ts +2 -2
  355. package/src/features/engage/engageSignals.ts +1 -1
  356. package/src/features/engage/engageStoreReviewBridge.ts +2 -2
  357. package/src/features/engage/engageTestSeenStore.ts +1 -1
  358. package/src/features/engage/engageThrottle.ts +4 -4
  359. package/src/features/engage/engageTriggerEngine.ts +4 -4
  360. package/src/features/engage/engageWindowInsets.ts +1 -1
  361. package/src/features/install-referrer/installReferrer.ts +3 -3
  362. package/src/features/journey/calibrationContext.ts +0 -9
  363. package/src/features/journey/journeyManager.ts +3 -1
  364. package/src/features/navigation/AutoScreenDetector.ts +4 -4
  365. package/src/features/ota/OtaOrchestrator.ts +27 -18
  366. package/src/features/ota/geoCountry.ts +2 -2
  367. package/src/features/ota/retry.ts +2 -2
  368. package/src/features/replay/core/logger/logger.ts +0 -4
  369. package/src/features/replay/integrations/network/networkAdapter.ts +1 -56
  370. package/src/features/replay/integrations/react-navigation/navigationIntegration.ts +1 -1
  371. package/src/features/replay/integrations/touch/ReplayRoot.tsx +1 -1
  372. package/src/features/replay/pipeline/batching/batchManager.ts +1 -1
  373. package/src/features/replay/pipeline/retry/retryPolicy.ts +1 -1
  374. package/src/features/replay/public/api.ts +7 -7
  375. package/src/features/replay/replay/session/sessionOrchestrator.ts +9 -9
  376. package/src/features/session/BackendSessionAdapter.ts +41 -41
  377. package/src/features/session/DesktopSessionTransport.ts +4 -2
  378. package/src/features/session/JourneyEventPipeline.ts +1 -1
  379. package/src/features/session/ReplayCaptureManager.ts +14 -14
  380. package/src/features/session/SessionManager.ts +9 -9
  381. package/src/features/session/SyncDecisionEngine.ts +1 -1
  382. package/src/features/skan/skanBridge.ts +6 -14
  383. package/src/features/skan/skanConversionManager.ts +5 -5
  384. package/src/index.ts +1 -1
  385. package/src/integrations/fetch/fetchInterceptor.ts +1 -1
  386. package/src/integrations/xhr/xhrInterceptor.ts +1 -1
  387. package/src/metro/composeSourceMap.ts +104 -0
  388. package/src/metro/featureModules.ts +143 -0
  389. package/src/metro/index.ts +173 -1
  390. package/src/metro/serializerCompose.ts +157 -0
  391. package/src/pipeline/dispatcher/dispatcher.ts +1 -1
  392. package/src/pipeline/queue/flushQueue.ts +2 -2
  393. package/src/pipeline/queue/persistentQueue.ts +6 -35
  394. package/src/pipeline/scheduler/flushScheduler.ts +1 -1
  395. package/src/public/ScaleBunFacade.ts +60 -15
  396. package/src/public/types.ts +35 -8
  397. package/src/push/PushManager.ts +3 -3
  398. package/src/push/adapters/NativeBridgeAdapter.ts +1 -1
  399. package/src/push/native/nativeNotifications.ts +7 -16
  400. package/src/storage/StorageBackend.ts +1 -1
@@ -3,228 +3,421 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ConfigSchema = void 0;
7
- var _protocol = require("../../vendor/protocol");
6
+ exports.ConfigValidationError = exports.ConfigSchema = void 0;
8
7
  var _config = require("../../features/performance/config");
9
8
  var _endpoints = require("../constants/endpoints");
10
- const ConfigSchema = exports.ConfigSchema = _protocol.z.object({
11
- projectId: _protocol.z.string().min(1).optional(),
12
- publishableKey: _protocol.z.string().min(1).optional(),
13
- /**
14
- * Backend API base URL. LOCKED to {@link DEFAULT_API_BASE_URL} the ScaleBun
15
- * cloud endpoint is fixed and cannot be overridden by integrators. Any value
16
- * supplied here is accepted (no validation error, for backward compatibility)
17
- * but ignored: the bootstrapper force-overwrites it with DEFAULT_API_BASE_URL
18
- * immediately after parse. To point the SDK at a different backend, change the
19
- * constant at build time.
20
- */
21
- // Thunk, not a bare string: `default()` is typed `Partial<T> | (() => T)`, and for
22
- // `z.any()` T is `any`, so `Partial<any>` widens to an index signature that a string
23
- // does not satisfy. The function overload does, and DefaultSchema calls it only when
24
- // the input is undefined identical at runtime, and it type-checks, which `bob build`
25
- // requires to emit definitions at all.
26
- apiBaseUrl: _protocol.z.any().default(() => _endpoints.DEFAULT_API_BASE_URL),
27
- debug: _protocol.z.boolean().default(false),
28
- /**
29
- * SDK internal log verbosity. Recoverable transport failures are logged at
30
- * 'warn' (never console.error), so they never surface as a RedBox.
31
- * Default: 'warn'. If omitted and debug=true, the bootstrapper uses 'debug'.
32
- */
33
- logLevel: _protocol.z.enum(['silent', 'error', 'warn', 'info', 'debug']).optional(),
34
- flushIntervalMs: _protocol.z.number().min(1000).default(5000),
35
- /**
36
- * When true, end the recording session on APP_BACKGROUND and start a fresh
37
- * one on next foreground (per-foreground sessions). Default false: a single
38
- * session spans app-switches; the server-side reaper closes it if the app is
39
- * killed in the background. Background always flushes pending data regardless.
40
- */
41
- finalizeOnBackground: _protocol.z.boolean().default(false),
42
- /**
43
- * Inactivity gap (ms) at/after which timeline time is treated as "idle" and
44
- * excluded from the active session duration. Sent to the backend on session
45
- * start and echoed back in the session detail so the dashboard draws idle
46
- * bands + computes active duration with the SAME threshold the SDK declared
47
- * (no client-side guess). Default 60000 (60s).
48
- */
49
- idleThresholdMs: _protocol.z.number().min(1000).default(60_000),
50
- /**
51
- * Max time (ms) the app may stay backgrounded before the analytics session is
52
- * finalized on the next foreground and a fresh one is opened ("cap then
53
- * reaper"). Below the cap, a background/foreground round-trip keeps ONE
54
- * session (background span is flagged, not split). The server-side stale
55
- * reaper is the backstop for a true process kill. Default 1800000 (30 min).
56
- */
57
- sessionBackgroundCapMs: _protocol.z.number().min(60_000).default(30 * 60 * 1000),
58
- maxQueueSize: _protocol.z.number().min(1).default(1000),
59
- enableNetworkMonitoring: _protocol.z.boolean().default(true),
60
- /**
61
- * Opt-in: capture request/response headers and bodies.
62
- * Default: false — must be explicitly enabled by the integrator.
63
- * See ScaleBunFeatures.captureNetworkBodies for the full privacy warning.
64
- */
65
- captureNetworkBodies: _protocol.z.boolean().default(false),
66
- /**
67
- * Max bytes captured per body (request or response) before truncation.
68
- * Range: 1 byte – 1 MiB. Default: 65536 (64 KiB).
69
- */
70
- networkBodyMaxBytes: _protocol.z.number().min(1).max(1_048_576).default(65_536),
71
- /**
72
- * Persistent queue configuration.
73
- * Controls whether the event queue persists to disk and its bounds.
74
- */
75
- persistence: _protocol.z.object({
76
- /** Enable disk persistence (survives app restarts). Default: true */
77
- enabled: _protocol.z.boolean().default(true),
78
- /** Max total bytes stored on disk. Default: 5 MB (5_242_880) */
79
- maxBytes: _protocol.z.number().min(1024).default(5_242_880),
80
- /** Max total entries stored. Default: 5000 */
81
- maxEntries: _protocol.z.number().min(10).default(5_000),
82
- /** Strip PII from payloads before writing to disk. Default: true */
83
- redactBeforeWrite: _protocol.z.boolean().default(true)
84
- }).default({}),
85
- clientKey: _protocol.z.string().optional(),
86
- /**
87
- * Upload replay frame bytes to object storage via presigned PUT instead of
88
- * inline base64 in the frames JSON body. Default false (legacy inline). Safe
89
- * to enable before the backend is ready: the SDK auto-falls back to inline if
90
- * the presign endpoint reports storage is not configured. SaaS (clientKey) only.
91
- */
92
- useObjectStorage: _protocol.z.boolean().default(false),
93
- /**
94
- * Native file-based replay outbox (durable, survives app restart/process kill).
95
- * When true, frames are captured natively to disk and metadata is handed to the
96
- * native outbox instead of buffering base64 in the JS in-memory pendingFrames.
97
- * Default false: existing in-memory JS upload path stays the only path. If the
98
- * native module or a native call is unavailable, the SDK falls back to the
99
- * existing JS path. SaaS (clientKey) only — uploads target /ingestion endpoints.
100
- */
101
- enableNativeFileOutbox: _protocol.z.boolean().default(false),
102
- /**
103
- * Allow the NATIVE outbox to perform uploads (presign -> PUT -> commit, plus
104
- * JSONL telemetry batches) on its own. Default false: even with the outbox on,
105
- * native only captures+stores; JS still drives flush by calling the native
106
- * flush bridge method. Set true to let native upload directly. Requires
107
- * enableNativeFileOutbox.
108
- */
109
- nativeOutboxUploadEnabled: _protocol.z.boolean().default(false),
110
- /**
111
- * Within the native outbox, upload frame image bytes to object storage via
112
- * presigned PUT (key-only metadata commit) instead of inline base64. Default
113
- * false. If the presign endpoint reports storage disabled, native falls back to
114
- * the JS path for that frame (it does NOT send base64 over the bridge in the
115
- * outbox path). Requires enableNativeFileOutbox.
116
- */
117
- useObjectStorageForFrames: _protocol.z.boolean().default(false),
118
- /**
119
- * Native outbox tuning (all additive, all optional — native parses both the
120
- * `nativeOutbox*` keys here and bare `outbox*` aliases). These only take effect
121
- * when enableNativeFileOutbox is true; defaults mirror the native ReplayConfig
122
- * defaults so omitting them changes nothing.
123
- */
124
- /** Armed-retry interval for due outbox work, ms. Default 3000. */
125
- nativeOutboxRetryIntervalMs: _protocol.z.number().min(250).default(3000),
126
- /** Server-attempt cap before a batch is moved to dead. Default 30. */
127
- nativeOutboxMaxUploadAttempts: _protocol.z.number().min(1).default(30),
128
- /** Poison (4xx≠429) attempt cap before dead. Default 2. */
129
- nativeOutboxPoisonMaxAttempts: _protocol.z.number().min(1).default(2),
130
- /** Honor server Retry-After on 429/503. Default true. */
131
- nativeOutboxRespectRetryAfter: _protocol.z.boolean().default(true),
132
- /** Force fixed 3s retry, ignoring exponential backoff. Default false. */
133
- nativeOutboxStrictThreeSecondRetry: _protocol.z.boolean().default(false),
134
- /** Count NETWORK_UNAVAILABLE failures toward the dead threshold. Default false. */
135
- nativeOutboxNetworkFailuresCountTowardDead: _protocol.z.boolean().default(false),
136
- /** Outbox on-disk byte cap before GC. Default 100 MiB. */
137
- nativeOutboxMaxBytes: _protocol.z.number().min(1024).default(100 * 1024 * 1024),
138
- /** Outbox max age before GC, ms. Default 7 days. */
139
- nativeOutboxMaxAgeMs: _protocol.z.number().min(1000).default(7 * 24 * 60 * 60 * 1000),
140
- /**
141
- * Performance pipeline activation flags (SaaS).
142
- * Tiered by cost. Defaults are conservative ("default-safe"): cheap
143
- * event-driven Tier-1 collectors on; heavier UI-hang watchdog and Tier-2
144
- * sampled collectors OFF until device-measured. All flippable via config
145
- * with no SDK release.
146
- */
147
- performance: _protocol.z.object({
148
- /** Master enable; also gates native ScaleBunPerformance.initialize(). Default: true */
149
- enabled: _protocol.z.boolean().default(true),
150
- /** Tier-1: cheap, event-driven collectors. */
151
- tier1: _protocol.z.object({
152
- /** App launch (one-shot at start). Default: true */
153
- appLaunch: _protocol.z.boolean().default(true),
154
- /** Screen load (per navigation). Default: true */
155
- screenLoad: _protocol.z.boolean().default(true),
156
- /** Network perf (slow/failed requests). Default: true */
157
- network: _protocol.z.boolean().default(true),
158
- /** UI hang / ANR watchdog. Default: true — additive, forward-only (needs native module). */
159
- uiHang: _protocol.z.boolean().default(true)
160
- }).default({}),
161
- /** Tier-2: heavy, continuous collectors (frame_metrics + js_stall), sampled. */
162
- tier2: _protocol.z.object({
163
- /** Master enable for Tier-2. Default: true (still gated by sampleRate). */
164
- enabled: _protocol.z.boolean().default(true),
165
- /** Per-session sampling fraction 0..1. Default: 10% — conservative, host-overridable (0 disables). */
166
- sampleRate: _protocol.z.number().min(0).max(1).default(_config.DEFAULT_TIER2_SAMPLE_RATE)
167
- }).default({})
168
- }).default({}),
169
- /**
170
- * Session-replay capture cadence for the unified SessionManager.
171
- * 'navigation' (SDK default) captures only on screen change → a session with
172
- * no navigation produces ~0 frames. 'frequency' captures on a timer
173
- * (intervalMs, min 500ms) for a continuous replay. 'interactions' on gestures.
174
- * Plumbed into SessionManager via SDKBootstrapper.
175
- */
176
- replay: _protocol.z.object({
177
- captureMode: _protocol.z.enum(['navigation', 'interactions', 'frequency']).optional(),
178
- intervalMs: _protocol.z.number().min(500).optional(),
179
- quality: _protocol.z.enum(['high', 'normal', 'low', 'grayscale']).optional(),
180
- // P2-5: emit deltas between keyframes (default false in DEFAULT_SESSION_REPLAY_CONFIG).
181
- deltaEncoding: _protocol.z.boolean().optional(),
182
- deltaKeyframeInterval: _protocol.z.number().int().min(1).optional()
183
- }).optional(),
184
- /**
185
- * Heatmap interaction capture (Feature #4).
186
- *
187
- * When true, tap/gesture coordinates (normalizedX/Y + gesture type + screen)
188
- * are ALSO emitted to the always-on analytics lane — so heatmaps receive data
189
- * even when no replay-recording session is active. This is ADDITIVE: it does
190
- * NOT change replay-recording capture, and reuses the exact same USER_ACTION
191
- * payload keys (normalizedX, normalizedY, gestureType, screen) the recording
192
- * lane writes, so the backend aggregate reads them identically.
193
- *
194
- * Coordinates are NORMALIZED (0..1) and carry no PII. The analytics lane is
195
- * SaaS-only (requires clientKey) and finalize-scoped per foreground; while ON
196
- * a tap on every gesture is enqueued (bounded buffer, drop-oldest).
197
- *
198
- * Default: true (ON). Coords are normalized + PII-free, and volume is bounded
199
- * by a per-foreground sampling cap in SessionManager (HEATMAP_MAX_INTERACTIONS_
200
- * PER_WINDOW) so the gesture stream can't run away. Integrators who want zero
201
- * extra analytics events can still set this false. SaaS (clientKey) only.
202
- *
203
- * CAVEAT: heatmaps populate going FORWARD only — sessions recorded before this
204
- * shipped (or with the flag off) carry no analytics-lane interaction data.
205
- */
206
- captureInteractionHeatmap: _protocol.z.boolean().default(true),
207
- /**
208
- * OTA (Over-the-Air) update configuration.
209
- * When enabled, the SDK checks for JS bundle updates on app foreground
210
- * and applies them atomically. Opt-in: existing integrators are unaffected.
211
- * SaaS (clientKey) only.
212
- */
213
- ota: _protocol.z.object({
214
- /** Enable OTA update checking. Default: false (opt-in). */
215
- enabled: _protocol.z.boolean().default(false),
216
- /** Check for updates on each app foreground. Default: true. */
217
- checkOnForeground: _protocol.z.boolean().default(true),
218
- /** Override the auto-resolved channel (env-based). */
219
- channelOverride: _protocol.z.string().optional(),
220
- /** Ed25519 public key for bundle signature verification (base64). */
221
- publicSigningKey: _protocol.z.string().optional(),
222
- /** Block UI interaction while a mandatory update is pending. Default: false. */
223
- mandatoryBlocksUi: _protocol.z.boolean().default(false)
224
- }).optional()
225
- }).refine(data => !!data.clientKey || !!data.projectId && !!data.publishableKey, {
226
- message: 'Either clientKey (SaaS mode) or both projectId and publishableKey (legacy mode) are required'
9
+ /**
10
+ * ScaleBun SDK — init-config validation and normalization.
11
+ *
12
+ * Hand-rolled, table-driven replacement for the vendored mini-Zod this schema used to be built
13
+ * on. The generic validator cost ~6.7 KB of minified bundle to serve exactly one consumer
14
+ * `SDKBootstrapper.safeParse(rawConfig)` so the machinery is replaced by a field table and a
15
+ * ~1.5 KB engine with BEHAVIOUR PARITY, byte-for-byte on messages:
16
+ *
17
+ * - same accept/reject decisions (strict types, no coercion; min/max reject rather than clamp)
18
+ * - same normalized output (defaults filled, nested defaults via `{}`, unknown keys stripped,
19
+ * optional-and-absent keys omitted)
20
+ * - same error surface (`safeParse` `{ success, data | error }`, error with `.issues`
21
+ * [{path, message}] and Zod-style `.format()`), with identical message strings
22
+ *
23
+ * The parity suite in __tests__/schemaParity.test.ts runs a generated matrix of configs against
24
+ * BOTH this implementation and a verbatim copy of the old vendored-z construction, and
25
+ * deep-compares every result. Changing behaviour here without failing that suite should be
26
+ * treated as impossible; if you extend the config, extend the parity suite's reference schema in
27
+ * the same commit.
28
+ *
29
+ * `apiBaseUrl` note: any value is accepted (`kind: 'any'`, backward compatibility) but the
30
+ * bootstrapper force-overwrites it with DEFAULT_API_BASE_URL immediately after parse the
31
+ * endpoint is locked at build time by design.
32
+ */
33
+
34
+ // ─── Result surface (drop-in for the vendored validator's) ─────────────────────
35
+
36
+ class ConfigValidationError extends Error {
37
+ constructor(issues) {
38
+ super(issues.map(i => `${i.path.join('.') || '(root)'}: ${i.message}`).join('; '));
39
+ this.name = 'ValidationError';
40
+ this.issues = issues;
41
+ }
42
+
43
+ /** Nested error object keyed by path, matching Zod's `error.format()`. */
44
+ format() {
45
+ const root = {
46
+ _errors: []
47
+ };
48
+ for (const issue of this.issues) {
49
+ if (issue.path.length === 0) {
50
+ root._errors.push(issue.message);
51
+ continue;
52
+ }
53
+ let node = root;
54
+ for (let i = 0; i < issue.path.length; i++) {
55
+ const key = String(issue.path[i]);
56
+ const existing = node[key];
57
+ let child;
58
+ if (existing && !Array.isArray(existing)) {
59
+ child = existing;
60
+ } else {
61
+ child = {
62
+ _errors: []
63
+ };
64
+ node[key] = child;
65
+ }
66
+ if (i === issue.path.length - 1) {
67
+ child._errors.push(issue.message);
68
+ }
69
+ node = child;
70
+ }
71
+ }
72
+ return root;
73
+ }
74
+ }
75
+
76
+ // ─── Field table ────────────────────────────────────────────────────────────────
77
+ //
78
+ // One row per config key. `def` present → the field always exists in the output (the default is
79
+ // itself validated, matching DefaultSchema semantics). `opt` absent input stays absent.
80
+ exports.ConfigValidationError = ConfigValidationError;
81
+ const bool = def => def === undefined ? {
82
+ kind: 'bool'
83
+ } : {
84
+ kind: 'bool',
85
+ def
86
+ };
87
+ const num = o => ({
88
+ kind: 'num',
89
+ ...o
227
90
  });
91
+ const SHAPE = {
92
+ projectId: {
93
+ kind: 'str',
94
+ min: 1,
95
+ opt: true
96
+ },
97
+ publishableKey: {
98
+ kind: 'str',
99
+ min: 1,
100
+ opt: true
101
+ },
102
+ apiBaseUrl: {
103
+ kind: 'any',
104
+ def: () => _endpoints.DEFAULT_API_BASE_URL
105
+ },
106
+ debug: bool(false),
107
+ logLevel: {
108
+ kind: 'enum',
109
+ values: ['silent', 'error', 'warn', 'info', 'debug'],
110
+ opt: true
111
+ },
112
+ flushIntervalMs: num({
113
+ min: 1000,
114
+ def: 5000
115
+ }),
116
+ finalizeOnBackground: bool(false),
117
+ idleThresholdMs: num({
118
+ min: 1000,
119
+ def: 60_000
120
+ }),
121
+ sessionBackgroundCapMs: num({
122
+ min: 60_000,
123
+ def: 30 * 60 * 1000
124
+ }),
125
+ maxQueueSize: num({
126
+ min: 1,
127
+ def: 1000
128
+ }),
129
+ enableNetworkMonitoring: bool(true),
130
+ captureNetworkBodies: bool(false),
131
+ networkBodyMaxBytes: num({
132
+ min: 1,
133
+ max: 1_048_576,
134
+ def: 65_536
135
+ }),
136
+ persistence: {
137
+ kind: 'obj',
138
+ def: true,
139
+ shape: {
140
+ enabled: bool(true),
141
+ maxBytes: num({
142
+ min: 1024,
143
+ def: 5_242_880
144
+ }),
145
+ maxEntries: num({
146
+ min: 10,
147
+ def: 5_000
148
+ }),
149
+ redactBeforeWrite: bool(true)
150
+ }
151
+ },
152
+ clientKey: {
153
+ kind: 'str',
154
+ opt: true
155
+ },
156
+ useObjectStorage: bool(false),
157
+ enableNativeFileOutbox: bool(false),
158
+ nativeOutboxUploadEnabled: bool(false),
159
+ useObjectStorageForFrames: bool(false),
160
+ nativeOutboxRetryIntervalMs: num({
161
+ min: 250,
162
+ def: 3000
163
+ }),
164
+ nativeOutboxMaxUploadAttempts: num({
165
+ min: 1,
166
+ def: 30
167
+ }),
168
+ nativeOutboxPoisonMaxAttempts: num({
169
+ min: 1,
170
+ def: 2
171
+ }),
172
+ nativeOutboxRespectRetryAfter: bool(true),
173
+ nativeOutboxStrictThreeSecondRetry: bool(false),
174
+ nativeOutboxNetworkFailuresCountTowardDead: bool(false),
175
+ nativeOutboxMaxBytes: num({
176
+ min: 1024,
177
+ def: 100 * 1024 * 1024
178
+ }),
179
+ nativeOutboxMaxAgeMs: num({
180
+ min: 1000,
181
+ def: 7 * 24 * 60 * 60 * 1000
182
+ }),
183
+ performance: {
184
+ kind: 'obj',
185
+ def: true,
186
+ shape: {
187
+ enabled: bool(true),
188
+ tier1: {
189
+ kind: 'obj',
190
+ def: true,
191
+ shape: {
192
+ appLaunch: bool(true),
193
+ screenLoad: bool(true),
194
+ network: bool(true),
195
+ uiHang: bool(true)
196
+ }
197
+ },
198
+ tier2: {
199
+ kind: 'obj',
200
+ def: true,
201
+ shape: {
202
+ enabled: bool(true),
203
+ sampleRate: num({
204
+ min: 0,
205
+ max: 1,
206
+ def: _config.DEFAULT_TIER2_SAMPLE_RATE
207
+ })
208
+ }
209
+ }
210
+ }
211
+ },
212
+ replay: {
213
+ kind: 'obj',
214
+ opt: true,
215
+ shape: {
216
+ // Auto-start frame recording in SaaS mode (clientKey set) at cold launch, so replay
217
+ // sessions carry frames out of the box. Default: true (undefined ⇒ record). Set false
218
+ // for events-only sessions — the host can still record via ScaleBun.startSession().
219
+ record: {
220
+ kind: 'bool',
221
+ opt: true
222
+ },
223
+ captureMode: {
224
+ kind: 'enum',
225
+ values: ['navigation', 'interactions', 'frequency'],
226
+ opt: true
227
+ },
228
+ intervalMs: num({
229
+ min: 500,
230
+ opt: true
231
+ }),
232
+ quality: {
233
+ kind: 'enum',
234
+ values: ['high', 'normal', 'low', 'grayscale'],
235
+ opt: true
236
+ },
237
+ deltaEncoding: {
238
+ kind: 'bool',
239
+ opt: true
240
+ },
241
+ deltaKeyframeInterval: num({
242
+ min: 1,
243
+ int: true,
244
+ opt: true
245
+ })
246
+ }
247
+ },
248
+ captureInteractionHeatmap: bool(true),
249
+ ota: {
250
+ kind: 'obj',
251
+ opt: true,
252
+ shape: {
253
+ enabled: bool(false),
254
+ checkOnForeground: bool(true),
255
+ channelOverride: {
256
+ kind: 'str',
257
+ opt: true
258
+ },
259
+ publicSigningKey: {
260
+ kind: 'str',
261
+ opt: true
262
+ },
263
+ mandatoryBlocksUi: bool(false)
264
+ }
265
+ }
266
+ };
267
+
268
+ // ─── Engine ─────────────────────────────────────────────────────────────────────
269
+
270
+ const typeofName = v => v === null ? 'null' : Array.isArray(v) ? 'array' : typeof v;
271
+ function parseField(field, input, path, issues) {
272
+ const fail = message => {
273
+ issues.push({
274
+ path,
275
+ message
276
+ });
277
+ return {
278
+ ok: false,
279
+ present: true
280
+ };
281
+ };
282
+ if (input === undefined) {
283
+ if ('opt' in field && field.opt) return {
284
+ ok: true,
285
+ present: false
286
+ };
287
+ if (field.kind === 'any') return {
288
+ ok: true,
289
+ value: field.def(),
290
+ present: true
291
+ };
292
+ if (field.kind === 'obj' && field.def) return parseField({
293
+ ...field,
294
+ def: undefined
295
+ }, {}, path, issues);
296
+ if ('def' in field && field.def !== undefined) return {
297
+ ok: true,
298
+ value: field.def,
299
+ present: true
300
+ };
301
+ // Required with no default (matches the base schemas' type errors on undefined).
302
+ return fail(field.kind === 'bool' ? 'Expected boolean, received undefined' : field.kind === 'num' ? 'Expected number, received undefined' : field.kind === 'str' ? 'Expected string, received undefined' : field.kind === 'enum' ? "Invalid enum value. Expected " + field.values.map(v => `'${v}'`).join(' | ') : 'Expected object, received undefined');
303
+ }
304
+ switch (field.kind) {
305
+ case 'any':
306
+ return {
307
+ ok: true,
308
+ value: input,
309
+ present: true
310
+ };
311
+ case 'bool':
312
+ if (typeof input !== 'boolean') return fail(`Expected boolean, received ${typeofName(input)}`);
313
+ return {
314
+ ok: true,
315
+ value: input,
316
+ present: true
317
+ };
318
+ case 'str':
319
+ if (typeof input !== 'string') return fail(`Expected string, received ${typeofName(input)}`);
320
+ if (field.min !== undefined && input.length < field.min) {
321
+ return fail(`String must contain at least ${field.min} character(s)`);
322
+ }
323
+ return {
324
+ ok: true,
325
+ value: input,
326
+ present: true
327
+ };
328
+ case 'num':
329
+ if (typeof input !== 'number' || Number.isNaN(input)) {
330
+ return fail(`Expected number, received ${typeofName(input)}`);
331
+ }
332
+ if (field.int && !Number.isInteger(input)) return fail('Expected integer, received float');
333
+ if (field.min !== undefined && input < field.min) {
334
+ return fail(`Number must be greater than or equal to ${field.min}`);
335
+ }
336
+ if (field.max !== undefined && input > field.max) {
337
+ return fail(`Number must be less than or equal to ${field.max}`);
338
+ }
339
+ return {
340
+ ok: true,
341
+ value: input,
342
+ present: true
343
+ };
344
+ case 'enum':
345
+ if (typeof input !== 'string' || !field.values.includes(input)) {
346
+ return fail(`Invalid enum value. Expected ${field.values.map(v => `'${v}'`).join(' | ')}`);
347
+ }
348
+ return {
349
+ ok: true,
350
+ value: input,
351
+ present: true
352
+ };
353
+ case 'obj':
354
+ {
355
+ if (typeofName(input) !== 'object') return fail(`Expected object, received ${typeofName(input)}`);
356
+ const src = input;
357
+ const out = {};
358
+ let ok = true;
359
+ for (const key of Object.keys(field.shape)) {
360
+ const r = parseField(field.shape[key], src[key], [...path, key], issues);
361
+ if (!r.ok) ok = false;
362
+ // Mirrors ObjectSchema: keep defined results, and explicit `key in input`
363
+ // occurrences even when the parsed value is undefined (optional present-but-
364
+ // undefined keys survive as own properties, exactly like the old parser).
365
+ else if (r.value !== undefined || key in src) {
366
+ if (r.present || key in src) out[key] = r.value;
367
+ }
368
+ }
369
+ // Unknown keys are stripped (Zod's default `.strip()` behaviour).
370
+ return ok ? {
371
+ ok: true,
372
+ value: out,
373
+ present: true
374
+ } : {
375
+ ok: false,
376
+ present: true
377
+ };
378
+ }
379
+ }
380
+ }
381
+
382
+ /** The one root-level cross-field rule (was `.refine(...)` on the old schema). */
383
+ const ROOT_REFINE_MESSAGE = 'Either clientKey (SaaS mode) or both projectId and publishableKey (legacy mode) are required';
384
+ const ConfigSchema = exports.ConfigSchema = {
385
+ safeParse(input) {
386
+ const issues = [];
387
+ const r = parseField({
388
+ kind: 'obj',
389
+ shape: SHAPE
390
+ }, input, [], issues);
391
+ if (r.ok && issues.length === 0) {
392
+ const data = r.value;
393
+ if (!(!!data.clientKey || !!data.projectId && !!data.publishableKey)) {
394
+ issues.push({
395
+ path: [],
396
+ message: ROOT_REFINE_MESSAGE
397
+ });
398
+ return {
399
+ success: false,
400
+ error: new ConfigValidationError(issues)
401
+ };
402
+ }
403
+ return {
404
+ success: true,
405
+ data
406
+ };
407
+ }
408
+ return {
409
+ success: false,
410
+ error: new ConfigValidationError(issues)
411
+ };
412
+ },
413
+ parse(input) {
414
+ const r = this.safeParse(input);
415
+ if (!r.success) throw r.error;
416
+ return r.data;
417
+ }
418
+ };
419
+
420
+ // ─── Output type (was Infer<typeof ConfigSchema>) ──────────────────────────────
228
421
 
229
422
  // Re-export config types from contracts for consumers migrating to new import paths
230
423
  //# sourceMappingURL=schema.js.map