Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions sdk/@launchdarkly/react-native-ld-session-replay/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ android/keystores/debug.keystore
# generated by bob
lib/

# XCFrameworks — built artifacts, not committed to git but included in npm publish
# Run: yarn build:xcframeworks
ios/Frameworks/

# Expo Config Plugin compiled output
plugin/build/

# React Native Codegen
ios/generated
android/generated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,33 @@ Pod::Spec.new do |s|
s.authors = package["author"]

s.platforms = { :ios => min_ios_version_supported }
s.source = { :git => "https://github.com/launchdarkly/swift-launchdarkly-observability.git", :tag => "#{s.version}" }
s.source = { :git => "https://github.com/launchdarkly/observability-sdk.git",
:tag => "rn-session-replay-#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,swift,cpp}"
s.private_header_files = "ios/**/*.h"

# --- Swift Package Manager Dependency ---
# This helper adds the SPM package to the generated Pods project
spm_dependency(
s,
url: 'https://github.com/launchdarkly/swift-launchdarkly-observability',
requirement: {
kind: 'upToNextMajorVersion',
minimumVersion: '0.18.1'
},
products: ['LaunchDarklyObservability', 'LaunchDarklySessionReplay']
)
# Pre-built XCFrameworks from swift-launchdarkly-observability.
# Built via scripts/build-xcframeworks.sh and shipped inside the npm package.
# This replaces the previous spm_dependency approach, eliminating the need for
# react_native_post_install SPM support and network access at pod install time.
#
# LaunchDarklyObservability is a "fat" static archive that already contains all
# internal and ObjC-only transitive deps (KSCrash, Common, NetworkStatus, etc.).
# The remaining xcframeworks satisfy the Swift module references (@_exported import
# LaunchDarkly / OpenTelemetryApi, plus OtlpConfiguration, ReadableLogRecord,
# SwiftProtobuf.Message) that appear in the public .swiftinterface files.
s.vendored_frameworks = [
'ios/Frameworks/LaunchDarklyObservability.xcframework',
'ios/Frameworks/LaunchDarklySessionReplay.xcframework',
'ios/Frameworks/LaunchDarkly.xcframework',
'ios/Frameworks/OpenTelemetryApi.xcframework',
'ios/Frameworks/OpenTelemetrySdk.xcframework',
'ios/Frameworks/OpenTelemetryProtocolExporterCommon.xcframework',
'ios/Frameworks/SwiftProtobuf.xcframework',
]

s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }

install_modules_dependencies(s)
end
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./plugin/build/index.js');
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,7 @@ SPEC CHECKSUMS:
ReactAppDependencyProvider: ebcf3a78dc1bcdf054c9e8d309244bade6b31568
ReactCodegen: 11c08ff43a62009d48c71de000352e4515918801
ReactCommon: 424cc34cf5055d69a3dcf02f3436481afb8b0f6f
SessionReplayReactNative: 2abade3c8879121f8316d64bc41d6d29ac3d7d6d
SessionReplayReactNative: 6a469f14f953d03ce8973347cb485524f52517b3
SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
Yoga: 6ca93c8c13f56baeec55eb608577619b17a4d64e

Expand Down
18 changes: 16 additions & 2 deletions sdk/@launchdarkly/react-native-ld-session-replay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@launchdarkly/session-replay-react-native",
"version": "0.2.2",
"spmVersion": "0.18.1",
"description": "session replay for react native",
"main": "./lib/module/index.js",
"types": "./lib/typescript/src/index.d.ts",
Expand All @@ -17,7 +18,11 @@
"lib",
"android",
"ios",
"ios/Frameworks",
"cpp",
"plugin",
"app.plugin.js",
"scripts/build-xcframeworks.sh",
"*.podspec",
"react-native.config.js",
"!ios/build",
Expand All @@ -34,8 +39,10 @@
"scripts": {
"example": "yarn workspace session-replay-react-native-example",
"build": "bob build",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepack": "bob build",
"build:plugin": "tsc -p plugin/tsconfig.json",
"build:xcframeworks": "bash scripts/build-xcframeworks.sh",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib plugin/build ios/Frameworks",
"prepack": "bob build && tsc -p plugin/tsconfig.json && bash scripts/build-xcframeworks.sh",
"typecheck": "tsc",
"lint": "echo 'Linting temporarily disabled - TODO: fix ESLint config'",
"test": "jest",
Expand Down Expand Up @@ -72,6 +79,7 @@
"@eslint/compat": "^1.3.2",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.35.0",
"@expo/config-plugins": "^9.0.0",
"@react-native/babel-preset": "0.83.0",
"@react-native/eslint-config": "0.83.0",
"@react-native/eslint-plugin": "0.83.0",
Expand All @@ -93,9 +101,15 @@
"typescript": "^5.9.2"
},
"peerDependencies": {
"@expo/config-plugins": ">=7.0.0",
"react": "*",
"react-native": "*"
},
"peerDependenciesMeta": {
"@expo/config-plugins": {
"optional": true
}
},
"workspaces": [
"example"
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { ConfigPlugin, withXcodeProject } from '@expo/config-plugins';

/**
* Expo Config Plugin for @launchdarkly/session-replay-react-native.
*
* Patches the Xcode project so that dynamic Swift frameworks vendored by the
* pod (LaunchDarklyObservability.xcframework, LaunchDarklySessionReplay.xcframework)
* are embedded correctly in the app bundle.
*
* Usage in app.json / app.config.js:
* "plugins": ["@launchdarkly/session-replay-react-native"]
*/
const withSessionReplay: ConfigPlugin = (config) => {
return withXcodeProject(config, (projectConfig) => {
const project = projectConfig.modResults;

const buildConfigs = project.pbxBuildConfigurationSection();
for (const [, buildConfig] of Object.entries(buildConfigs)) {
if (
typeof buildConfig !== 'object' ||
!buildConfig.buildSettings
) {
continue;
}
// Required when embedding dynamic Swift frameworks into an app that
// may not otherwise include the Swift standard libraries.
buildConfig.buildSettings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] =
'YES';
}

return projectConfig;
});
};

export default withSessionReplay;
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"strict": true,
"target": "ES2019",
"module": "commonjs",
"lib": ["ES2019"],
"outDir": "build",
"rootDir": "src",
"declaration": true,
"declarationMap": true
},
"include": ["src"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
Loading
Loading