diff --git a/CHANGELOG.md b/CHANGELOG.md index 5819b036..be0ac154 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +- 1.0.10 + - Added Collect Dispatch URL to the `initializeCustom` method + - Enabled `null` in TypeScript definition for parameters that accept it + - Fixed TypeScript definition for Remote Command methods - 1.0.9 - Bug fix - Removed duplicate default keywords from Typescript definitions file diff --git a/README.md b/README.md index d94e8bb9..c8ce8d25 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ ## Tealium React Native -This repository contains the necessary assets for exposing Tealium's native [Android](https://community.tealiumiq.com/t5/Tealium-for-Android/tkb-p/android-documentation) and [iOS](https://community.tealiumiq.com/t5/Tealium-for-iOS/tkb-p/ios-documentation) mobile libraries to the JavaScript code in your React Native project. This includes code for exposing the native APIs for both platforms through React Native's bridging system, and a basic helper class in JavaScript to create a single cross platform API. +This repository contains the necessary assets for exposing Tealium's native [Android](https://docs.tealium.com/platforms/android-java/) and [iOS](https://docs.tealium.com/platforms/ios-objective-c/) mobile libraries to the JavaScript code in your React Native project. This includes code for exposing the native APIs for both platforms through React Native's bridging system, and a basic helper class in JavaScript to create a single cross platform API. -Because including the respective libraries for Android and iOS means working with platform specific code, you will need access to your native build environments. For example you will need to "[eject](https://github.com/react-community/create-react-native-app/blob/master/EJECTING.md)" if you're using [Create React Native App](https://github.com/react-community/create-react-native-app) and haven't done so already. Including the mobile libraries works no differently than in any other Android or iOS project. Therefore any non React Native specific documentation in the [Tealium Learning Community](https://community.tealiumiq.com/) regarding the mobile libraries is still relevant, and at times you may be directed to it from our React Native documentation. For this reason the mobile libraries themselves aren't distributed in this repository, and are meant to be acquired through the usual methods described for [Android](https://community.tealiumiq.com/t5/Tealium-for-Android/Adding-Tealium-to-Your-Android-App/ta-p/16846) and [iOS](https://community.tealiumiq.com/t5/Tealium-for-iOS/Adding-Tealium-to-Your-iOS-App/ta-p/16327). - -You can also find a sample application demonstrating how everything is put together and how the API gets called in JavaScript, with instructions in the Tealium Learning Community. +You can also find a sample application demonstrating how everything is put together and how the API gets called in JavaScript. ## Documentation -For full documentation, please see the Tealium Learning Community: +For full documentation, please see the Tealium Developer Docs website: -[Tealium React Native Documentation on TLC](https://community.tealiumiq.com/t5/Mobile-Libraries/Tealium-for-React-Native/ta-p/22449) +[Tealium React Native Documentation](https://docs.tealium.com/platforms/react-native/install/) ## License diff --git a/TealiumSampleApp/App.js b/TealiumSampleApp/App.js index dd605a80..71822c89 100644 --- a/TealiumSampleApp/App.js +++ b/TealiumSampleApp/App.js @@ -354,7 +354,7 @@ export default class App extends React.Component { Tealium.initializeCustom( 'tealiummobile', 'react-native', 'qa', 'your-ios-datasource', 'your-android-datasource', 'instance-2', - true, null, null, true, true + true, null, null, true, false, 'https://your.custom.endpoint/here' ); } diff --git a/TealiumSampleApp/ios/Podfile.lock b/TealiumSampleApp/ios/Podfile.lock index b5c4dd76..48c7022a 100644 --- a/TealiumSampleApp/ios/Podfile.lock +++ b/TealiumSampleApp/ios/Podfile.lock @@ -217,7 +217,7 @@ PODS: - React-cxxreact (= 0.61.3) - React-jsi (= 0.61.3) - ReactCommon/jscallinvoker (= 0.61.3) - - tealium-react-native (1.0.7): + - tealium-react-native (1.0.10): - React - TealiumIOS (= 5.6.6) - TealiumIOSLifecycle (= 5.6.6) @@ -342,11 +342,11 @@ SPEC CHECKSUMS: React-RCTText: b8f895b94aa0e7778fef28d13f3d71eed4a10c3d React-RCTVibration: 262588c97551b0b1c675468cda857466ba5af18f ReactCommon: c2c63d9290b422ca6ad5b3663073a015dd892ae9 - tealium-react-native: b9f45e5242eaffb754085da8ef6764df85b08290 + tealium-react-native: 04e565c1db7174dba64ae3fa53e0268e142ce9ee TealiumIOS: 6fa0157ef4ea13ff56b576e17d90085dc2fe9c4d TealiumIOSLifecycle: f26daa58f08ea3a76b96363b966698c5c79af6ed Yoga: 02036f6383c0008edb7ef0773a0e6beb6ce82bd1 PODFILE CHECKSUM: 063bda2eba9e64c447cb71e6f95741b86dd5b2c6 -COCOAPODS: 1.8.4 +COCOAPODS: 1.9.1 diff --git a/TealiumSampleApp/yarn.lock b/TealiumSampleApp/yarn.lock index 48d23ef8..1e8d95d1 100644 --- a/TealiumSampleApp/yarn.lock +++ b/TealiumSampleApp/yarn.lock @@ -6111,7 +6111,7 @@ tar@^4: yallist "^3.0.3" tealium-react-native@../npm-package: - version "1.0.8" + version "1.0.10" temp@0.8.3: version "0.8.3" diff --git a/android/TealiumModule.java b/android/TealiumModule.java index e849120f..9af66672 100644 --- a/android/TealiumModule.java +++ b/android/TealiumModule.java @@ -140,7 +140,8 @@ public void initializeCustom(String account, String overridePublishSettingsUrl, String overrideTagManagementUrl, boolean enableCollectUrl, - boolean enableConsentManager) { + boolean enableConsentManager, + String overrideCollectDispatchUrl) { if (account == null || profile == null || environment == null) { throw new IllegalArgumentException("Account, profile, and environment parameters must be provided and non-null"); @@ -156,6 +157,9 @@ public void initializeCustom(String account, if (overrideTagManagementUrl != null) { config.setOverrideTagManagementUrl(overrideTagManagementUrl); } + if (overrideCollectDispatchUrl != null) { + config.setOverrideCollectDispatchUrl(overrideCollectDispatchUrl); + } if (!enableCollectUrl) { config.setVdataCollectEndpointEnabled(true); } diff --git a/ios/TealiumModule.m b/ios/TealiumModule.m index 239e7a54..6036f811 100644 --- a/ios/TealiumModule.m +++ b/ios/TealiumModule.m @@ -85,6 +85,7 @@ @implementation TealiumModule overrideTagManagementURL:(NSString *)overrideTagManagementURL collectURL:(BOOL)enableCollectURL enableConsentManager:(BOOL)enableConsentManager + overrideCollectDispatchURL:(NSString *)overrideCollectDispatchURL ) { // Set your account, profile, and environment TEALConfiguration *configuration = [TEALConfiguration configurationWithAccount:account @@ -99,6 +100,9 @@ @implementation TealiumModule if (overrideTagManagementURL) { configuration.overrideTagManagementURL = overrideTagManagementURL; } + if (overrideCollectDispatchURL) { + configuration.overrideCollectDispatchURL = overrideCollectDispatchURL; + } if (!enableCollectURL) { configuration.collectURL = TEALCollectURLVdata; } @@ -274,10 +278,10 @@ @implementation TealiumModule } RCT_EXPORT_METHOD(isConsentLoggingEnabled:(RCTResponseSenderBlock)callback) { - [self isConsentLoggingEnabledForInstance:tealiumInternalInstanceName callback:callback]; + [self isConsentLoggingEnabledForInstanceName:tealiumInternalInstanceName callback:callback]; } -RCT_EXPORT_METHOD(isConsentLoggingEnabledForInstance:(NSString *)instanceName callback:(RCTResponseSenderBlock)callback) { +RCT_EXPORT_METHOD(isConsentLoggingEnabledForInstanceName:(NSString *)instanceName callback:(RCTResponseSenderBlock)callback) { Tealium *tealium = [Tealium instanceForKey:instanceName]; [[tealium consentManager] isConsentLoggingEnabled]; } diff --git a/npm-package/README.md b/npm-package/README.md index 87926913..36185fd5 100644 --- a/npm-package/README.md +++ b/npm-package/README.md @@ -1,16 +1,7 @@ # tealium-react-native -This package provides a native module for React Native apps giving access to Tealium's native libraries for Android and iOS, exposed through a common JavaScript api. More information can be found in the [Tealium Learning Community document](https://community.tealiumiq.com/t5/Mobile-Libraries/Tealium-for-React-Native/ta-p/22449). +This package provides a native module for React Native apps giving access to Tealium's native libraries for Android and iOS, exposed through a common JavaScript API. More information can be found in the [Tealium Developer Docs](https://docs.tealium.com/platforms/react-native/). ## Installation -In the root of your React Native project, run the following: - -```console -npm install tealium-react-native -react-native link -``` - -The first command will download the `tealium-react-native` package and install it to your project. - -The second command will link the native dependencies within the module to your main React Native app so that it can build against the module. +For installation instructions, please refer to the installation guide found on the Tealium Developer Docs website [here](https://docs.tealium.com/platforms/react-native/install/) diff --git a/npm-package/android/src/main/java/com/tealiumreactnative/TealiumModule.java b/npm-package/android/src/main/java/com/tealiumreactnative/TealiumModule.java index e849120f..9af66672 100644 --- a/npm-package/android/src/main/java/com/tealiumreactnative/TealiumModule.java +++ b/npm-package/android/src/main/java/com/tealiumreactnative/TealiumModule.java @@ -140,7 +140,8 @@ public void initializeCustom(String account, String overridePublishSettingsUrl, String overrideTagManagementUrl, boolean enableCollectUrl, - boolean enableConsentManager) { + boolean enableConsentManager, + String overrideCollectDispatchUrl) { if (account == null || profile == null || environment == null) { throw new IllegalArgumentException("Account, profile, and environment parameters must be provided and non-null"); @@ -156,6 +157,9 @@ public void initializeCustom(String account, if (overrideTagManagementUrl != null) { config.setOverrideTagManagementUrl(overrideTagManagementUrl); } + if (overrideCollectDispatchUrl != null) { + config.setOverrideCollectDispatchUrl(overrideCollectDispatchUrl); + } if (!enableCollectUrl) { config.setVdataCollectEndpointEnabled(true); } diff --git a/npm-package/index.d.ts b/npm-package/index.d.ts index d5fbb14b..7c3ec76d 100644 --- a/npm-package/index.d.ts +++ b/npm-package/index.d.ts @@ -22,8 +22,8 @@ declare module 'tealium-react-native' { account: string, profile = string, environment: string, - iosDataSource?: string, - androidDataSource?: string, + iosDataSource?: string | null, + androidDataSource?: string | null, ): void; /** @@ -38,8 +38,8 @@ declare module 'tealium-react-native' { account: string, profile = string, environment: string, - iosDataSource?: string, - androidDataSource?: string, + iosDataSource?: string | null, + androidDataSource?: string | null, ): void; /** @@ -55,19 +55,21 @@ declare module 'tealium-react-native' { * @param overrideTagManagementUrl String representing the tag management URL if overriding, otherwise null (default: null) * @param enableCollectEndpoint True sends data to the Collect endpoint (default: true) * @param enableConsentManager True enables Consent Management + * @param overrideCollectDispatchURL String representing the HTTP endpoint to send all event data (default: null) */ static initializeCustom( account: string, profile = string, environment: string, - iosDataSource?: string, - androidDataSource?: string, + iosDataSource?: string | null, + androidDataSource?: string | null, instance: string, enableLifeCycle = boolean, - overridePublishSettingsUrl: string, - overrideTagManagementUrl: string, + overridePublishSettingsUrl: string | null, + overrideTagManagementUrl: string | null, enableCollectEndpoint = boolean, enableConsentManager = boolean, + overrideCollectDispatchURL: string | null ): void; /** @@ -344,27 +346,31 @@ declare module 'tealium-react-native' { /** * Adds a remote command to the remote command manager. - * Don't forget to subscribe to the `RemoteCommandEvent` emitter. + * * @param commandID Name of the Remote Command (if using TiQ, this is whatever is in the tag config) * @param description A description of the remote command + * @param callback Callback to execute with the Remote Command payload */ static addRemoteCommand( commandID: string, description: string, + callback: (payload: object) => void ): void; /** * Adds a remote command to the remote command manager. - * Don't forget to subscribe to the `RemoteCommandEvent` emitter. + * * This method should be used if you have multiple instances of Tealium in your app. * @param instanceName Name of the Tealium instance * @param commandID Name of the Remote Command (if using TiQ, this is whatever is in the tag config) * @param description A description of the remote command + * @param callback Callback to execute with the Remote Command payload */ static addRemoteCommandForInstanceName( instanceName: string, commandID: string, description: string, + callback: (payload: object) => void ): void; diff --git a/npm-package/index.js b/npm-package/index.js index e3647cc1..6cd68e00 100644 --- a/npm-package/index.js +++ b/npm-package/index.js @@ -59,7 +59,8 @@ export default class Tealium { overridePublishSettingsURL, overrideTagManagementURL, collectURL, - enableConsentManager + enableConsentManager, + overrideCollectDispatchURL ) { TealiumModule.initializeCustom( account, @@ -72,7 +73,8 @@ export default class Tealium { overridePublishSettingsURL, overrideTagManagementURL, collectURL, - enableConsentManager + enableConsentManager, + overrideCollectDispatchURL ); this.addRemoteCommandListener('RemoteCommandEvent'); } diff --git a/npm-package/ios/TealiumModule/TealiumModule.m b/npm-package/ios/TealiumModule/TealiumModule.m index c753fceb..6036f811 100644 --- a/npm-package/ios/TealiumModule/TealiumModule.m +++ b/npm-package/ios/TealiumModule/TealiumModule.m @@ -85,6 +85,7 @@ @implementation TealiumModule overrideTagManagementURL:(NSString *)overrideTagManagementURL collectURL:(BOOL)enableCollectURL enableConsentManager:(BOOL)enableConsentManager + overrideCollectDispatchURL:(NSString *)overrideCollectDispatchURL ) { // Set your account, profile, and environment TEALConfiguration *configuration = [TEALConfiguration configurationWithAccount:account @@ -99,6 +100,9 @@ @implementation TealiumModule if (overrideTagManagementURL) { configuration.overrideTagManagementURL = overrideTagManagementURL; } + if (overrideCollectDispatchURL) { + configuration.overrideCollectDispatchURL = overrideCollectDispatchURL; + } if (!enableCollectURL) { configuration.collectURL = TEALCollectURLVdata; } diff --git a/npm-package/package.json b/npm-package/package.json index a62386b8..70a87876 100644 --- a/npm-package/package.json +++ b/npm-package/package.json @@ -1,6 +1,6 @@ { "name": "tealium-react-native", - "version": "1.0.9", + "version": "1.0.10", "description": "A native module for using Tealium's Android and iOS libraries from a React Native app.", "main": "index.js", "types": "index.d.ts",