@momo-kits/foundation 0.89.4-tracking.14 → 0.89.4-tracking.15

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.
@@ -6,7 +6,6 @@ import React, {
6
6
  useState,
7
7
  } from 'react';
8
8
  import {
9
- Alert,
10
9
  Animated,
11
10
  BackHandler,
12
11
  DeviceEventEmitter,
@@ -121,23 +120,18 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
121
120
  const goBack = () => {
122
121
  const canGoBack = navigator?.ref.current?.canGoBack();
123
122
  if (!canGoBack) {
124
- const currentRoute = navigator?.ref?.current.getCurrentRoute();
125
- Alert.alert(
126
- 'service_icon_clicked',
127
- JSON.stringify({
128
- ...context,
129
- screen_name:
130
- currentRoute?.params?.screen?.name ?? currentRoute?.name,
131
- trigger_id: '111154000000000000',
132
- icon_name: 'back',
133
- }),
134
- );
135
- navigator?.maxApi?.trackEvent?.('service_icon_clicked', {
123
+ const currentRoute = navigator?.ref?.current?.getCurrentRoute?.();
124
+ const params = {
136
125
  ...context,
137
126
  screen_name: currentRoute?.params?.screen?.name ?? currentRoute?.name,
138
127
  trigger_id: '111154000000000000',
139
128
  icon_name: 'back',
129
+ };
130
+ navigator?.maxApi?.showToastDebug?.({
131
+ title: 'service_icon_clicked',
132
+ params,
140
133
  });
134
+ navigator?.maxApi?.trackEvent?.('service_icon_clicked', params);
141
135
  }
142
136
  if (canGoBack) {
143
137
  navigator?.ref.current?.goBack();
@@ -4,7 +4,7 @@ import Navigation from './Navigation';
4
4
  import {ApplicationContext, MiniAppContext} from './index';
5
5
  import {GridSystem} from '../Layout';
6
6
  import {useHeaderHeight} from '@react-navigation/stack';
7
- import {Alert} from 'react-native';
7
+ import {InteractionManager} from 'react-native';
8
8
 
9
9
  const {
10
10
  ScreenContext,
@@ -37,6 +37,12 @@ const StackScreen: React.FC<ScreenParams> = props => {
37
37
  if (options) {
38
38
  navigation.setOptions(options);
39
39
  }
40
+ InteractionManager.runAfterInteractions(() => {
41
+ navigator?.maxApi?.showToastDebug?.({
42
+ title: 'screen_interaction_time',
43
+ message: Date.now() - startTime.current,
44
+ });
45
+ });
40
46
  }, [options]);
41
47
 
42
48
  /**
@@ -55,34 +61,28 @@ const StackScreen: React.FC<ScreenParams> = props => {
55
61
  pre_screen_name = routes[routesLength - 2]?.params?.screen?.name;
56
62
  }
57
63
 
58
- navigator?.maxApi?.trackEvent?.('service_frame_displayed', {
64
+ const params = {
59
65
  ...tracking,
60
66
  pre_screen_name,
61
67
  trigger_id: '111378000000000000',
68
+ };
69
+ navigator?.maxApi?.trackEvent?.('service_frame_displayed', params);
70
+ navigator?.maxApi?.showToastDebug?.({
71
+ title: 'service_frame_displayed',
72
+ params,
62
73
  });
63
74
 
64
- Alert.alert(
65
- 'service_frame_displayed',
66
- JSON.stringify({
67
- ...tracking,
68
- pre_screen_name,
69
- trigger_id: '111378000000000000',
70
- }),
71
- );
72
75
  return props.navigation.addListener('beforeRemove', () => {
73
- navigator?.maxApi?.trackEvent?.('service_icon_clicked', {
76
+ const params = {
74
77
  ...tracking,
75
78
  trigger_id: '111154000000000000',
76
79
  icon_name: 'back',
80
+ };
81
+ navigator?.maxApi?.trackEvent?.('service_icon_clicked', params);
82
+ navigator?.maxApi?.showToastDebug?.({
83
+ title: 'service_icon_clicked',
84
+ params,
77
85
  });
78
- Alert.alert(
79
- 'service_icon_clicked',
80
- JSON.stringify({
81
- ...tracking,
82
- trigger_id: '111154000000000000',
83
- icon_name: 'back',
84
- }),
85
- );
86
86
  });
87
87
  }, []);
88
88
 
@@ -100,6 +100,10 @@ const StackScreen: React.FC<ScreenParams> = props => {
100
100
  clearTimeout(timeout.current);
101
101
  timeout.current = setTimeout(() => {
102
102
  timeLoad.current = endTime.current - startTime.current;
103
+ navigator?.maxApi?.showToastDebug?.({
104
+ title: 'screen_load_time',
105
+ message: timeLoad.current,
106
+ });
103
107
  }, 1000);
104
108
  },
105
109
  }}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.89.4-tracking.14",
3
+ "version": "0.89.4-tracking.15",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {