@momo-kits/native-kits 0.155.1-tracking.13 → 0.155.1-tracking.14-debug

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 (116) hide show
  1. package/build.gradle.kts +11 -0
  2. package/compose/build.gradle.kts +180 -0
  3. package/compose/compose.podspec +54 -0
  4. package/compose/src/androidMain/kotlin/vn/momo/kits/platform/Platform.android.kt +113 -0
  5. package/compose/src/commonMain/composeResources/font/momosignature.otf +0 -0
  6. package/compose/src/commonMain/composeResources/font/momotrustdisplay.otf +0 -0
  7. package/compose/src/commonMain/composeResources/font/sfprotext_black.otf +0 -0
  8. package/compose/src/commonMain/composeResources/font/sfprotext_black.ttf +0 -0
  9. package/compose/src/commonMain/composeResources/font/sfprotext_bold.ttf +0 -0
  10. package/compose/src/commonMain/composeResources/font/sfprotext_heavy.ttf +0 -0
  11. package/compose/src/commonMain/composeResources/font/sfprotext_light.ttf +0 -0
  12. package/compose/src/commonMain/composeResources/font/sfprotext_medium.ttf +0 -0
  13. package/compose/src/commonMain/composeResources/font/sfprotext_regular.ttf +0 -0
  14. package/compose/src/commonMain/composeResources/font/sfprotext_semibold.ttf +0 -0
  15. package/compose/src/commonMain/composeResources/font/sfprotext_thin.otf +0 -0
  16. package/compose/src/commonMain/composeResources/font/sfprotext_thin.ttf +0 -0
  17. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.otf +0 -0
  18. package/compose/src/commonMain/composeResources/font/sfprotext_ultralight.ttf +0 -0
  19. package/compose/src/commonMain/kotlin/vn/momo/kits/application/AnimationSearchInput.kt +57 -0
  20. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Context.kt +95 -0
  21. package/compose/src/commonMain/kotlin/vn/momo/kits/application/FloatingButton.kt +201 -0
  22. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Header.kt +222 -0
  23. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderAnimated.kt +48 -0
  24. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderBackground.kt +86 -0
  25. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderDefault.kt +76 -0
  26. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderExtended.kt +76 -0
  27. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderRight.kt +305 -0
  28. package/compose/src/commonMain/kotlin/vn/momo/kits/application/HeaderTitle.kt +33 -0
  29. package/compose/src/commonMain/kotlin/vn/momo/kits/application/LiteScreen.kt +715 -0
  30. package/compose/src/commonMain/kotlin/vn/momo/kits/application/NavigationContainer.kt +121 -0
  31. package/compose/src/commonMain/kotlin/vn/momo/kits/application/Screen.kt +405 -0
  32. package/compose/src/commonMain/kotlin/vn/momo/kits/application/useHeaderSearchAnimation.kt +69 -0
  33. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Badge.kt +85 -0
  34. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeDot.kt +35 -0
  35. package/compose/src/commonMain/kotlin/vn/momo/kits/components/BadgeRibbon.kt +343 -0
  36. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Button.kt +353 -0
  37. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CheckBox.kt +98 -0
  38. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Chip.kt +138 -0
  39. package/compose/src/commonMain/kotlin/vn/momo/kits/components/CupertinoOverscroll.kt +543 -0
  40. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Divider.kt +23 -0
  41. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Icon.kt +78 -0
  42. package/compose/src/commonMain/kotlin/vn/momo/kits/components/IconButton.kt +151 -0
  43. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Image.kt +190 -0
  44. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Information.kt +119 -0
  45. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Input.kt +407 -0
  46. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputDropDown.kt +175 -0
  47. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputMoney.kt +244 -0
  48. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputOTP.kt +233 -0
  49. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputPhoneNumber.kt +233 -0
  50. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputSearch.kt +257 -0
  51. package/compose/src/commonMain/kotlin/vn/momo/kits/components/InputTextArea.kt +240 -0
  52. package/compose/src/commonMain/kotlin/vn/momo/kits/components/LazyColumnWithBouncing.kt +364 -0
  53. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationDot.kt +59 -0
  54. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationNumber.kt +44 -0
  55. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationScroll.kt +95 -0
  56. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PaginationWhiteDot.kt +43 -0
  57. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupNotify.kt +351 -0
  58. package/compose/src/commonMain/kotlin/vn/momo/kits/components/PopupPromotion.kt +106 -0
  59. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Radio.kt +72 -0
  60. package/compose/src/commonMain/kotlin/vn/momo/kits/components/ScaleSizeScope.kt +17 -0
  61. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Skeleton.kt +99 -0
  62. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Switch.kt +99 -0
  63. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Tag.kt +95 -0
  64. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Text.kt +132 -0
  65. package/compose/src/commonMain/kotlin/vn/momo/kits/components/Title.kt +217 -0
  66. package/compose/src/commonMain/kotlin/vn/momo/kits/components/TrustBanner.kt +180 -0
  67. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePicker.kt +208 -0
  68. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerTypes.kt +29 -0
  69. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/DateTimePickerUtils.kt +239 -0
  70. package/compose/src/commonMain/kotlin/vn/momo/kits/components/datetimepicker/WheelPicker.kt +191 -0
  71. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Colors.kt +306 -0
  72. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Radius.kt +12 -0
  73. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Spacing.kt +13 -0
  74. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Theme.kt +189 -0
  75. package/compose/src/commonMain/kotlin/vn/momo/kits/const/Typography.kt +285 -0
  76. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Card.kt +2 -0
  77. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Item.kt +35 -0
  78. package/compose/src/commonMain/kotlin/vn/momo/kits/layout/Section.kt +2 -0
  79. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/AutomationId.kt +59 -0
  80. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Clickable.kt +68 -0
  81. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Conditional.kt +11 -0
  82. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/DeprecatedModifier.kt +15 -0
  83. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Shadow.kt +50 -0
  84. package/compose/src/commonMain/kotlin/vn/momo/kits/modifier/Size.kt +51 -0
  85. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/BottomSheet.kt +271 -0
  86. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/ModalScreen.kt +152 -0
  87. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigation.kt +95 -0
  88. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/NavigationContainer.kt +162 -0
  89. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/Navigator.kt +347 -0
  90. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/StackScreen.kt +551 -0
  91. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTab.kt +169 -0
  92. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/BottomTabBar.kt +233 -0
  93. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/bottomtab/CurvedContainer.kt +86 -0
  94. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/FloatingButton.kt +190 -0
  95. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/Header.kt +258 -0
  96. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderBackground.kt +80 -0
  97. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderRight.kt +306 -0
  98. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderTitle.kt +31 -0
  99. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/HeaderUser.kt +370 -0
  100. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/component/SnackBar.kt +135 -0
  101. package/compose/src/commonMain/kotlin/vn/momo/kits/navigation/tracking/ScreenTracker.kt +218 -0
  102. package/compose/src/commonMain/kotlin/vn/momo/kits/platform/Platform.kt +42 -0
  103. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Icons.kt +1329 -0
  104. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Resources.kt +62 -0
  105. package/compose/src/commonMain/kotlin/vn/momo/kits/utils/Utils.kt +88 -0
  106. package/compose/src/iosMain/kotlin/vn/momo/kits/platform/Platform.ios.kt +152 -0
  107. package/gradle/libs.versions.toml +57 -0
  108. package/gradle/wrapper/gradle-wrapper.jar +0 -0
  109. package/gradle/wrapper/gradle-wrapper.properties +8 -0
  110. package/gradle.properties +26 -0
  111. package/gradlew +252 -0
  112. package/gradlew.bat +94 -0
  113. package/local.properties +8 -0
  114. package/package.json +1 -1
  115. package/publish_release.sh +105 -0
  116. package/settings.gradle.kts +52 -0
