react-native-mparticle 2.7.12 → 2.8.0

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.
Files changed (177) hide show
  1. package/SECURITY.md +9 -0
  2. package/android/build.gradle +65 -10
  3. package/android/src/main/AndroidManifestNew.xml +3 -0
  4. package/android/src/main/java/com/mparticle/react/MParticleModule.kt +976 -0
  5. package/android/src/main/java/com/mparticle/react/MParticlePackage.kt +68 -0
  6. package/android/src/main/java/com/mparticle/react/rokt/MPRoktModuleImpl.kt +251 -0
  7. package/android/src/main/java/com/mparticle/react/rokt/RoktLayoutViewManagerImpl.kt +79 -0
  8. package/android/src/newarch/java/com/mparticle/react/rokt/MPRoktModule.kt +130 -0
  9. package/android/src/newarch/java/com/mparticle/react/rokt/RoktLayoutViewManager.kt +22 -0
  10. package/android/src/oldarch/java/com/mparticle/react/NativeMPRoktSpec.kt +29 -0
  11. package/android/src/oldarch/java/com/mparticle/react/NativeMParticleSpec.kt +153 -0
  12. package/android/src/oldarch/java/com/mparticle/react/rokt/MPRoktModule.kt +79 -0
  13. package/android/src/oldarch/java/com/mparticle/react/rokt/RoktLayoutViewManager.kt +34 -0
  14. package/ios/RNMParticle/RNMPRokt.h +15 -0
  15. package/ios/RNMParticle/RNMPRokt.mm +247 -0
  16. package/ios/RNMParticle/RNMParticle.h +6 -1
  17. package/ios/RNMParticle/RNMParticle.mm +1199 -0
  18. package/ios/RNMParticle/RoktEventManager.h +16 -0
  19. package/ios/RNMParticle/RoktEventManager.m +174 -0
  20. package/ios/RNMParticle/RoktLayoutManager.m +22 -0
  21. package/ios/RNMParticle/RoktNativeLayoutComponentView.h +18 -0
  22. package/ios/RNMParticle/RoktNativeLayoutComponentView.mm +50 -0
  23. package/ios/RNMParticle.xcodeproj/project.pbxproj +29 -6
  24. package/js/codegenSpecs/NativeMParticle.ts +214 -0
  25. package/js/codegenSpecs/rokt/NativeMPRokt.ts +32 -0
  26. package/js/codegenSpecs/rokt/RoktLayoutNativeComponent.ts +29 -0
  27. package/js/index.tsx +940 -0
  28. package/js/rokt/rokt-layout-view.android.tsx +133 -0
  29. package/js/rokt/rokt-layout-view.ios.tsx +121 -0
  30. package/js/rokt/rokt-layout-view.tsx +15 -0
  31. package/js/rokt/rokt.ts +87 -0
  32. package/js/utils/architecture.ts +22 -0
  33. package/lib/codegenSpecs/NativeMParticle.d.ts +148 -0
  34. package/lib/codegenSpecs/NativeMParticle.js +5 -0
  35. package/lib/codegenSpecs/NativeMParticle.js.map +1 -0
  36. package/lib/codegenSpecs/rokt/NativeMPRokt.d.ts +24 -0
  37. package/lib/codegenSpecs/rokt/NativeMPRokt.js +5 -0
  38. package/lib/codegenSpecs/rokt/NativeMPRokt.js.map +1 -0
  39. package/lib/codegenSpecs/rokt/RoktLayoutNativeComponent.d.ts +18 -0
  40. package/lib/codegenSpecs/rokt/RoktLayoutNativeComponent.js +8 -0
  41. package/lib/codegenSpecs/rokt/RoktLayoutNativeComponent.js.map +1 -0
  42. package/lib/index.d.ts +410 -0
  43. package/lib/index.js +645 -0
  44. package/lib/index.js.map +1 -0
  45. package/lib/rokt/rokt-layout-view.android.d.ts +39 -0
  46. package/lib/rokt/rokt-layout-view.android.js +109 -0
  47. package/lib/rokt/rokt-layout-view.android.js.map +1 -0
  48. package/lib/rokt/rokt-layout-view.d.ts +5 -0
  49. package/lib/rokt/rokt-layout-view.ios.d.ts +32 -0
  50. package/lib/rokt/rokt-layout-view.ios.js +84 -0
  51. package/lib/rokt/rokt-layout-view.ios.js.map +1 -0
  52. package/lib/rokt/rokt-layout-view.js +12 -0
  53. package/lib/rokt/rokt-layout-view.js.map +1 -0
  54. package/lib/rokt/rokt.d.ts +40 -0
  55. package/lib/rokt/rokt.js +54 -0
  56. package/lib/rokt/rokt.js.map +1 -0
  57. package/lib/utils/architecture.d.ts +9 -0
  58. package/lib/utils/architecture.js +19 -0
  59. package/lib/utils/architecture.js.map +1 -0
  60. package/package.json +32 -10
  61. package/react-native-mparticle.podspec +7 -6
  62. package/.github/PULL_REQUEST_TEMPLATE.md +0 -8
  63. package/.github/dependabot.yml +0 -12
  64. package/.github/workflows/daily.yml +0 -19
  65. package/.github/workflows/dependabot-automerge.yml +0 -12
  66. package/.github/workflows/pull-request.yml +0 -60
  67. package/.github/workflows/release.yml +0 -60
  68. package/.github/workflows/sonarcloud.yml +0 -16
  69. package/android/.classpath +0 -6
  70. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  71. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  72. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  73. package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  74. package/android/.gradle/7.5.1/dependencies-accessors/gc.properties +0 -0
  75. package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  76. package/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  77. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  78. package/android/.gradle/7.5.1/gc.properties +0 -0
  79. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  80. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  81. package/android/.gradle/vcs-1/gc.properties +0 -0
  82. package/android/.project +0 -34
  83. package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
  84. package/android/.settings/org.eclipse.jdt.core.prefs +0 -4
  85. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  86. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  87. package/android/gradle.properties +0 -53
  88. package/android/gradlew +0 -160
  89. package/android/gradlew.bat +0 -90
  90. package/android/libs/java-json.jar +0 -0
  91. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug-sources.jar +0 -0
  92. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug-sources.jar.md5 +0 -1
  93. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug-sources.jar.sha1 +0 -1
  94. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug-sources.jar.sha256 +0 -1
  95. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug-sources.jar.sha512 +0 -1
  96. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug.aar +0 -0
  97. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug.aar.md5 +0 -1
  98. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug.aar.sha1 +0 -1
  99. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug.aar.sha256 +0 -1
  100. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-debug.aar.sha512 +0 -1
  101. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release-sources.jar +0 -0
  102. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release-sources.jar.md5 +0 -1
  103. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release-sources.jar.sha1 +0 -1
  104. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release-sources.jar.sha256 +0 -1
  105. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release-sources.jar.sha512 +0 -1
  106. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release.aar +0 -0
  107. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release.aar.md5 +0 -1
  108. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release.aar.sha1 +0 -1
  109. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release.aar.sha256 +0 -1
  110. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5-release.aar.sha512 +0 -1
  111. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.module +0 -204
  112. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.module.md5 +0 -1
  113. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.module.sha1 +0 -1
  114. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.module.sha256 +0 -1
  115. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.module.sha512 +0 -1
  116. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.pom +0 -44
  117. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.pom.md5 +0 -1
  118. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.pom.sha1 +0 -1
  119. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.pom.sha256 +0 -1
  120. package/android/libs/react-native-android/com/facebook/react/hermes-engine/0.70.5/hermes-engine-0.70.5.pom.sha512 +0 -1
  121. package/android/libs/react-native-android/com/facebook/react/hermes-engine/maven-metadata.xml +0 -13
  122. package/android/libs/react-native-android/com/facebook/react/hermes-engine/maven-metadata.xml.md5 +0 -1
  123. package/android/libs/react-native-android/com/facebook/react/hermes-engine/maven-metadata.xml.sha1 +0 -1
  124. package/android/libs/react-native-android/com/facebook/react/hermes-engine/maven-metadata.xml.sha256 +0 -1
  125. package/android/libs/react-native-android/com/facebook/react/hermes-engine/maven-metadata.xml.sha512 +0 -1
  126. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug-sources.jar +0 -0
  127. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug-sources.jar.md5 +0 -1
  128. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug-sources.jar.sha1 +0 -1
  129. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug-sources.jar.sha256 +0 -1
  130. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug-sources.jar.sha512 +0 -1
  131. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug.aar +0 -0
  132. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug.aar.md5 +0 -1
  133. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug.aar.sha1 +0 -1
  134. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug.aar.sha256 +0 -1
  135. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-debug.aar.sha512 +0 -1
  136. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release-sources.jar +0 -0
  137. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release-sources.jar.md5 +0 -1
  138. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release-sources.jar.sha1 +0 -1
  139. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release-sources.jar.sha256 +0 -1
  140. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release-sources.jar.sha512 +0 -1
  141. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release.aar +0 -0
  142. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release.aar.md5 +0 -1
  143. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release.aar.sha1 +0 -1
  144. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release.aar.sha256 +0 -1
  145. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5-release.aar.sha512 +0 -1
  146. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.module +0 -628
  147. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.module.md5 +0 -1
  148. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.module.sha1 +0 -1
  149. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.module.sha256 +0 -1
  150. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.module.sha512 +0 -1
  151. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.pom +0 -156
  152. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.pom.md5 +0 -1
  153. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.pom.sha1 +0 -1
  154. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.pom.sha256 +0 -1
  155. package/android/libs/react-native-android/com/facebook/react/react-native/0.70.5/react-native-0.70.5.pom.sha512 +0 -1
  156. package/android/libs/react-native-android/com/facebook/react/react-native/maven-metadata.xml +0 -13
  157. package/android/libs/react-native-android/com/facebook/react/react-native/maven-metadata.xml.md5 +0 -1
  158. package/android/libs/react-native-android/com/facebook/react/react-native/maven-metadata.xml.sha1 +0 -1
  159. package/android/libs/react-native-android/com/facebook/react/react-native/maven-metadata.xml.sha256 +0 -1
  160. package/android/libs/react-native-android/com/facebook/react/react-native/maven-metadata.xml.sha512 +0 -1
  161. package/android/src/main/java/com/mparticle/react/MParticleModule.java +0 -987
  162. package/android/src/main/java/com/mparticle/react/MParticlePackage.java +0 -34
  163. package/android/src/test/java/com/mparticle/react/IdentityApiTest.java +0 -230
  164. package/android/src/test/java/com/mparticle/react/MParticleUserTest.java +0 -233
  165. package/android/src/test/java/com/mparticle/react/testutils/MockMParticleUser.java +0 -103
  166. package/android/src/test/java/com/mparticle/react/testutils/MockMap.java +0 -169
  167. package/android/src/test/java/com/mparticle/react/testutils/MockReadableArray.java +0 -53
  168. package/android/src/test/java/com/mparticle/react/testutils/MockWritableMap.java +0 -4
  169. package/android/src/test/java/com/mparticle/react/testutils/Mutable.java +0 -13
  170. package/ios/RNMParticle/RNMParticle.m +0 -671
  171. package/ios/RNMParticle.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  172. package/ios/RNMParticle.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  173. package/ios/RNMParticle.xcodeproj/project.xcworkspace/xcuserdata/bstalnaker.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  174. package/ios/RNMParticle.xcodeproj/xcuserdata/bstalnaker.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
  175. package/ios/RNMParticle.xcodeproj/xcuserdata/bstalnaker.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
  176. package/js/index.js +0 -697
  177. package/release.sh +0 -6
