@scalebun/react-native 1.0.3 → 1.1.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.
- package/android/src/main/java/com/scalebun/core/crash/CrashStorage.kt +115 -1
- package/android/src/main/java/com/scalebun/core/crash/NativeCrashHandler.kt +14 -0
- package/android/src/main/java/com/scalebun/replaysdk/ReplaySdkModule.kt +25 -9
- package/android/src/main/java/com/scalebun/replaysdk/voice/VoiceTranscriber.kt +68 -2
- package/android/src/main/java/com/scalebun/rn/crash/ScaleBunCrashModule.kt +66 -2
- package/android/src/main/java/com/scalebun/rn/ota/SlotManager.kt +70 -4
- package/ios/Crash/ScaleBunCrashBridge.mm +6 -0
- package/ios/Crash/ScaleBunCrashHandler.swift +14 -1
- package/ios/Crash/ScaleBunCrashModule.swift +14 -0
- package/ios/Crash/ScaleBunCrashSignalBridge.h +32 -1
- package/ios/Crash/ScaleBunCrashSignalBridge.m +172 -7
- package/ios/Crash/ScaleBunCrashSignalStress.c +137 -0
- package/ios/Crash/ScaleBunCrashStorage.swift +75 -0
- package/lib/commonjs/analytics/EventTracker.js +30 -2
- package/lib/commonjs/analytics/EventTracker.js.map +1 -1
- package/lib/commonjs/bootstrap/SDKBootstrapper.js +31 -23
- package/lib/commonjs/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/commonjs/compat/codepush.js +78 -15
- package/lib/commonjs/compat/codepush.js.map +1 -1
- package/lib/commonjs/core/config/schema.js +26 -5
- package/lib/commonjs/core/config/schema.js.map +1 -1
- package/lib/commonjs/core/constants/endpoints.js +9 -6
- package/lib/commonjs/core/constants/endpoints.js.map +1 -1
- package/lib/commonjs/core/context/device.js +130 -0
- package/lib/commonjs/core/context/device.js.map +1 -1
- package/lib/commonjs/debug/replayWiring.js +2 -1
- package/lib/commonjs/debug/replayWiring.js.map +1 -1
- package/lib/commonjs/features/bugreport/BugReportFeature.js +112 -0
- package/lib/commonjs/features/bugreport/BugReportFeature.js.map +1 -0
- package/lib/commonjs/features/bugreport/buildPayload.js +97 -0
- package/lib/commonjs/features/bugreport/buildPayload.js.map +1 -0
- package/lib/commonjs/features/crash/CrashReporter.js +25 -1
- package/lib/commonjs/features/crash/CrashReporter.js.map +1 -1
- package/lib/commonjs/features/crash/capture.js +27 -9
- package/lib/commonjs/features/crash/capture.js.map +1 -1
- package/lib/commonjs/features/crash/nativeCrashBridge.js +163 -28
- package/lib/commonjs/features/crash/nativeCrashBridge.js.map +1 -1
- package/lib/commonjs/features/engage/EngagePromptProvider.js +36 -2
- package/lib/commonjs/features/engage/EngagePromptProvider.js.map +1 -1
- package/lib/commonjs/features/engage/EngagePromptView.js +47 -14
- package/lib/commonjs/features/engage/EngagePromptView.js.map +1 -1
- package/lib/commonjs/features/engage/engageTriggerEngine.js +10 -0
- package/lib/commonjs/features/engage/engageTriggerEngine.js.map +1 -1
- package/lib/commonjs/features/engage/engageTypes.js.map +1 -1
- package/lib/commonjs/features/journey/ScaleBunDebugRoot.js +2 -1
- package/lib/commonjs/features/journey/ScaleBunDebugRoot.js.map +1 -1
- package/lib/commonjs/features/ota/OtaOrchestrator.js +72 -5
- package/lib/commonjs/features/ota/OtaOrchestrator.js.map +1 -1
- package/lib/commonjs/features/ota/deviceAttributes.js +48 -0
- package/lib/commonjs/features/ota/deviceAttributes.js.map +1 -0
- package/lib/commonjs/features/ota/geoCountry.js +93 -0
- package/lib/commonjs/features/ota/geoCountry.js.map +1 -0
- package/lib/commonjs/features/ota/useOtaUpdate.js +4 -1
- package/lib/commonjs/features/ota/useOtaUpdate.js.map +1 -1
- package/lib/commonjs/features/performance/PerformanceFeature.js +23 -9
- package/lib/commonjs/features/performance/PerformanceFeature.js.map +1 -1
- package/lib/commonjs/features/performance/collectors/FrameMetricsCollector.js +69 -9
- package/lib/commonjs/features/performance/collectors/FrameMetricsCollector.js.map +1 -1
- package/lib/commonjs/features/performance/transport/PerformanceTransport.js +25 -0
- package/lib/commonjs/features/performance/transport/PerformanceTransport.js.map +1 -1
- package/lib/commonjs/features/session/BackendSessionAdapter.js +128 -11
- package/lib/commonjs/features/session/BackendSessionAdapter.js.map +1 -1
- package/lib/commonjs/features/session/JourneyEventPipeline.js +1 -0
- package/lib/commonjs/features/session/JourneyEventPipeline.js.map +1 -1
- package/lib/commonjs/features/session/ReplayCaptureManager.js +46 -0
- package/lib/commonjs/features/session/ReplayCaptureManager.js.map +1 -1
- package/lib/commonjs/features/session/SessionManager.js +42 -12
- package/lib/commonjs/features/session/SessionManager.js.map +1 -1
- package/lib/commonjs/features/session/nativeCapture.js +4 -4
- package/lib/commonjs/features/session/nativeCapture.js.map +1 -1
- package/lib/commonjs/features/session/outboxFrameCapture.js +3 -2
- package/lib/commonjs/features/session/outboxFrameCapture.js.map +1 -1
- package/lib/commonjs/features/session/sessionTypes.js.map +1 -1
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/public/ScaleBunFacade.js +199 -2
- package/lib/commonjs/public/ScaleBunFacade.js.map +1 -1
- package/lib/commonjs/specs/NativeScaleBunCrash.js.map +1 -1
- package/lib/module/analytics/EventTracker.js +29 -1
- package/lib/module/analytics/EventTracker.js.map +1 -1
- package/lib/module/bootstrap/SDKBootstrapper.js +29 -21
- package/lib/module/bootstrap/SDKBootstrapper.js.map +1 -1
- package/lib/module/compat/codepush.js +77 -14
- package/lib/module/compat/codepush.js.map +1 -1
- package/lib/module/core/config/schema.js +26 -5
- package/lib/module/core/config/schema.js.map +1 -1
- package/lib/module/core/constants/endpoints.js +9 -6
- package/lib/module/core/constants/endpoints.js.map +1 -1
- package/lib/module/core/context/device.js +119 -0
- package/lib/module/core/context/device.js.map +1 -1
- package/lib/module/debug/replayWiring.js +2 -1
- package/lib/module/debug/replayWiring.js.map +1 -1
- package/lib/module/features/bugreport/BugReportFeature.js +105 -0
- package/lib/module/features/bugreport/BugReportFeature.js.map +1 -0
- package/lib/module/features/bugreport/buildPayload.js +91 -0
- package/lib/module/features/bugreport/buildPayload.js.map +1 -0
- package/lib/module/features/crash/CrashReporter.js +25 -1
- package/lib/module/features/crash/CrashReporter.js.map +1 -1
- package/lib/module/features/crash/capture.js +28 -9
- package/lib/module/features/crash/capture.js.map +1 -1
- package/lib/module/features/crash/nativeCrashBridge.js +161 -28
- package/lib/module/features/crash/nativeCrashBridge.js.map +1 -1
- package/lib/module/features/engage/EngagePromptProvider.js +36 -2
- package/lib/module/features/engage/EngagePromptProvider.js.map +1 -1
- package/lib/module/features/engage/EngagePromptView.js +47 -14
- package/lib/module/features/engage/EngagePromptView.js.map +1 -1
- package/lib/module/features/engage/engageTriggerEngine.js +10 -0
- package/lib/module/features/engage/engageTriggerEngine.js.map +1 -1
- package/lib/module/features/engage/engageTypes.js.map +1 -1
- package/lib/module/features/journey/ScaleBunDebugRoot.js +2 -1
- package/lib/module/features/journey/ScaleBunDebugRoot.js.map +1 -1
- package/lib/module/features/ota/OtaOrchestrator.js +72 -5
- package/lib/module/features/ota/OtaOrchestrator.js.map +1 -1
- package/lib/module/features/ota/deviceAttributes.js +43 -0
- package/lib/module/features/ota/deviceAttributes.js.map +1 -0
- package/lib/module/features/ota/geoCountry.js +86 -0
- package/lib/module/features/ota/geoCountry.js.map +1 -0
- package/lib/module/features/ota/useOtaUpdate.js +4 -1
- package/lib/module/features/ota/useOtaUpdate.js.map +1 -1
- package/lib/module/features/performance/PerformanceFeature.js +23 -9
- package/lib/module/features/performance/PerformanceFeature.js.map +1 -1
- package/lib/module/features/performance/collectors/FrameMetricsCollector.js +70 -10
- package/lib/module/features/performance/collectors/FrameMetricsCollector.js.map +1 -1
- package/lib/module/features/performance/transport/PerformanceTransport.js +25 -0
- package/lib/module/features/performance/transport/PerformanceTransport.js.map +1 -1
- package/lib/module/features/session/BackendSessionAdapter.js +128 -11
- package/lib/module/features/session/BackendSessionAdapter.js.map +1 -1
- package/lib/module/features/session/JourneyEventPipeline.js +1 -0
- package/lib/module/features/session/JourneyEventPipeline.js.map +1 -1
- package/lib/module/features/session/ReplayCaptureManager.js +46 -0
- package/lib/module/features/session/ReplayCaptureManager.js.map +1 -1
- package/lib/module/features/session/SessionManager.js +42 -12
- package/lib/module/features/session/SessionManager.js.map +1 -1
- package/lib/module/features/session/nativeCapture.js +4 -5
- package/lib/module/features/session/nativeCapture.js.map +1 -1
- package/lib/module/features/session/outboxFrameCapture.js +3 -2
- package/lib/module/features/session/outboxFrameCapture.js.map +1 -1
- package/lib/module/features/session/sessionTypes.js.map +1 -1
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/public/ScaleBunFacade.js +199 -2
- package/lib/module/public/ScaleBunFacade.js.map +1 -1
- package/lib/module/specs/NativeScaleBunCrash.js.map +1 -1
- package/lib/typescript/analytics/EventTracker.d.ts +20 -0
- package/lib/typescript/analytics/EventTracker.d.ts.map +1 -1
- package/lib/typescript/bootstrap/SDKBootstrapper.d.ts.map +1 -1
- package/lib/typescript/compat/codepush.d.ts +27 -4
- package/lib/typescript/compat/codepush.d.ts.map +1 -1
- package/lib/typescript/core/config/schema.d.ts +4 -1
- package/lib/typescript/core/config/schema.d.ts.map +1 -1
- package/lib/typescript/core/constants/endpoints.d.ts +9 -6
- package/lib/typescript/core/constants/endpoints.d.ts.map +1 -1
- package/lib/typescript/core/context/device.d.ts +46 -0
- package/lib/typescript/core/context/device.d.ts.map +1 -1
- package/lib/typescript/debug/replayWiring.d.ts.map +1 -1
- package/lib/typescript/features/bugreport/BugReportFeature.d.ts +59 -0
- package/lib/typescript/features/bugreport/BugReportFeature.d.ts.map +1 -0
- package/lib/typescript/features/bugreport/buildPayload.d.ts +51 -0
- package/lib/typescript/features/bugreport/buildPayload.d.ts.map +1 -0
- package/lib/typescript/features/crash/CrashReporter.d.ts +20 -1
- package/lib/typescript/features/crash/CrashReporter.d.ts.map +1 -1
- package/lib/typescript/features/crash/capture.d.ts +21 -2
- package/lib/typescript/features/crash/capture.d.ts.map +1 -1
- package/lib/typescript/features/crash/nativeCrashBridge.d.ts +16 -3
- package/lib/typescript/features/crash/nativeCrashBridge.d.ts.map +1 -1
- package/lib/typescript/features/engage/EngagePromptProvider.d.ts.map +1 -1
- package/lib/typescript/features/engage/EngagePromptView.d.ts.map +1 -1
- package/lib/typescript/features/engage/EngageTransport.d.ts +1 -1
- package/lib/typescript/features/engage/EngageTransport.d.ts.map +1 -1
- package/lib/typescript/features/engage/engageTriggerEngine.d.ts.map +1 -1
- package/lib/typescript/features/engage/engageTypes.d.ts +15 -0
- package/lib/typescript/features/engage/engageTypes.d.ts.map +1 -1
- package/lib/typescript/features/journey/ScaleBunDebugRoot.d.ts.map +1 -1
- package/lib/typescript/features/ota/OtaOrchestrator.d.ts +14 -2
- package/lib/typescript/features/ota/OtaOrchestrator.d.ts.map +1 -1
- package/lib/typescript/features/ota/deviceAttributes.d.ts +18 -0
- package/lib/typescript/features/ota/deviceAttributes.d.ts.map +1 -0
- package/lib/typescript/features/ota/geoCountry.d.ts +14 -0
- package/lib/typescript/features/ota/geoCountry.d.ts.map +1 -0
- package/lib/typescript/features/ota/useOtaUpdate.d.ts +20 -2
- package/lib/typescript/features/ota/useOtaUpdate.d.ts.map +1 -1
- package/lib/typescript/features/performance/PerformanceFeature.d.ts +0 -1
- package/lib/typescript/features/performance/PerformanceFeature.d.ts.map +1 -1
- package/lib/typescript/features/performance/collectors/FrameMetricsCollector.d.ts +33 -0
- package/lib/typescript/features/performance/collectors/FrameMetricsCollector.d.ts.map +1 -1
- package/lib/typescript/features/performance/transport/PerformanceTransport.d.ts.map +1 -1
- package/lib/typescript/features/session/BackendSessionAdapter.d.ts +42 -2
- package/lib/typescript/features/session/BackendSessionAdapter.d.ts.map +1 -1
- package/lib/typescript/features/session/JourneyEventPipeline.d.ts +2 -0
- package/lib/typescript/features/session/JourneyEventPipeline.d.ts.map +1 -1
- package/lib/typescript/features/session/ReplayCaptureManager.d.ts +38 -1
- package/lib/typescript/features/session/ReplayCaptureManager.d.ts.map +1 -1
- package/lib/typescript/features/session/SessionManager.d.ts.map +1 -1
- package/lib/typescript/features/session/nativeCapture.d.ts +2 -1
- package/lib/typescript/features/session/nativeCapture.d.ts.map +1 -1
- package/lib/typescript/features/session/outboxFrameCapture.d.ts.map +1 -1
- package/lib/typescript/features/session/sessionTypes.d.ts +20 -3
- package/lib/typescript/features/session/sessionTypes.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/public/ScaleBunFacade.d.ts +69 -0
- package/lib/typescript/public/ScaleBunFacade.d.ts.map +1 -1
- package/lib/typescript/public/types.d.ts +34 -8
- package/lib/typescript/public/types.d.ts.map +1 -1
- package/lib/typescript/specs/NativeScaleBunCrash.d.ts +14 -0
- package/lib/typescript/specs/NativeScaleBunCrash.d.ts.map +1 -1
- package/lib/typescript/vendor/protocol/index.d.ts +17 -17
- package/package.json +1 -1
- package/src/analytics/EventTracker.ts +28 -1
- package/src/bootstrap/SDKBootstrapper.ts +27 -23
- package/src/compat/codepush.ts +87 -16
- package/src/core/config/schema.ts +26 -5
- package/src/core/constants/endpoints.ts +9 -6
- package/src/core/context/device.ts +146 -0
- package/src/debug/replayWiring.ts +2 -1
- package/src/features/bugreport/BugReportFeature.ts +128 -0
- package/src/features/bugreport/buildPayload.ts +116 -0
- package/src/features/crash/CrashReporter.ts +40 -1
- package/src/features/crash/capture.ts +36 -9
- package/src/features/crash/nativeCrashBridge.ts +156 -22
- package/src/features/engage/EngagePromptProvider.tsx +48 -2
- package/src/features/engage/EngagePromptView.tsx +51 -15
- package/src/features/engage/EngageTransport.ts +1 -1
- package/src/features/engage/engageTriggerEngine.ts +15 -0
- package/src/features/engage/engageTypes.ts +15 -0
- package/src/features/journey/ScaleBunDebugRoot.tsx +2 -1
- package/src/features/ota/OtaOrchestrator.ts +84 -6
- package/src/features/ota/deviceAttributes.ts +46 -0
- package/src/features/ota/geoCountry.ts +85 -0
- package/src/features/ota/useOtaUpdate.ts +20 -2
- package/src/features/performance/PerformanceFeature.ts +22 -9
- package/src/features/performance/collectors/FrameMetricsCollector.ts +72 -10
- package/src/features/performance/transport/PerformanceTransport.ts +18 -0
- package/src/features/session/BackendSessionAdapter.ts +137 -10
- package/src/features/session/JourneyEventPipeline.ts +3 -0
- package/src/features/session/ReplayCaptureManager.ts +53 -1
- package/src/features/session/SessionManager.ts +46 -7
- package/src/features/session/nativeCapture.ts +3 -2
- package/src/features/session/outboxFrameCapture.ts +3 -2
- package/src/features/session/sessionTypes.ts +26 -3
- package/src/index.ts +4 -1
- package/src/public/ScaleBunFacade.ts +198 -2
- package/src/public/types.ts +35 -8
- package/src/specs/NativeScaleBunCrash.ts +16 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { otaOrchestrator } from '../features/ota/OtaOrchestrator';
|
|
2
|
+
import { logger } from '../core/logger/internalLogger';
|
|
2
3
|
export let CodePushInstallMode = /*#__PURE__*/function (CodePushInstallMode) {
|
|
3
4
|
CodePushInstallMode[CodePushInstallMode["IMMEDIATE"] = 0] = "IMMEDIATE";
|
|
4
5
|
CodePushInstallMode[CodePushInstallMode["ON_NEXT_RESTART"] = 1] = "ON_NEXT_RESTART";
|
|
@@ -16,24 +17,65 @@ export let CodePushSyncStatus = /*#__PURE__*/function (CodePushSyncStatus) {
|
|
|
16
17
|
CodePushSyncStatus[CodePushSyncStatus["INSTALLING_UPDATE"] = 6] = "INSTALLING_UPDATE";
|
|
17
18
|
return CodePushSyncStatus;
|
|
18
19
|
}({});
|
|
20
|
+
|
|
19
21
|
/**
|
|
20
|
-
* Microsoft CodePush
|
|
22
|
+
* Microsoft CodePush compatibility shim.
|
|
21
23
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* Maps the CodePush surface (`sync`, `checkForUpdate`, the HOC) onto the
|
|
25
|
+
* ScaleBun orchestrator so a migrating app keeps compiling while its call sites
|
|
26
|
+
* are ported.
|
|
27
|
+
*
|
|
28
|
+
* CONFIGURE IT FIRST. This shim used to carry hardcoded defaults —
|
|
29
|
+
* `http://localhost:3001/api/v1` with a dev client key — so a migrated
|
|
30
|
+
* production app silently checked localhost forever and reported UP_TO_DATE on
|
|
31
|
+
* every sync. There is no correct default for someone else's backend, so there
|
|
32
|
+
* is now none: call `configureCodePushShim()` (or `ScaleBun.init({ ota })`,
|
|
33
|
+
* which the facade wires for you) before the first sync, and an unconfigured
|
|
34
|
+
* shim says so loudly instead of pretending to be up to date.
|
|
35
|
+
*
|
|
36
|
+
* import codePush, { configureCodePushShim } from '@scalebun/react-native/compat/codepush';
|
|
37
|
+
* configureCodePushShim({ apiUrl, clientKey, appVersion, installationId });
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
let shimConfig = null;
|
|
41
|
+
|
|
42
|
+
/** Point the shim at a real backend. Required before sync/checkForUpdate. */
|
|
43
|
+
export function configureCodePushShim(config) {
|
|
44
|
+
shimConfig = config;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Resolve the sync params, or null when unconfigured. Returning null (rather
|
|
49
|
+
* than substituting a localhost default) is what turns a silent no-update into
|
|
50
|
+
* a visible, fixable error.
|
|
25
51
|
*/
|
|
52
|
+
function shimParams() {
|
|
53
|
+
if (!shimConfig) {
|
|
54
|
+
logger.warn('[ScaleBun] CodePush shim is not configured — no update check was performed. ' + 'Call configureCodePushShim({ apiUrl, clientKey, appVersion }) during startup.');
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return shimConfig;
|
|
58
|
+
}
|
|
26
59
|
const codePushShim = function (rootComponent) {
|
|
27
60
|
return rootComponent;
|
|
28
61
|
};
|
|
29
62
|
codePushShim.sync = async (options, syncStatusCallback, downloadProgressCallback) => {
|
|
63
|
+
const params = shimParams();
|
|
64
|
+
if (!params) {
|
|
65
|
+
// Unconfigured is an ERROR, not "up to date": reporting UP_TO_DATE here is
|
|
66
|
+
// exactly how a broken migration stays invisible for months.
|
|
67
|
+
syncStatusCallback?.(CodePushSyncStatus.UNKNOWN_ERROR);
|
|
68
|
+
return CodePushSyncStatus.UNKNOWN_ERROR;
|
|
69
|
+
}
|
|
30
70
|
try {
|
|
31
71
|
syncStatusCallback?.(CodePushSyncStatus.CHECKING_FOR_UPDATE);
|
|
32
72
|
const result = await otaOrchestrator.sync({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
installationId
|
|
73
|
+
...params,
|
|
74
|
+
// Omitted → the orchestrator falls back to the SDK's canonical
|
|
75
|
+
// installation id, which is the right identity anyway.
|
|
76
|
+
...(params.installationId ? {
|
|
77
|
+
installationId: params.installationId
|
|
78
|
+
} : {})
|
|
37
79
|
});
|
|
38
80
|
if (result.status === 'UP_TO_DATE') {
|
|
39
81
|
syncStatusCallback?.(CodePushSyncStatus.UP_TO_DATE);
|
|
@@ -51,15 +93,17 @@ codePushShim.sync = async (options, syncStatusCallback, downloadProgressCallback
|
|
|
51
93
|
}
|
|
52
94
|
};
|
|
53
95
|
codePushShim.checkForUpdate = async () => {
|
|
96
|
+
const params = shimParams();
|
|
97
|
+
if (!params) return null;
|
|
54
98
|
const check = await otaOrchestrator.checkForUpdate({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
99
|
+
...params,
|
|
100
|
+
...(params.installationId ? {
|
|
101
|
+
installationId: params.installationId
|
|
102
|
+
} : {})
|
|
59
103
|
});
|
|
60
104
|
if (check.action === 'NONE' || !check.bundle) return null;
|
|
61
105
|
return {
|
|
62
|
-
appVersion:
|
|
106
|
+
appVersion: params.appVersion,
|
|
63
107
|
deploymentKey: 'scalebun_ota',
|
|
64
108
|
description: check.bundle.releaseNote ?? '',
|
|
65
109
|
failedInstall: false,
|
|
@@ -77,8 +121,27 @@ codePushShim.disallowRestart = () => {
|
|
|
77
121
|
codePushShim.allowRestart = () => {
|
|
78
122
|
// Scalebun handles restart safety automatically via boot guard
|
|
79
123
|
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Metadata for the bundle currently RUNNING. CodePush apps use this to show a
|
|
127
|
+
* version or decide whether a pending update landed; returning a flat null
|
|
128
|
+
* (as this did) makes every such check read as "no OTA bundle installed".
|
|
129
|
+
*/
|
|
80
130
|
codePushShim.getUpdateMetadata = async () => {
|
|
81
|
-
|
|
131
|
+
const current = otaOrchestrator.getCurrentBundle();
|
|
132
|
+
if (!current) return null;
|
|
133
|
+
return {
|
|
134
|
+
appVersion: shimConfig?.appVersion ?? '',
|
|
135
|
+
deploymentKey: 'scalebun_ota',
|
|
136
|
+
description: current.releaseNote ?? '',
|
|
137
|
+
failedInstall: false,
|
|
138
|
+
isFirstRun: false,
|
|
139
|
+
isMandatory: current.isMandatory ?? false,
|
|
140
|
+
isPending: false,
|
|
141
|
+
label: `v${current.version}`,
|
|
142
|
+
packageHash: current.sha256,
|
|
143
|
+
packageSize: current.size
|
|
144
|
+
};
|
|
82
145
|
};
|
|
83
146
|
export default codePushShim;
|
|
84
147
|
//# sourceMappingURL=codepush.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["otaOrchestrator","CodePushInstallMode","CodePushSyncStatus","codePushShim","rootComponent","sync","options","syncStatusCallback","downloadProgressCallback","
|
|
1
|
+
{"version":3,"names":["otaOrchestrator","logger","CodePushInstallMode","CodePushSyncStatus","shimConfig","configureCodePushShim","config","shimParams","warn","codePushShim","rootComponent","sync","options","syncStatusCallback","downloadProgressCallback","params","UNKNOWN_ERROR","CHECKING_FOR_UPDATE","result","installationId","status","UP_TO_DATE","UPDATE_INSTALLED","err","checkForUpdate","check","action","bundle","appVersion","deploymentKey","description","releaseNote","failedInstall","isFirstRun","isMandatory","isPending","label","version","packageHash","sha256","packageSize","size","disallowRestart","allowRestart","getUpdateMetadata","current","getCurrentBundle"],"sourceRoot":"../../../src","sources":["compat/codepush.ts"],"mappings":"AAAA,SAASA,eAAe,QAAQ,iCAAiC;AACjE,SAASC,MAAM,QAAQ,+BAA+B;AAEtD,WAAYC,mBAAmB,0BAAnBA,mBAAm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AU;IAC7BC,aAAa,EAAE,cAAc;IAC7BC,WAAW,EAAEL,KAAK,CAACE,MAAM,CAACI,WAAW,IAAI,EAAE;IAC3CC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,KAAK;IACjBC,WAAW,EAAET,KAAK,CAACE,MAAM,CAACO,WAAW;IACrCC,SAAS,EAAE,KAAK;IAChBC,KAAK,EAAE,IAAIX,KAAK,CAACE,MAAM,CAACU,OAAO,EAAE;IACjCC,WAAW,EAAEb,KAAK,CAACE,MAAM,CAACY,MAAM;IAChCC,WAAW,EAAEf,KAAK,CAACE,MAAM,CAACc;EAC5B,CAAC;AACH,CAAC;AAEDhC,YAAY,CAACiC,eAAe,GAAG,MAAM;EACnC;AAAA,CACD;AAEDjC,YAAY,CAACkC,YAAY,GAAG,MAAM;EAChC;AAAA,CACD;;AAED;AACA;AACA;AACA;AACA;AACAlC,YAAY,CAACmC,iBAAiB,GAAG,YAA6C;EAC5E,MAAMC,OAAO,GAAG7C,eAAe,CAAC8C,gBAAgB,CAAC,CAAC;EAClD,IAAI,CAACD,OAAO,EAAE,OAAO,IAAI;EACzB,OAAO;IACLjB,UAAU,EAAExB,UAAU,EAAEwB,UAAU,IAAI,EAAE;IACxCC,aAAa,EAAE,cAAc;IAC7BC,WAAW,EAAEe,OAAO,CAACd,WAAW,IAAI,EAAE;IACtCC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,KAAK;IACjBC,WAAW,EAAEW,OAAO,CAACX,WAAW,IAAI,KAAK;IACzCC,SAAS,EAAE,KAAK;IAChBC,KAAK,EAAE,IAAIS,OAAO,CAACR,OAAO,EAAE;IAC5BC,WAAW,EAAEO,OAAO,CAACN,MAAM;IAC3BC,WAAW,EAAEK,OAAO,CAACJ;EACvB,CAAC;AACH,CAAC;AAED,eAAehC,YAAY","ignoreList":[]}
|
|
@@ -5,11 +5,18 @@ export const ConfigSchema = z.object({
|
|
|
5
5
|
projectId: z.string().min(1).optional(),
|
|
6
6
|
publishableKey: z.string().min(1).optional(),
|
|
7
7
|
/**
|
|
8
|
-
* Backend API base URL.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
// NB: `.default()` on the vendored `z` types its arg as `Partial<T> | (() => T)`, so a bare
|
|
16
|
+
// string arg fails `tsc` (.d.ts generation via bob) with TS2345. The factory form satisfies the
|
|
17
|
+
// `(() => any)` overload. Behaviour is identical — omitted apiBaseUrl resolves to the default,
|
|
18
|
+
// which the bootstrapper overwrites anyway (the endpoint is locked).
|
|
19
|
+
apiBaseUrl: z.any().default(() => DEFAULT_API_BASE_URL),
|
|
13
20
|
debug: z.boolean().default(false),
|
|
14
21
|
/**
|
|
15
22
|
* SDK internal log verbosity. Recoverable transport failures are logged at
|
|
@@ -160,6 +167,11 @@ export const ConfigSchema = z.object({
|
|
|
160
167
|
* Plumbed into SessionManager via SDKBootstrapper.
|
|
161
168
|
*/
|
|
162
169
|
replay: z.object({
|
|
170
|
+
// Auto-start frame recording in SaaS mode (clientKey set) at cold launch, so replay
|
|
171
|
+
// sessions carry frames out of the box. Default: true (undefined ⇒ record). Set false for
|
|
172
|
+
// events-only sessions — the host can still record on demand via ScaleBun.startSession().
|
|
173
|
+
// Decoupled from finalizeOnBackground (which only governs per-foreground session boundaries).
|
|
174
|
+
record: z.boolean().optional(),
|
|
163
175
|
captureMode: z.enum(['navigation', 'interactions', 'frequency']).optional(),
|
|
164
176
|
intervalMs: z.number().min(500).optional(),
|
|
165
177
|
quality: z.enum(['high', 'normal', 'low', 'grayscale']).optional(),
|
|
@@ -205,6 +217,15 @@ export const ConfigSchema = z.object({
|
|
|
205
217
|
channelOverride: z.string().optional(),
|
|
206
218
|
/** Ed25519 public key for bundle signature verification (base64). */
|
|
207
219
|
publicSigningKey: z.string().optional(),
|
|
220
|
+
/**
|
|
221
|
+
* Ed25519 verifier supplied by the host — the SDK ships no crypto
|
|
222
|
+
* implementation. Required whenever `publicSigningKey` is set: pinning a
|
|
223
|
+
* key without a verifier is fail-closed, so updates stop installing.
|
|
224
|
+
* `(message, signature, publicKey) => boolean | Promise<boolean>`.
|
|
225
|
+
*/
|
|
226
|
+
verifySignature: z.any().optional(),
|
|
227
|
+
/** Override how long a new bundle has to prove healthy (ms). */
|
|
228
|
+
healthyTimeoutMs: z.number().optional(),
|
|
208
229
|
/** Block UI interaction while a mandatory update is pending. Default: false. */
|
|
209
230
|
mandatoryBlocksUi: z.boolean().default(false)
|
|
210
231
|
}).optional()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["z","DEFAULT_TIER2_SAMPLE_RATE","DEFAULT_API_BASE_URL","ConfigSchema","object","projectId","string","min","optional","publishableKey","apiBaseUrl","
|
|
1
|
+
{"version":3,"names":["z","DEFAULT_TIER2_SAMPLE_RATE","DEFAULT_API_BASE_URL","ConfigSchema","object","projectId","string","min","optional","publishableKey","apiBaseUrl","any","default","debug","boolean","logLevel","enum","flushIntervalMs","number","finalizeOnBackground","idleThresholdMs","sessionBackgroundCapMs","maxQueueSize","enableNetworkMonitoring","captureNetworkBodies","networkBodyMaxBytes","max","persistence","enabled","maxBytes","maxEntries","redactBeforeWrite","clientKey","useObjectStorage","enableNativeFileOutbox","nativeOutboxUploadEnabled","useObjectStorageForFrames","nativeOutboxRetryIntervalMs","nativeOutboxMaxUploadAttempts","nativeOutboxPoisonMaxAttempts","nativeOutboxRespectRetryAfter","nativeOutboxStrictThreeSecondRetry","nativeOutboxNetworkFailuresCountTowardDead","nativeOutboxMaxBytes","nativeOutboxMaxAgeMs","performance","tier1","appLaunch","screenLoad","network","uiHang","tier2","sampleRate","replay","record","captureMode","intervalMs","quality","deltaEncoding","deltaKeyframeInterval","int","captureInteractionHeatmap","ota","checkOnForeground","channelOverride","publicSigningKey","verifySignature","healthyTimeoutMs","mandatoryBlocksUi","refine","data","message"],"sourceRoot":"../../../../src","sources":["core/config/schema.ts"],"mappings":"AAAA,SAASA,CAAC,QAAoB,uBAAuB;AACrD,SAASC,yBAAyB,QAAQ,mCAAmC;AAC7E,SAASC,oBAAoB,QAAQ,wBAAwB;AAE7D,OAAO,MAAMC,YAAY,GAAGH,CAAC,CAACI,MAAM,CAAC;EACjCC,SAAS,EAAEL,CAAC,CAACM,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACvCC,cAAc,EAAET,CAAC,CAACM,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC5C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;EACI;EACA;EACA;EACA;EACAE,UAAU,EAAEV,CAAC,CAACW,GAAG,CAAC,CAAC,CAACC,OAAO,CAAC,MAAMV,oBAAoB,CAAC;EACvDW,KAAK,EAAEb,CAAC,CAACc,OAAO,CAAC,CAAC,CAACF,OAAO,CAAC,KAAK,CAAC;EACjC;AACJ;AACA;AACA;AACA;EACIG,QAAQ,EAAEf,CAAC,CAACgB,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAACR,QAAQ,CAAC,CAAC;EACzES,eAAe,EAAEjB,CAAC,CAACkB,MAAM,CAAC,CAAC,CAACX,GAAG,CAAC,IAAI,CAAC,CAACK,OAAO,CAAC,IAAI,CAAC;EACnD;AACJ;AACA;AACA;AACA;AACA;EACIO,oBAAoB,EAAEnB,CAAC,CAACc,OAAO,CAAC,CAAC,CAACF,OAAO,CAAC,KAAK,C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AAE9D,CAAC,CAACI,MAAM,CAAC;IACV;IACAwB,OAAO,EAAE5B,CAAC,CAACc,OAAO,CAAC,CAAC,CAACF,OAAO,CAAC,KAAK,CAAC;IACnC;IACAmD,iBAAiB,EAAE/D,CAAC,CAACc,OAAO,CAAC,CAAC,CAACF,OAAO,CAAC,IAAI,CAAC;IAC5C;IACAoD,eAAe,EAAEhE,CAAC,CAACM,MAAM,CAAC,CAAC,CAACE,QAAQ,CAAC,CAAC;IACtC;IACAyD,gBAAgB,EAAEjE,CAAC,CAACM,MAAM,CAAC,CAAC,CAACE,QAAQ,CAAC,CAAC;IACvC;AACR;AACA;AACA;AACA;AACA;IACQ0D,eAAe,EAAElE,CAAC,CAACW,GAAG,CAAC,CAAC,CAACH,QAAQ,CAAC,CAAC;IACnC;IACA2D,gBAAgB,EAAEnE,CAAC,CAACkB,MAAM,CAAC,CAAC,CAACV,QAAQ,CAAC,CAAC;IACvC;IACA4D,iBAAiB,EAAEpE,CAAC,CAACc,OAAO,CAAC,CAAC,CAACF,OAAO,CAAC,KAAK;EAChD,CAAC,CAAC,CAACJ,QAAQ,CAAC;AAChB,CAAC,CAAC,CAAC6D,MAAM,CACJC,IAAI,IAAK,CAAC,CAACA,IAAI,CAACtC,SAAS,IAAK,CAAC,CAACsC,IAAI,CAACjE,SAAS,IAAI,CAAC,CAACiE,IAAI,CAAC7D,cAAe,EACzE;EAAE8D,OAAO,EAAE;AAA+F,CAC9G,CAAC;;AAID","ignoreList":[]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ScaleBun cloud API base URL.
|
|
2
|
+
* ScaleBun cloud API base URL — the single, LOCKED endpoint for the SDK.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* the
|
|
7
|
-
*
|
|
4
|
+
* `SDKBootstrapper` ignores any `apiBaseUrl` passed in init config and always
|
|
5
|
+
* uses this value, so an integrator cannot repoint the SDK at another backend.
|
|
6
|
+
* Includes the `/api/v1` path segment because every SDK route is built relative
|
|
7
|
+
* to this base (e.g. `${apiBaseUrl}/batch`, `${apiBaseUrl}/ingestion/sessions`,
|
|
8
|
+
* `${apiBaseUrl}/config`). Without `/api/v1` the ingestion routes return 404 and
|
|
9
|
+
* events are silently lost. To target a staging or self-hosted backend, change
|
|
10
|
+
* this value at build time.
|
|
8
11
|
*/
|
|
9
|
-
export const DEFAULT_API_BASE_URL = 'https://api.scalebun.com';
|
|
12
|
+
export const DEFAULT_API_BASE_URL = 'https://api.scalebun.com/api/v1';
|
|
10
13
|
//# sourceMappingURL=endpoints.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DEFAULT_API_BASE_URL"],"sourceRoot":"../../../../src","sources":["core/constants/endpoints.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAG,
|
|
1
|
+
{"version":3,"names":["DEFAULT_API_BASE_URL"],"sourceRoot":"../../../../src","sources":["core/constants/endpoints.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAG,iCAAiC","ignoreList":[]}
|
|
@@ -1,2 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE place that answers "what device is this?".
|
|
3
|
+
*
|
|
4
|
+
* It was previously answered three incompatible ways at once:
|
|
5
|
+
*
|
|
6
|
+
* 1. The replay lane asked the native bridge and got the truth.
|
|
7
|
+
* 2. The analytics lane took `ScaleBun.init({ context })` verbatim and shipped whatever the
|
|
8
|
+
* integrator typed. Production carries `device_model: "android"`, `manufacturer: "android"`
|
|
9
|
+
* and `sdk_version: "qa-app-1.0"` because an app hand-wrote them — none of those are a model,
|
|
10
|
+
* a manufacturer, or an SDK version.
|
|
11
|
+
* 3. Seven call sites wrote `Platform.OS === 'ios' ? 'ios' : 'android'`, which reports every
|
|
12
|
+
* non-iOS platform — windows, macos, web — as Android.
|
|
13
|
+
*
|
|
14
|
+
* Detection belongs to the SDK. An integrator cannot be expected to know the device better than the
|
|
15
|
+
* process running on it, and asking them to means the field is wrong whenever they guess.
|
|
16
|
+
*
|
|
17
|
+
* Every value here is measured or absent. Nothing is defaulted to a plausible-looking constant: a
|
|
18
|
+
* fabricated device model is indistinguishable from a real one to whoever reads the dashboard, which
|
|
19
|
+
* is strictly worse than an empty field.
|
|
20
|
+
*/
|
|
21
|
+
import { SDK_VERSION } from '../constants/version';
|
|
1
22
|
|
|
23
|
+
/**
|
|
24
|
+
* The real `Platform.OS`, never narrowed.
|
|
25
|
+
*
|
|
26
|
+
* React Native's own union is `'ios' | 'android' | 'windows' | 'macos' | 'web'`, and the protocol's
|
|
27
|
+
* platform field is an open enum precisely so new ones travel without a release. Collapsing that to
|
|
28
|
+
* a two-way ternary is what made every macOS and Windows session read as Android.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
function rnPlatform() {
|
|
32
|
+
try {
|
|
33
|
+
return require('react-native').Platform ?? null;
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* `Platform.OS`, verbatim.
|
|
41
|
+
*
|
|
42
|
+
* `'unknown'` when React Native itself cannot be loaded — the previous `catch { return 'android' }`
|
|
43
|
+
* turned "we could not tell" into a confident, wrong answer.
|
|
44
|
+
*/
|
|
45
|
+
export function resolvePlatformOS() {
|
|
46
|
+
const os = rnPlatform()?.OS;
|
|
47
|
+
switch (os) {
|
|
48
|
+
case 'ios':
|
|
49
|
+
case 'android':
|
|
50
|
+
case 'windows':
|
|
51
|
+
case 'macos':
|
|
52
|
+
case 'web':
|
|
53
|
+
return os;
|
|
54
|
+
default:
|
|
55
|
+
// A platform React Native gained after this build. Pass it through rather than guess —
|
|
56
|
+
// the wire's platform field is an open enum for exactly this case.
|
|
57
|
+
return os ?? 'unknown';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* `'ios' | 'android'` for the few call sites whose payload genuinely only has those two, keeping the
|
|
63
|
+
* narrowing HONEST: `null` where it used to silently say Android.
|
|
64
|
+
*/
|
|
65
|
+
export function resolveMobileOS() {
|
|
66
|
+
const os = resolvePlatformOS();
|
|
67
|
+
return os === 'ios' || os === 'android' ? os : null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The keys this module owns. An integrator-supplied value for any of them is overridden. */
|
|
71
|
+
export const DETECTED_CONTEXT_KEYS = ['sdk_version', 'platform_os', 'os_version', 'device_model', 'manufacturer'];
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Everything derivable WITHOUT the native bridge, so the very first event already carries it.
|
|
75
|
+
*
|
|
76
|
+
* The bridge is async and may not be installed at all (Expo Go, an older native binary); waiting on
|
|
77
|
+
* it would leave the opening events of every session unattributed. `Platform.constants` is populated
|
|
78
|
+
* synchronously at startup and covers Android fully — iOS exposes no model there, which is why
|
|
79
|
+
* `device_model` stays absent on iOS until {@link nativeDeviceContext} fills it in.
|
|
80
|
+
*/
|
|
81
|
+
export function staticDeviceContext() {
|
|
82
|
+
const platform = rnPlatform();
|
|
83
|
+
const out = {
|
|
84
|
+
sdk_version: SDK_VERSION,
|
|
85
|
+
platform_os: resolvePlatformOS()
|
|
86
|
+
};
|
|
87
|
+
if (!platform) return out;
|
|
88
|
+
const c = platform.constants ?? {};
|
|
89
|
+
// Android: Release is the marketing version ("14"); Version is the API level (34).
|
|
90
|
+
// iOS: osVersion is the real thing; Platform.Version mirrors it.
|
|
91
|
+
const osVersion = c.Release ?? c.osVersion ?? (platform.Version != null ? String(platform.Version) : undefined);
|
|
92
|
+
if (osVersion) out.os_version = String(osVersion);
|
|
93
|
+
if (c.Model) out.device_model = String(c.Model);
|
|
94
|
+
if (c.Manufacturer) out.manufacturer = String(c.Manufacturer);else if (c.Brand) out.manufacturer = String(c.Brand);
|
|
95
|
+
return out;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Bridge values, once the native module answers. Absent keys stay absent. */
|
|
99
|
+
export function nativeDeviceContext(info) {
|
|
100
|
+
const out = {};
|
|
101
|
+
if (!info) return out;
|
|
102
|
+
if (info.osVersion) out.os_version = info.osVersion;
|
|
103
|
+
if (info.deviceModel) out.device_model = info.deviceModel;
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Merge the integrator's context with what we detected — DETECTED WINS on the keys above.
|
|
109
|
+
*
|
|
110
|
+
* The inversion is deliberate. Config normally wins over defaults, but these are not defaults: they
|
|
111
|
+
* are measurements, and a measurement must not be overridable by a guess. Everything outside
|
|
112
|
+
* {@link DETECTED_CONTEXT_KEYS} — `language`, `timezone`, `network_type`, anything app-specific —
|
|
113
|
+
* is still the integrator's to set, untouched.
|
|
114
|
+
*/
|
|
115
|
+
export function mergeDeviceContext(configured, detected = staticDeviceContext()) {
|
|
116
|
+
return {
|
|
117
|
+
...(configured ?? {}),
|
|
118
|
+
...detected
|
|
119
|
+
};
|
|
120
|
+
}
|
|
2
121
|
//# sourceMappingURL=device.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["core/context/device.ts"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["SDK_VERSION","rnPlatform","require","Platform","resolvePlatformOS","os","OS","resolveMobileOS","DETECTED_CONTEXT_KEYS","staticDeviceContext","platform","out","sdk_version","platform_os","c","constants","osVersion","Release","Version","String","undefined","os_version","Model","device_model","Manufacturer","manufacturer","Brand","nativeDeviceContext","info","deviceModel","mergeDeviceContext","configured","detected"],"sourceRoot":"../../../../src","sources":["core/context/device.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,WAAW,QAAQ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AS,KAAKN,QAAQ,CAACQ,OAAO,IAAI,IAAI,GAAGC,MAAM,CAACT,QAAQ,CAACQ,OAAO,CAAC,GAAGE,SAAS,CAAC;EAC/G,IAAIJ,SAAS,EAAEL,GAAG,CAACU,UAAU,GAAGF,MAAM,CAACH,SAAS,CAAC;EACjD,IAAIF,CAAC,CAACQ,KAAK,EAAEX,GAAG,CAACY,YAAY,GAAGJ,MAAM,CAACL,CAAC,CAACQ,KAAK,CAAC;EAC/C,IAAIR,CAAC,CAACU,YAAY,EAAEb,GAAG,CAACc,YAAY,GAAGN,MAAM,CAACL,CAAC,CAACU,YAAY,CAAC,CAAC,KACzD,IAAIV,CAAC,CAACY,KAAK,EAAEf,GAAG,CAACc,YAAY,GAAGN,MAAM,CAACL,CAAC,CAACY,KAAK,CAAC;EACpD,OAAOf,GAAG;AACd;;AAEA;AACA,OAAO,SAASgB,mBAAmBA,CAACC,IAI5B,EAA0B;EAC9B,MAAMjB,GAA2B,GAAG,CAAC,CAAC;EACtC,IAAI,CAACiB,IAAI,EAAE,OAAOjB,GAAG;EACrB,IAAIiB,IAAI,CAACZ,SAAS,EAAEL,GAAG,CAACU,UAAU,GAAGO,IAAI,CAACZ,SAAS;EACnD,IAAIY,IAAI,CAACC,WAAW,EAAElB,GAAG,CAACY,YAAY,GAAGK,IAAI,CAACC,WAAW;EACzD,OAAOlB,GAAG;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASmB,kBAAkBA,CAC9BC,UAA+C,EAC/CC,QAAgC,GAAGvB,mBAAmB,CAAC,CAAC,EACjC;EACvB,OAAO;IAAE,IAAIsB,UAAU,IAAI,CAAC,CAAC,CAAC;IAAE,GAAGC;EAAS,CAAC;AACjD","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { ReplaySdk } from '../features/replay/public/api';
|
|
9
9
|
import { logger } from '../core/logger/internalLogger';
|
|
10
|
+
import { resolvePlatformOS } from '../core/context/device';
|
|
10
11
|
|
|
11
12
|
// ─── State ──────────────────────────────────────────────────────────────────
|
|
12
13
|
|
|
@@ -85,7 +86,7 @@ export function wireNativeCaptureDeferred(getSessionManager) {
|
|
|
85
86
|
byteSize: result.sizeBytes || Math.round(result.base64.length * 0.75),
|
|
86
87
|
format: result.format ?? 'jpeg',
|
|
87
88
|
frameHash: result.frameHash,
|
|
88
|
-
platform:
|
|
89
|
+
platform: resolvePlatformOS()
|
|
89
90
|
};
|
|
90
91
|
} catch {
|
|
91
92
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ReplaySdk","logger","_replaySdkInitialized","_nativeCaptureWired","initReplaySdk","replayConfig","transport","undefined","debug","init","debugTransport","then","info","catch","err","warn","message","recErr","wireNativeCaptureDeferred","getSessionManager","attempt","retryCount","sessionManager","setTimeout","bridgeAdapter","require","Dimensions","Platform","isAvailable","nativeBridgeCapture","_sessionId","_reason","_quality","result","captureScreenshot","base64","width","height","get","Math","round","byteSize","sizeBytes","length","format","frameHash","platform","
|
|
1
|
+
{"version":3,"names":["ReplaySdk","logger","resolvePlatformOS","_replaySdkInitialized","_nativeCaptureWired","initReplaySdk","replayConfig","transport","undefined","debug","init","debugTransport","then","info","catch","err","warn","message","recErr","wireNativeCaptureDeferred","getSessionManager","attempt","retryCount","sessionManager","setTimeout","bridgeAdapter","require","Dimensions","Platform","isAvailable","nativeBridgeCapture","_sessionId","_reason","_quality","result","captureScreenshot","base64","width","height","get","Math","round","byteSize","sizeBytes","length","format","frameHash","platform","setNativeCapture","isReplaySdkInitialized","getReplaySdk","teardownReplay","destroy","resetReplayState"],"sourceRoot":"../../../src","sources":["debug/replayWiring.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,SAAS,QAAQ,+BAA+B;AAIzD,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,iBAAiB,QAAQ,wBAAwB;;AAE1D;;AAEA,IAAIC,qBAAqB,GA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GJ;MACAT,mBAAmB,GAAG,IAAI;MAC1BH,MAAM,CAACY,IAAI,CAAC,uEAAuE,CAAC;IAExF,CAAC,CAAC,OAAOE,GAAQ,EAAE;MACfd,MAAM,CAACe,IAAI,CAAC,8BAA8B,EAAED,GAAG,EAAEE,OAAO,CAAC;MACzD,IAAIK,UAAU,GAAG,CAAC,EAAE;QAChBE,UAAU,CAAC,MAAMH,OAAO,CAACC,UAAU,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC;MACnD;IACJ;EACJ,CAAC;EAEDE,UAAU,CAAC,MAAMH,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;AACrC;;AAEA;;AAEA,OAAO,SAAS4B,sBAAsBA,CAAA,EAAY;EAC9C,OAAO9C,qBAAqB;AAChC;AAEA,OAAO,SAAS+C,YAAYA,CAAA,EAAqB;EAC7C,OAAOlD,SAAS;AACpB;;AAEA;;AAEA,OAAO,SAASmD,cAAcA,CAAA,EAAS;EACnC,IAAIhD,qBAAqB,EAAE;IACvBH,SAAS,CAACoD,OAAO,CAAC,CAAC,CAACtC,KAAK,CAAC,MAAM,CAAE,eAAgB,CAAC;EACvD;AACJ;AAEA,OAAO,SAASuC,gBAAgBA,CAAA,EAAS;EACrClD,qBAAqB,GAAG,KAAK;EAC7BC,mBAAmB,GAAG,KAAK;AAC/B","ignoreList":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* F-BUG (React Native) — bug-report feature.
|
|
3
|
+
*
|
|
4
|
+
* Ported from the web SDK's `features/bugreport/BugReportFeature.ts`, deliberately keeping its
|
|
5
|
+
* split: this class is THIN. It raises the capture signal and holds a `submitFn` injected by the
|
|
6
|
+
* facade, which owns session + transport and therefore owns the HTTP. Duplicating the submit here
|
|
7
|
+
* would give the two SDKs two contracts to drift apart.
|
|
8
|
+
*
|
|
9
|
+
* WHAT DOES NOT PORT
|
|
10
|
+
* The web feature lazy-imports a DOM launcher widget (`widget.ts`, 185 lines of document/CSS). RN
|
|
11
|
+
* has no DOM: the form is rendered by `EngagePromptView`, which already exists, already handles the
|
|
12
|
+
* native modal/keyboard behaviour, and is already what `shake_device` puts on screen. Building a
|
|
13
|
+
* second prompt system for this would be the same mistake in a different repo.
|
|
14
|
+
*
|
|
15
|
+
* TRIGGERING
|
|
16
|
+
* `shake_device` is already wired end to end — native CoreMotion/SensorManager →
|
|
17
|
+
* `engageShakeBridge` → `gestureTriggerDetector.reportShake()` → the `$gesture` signal lane → the
|
|
18
|
+
* engage trigger engine. This feature is a submit target for that flow, not a second detector.
|
|
19
|
+
*/
|
|
20
|
+
import { logger } from '../../core/logger/internalLogger';
|
|
21
|
+
|
|
22
|
+
/** Why a submit did not produce a report id. Mirrors the web SDK's discriminated failure union. */
|
|
23
|
+
|
|
24
|
+
/** Resolves to the report id, or to `{ e }` naming WHICH branch failed. */
|
|
25
|
+
|
|
26
|
+
export class BugReportFeature {
|
|
27
|
+
name = 'bugReport';
|
|
28
|
+
active = false;
|
|
29
|
+
submitFn = null;
|
|
30
|
+
/** Raises the 'report' capture signal so replay flushes its buffer into the current session. */
|
|
31
|
+
signalFn = null;
|
|
32
|
+
get isActive() {
|
|
33
|
+
return this.active;
|
|
34
|
+
}
|
|
35
|
+
setup(hooks = {}) {
|
|
36
|
+
this.signalFn = hooks.signal ?? null;
|
|
37
|
+
this.active = true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Flush replay into the session so the report has its visual context.
|
|
42
|
+
*
|
|
43
|
+
* Fail-soft: replay may be disabled, paused, or unsupported on this build. A report without a
|
|
44
|
+
* replay anchor is still a useful report, so this must never block a submit.
|
|
45
|
+
*/
|
|
46
|
+
signalReport() {
|
|
47
|
+
try {
|
|
48
|
+
this.signalFn?.();
|
|
49
|
+
} catch {
|
|
50
|
+
/* never let a capture-signal failure break a bug report */
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Wired by the facade after init — the full submit path (transport + session + context). */
|
|
55
|
+
setSubmit(fn) {
|
|
56
|
+
this.submitFn = fn;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Submit a report.
|
|
61
|
+
*
|
|
62
|
+
* Returns rather than throws, always. This is called from a UI the host app renders, often from a
|
|
63
|
+
* user gesture; an exception escaping into a React Native render tree is a redbox for the
|
|
64
|
+
* customer's user, over a bug report they were trying to send us.
|
|
65
|
+
*/
|
|
66
|
+
async submit(input) {
|
|
67
|
+
if (!input || !input.message || input.message.trim().length === 0) {
|
|
68
|
+
logger.warn('[scalebun] reportBug: a message is required');
|
|
69
|
+
return {
|
|
70
|
+
e: 'empty'
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// No submitFn means the facade never finished wiring. That is 'init', not a send failure —
|
|
74
|
+
// the distinction is what tells an integrator to check their setup rather than their network.
|
|
75
|
+
if (!this.submitFn) return {
|
|
76
|
+
e: 'init'
|
|
77
|
+
};
|
|
78
|
+
if (input.voice && !input.voice.transcriptApproved) {
|
|
79
|
+
// Refused rather than silently stripped: dropping the attachment would send a report the user
|
|
80
|
+
// believes contains their voice note, and they would never learn it did not.
|
|
81
|
+
logger.warn('[scalebun] reportBug: voice note has no approved transcript — not sending');
|
|
82
|
+
return {
|
|
83
|
+
e: 'empty'
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
// Order matters and mirrors the web path: signal BEFORE submit so the replay bytes are already
|
|
88
|
+
// in flight, and so the report's replay coordinate refers to a frame that exists. A flush
|
|
89
|
+
// cannot retroactively manufacture a frame, so a missing anchor must stay missing rather than
|
|
90
|
+
// become a misleading "start of session" link in the dashboard.
|
|
91
|
+
this.signalReport();
|
|
92
|
+
return await this.submitFn(input);
|
|
93
|
+
} catch {
|
|
94
|
+
return {
|
|
95
|
+
e: 'send'
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
teardown() {
|
|
100
|
+
this.submitFn = null;
|
|
101
|
+
this.signalFn = null;
|
|
102
|
+
this.active = false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=BugReportFeature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["logger","BugReportFeature","name","active","submitFn","signalFn","isActive","setup","hooks","signal","signalReport","setSubmit","fn","submit","input","message","trim","length","warn","e","voice","transcriptApproved","teardown"],"sourceRoot":"../../../../src","sources":["features/bugreport/BugReportFeature.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,MAAM,QAAQ,kCAAkC;;AAGzD;;AAGA;;AA0BA,OAAO,MAAMC,gBAAgB,CAAC;EACnBC,IAAI,GAAG,WAAW;EAEnBC,MAAM,GAAG,KAAK;EACdC,QAAQ,GAAoB,IAAI;EACxC;EACQC,QAAQ,GAAwB,IAAI;EAE5C,IAAIC,QAAQA,CAAA,EAAY;IACtB,OAAO,IAAI,CAACH,MAAM;EACpB;EAEAI,KAAKA,CAACC,KAA8B,GAAG,CAAC,CAAC,EAAQ;IAC/C,IAAI,CAACH,QAAQ,GAAGG,KAAK,CAACC,MAAM,IAAI,IAAI;IACpC,IAAI,CAACN,MAAM,GAAG,IAAI;EACpB;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEO,YAAYA,CAAA,EAAS;IACnB,IAAI;MACF,IAAI,CAACL,QAAQ,GAAG,CAAC;IACnB,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;;EAEA;EACAM,SAASA,CAACC,EAAY,EAAQ;IAC5B,IAAI,CAACR,QAAQ,GAAGQ,EAAE;EACpB;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,MAAMA,CAACC,KAAqB,EAA4B;IAC5D,IAAI,CAACA,KAAK,IAAI,CAACA,KAAK,CAACC,OAAO,IAAID,KAAK,CAACC,OAAO,CAACC,IAA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