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