diff --git a/README.md b/README.md index 00e32df4..fc16d940 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ You must pass at least the `writeKey`. Additional configuration options are list | `storePersistor` | undefined | A custom persistor for the store that `analytics-react-native` leverages. Must match [`Persistor`](https://github.com/segmentio/analytics-react-native/blob/master/packages/sovran/src/persistor/persistor.ts#L1-L18) interface exported from [sovran-react-native](https://github.com/segmentio/analytics-react-native/blob/master/packages/sovran).| | `proxy` | undefined | `proxy` is a batch url to post to instead of 'https://api.segment.io/v1/b'. | | `errorHandler` | undefined | Create custom actions when errors happen, see [Handling errors](#handling-errors) | +| `cdnProxy` | undefined | Sets an alternative CDN host for settings retrieval | \* The default value of `debug` will be false in production. diff --git a/example/ios/AnalyticsReactNativeExample.xcodeproj/project.pbxproj b/example/ios/AnalyticsReactNativeExample.xcodeproj/project.pbxproj index b3709a06..81168eb9 100644 --- a/example/ios/AnalyticsReactNativeExample.xcodeproj/project.pbxproj +++ b/example/ios/AnalyticsReactNativeExample.xcodeproj/project.pbxproj @@ -206,14 +206,10 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-AnalyticsReactNativeExample/Pods-AnalyticsReactNativeExample-resources.sh", - "${PODS_CONFIGURATION_BUILD_DIR}/BrazeKit/BrazeKit.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/BrazeUI/BrazeUI.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/React-Core/AccessibilityResources.bundle", ); name = "[CP] Copy Pods Resources"; outputPaths = ( - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/BrazeKit.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/BrazeUI.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AccessibilityResources.bundle", ); runOnlyForDeploymentPostprocessing = 0; diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index b231e83d..33d3cc4e 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,15 +1,5 @@ PODS: - boost (1.76.0) - - braze-react-native-sdk (4.1.0): - - BrazeKit (~> 5.13.0) - - BrazeLocation (~> 5.13.0) - - BrazeUI (~> 5.13.0) - - React-Core - - BrazeKit (5.13.0) - - BrazeLocation (5.13.0): - - BrazeKit (= 5.13.0) - - BrazeUI (5.13.0): - - BrazeKit (= 5.13.0) - DoubleConversion (1.1.6) - FBLazyVector (0.69.7) - FBReactNativeSpec (0.69.7): @@ -321,7 +311,6 @@ PODS: DEPENDENCIES: - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) - - "braze-react-native-sdk (from `../node_modules/@braze/react-native-sdk`)" - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) @@ -367,16 +356,11 @@ DEPENDENCIES: SPEC REPOS: trunk: - - BrazeKit - - BrazeLocation - - BrazeUI - fmt EXTERNAL SOURCES: boost: :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec" - braze-react-native-sdk: - :path: "../node_modules/@braze/react-native-sdk" DoubleConversion: :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" FBLazyVector: @@ -462,10 +446,6 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost: a7c83b31436843459a1961bfd74b96033dc77234 - braze-react-native-sdk: 686da10a997500422984bd4b39c78fc19fcd701a - BrazeKit: 97f6875bf05920a46a2f0c9d0e452b6b840c5f99 - BrazeLocation: 571ee6bf6b2f5c1aba20d9a75e4da190f8db7e5b - BrazeUI: 31dd9f0235149f05d6f7e37f273be7293e000587 DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 FBLazyVector: 6b7f5692909b4300d50e7359cdefbcd09dd30faa FBReactNativeSpec: affcf71d996f6b0c01f68883482588297b9d5e6e diff --git a/packages/core/src/analytics.ts b/packages/core/src/analytics.ts index 8cfda5ff..f006a04a 100644 --- a/packages/core/src/analytics.ts +++ b/packages/core/src/analytics.ts @@ -293,7 +293,8 @@ export class SegmentClient { } async fetchSettings() { - const settingsEndpoint = `${settingsCDN}/${this.config.writeKey}/settings`; + const settingsPrefix: string = this.config.cdnProxy ?? settingsCDN; + const settingsEndpoint = `${settingsPrefix}/${this.config.writeKey}/settings`; try { const res = await fetch(settingsEndpoint); diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index f73f885f..a208cd19 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -146,6 +146,7 @@ export type Config = { collectDeviceId?: boolean; storePersistor?: Persistor; proxy?: string; + cdnProxy?: string; errorHandler?: (error: SegmentError) => void; };