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
@@ -1,14 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>SchemeUserState</key>
6
- <dict>
7
- <key>RNMParticle.xcscheme_^#shared#^_</key>
8
- <dict>
9
- <key>orderHint</key>
10
- <integer>0</integer>
11
- </dict>
12
- </dict>
13
- </dict>
14
- </plist>
package/js/index.js DELETED
@@ -1,697 +0,0 @@
1
- 'use strict'
2
-
3
- import { NativeModules } from 'react-native'
4
-
5
- // ******** Constants ********
6
-
7
- const EventType = {
8
- Navigation: 1,
9
- Location: 2,
10
- Search: 3,
11
- Transaction: 4,
12
- UserContent: 5,
13
- UserPreference: 6,
14
- Social: 7,
15
- Other: 8,
16
- Media: 9
17
- }
18
-
19
- const UserAttributeType = {
20
- FirstName: '$FirstName',
21
- LastName: '$LastName',
22
- Address: '$Address',
23
- State: '$State',
24
- City: '$City',
25
- Zipcode: '$Zip',
26
- Country: '$Country',
27
- Age: '$Age',
28
- Gender: '$Gender',
29
- MobileNumber: '$Mobile'
30
- }
31
-
32
- const UserIdentityType = {
33
- Other: 0,
34
- CustomerId: 1,
35
- Facebook: 2,
36
- Twitter: 3,
37
- Google: 4,
38
- Microsoft: 5,
39
- Yahoo: 6,
40
- Email: 7,
41
- Alias: 8,
42
- FacebookCustomAudienceId: 9,
43
- Other2: 10,
44
- Other3: 11,
45
- Other4: 12,
46
- Other5: 13,
47
- Other6: 14,
48
- Other7: 15,
49
- Other8: 16,
50
- Other9: 17,
51
- Other10: 18,
52
- MobileNumber: 19,
53
- PhoneNumber2: 20,
54
- PhoneNumber3: 21,
55
- IOSAdvertiserId: 22,
56
- IOSVendorId: 23,
57
- PushToken: 24,
58
- DeviceApplicationStamp: 25
59
- }
60
-
61
- const ProductActionType = {
62
- AddToCart: 1,
63
- RemoveFromCart: 2,
64
- Checkout: 3,
65
- CheckoutOption: 4,
66
- Click: 5,
67
- ViewDetail: 6,
68
- Purchase: 7,
69
- Refund: 8,
70
- AddToWishlist: 9,
71
- RemoveFromWishlist: 10
72
- }
73
-
74
- const PromotionActionType = {
75
- View: 0,
76
- Click: 1
77
- }
78
-
79
- const ATTAuthStatus = {
80
- NotDetermined: 0,
81
- Restricted: 1,
82
- Denied: 2,
83
- Authorized: 3
84
- }
85
-
86
- // ******** Main API ********
87
-
88
- const upload = () => {
89
- NativeModules.MParticle.upload()
90
- }
91
-
92
- const setUploadInterval = (uploadInterval) => {
93
- NativeModules.MParticle.setUploadInterval(uploadInterval)
94
- }
95
-
96
- const logEvent = (eventName, type = EventType.Other, attributes = null) => {
97
- NativeModules.MParticle.logEvent(eventName, type, attributes)
98
- }
99
-
100
- const logMPEvent = (event) => {
101
- NativeModules.MParticle.logMPEvent(event)
102
- }
103
-
104
- const logCommerceEvent = (commerceEvent) => {
105
- NativeModules.MParticle.logCommerceEvent(commerceEvent)
106
- }
107
-
108
- const logScreenEvent = (screenName, attributes = null, shouldUploadEvent = true) => {
109
- NativeModules.MParticle.logScreenEvent(screenName, attributes, shouldUploadEvent)
110
- }
111
-
112
- // Use ATTAuthStatus constants for status
113
- const setATTStatus = (status) => {
114
- NativeModules.MParticle.setATTStatus(status)
115
- }
116
-
117
- const setATTStatusWithCustomTimestamp = (status, timestamp) => {
118
- NativeModules.MParticle.setATTStatus(status, timestamp)
119
- }
120
-
121
- const setOptOut = (optOut) => {
122
- NativeModules.MParticle.setOptOut(optOut)
123
- }
124
-
125
- const getOptOut = (completion) => {
126
- NativeModules.MParticle.getOptOut(completion)
127
- }
128
-
129
- const addGDPRConsentState = (newConsentState, purpose) => {
130
- NativeModules.MParticle.addGDPRConsentState(newConsentState, purpose)
131
- }
132
-
133
- const removeGDPRConsentStateWithPurpose = (purpose) => {
134
- NativeModules.MParticle.removeGDPRConsentStateWithPurpose(purpose)
135
- }
136
-
137
- const setCCPAConsentState = (newConsentState) => {
138
- NativeModules.MParticle.setCCPAConsentState(newConsentState)
139
- }
140
-
141
- const removeCCPAConsentState = () => {
142
- NativeModules.MParticle.removeCCPAConsentState()
143
- }
144
-
145
- const isKitActive = (kitId, completion) => {
146
- NativeModules.MParticle.isKitActive(kitId, completion)
147
- }
148
-
149
- const getAttributions = (completion) => {
150
- NativeModules.MParticle.getAttributions(completion)
151
- }
152
-
153
- const logPushRegistration = (registrationField1, registrationField2) => {
154
- NativeModules.MParticle.logPushRegistration(registrationField1, registrationField2)
155
- }
156
-
157
- const getSession = (completion) => {
158
- NativeModules.MParticle.getSession(completion)
159
- }
160
-
161
- const setLocation = (latitude, longitude) => {
162
- NativeModules.MParticle.setLocation(latitude, longitude)
163
- }
164
-
165
- // ******** Identity ********
166
- class User {
167
- constructor (userId) {
168
- this.userId = userId
169
- }
170
-
171
- getMpid () {
172
- return this.userId
173
- }
174
-
175
- setUserAttribute (key, value) {
176
- if (value && value.constructor === Array) {
177
- NativeModules.MParticle.setUserAttributeArray(this.userId, key, value)
178
- } else {
179
- NativeModules.MParticle.setUserAttribute(this.userId, key, value)
180
- }
181
- }
182
-
183
- setUserAttributeArray (key, value) {
184
- NativeModules.MParticle.setUserAttributeArray(this.userId, key, value)
185
- }
186
-
187
- getUserAttributes (completion) {
188
- NativeModules.MParticle.getUserAttributes(this.userId, (error, userAttributes) => {
189
- if (error) {
190
- console.log(error.stack)
191
- }
192
- completion(userAttributes)
193
- })
194
- }
195
-
196
- setUserTag (value) {
197
- NativeModules.MParticle.setUserTag(this.userId, value)
198
- }
199
-
200
- incrementUserAttribute (key, value) {
201
- NativeModules.MParticle.incrementUserAttribute(this.userId, key, value)
202
- }
203
-
204
- removeUserAttribute (key) {
205
- NativeModules.MParticle.removeUserAttribute(this.userId, key)
206
- }
207
-
208
- getUserIdentities (completion) {
209
- NativeModules.MParticle.getUserIdentities(this.userId, (error, userIdentities) => {
210
- if (error) {
211
- console.log(error.stack)
212
- }
213
- completion(userIdentities)
214
- })
215
- }
216
-
217
- getFirstSeen (completion) {
218
- NativeModules.MParticle.getFirstSeen(this.userId, completion)
219
- }
220
-
221
- getLastSeen (completion) {
222
- NativeModules.MParticle.getLastSeen(this.userId, completion)
223
- }
224
- }
225
-
226
- class IdentityRequest {
227
-
228
- setEmail (email) {
229
- this[UserIdentityType.Email] = email
230
- return this
231
- }
232
-
233
- setCustomerID (customerId) {
234
- this[UserIdentityType.CustomerId] = customerId
235
- return this
236
- }
237
-
238
- setUserIdentity (userIdentity, identityType) {
239
- this[identityType] = userIdentity
240
- return this
241
- }
242
-
243
- setOnUserAlias (onUserAlias) {
244
- console.log("Warning: deprecated method 'setUserAlias(onUserAlias)', will be removed in future releases")
245
- }
246
- }
247
-
248
- class Identity {
249
-
250
- static getCurrentUser (completion) {
251
- NativeModules.MParticle.getCurrentUserWithCompletion((error, userId) => {
252
- if (error) {
253
- console.log(error.stack)
254
- }
255
- var currentUser = new User(userId)
256
- completion(currentUser)
257
- })
258
- }
259
-
260
- static identify (IdentityRequest, completion) {
261
- NativeModules.MParticle.identify(IdentityRequest, (error, userId, previousUserId) => {
262
- if (error == null || error === undefined) {
263
- completion(error, userId, previousUserId)
264
- } else {
265
- var parsedError = new MParticleError(error)
266
- completion(parsedError, userId, previousUserId)
267
- }
268
- })
269
- }
270
-
271
- static login (IdentityRequest, completion) {
272
- NativeModules.MParticle.login(IdentityRequest, (error, userId, previousUserId) => {
273
- if (error == null || error === undefined) {
274
- completion(error, userId, previousUserId)
275
- } else {
276
- var parsedError = new MParticleError(error)
277
- completion(parsedError, userId, previousUserId)
278
- }
279
- })
280
- }
281
-
282
- static logout (IdentityRequest, completion) {
283
- NativeModules.MParticle.logout(IdentityRequest, (error, userId, previousUserId) => {
284
- if (error == null || error === undefined) {
285
- completion(error, userId, previousUserId)
286
- } else {
287
- var parsedError = new MParticleError(error)
288
- completion(parsedError, userId, previousUserId)
289
- }
290
- })
291
- }
292
-
293
- static modify (IdentityRequest, completion) {
294
- NativeModules.MParticle.modify(IdentityRequest, (error, userId, previousUserId) => {
295
- if (error == null || error === undefined) {
296
- completion(error, userId, previousUserId)
297
- } else {
298
- var parsedError = new MParticleError(error)
299
- completion(parsedError, userId, previousUserId)
300
- }
301
- })
302
- }
303
-
304
- static aliasUsers (AliasRequest, completion) {
305
- NativeModules.MParticle.aliasUsers(AliasRequest, completion)
306
- }
307
-
308
- }
309
-
310
- // ******** Commerce ********
311
-
312
- class Impression {
313
- constructor (impressionListName, products) {
314
- this.impressionListName = impressionListName
315
- this.products = products
316
- }
317
- }
318
-
319
- class Promotion {
320
- constructor (id, name, creative, position) {
321
- this.id = id
322
- this.name = name
323
- this.creative = creative
324
- this.position = position
325
- }
326
- }
327
-
328
- class AliasRequest {
329
-
330
- sourceMpid (mpid) {
331
- this.sourceMpid = mpid
332
- return this
333
- }
334
-
335
- destinationMpid (mpid) {
336
- this.destinationMpid = mpid
337
- return this
338
- }
339
-
340
- endTime (mpid) {
341
- this.endTime = mpid
342
- return this
343
- }
344
-
345
- startTime (mpid) {
346
- this.startTime = mpid
347
- return this
348
- }
349
- }
350
-
351
- class TransactionAttributes {
352
- constructor (transactionId) {
353
- this.transactionId = transactionId
354
- }
355
-
356
- setAffiliation (affiliation) {
357
- this.affiliation = affiliation
358
- return this
359
- }
360
-
361
- setRevenue (revenue) {
362
- this.revenue = typeof revenue === 'string' ? parseFloat(revenue) : revenue
363
- return this
364
- }
365
-
366
- setShipping (shipping) {
367
- this.shipping = typeof shipping === 'string' ? parseFloat(shipping) : shipping
368
- return this
369
- }
370
-
371
- setTax (tax) {
372
- this.tax = typeof tax === 'string' ? parseFloat(tax) : tax
373
- return this
374
- }
375
-
376
- setCouponCode (couponCode) {
377
- this.couponCode = couponCode
378
- return this
379
- }
380
- }
381
-
382
- class Product {
383
- constructor (name, sku, price, quantity = 1) {
384
- this.name = name
385
- this.sku = sku
386
- this.price = price
387
- this.quantity = quantity
388
- }
389
-
390
- setBrand (brand) {
391
- this.brand = brand
392
- return this
393
- }
394
-
395
- setCouponCode (couponCode) {
396
- this.couponCode = couponCode
397
- return this
398
- }
399
-
400
- setPosition (position) {
401
- this.position = position
402
- return this
403
- }
404
-
405
- setCategory (category) {
406
- this.category = category
407
- return this
408
- }
409
-
410
- setVariant (variant) {
411
- this.variant = variant
412
- return this
413
- }
414
-
415
- setCustomAttributes (customAttributes) {
416
- this.customAttributes = customAttributes
417
- return this
418
- }
419
- }
420
-
421
- class GDPRConsent {
422
-
423
- constructor (consented, doc, timestamp, location, hardwareId) {
424
- this.consented = consented
425
- this.document = doc
426
- this.timestamp = timestamp
427
- this.location = location
428
- this.hardwareId = hardwareId
429
- }
430
-
431
- setConsented (consented) {
432
- this.consented = consented
433
- return this
434
- }
435
-
436
- setDocument (doc) {
437
- this.document = doc
438
- return this
439
- }
440
-
441
- setTimestamp (timestamp) {
442
- this.timestamp = timestamp
443
- return this
444
- }
445
-
446
- setLocation (location) {
447
- this.location = location
448
- return this
449
- }
450
-
451
- setHardwareId (hardwareId) {
452
- this.hardwareId = hardwareId
453
- return this
454
- }
455
- }
456
-
457
- class CCPAConsent {
458
-
459
- constructor (consented, doc, timestamp, location, hardwareId) {
460
- this.consented = consented
461
- this.document = doc
462
- this.timestamp = timestamp
463
- this.location = location
464
- this.hardwareId = hardwareId
465
- }
466
-
467
- setConsented (consented) {
468
- this.consented = consented
469
- return this
470
- }
471
-
472
- setDocument (doc) {
473
- this.document = doc
474
- return this
475
- }
476
-
477
- setTimestamp (timestamp) {
478
- this.timestamp = timestamp
479
- return this
480
- }
481
-
482
- setLocation (location) {
483
- this.location = location
484
- return this
485
- }
486
-
487
- setHardwareId (hardwareId) {
488
- this.hardwareId = hardwareId
489
- return this
490
- }
491
- }
492
-
493
- class CommerceEvent {
494
-
495
- static createProductActionEvent (productActionType, products, transactionAttributes = {}) {
496
- return new CommerceEvent()
497
- .setProductActionType(productActionType)
498
- .setProducts(products)
499
- .setTransactionAttributes(transactionAttributes)
500
- }
501
-
502
- static createPromotionEvent (promotionActionType, promotions) {
503
- return new CommerceEvent()
504
- .setPromotionActionType(promotionActionType)
505
- .setPromotions(promotions)
506
- }
507
-
508
- static createImpressionEvent (impressions) {
509
- return new CommerceEvent()
510
- .setImpressions(impressions)
511
- }
512
-
513
- setTransactionAttributes (transactionAttributes) {
514
- this.transactionAttributes = transactionAttributes
515
- return this
516
- }
517
-
518
- setProductActionType (productActionType) {
519
- this.productActionType = productActionType
520
- return this
521
- }
522
-
523
- setPromotionActionType (promotionActionType) {
524
- this.promotionActionType = promotionActionType
525
- return this
526
- }
527
-
528
- setProducts (products) {
529
- this.products = products
530
- return this
531
- }
532
-
533
- setPromotions (promotions) {
534
- this.promotions = promotions
535
- return this
536
- }
537
-
538
- setImpressions (impressions) {
539
- this.impressions = impressions
540
- return this
541
- }
542
-
543
- setScreenName (screenName) {
544
- this.screenName = screenName
545
- return this
546
- }
547
-
548
- setCurrency (currency) {
549
- this.currency = currency
550
- return this
551
- }
552
-
553
- setCustomAttributes (customAttributes) {
554
- this.customAttributes = customAttributes
555
- return this
556
- }
557
-
558
- setCheckoutOptions (checkoutOptions) {
559
- this.checkoutOptions = checkoutOptions
560
- return this
561
- }
562
-
563
- setProductActionListName (productActionListName) {
564
- this.productActionListName = productActionListName
565
- return this
566
- }
567
-
568
- setProductActionListSource (productActionListSource) {
569
- this.productActionListSource = productActionListSource
570
- return this
571
- }
572
-
573
- setCheckoutStep (checkoutStep) {
574
- this.checkoutStep = checkoutStep
575
- return this
576
- }
577
-
578
- setNonInteractive (nonInteractive) {
579
- this.nonInteractive = nonInteractive
580
- return this
581
- }
582
-
583
- setShouldUploadEvent (shouldUploadEvent) {
584
- this.shouldUploadEvent = shouldUploadEvent
585
- return this
586
- }
587
- }
588
-
589
- class Event {
590
-
591
- setCategory (category) {
592
- this.category = category
593
- return this
594
- }
595
-
596
- setDuration (duration) {
597
- this.duration = duration
598
- return this
599
- }
600
-
601
- setEndTime (endTime) {
602
- this.endTime = endTime
603
- return this
604
- }
605
-
606
- setInfo (info) {
607
- this.info = info
608
- return this
609
- }
610
-
611
- setName (name) {
612
- this.name = name
613
- return this
614
- }
615
-
616
- setStartTime (startTime) {
617
- this.startTime = startTime
618
- return this
619
- }
620
-
621
- setType (type) {
622
- this.type = type
623
- return this
624
- }
625
-
626
- setShouldUploadEvent (shouldUploadEvent) {
627
- this.shouldUploadEvent = shouldUploadEvent
628
- return this
629
- }
630
-
631
- setCustomFlags (customFlags) {
632
- this.customFlags = customFlags
633
- return this
634
- }
635
- }
636
-
637
- class MParticleError {
638
- constructor (errorResponse) {
639
- this.httpCode = errorResponse.httpCode
640
-
641
- this.responseCode = errorResponse.responseCode
642
-
643
- this.message = errorResponse.message
644
-
645
- this.mpid = errorResponse.mpid
646
-
647
- this.errors = errorResponse.errors
648
- }
649
- }
650
-
651
- // ******** Exports ********
652
-
653
- const MParticle = {
654
-
655
- EventType, // Constants
656
- UserIdentityType,
657
- UserAttributeType,
658
- ProductActionType,
659
- PromotionActionType,
660
- ATTAuthStatus,
661
-
662
- Product, // Classes
663
- Impression,
664
- Promotion,
665
- CommerceEvent,
666
- TransactionAttributes,
667
- IdentityRequest,
668
- AliasRequest,
669
- Identity,
670
- User,
671
- Event,
672
- MParticleError,
673
- GDPRConsent,
674
- CCPAConsent,
675
-
676
- upload, // Methods
677
- setUploadInterval,
678
- logEvent,
679
- logMPEvent,
680
- logCommerceEvent,
681
- logScreenEvent,
682
- setATTStatus,
683
- setATTStatusWithCustomTimestamp,
684
- setOptOut,
685
- getOptOut,
686
- addGDPRConsentState,
687
- removeGDPRConsentStateWithPurpose,
688
- setCCPAConsentState,
689
- removeCCPAConsentState,
690
- isKitActive,
691
- getAttributions,
692
- logPushRegistration,
693
- getSession,
694
- setLocation
695
- }
696
-
697
- export default MParticle
package/release.sh DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env bash
2
- : ${1?"NPM Token missing- usage: $0 {MY_NPM_TOKEN}"}
3
-
4
- touch .npmrc;
5
- echo "//registry.npmjs.org/:_authToken=$1" > .npmrc;
6
- npm publish;