@@ -0,0 +1,133 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import React, { Component } from 'react';
3
+ import RoktNativeLayoutComponent from '../codegenSpecs/rokt/RoktLayoutNativeComponent';
4
+
5
+ /**
6
+ * PUBLIC API: Props that users of RoktLayoutView can set
7
+ */
8
+ export interface RoktLayoutViewProps {
9
+ // Placeholder name to use
10
+ placeholderName: string;
11
+ }
12
+
13
+ /**
14
+ * INTERNAL: State managed by the component to handle native events
15
+ */
16
+ export interface RoktLayoutViewState {
17
+ height: number;
18
+ placeholderName: string;
19
+ marginTop: number;
20
+ marginRight: number;
21
+ marginLeft: number;
22
+ marginBottom: number;
23
+ }
24
+
25
+ /**
26
+ * Native event types for type safety
27
+ */
28
+ interface HeightChangedEvent {
29
+ nativeEvent: {
30
+ height: string;
31
+ };
32
+ }
33
+
34
+ interface MarginChangedEvent {
35
+ nativeEvent: {
36
+ marginTop?: string;
37
+ marginLeft?: string;
38
+ marginRight?: string;
39
+ marginBottom?: string;
40
+ };
41
+ }
42
+
43
+ const styles = StyleSheet.create({
44
+ widget: {
45
+ flex: 1,
46
+ backgroundColor: 'transparent',
47
+ },
48
+ });
49
+
50
+ /**
51
+ * RoktEmbeddedView is a wrapper component for the native RoktNativeWidget.
52
+ * It handles the native events internally and provides a simpler API for React Native apps.
53
+ *
54
+ * This component only exposes the placeholderName prop to users, hiding all the internal complexity.
55
+ */
56
+ export class RoktLayoutView extends Component<
57
+ RoktLayoutViewProps,
58
+ RoktLayoutViewState
59
+ > {
60
+ constructor(props: RoktLayoutViewProps) {
61
+ super(props);
62
+ this.state = {
63
+ height: 0,
64
+ placeholderName: this.props.placeholderName,
65
+ marginTop: 0,
66
+ marginRight: 0,
67
+ marginLeft: 0,
68
+ marginBottom: 0,
69
+ };
70
+ }
71
+
72
+ /**
73
+ * Handles the height changed event from the native component
74
+ * This is an internal implementation detail not exposed to users
75
+ */
76
+ private handleHeightChanged = (event: HeightChangedEvent) => {
77
+ if (event && event.nativeEvent && event.nativeEvent.height) {
78
+ this.setState({ height: parseInt(event.nativeEvent.height) });
79
+ }
80
+ };
81
+
82
+ /**
83
+ * Handles the margin changed event from the native component
84
+ * This is an internal implementation detail not exposed to users
85
+ */
86
+ private handleMarginChanged = (event: MarginChangedEvent) => {
87
+ if (event && event.nativeEvent) {
88
+ const { marginTop, marginLeft, marginRight, marginBottom } =
89
+ event.nativeEvent;
90
+ this.setState({
91
+ marginTop: parseInt(marginTop || '0'),
92
+ marginLeft: parseInt(marginLeft || '0'),
93
+ marginRight: parseInt(marginRight || '0'),
94
+ marginBottom: parseInt(marginBottom || '0'),
95
+ });
96
+ }
97
+ };
98
+
99
+ override render() {
100
+ try {
101
+ // Get the placeholderName from props
102
+ const { placeholderName } = this.props;
103
+
104
+ // Return the native component with the props
105
+ // Cast to React.ComponentType to make it compatible with JSX
106
+ const RoktComponent =
107
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
108
+ RoktNativeLayoutComponent as React.ComponentType<any>;
109
+ return (
110
+ <RoktComponent
111
+ placeholderName={placeholderName}
112
+ style={[
113
+ styles.widget,
114
+ {
115
+ height: this.state.height,
116
+ marginTop: this.state.marginTop,
117
+ marginLeft: this.state.marginLeft,
118
+ marginRight: this.state.marginRight,
119
+ marginBottom: this.state.marginBottom,
120
+ },
121
+ ]}
122
+ onLayoutHeightChanged={this.handleHeightChanged}
123
+ onLayoutMarginChanged={this.handleMarginChanged}
124
+ />
125
+ );
126
+ } catch (error) {
127
+ console.error('[ROKT] Error rendering RoktEmbeddedView:', error);
128
+ return null;
129
+ }
130
+ }
131
+ }
132
+
133
+ export default RoktLayoutView;
@@ -0,0 +1,121 @@
1
+ import {
2
+ requireNativeComponent,
3
+ StyleSheet,
4
+ NativeEventEmitter,
5
+ NativeModules,
6
+ ViewProps,
7
+ NativeModule,
8
+ } from 'react-native';
9
+ import React, { Component } from 'react';
10
+ import { isFabricEnabled } from '../utils/architecture';
11
+ import RoktLayoutNativeComponent from '../codegenSpecs/rokt/RoktLayoutNativeComponent';
12
+
13
+ const RoktEventManager = NativeModules.RoktEventManager as NativeModule;
14
+
15
+ export interface HeightChangedEvent extends Event {
16
+ height: string;
17
+ }
18
+
19
+ export interface MarginChangedEvent extends Event {
20
+ marginTop: string;
21
+ marginRight: string;
22
+ marginLeft: string;
23
+ marginBottom: string;
24
+ }
25
+
26
+ export interface WidgetChangeEvent {
27
+ selectedPlacement: string;
28
+ height: string;
29
+ }
30
+
31
+ export interface RoktLayoutViewProps {
32
+ placeholderName: string;
33
+ }
34
+
35
+ export interface RoktLayoutViewState {
36
+ height: number;
37
+ placeholderName: string;
38
+ marginTop: number;
39
+ marginRight: number;
40
+ marginLeft: number;
41
+ marginBottom: number;
42
+ }
43
+
44
+ // Define the native component props interface
45
+ interface RoktNativeLayoutProps extends ViewProps {
46
+ placeholderName?: string;
47
+ onLayoutHeightChanged?: (event: HeightChangedEvent) => void;
48
+ onLayoutMarginChanged?: (event: MarginChangedEvent) => void;
49
+ }
50
+
51
+ // Use the appropriate component based on architecture
52
+ const LayoutNativeComponent = (
53
+ isFabricEnabled
54
+ ? RoktLayoutNativeComponent
55
+ : requireNativeComponent<RoktNativeLayoutProps>('RoktLegacyLayout')
56
+ ) as any;
57
+
58
+ const eventManagerEmitter = new NativeEventEmitter(RoktEventManager);
59
+
60
+ export class RoktLayoutView extends Component<
61
+ RoktLayoutViewProps,
62
+ RoktLayoutViewState
63
+ > {
64
+ subscription = eventManagerEmitter.addListener(
65
+ 'LayoutHeightChanges',
66
+ (widgetChanges: WidgetChangeEvent) => {
67
+ if (widgetChanges.selectedPlacement == this.state.placeholderName) {
68
+ this.setState({ height: parseInt(widgetChanges.height) });
69
+ }
70
+ }
71
+ );
72
+
73
+ constructor(props: RoktLayoutViewProps) {
74
+ super(props);
75
+
76
+ this.state = {
77
+ height: 0,
78
+ placeholderName: this.props.placeholderName,
79
+ marginTop: 0,
80
+ marginRight: 0,
81
+ marginLeft: 0,
82
+ marginBottom: 0,
83
+ };
84
+ }
85
+
86
+ override render() {
87
+ return (
88
+ <LayoutNativeComponent
89
+ style={[styles.widget, { height: this.state.height }]}
90
+ placeholderName={this.state.placeholderName}
91
+ onLayoutHeightChanged={(event: HeightChangedEvent) => {
92
+ if (event.height) {
93
+ this.setState({ height: parseInt(event.height) });
94
+ }
95
+ }}
96
+ onLayoutMarginChanged={(event: MarginChangedEvent) => {
97
+ this.setState({
98
+ marginTop: parseInt(event.marginTop || '0'),
99
+ marginRight: parseInt(event.marginRight || '0'),
100
+ marginLeft: parseInt(event.marginLeft || '0'),
101
+ marginBottom: parseInt(event.marginBottom || '0'),
102
+ });
103
+ }}
104
+ />
105
+ );
106
+ }
107
+
108
+ override componentWillUnmount() {
109
+ this.subscription.remove();
110
+ }
111
+ }
112
+
113
+ const styles = StyleSheet.create({
114
+ widget: {
115
+ flex: 1,
116
+ backgroundColor: 'transparent',
117
+ overflow: 'hidden',
118
+ },
119
+ });
120
+
121
+ export default RoktLayoutView;
@@ -0,0 +1,15 @@
1
+ import { Platform } from 'react-native';
2
+
3
+ // Import both implementations
4
+ import { RoktLayoutView as RoktLayoutViewIOS } from './rokt-layout-view.ios';
5
+ import { RoktLayoutView as RoktLayoutViewAndroid } from './rokt-layout-view.android';
6
+
7
+ // Export types
8
+ export type { RoktLayoutViewProps } from './rokt-layout-view.ios';
9
+
10
+ // Export the appropriate component based on platform
11
+ export const RoktLayoutView =
12
+ Platform.OS === 'ios' ? RoktLayoutViewIOS : RoktLayoutViewAndroid;
13
+
14
+ // Default export
15
+ export default RoktLayoutView;
@@ -0,0 +1,87 @@
1
+ import { NativeModules } from 'react-native';
2
+ import { getNativeModule } from '../utils/architecture';
3
+ import type { Spec as NativeMPRoktInterface } from '../codegenSpecs/rokt/NativeMPRokt';
4
+
5
+ const MPRokt = getNativeModule<NativeMPRoktInterface>('RNMPRokt');
6
+
7
+ export abstract class Rokt {
8
+ /**
9
+ * Selects placements with a [identifier], [attributes], optional [placeholders], optional [roktConfig], and optional [fontFilePathMap].
10
+ *
11
+ * @param {string} identifier - The page identifier for the placement.
12
+ * @param {Record<string, string>} attributes - Attributes to be associated with the placement.
13
+ * @param {Record<string, number | null>} [placeholders] - Optional placeholders for dynamic content.
14
+ * @param {IRoktConfig} [roktConfig] - Optional configuration settings for Rokt.
15
+ * @param {Record<string, string>} [fontFilesMap] - Optional mapping of font files.
16
+ * @returns {Promise<void>} A promise that resolves when the placement request is sent.
17
+ */
18
+ static async selectPlacements(
19
+ identifier: string,
20
+ attributes: Record<string, string>,
21
+ placeholders?: Record<string, number | null>,
22
+ roktConfig?: IRoktConfig,
23
+ fontFilesMap?: Record<string, string>
24
+ ): Promise<void> {
25
+ MPRokt.selectPlacements(
26
+ identifier,
27
+ attributes,
28
+ placeholders,
29
+ roktConfig,
30
+ fontFilesMap
31
+ );
32
+ }
33
+
34
+ static async purchaseFinalized(
35
+ placementId: string,
36
+ catalogItemId: string,
37
+ success: boolean
38
+ ): Promise<void> {
39
+ MPRokt.purchaseFinalized(placementId, catalogItemId, success);
40
+ }
41
+
42
+ static createRoktConfig(colorMode?: ColorMode, cacheConfig?: CacheConfig) {
43
+ return new RoktConfig(colorMode ?? 'system', cacheConfig);
44
+ }
45
+
46
+ static createCacheConfig(
47
+ cacheDurationInSeconds: number,
48
+ cacheAttributes: Record<string, string>
49
+ ) {
50
+ return new CacheConfig(cacheDurationInSeconds, cacheAttributes);
51
+ }
52
+ }
53
+
54
+ // Define the interface that matches the native module for cleaner code
55
+ export interface IRoktConfig {
56
+ readonly colorMode?: ColorMode;
57
+ readonly cacheConfig?: CacheConfig;
58
+ }
59
+
60
+ /**
61
+ * Cache configuration for Rokt SDK
62
+ */
63
+ export class CacheConfig {
64
+ /**
65
+ * @param cacheDurationInSeconds - The duration in seconds for which the Rokt SDK should cache the experience. Default is 90 minutes
66
+ * @param cacheAttributes - optional attributes to be used as cache key. If null, all the attributes will be used as the cache key
67
+ */
68
+ constructor(
69
+ public readonly cacheDurationInSeconds?: number,
70
+ public readonly cacheAttributes?: Record<string, string>
71
+ ) {}
72
+ }
73
+
74
+ class RoktConfig implements IRoktConfig {
75
+ public readonly colorMode: ColorMode;
76
+ public readonly cacheConfig?: CacheConfig;
77
+
78
+ constructor(colorMode: ColorMode, cacheConfig?: CacheConfig) {
79
+ this.colorMode = colorMode;
80
+ this.cacheConfig = cacheConfig;
81
+ }
82
+ }
83
+ const { RoktEventManager } = NativeModules;
84
+
85
+ export { RoktEventManager };
86
+
87
+ export type ColorMode = 'light' | 'dark' | 'system';
@@ -0,0 +1,22 @@
1
+ import { NativeModules, TurboModuleRegistry, TurboModule } from 'react-native';
2
+
3
+ declare const global: {
4
+ __turboModuleProxy: unknown;
5
+ nativeFabricUIManager: unknown;
6
+ };
7
+
8
+ export const isNewArchitecture = global.__turboModuleProxy != null;
9
+
10
+ export const isFabricEnabled = global.nativeFabricUIManager != null;
11
+
12
+ /**
13
+ * Gets the native module for both old and new architectures
14
+ * @param moduleName The name of the module
15
+ * @returns The native module
16
+ */
17
+ export function getNativeModule<T extends TurboModule>(moduleName: string): T {
18
+ if (isNewArchitecture) {
19
+ return TurboModuleRegistry.getEnforcing<T>(moduleName);
20
+ }
21
+ return NativeModules[moduleName] as T;
22
+ }
@@ -0,0 +1,148 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export type CustomAttributes = {
3
+ [key: string]: string | number | boolean;
4
+ };
5
+ export type UserAttributes = {
6
+ [key: string]: string | string[] | number | boolean | null;
7
+ };
8
+ export type UserIdentities = {
9
+ [key: string]: string;
10
+ };
11
+ export interface Product {
12
+ name: string;
13
+ sku: string;
14
+ price: number;
15
+ quantity?: number;
16
+ brand?: string;
17
+ couponCode?: string;
18
+ position?: number;
19
+ category?: string;
20
+ variant?: string;
21
+ customAttributes?: CustomAttributes;
22
+ }
23
+ export interface TransactionAttributes {
24
+ transactionId: string;
25
+ affiliation?: string;
26
+ revenue?: number;
27
+ shipping?: number;
28
+ tax?: number;
29
+ couponCode?: string;
30
+ }
31
+ export interface Promotion {
32
+ id: string;
33
+ name: string;
34
+ creative: string;
35
+ position: string;
36
+ }
37
+ export interface Impression {
38
+ impressionListName: string;
39
+ products: Product[];
40
+ }
41
+ export interface CommerceEvent {
42
+ productActionType?: number;
43
+ promotionActionType?: number;
44
+ products?: Product[];
45
+ transactionAttributes?: TransactionAttributes;
46
+ promotions?: Promotion[];
47
+ impressions?: Impression[];
48
+ screenName?: string;
49
+ currency?: string;
50
+ customAttributes?: CustomAttributes;
51
+ checkoutOptions?: string;
52
+ productActionListName?: string;
53
+ productActionListSource?: string;
54
+ checkoutStep?: number;
55
+ nonInteractive?: boolean;
56
+ shouldUploadEvent?: boolean;
57
+ }
58
+ export interface Event {
59
+ category?: string;
60
+ duration?: number;
61
+ endTime?: number;
62
+ info?: CustomAttributes;
63
+ name?: string;
64
+ startTime?: number;
65
+ type?: number;
66
+ shouldUploadEvent?: boolean;
67
+ customFlags?: {
68
+ [key: string]: string;
69
+ };
70
+ }
71
+ export interface GDPRConsent {
72
+ consented?: boolean;
73
+ document?: string | null;
74
+ timestamp?: number;
75
+ location?: string | null;
76
+ hardwareId?: string | null;
77
+ }
78
+ export interface CCPAConsent {
79
+ consented?: boolean;
80
+ document?: string | null;
81
+ timestamp?: number;
82
+ location?: string | null;
83
+ hardwareId?: string | null;
84
+ }
85
+ export type AttributionResult = {
86
+ [key: string]: {
87
+ [key: string]: string | number | boolean;
88
+ };
89
+ };
90
+ export interface CallbackError {
91
+ message: string;
92
+ code?: number;
93
+ httpCode?: number;
94
+ responseCode?: number;
95
+ mpid?: string;
96
+ errors?: string;
97
+ }
98
+ export type IdentityRequest = {
99
+ [key: number]: string;
100
+ };
101
+ export interface AliasRequest {
102
+ sourceMpid?: string;
103
+ destinationMpid?: string;
104
+ startTime?: number;
105
+ endTime?: number;
106
+ }
107
+ export interface IdentityResult {
108
+ userId: string;
109
+ previousUserId: string;
110
+ }
111
+ export interface Spec extends TurboModule {
112
+ upload(): void;
113
+ setUploadInterval(uploadInterval: number): void;
114
+ logEvent(eventName: string, eventType: number, attributes: CustomAttributes | null): void;
115
+ logMPEvent(event: Event): void;
116
+ logCommerceEvent(commerceEvent: CommerceEvent): void;
117
+ logScreenEvent(screenName: string, attributes: CustomAttributes | null, shouldUploadEvent: boolean): void;
118
+ setATTStatus(status: number): void;
119
+ setATTStatusWithCustomTimestamp(status: number, timestamp: number): void;
120
+ setOptOut(optOut: boolean): void;
121
+ getOptOut(callback: (result: boolean) => void): void;
122
+ addGDPRConsentState(consent: GDPRConsent, purpose: string): void;
123
+ removeGDPRConsentStateWithPurpose(purpose: string): void;
124
+ setCCPAConsentState(consent: CCPAConsent): void;
125
+ removeCCPAConsentState(): void;
126
+ isKitActive(kitId: number, callback: (result: boolean) => void): void;
127
+ getAttributions(callback: (result: AttributionResult) => void): void;
128
+ logPushRegistration(token: string, senderId: string): void;
129
+ getSession(callback: (result: string | null) => void): void;
130
+ setLocation(latitude: number, longitude: number): void;
131
+ setUserAttribute(mpid: string, key: string, value: string): void;
132
+ setUserAttributeArray(mpid: string, key: string, value: Array<string>): void;
133
+ getUserAttributes(mpid: string, callback: (error: CallbackError | null, result: UserAttributes | null) => void): void;
134
+ setUserTag(mpid: string, tag: string): void;
135
+ incrementUserAttribute(mpid: string, key: string, value: number): void;
136
+ removeUserAttribute(mpid: string, key: string): void;
137
+ getUserIdentities(mpid: string, callback: (error: CallbackError | null, result: UserIdentities | null) => void): void;
138
+ getFirstSeen(mpid: string, callback: (result: string) => void): void;
139
+ getLastSeen(mpid: string, callback: (result: string) => void): void;
140
+ getCurrentUserWithCompletion(callback: (error: CallbackError | null, userId: string | null) => void): void;
141
+ identify(identityRequest: IdentityRequest, callback: (error: CallbackError | null, userId: string | null, previousUserId: string | null) => void): void;
142
+ login(identityRequest: IdentityRequest, callback: (error: CallbackError | null, userId: string | null, previousUserId: string | null) => void): void;
143
+ logout(identityRequest: IdentityRequest, callback: (error: CallbackError | null, userId: string | null, previousUserId: string | null) => void): void;
144
+ modify(identityRequest: IdentityRequest, callback: (error: CallbackError | null, userId: string | null, previousUserId: string | null) => void): void;
145
+ aliasUsers(aliasRequest: AliasRequest, callback: (success: boolean, message?: string) => void): void;
146
+ }
147
+ declare const _default: Spec;
148
+ export default _default;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_native_1 = require("react-native");
4
+ exports.default = react_native_1.TurboModuleRegistry.getEnforcing('RNMParticle');
5
+ //# sourceMappingURL=NativeMParticle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeMParticle.js","sourceRoot":"","sources":["../../js/codegenSpecs/NativeMParticle.ts"],"names":[],"mappings":";;AACA,+CAAmD;AAoNnD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { TurboModule } from 'react-native';
2
+ type ColorMode = string;
3
+ type CacheConfig = {
4
+ readonly cacheDurationInSeconds?: number;
5
+ readonly cacheAttributes?: {
6
+ [key: string]: string;
7
+ };
8
+ };
9
+ type RoktConfigType = {
10
+ readonly colorMode?: ColorMode;
11
+ readonly cacheConfig?: CacheConfig;
12
+ };
13
+ export interface Spec extends TurboModule {
14
+ selectPlacements(identifier: string, attributes?: {
15
+ [key: string]: string;
16
+ }, placeholders?: {
17
+ [key: string]: number | null;
18
+ }, roktConfig?: RoktConfigType, fontFilesMap?: {
19
+ [key: string]: string;
20
+ }): void;
21
+ purchaseFinalized(placementId: string, catalogItemId: string, success: boolean): void;
22
+ }
23
+ declare const _default: Spec;
24
+ export default _default;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_native_1 = require("react-native");
4
+ exports.default = react_native_1.TurboModuleRegistry.getEnforcing('RNMPRokt');
5
+ //# sourceMappingURL=NativeMPRokt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeMPRokt.js","sourceRoot":"","sources":["../../../js/codegenSpecs/rokt/NativeMPRokt.ts"],"names":[],"mappings":";;AACA,+CAAmD;AA8BnD,kBAAe,kCAAmB,CAAC,YAAY,CAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
+ type HeightChangedEvent = {
4
+ height: string;
5
+ };
6
+ type MarginChangedEvent = {
7
+ marginTop: string;
8
+ marginRight: string;
9
+ marginLeft: string;
10
+ marginBottom: string;
11
+ };
12
+ export interface NativeProps extends ViewProps {
13
+ placeholderName: string;
14
+ onLayoutHeightChanged?: DirectEventHandler<HeightChangedEvent>;
15
+ onLayoutMarginChanged?: DirectEventHandler<MarginChangedEvent>;
16
+ }
17
+ declare const _default: HostComponent<NativeProps>;
18
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const codegenNativeComponent_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
7
+ exports.default = (0, codegenNativeComponent_1.default)('RoktNativeLayout');
8
+ //# sourceMappingURL=RoktLayoutNativeComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RoktLayoutNativeComponent.js","sourceRoot":"","sources":["../../../js/codegenSpecs/rokt/RoktLayoutNativeComponent.ts"],"names":[],"mappings":";;;;;AAEA,qHAA6F;AAwB7F,kBAAe,IAAA,gCAAsB,EACnC,kBAAkB,CACW,CAAC"}