@multiplayer-app/session-recorder-react-native 1.0.1-beta.2 → 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 -41
- 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/GestureTargetFinder.swift +50 -0
- package/ios/SessionRecorderNative.podspec +4 -2
- package/ios/SessionRecorderNative.swift +10 -1
- package/ios/SessionRecorderNativeSpec.swift +55 -0
- 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/lib/typescript/src/version.d.ts +2 -0
- package/lib/typescript/src/version.d.ts.map +1 -0
- package/package.json +140 -39
- 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/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.d.ts +0 -1
- package/dist/version.js +0 -1
- package/dist/version.js.map +0 -1
- package/docs/AUTO_METADATA_DETECTION.md +0 -108
- /package/{dist/components/ScreenRecorderView/index.d.ts → src/components/ScreenRecorderView/index.ts} +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
4
|
+
import { W3CTraceContextPropagator } from '@opentelemetry/core';
|
|
5
|
+
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
6
|
+
import * as SemanticAttributes from '@opentelemetry/semantic-conventions';
|
|
7
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
8
|
+
import { SessionType, ATTR_MULTIPLAYER_SESSION_ID, SessionRecorderIdGenerator, SessionRecorderTraceIdRatioBasedSampler, SessionRecorderBrowserTraceExporter } from '@multiplayer-app/session-recorder-common';
|
|
9
|
+
import { getInstrumentations } from "./instrumentations/index.js";
|
|
10
|
+
import { getExporterEndpoint } from "./helpers.js";
|
|
11
|
+
import { getPlatformAttributes } from "../utils/platform.js";
|
|
12
|
+
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
|
|
13
|
+
export class TracerReactNativeSDK {
|
|
14
|
+
sessionId = '';
|
|
15
|
+
constructor() {}
|
|
16
|
+
_setSessionId(sessionId, sessionType = SessionType.PLAIN) {
|
|
17
|
+
this.sessionId = sessionId;
|
|
18
|
+
this.idGenerator?.setSessionId(sessionId, sessionType);
|
|
19
|
+
}
|
|
20
|
+
init(options) {
|
|
21
|
+
this.config = options;
|
|
22
|
+
const {
|
|
23
|
+
application,
|
|
24
|
+
version,
|
|
25
|
+
environment
|
|
26
|
+
} = this.config;
|
|
27
|
+
this.idGenerator = new SessionRecorderIdGenerator();
|
|
28
|
+
this.exporter = new SessionRecorderBrowserTraceExporter({
|
|
29
|
+
apiKey: options.apiKey,
|
|
30
|
+
url: getExporterEndpoint(options.exporterEndpoint)
|
|
31
|
+
});
|
|
32
|
+
this.tracerProvider = new WebTracerProvider({
|
|
33
|
+
resource: resourceFromAttributes({
|
|
34
|
+
[SemanticAttributes.SEMRESATTRS_SERVICE_NAME]: application,
|
|
35
|
+
[SemanticAttributes.SEMRESATTRS_SERVICE_VERSION]: version,
|
|
36
|
+
[SemanticAttributes.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT]: environment,
|
|
37
|
+
...getPlatformAttributes()
|
|
38
|
+
}),
|
|
39
|
+
idGenerator: this.idGenerator,
|
|
40
|
+
sampler: new SessionRecorderTraceIdRatioBasedSampler(this.config.sampleTraceRatio || 0.15),
|
|
41
|
+
spanProcessors: [this._getSpanSessionIdProcessor(), new BatchSpanProcessor(this.exporter)]
|
|
42
|
+
});
|
|
43
|
+
this.tracerProvider.register({
|
|
44
|
+
propagator: new W3CTraceContextPropagator()
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Register instrumentations
|
|
48
|
+
registerInstrumentations({
|
|
49
|
+
tracerProvider: this.tracerProvider,
|
|
50
|
+
instrumentations: getInstrumentations(this.config)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
_getSpanSessionIdProcessor() {
|
|
54
|
+
return {
|
|
55
|
+
onStart: span => {
|
|
56
|
+
if (this.sessionId) {
|
|
57
|
+
span.setAttribute(ATTR_MULTIPLAYER_SESSION_ID, this.sessionId);
|
|
58
|
+
}
|
|
59
|
+
// Add React Native specific attributes
|
|
60
|
+
span.setAttribute('platform', 'react-native');
|
|
61
|
+
span.setAttribute('timestamp', Date.now());
|
|
62
|
+
},
|
|
63
|
+
onEnd: () => {},
|
|
64
|
+
shutdown: () => Promise.resolve(),
|
|
65
|
+
forceFlush: () => Promise.resolve()
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
start(sessionId, sessionType) {
|
|
69
|
+
if (!this.tracerProvider) {
|
|
70
|
+
throw new Error('Configuration not initialized. Call init() before start().');
|
|
71
|
+
}
|
|
72
|
+
this._setSessionId(sessionId, sessionType);
|
|
73
|
+
}
|
|
74
|
+
stop() {
|
|
75
|
+
if (!this.tracerProvider) {
|
|
76
|
+
throw new Error('Configuration not initialized. Call init() before start().');
|
|
77
|
+
}
|
|
78
|
+
this._setSessionId('');
|
|
79
|
+
}
|
|
80
|
+
setApiKey(apiKey) {
|
|
81
|
+
if (!this.exporter) {
|
|
82
|
+
throw new Error('Configuration not initialized. Call init() before setApiKey().');
|
|
83
|
+
}
|
|
84
|
+
this.exporter.setApiKey?.(apiKey);
|
|
85
|
+
}
|
|
86
|
+
setSessionId(sessionId, sessionType) {
|
|
87
|
+
this._setSessionId(sessionId, sessionType);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Shutdown (React Native specific)
|
|
91
|
+
shutdown() {
|
|
92
|
+
return Promise.resolve();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["resourceFromAttributes","W3CTraceContextPropagator","BatchSpanProcessor","SemanticAttributes","registerInstrumentations","SessionType","ATTR_MULTIPLAYER_SESSION_ID","SessionRecorderIdGenerator","SessionRecorderTraceIdRatioBasedSampler","SessionRecorderBrowserTraceExporter","getInstrumentations","getExporterEndpoint","getPlatformAttributes","WebTracerProvider","TracerReactNativeSDK","sessionId","constructor","_setSessionId","sessionType","PLAIN","idGenerator","setSessionId","init","options","config","application","version","environment","exporter","apiKey","url","exporterEndpoint","tracerProvider","resource","SEMRESATTRS_SERVICE_NAME","SEMRESATTRS_SERVICE_VERSION","SEMRESATTRS_DEPLOYMENT_ENVIRONMENT","sampler","sampleTraceRatio","spanProcessors","_getSpanSessionIdProcessor","register","propagator","instrumentations","onStart","span","setAttribute","Date","now","onEnd","shutdown","Promise","resolve","forceFlush","start","Error","stop","setApiKey"],"sourceRoot":"../../../src","sources":["otel/index.ts"],"mappings":";;AAAA,SAASA,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,OAAO,KAAKC,kBAAkB,MAAM,qCAAqC;AACzE,SAASC,wBAAwB,QAAQ,gCAAgC;AACzE,SACEC,WAAW,EACXC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,uCAAuC,EACvCC,mCAAmC,QAC9B,0CAA0C;AAEjD,SAASC,mBAAmB,QAAQ,6BAAoB;AACxD,SAASC,mBAAmB,QAAQ,cAAW;AAE/C,SAASC,qBAAqB,QAAQ,sBAAmB;AACzD,SAASC,iBAAiB,QAAQ,8BAA8B;AAKhE,OAAO,MAAMC,oBAAoB,CAAC;EAIxBC,SAAS,GAAG,EAAE;EAKtBC,WAAWA,CAAA,EAAG,CAAE;EAERC,aAAaA,CACnBF,SAAiB,EACjBG,WAAwB,GAAGb,WAAW,CAACc,KAAK,EAC5C;IACA,IAAI,CAACJ,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACK,WAAW,EAAEC,YAAY,CAACN,SAAS,EAAEG,WAAW,CAAC;EACxD;EAEAI,IAAIA,CAACC,OAAgC,EAAQ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F","ignoreList":[]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { FetchInstrumentation } from '@opentelemetry/instrumentation-fetch';
|
|
4
|
+
import { XMLHttpRequestInstrumentation } from '@opentelemetry/instrumentation-xml-http-request';
|
|
5
|
+
import { logger } from "../../utils/index.js";
|
|
6
|
+
import { OTEL_IGNORE_URLS } from "../../config/index.js";
|
|
7
|
+
import { extractResponseBody, headersToObject, processHttpPayload } from "../helpers.js";
|
|
8
|
+
export function getInstrumentations(config) {
|
|
9
|
+
const instrumentations = [];
|
|
10
|
+
|
|
11
|
+
// Fetch instrumentation
|
|
12
|
+
try {
|
|
13
|
+
instrumentations.push(new FetchInstrumentation({
|
|
14
|
+
clearTimingResources: false,
|
|
15
|
+
ignoreUrls: [...OTEL_IGNORE_URLS, ...(config.ignoreUrls || [])],
|
|
16
|
+
propagateTraceHeaderCorsUrls: config.propagateTraceHeaderCorsUrls,
|
|
17
|
+
applyCustomAttributesOnSpan: async (span, request, response) => {
|
|
18
|
+
if (!config) return;
|
|
19
|
+
const {
|
|
20
|
+
captureBody,
|
|
21
|
+
captureHeaders
|
|
22
|
+
} = config;
|
|
23
|
+
try {
|
|
24
|
+
if (!captureBody && !captureHeaders) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const requestBody = request.body;
|
|
28
|
+
const requestHeaders = headersToObject(request.headers);
|
|
29
|
+
const responseHeaders = headersToObject(response instanceof Response ? response.headers : undefined);
|
|
30
|
+
let responseBody = null;
|
|
31
|
+
if (response instanceof Response && response.body) {
|
|
32
|
+
responseBody = await extractResponseBody(response);
|
|
33
|
+
}
|
|
34
|
+
const payload = {
|
|
35
|
+
requestBody,
|
|
36
|
+
responseBody,
|
|
37
|
+
requestHeaders,
|
|
38
|
+
responseHeaders
|
|
39
|
+
};
|
|
40
|
+
processHttpPayload(payload, config, span);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
// eslint-disable-next-line
|
|
43
|
+
logger.error('DEBUGGER_LIB', 'Failed to capture fetch payload', error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}));
|
|
47
|
+
} catch (error) {
|
|
48
|
+
logger.warn('DEBUGGER_LIB', 'Fetch instrumentation not available', error);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// XMLHttpRequest instrumentation
|
|
52
|
+
try {
|
|
53
|
+
instrumentations.push(new XMLHttpRequestInstrumentation({
|
|
54
|
+
clearTimingResources: false,
|
|
55
|
+
ignoreUrls: [...OTEL_IGNORE_URLS, ...(config.ignoreUrls || [])],
|
|
56
|
+
propagateTraceHeaderCorsUrls: config.propagateTraceHeaderCorsUrls,
|
|
57
|
+
applyCustomAttributesOnSpan: (span, xhr) => {
|
|
58
|
+
if (!config) return;
|
|
59
|
+
const {
|
|
60
|
+
captureBody,
|
|
61
|
+
captureHeaders
|
|
62
|
+
} = config;
|
|
63
|
+
try {
|
|
64
|
+
if (!captureBody && !captureHeaders) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
const requestBody = xhr.networkRequest.requestBody;
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
const responseBody = xhr.networkRequest.responseBody;
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
const requestHeaders = xhr.networkRequest.requestHeaders || {};
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
const responseHeaders = xhr.networkRequest.responseHeaders || {};
|
|
76
|
+
const payload = {
|
|
77
|
+
requestBody,
|
|
78
|
+
responseBody,
|
|
79
|
+
requestHeaders,
|
|
80
|
+
responseHeaders
|
|
81
|
+
};
|
|
82
|
+
processHttpPayload(payload, config, span);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
// eslint-disable-next-line
|
|
85
|
+
logger.error('DEBUGGER_LIB', 'Failed to capture xml-http payload', error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
} catch (error) {
|
|
90
|
+
logger.warn('DEBUGGER_LIB', 'XMLHttpRequest instrumentation not available', error);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Custom React Native instrumentations
|
|
94
|
+
// try {
|
|
95
|
+
// instrumentations.push(new ReactNativeInstrumentation())
|
|
96
|
+
// } catch (error) {
|
|
97
|
+
// console.warn('React Native instrumentation not available:', error)
|
|
98
|
+
// }
|
|
99
|
+
|
|
100
|
+
return instrumentations;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FetchInstrumentation","XMLHttpRequestInstrumentation","logger","OTEL_IGNORE_URLS","extractResponseBody","headersToObject","processHttpPayload","getInstrumentations","config","instrumentations","push","clearTimingResources","ignoreUrls","propagateTraceHeaderCorsUrls","applyCustomAttributesOnSpan","span","request","response","captureBody","captureHeaders","requestBody","body","requestHeaders","headers","responseHeaders","Response","undefined","responseBody","payload","error","warn","xhr","networkRequest"],"sourceRoot":"../../../../src","sources":["otel/instrumentations/index.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,sCAAsC;AAC3E,SAASC,6BAA6B,QAAQ,iDAAiD;AAE/F,SAASC,MAAM,QAAQ,sBAAa;AACpC,SAASC,gBAAgB,QAAQ,uBAAc;AAE/C,SAASC,mBAAmB,EAAEC,eAAe,EAAEC,kBAAkB,QAAQ,eAAY;AAErF,OAAO,SAASC,mBAAmBA,CAACC,MAA+B,EAAE;EAEnE,MAAMC,gBAAgB,GAAG,EAAE;;EAE3B;EACA,IAAI;IACFA,gBAAgB,CAACC,IAAI,CACnB,IAAIV,oBAAoB,CAAC;MACvBW,oBAAoB,EAAE,KAAK;MAC3BC,UAAU,EAAE,CACV,GAAGT,gBAAgB,EACnB,IAAIK,MAAM,CAACI,UAAU,IAAI,EAAE,CAAC,CAC7B;MACDC,4BAA4B,EAAEL,MAAM,CAACK,4BAA4B;MACjEC,2BAA2B,EAAE,MAAAA,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B;MACjEC,2BAA2B,EAAEA,CAACC,IAAI,EAAEgB,GAAG,KAAK;QAC1C,IAAI,CAACvB,MAAM,EAAE;QAEb,MAAM;UAAEU,WAAW;UAAEC;QAAe,CAAC,GAAGX,MAAM;QAE9C,IAAI;UACF,IAAI,CAACU,WAAW,IAAI,CAACC,cAAc,EAAE;YACnC;UACF;;UAEA;UACA,MAAMC,WAAW,GAAGW,GAAG,CAACC,cAAc,CAACZ,WAAW;UAClD;UACA,MAAMO,YAAY,GAAGI,GAAG,CAACC,cAAc,CAACL,YAAY;UACpD;UACA,MAAML,cAAc,GAAGS,GAAG,CAACC,cAAc,CAACV,cAAc,IAAI,CAAC,CAAC;UAC9D;UACA,MAAME,eAAe,GAAGO,GAAG,CAACC,cAAc,CAACR,eAAe,IAAI,CAAC,CAAC;UAEhE,MAAMI,OAAO,GAAG;YACdR,WAAW;YACXO,YAAY;YACZL,cAAc;YACdE;UACF,CAAC;UACDlB,kBAAkB,CAACsB,OAAO,EAAEpB,MAAM,EAAEO,IAAI,CAAC;QAC3C,CAAC,CAAC,OAAOc,KAAK,EAAE;UACd;UACA3B,MAAM,CAAC2B,KAAK,CAAC,cAAc,EAAE,oCAAoC,EAAEA,KAAK,CAAC;QAC3E;MACF;IACF,CAAC,CACH,CAAC;EACH,CAAC,CAAC,OAAOA,KAAK,EAAE;IACd3B,MAAM,CAAC4B,IAAI,CAAC,cAAc,EAAE,8CAA8C,EAAED,KAAK,CAAC;EACpF;;EAEA;EACA;EACA;EACA;EACA;EACA;;EAEA,OAAOpB,gBAAgB;AACzB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["patch/index.ts"],"mappings":";;AAAA,OAAO,UAAO","ignoreList":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { isFormData, isNullish, isObject, isString } from "../utils/type-utils.js";
|
|
5
|
+
import { formDataToQuery } from "../utils/request-utils.js";
|
|
6
|
+
import { DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE } from "../config/index.js";
|
|
7
|
+
|
|
8
|
+
// Check if we're on web platform
|
|
9
|
+
const isWeb = Platform.OS === 'web';
|
|
10
|
+
let recordRequestHeaders = true;
|
|
11
|
+
let recordResponseHeaders = true;
|
|
12
|
+
let shouldRecordBody = true;
|
|
13
|
+
let maxCapturingHttpPayloadSize = DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE;
|
|
14
|
+
export const setMaxCapturingHttpPayloadSize = _maxCapturingHttpPayloadSize => {
|
|
15
|
+
maxCapturingHttpPayloadSize = _maxCapturingHttpPayloadSize;
|
|
16
|
+
};
|
|
17
|
+
export const setShouldRecordHttpData = (shouldRecordBody, shouldRecordHeaders) => {
|
|
18
|
+
recordRequestHeaders = shouldRecordHeaders;
|
|
19
|
+
recordResponseHeaders = shouldRecordHeaders;
|
|
20
|
+
shouldRecordBody = shouldRecordBody;
|
|
21
|
+
};
|
|
22
|
+
function _tryReadXHRBody({
|
|
23
|
+
body
|
|
24
|
+
}) {
|
|
25
|
+
if (isNullish(body)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (isString(body)) {
|
|
29
|
+
return body;
|
|
30
|
+
}
|
|
31
|
+
if (isFormData(body)) {
|
|
32
|
+
return formDataToQuery(body);
|
|
33
|
+
}
|
|
34
|
+
if (isObject(body)) {
|
|
35
|
+
try {
|
|
36
|
+
return JSON.stringify({
|
|
37
|
+
...body
|
|
38
|
+
});
|
|
39
|
+
} catch {
|
|
40
|
+
return '[XHR] Failed to stringify response object';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return `[XHR] Cannot read body of type ${Object.prototype.toString.call(body)}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Only patch XMLHttpRequest if not on web platform or if XMLHttpRequest is available
|
|
47
|
+
if (!isWeb && typeof XMLHttpRequest !== 'undefined') {
|
|
48
|
+
(function (xhr) {
|
|
49
|
+
const originalOpen = XMLHttpRequest.prototype.open;
|
|
50
|
+
xhr.open = function (method, url, async = true, username, password) {
|
|
51
|
+
const xhr = this;
|
|
52
|
+
const networkRequest = {};
|
|
53
|
+
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
const requestHeaders = {};
|
|
56
|
+
const originalSetRequestHeader = xhr.setRequestHeader.bind(xhr);
|
|
57
|
+
xhr.setRequestHeader = (header, value) => {
|
|
58
|
+
requestHeaders[header] = value;
|
|
59
|
+
return originalSetRequestHeader(header, value);
|
|
60
|
+
};
|
|
61
|
+
if (recordRequestHeaders) {
|
|
62
|
+
networkRequest.requestHeaders = requestHeaders;
|
|
63
|
+
}
|
|
64
|
+
const originalSend = xhr.send.bind(xhr);
|
|
65
|
+
xhr.send = body => {
|
|
66
|
+
if (shouldRecordBody) {
|
|
67
|
+
const requestBody = _tryReadXHRBody({
|
|
68
|
+
body,
|
|
69
|
+
url
|
|
70
|
+
});
|
|
71
|
+
if (requestBody?.length && requestBody.length <= maxCapturingHttpPayloadSize) {
|
|
72
|
+
networkRequest.requestBody = requestBody;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return originalSend(body);
|
|
76
|
+
};
|
|
77
|
+
xhr.addEventListener('readystatechange', () => {
|
|
78
|
+
if (xhr.readyState !== xhr.DONE) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
const responseHeaders = {};
|
|
84
|
+
const rawHeaders = xhr.getAllResponseHeaders() || '';
|
|
85
|
+
const headers = rawHeaders.trim().split(/[\r\n]+/).filter(Boolean);
|
|
86
|
+
headers.forEach(line => {
|
|
87
|
+
const parts = line.split(': ');
|
|
88
|
+
const header = parts.shift();
|
|
89
|
+
const value = parts.join(': ');
|
|
90
|
+
if (header) {
|
|
91
|
+
responseHeaders[header] = value;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
if (recordResponseHeaders) {
|
|
95
|
+
networkRequest.responseHeaders = responseHeaders;
|
|
96
|
+
}
|
|
97
|
+
if (shouldRecordBody) {
|
|
98
|
+
const responseBody = _tryReadXHRBody({
|
|
99
|
+
body: xhr.response,
|
|
100
|
+
url
|
|
101
|
+
});
|
|
102
|
+
if (responseBody?.length && responseBody.length <= maxCapturingHttpPayloadSize) {
|
|
103
|
+
networkRequest.responseBody = responseBody;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// @ts-ignore
|
|
109
|
+
xhr.networkRequest = networkRequest;
|
|
110
|
+
originalOpen.call(xhr, method, url, async, username, password);
|
|
111
|
+
};
|
|
112
|
+
})(XMLHttpRequest.prototype);
|
|
113
|
+
} else if (isWeb) {
|
|
114
|
+
console.info('XHR patch: Skipping XMLHttpRequest patching on web platform');
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=xhr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","isFormData","isNullish","isObject","isString","formDataToQuery","DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE","isWeb","OS","recordRequestHeaders","recordResponseHeaders","shouldRecordBody","maxCapturingHttpPayloadSize","setMaxCapturingHttpPayloadSize","_maxCapturingHttpPayloadSize","setShouldRecordHttpData","shouldRecordHeaders","_tryReadXHRBody","body","JSON","stringify","Object","prototype","toString","call","XMLHttpRequest","xhr","originalOpen","open","method","url","async","username","password","networkRequest","requestHeaders","originalSetRequestHeader","setRequestHeader","bind","header","value","originalSend","send","requestBody","length","addEventListener","readyState","DONE","responseHeaders","rawHeaders","getAllResponseHeaders","headers","trim","split","filter","Boolean","forEach","line","parts","shift","join","responseBody","response","console","info"],"sourceRoot":"../../../src","sources":["patch/xhr.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;A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,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import io from 'socket.io-client';
|
|
4
|
+
import { logger } from "../utils/index.js";
|
|
5
|
+
import { SESSION_ADD_EVENT, SESSION_AUTO_CREATED, SESSION_STOPPED_EVENT, SESSION_SUBSCRIBE_EVENT, SESSION_UNSUBSCRIBE_EVENT } from "../config/index.js";
|
|
6
|
+
const MAX_RECONNECTION_ATTEMPTS = 2;
|
|
7
|
+
export class EventExporter {
|
|
8
|
+
socket = null;
|
|
9
|
+
queue = [];
|
|
10
|
+
isConnecting = false;
|
|
11
|
+
isConnected = false;
|
|
12
|
+
attempts = 0;
|
|
13
|
+
sessionId = null;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.socketUrl = options.socketUrl;
|
|
16
|
+
this.apiKey = options.apiKey;
|
|
17
|
+
}
|
|
18
|
+
init() {
|
|
19
|
+
if (this.isConnecting || this.isConnected) return;
|
|
20
|
+
this.attempts++;
|
|
21
|
+
this.isConnecting = true;
|
|
22
|
+
this.socket = io(this.socketUrl, {
|
|
23
|
+
path: '/v0/radar/ws',
|
|
24
|
+
auth: {
|
|
25
|
+
'x-api-key': this.apiKey
|
|
26
|
+
},
|
|
27
|
+
reconnectionAttempts: 2,
|
|
28
|
+
transports: ['websocket']
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// this.socket.on('connect', () => {
|
|
32
|
+
// this.isConnecting = false
|
|
33
|
+
// this.isConnected = true
|
|
34
|
+
// this.usePostMessage = false
|
|
35
|
+
// this.flushQueue()
|
|
36
|
+
// })
|
|
37
|
+
|
|
38
|
+
this.socket.on('ready', () => {
|
|
39
|
+
this.isConnecting = false;
|
|
40
|
+
this.isConnected = true;
|
|
41
|
+
logger.info('EventExporter', 'Connected to server');
|
|
42
|
+
this.flushQueue();
|
|
43
|
+
});
|
|
44
|
+
this.socket.on('disconnect', _err => {
|
|
45
|
+
this.isConnecting = false;
|
|
46
|
+
this.isConnected = false;
|
|
47
|
+
logger.info('EventExporter', 'Disconnected from server');
|
|
48
|
+
});
|
|
49
|
+
this.socket.on('connect_error', err => {
|
|
50
|
+
this.isConnecting = false;
|
|
51
|
+
this.isConnected = false;
|
|
52
|
+
this.checkReconnectionAttempts();
|
|
53
|
+
logger.error('EventExporter', 'Error connecting to server', err);
|
|
54
|
+
});
|
|
55
|
+
this.socket.on(SESSION_STOPPED_EVENT, _ => {
|
|
56
|
+
this.unsubscribeFromSession();
|
|
57
|
+
});
|
|
58
|
+
this.socket.on(SESSION_AUTO_CREATED, _ => {});
|
|
59
|
+
}
|
|
60
|
+
setApiKey(apiKey) {
|
|
61
|
+
this.apiKey = apiKey;
|
|
62
|
+
}
|
|
63
|
+
setSocketUrl(socketUrl) {
|
|
64
|
+
this.socketUrl = socketUrl;
|
|
65
|
+
}
|
|
66
|
+
checkReconnectionAttempts() {
|
|
67
|
+
if (this.attempts >= MAX_RECONNECTION_ATTEMPTS) {
|
|
68
|
+
this.flushQueue();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
flushQueue() {
|
|
72
|
+
while (this.queue.length > 0 && this.socket?.connected) {
|
|
73
|
+
const event = this.queue.shift();
|
|
74
|
+
if (!event) continue;
|
|
75
|
+
if (this.socket?.connected) {
|
|
76
|
+
this.socket.emit(event.name, event.data);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
unsubscribeFromSession() {
|
|
81
|
+
const payload = {
|
|
82
|
+
debugSessionId: this.sessionId
|
|
83
|
+
};
|
|
84
|
+
if (this.socket?.connected) {
|
|
85
|
+
this.socket.emit(SESSION_UNSUBSCRIBE_EVENT, payload);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
send(event) {
|
|
89
|
+
if (this.socket?.connected) {
|
|
90
|
+
this.socket.emit(SESSION_ADD_EVENT, event);
|
|
91
|
+
} else {
|
|
92
|
+
this.queue.push({
|
|
93
|
+
data: event,
|
|
94
|
+
name: SESSION_ADD_EVENT
|
|
95
|
+
});
|
|
96
|
+
this.init();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
subscribeToSession(session) {
|
|
100
|
+
this.sessionId = session.shortId || session._id;
|
|
101
|
+
const payload = {
|
|
102
|
+
projectId: session.project,
|
|
103
|
+
workspaceId: session.workspace,
|
|
104
|
+
debugSessionId: this.sessionId,
|
|
105
|
+
sessionType: session.creationType
|
|
106
|
+
};
|
|
107
|
+
if (this.socket?.connected) {
|
|
108
|
+
this.socket.emit(SESSION_SUBSCRIBE_EVENT, payload);
|
|
109
|
+
} else {
|
|
110
|
+
this.queue.push({
|
|
111
|
+
data: payload,
|
|
112
|
+
name: SESSION_SUBSCRIBE_EVENT
|
|
113
|
+
});
|
|
114
|
+
this.init();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
close() {
|
|
118
|
+
if (this.socket?.connected) {
|
|
119
|
+
setTimeout(() => {
|
|
120
|
+
this.unsubscribeFromSession();
|
|
121
|
+
this.attempts = 0;
|
|
122
|
+
this.isConnected = false;
|
|
123
|
+
this.isConnecting = false;
|
|
124
|
+
this.socket?.disconnect();
|
|
125
|
+
this.socket = null;
|
|
126
|
+
}, 500);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=eventExporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["io","logger","SESSION_ADD_EVENT","SESSION_AUTO_CREATED","SESSION_STOPPED_EVENT","SESSION_SUBSCRIBE_EVENT","SESSION_UNSUBSCRIBE_EVENT","MAX_RECONNECTION_ATTEMPTS","EventExporter","socket","queue","isConnecting","isConnected","attempts","sessionId","constructor","options","socketUrl","apiKey","init","path","auth","reconnectionAttempts","transports","on","info","flushQueue","_err","err","checkReconnectionAttempts","error","_","unsubscribeFromSession","setApiKey","setSocketUrl","length","connected","event","shift","emit","name","data","payload","debugSessionId","send","push","subscribeToSession","session","shortId","_id","projectId","project","workspaceId","workspace","sessionType","creationType","close","setTimeout","disconnect"],"sourceRoot":"../../../src","sources":["recorder/eventExporter.ts"],"mappings":";;AAAA,OAAOA,EAAE,MAAkB,kBAAkB;AAG7C,SAASC,MAAM,QAAQ,mBAAU;AAEjC,SACEC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,uBAAuB,EACvBC,yBAAyB,QACpB,oBAAW;AAElB,MAAMC,yBAAyB,GAAG,CAAC;AAEnC,OAAO,MAAMC,aAAa,CAAC;EACjBC,MAAM,GAAkB,IAAI;EAC5BC,KAAK,GAAU,EAAE;EACjBC,YAAY,GAAY,KAAK;EAC7BC,WAAW,GAAY,KAAK;EAC5BC,QAAQ,GAAW,CAAC;EACpBC,SAAS,GAAkB,IAAI;EAKvCC,WAAWA,CAACC,OAA8C,EAAE;IAC1D,IAAI,CAACC,SAAS,GAAGD,OAAO,CAACC,SAAS;IAClC,IAAI,CAACC,MAAM,GAAGF,OAAO,CAACE,MAAM;EAC9B;EAEQC,IAAIA,CAAA,EAAS;IACnB,IAAI,IAAI,CAACR,YAAY,IAAI,IAAI,CAACC,WAAW,EAAE;IAC3C,IAAI,CAACC,QAAQ,EAAE;IACf,IAAI,CAACF,YAAY,GAAG,IAAI;IACxB,IAAI,CAACF,MAAM,GAAGT,EAAE,CAAC,IAAI,CAACiB,SAAS,EAAE;MAC/BG,IAAI,EAAE,cAAc;MACpBC,IAAI,EAAE;QACJ,WAAW,EAAE,IAAI,CAACH;MACpB,CAAC;MACDI,oBAAoB,EAAE,CAAC;MACvBC,UAAU,EAAE,CAAC,WAAW;IAC1B,CAAC,CAAC;;IAEF;IACA;IACA;IACA;IACA;IACA;;IAEA,IAAI,CAACd,MAAM,CAACe,EAAE,CAAC,OAAO,EAAE,MAAM;MAC5B,IAAI,CAACb,YAAY,GAAG,KAAK;MACzB,IAAI,CAACC,WAAW,GAAG,IAAI;MACvBX,MAAM,CAACwB,IAAI,CAAC,eAAe,EAAE,qBAAqB,CAAC;MACnD,IAAI,CAACC,UAAU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