@@ -0,0 +1,218 @@
1
+ package vn.momo.kits.navigation.tracking
2
+
3
+ import vn.momo.kits.application.MiniAppContext
4
+ import vn.momo.maxapi.IMaxApi
5
+ import kotlin.time.Clock
6
+ import kotlin.time.ExperimentalTime
7
+
8
+ /**
9
+ * Screen tracking state holder
10
+ */
11
+ class ScreenTrackingState {
12
+ @OptIn(ExperimentalTime::class)
13
+ var startTime: Long = Clock.System.now().toEpochMilliseconds()
14
+ var endTime: Long = startTime
15
+ var releaseNavigated: Boolean = false
16
+ var releaseLoad: Boolean = false
17
+ var releaseInteraction: Boolean = false
18
+ var previousScreenName: String? = null
19
+ var action: String = "push"
20
+ }
21
+
22
+ /**
23
+ * Screen tracker for auto tracking events
24
+ *
25
+ * Tracks 3 main events:
26
+ * - auto_screen_navigated: When screen is focused
27
+ * - auto_screen_displayed: When screen finished loading
28
+ * - auto_screen_interacted: When screen is ready for interaction
29
+ */
30
+ object ScreenTracker {
31
+
32
+ private var lastScreenName: String? = null
33
+
34
+ /**
35
+ * Track screen navigation event
36
+ * Called when screen is focused
37
+ */
38
+ fun trackScreenNavigated(
39
+ maxApi: IMaxApi?,
40
+ context: MiniAppContext?,
41
+ screenName: String,
42
+ action: String,
43
+ state: ScreenTrackingState
44
+ ) {
45
+ if (state.releaseNavigated) return
46
+
47
+ val previousScreen = lastScreenName
48
+ lastScreenName = screenName
49
+
50
+ maxApi?.track(
51
+ eventName = "auto_screen_navigated",
52
+ params = buildBaseParams(context, screenName).apply {
53
+ put("pre_screen_name", previousScreen)
54
+ put("state", "navigated")
55
+ put("action", action)
56
+ }
57
+ )
58
+
59
+ state.releaseNavigated = true
60
+ state.previousScreenName = previousScreen
61
+ }
62
+
63
+ /**
64
+ * Track screen displayed event
65
+ * Called when screen finished loading all elements
66
+ */
67
+ fun trackScreenDisplayed(
68
+ maxApi: IMaxApi?,
69
+ context: MiniAppContext?,
70
+ screenName: String,
71
+ duration: Long,
72
+ state: ScreenTrackingState
73
+ ) {
74
+ if (state.releaseLoad) return
75
+
76
+ maxApi?.track(
77
+ eventName = "auto_screen_displayed",
78
+ params = buildBaseParams(context, screenName).apply {
79
+ put("state", "load")
80
+ put("duration", duration)
81
+ }
82
+ )
83
+
84
+ state.releaseLoad = true
85
+ }
86
+
87
+ /**
88
+ * Track screen interacted event
89
+ * Called when screen is ready for user interaction
90
+ */
91
+ fun trackScreenInteracted(
92
+ maxApi: IMaxApi?,
93
+ context: MiniAppContext?,
94
+ screenName: String,
95
+ duration: Long,
96
+ totalDuration: Long,
97
+ state: ScreenTrackingState
98
+ ) {
99
+ if (state.releaseInteraction) return
100
+
101
+ maxApi?.track(
102
+ eventName = "auto_screen_interacted",
103
+ params = buildBaseParams(context, screenName).apply {
104
+ put("state", "interaction")
105
+ put("duration", duration)
106
+ put("total_duration", totalDuration)
107
+ }
108
+ )
109
+
110
+ state.releaseInteraction = true
111
+ }
112
+
113
+ /**
114
+ * Build base tracking params from MiniAppContext
115
+ */
116
+ private fun buildBaseParams(
117
+ context: MiniAppContext?,
118
+ screenName: String,
119
+ componentName: String = "Screen"
120
+ ): MutableMap<String, Any?> {
121
+ return mutableMapOf(
122
+ "app_id" to context?.appId,
123
+ "feature_code" to context?.appCode,
124
+ // "miniapp_version" to context?.,
125
+ "screen_name" to screenName,
126
+ "component_name" to componentName,
127
+ "tracking_source" to 1
128
+ )
129
+ }
130
+
131
+ /**
132
+ * Track popup/modal displayed event
133
+ * Called when popup is opened or closed
134
+ *
135
+ * @param action "open" or "close"
136
+ * @param popupName name of the popup/modal
137
+ * @param parentScreenName the screen that shows the popup
138
+ * @param title popup title for tracking
139
+ * @param desc popup description for tracking
140
+ */
141
+ fun trackPopupDisplayed(
142
+ maxApi: IMaxApi?,
143
+ context: MiniAppContext?,
144
+ action: String,
145
+ popupName: String?,
146
+ parentScreenName: String?,
147
+ title: String? = null,
148
+ desc: String? = null
149
+ ) {
150
+ // When opening: screen_name = parent screen, component_name = popup name
151
+ // When closing: screen_name = popup name, component_name = parent screen
152
+ val screenName = if (action == "open") parentScreenName else popupName
153
+ val componentName = if (action == "open") popupName else parentScreenName
154
+
155
+ maxApi?.track(
156
+ eventName = "auto_popup_displayed",
157
+ params = mutableMapOf(
158
+ "app_id" to context?.appId,
159
+ "feature_code" to context?.appCode,
160
+ "screen_name" to screenName,
161
+ "component_name" to componentName,
162
+ "action" to action,
163
+ "title" to title,
164
+ "desc" to desc,
165
+ "tracking_source" to 1
166
+ )
167
+ )
168
+ }
169
+
170
+ /**
171
+ * Track bottom sheet displayed event
172
+ * Called when bottom sheet is opened or closed
173
+ *
174
+ * @param action "open" or "close"
175
+ * @param sheetName name of the bottom sheet
176
+ * @param parentScreenName the screen that shows the bottom sheet
177
+ * @param title sheet title for tracking
178
+ * @param desc sheet description for tracking
179
+ */
180
+ fun trackBottomSheetDisplayed(
181
+ maxApi: IMaxApi?,
182
+ context: MiniAppContext?,
183
+ action: String,
184
+ sheetName: String?,
185
+ parentScreenName: String?,
186
+ title: String? = null,
187
+ desc: String? = null
188
+ ) {
189
+ val screenName = if (action == "open") parentScreenName else sheetName
190
+ val componentName = if (action == "open") sheetName else parentScreenName
191
+
192
+ maxApi?.track(
193
+ eventName = "auto_bottomsheet_displayed",
194
+ params = mutableMapOf(
195
+ "app_id" to context?.appId,
196
+ "feature_code" to context?.appCode,
197
+ "screen_name" to screenName,
198
+ "component_name" to componentName,
199
+ "action" to action,
200
+ "title" to title,
201
+ "desc" to desc,
202
+ "tracking_source" to 1
203
+ )
204
+ )
205
+ }
206
+
207
+ /**
208
+ * Get previous screen name for back navigation detection
209
+ */
210
+ fun getLastScreenName(): String? = lastScreenName
211
+
212
+ /**
213
+ * Reset tracker (for testing or cleanup)
214
+ */
215
+ fun reset() {
216
+ lastScreenName = null
217
+ }
218
+ }
@@ -0,0 +1,42 @@
1
+ package vn.momo.kits.platform
2
+
3
+ import androidx.compose.runtime.Composable
4
+ import androidx.compose.ui.Modifier
5
+ import androidx.compose.ui.graphics.Color
6
+ import androidx.compose.ui.graphics.NativePaint
7
+ import androidx.compose.ui.unit.Dp
8
+
9
+ data class ScreenDimension(
10
+ val width: Int,
11
+ val height: Int,
12
+ )
13
+
14
+ expect fun getPlatformName(): String
15
+
16
+ @Composable
17
+ expect fun getScreenDimensions(): ScreenDimension
18
+
19
+ expect fun NativePaint.setMaskFilter(blurRadius: Float)
20
+
21
+ @Composable
22
+ expect fun getStatusBarHeight(): Dp
23
+
24
+ @Composable
25
+ expect fun BackHandler(enabled: Boolean, onBack: () -> Unit)
26
+
27
+ @Composable
28
+ expect fun getScreenHeight(): Dp
29
+
30
+ expect fun getAndroidBuildVersion(): Int
31
+
32
+ @Composable
33
+ expect fun LottieAnimation(
34
+ path: String,
35
+ tintColor: Color? = null,
36
+ bgColor: Color? = null,
37
+ modifier: Modifier = Modifier
38
+ )
39
+
40
+ expect fun NativePaint.setColor(
41
+ color: Color = Color.Black
42
+ )