@momo-kits/foundation 0.121.3-beta.6 → 0.121.3-beta.7

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.
@@ -50,7 +50,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
50
50
  useKeyboardAvoidingView = true,
51
51
  useScrollOverflow = false,
52
52
  keyboardVerticalOffset,
53
- useDivider,
53
+ useDivider = true,
54
54
  }: BottomSheetParams = props.route.params;
55
55
 
56
56
  const customEasingOpen = Easing.bezier(0.05, 0.7, 0.1, 1);
@@ -218,7 +218,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
218
218
  return (
219
219
  <View
220
220
  style={{
221
- backgroundColor: 'red',
221
+ backgroundColor,
222
222
  borderTopLeftRadius: Radius.M,
223
223
  borderTopRightRadius: Radius.M,
224
224
  }}
@@ -55,6 +55,7 @@ const HeaderToolkitAction: React.FC<any> = ({
55
55
  useShortcut = false,
56
56
  useMore = false,
57
57
  tools = [],
58
+ useCloseIcon = false,
58
59
  }) => {
59
60
  const {navigator} = useContext(ApplicationContext);
60
61
  const context = useContext<any>(MiniAppContext);
@@ -104,14 +105,22 @@ const HeaderToolkitAction: React.FC<any> = ({
104
105
  );
105
106
 
106
107
  const onDismiss = () => {
107
- if (isWhiteList) {
108
- navigator?.maxApi?.dispatchFunction?.('dismissAll');
109
- } else {
108
+ if (useCloseIcon) {
110
109
  navigator?.maxApi?.dispatchFunction?.(
111
110
  'dismiss',
112
111
  navigator?.dismissData,
113
112
  undefined
114
113
  );
114
+ } else {
115
+ if (isWhiteList) {
116
+ navigator?.maxApi?.dispatchFunction?.('dismissAll');
117
+ } else {
118
+ navigator?.maxApi?.dispatchFunction?.(
119
+ 'dismiss',
120
+ navigator?.dismissData,
121
+ undefined
122
+ );
123
+ }
115
124
  }
116
125
  };
117
126
 
@@ -260,6 +269,12 @@ const HeaderToolkitAction: React.FC<any> = ({
260
269
  group?.items?.some?.(tool => tool?.showBadge)
261
270
  );
262
271
 
272
+ const iconRight = useCloseIcon
273
+ ? '16_navigation_close_circle'
274
+ : isWhiteList
275
+ ? '16_basic_home'
276
+ : '16_navigation_close_circle';
277
+
263
278
  return (
264
279
  <View style={Styles.row}>
265
280
  {useShortcut && (
@@ -296,13 +311,7 @@ const HeaderToolkitAction: React.FC<any> = ({
296
311
  onPress={onClose}
297
312
  style={styles.toolkitButton}
298
313
  hitSlop={{top: 7, bottom: 7, left: 0, right: 7}}>
299
- <Icon
300
- color={tintColor}
301
- source={
302
- isWhiteList ? '16_basic_home' : '16_navigation_close_circle'
303
- }
304
- size={20}
305
- />
314
+ <Icon color={tintColor} source={iconRight} size={20} />
306
315
  </TouchableOpacity>
307
316
  </View>
308
317
  </View>
@@ -96,7 +96,7 @@ const Modal: React.FC<ModalParams> = props => {
96
96
  style={StyleSheet.absoluteFillObject}>
97
97
  <KeyboardAvoidingView
98
98
  style={Styles.flexCenter}
99
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}>
99
+ behavior={Platform.OS === 'ios' ? 'padding' : undefined}>
100
100
  <Pressable
101
101
  style={StyleSheet.absoluteFillObject}
102
102
  onPress={() => onDismiss(undefined, barrierDismissible)}>
@@ -26,6 +26,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
26
26
  traceIdInteraction: undefined,
27
27
  releaseLoad: undefined,
28
28
  releaseInteraction: undefined,
29
+ releaseUserInteraction: undefined,
29
30
  timeLoad: 0,
30
31
  timeInteraction: 0,
31
32
  widgets: [],
@@ -183,6 +184,36 @@ const StackScreen: React.FC<ScreenParams> = props => {
183
184
  }
184
185
  };
185
186
 
187
+ /**
188
+ * tracking for first interaction by user
189
+ */
190
+ const onFirstInteraction = (action: string) => {
191
+ if (!tracking.current?.releaseUserInteraction) {
192
+ let timeLoad = tracking.current.timeLoad;
193
+ if (timeLoad === 0) {
194
+ timeLoad = tracking.current.endTime - tracking.current.startTime;
195
+ }
196
+ context?.autoTracking?.({
197
+ ...context,
198
+ screenName,
199
+ componentName: 'Screen',
200
+ state: 'interaction',
201
+ duration: timeLoad,
202
+ action,
203
+ });
204
+ tracking.current.releaseUserInteraction = true;
205
+
206
+ /**
207
+ * debug
208
+ */
209
+ navigator?.maxApi?.showToastDebug?.({
210
+ appId: context.appId,
211
+ message: `${screenName} user_interaction ${timeLoad}`,
212
+ type: 'ERROR',
213
+ });
214
+ }
215
+ };
216
+
186
217
  return (
187
218
  <ScreenContext.Provider
188
219
  value={{
@@ -237,6 +268,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
237
268
  if (data?.interaction) {
238
269
  onScreenLoad();
239
270
  onScreenInteraction();
271
+ onFirstInteraction(data?.action);
240
272
  }
241
273
  /**
242
274
  * timeout for handle tracking screen
@@ -21,6 +21,9 @@ const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
21
21
  const ScreenContext = (Platform as any).ScreenContext ?? Context;
22
22
  const ComponentContext = (Platform as any).ComponentContext ?? Context;
23
23
  const SkeletonContext = createContext({loading: false});
24
+ const TrackingScopeContext = createContext<{scopeName?: string}>({
25
+ scopeName: undefined,
26
+ });
24
27
 
25
28
  export {
26
29
  ApplicationContext,
@@ -39,4 +42,5 @@ export {
39
42
  HeaderAnimated,
40
43
  setAutomationID,
41
44
  useComponentId,
45
+ TrackingScopeContext,
42
46
  };
@@ -192,6 +192,7 @@ export type HeaderRightToolkit = {
192
192
  tools?: ToolGroup[];
193
193
  preventClose?: PopupNotifyProps;
194
194
  useMore?: boolean;
195
+ useCloseIcon?: boolean;
195
196
  };
196
197
 
197
198
  export interface HeaderBackProps extends NavigationButtonProps {
@@ -13,7 +13,7 @@ import {
13
13
  import {HeaderTitleProps, NavigationOptions} from './types';
14
14
  import {Colors} from '../Consts';
15
15
  import {Animated, Platform} from 'react-native';
16
- import {MiniAppContext, ScreenContext} from './index';
16
+ import {MiniAppContext, ScreenContext, TrackingScopeContext} from './index';
17
17
 
18
18
  /**
19
19
  * default options for stack screen
@@ -173,12 +173,13 @@ const setAutomationID = (accessibilityLabel = '') => {
173
173
  const useComponentId = (componentName: string, accessibilityLabel?: string) => {
174
174
  const app = useContext<any>(MiniAppContext);
175
175
  const screen = useContext<any>(ScreenContext);
176
+ const {scopeName} = useContext<any>(TrackingScopeContext);
176
177
 
177
178
  const componentId = useMemo(() => {
178
179
  if (accessibilityLabel) {
179
180
  return accessibilityLabel;
180
181
  }
181
- return `${app.appId}/${app.code}/${screen.screenName}/${componentName}`;
182
+ return `${app.appId}/${app.code}/${screen.screenName}/${scopeName}/${componentName}`;
182
183
  }, [componentName, accessibilityLabel, app, screen]);
183
184
 
184
185
  return {componentId};
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import {TrackingScopeContext} from '../Application';
3
+
4
+ const TrackingScope = ({
5
+ scopeName,
6
+ children,
7
+ }: {
8
+ scopeName: string;
9
+ children: any;
10
+ }) => {
11
+ return (
12
+ <TrackingScopeContext.Provider value={{scopeName}}>
13
+ {children}
14
+ </TrackingScopeContext.Provider>
15
+ );
16
+ };
17
+
18
+ export {TrackingScope};
package/Layout/index.ts CHANGED
@@ -7,6 +7,7 @@ import {GridContextProps} from './types';
7
7
  import Item from './Item';
8
8
  import ItemList from './ItemList';
9
9
  import ItemSectionList from './ItemSectionList';
10
+ import {TrackingScope} from './TrackingScope';
10
11
 
11
12
  const GridContext = createContext<GridContextProps>({
12
13
  numberOfColumns: 12,
@@ -24,4 +25,5 @@ export {
24
25
  Item,
25
26
  ItemList,
26
27
  ItemSectionList,
28
+ TrackingScope,
27
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.121.3-beta.6",
3
+ "version": "0.121.3-beta.7",
4
4
  "minimumDeployTarget": 32,
5
5
  "deploymentTarget": 121,
6
6
  "description": "React Native Component Kits",