@multiplayer-app/session-recorder-react-native 1.0.1-beta.3 → 1.0.1-beta.4
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/LICENSE +1 -2
- package/README.md +216 -155
- package/SessionRecorderNative.podspec +9 -14
- package/android/build.gradle +21 -44
- package/android/gradle.properties +4 -4
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativeConfig.kt +52 -0
- package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativeModule.kt +860 -0
- package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativeModuleSpec.kt +51 -0
- package/android/src/main/java/com/multiplayer/sessionrecordernative/SessionRecorderNativePackage.kt +33 -0
- package/android/src/main/java/com/multiplayer/sessionrecordernative/model/TargetInfo.kt +9 -0
- package/android/src/main/java/com/multiplayer/sessionrecordernative/util/ViewUtils.kt +72 -0
- package/android/src/main/java/com/xxx/XxxModule.kt +23 -0
- package/ios/SessionRecorderNative.podspec +4 -2
- package/ios/SessionRecorderNative.swift +1 -1
- package/ios/SessionRecorderNativeSpec.swift +3 -3
- package/ios/Xxx.h +5 -0
- package/ios/Xxx.mm +21 -0
- package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js +23 -0
- package/lib/module/components/ScreenRecorderView/ScreenRecorderView.js.map +1 -0
- package/lib/module/components/ScreenRecorderView/index.js +4 -0
- package/lib/module/components/ScreenRecorderView/index.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/ErrorBanner.js +64 -0
- package/lib/module/components/SessionRecorderWidget/ErrorBanner.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/FinalPopover.js +74 -0
- package/lib/module/components/SessionRecorderWidget/FinalPopover.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/FloatingButton.js +191 -0
- package/lib/module/components/SessionRecorderWidget/FloatingButton.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/InitialPopover.js +138 -0
- package/lib/module/components/SessionRecorderWidget/InitialPopover.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/ModalContainer.js +177 -0
- package/lib/module/components/SessionRecorderWidget/ModalContainer.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/ModalHeader.js +27 -0
- package/lib/module/components/SessionRecorderWidget/ModalHeader.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js +133 -0
- package/lib/module/components/SessionRecorderWidget/SessionRecorderWidget.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/icons.js +93 -0
- package/lib/module/components/SessionRecorderWidget/icons.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/index.js +5 -0
- package/lib/module/components/SessionRecorderWidget/index.js.map +1 -0
- package/lib/module/components/SessionRecorderWidget/styles.js +173 -0
- package/lib/module/components/SessionRecorderWidget/styles.js.map +1 -0
- package/lib/module/components/index.js +5 -0
- package/lib/module/components/index.js.map +1 -0
- package/lib/module/config/constants.js +42 -0
- package/lib/module/config/constants.js.map +1 -0
- package/lib/module/config/defaults.js +81 -0
- package/lib/module/config/defaults.js.map +1 -0
- package/lib/module/config/index.js +9 -0
- package/lib/module/config/index.js.map +1 -0
- package/lib/module/config/masking.js +35 -0
- package/lib/module/config/masking.js.map +1 -0
- package/lib/module/config/session-recorder.js +44 -0
- package/lib/module/config/session-recorder.js.map +1 -0
- package/lib/module/config/validators.js +28 -0
- package/lib/module/config/validators.js.map +1 -0
- package/lib/module/config/widget.js +35 -0
- package/lib/module/config/widget.js.map +1 -0
- package/lib/module/context/SessionRecorderContext.js +93 -0
- package/lib/module/context/SessionRecorderContext.js.map +1 -0
- package/lib/module/context/SessionRecorderStore.js +12 -0
- package/lib/module/context/SessionRecorderStore.js.map +1 -0
- package/lib/module/context/useSessionRecorderStore.js +20 -0
- package/lib/module/context/useSessionRecorderStore.js.map +1 -0
- package/lib/module/context/useStoreSelector.js +27 -0
- package/lib/module/context/useStoreSelector.js.map +1 -0
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native/SessionRecorderNative.js +74 -0
- package/lib/module/native/SessionRecorderNative.js.map +1 -0
- package/lib/module/native/index.js +4 -0
- package/lib/module/native/index.js.map +1 -0
- package/lib/module/otel/helpers.js +218 -0
- package/lib/module/otel/helpers.js.map +1 -0
- package/lib/module/otel/index.js +95 -0
- package/lib/module/otel/index.js.map +1 -0
- package/lib/module/otel/instrumentations/index.js +102 -0
- package/lib/module/otel/instrumentations/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/patch/index.js +4 -0
- package/lib/module/patch/index.js.map +1 -0
- package/lib/module/patch/xhr.js +116 -0
- package/lib/module/patch/xhr.js.map +1 -0
- package/lib/module/recorder/eventExporter.js +130 -0
- package/lib/module/recorder/eventExporter.js.map +1 -0
- package/lib/module/recorder/gestureRecorder.js +641 -0
- package/lib/module/recorder/gestureRecorder.js.map +1 -0
- package/lib/module/recorder/index.js +168 -0
- package/lib/module/recorder/index.js.map +1 -0
- package/lib/module/recorder/navigationTracker.js +228 -0
- package/lib/module/recorder/navigationTracker.js.map +1 -0
- package/lib/module/recorder/screenRecorder.js +495 -0
- package/lib/module/recorder/screenRecorder.js.map +1 -0
- package/lib/module/services/api.service.js +149 -0
- package/lib/module/services/api.service.js.map +1 -0
- package/lib/module/services/network.service.js +178 -0
- package/lib/module/services/network.service.js.map +1 -0
- package/lib/module/services/screenMaskingService.js +107 -0
- package/lib/module/services/screenMaskingService.js.map +1 -0
- package/lib/module/services/storage.service.js +179 -0
- package/lib/module/services/storage.service.js.map +1 -0
- package/lib/module/session-recorder.js +541 -0
- package/lib/module/session-recorder.js.map +1 -0
- package/lib/module/types/configs.js +4 -0
- package/lib/module/types/configs.js.map +1 -0
- package/lib/module/types/expo-constants.d.js +2 -0
- package/lib/module/types/expo-constants.d.js.map +1 -0
- package/lib/module/types/index.js +11 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/session-recorder.js +68 -0
- package/lib/module/types/session-recorder.js.map +1 -0
- package/lib/module/types/session.js +9 -0
- package/lib/module/types/session.js.map +1 -0
- package/lib/module/utils/app-metadata.js +28 -0
- package/lib/module/utils/app-metadata.js.map +1 -0
- package/lib/module/utils/constants.optional.expo.js +6 -0
- package/lib/module/utils/constants.optional.expo.js.map +1 -0
- package/lib/module/utils/constants.optional.js +8 -0
- package/lib/module/utils/constants.optional.js.map +1 -0
- package/lib/module/utils/createStore.js +27 -0
- package/lib/module/utils/createStore.js.map +1 -0
- package/lib/module/utils/index.js +11 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/module/utils/logger.js +193 -0
- package/lib/module/utils/logger.js.map +1 -0
- package/lib/module/utils/platform.js +340 -0
- package/lib/module/utils/platform.js.map +1 -0
- package/lib/module/utils/request-utils.js +58 -0
- package/lib/module/utils/request-utils.js.map +1 -0
- package/lib/module/utils/rrweb-events.js +276 -0
- package/lib/module/utils/rrweb-events.js.map +1 -0
- package/lib/module/utils/session.js +21 -0
- package/lib/module/utils/session.js.map +1 -0
- package/lib/module/utils/shallowEqual.js +17 -0
- package/lib/module/utils/shallowEqual.js.map +1 -0
- package/lib/module/utils/time.js +17 -0
- package/lib/module/utils/time.js.map +1 -0
- package/lib/module/utils/type-utils.js +69 -0
- package/lib/module/utils/type-utils.js.map +1 -0
- package/lib/module/version.js +4 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts +6 -0
- package/lib/typescript/src/components/ScreenRecorderView/ScreenRecorderView.d.ts.map +1 -0
- package/lib/typescript/src/components/ScreenRecorderView/index.d.ts +2 -0
- package/lib/typescript/src/components/ScreenRecorderView/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ErrorBanner.d.ts +1 -0
- package/lib/typescript/src/components/SessionRecorderWidget/ErrorBanner.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/FinalPopover.d.ts +2 -1
- package/lib/typescript/src/components/SessionRecorderWidget/FinalPopover.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/FloatingButton.d.ts +1 -0
- package/lib/typescript/src/components/SessionRecorderWidget/FloatingButton.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/InitialPopover.d.ts +2 -1
- package/lib/typescript/src/components/SessionRecorderWidget/InitialPopover.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ModalContainer.d.ts +1 -0
- package/lib/typescript/src/components/SessionRecorderWidget/ModalContainer.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/ModalHeader.d.ts +1 -0
- package/lib/typescript/src/components/SessionRecorderWidget/ModalHeader.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/SessionRecorderWidget.d.ts +1 -0
- package/lib/typescript/src/components/SessionRecorderWidget/SessionRecorderWidget.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/icons.d.ts +1 -0
- package/lib/typescript/src/components/SessionRecorderWidget/icons.d.ts.map +1 -0
- package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts +3 -0
- package/lib/typescript/src/components/SessionRecorderWidget/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/SessionRecorderWidget/styles.d.ts +4 -3
- package/lib/typescript/src/components/SessionRecorderWidget/styles.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/components/index.d.ts +1 -0
- package/lib/typescript/src/components/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/config/constants.d.ts +1 -0
- package/lib/typescript/src/config/constants.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/config/defaults.d.ts +2 -1
- package/lib/typescript/src/config/defaults.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/config/index.d.ts +1 -0
- package/lib/typescript/src/config/index.d.ts.map +1 -0
- package/lib/typescript/src/config/masking.d.ts +3 -0
- package/lib/typescript/src/config/masking.d.ts.map +1 -0
- package/lib/typescript/src/config/session-recorder.d.ts +3 -0
- package/lib/typescript/src/config/session-recorder.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/config/validators.d.ts +1 -0
- package/lib/typescript/src/config/validators.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/config/widget.d.ts +2 -1
- package/lib/typescript/src/config/widget.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/context/SessionRecorderContext.d.ts +3 -2
- package/lib/typescript/src/context/SessionRecorderContext.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/context/SessionRecorderStore.d.ts +2 -1
- package/lib/typescript/src/context/SessionRecorderStore.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/context/useSessionRecorderStore.d.ts +2 -1
- package/lib/typescript/src/context/useSessionRecorderStore.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/context/useStoreSelector.d.ts +2 -1
- package/lib/typescript/src/context/useStoreSelector.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/native/SessionRecorderNative.d.ts +21 -3
- package/lib/typescript/src/native/SessionRecorderNative.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/native/index.d.ts +1 -0
- package/lib/typescript/src/native/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/otel/helpers.d.ts +3 -2
- package/lib/typescript/src/otel/helpers.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/otel/index.d.ts +2 -2
- package/lib/typescript/src/otel/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/otel/instrumentations/index.d.ts +2 -1
- package/lib/typescript/src/otel/instrumentations/index.d.ts.map +1 -0
- package/lib/typescript/src/patch/index.d.ts +2 -0
- package/lib/typescript/src/patch/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/patch/xhr.d.ts +1 -0
- package/lib/typescript/src/patch/xhr.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/recorder/eventExporter.d.ts +2 -1
- package/lib/typescript/src/recorder/eventExporter.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/recorder/gestureRecorder.d.ts +3 -2
- package/lib/typescript/src/recorder/gestureRecorder.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/recorder/index.d.ts +3 -2
- package/lib/typescript/src/recorder/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/recorder/navigationTracker.d.ts +2 -1
- package/lib/typescript/src/recorder/navigationTracker.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/recorder/screenRecorder.d.ts +4 -4
- package/lib/typescript/src/recorder/screenRecorder.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/services/api.service.d.ts +2 -1
- package/lib/typescript/src/services/api.service.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/services/network.service.d.ts +1 -0
- package/lib/typescript/src/services/network.service.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/services/screenMaskingService.d.ts +2 -1
- package/lib/typescript/src/services/screenMaskingService.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/services/storage.service.d.ts +2 -1
- package/lib/typescript/src/services/storage.service.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/session-recorder.d.ts +3 -2
- package/lib/typescript/src/session-recorder.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/types/configs.d.ts +3 -2
- package/lib/typescript/src/types/configs.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/types/index.d.ts +1 -0
- package/lib/typescript/src/types/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/types/session-recorder.d.ts +3 -2
- package/lib/typescript/src/types/session-recorder.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/types/session.d.ts +1 -0
- package/lib/typescript/src/types/session.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/app-metadata.d.ts +1 -0
- package/lib/typescript/src/utils/app-metadata.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/constants.optional.d.ts +1 -0
- package/lib/typescript/src/utils/constants.optional.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/constants.optional.expo.d.ts +1 -0
- package/lib/typescript/src/utils/constants.optional.expo.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/createStore.d.ts +1 -0
- package/lib/typescript/src/utils/createStore.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/index.d.ts +1 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/logger.d.ts +1 -0
- package/lib/typescript/src/utils/logger.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/platform.d.ts +2 -1
- package/lib/typescript/src/utils/platform.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/request-utils.d.ts +1 -0
- package/lib/typescript/src/utils/request-utils.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/rrweb-events.d.ts +2 -1
- package/lib/typescript/src/utils/rrweb-events.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/session.d.ts +1 -0
- package/lib/typescript/src/utils/session.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/shallowEqual.d.ts +1 -0
- package/lib/typescript/src/utils/shallowEqual.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/time.d.ts +1 -0
- package/lib/typescript/src/utils/time.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/utils/type-utils.d.ts +1 -0
- package/lib/typescript/src/utils/type-utils.d.ts.map +1 -0
- package/{dist → lib/typescript/src}/version.d.ts +1 -0
- package/lib/typescript/src/version.d.ts.map +1 -0
- package/package.json +133 -44
- package/src/components/ScreenRecorderView/ScreenRecorderView.tsx +20 -0
- package/src/components/SessionRecorderWidget/ErrorBanner.tsx +58 -0
- package/src/components/SessionRecorderWidget/FinalPopover.tsx +96 -0
- package/src/components/SessionRecorderWidget/FloatingButton.tsx +176 -0
- package/src/components/SessionRecorderWidget/InitialPopover.tsx +167 -0
- package/src/components/SessionRecorderWidget/ModalContainer.tsx +189 -0
- package/src/components/SessionRecorderWidget/ModalHeader.tsx +24 -0
- package/src/components/SessionRecorderWidget/SessionRecorderWidget.tsx +136 -0
- package/src/components/SessionRecorderWidget/icons.tsx +52 -0
- package/{dist/components/SessionRecorderWidget/index.d.ts → src/components/SessionRecorderWidget/index.ts} +1 -0
- package/src/components/SessionRecorderWidget/styles.ts +169 -0
- package/src/components/index.ts +2 -0
- package/src/config/constants.ts +68 -0
- package/src/config/defaults.ts +101 -0
- package/src/config/index.ts +6 -0
- package/src/config/masking.ts +34 -0
- package/src/config/session-recorder.ts +59 -0
- package/src/config/validators.ts +31 -0
- package/src/config/widget.ts +38 -0
- package/src/context/SessionRecorderContext.tsx +138 -0
- package/src/context/SessionRecorderStore.ts +21 -0
- package/src/context/useSessionRecorderStore.ts +27 -0
- package/src/context/useStoreSelector.ts +34 -0
- package/src/index.ts +10 -0
- package/src/native/SessionRecorderNative.ts +164 -0
- package/src/native/index.ts +1 -0
- package/src/otel/helpers.ts +274 -0
- package/src/otel/index.ts +135 -0
- package/src/otel/instrumentations/index.ts +115 -0
- package/src/patch/index.ts +1 -0
- package/src/patch/xhr.ts +149 -0
- package/src/recorder/eventExporter.ts +155 -0
- package/src/recorder/gestureRecorder.ts +681 -0
- package/src/recorder/index.ts +190 -0
- package/src/recorder/navigationTracker.ts +245 -0
- package/src/recorder/screenRecorder.ts +549 -0
- package/src/services/api.service.ts +215 -0
- package/src/services/network.service.ts +182 -0
- package/src/services/screenMaskingService.ts +122 -0
- package/src/services/storage.service.ts +219 -0
- package/src/session-recorder.ts +591 -0
- package/src/types/configs.ts +96 -0
- package/src/types/expo-constants.d.ts +7 -0
- package/src/types/index.ts +29 -0
- package/src/types/session-recorder.ts +386 -0
- package/src/types/session.ts +65 -0
- package/src/utils/app-metadata.ts +31 -0
- package/src/utils/constants.optional.expo.ts +5 -0
- package/src/utils/constants.optional.ts +16 -0
- package/src/utils/createStore.ts +29 -0
- package/src/utils/index.ts +8 -0
- package/src/utils/logger.ts +216 -0
- package/src/utils/platform.ts +370 -0
- package/src/utils/request-utils.ts +61 -0
- package/src/utils/rrweb-events.ts +316 -0
- package/src/utils/session.ts +19 -0
- package/src/utils/shallowEqual.ts +14 -0
- package/src/utils/time.ts +17 -0
- package/src/utils/type-utils.ts +75 -0
- package/src/version.ts +1 -0
- package/REACT_NATIVE_SETUP.md +0 -91
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/android/gradlew +0 -249
- package/android/gradlew.bat +0 -92
- package/copy-react-native-dist.sh +0 -56
- package/dist/components/ScreenRecorderView/ScreenRecorderView.d.ts +0 -5
- package/dist/components/ScreenRecorderView/ScreenRecorderView.js +0 -1
- package/dist/components/ScreenRecorderView/ScreenRecorderView.js.map +0 -1
- package/dist/components/ScreenRecorderView/index.js +0 -1
- package/dist/components/ScreenRecorderView/index.js.map +0 -1
- package/dist/components/SessionRecorderWidget/ErrorBanner.js +0 -1
- package/dist/components/SessionRecorderWidget/ErrorBanner.js.map +0 -1
- package/dist/components/SessionRecorderWidget/FinalPopover.js +0 -1
- package/dist/components/SessionRecorderWidget/FinalPopover.js.map +0 -1
- package/dist/components/SessionRecorderWidget/FloatingButton.js +0 -1
- package/dist/components/SessionRecorderWidget/FloatingButton.js.map +0 -1
- package/dist/components/SessionRecorderWidget/InitialPopover.js +0 -1
- package/dist/components/SessionRecorderWidget/InitialPopover.js.map +0 -1
- package/dist/components/SessionRecorderWidget/ModalContainer.js +0 -1
- package/dist/components/SessionRecorderWidget/ModalContainer.js.map +0 -1
- package/dist/components/SessionRecorderWidget/ModalHeader.js +0 -1
- package/dist/components/SessionRecorderWidget/ModalHeader.js.map +0 -1
- package/dist/components/SessionRecorderWidget/SessionRecorderWidget.js +0 -1
- package/dist/components/SessionRecorderWidget/SessionRecorderWidget.js.map +0 -1
- package/dist/components/SessionRecorderWidget/icons.js +0 -1
- package/dist/components/SessionRecorderWidget/icons.js.map +0 -1
- package/dist/components/SessionRecorderWidget/index.js +0 -1
- package/dist/components/SessionRecorderWidget/index.js.map +0 -1
- package/dist/components/SessionRecorderWidget/styles.js +0 -1
- package/dist/components/SessionRecorderWidget/styles.js.map +0 -1
- package/dist/components/index.js +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/config/constants.js +0 -1
- package/dist/config/constants.js.map +0 -1
- package/dist/config/defaults.js +0 -1
- package/dist/config/defaults.js.map +0 -1
- package/dist/config/index.js +0 -1
- package/dist/config/index.js.map +0 -1
- package/dist/config/masking.d.ts +0 -2
- package/dist/config/masking.js +0 -1
- package/dist/config/masking.js.map +0 -1
- package/dist/config/session-recorder.d.ts +0 -2
- package/dist/config/session-recorder.js +0 -1
- package/dist/config/session-recorder.js.map +0 -1
- package/dist/config/validators.js +0 -1
- package/dist/config/validators.js.map +0 -1
- package/dist/config/widget.js +0 -1
- package/dist/config/widget.js.map +0 -1
- package/dist/context/SessionRecorderContext.js +0 -1
- package/dist/context/SessionRecorderContext.js.map +0 -1
- package/dist/context/SessionRecorderStore.js +0 -1
- package/dist/context/SessionRecorderStore.js.map +0 -1
- package/dist/context/useSessionRecorderStore.js +0 -1
- package/dist/context/useSessionRecorderStore.js.map +0 -1
- package/dist/context/useStoreSelector.js +0 -1
- package/dist/context/useStoreSelector.js.map +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +0 -1
- package/dist/native/GestureRecorderNative.d.ts +0 -57
- package/dist/native/GestureRecorderNative.js +0 -1
- package/dist/native/GestureRecorderNative.js.map +0 -1
- package/dist/native/GestureRecorderNativeTurboSpec.d.ts +0 -31
- package/dist/native/GestureRecorderNativeTurboSpec.js +0 -1
- package/dist/native/GestureRecorderNativeTurboSpec.js.map +0 -1
- package/dist/native/SessionRecorderNative.js +0 -1
- package/dist/native/SessionRecorderNative.js.map +0 -1
- package/dist/native/SessionRecorderNativeTurboSpec.d.ts +0 -17
- package/dist/native/SessionRecorderNativeTurboSpec.js +0 -1
- package/dist/native/SessionRecorderNativeTurboSpec.js.map +0 -1
- package/dist/native/index.js +0 -1
- package/dist/native/index.js.map +0 -1
- package/dist/otel/helpers.js +0 -1
- package/dist/otel/helpers.js.map +0 -1
- package/dist/otel/index.js +0 -1
- package/dist/otel/index.js.map +0 -1
- package/dist/otel/instrumentations/index.js +0 -1
- package/dist/otel/instrumentations/index.js.map +0 -1
- package/dist/patch/index.d.ts +0 -1
- package/dist/patch/index.js +0 -1
- package/dist/patch/index.js.map +0 -1
- package/dist/patch/xhr.js +0 -1
- package/dist/patch/xhr.js.map +0 -1
- package/dist/recorder/eventExporter.js +0 -1
- package/dist/recorder/eventExporter.js.map +0 -1
- package/dist/recorder/gestureRecorder.js +0 -1
- package/dist/recorder/gestureRecorder.js.map +0 -1
- package/dist/recorder/index.js +0 -1
- package/dist/recorder/index.js.map +0 -1
- package/dist/recorder/navigationTracker.js +0 -1
- package/dist/recorder/navigationTracker.js.map +0 -1
- package/dist/recorder/screenRecorder.js +0 -1
- package/dist/recorder/screenRecorder.js.map +0 -1
- package/dist/services/api.service.js +0 -1
- package/dist/services/api.service.js.map +0 -1
- package/dist/services/network.service.js +0 -1
- package/dist/services/network.service.js.map +0 -1
- package/dist/services/screenMaskingService.js +0 -1
- package/dist/services/screenMaskingService.js.map +0 -1
- package/dist/services/storage.service.js +0 -1
- package/dist/services/storage.service.js.map +0 -1
- package/dist/session-recorder.js +0 -1
- package/dist/session-recorder.js.map +0 -1
- package/dist/types/configs.js +0 -1
- package/dist/types/configs.js.map +0 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/session-recorder.js +0 -1
- package/dist/types/session-recorder.js.map +0 -1
- package/dist/types/session.js +0 -1
- package/dist/types/session.js.map +0 -1
- package/dist/utils/app-metadata.js +0 -1
- package/dist/utils/app-metadata.js.map +0 -1
- package/dist/utils/constants.optional.expo.js +0 -1
- package/dist/utils/constants.optional.expo.js.map +0 -1
- package/dist/utils/constants.optional.js +0 -1
- package/dist/utils/constants.optional.js.map +0 -1
- package/dist/utils/createStore.js +0 -1
- package/dist/utils/createStore.js.map +0 -1
- package/dist/utils/index.js +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/logger.js +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/platform.js +0 -1
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/request-utils.js +0 -1
- package/dist/utils/request-utils.js.map +0 -1
- package/dist/utils/rrweb-events.js +0 -1
- package/dist/utils/rrweb-events.js.map +0 -1
- package/dist/utils/session.js +0 -1
- package/dist/utils/session.js.map +0 -1
- package/dist/utils/shallowEqual.js +0 -1
- package/dist/utils/shallowEqual.js.map +0 -1
- package/dist/utils/time.js +0 -1
- package/dist/utils/time.js.map +0 -1
- package/dist/utils/type-utils.js +0 -1
- package/dist/utils/type-utils.js.map +0 -1
- package/dist/version.js +0 -1
- package/dist/version.js.map +0 -1
- package/docs/AUTO_METADATA_DETECTION.md +0 -108
- package/react-native.config.js +0 -13
- /package/{dist/components/ScreenRecorderView/index.d.ts → src/components/ScreenRecorderView/index.ts} +0 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { trace, SpanStatusCode } from '@opentelemetry/api';
|
|
4
|
+
import { Dimensions, Platform } from 'react-native';
|
|
5
|
+
import { createRecordingMetaEvent, createFullSnapshotEvent, createIncrementalSnapshotWithImageUpdate as createIncrementalSnapshotUtil, generateScreenHash, logger } from "../utils/index.js";
|
|
6
|
+
import { screenMaskingService } from "../services/screenMaskingService.js";
|
|
7
|
+
import { captureRef } from 'react-native-view-shot';
|
|
8
|
+
const isWeb = Platform.OS === 'web';
|
|
9
|
+
export class ScreenRecorder {
|
|
10
|
+
isRecording = false;
|
|
11
|
+
events = [];
|
|
12
|
+
captureCount = 0;
|
|
13
|
+
maxCaptures = 100; // Limit captures to prevent memory issues
|
|
14
|
+
captureQuality = 0.2;
|
|
15
|
+
captureScale = 0.66;
|
|
16
|
+
captureFormat = 'jpg';
|
|
17
|
+
screenDimensions = null;
|
|
18
|
+
nodeIdCounter = 1;
|
|
19
|
+
viewShotRef = null;
|
|
20
|
+
lastScreenCapture = null;
|
|
21
|
+
lastScreenHash = null;
|
|
22
|
+
enableChangeDetection = true;
|
|
23
|
+
hashSampleSize = 100;
|
|
24
|
+
currentImageNodeId = null;
|
|
25
|
+
init(config, eventRecorder) {
|
|
26
|
+
this.config = config;
|
|
27
|
+
this.eventRecorder = eventRecorder;
|
|
28
|
+
this._getScreenDimensions();
|
|
29
|
+
|
|
30
|
+
// Initialize masking configuration
|
|
31
|
+
this.maskingConfig = {
|
|
32
|
+
enabled: true,
|
|
33
|
+
...this.config.masking
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// Update the masking service configuration
|
|
37
|
+
screenMaskingService.updateConfig(this.maskingConfig);
|
|
38
|
+
}
|
|
39
|
+
start() {
|
|
40
|
+
this.isRecording = true;
|
|
41
|
+
this.events = [];
|
|
42
|
+
this.captureCount = 0;
|
|
43
|
+
this.lastScreenCapture = null;
|
|
44
|
+
this.lastScreenHash = null;
|
|
45
|
+
this.currentImageNodeId = null; // Reset image node ID for new session
|
|
46
|
+
logger.info('ScreenRecorder', 'Screen recording started');
|
|
47
|
+
// Emit screen recording started meta event
|
|
48
|
+
|
|
49
|
+
this.recordEvent(createRecordingMetaEvent());
|
|
50
|
+
this._startPeriodicCapture();
|
|
51
|
+
|
|
52
|
+
// Capture initial screen immediately
|
|
53
|
+
this._captureScreen();
|
|
54
|
+
|
|
55
|
+
// Screen recording started
|
|
56
|
+
}
|
|
57
|
+
stop() {
|
|
58
|
+
this.isRecording = false;
|
|
59
|
+
this._stopPeriodicCapture();
|
|
60
|
+
// Screen recording stopped
|
|
61
|
+
}
|
|
62
|
+
pause() {
|
|
63
|
+
this.isRecording = false;
|
|
64
|
+
this._stopPeriodicCapture();
|
|
65
|
+
}
|
|
66
|
+
resume() {
|
|
67
|
+
this.isRecording = true;
|
|
68
|
+
// this._startPeriodicCapture()
|
|
69
|
+
}
|
|
70
|
+
_getScreenDimensions() {
|
|
71
|
+
try {
|
|
72
|
+
this.screenDimensions = Dimensions.get('window');
|
|
73
|
+
} catch (error) {
|
|
74
|
+
// Failed to get screen dimensions - silently continue
|
|
75
|
+
this.screenDimensions = {
|
|
76
|
+
width: 375,
|
|
77
|
+
height: 667
|
|
78
|
+
}; // Default fallback
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
_startPeriodicCapture() {
|
|
82
|
+
if (this.captureInterval) {
|
|
83
|
+
clearInterval(this.captureInterval);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Capture screen every 5 seconds (reduced frequency)
|
|
87
|
+
this.captureInterval = setInterval(() => {
|
|
88
|
+
this._captureScreen();
|
|
89
|
+
}, 5000);
|
|
90
|
+
}
|
|
91
|
+
_stopPeriodicCapture() {
|
|
92
|
+
if (this.captureInterval) {
|
|
93
|
+
clearInterval(this.captureInterval);
|
|
94
|
+
this.captureInterval = undefined;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async _captureScreen(timestamp) {
|
|
98
|
+
if (!this.isRecording || this.captureCount >= this.maxCaptures) return;
|
|
99
|
+
try {
|
|
100
|
+
const base64Image = await this._captureScreenBase64();
|
|
101
|
+
if (base64Image) {
|
|
102
|
+
// Check if screen has changed by comparing with previous capture
|
|
103
|
+
const hasChanged = this.enableChangeDetection ? this._hasScreenChanged(base64Image) : true;
|
|
104
|
+
if (hasChanged) {
|
|
105
|
+
// Use incremental snapshot if we have an existing image node, otherwise create full snapshot
|
|
106
|
+
if (this.currentImageNodeId !== null && this.lastScreenCapture) {
|
|
107
|
+
const success = this.updateScreenWithIncrementalSnapshot(base64Image, timestamp);
|
|
108
|
+
if (!success) {
|
|
109
|
+
// Fallback to full snapshot if incremental update fails
|
|
110
|
+
this._createAndEmitFullSnapshotEvent(base64Image, timestamp);
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
// First capture or no existing image node - create full snapshot
|
|
114
|
+
this._createAndEmitFullSnapshotEvent(base64Image, timestamp);
|
|
115
|
+
}
|
|
116
|
+
this.lastScreenCapture = base64Image;
|
|
117
|
+
this.lastScreenHash = this._generateScreenHash(base64Image);
|
|
118
|
+
this.captureCount++;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} catch (error) {
|
|
122
|
+
this._recordScreenCaptureError(error);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
async _captureScreenBase64() {
|
|
126
|
+
try {
|
|
127
|
+
// Check if we're on web platform
|
|
128
|
+
if (isWeb) {
|
|
129
|
+
logger.warn('ScreenRecorder', 'Screen capture not available on web platform');
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Try native masking first if available
|
|
134
|
+
if (screenMaskingService.isScreenMaskingAvailable()) {
|
|
135
|
+
logger.info('ScreenRecorder', 'Using native masking for screen capture');
|
|
136
|
+
const maskedImage = await screenMaskingService.captureMaskedScreen({
|
|
137
|
+
quality: this.captureQuality,
|
|
138
|
+
scale: this.captureScale
|
|
139
|
+
});
|
|
140
|
+
if (maskedImage) {
|
|
141
|
+
return maskedImage;
|
|
142
|
+
}
|
|
143
|
+
logger.warn('ScreenRecorder', 'Native masking failed, falling back to view-shot');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Fallback to react-native-view-shot
|
|
147
|
+
if (!this.viewShotRef) {
|
|
148
|
+
logger.warn('ScreenRecorder', 'ViewShot ref not available for screen capture');
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Check if captureRef is available
|
|
153
|
+
if (!captureRef) {
|
|
154
|
+
logger.warn('ScreenRecorder', 'react-native-view-shot not available');
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Capture the screen using react-native-view-shot
|
|
159
|
+
const result = await captureRef(this.viewShotRef, {
|
|
160
|
+
format: this.captureFormat,
|
|
161
|
+
quality: this.captureQuality,
|
|
162
|
+
result: 'base64'
|
|
163
|
+
});
|
|
164
|
+
return result;
|
|
165
|
+
} catch (error) {
|
|
166
|
+
logger.error('ScreenRecorder', 'Failed to capture screen. Make sure react-native-view-shot is properly installed and linked:', error);
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
_createAndEmitFullSnapshotEvent(base64Image, timestamp) {
|
|
171
|
+
if (!this.screenDimensions) return;
|
|
172
|
+
|
|
173
|
+
// Use the new createFullSnapshot method
|
|
174
|
+
const fullSnapshotEvent = this.createFullSnapshot(base64Image, timestamp);
|
|
175
|
+
this.recordEvent(fullSnapshotEvent);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Create a full snapshot event with the given base64 image
|
|
180
|
+
* @param base64Image - Base64 encoded image data
|
|
181
|
+
* @param timestamp - Optional timestamp to use for the event
|
|
182
|
+
* @returns Full snapshot event
|
|
183
|
+
*/
|
|
184
|
+
createFullSnapshot(base64Image, timestamp) {
|
|
185
|
+
if (!this.screenDimensions) {
|
|
186
|
+
throw new Error('Screen dimensions not available');
|
|
187
|
+
}
|
|
188
|
+
const {
|
|
189
|
+
width,
|
|
190
|
+
height
|
|
191
|
+
} = this.screenDimensions;
|
|
192
|
+
this.nodeIdCounter = 1;
|
|
193
|
+
|
|
194
|
+
// Use utility function to create full snapshot event
|
|
195
|
+
const fullSnapshotEvent = createFullSnapshotEvent(base64Image, width, height, this.captureFormat, {
|
|
196
|
+
current: this.nodeIdCounter
|
|
197
|
+
}, timestamp);
|
|
198
|
+
|
|
199
|
+
// Store the image node ID for future incremental updates
|
|
200
|
+
// The image node ID is the first node created (after the document)
|
|
201
|
+
this.currentImageNodeId = 0; // First element node is the image
|
|
202
|
+
|
|
203
|
+
return fullSnapshotEvent;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Create an incremental snapshot event with mutation data to update image src
|
|
208
|
+
* @param base64Image - New base64 encoded image data
|
|
209
|
+
* @param captureFormat - Image format (png, jpg, etc.)
|
|
210
|
+
* @param timestamp - Optional timestamp to use for the event
|
|
211
|
+
* @returns Incremental snapshot event with mutation data
|
|
212
|
+
*/
|
|
213
|
+
createIncrementalSnapshotWithImageUpdate(base64Image, captureFormat, timestamp) {
|
|
214
|
+
return createIncrementalSnapshotUtil(base64Image, captureFormat || this.captureFormat, timestamp);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Update the screen with a new image using incremental snapshot
|
|
219
|
+
* @param base64Image - New base64 encoded image data
|
|
220
|
+
* @param timestamp - Optional timestamp to use for the event
|
|
221
|
+
* @returns true if update was successful, false otherwise
|
|
222
|
+
*/
|
|
223
|
+
updateScreenWithIncrementalSnapshot(base64Image, timestamp) {
|
|
224
|
+
if (this.currentImageNodeId === null) {
|
|
225
|
+
logger.warn('ScreenRecorder', 'No image node ID available for incremental update');
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
const incrementalEvent = this.createIncrementalSnapshotWithImageUpdate(base64Image, 'jpg', timestamp);
|
|
229
|
+
this.recordEvent(incrementalEvent);
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Force a full snapshot (useful when screen dimensions change or for debugging)
|
|
235
|
+
* @param base64Image - Base64 encoded image data
|
|
236
|
+
*/
|
|
237
|
+
forceFullSnapshot(base64Image) {
|
|
238
|
+
this._createAndEmitFullSnapshotEvent(base64Image);
|
|
239
|
+
this.lastScreenCapture = base64Image;
|
|
240
|
+
this.lastScreenHash = this._generateScreenHash(base64Image);
|
|
241
|
+
this.captureCount++;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Check if the screen has changed by comparing with the previous capture
|
|
246
|
+
* @param currentBase64 - Current screen capture as base64
|
|
247
|
+
* @returns true if screen has changed, false otherwise
|
|
248
|
+
*/
|
|
249
|
+
_hasScreenChanged(currentBase64) {
|
|
250
|
+
// If this is the first capture, consider it changed
|
|
251
|
+
if (!this.lastScreenCapture) {
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Generate hash for current capture
|
|
256
|
+
const currentHash = this._generateScreenHash(currentBase64);
|
|
257
|
+
|
|
258
|
+
// Compare with previous hash
|
|
259
|
+
return currentHash !== this.lastScreenHash;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Generate a simple hash for screen comparison
|
|
264
|
+
* This is a lightweight hash that focuses on the beginning and end of the base64 string
|
|
265
|
+
* to detect changes without doing a full comparison
|
|
266
|
+
* @param base64Image - Base64 encoded image
|
|
267
|
+
* @returns Hash string for comparison
|
|
268
|
+
*/
|
|
269
|
+
_generateScreenHash(base64Image) {
|
|
270
|
+
return generateScreenHash(base64Image, this.hashSampleSize);
|
|
271
|
+
}
|
|
272
|
+
_sendEvent(_event) {
|
|
273
|
+
// Screen event recorded
|
|
274
|
+
// Send event to backend or store locally
|
|
275
|
+
}
|
|
276
|
+
_recordOpenTelemetrySpan(event) {
|
|
277
|
+
try {
|
|
278
|
+
const span = trace.getTracer('screen').startSpan(`Screen.${event.type}`, {
|
|
279
|
+
attributes: {
|
|
280
|
+
'screen.type': event.type,
|
|
281
|
+
'screen.timestamp': event.timestamp,
|
|
282
|
+
'screen.platform': 'react-native'
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
if (event.metadata) {
|
|
286
|
+
Object.entries(event.metadata).forEach(([key, value]) => {
|
|
287
|
+
span.setAttribute(`screen.metadata.${key}`, String(value));
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
span.setStatus({
|
|
291
|
+
code: SpanStatusCode.OK
|
|
292
|
+
});
|
|
293
|
+
span.end();
|
|
294
|
+
} catch (error) {
|
|
295
|
+
// Failed to record OpenTelemetry span for screen - silently continue
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
_recordScreenCaptureError(error) {
|
|
299
|
+
try {
|
|
300
|
+
const span = trace.getTracer('screen').startSpan('Screen.capture.error', {
|
|
301
|
+
attributes: {
|
|
302
|
+
'screen.error': true,
|
|
303
|
+
'screen.error.type': error.name,
|
|
304
|
+
'screen.error.message': error.message,
|
|
305
|
+
'screen.timestamp': Date.now()
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
span.setStatus({
|
|
309
|
+
code: SpanStatusCode.ERROR,
|
|
310
|
+
message: error.message
|
|
311
|
+
});
|
|
312
|
+
span.recordException(error);
|
|
313
|
+
span.end();
|
|
314
|
+
} catch (spanError) {
|
|
315
|
+
// Failed to record error span - silently continue
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
async captureSpecificElement(elementRef, _options) {
|
|
319
|
+
try {
|
|
320
|
+
if (isWeb || !captureRef) {
|
|
321
|
+
logger.warn('ScreenRecorder', 'Element capture not available on web platform');
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
return await captureRef(elementRef);
|
|
325
|
+
} catch (error) {
|
|
326
|
+
// Failed to capture specific element - silently continue
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Configuration methods
|
|
332
|
+
setCaptureInterval(intervalMs) {
|
|
333
|
+
if (this.captureInterval) {
|
|
334
|
+
clearInterval(this.captureInterval);
|
|
335
|
+
}
|
|
336
|
+
if (this.isRecording) {
|
|
337
|
+
this.captureInterval = setInterval(() => {
|
|
338
|
+
this._captureScreen();
|
|
339
|
+
}, intervalMs);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
setCaptureQuality(quality) {
|
|
343
|
+
this.captureQuality = Math.max(0.1, Math.min(1.0, quality));
|
|
344
|
+
}
|
|
345
|
+
setCaptureFormat(format) {
|
|
346
|
+
this.captureFormat = format;
|
|
347
|
+
}
|
|
348
|
+
setMaxCaptures(max) {
|
|
349
|
+
this.maxCaptures = Math.max(1, max);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Enable or disable change detection
|
|
354
|
+
* @param enabled - Whether to enable change detection
|
|
355
|
+
*/
|
|
356
|
+
setChangeDetection(enabled) {
|
|
357
|
+
this.enableChangeDetection = enabled;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Set the hash sample size for change detection
|
|
362
|
+
* @param size - Number of characters to sample from each part of the image
|
|
363
|
+
*/
|
|
364
|
+
setHashSampleSize(size) {
|
|
365
|
+
this.hashSampleSize = Math.max(10, Math.min(1000, size));
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// Performance monitoring
|
|
369
|
+
recordScreenPerformance(screenName, loadTime) {
|
|
370
|
+
const event = {
|
|
371
|
+
screenName,
|
|
372
|
+
type: 'screenCapture',
|
|
373
|
+
timestamp: Date.now(),
|
|
374
|
+
metadata: {
|
|
375
|
+
screenName,
|
|
376
|
+
loadTime,
|
|
377
|
+
performance: 'monitoring',
|
|
378
|
+
captureCount: this.captureCount
|
|
379
|
+
}
|
|
380
|
+
};
|
|
381
|
+
this.events.push(event);
|
|
382
|
+
this._sendEvent(event);
|
|
383
|
+
this._recordOpenTelemetrySpan(event);
|
|
384
|
+
this.events.push(event);
|
|
385
|
+
this._sendEvent(event);
|
|
386
|
+
this._recordOpenTelemetrySpan(event);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// Error tracking
|
|
390
|
+
recordScreenError(error, screenName) {
|
|
391
|
+
const event = {
|
|
392
|
+
screenName: screenName || 'unknown',
|
|
393
|
+
type: 'screenCapture',
|
|
394
|
+
timestamp: Date.now(),
|
|
395
|
+
metadata: {
|
|
396
|
+
error: true,
|
|
397
|
+
errorType: error.name,
|
|
398
|
+
errorMessage: error.message,
|
|
399
|
+
screenName,
|
|
400
|
+
captureCount: this.captureCount
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
this.events.push(event);
|
|
404
|
+
this._sendEvent(event);
|
|
405
|
+
this._recordOpenTelemetrySpan(event);
|
|
406
|
+
this.events.push(event);
|
|
407
|
+
this._sendEvent(event);
|
|
408
|
+
this._recordScreenCaptureError(error);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// Get recorded events
|
|
412
|
+
getEvents() {
|
|
413
|
+
return [...this.events];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Clear events
|
|
417
|
+
clearEvents() {
|
|
418
|
+
this.events = [];
|
|
419
|
+
this.captureCount = 0;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Get screen capture statistics
|
|
423
|
+
getScreenStats() {
|
|
424
|
+
const stats = {
|
|
425
|
+
totalCaptures: this.captureCount,
|
|
426
|
+
totalEvents: this.events.length,
|
|
427
|
+
averageCaptureTime: 0,
|
|
428
|
+
successRate: 0
|
|
429
|
+
};
|
|
430
|
+
if (this.events.length > 0) {
|
|
431
|
+
const captureTimes = this.events.map(event => event.metadata?.captureTime || 0).filter(time => time > 0);
|
|
432
|
+
if (captureTimes.length > 0) {
|
|
433
|
+
stats.averageCaptureTime = captureTimes.reduce((a, b) => a + b, 0) / captureTimes.length;
|
|
434
|
+
}
|
|
435
|
+
const successfulCaptures = this.events.filter(event => event.dataUrl).length;
|
|
436
|
+
stats.successRate = successfulCaptures / this.events.length * 100;
|
|
437
|
+
}
|
|
438
|
+
return stats;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// Get recording status
|
|
442
|
+
isRecordingEnabled() {
|
|
443
|
+
return this.isRecording;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Get current configuration
|
|
447
|
+
getConfiguration() {
|
|
448
|
+
return {
|
|
449
|
+
captureInterval: this.captureInterval ? 2000 : 0,
|
|
450
|
+
// Default 5 seconds
|
|
451
|
+
captureQuality: this.captureQuality,
|
|
452
|
+
captureFormat: this.captureFormat,
|
|
453
|
+
maxCaptures: this.maxCaptures,
|
|
454
|
+
screenDimensions: this.screenDimensions
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Shutdown
|
|
459
|
+
shutdown() {
|
|
460
|
+
this.stop();
|
|
461
|
+
this.clearEvents();
|
|
462
|
+
// Screen recorder shutdown
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Set the viewshot ref for screen capture
|
|
467
|
+
* @param ref - React Native View ref for screen capture
|
|
468
|
+
*/
|
|
469
|
+
setViewShotRef(ref) {
|
|
470
|
+
this.viewShotRef = ref;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Force capture screen (useful after touch interactions)
|
|
475
|
+
* This bypasses the change detection and always captures
|
|
476
|
+
* @param timestamp - Optional timestamp to use for the capture event
|
|
477
|
+
*/
|
|
478
|
+
forceCapture(timestamp) {
|
|
479
|
+
if (!this.isRecording) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
this._captureScreen(timestamp);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Record an rrweb event
|
|
487
|
+
* @param event - The rrweb event to record
|
|
488
|
+
*/
|
|
489
|
+
recordEvent(event) {
|
|
490
|
+
if (this.eventRecorder) {
|
|
491
|
+
this.eventRecorder.recordEvent(event);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
//# sourceMappingURL=screenRecorder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["trace","SpanStatusCode","Dimensions","Platform","createRecordingMetaEvent","createFullSnapshotEvent","createIncrementalSnapshotWithImageUpdate","createIncrementalSnapshotUtil","generateScreenHash","logger","screenMaskingService","captureRef","isWeb","OS","ScreenRecorder","isRecording","events","captureCount","maxCaptures","captureQuality","captureScale","captureFormat","screenDimensions","nodeIdCounter","viewShotRef","lastScreenCapture","lastScreenHash","enableChangeDetection","hashSampleSize","currentImageNodeId","init","config","eventRecorder","_getScreenDimensions","maskingConfig","enabled","masking","updateConfig","start","info","recordEvent","_startPeriodicCapture","_captureScreen","stop","_stopPeriodicCapture","pause","resume","get","error","width","height","captureInterval","clearInterval","setInterval","undefined","timestamp","base64Image","_captureScreenBase64","hasChanged","_hasScreenChanged","success","updateScreenWithIncrementalSnapshot","_createAndEmitFullSnapshotEvent","_generateScreenHash","_recordScreenCaptureError","warn","isScreenMaskingAvailable","maskedImage","captureMaskedScreen","quality","scale","result","format","fullSnapshotEvent","createFullSnapshot","Error","current","incrementalEvent","forceFullSnapshot","currentBase64","currentHash","_sendEvent","_event","_recordOpenTelemetrySpan","event","span","getTracer","startSpan","type","attributes","metadata","Object","entries","forEach","key","value","setAttribute","String","setStatus","code","OK","end","name","message","Date","now","ERROR","recordException","spanError","captureSpecificElement","elementRef","_options","setCaptureInterval","intervalMs","setCaptureQuality","Math","max","min","setCaptureFormat","setMaxCaptures","setChangeDetection","setHashSampleSize","size","recordScreenPerformance","screenName","loadTime","performance","push","recordScreenError","errorType","errorMessage","getEvents","clearEvents","getScreenStats","stats","totalCaptures","totalEvents","length","averageCaptureTime","successRate","captureTimes","map","captureTime","filter","time","reduce","a","b","successfulCaptures","dataUrl","isRecordingEnabled","getConfiguration","shutdown","setViewShotRef","ref","forceCapture"],"sourceRoot":"../../../src","sources":["recorder/screenRecorder.ts"],"mappings":";;AAEA,SAASA,KAAK,EAAEC,cAAc,QAAQ,oBAAoB;AAC1D,SAASC,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AACnD,SACEC,wBAAwB,EACxBC,uBAAuB,EACvBC,wCAAwC,IAAIC,6BAA6B,EACzEC,kBAAkB,EAClBC,MAAM,QACD,mBAAU;AACjB,SAASC,oBAAoB,QAAkC,qCAAkC;AACjG,SAASC,UAAU,QAAQ,wBAAwB;AACnD,MAAMC,KAAK,GAAGT,QAAQ,CAACU,EAAE,KAAK,KAAK;AAGnC,OAAO,MAAMC,cAAc,CAA0B;EAE3CC,WAAW,GAAG,KAAK;EACnBC,MAAM,GAAkB,EAAE;EAE1BC,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CAACpD,aAAa,EAAE;MACtB,IAAI,CAACA,aAAa,CAACQ,WAAW,CAAC4C,KAAK,CAAC;IACvC;EACF;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export class ApiService {
|
|
4
|
+
baseUrl = 'https://api.multiplayer.app';
|
|
5
|
+
constructor() {
|
|
6
|
+
this.config = {
|
|
7
|
+
apiKey: '',
|
|
8
|
+
apiBaseUrl: '',
|
|
9
|
+
exporterEndpoint: ''
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
init(config) {
|
|
13
|
+
this.config = {
|
|
14
|
+
...this.config,
|
|
15
|
+
...config
|
|
16
|
+
};
|
|
17
|
+
if (config.apiBaseUrl) {
|
|
18
|
+
this.baseUrl = config.apiBaseUrl;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Update the API service configuration
|
|
24
|
+
* @param config - Partial configuration to update
|
|
25
|
+
*/
|
|
26
|
+
updateConfigs(config) {
|
|
27
|
+
if (this.config) {
|
|
28
|
+
this.config = {
|
|
29
|
+
...this.config,
|
|
30
|
+
...config
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Set the API key
|
|
37
|
+
* @param apiKey - The API key to set
|
|
38
|
+
*/
|
|
39
|
+
setApiKey(apiKey) {
|
|
40
|
+
if (this.config) {
|
|
41
|
+
this.config.apiKey = apiKey;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Make a request to the session debugger API
|
|
47
|
+
* @param path - API endpoint path (relative to the base URL)
|
|
48
|
+
* @param method - HTTP method (GET, POST, PATCH, etc.)
|
|
49
|
+
* @param body - request payload
|
|
50
|
+
* @param signal - AbortSignal to set request's signal
|
|
51
|
+
*/
|
|
52
|
+
async makeRequest(path, method, body, signal) {
|
|
53
|
+
const url = `${this.baseUrl}/v0/radar${path}`;
|
|
54
|
+
const params = {
|
|
55
|
+
method,
|
|
56
|
+
body: body ? JSON.stringify(body) : null,
|
|
57
|
+
headers: {
|
|
58
|
+
'Content-Type': 'application/json',
|
|
59
|
+
...(this.config?.apiKey && {
|
|
60
|
+
'X-Api-Key': this.config.apiKey
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
try {
|
|
65
|
+
const response = await fetch(url, {
|
|
66
|
+
...params,
|
|
67
|
+
signal
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
throw new Error('Network response was not ok: ' + response.statusText);
|
|
71
|
+
}
|
|
72
|
+
if (response.status === 204) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return await response.json();
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (error?.name === 'AbortError') {
|
|
78
|
+
throw new Error('Request aborted');
|
|
79
|
+
}
|
|
80
|
+
throw new Error('Error making request: ' + error.message);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Start a new debug session
|
|
86
|
+
* @param request - Session start request data
|
|
87
|
+
* @param signal - Optional AbortSignal for request cancellation
|
|
88
|
+
*/
|
|
89
|
+
async startSession(request, signal) {
|
|
90
|
+
try {
|
|
91
|
+
const res = await this.makeRequest('/debug-sessions/start', 'POST', request, signal);
|
|
92
|
+
return res;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Stop an active debug session
|
|
100
|
+
* @param sessionId - ID of the session to stop
|
|
101
|
+
* @param request - Session stop request data
|
|
102
|
+
*/
|
|
103
|
+
async stopSession(sessionId, request) {
|
|
104
|
+
return this.makeRequest(`/debug-sessions/${sessionId}/stop`, 'PATCH', request);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Cancel an active debug session
|
|
109
|
+
* @param sessionId - ID of the session to cancel
|
|
110
|
+
*/
|
|
111
|
+
async cancelSession(sessionId) {
|
|
112
|
+
return this.makeRequest(`/debug-sessions/${sessionId}/cancel`, 'DELETE');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Start a new continuous debug session
|
|
117
|
+
* @param request - Session start request data
|
|
118
|
+
* @param signal - Optional AbortSignal for request cancellation
|
|
119
|
+
*/
|
|
120
|
+
async startContinuousDebugSession(request, signal) {
|
|
121
|
+
return this.makeRequest('/continuous-debug-sessions/start', 'POST', request, signal);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Save a continuous debug session
|
|
126
|
+
* @param sessionId - ID of the session to save
|
|
127
|
+
* @param request - Session save request data
|
|
128
|
+
* @param signal - Optional AbortSignal for request cancellation
|
|
129
|
+
*/
|
|
130
|
+
async saveContinuousDebugSession(sessionId, request, signal) {
|
|
131
|
+
return this.makeRequest(`/continuous-debug-sessions/${sessionId}/save`, 'POST', request, signal);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Stop an active continuous debug session
|
|
136
|
+
* @param sessionId - ID of the session to stop
|
|
137
|
+
*/
|
|
138
|
+
async stopContinuousDebugSession(sessionId) {
|
|
139
|
+
return this.makeRequest(`/continuous-debug-sessions/${sessionId}/cancel`, 'DELETE');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Check debug session should be started remotely
|
|
144
|
+
*/
|
|
145
|
+
async checkRemoteSession(requestBody, signal) {
|
|
146
|
+
return this.makeRequest('/remote-debug-session/check', 'POST', requestBody, signal);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=api.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ApiService","baseUrl","constructor","config","apiKey","apiBaseUrl","exporterEndpoint","init","updateConfigs","setApiKey","makeRequest","path","method","body","signal","url","params","JSON","stringify","headers","response","fetch","ok","Error","statusText","status","json","error","name","message","startSession","request","res","stopSession","sessionId","cancelSession","startContinuousDebugSession","saveContinuousDebugSession","stopContinuousDebugSession","checkRemoteSession","requestBody"],"sourceRoot":"../../../src","sources":["services/api.service.ts"],"mappings":";;AAgBA,OAAO,MAAMA,UAAU,CAAC;EAEdC,OAAO,GAAW,6BAA6B;EAEvDC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAACC,MAAM,GAAG;MACZC,MAAM,EAAE,EAAE;MACVC,UAAU,EAAE,EAAE;MACdC,gBAAgB,EAAE;IACpB,CAAC;EACH;EAEAC,IAAIA,CAACJ,MAAwB,EAAQ;IACnC,IAAI,CAACA,MAAM,GAAG;MACZ,GAAG,IAAI,CAACA,MAAM;MACd,GAAGA;IACL,CAAC;IACD,IAAIA,MAAM,CAACE,UAAU,EAAE;MACrB,IAAI,CAACJ,OAAO,GAAGE,MAAM,CAACE,UAAU;IAClC;EACF;;EAEA;AACF;AACA;AACA;EACSG,aAAaA,CAACL,MAAiC,EAAE;IACtD,IAAI,IAAI,CAACA,MAAM,EAAE;MACf,IAAI,CAACA,MAAM,GAAG;QAAE,GAAG,IAAI,CAACA,MAAM;QAAE,GAAGA;MAAO,CAAC;IAC7C;EACF;;EAEA;AACF;AACA;AACA;EACEM,SAASA,CAACL,MAAc,EAAQ;IAC9B,IAAI,IAAI,CAACD,MAAM,EAAE;MACf,IAAI,CAACA,MAAM,CAACC,MAAM,GAAGA,MAAM;IAC7B;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACE,MAAcM,WAAWA,CACvBC,IAAY,EACZC,MAAc,EACdC,IAAU,EACVC,MAAoB,EACN;IACd,MAAMC,GAAG,GAAG,GAAG,IAAI,CAACd,OAAO,YAAYU,IAAI,EAAE;IAC7C,MAAMK,MAAM,GAAG;MACbJ,MAAM;MACNC,IAAI,EAAEA,IAAI,GAAGI,IAAI,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