@botim/botim-cli 0.1.4 → 0.1.6
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.
- package/dist/cli.js +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/templates/react/.botim/app.json5 +12 -0
- package/dist/templates/react/.botim/ci/post-version.sh +7 -0
- package/dist/templates/react/.cursorrules +37 -0
- package/dist/templates/react/scripts/.gitkeep +0 -0
- package/dist/templates/react/src/assets/animation/.gitkeep +0 -0
- package/dist/templates/react/src/assets/fonts/.gitkeep +0 -0
- package/dist/templates/react/src/assets/images/.gitkeep +0 -0
- package/dist/templates/templates/react/.botim/app.json5 +12 -0
- package/dist/templates/templates/react/.botim/ci/post-version.sh +7 -0
- package/dist/templates/templates/react/.cursorrules +37 -0
- package/dist/templates/templates/react/README.md +48 -0
- package/dist/templates/templates/react/docs/code-patterns.md +139 -0
- package/dist/templates/templates/react/docs/core-rules.md +69 -0
- package/dist/templates/templates/react/docs/figma-workflow.md +81 -0
- package/dist/templates/templates/react/docs/validation.md +59 -0
- package/dist/templates/templates/react/eslint.config.ts +57 -0
- package/dist/templates/templates/react/index.html +12 -0
- package/dist/templates/templates/react/package-lock.json +12197 -0
- package/dist/templates/templates/react/package.json +102 -0
- package/dist/templates/templates/react/scripts/.gitkeep +0 -0
- package/dist/templates/templates/react/scripts/setup.sh +304 -0
- package/dist/templates/templates/react/src/api/http-client.ts +8 -0
- package/dist/templates/templates/react/src/api/modules/example.ts +12 -0
- package/dist/templates/templates/react/src/app.tsx +27 -0
- package/dist/templates/templates/react/src/assets/animation/.gitkeep +0 -0
- package/dist/templates/templates/react/src/assets/fonts/.gitkeep +0 -0
- package/dist/templates/templates/react/src/assets/images/.gitkeep +0 -0
- package/dist/templates/templates/react/src/components/not-found-content/index.ts +2 -0
- package/dist/templates/templates/react/src/components/not-found-content/not-found-content.tsx +24 -0
- package/dist/templates/templates/react/src/components/welcome-card/index.ts +1 -0
- package/dist/templates/templates/react/src/components/welcome-card/welcome-card.tsx +10 -0
- package/dist/templates/templates/react/src/hooks/use-document-title.ts +11 -0
- package/dist/templates/templates/react/src/i18n/index.ts +40 -0
- package/dist/templates/templates/react/src/i18n/languages/en.json +10 -0
- package/dist/templates/templates/react/src/main.tsx +27 -0
- package/dist/templates/templates/react/src/modules/common/README.md +7 -0
- package/dist/templates/templates/react/src/modules/common/constants.ts +3 -0
- package/dist/templates/templates/react/src/modules/core/README.md +7 -0
- package/dist/templates/templates/react/src/modules/core/api/error.ts +6 -0
- package/dist/templates/templates/react/src/modules/core/app-providers.tsx +18 -0
- package/dist/templates/templates/react/src/modules/core/index.ts +2 -0
- package/dist/templates/templates/react/src/pages/home/index.tsx +13 -0
- package/dist/templates/templates/react/src/pages/not-found/index.tsx +7 -0
- package/dist/templates/templates/react/src/routes.tsx +18 -0
- package/dist/templates/templates/react/src/stores/home-store.ts +11 -0
- package/dist/templates/templates/react/src/styles/font.css +1 -0
- package/dist/templates/templates/react/src/styles/global-style.tsx +27 -0
- package/dist/templates/templates/react/src/styles/tailwind.css +4 -0
- package/dist/templates/templates/react/src/styles/utility-classes.ts +13 -0
- package/dist/templates/templates/react/src/theme/index.tsx +24 -0
- package/dist/templates/templates/react/src/theme/types.ts +10 -0
- package/dist/templates/templates/react/src/types/global.d.ts +139 -0
- package/dist/templates/templates/react/src/types/shims-global.d.ts +97 -0
- package/dist/templates/templates/react/src/utils/currency.ts +6 -0
- package/dist/templates/templates/react/src/utils/date.ts +5 -0
- package/dist/templates/templates/react/src/utils/guard.ts +4 -0
- package/dist/templates/templates/react/src/vite-env.d.ts +1 -0
- package/dist/templates/templates/react/tsconfig.json +39 -0
- package/dist/templates/templates/react/tsconfig.node.json +11 -0
- package/dist/templates/templates/react/types/global.d.ts +131 -0
- package/dist/templates/templates/react/vite.config.ts +179 -0
- package/dist/templates/templates/vue/README.md +19 -0
- package/dist/templates/templates/vue/eslint.config.ts +44 -0
- package/dist/templates/templates/vue/index.html +12 -0
- package/dist/templates/templates/vue/package-lock.json +5774 -0
- package/dist/templates/templates/vue/package.json +39 -0
- package/dist/templates/templates/vue/src/api/http-client.ts +11 -0
- package/dist/templates/templates/vue/src/api/modules/example.ts +12 -0
- package/dist/templates/templates/vue/src/app.vue +23 -0
- package/dist/templates/templates/vue/src/components/card/index.vue +14 -0
- package/dist/templates/templates/vue/src/components/layout/index.ts +1 -0
- package/dist/templates/templates/vue/src/components/layout/page-layout.vue +43 -0
- package/dist/templates/templates/vue/src/components/layout/styles.ts +5 -0
- package/dist/templates/templates/vue/src/components/typography/heading.vue +21 -0
- package/dist/templates/templates/vue/src/components/typography/index.ts +1 -0
- package/dist/templates/templates/vue/src/hooks/use-document-title.ts +23 -0
- package/dist/templates/templates/vue/src/i18n/index.ts +31 -0
- package/dist/templates/templates/vue/src/i18n/languages/en.json +10 -0
- package/dist/templates/templates/vue/src/main.ts +12 -0
- package/dist/templates/templates/vue/src/modules/common/README.md +7 -0
- package/dist/templates/templates/vue/src/modules/common/constants.ts +3 -0
- package/dist/templates/templates/vue/src/modules/core/README.md +7 -0
- package/dist/templates/templates/vue/src/modules/core/api/error.ts +6 -0
- package/dist/templates/templates/vue/src/modules/core/app-providers.ts +17 -0
- package/dist/templates/templates/vue/src/modules/core/index.ts +2 -0
- package/dist/templates/templates/vue/src/pages/home/index.vue +28 -0
- package/dist/templates/templates/vue/src/pages/not-found/index.vue +13 -0
- package/dist/templates/templates/vue/src/routes.ts +19 -0
- package/dist/templates/templates/vue/src/stores/home-store.ts +12 -0
- package/dist/templates/templates/vue/src/styles/font.css +1 -0
- package/dist/templates/templates/vue/src/styles/global-style.ts +63 -0
- package/dist/templates/templates/vue/src/styles/utility-classes.ts +1 -0
- package/dist/templates/templates/vue/src/theme/index.ts +33 -0
- package/dist/templates/templates/vue/src/theme/types.ts +10 -0
- package/dist/templates/templates/vue/src/types/global.d.ts +9 -0
- package/dist/templates/templates/vue/src/utils/currency.ts +6 -0
- package/dist/templates/templates/vue/src/utils/date.ts +5 -0
- package/dist/templates/templates/vue/src/utils/guard.ts +4 -0
- package/dist/templates/templates/vue/src/vite-env.d.ts +1 -0
- package/dist/templates/templates/vue/tsconfig.json +36 -0
- package/dist/templates/templates/vue/tsconfig.node.json +9 -0
- package/dist/templates/templates/vue/types/global.d.ts +7 -0
- package/dist/templates/templates/vue/vite.config.ts +74 -0
- package/package.json +3 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
import { createHashRouter, RouteObject } from 'react-router-dom';
|
|
3
|
+
import HomePage from './pages/home';
|
|
4
|
+
|
|
5
|
+
const NotFoundPage = lazy(async () => import('./pages/not-found'));
|
|
6
|
+
|
|
7
|
+
const routes: RouteObject[] = [
|
|
8
|
+
{
|
|
9
|
+
path: '/',
|
|
10
|
+
element: <HomePage />
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
path: '*',
|
|
14
|
+
element: <NotFoundPage />
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
export const router = createHashRouter(routes);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { create } from 'zustand';
|
|
2
|
+
|
|
3
|
+
export type HomeState = {
|
|
4
|
+
message: string;
|
|
5
|
+
setMessage: (value: string) => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const useHomeStore = create<HomeState>((set) => ({
|
|
9
|
+
message: 'Welcome to your new mini application',
|
|
10
|
+
setMessage: (value) => set({ message: value })
|
|
11
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Add @font-face declarations or external font imports here */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { css, Global, useTheme } from '@emotion/react';
|
|
2
|
+
import type { AppTheme } from '@theme/types';
|
|
3
|
+
|
|
4
|
+
const createGlobalStyles = (theme: AppTheme) => css`
|
|
5
|
+
:root {
|
|
6
|
+
color-scheme: light;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
*,
|
|
10
|
+
*::before,
|
|
11
|
+
*::after {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
body {
|
|
16
|
+
margin: 0;
|
|
17
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
18
|
+
background: ${theme.colors.background};
|
|
19
|
+
color: ${theme.colors.text};
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export function GlobalStyle(): JSX.Element {
|
|
24
|
+
const theme = useTheme() as AppTheme;
|
|
25
|
+
|
|
26
|
+
return <Global styles={createGlobalStyles(theme)} />;
|
|
27
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ThemeProvider } from '@emotion/react';
|
|
3
|
+
import type { AppTheme } from './types';
|
|
4
|
+
|
|
5
|
+
const baseTheme: AppTheme = {
|
|
6
|
+
colors: {
|
|
7
|
+
background: '#f8fafc',
|
|
8
|
+
surface: '#ffffff',
|
|
9
|
+
text: '#0f172a',
|
|
10
|
+
primary: '#2563eb',
|
|
11
|
+
muted: '#64748b'
|
|
12
|
+
},
|
|
13
|
+
spacing: (value: number) => `${value * 4}px`
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export function AppThemeProvider({ children }: PropsWithChildren): JSX.Element {
|
|
17
|
+
return <ThemeProvider theme={baseTheme}>{children}</ThemeProvider>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module '@emotion/react' {
|
|
21
|
+
export interface Theme extends AppTheme {}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type { AppTheme };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// declare namespace App {
|
|
2
|
+
// interface WindowVariables {
|
|
3
|
+
// example?: string;
|
|
4
|
+
// }
|
|
5
|
+
// }
|
|
6
|
+
|
|
7
|
+
// declare interface Window {
|
|
8
|
+
// app?: App.WindowVariables;
|
|
9
|
+
// }
|
|
10
|
+
|
|
11
|
+
// // Type definitions for @botim/framework
|
|
12
|
+
// // This fixes the module resolution issue where exports don't properly expose types
|
|
13
|
+
// declare module '@botim/framework' {
|
|
14
|
+
// // Core types
|
|
15
|
+
// export interface BridgeInstance {
|
|
16
|
+
// // Lifecycle
|
|
17
|
+
// onLaunch: (cb: () => void) => void;
|
|
18
|
+
// onRestart: (callback: () => void) => void;
|
|
19
|
+
|
|
20
|
+
// // Auth & User
|
|
21
|
+
// getUserInfo: () => Promise<any>;
|
|
22
|
+
// getMpAuthCode: () => Promise<any>;
|
|
23
|
+
// doLogin: () => Promise<any>;
|
|
24
|
+
|
|
25
|
+
// // Navigation
|
|
26
|
+
// closeCurrent: () => void;
|
|
27
|
+
// closeAll: () => void;
|
|
28
|
+
// navigateTo: (options: { url: string; payload?: Record<string, string> } | string) => void;
|
|
29
|
+
// redirectTo: (url: string) => void;
|
|
30
|
+
// navigateBack: () => void;
|
|
31
|
+
// reLaunch: () => void;
|
|
32
|
+
|
|
33
|
+
// // Storage
|
|
34
|
+
// getStorageSync: (key: string) => string | undefined;
|
|
35
|
+
// setStorageSync: (key: string, value: string) => void;
|
|
36
|
+
|
|
37
|
+
// // Page & Query
|
|
38
|
+
// getPageQuery: (name: string) => string | undefined;
|
|
39
|
+
|
|
40
|
+
// // Device & Platform
|
|
41
|
+
// isiOS: () => boolean;
|
|
42
|
+
// isAndroid: () => boolean;
|
|
43
|
+
// isRtl: () => boolean;
|
|
44
|
+
// getNetworkType: () => Promise<any>;
|
|
45
|
+
// getClientInfo: () => DeviceInfo;
|
|
46
|
+
// getDisplayInfoSync: () => DisplayInfo;
|
|
47
|
+
// allowContentOffSet: (options: { isNotAllow: boolean }) => void;
|
|
48
|
+
// checkAPILevel: (version: string | number) => boolean;
|
|
49
|
+
|
|
50
|
+
// // Location
|
|
51
|
+
// getLocation: (options: LocationOptions) => void;
|
|
52
|
+
|
|
53
|
+
// // Native Bridge
|
|
54
|
+
// nativeCall: (options: {
|
|
55
|
+
// method: string;
|
|
56
|
+
// parameters: string[];
|
|
57
|
+
// callback: {
|
|
58
|
+
// success: (res: any) => void;
|
|
59
|
+
// fail: (error: any) => void;
|
|
60
|
+
// };
|
|
61
|
+
// }) => void;
|
|
62
|
+
|
|
63
|
+
// // Keyboard
|
|
64
|
+
// onKeyboardPop: (callback: (val: { data: { keyboardHeight: number; keyboardStatus: number } }) => void) => void;
|
|
65
|
+
|
|
66
|
+
// // App & Theming
|
|
67
|
+
// App: () => { theme: { container: string }; [key: string]: unknown };
|
|
68
|
+
|
|
69
|
+
// // Analytics & Payment
|
|
70
|
+
// mpTrack: (options: Record<string, unknown>) => void;
|
|
71
|
+
// requestPayment: (
|
|
72
|
+
// options: Record<string, unknown>,
|
|
73
|
+
// callback: { success: (res: unknown) => void; fail: (error: unknown) => void }
|
|
74
|
+
// ) => void;
|
|
75
|
+
|
|
76
|
+
// // Catch-all for other properties
|
|
77
|
+
// [k: string]: unknown;
|
|
78
|
+
// }
|
|
79
|
+
|
|
80
|
+
// // Location Types
|
|
81
|
+
// export interface LocationOptions {
|
|
82
|
+
// altitude?: boolean;
|
|
83
|
+
// isHighAccuracy?: boolean;
|
|
84
|
+
// expireTime?: number;
|
|
85
|
+
// success?: (result: LocationResult) => void;
|
|
86
|
+
// fail?: (error: LocationError) => void;
|
|
87
|
+
// complete?: () => void;
|
|
88
|
+
// }
|
|
89
|
+
|
|
90
|
+
// export interface LocationResult {
|
|
91
|
+
// latitude: number;
|
|
92
|
+
// longitude: number;
|
|
93
|
+
// speed: number;
|
|
94
|
+
// accuracy: number;
|
|
95
|
+
// altitude: number;
|
|
96
|
+
// verticalAccuracy: number;
|
|
97
|
+
// horizontalAccuracy: number;
|
|
98
|
+
// }
|
|
99
|
+
|
|
100
|
+
// export interface LocationError {
|
|
101
|
+
// errorCode: number;
|
|
102
|
+
// errorMessage?: string;
|
|
103
|
+
// message?: string;
|
|
104
|
+
// }
|
|
105
|
+
|
|
106
|
+
// // Device Info
|
|
107
|
+
// export interface DeviceInfo {
|
|
108
|
+
// appVersion: string;
|
|
109
|
+
// versionCode: string;
|
|
110
|
+
// deviceType: string;
|
|
111
|
+
// osVersion: string;
|
|
112
|
+
// manufacturer: string;
|
|
113
|
+
// model: string;
|
|
114
|
+
// localTimezone: string;
|
|
115
|
+
// MP_E_SIM: string;
|
|
116
|
+
// canBack: string;
|
|
117
|
+
// }
|
|
118
|
+
|
|
119
|
+
// // Display Info
|
|
120
|
+
// export interface DisplayInfo {
|
|
121
|
+
// darkMode: 0 | 1;
|
|
122
|
+
// hasNotch: 0 | 1;
|
|
123
|
+
// notchHeight: string;
|
|
124
|
+
// }
|
|
125
|
+
|
|
126
|
+
// // Framework types
|
|
127
|
+
// export interface BotimFramework {
|
|
128
|
+
// Run: (success: ($rootScope: any, BOT: BridgeInstance) => void, showLog: boolean) => void;
|
|
129
|
+
// }
|
|
130
|
+
|
|
131
|
+
// export interface FrameworkConfig {
|
|
132
|
+
// showLog: boolean;
|
|
133
|
+
// }
|
|
134
|
+
|
|
135
|
+
// // Main exports
|
|
136
|
+
// export function useBOT(): BridgeInstance;
|
|
137
|
+
// export function useFramework(config?: FrameworkConfig): Promise<BridgeInstance>;
|
|
138
|
+
// export function getNetworkType(): Promise<string>;
|
|
139
|
+
// }
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
|
|
2
|
+
// Type definitions for @botim/bootstrap-mp
|
|
3
|
+
import { AppDisplayInfoType } from '@/stores/types';
|
|
4
|
+
import { ClientInfo } from '@/modules/core/utils/common/types';
|
|
5
|
+
|
|
6
|
+
// Type definitions for @botim/framework
|
|
7
|
+
declare module '@botim/framework' {
|
|
8
|
+
import { BridgeInstance } from '@botim/framework/dist/types';
|
|
9
|
+
|
|
10
|
+
interface BotimFramework {
|
|
11
|
+
Run: (success: ($rootScope: any, BOT: BridgeInstance) => void, showLog: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface FrameworkConfig {
|
|
15
|
+
showLog: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Properly typed useBOT function instead of returning 'any'
|
|
19
|
+
function useBOT(): BridgeInstance;
|
|
20
|
+
|
|
21
|
+
function useFramework(config?: FrameworkConfig): Promise<BridgeInstance>;
|
|
22
|
+
|
|
23
|
+
// Utility functions exported directly from the module
|
|
24
|
+
function getNetworkType(): Promise<string>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Re-export BridgeInstance interface for convenience
|
|
28
|
+
declare module '@botim/framework/dist/types' {
|
|
29
|
+
|
|
30
|
+
interface BridgeInstance {
|
|
31
|
+
// Original methods
|
|
32
|
+
onLaunch: (cb: () => void) => void;
|
|
33
|
+
getUserInfo: () => Promise<any>;
|
|
34
|
+
getMpAuthCode: () => Promise<any>;
|
|
35
|
+
doLogin: () => Promise<any>;
|
|
36
|
+
getNetworkType: () => Promise<any>;
|
|
37
|
+
|
|
38
|
+
// Navigation methods
|
|
39
|
+
closeCurrent: () => void;
|
|
40
|
+
navigateTo: ({ url, payload }: { url: string, payload?: Record<PropertyKey, string> }) => void;
|
|
41
|
+
navigateTo: (url: string) => void;
|
|
42
|
+
|
|
43
|
+
redirectTo: (url: string) => void;
|
|
44
|
+
navigateBack: () => void;
|
|
45
|
+
reLaunch: () => void;
|
|
46
|
+
|
|
47
|
+
// Storage methods
|
|
48
|
+
getStorageSync: (key: string) => string | undefined;
|
|
49
|
+
setStorageSync: (key: string, value: string) => void;
|
|
50
|
+
|
|
51
|
+
// Page and app methods
|
|
52
|
+
getPageQuery: (name: string) => string | undefined;
|
|
53
|
+
|
|
54
|
+
// Device and platform methods
|
|
55
|
+
isiOS: () => boolean;
|
|
56
|
+
allowContentOffSet: (options: { isNotAllow: boolean }) => void;
|
|
57
|
+
checkAPILevel: (version: string | number) => boolean;
|
|
58
|
+
getClientInfo: () => ClientInfo;
|
|
59
|
+
|
|
60
|
+
// Native bridge methods
|
|
61
|
+
nativeCall: (options: {
|
|
62
|
+
method: string;
|
|
63
|
+
parameters: string[];
|
|
64
|
+
callback: {
|
|
65
|
+
success: (res: any) => void;
|
|
66
|
+
fail: (error: any) => void;
|
|
67
|
+
};
|
|
68
|
+
}) => void;
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
// Display information related
|
|
72
|
+
getDisplayInfoSync: () => AppDisplayInfoType;
|
|
73
|
+
|
|
74
|
+
// Platform and device related
|
|
75
|
+
isRtl: () => boolean;
|
|
76
|
+
isiOS: () => boolean;
|
|
77
|
+
isAndroid: () => boolean;
|
|
78
|
+
allowContentOffSet: (options: { isNotAllow: boolean }) => void;
|
|
79
|
+
|
|
80
|
+
// Keyboard related
|
|
81
|
+
onKeyboardPop: (callback: (val: { data: { keyboardHeight: number, keyboardStatus: number } }) => void) => void;
|
|
82
|
+
|
|
83
|
+
// App related
|
|
84
|
+
App: () => { theme: { container: string }; [key: PropertyKey]: unknown };
|
|
85
|
+
|
|
86
|
+
mpTrack: (options: Record<PropertyKey, unknown>) => void;
|
|
87
|
+
|
|
88
|
+
closeAll: () => void;
|
|
89
|
+
|
|
90
|
+
requestPayment: (options: Record<PropertyKey, unknown>, callback: { success: (res: unknown) => void, fail: (error: unknown) => void }) => void;
|
|
91
|
+
|
|
92
|
+
onRestart: (callback: () => void) => void;
|
|
93
|
+
|
|
94
|
+
// Catch-all for other properties
|
|
95
|
+
[k: string]: unknown;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"allowSyntheticDefaultImports": true,
|
|
8
|
+
"allowImportingTsExtensions": true,
|
|
9
|
+
"useDefineForClassFields": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"noUnusedLocals": true,
|
|
15
|
+
"noUnusedParameters": true,
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"types": [],
|
|
18
|
+
"noEmit": true,
|
|
19
|
+
"jsx": "react-jsx",
|
|
20
|
+
"jsxImportSource": "@emotion/react",
|
|
21
|
+
"baseUrl": ".",
|
|
22
|
+
"paths": {
|
|
23
|
+
"@/*": ["src/*"],
|
|
24
|
+
"@modules/*": ["src/modules/*"],
|
|
25
|
+
"@components/*": ["src/components/*"],
|
|
26
|
+
"@hooks/*": ["src/hooks/*"],
|
|
27
|
+
"@i18n/*": ["src/i18n/*"],
|
|
28
|
+
"@pages/*": ["src/pages/*"],
|
|
29
|
+
"@stores/*": ["src/stores/*"],
|
|
30
|
+
"@styles/*": ["src/styles/*"],
|
|
31
|
+
"@theme/*": ["src/theme/*"],
|
|
32
|
+
"@utils/*": ["src/utils/*"]
|
|
33
|
+
},
|
|
34
|
+
"sourceMap": true
|
|
35
|
+
},
|
|
36
|
+
"include": ["src", "types"],
|
|
37
|
+
"exclude": ["node_modules", "dist"],
|
|
38
|
+
"references": [{ "path": "./tsconfig.node.json" }]
|
|
39
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
declare module 'eslint-plugin-jsx-a11y';
|
|
2
|
+
|
|
3
|
+
// Type definitions for @botim/framework
|
|
4
|
+
// This fixes the module resolution issue where exports don't properly expose types
|
|
5
|
+
declare module '@botim/framework' {
|
|
6
|
+
// Core types
|
|
7
|
+
export interface BridgeInstance {
|
|
8
|
+
// Lifecycle
|
|
9
|
+
onLaunch: (cb: () => void) => void;
|
|
10
|
+
onRestart: (callback: () => void) => void;
|
|
11
|
+
|
|
12
|
+
// Auth & User
|
|
13
|
+
getUserInfo: () => Promise<any>;
|
|
14
|
+
getMpAuthCode: () => Promise<any>;
|
|
15
|
+
doLogin: () => Promise<any>;
|
|
16
|
+
|
|
17
|
+
// Navigation
|
|
18
|
+
closeCurrent: () => void;
|
|
19
|
+
closeAll: () => void;
|
|
20
|
+
navigateTo: (options: { url: string; payload?: Record<string, string> } | string) => void;
|
|
21
|
+
redirectTo: (url: string) => void;
|
|
22
|
+
navigateBack: () => void;
|
|
23
|
+
reLaunch: () => void;
|
|
24
|
+
|
|
25
|
+
// Storage
|
|
26
|
+
getStorageSync: (key: string) => string | undefined;
|
|
27
|
+
setStorageSync: (key: string, value: string) => void;
|
|
28
|
+
|
|
29
|
+
// Page & Query
|
|
30
|
+
getPageQuery: (name: string) => string | undefined;
|
|
31
|
+
|
|
32
|
+
// Device & Platform
|
|
33
|
+
isiOS: () => boolean;
|
|
34
|
+
isAndroid: () => boolean;
|
|
35
|
+
isRtl: () => boolean;
|
|
36
|
+
getNetworkType: () => Promise<any>;
|
|
37
|
+
getClientInfo: () => DeviceInfo;
|
|
38
|
+
getDisplayInfoSync: () => DisplayInfo;
|
|
39
|
+
allowContentOffSet: (options: { isNotAllow: boolean }) => void;
|
|
40
|
+
checkAPILevel: (version: string | number) => boolean;
|
|
41
|
+
|
|
42
|
+
// Location
|
|
43
|
+
getLocation: (options: LocationOptions) => void;
|
|
44
|
+
|
|
45
|
+
// Native Bridge
|
|
46
|
+
nativeCall: (options: {
|
|
47
|
+
method: string;
|
|
48
|
+
parameters: string[];
|
|
49
|
+
callback: {
|
|
50
|
+
success: (res: any) => void;
|
|
51
|
+
fail: (error: any) => void;
|
|
52
|
+
};
|
|
53
|
+
}) => void;
|
|
54
|
+
|
|
55
|
+
// Keyboard
|
|
56
|
+
onKeyboardPop: (callback: (val: { data: { keyboardHeight: number; keyboardStatus: number } }) => void) => void;
|
|
57
|
+
|
|
58
|
+
// App & Theming
|
|
59
|
+
App: () => { theme: { container: string }; [key: string]: unknown };
|
|
60
|
+
|
|
61
|
+
// Analytics & Payment
|
|
62
|
+
mpTrack: (options: Record<string, unknown>) => void;
|
|
63
|
+
requestPayment: (
|
|
64
|
+
options: Record<string, unknown>,
|
|
65
|
+
callback: { success: (res: unknown) => void; fail: (error: unknown) => void }
|
|
66
|
+
) => void;
|
|
67
|
+
|
|
68
|
+
// Catch-all for other properties
|
|
69
|
+
[k: string]: unknown;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Location Types
|
|
73
|
+
export interface LocationOptions {
|
|
74
|
+
altitude?: boolean;
|
|
75
|
+
isHighAccuracy?: boolean;
|
|
76
|
+
expireTime?: number;
|
|
77
|
+
success?: (result: LocationResult) => void;
|
|
78
|
+
fail?: (error: LocationError) => void;
|
|
79
|
+
complete?: () => void;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface LocationResult {
|
|
83
|
+
latitude: number;
|
|
84
|
+
longitude: number;
|
|
85
|
+
speed: number;
|
|
86
|
+
accuracy: number;
|
|
87
|
+
altitude: number;
|
|
88
|
+
verticalAccuracy: number;
|
|
89
|
+
horizontalAccuracy: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface LocationError {
|
|
93
|
+
errorCode: number;
|
|
94
|
+
errorMessage?: string;
|
|
95
|
+
message?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Device Info
|
|
99
|
+
export interface DeviceInfo {
|
|
100
|
+
appVersion: string;
|
|
101
|
+
versionCode: string;
|
|
102
|
+
deviceType: string;
|
|
103
|
+
osVersion: string;
|
|
104
|
+
manufacturer: string;
|
|
105
|
+
model: string;
|
|
106
|
+
localTimezone: string;
|
|
107
|
+
MP_E_SIM: string;
|
|
108
|
+
canBack: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Display Info
|
|
112
|
+
export interface DisplayInfo {
|
|
113
|
+
darkMode: 0 | 1;
|
|
114
|
+
hasNotch: 0 | 1;
|
|
115
|
+
notchHeight: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Framework types
|
|
119
|
+
export interface BotimFramework {
|
|
120
|
+
Run: (success: ($rootScope: any, BOT: BridgeInstance) => void, showLog: boolean) => void;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface FrameworkConfig {
|
|
124
|
+
showLog?: boolean;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Main exports
|
|
128
|
+
export function useBOT(): BridgeInstance;
|
|
129
|
+
export function useFramework(config?: FrameworkConfig): Promise<BridgeInstance>;
|
|
130
|
+
export function getNetworkType(): Promise<string>;
|
|
131
|
+
}
|