Skip to content

Commit

Permalink
[MT-1589] Support for Moments API (#179)
Browse files Browse the repository at this point in the history
* Moments API: iOS complete, Android WIP

* Moments API: Android complete

* PR review updates: create EngineResponse type + align EngineResponse keys on both platforms

* Android fix: VisitorProfile/EngineResponse update to dates attribute

* VisiorProfile type definition + convertDateStringsToNumber mehtod name update

* PR fixes + increment core minor version

* VisitorProfile attribute type fixes

* Update VisitorProfile badge type

* MomentsApiConfig type correction

* Android: re-add package name to Manifest + move namespace under APG version check

* Update namespace check placement in build.gradle

* Update changelog entry
  • Loading branch information
tamayok authored Sep 30, 2024
1 parent 99d9f56 commit 03656fe
Show file tree
Hide file tree
Showing 27 changed files with 914 additions and 102 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

[Full documentation](https://docs.tealium.com/platforms/react-native/install/)

- 2.5.0
- Android fix: VisitorProfile dates now displayed as numerical timestamps instead of strings
- Added `VisitorProfile` type definition
- New module: MomentsAPI Module 1.0.0 added

- 2.4.2
- Android fix: added check during initialization to ensure only a single instance of Tealium is running. Pre-existing instances are shutdown.

Expand Down
52 changes: 47 additions & 5 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ import { checkAndRequestPermissions } from "./Utils"
// import { AuthState } from 'tealium-react-native-adobe-visitor/common';
import TealiumCrashReporter from 'tealium-react-native-crash-reporter';
import TealiumAttribution from 'tealium-react-native-attribution';
import AttributionConfig from 'tealium-react-native-attribution/common'
import AttributionConfig from 'tealium-react-native-attribution/common';
import TealiumMomentsApi from 'tealium-react-native-moments-api';
import { MomentsApiConfig, MomentsApiRegion} from 'tealium-react-native-moments-api/common';

export default class App extends Component<{}> {

Expand Down Expand Up @@ -63,6 +65,10 @@ export default class App extends Component<{}> {
iosSkAdConversionKeys: {"event": "conversion_value"}
}

let momentsApiConfig: MomentsApiConfig = {
momentsApiRegion: MomentsApiRegion.UsEast
}

// TealiumAdobeVisitor.configure(adobeVisitorConfig);
TealiumLocation.configure(locationConfig);
FirebaseRemoteCommand.initialize();
Expand All @@ -71,6 +77,7 @@ export default class App extends Component<{}> {
AppsFlyerRemoteCommand.initialize();
TealiumCrashReporter.initialize();
TealiumAttribution.configure(attributionConfig);
TealiumMomentsApi.configure(momentsApiConfig);

let config: TealiumConfig = {
account: 'tealiummobile',
Expand Down Expand Up @@ -126,12 +133,13 @@ export default class App extends Component<{}> {
});
});
Tealium.setVisitorServiceListener(profile => {
console.log("VisitorProfile: " + JSON.stringify(profile));
console.log("audiences: ");
console.log(JSON.stringify(profile["audiences"]));
console.log(JSON.stringify(profile.audiences));
console.log("tallies: ")
console.log(JSON.stringify(profile["tallies"]));
console.log(JSON.stringify(profile.tallies));
console.log("currentVisit: ")
console.log(JSON.stringify(profile["currentVisit"]));
console.log(JSON.stringify(profile.currentVisit));
});
Tealium.setVisitorIdListener(id => {
console.log("Visitor Id Updated: " + id);
Expand Down Expand Up @@ -303,6 +311,15 @@ export default class App extends Component<{}> {
});
}

fetchEngineResponse(id) {
TealiumMomentsApi.fetchEngineResponse(
id,
value => {
console.log("Engine Response data: " + JSON.stringify(value))
}
);
}

linkExistingAdobeVisitor (id, providerId, authState) {
TealiumAdobeVisitor.linkEcidToKnownIdentifier(
id, providerId, authState, value => {
Expand Down Expand Up @@ -444,6 +461,9 @@ export default class App extends Component<{}> {
<AdobeVisitor action={this.linkExistingAdobeVisitor} />
<TealiumButtonList actions={this.getButtonsForSection(Sections.AdobeVisitorService)} />
</Section>
<Section text={Sections.MomentsAPI}>
<MomentsAPI action={this.fetchEngineResponse} />
</Section>
<Section text={Sections.Misc}>
<TealiumButtonList actions={this.getButtonsForSection(Sections.Misc)} />
</Section>
Expand Down Expand Up @@ -475,7 +495,7 @@ const AdobeVisitor = (props) => {
const [inputAuthStateText, setAuthStateText] = useState()
return (
<View style={styles.inputContainer}>
<TextInput style={styles.input}
<TextInput style={styles.input}
textAlign={'center'}
underlineColorAndroid="transparent"
placeholder="ENTER KNOWN VISITOR ID"
Expand Down Expand Up @@ -510,6 +530,27 @@ const AdobeVisitor = (props) => {
)
}

const MomentsAPI = (props) => {
const [inputEngineIdIdText, setEngineIdText] = useState()
return (
<View style={styles.inputContainer}>
<TextInput style={styles.input}
textAlign={'center'}
underlineColorAndroid="transparent"
placeholder="ENTER MOMENTS API ENGINE ID"
placeholderTextColor="#007CC1"
autoCapitalize="none"
onChangeText={(id) => setEngineIdText(id)} />
<TealiumButton text="FETCH ENGINE RESPONSE" onPress={() => {
let id = inputEngineIdIdText;
if (id) {
props.action(id)
}
}} />
</View>
)
}

const ActionTextField = (props) => {
const [inputText, setInputText] = useState()

Expand Down Expand Up @@ -585,6 +626,7 @@ const Sections = {
DataLayer: "DataLayer",
RemoteCommand: "Remote Commands",
AdobeVisitorService: "Adobe Visitor Service",
MomentsAPI: "Moments API",
Misc: "Misc"
}

Expand Down
54 changes: 33 additions & 21 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ PODS:
- Adjust (4.38.4):
- Adjust/Core (= 4.38.4)
- Adjust/Core (4.38.4)
- AppsFlyerFramework (6.14.5):
- AppsFlyerFramework/Main (= 6.14.5)
- AppsFlyerFramework/Main (6.14.5)
- AppsFlyerFramework (6.15.2):
- AppsFlyerFramework/Main (= 6.15.2)
- AppsFlyerFramework/Main (6.15.2)
- boost (1.76.0)
- BrazeKit (9.3.1)
- DoubleConversion (1.1.6)
Expand Down Expand Up @@ -492,7 +492,13 @@ PODS:
- tealium-react-native-swift (~> 2.4)
- tealium-swift/Core (~> 2.12)
- TealiumFirebase (~> 3.2)
- tealium-react-native (2.4.2):
- tealium-react-moments-api (1.0.0):
- React-Core
- tealium-react-native (~> 2.4)
- tealium-react-native-swift (~> 2.4)
- tealium-swift/Core (~> 2.14)
- tealium-swift/MomentsAPI (~> 2.14)
- tealium-react-native (2.5.0):
- React-Core
- tealium-swift/Collect (~> 2.13)
- tealium-swift/Core (~> 2.13)
Expand All @@ -512,7 +518,7 @@ PODS:
- tealium-react-native-swift (~> 2.4)
- tealium-swift/Core (~> 2.12)
- tealium-swift/Location (~> 2.12)
- tealium-react-native-swift (2.4.2):
- tealium-react-native-swift (2.5.0):
- React-Core
- tealium-react-native
- tealium-swift/Collect (~> 2.13)
Expand All @@ -521,20 +527,22 @@ PODS:
- tealium-swift/RemoteCommands (~> 2.13)
- tealium-swift/TagManagement (~> 2.13)
- tealium-swift/VisitorService (~> 2.13)
- tealium-swift/Attribution (2.13.0):
- tealium-swift/Attribution (2.14.0):
- tealium-swift/Core
- tealium-swift/Collect (2.14.0):
- tealium-swift/Core
- tealium-swift/Collect (2.13.0):
- tealium-swift/Core (2.14.0)
- tealium-swift/Lifecycle (2.14.0):
- tealium-swift/Core
- tealium-swift/Core (2.13.0)
- tealium-swift/Lifecycle (2.13.0):
- tealium-swift/Location (2.14.0):
- tealium-swift/Core
- tealium-swift/Location (2.13.0):
- tealium-swift/MomentsAPI (2.14.0):
- tealium-swift/Core
- tealium-swift/RemoteCommands (2.13.0):
- tealium-swift/RemoteCommands (2.14.0):
- tealium-swift/Core
- tealium-swift/TagManagement (2.13.0):
- tealium-swift/TagManagement (2.14.0):
- tealium-swift/Core
- tealium-swift/VisitorService (2.13.0):
- tealium-swift/VisitorService (2.14.0):
- tealium-swift/Core
- TealiumAdjust (1.3.0):
- Adjust (~> 4.34)
Expand All @@ -555,11 +563,11 @@ PODS:
- TealiumCrashModule/Crash (2.5.0):
- PLCrashReporter (~> 1.11)
- tealium-swift/Core (~> 2.12)
- TealiumFirebase (3.2.0):
- TealiumFirebase (3.3.0):
- Firebase (~> 10.7)
- FirebaseAnalytics (~> 10.7)
- tealium-swift/Core (~> 2.12)
- tealium-swift/RemoteCommands (~> 2.12)
- tealium-swift/Core (~> 2.13)
- tealium-swift/RemoteCommands (~> 2.13)
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -608,6 +616,7 @@ DEPENDENCIES:
- tealium-react-attribution (from `../node_modules/tealium-react-native-attribution`)
- tealium-react-braze (from `../node_modules/tealium-react-braze`)
- tealium-react-firebase (from `../node_modules/tealium-react-firebase`)
- tealium-react-moments-api (from `../node_modules/tealium-react-native-moments-api`)
- tealium-react-native (from `../node_modules/tealium-react-native`)
- tealium-react-native-crash-reporter (from `../node_modules/tealium-react-native-crash-reporter`)
- tealium-react-native-location (from `../node_modules/tealium-react-native-location`)
Expand Down Expand Up @@ -726,6 +735,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/tealium-react-braze"
tealium-react-firebase:
:path: "../node_modules/tealium-react-firebase"
tealium-react-moments-api:
:path: "../node_modules/tealium-react-native-moments-api"
tealium-react-native:
:path: "../node_modules/tealium-react-native"
tealium-react-native-crash-reporter:
Expand All @@ -739,7 +750,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Adjust: afda46df69f035fd216310fb85f399c40c61830a
AppsFlyerFramework: 6bd90198428b9646a5653f8e0f19de529788b70e
AppsFlyerFramework: 3c6c50b7b3f0f37f648a5b23114940e0766e65e8
boost: 57d2868c099736d80fcd648bf211b4431e51a558
BrazeKit: 4da9eda353092104add9d3fcbb272afbd14dd3de
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
Expand Down Expand Up @@ -796,17 +807,18 @@ SPEC CHECKSUMS:
tealium-react-attribution: 5db8c4ccf60c0fea4790afc5a47537d4a198592c
tealium-react-braze: f72256073bf99902dbfbfcd875399cd0fac61796
tealium-react-firebase: 44bc3f5f8294a0f9fc2fba5ebd109bde31a141e5
tealium-react-native: c28c9edf54a59a261d910de52923cac338299d9a
tealium-react-moments-api: 34241abf796c723cdee660dd15dc7ff17ac41acb
tealium-react-native: 63c63a846552771b3c98e2b9fdfd85954864d1e6
tealium-react-native-crash-reporter: b6bbb018f2d3fc1c27a0423aca58c33820395d41
tealium-react-native-location: 7f275669c9434c0877e8ba20af06ac37c003657f
tealium-react-native-swift: a846102e391e9ae6fa3bd87331c078acf9d306d8
tealium-swift: f2a1d022bae58151c7ff31d2a063008cfe6463d8
tealium-react-native-swift: 6a5ec3a0297a38fd6f437935cbc2c34361bfdb0f
tealium-swift: d2a1f3ee12f3a0aa759ab43c07005b24148b6f75
TealiumAdjust: 7a8c033c93f5aaf306ebecaa2e575a5958e55e87
TealiumAdobeVisitorAPI: dd487f3e130829a15b9cdc7de7b2841a200214e2
TealiumAppsFlyer: 7736e28b06462c2fe2349040adce06a8ba6b27b1
TealiumBraze: af453e2758490a06ea463183a49fc9ec8bad9fc6
TealiumCrashModule: f52a33391a599e6b62983caff5432cd7e536104d
TealiumFirebase: b489c74d3a1d7d81ad806e4da4638be6ea9870b9
TealiumFirebase: 2afc11e00415f232672e3095e8dbd32c5af52fdc
Yoga: e7ea9e590e27460d28911403b894722354d73479

PODFILE CHECKSUM: 832c551ff313519d4cfb80ad52278076f6e41133
Expand Down
Loading

0 comments on commit 03656fe

Please sign in to comment.