gio-miniprogram-sdk 4.0.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.
- package/.babelrc +4 -0
- package/.eslintignore +11 -0
- package/.eslintrc.js +120 -0
- package/.github/workflows/greetings.yml +13 -0
- package/.github/workflows/publish.yml +43 -0
- package/.prettierignore +19 -0
- package/.prettierrc.js +9 -0
- package/LICENSE +674 -0
- package/README.md +103 -0
- package/babel.config.js +6 -0
- package/bin/build/all.sh +38 -0
- package/bin/build/full.sh +32 -0
- package/bin/build/jd.sh +14 -0
- package/bin/build/ks.sh +14 -0
- package/bin/build/my.sh +14 -0
- package/bin/build/plugins.sh +5 -0
- package/bin/build/qq.sh +14 -0
- package/bin/build/quickapp.sh +14 -0
- package/bin/build/swan.sh +14 -0
- package/bin/build/taro.sh +18 -0
- package/bin/build/tb.sh +18 -0
- package/bin/build/tt.sh +14 -0
- package/bin/build/uniapp.sh +18 -0
- package/bin/build/wx.sh +14 -0
- package/dist/alipay.js +1 -0
- package/dist/baidu.js +1 -0
- package/dist/bytedance.js +1 -0
- package/dist/jingdong.js +1 -0
- package/dist/kuaishou.js +1 -0
- package/dist/plugins/gioABTest.js +1 -0
- package/dist/plugins/gioCompress.js +1 -0
- package/dist/plugins/gioEventAutoTracking.js +1 -0
- package/dist/plugins/gioImpressionTracking.js +1 -0
- package/dist/qq.js +1 -0
- package/dist/quickapp.js +1 -0
- package/dist/taobao.js +1 -0
- package/dist/taro.js +1 -0
- package/dist/uniapp.js +1 -0
- package/dist/wechat.js +1 -0
- package/package.json +144 -0
- package/rollup.config.js +92 -0
- package/rollup.plugins.config.js +76 -0
- package/src/constants/config.ts +136 -0
- package/src/constants/regex.ts +4 -0
- package/src/core/dataStore/eventContextBuilder.ts +70 -0
- package/src/core/dataStore/eventHooks/appEffects.ts +220 -0
- package/src/core/dataStore/eventHooks/index.ts +403 -0
- package/src/core/dataStore/eventHooks/minipPage.ts +132 -0
- package/src/core/dataStore/eventHooks/pageEffects.ts +168 -0
- package/src/core/dataStore/index.ts +543 -0
- package/src/core/growingIO.ts +433 -0
- package/src/core/plugins.ts +152 -0
- package/src/core/uploader.ts +219 -0
- package/src/core/userStore.ts +203 -0
- package/src/index.ts +68 -0
- package/src/minipInstance/base.ts +287 -0
- package/src/minipInstance/framework.ts +22 -0
- package/src/minipInstance/jd.ts +11 -0
- package/src/minipInstance/ks.ts +12 -0
- package/src/minipInstance/my.ts +53 -0
- package/src/minipInstance/qq.ts +12 -0
- package/src/minipInstance/quickapp.ts +230 -0
- package/src/minipInstance/swan.ts +20 -0
- package/src/minipInstance/tb.ts +53 -0
- package/src/minipInstance/tt.ts +12 -0
- package/src/minipInstance/wx.ts +12 -0
- package/src/platformConfig/base.ts +86 -0
- package/src/platformConfig/framework.ts +29 -0
- package/src/platformConfig/jd.ts +11 -0
- package/src/platformConfig/ks.ts +11 -0
- package/src/platformConfig/my.ts +15 -0
- package/src/platformConfig/qq.ts +13 -0
- package/src/platformConfig/quickapp.ts +48 -0
- package/src/platformConfig/swan.ts +11 -0
- package/src/platformConfig/tb.ts +29 -0
- package/src/platformConfig/tt.ts +11 -0
- package/src/platformConfig/wx.ts +20 -0
- package/src/pluginsOut/README.md +50 -0
- package/src/pluginsOut/frameworks/gioTaobaoAdapter.ts +195 -0
- package/src/pluginsOut/frameworks/gioTaroAdapter.ts +358 -0
- package/src/pluginsOut/frameworks/gioUniAppAdapter.ts +220 -0
- package/src/pluginsOut/ordinary/gioABTest.ts +254 -0
- package/src/pluginsOut/ordinary/gioCompress.ts +251 -0
- package/src/pluginsOut/ordinary/gioCustomTracking.ts +71 -0
- package/src/pluginsOut/ordinary/gioEventAutoTracking.ts +164 -0
- package/src/pluginsOut/ordinary/gioImpressionTracking.ts +298 -0
- package/src/types/base.ts +150 -0
- package/src/types/dataStore.ts +43 -0
- package/src/types/eventHooks.ts +141 -0
- package/src/types/gioCustomTracking.ts +9 -0
- package/src/types/gioEventTracking.ts +10 -0
- package/src/types/gioPerformance.ts +8 -0
- package/src/types/growingIO.ts +102 -0
- package/src/types/minipInstance.ts +126 -0
- package/src/types/platforms.ts +65 -0
- package/src/types/plugins.ts +24 -0
- package/src/types/uploader.ts +26 -0
- package/src/types/userStore.ts +22 -0
- package/src/utils/glodash.ts +423 -0
- package/src/utils/tools.ts +384 -0
- package/src/utils/verifiers.ts +76 -0
- package/tsconfig.json +32 -0
- package/typings/global.d.ts +92 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export type AppHookLifeCircle = 'onShow' | 'onHide' | 'onError';
|
|
2
|
+
export type PageHookLifeCircle =
|
|
3
|
+
| 'onShow'
|
|
4
|
+
| 'onLoad'
|
|
5
|
+
| 'onReady'
|
|
6
|
+
| 'onHide'
|
|
7
|
+
| 'onUnload'
|
|
8
|
+
| 'onShareAppMessage'
|
|
9
|
+
| 'onTabItemTap';
|
|
10
|
+
|
|
11
|
+
export type ActionEventTypes =
|
|
12
|
+
| 'tap'
|
|
13
|
+
| 'longpress'
|
|
14
|
+
| 'longtap'
|
|
15
|
+
| 'change'
|
|
16
|
+
| 'confirm'
|
|
17
|
+
| 'blur'
|
|
18
|
+
| 'getphonenumber'
|
|
19
|
+
| 'contact'
|
|
20
|
+
| 'submit'
|
|
21
|
+
| 'getuserinfo';
|
|
22
|
+
export interface EventTarget {
|
|
23
|
+
type: ActionEventTypes;
|
|
24
|
+
currentTarget: {
|
|
25
|
+
id: string;
|
|
26
|
+
dataset: {
|
|
27
|
+
index: number | string;
|
|
28
|
+
src: string;
|
|
29
|
+
title: string;
|
|
30
|
+
growingTrack: boolean;
|
|
31
|
+
growingtrack: boolean;
|
|
32
|
+
growingIgnore: boolean;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
target: {
|
|
36
|
+
id: string;
|
|
37
|
+
dataset: {
|
|
38
|
+
index: number | string;
|
|
39
|
+
src: string;
|
|
40
|
+
title: string;
|
|
41
|
+
growingTrack: boolean;
|
|
42
|
+
growingtrack: boolean;
|
|
43
|
+
growingIgnore: boolean;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
detail: any;
|
|
47
|
+
handler: string | undefined;
|
|
48
|
+
timeStamp: number | string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ShareQuery {
|
|
52
|
+
// 访问用户id
|
|
53
|
+
suid: string;
|
|
54
|
+
// 当前用户分享id
|
|
55
|
+
gioShareId: string;
|
|
56
|
+
// 之前用户分享id
|
|
57
|
+
gioPreShareId?: string;
|
|
58
|
+
// 内容类型
|
|
59
|
+
contentType?: string;
|
|
60
|
+
// 内容id
|
|
61
|
+
contentId?: string;
|
|
62
|
+
|
|
63
|
+
[K: string]: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface PageShareResult {
|
|
67
|
+
title: string;
|
|
68
|
+
path?: string;
|
|
69
|
+
query?: string;
|
|
70
|
+
imageUrl?: string;
|
|
71
|
+
contentType?: string;
|
|
72
|
+
contentId?: string;
|
|
73
|
+
attributes?: any;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface MinipPageType {
|
|
77
|
+
path: string;
|
|
78
|
+
time: number;
|
|
79
|
+
query: any;
|
|
80
|
+
settedTitle: any;
|
|
81
|
+
title: string;
|
|
82
|
+
pageProps: any;
|
|
83
|
+
lastLifecycle: string;
|
|
84
|
+
currentLifecycle: string;
|
|
85
|
+
parsePage: (page: any, query: any) => void;
|
|
86
|
+
getQuery: (query: any) => string;
|
|
87
|
+
getReferralPage: () => string;
|
|
88
|
+
saveShareId: (query: string) => void;
|
|
89
|
+
buildShareQuery: (result: PageShareResult) => [string, string];
|
|
90
|
+
updateAppMessageResult: (result: PageShareResult) => PageShareResult;
|
|
91
|
+
updateTimelineResult: (result: PageShareResult) => PageShareResult;
|
|
92
|
+
updateAddFavoritesResult: (result: PageShareResult) => PageShareResult;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface EventHooksType {
|
|
96
|
+
defAppCbs: any;
|
|
97
|
+
defPageCbs: any;
|
|
98
|
+
appHandlers: string[];
|
|
99
|
+
pageHandlers: string[];
|
|
100
|
+
actionEventTypes: string[];
|
|
101
|
+
originalApp: (any: any) => any;
|
|
102
|
+
originalPage: (any: any) => any;
|
|
103
|
+
originalComponent: (any: any) => any;
|
|
104
|
+
originalBehavior: (any: any) => any;
|
|
105
|
+
appEffects: (app: any, event: AppHookLifeCircle, args: any) => void;
|
|
106
|
+
pageEffects: (page: any, event: PageHookLifeCircle, args: any) => void;
|
|
107
|
+
actionEffects: (event: EventTarget, method: string) => void;
|
|
108
|
+
currentPage: MinipPageType;
|
|
109
|
+
// 判断是否为非构造函数的一个函数
|
|
110
|
+
isNormalFc: (key: string, method: any) => any;
|
|
111
|
+
// 补充生命周期函数
|
|
112
|
+
supLifeFcs: (target: any, type: 'app' | 'page') => void;
|
|
113
|
+
// 对象的遍历
|
|
114
|
+
objectTraverse: (target: any, fn: any) => any;
|
|
115
|
+
// 初始化无埋点
|
|
116
|
+
initEventHooks: () => void;
|
|
117
|
+
// 生命周期方法effects
|
|
118
|
+
lifeFcEffects: (eventName: string, method: any, cType: 'App' | 'Page') => any;
|
|
119
|
+
// 自定义方法effects
|
|
120
|
+
customFcEffects: (eventName: string, method: any) => any;
|
|
121
|
+
// app逻辑执行代理
|
|
122
|
+
appApplyProxy: (eventName: string, method: any) => Function;
|
|
123
|
+
// Page事件执行代理
|
|
124
|
+
pageApplyProxy: (eventName: string, method: any) => Function;
|
|
125
|
+
// App重写(重写除构造函数之外的所有方法)
|
|
126
|
+
appOverriding: (options: any) => any;
|
|
127
|
+
// Page/Component/Behavior重写(重写除构造函数之外的所有方法,原生小程序使用)
|
|
128
|
+
pageOverriding: (options: any) => any;
|
|
129
|
+
// Component/Behavior重写(重写除构造函数之外的所有方法)
|
|
130
|
+
componentOverriding: (options: any) => any;
|
|
131
|
+
// App属性重写复用方法
|
|
132
|
+
growingApp: (app: any) => any;
|
|
133
|
+
// Page属性重写复用方法
|
|
134
|
+
growingPage: (page: any) => any;
|
|
135
|
+
// Component属性重写复用方法
|
|
136
|
+
growingComponent: (component: any) => any;
|
|
137
|
+
// Behavior属性重写复用方法
|
|
138
|
+
growingBehavior: (behavior: any) => any;
|
|
139
|
+
// 对原生的重写方法
|
|
140
|
+
nativeGrowing: (designated?: string[]) => void;
|
|
141
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventTarget } from './base';
|
|
2
|
+
|
|
3
|
+
export default interface GioEventAutoTrackingType {
|
|
4
|
+
main: (event: EventTarget, eventName: string) => void;
|
|
5
|
+
getNodeXpath: (e: EventTarget, eventName: string) => string;
|
|
6
|
+
buildClickEvent: (e: EventTarget, eventName: string) => void;
|
|
7
|
+
buildTabClickEvent: (tabItem: any) => void;
|
|
8
|
+
buildChangeEvent: (e: EventTarget, eventName: string) => void;
|
|
9
|
+
buildSubmitEvent: (e: EventTarget, eventName: string) => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { DataStoreType, OriginOptions } from '@@/types/dataStore';
|
|
2
|
+
import { MinipInstanceType } from '@@/types/minipInstance';
|
|
3
|
+
import { FRAMEWORKS, PLATFORMTYPES } from '@@/types/platforms';
|
|
4
|
+
import { PluginsType } from '@@/types/plugins';
|
|
5
|
+
import { UploaderType } from '@@/types/uploader';
|
|
6
|
+
import { UserStoreType } from '@@/types/userStore';
|
|
7
|
+
|
|
8
|
+
export interface GrowingIOType {
|
|
9
|
+
// 小程序平台
|
|
10
|
+
gioPlatform: PLATFORMTYPES;
|
|
11
|
+
// 标记当前小程序是什么框架
|
|
12
|
+
gioFramework: FRAMEWORKS;
|
|
13
|
+
// sdk版本号
|
|
14
|
+
sdkVersion: string;
|
|
15
|
+
// 是否在小程序插件中标识
|
|
16
|
+
inPlugin: boolean;
|
|
17
|
+
// 分包在全局中的实例key值
|
|
18
|
+
subKey?: string;
|
|
19
|
+
// 小程序实例配置
|
|
20
|
+
platformConfig: any;
|
|
21
|
+
// sdk初始化标识
|
|
22
|
+
gioSDKInitialized: boolean;
|
|
23
|
+
// 所有配置项
|
|
24
|
+
vdsConfig: OriginOptions;
|
|
25
|
+
// 小程序实例
|
|
26
|
+
minipInstance: MinipInstanceType;
|
|
27
|
+
// 用户管理实例
|
|
28
|
+
userStore: UserStoreType;
|
|
29
|
+
// 数据管理实例
|
|
30
|
+
dataStore: DataStoreType;
|
|
31
|
+
// 插件管理实例
|
|
32
|
+
plugins: PluginsType;
|
|
33
|
+
// 上传组件实例
|
|
34
|
+
uploader: UploaderType;
|
|
35
|
+
// 无埋点插件实例
|
|
36
|
+
eventTracking?: any;
|
|
37
|
+
// 埋点插件实例
|
|
38
|
+
customTracking?: any;
|
|
39
|
+
// taro3中存储完整的页面节点信息
|
|
40
|
+
taro3VMs?: any;
|
|
41
|
+
// 分享数据
|
|
42
|
+
shareAppMessage?: any;
|
|
43
|
+
// 初始化方法
|
|
44
|
+
init: (args: any) => void;
|
|
45
|
+
// 注册插件
|
|
46
|
+
registerPlugins?: (path?: string) => void;
|
|
47
|
+
// 运行中修改配置
|
|
48
|
+
setOption: (optionKey: string, value: any) => void;
|
|
49
|
+
// 运行中获取配置
|
|
50
|
+
getOption: (optionKey?: string) => any;
|
|
51
|
+
// 创建自定义埋点事件
|
|
52
|
+
track?: (
|
|
53
|
+
name: string,
|
|
54
|
+
properties: { [key: string]: string },
|
|
55
|
+
items?: { key: string; id: string; attributes?: { [key: string]: string } }
|
|
56
|
+
) => void;
|
|
57
|
+
// 设置登录用户Id
|
|
58
|
+
setUserId?: (userId: string, userKey?: string) => void;
|
|
59
|
+
// 清除登录用户Id
|
|
60
|
+
clearUserId?: () => void;
|
|
61
|
+
// 设置openId作为uid
|
|
62
|
+
identify?: (openId: string) => void;
|
|
63
|
+
// 发送用户变量
|
|
64
|
+
setUserAttributes?: (userAttributes: any) => void;
|
|
65
|
+
// 初始化回调
|
|
66
|
+
initCallback?: () => void;
|
|
67
|
+
// 错误提示
|
|
68
|
+
callError?: (fn: string, type?: boolean, msg?: string) => void;
|
|
69
|
+
// 工具类
|
|
70
|
+
utils?: any;
|
|
71
|
+
// 事件通用维度组装
|
|
72
|
+
eventContextBuilder?: (updateTime?: boolean) => any;
|
|
73
|
+
// 事件转换
|
|
74
|
+
eventConverter?: (event: any) => void;
|
|
75
|
+
// 事件拦截器
|
|
76
|
+
eventInterceptor?: (event: any) => void;
|
|
77
|
+
// 设置埋点通用属性
|
|
78
|
+
setGeneralProps?: (properties: any) => void;
|
|
79
|
+
// 清除已设置的埋点通用属性
|
|
80
|
+
clearGeneralProps?: (properties: string[] | undefined) => void;
|
|
81
|
+
// 手动更新曝光监听
|
|
82
|
+
updateImpression?: (collect?: any) => void;
|
|
83
|
+
// 清除所有事件计时器
|
|
84
|
+
clearTrackTimer?: () => void;
|
|
85
|
+
// 手动获取位置信息补发visit上报
|
|
86
|
+
setLocation: (latitude: number, longitude: number) => void;
|
|
87
|
+
// 获取打通信息
|
|
88
|
+
getGioInfo: () => string;
|
|
89
|
+
// 获取ABTest数据
|
|
90
|
+
getABTest?: (layerId: string, callback?: (arg: any) => any) => void;
|
|
91
|
+
|
|
92
|
+
emitter: {
|
|
93
|
+
emit?: (msg: string, args?: any) => void;
|
|
94
|
+
on?: (msg: string, method: (args?: any) => any) => void;
|
|
95
|
+
once?: (msg: string, method: (args?: any) => any) => void;
|
|
96
|
+
off?: (msg: string, method: (args?: any) => any) => void;
|
|
97
|
+
};
|
|
98
|
+
GioApp?: any;
|
|
99
|
+
GioPage?: any;
|
|
100
|
+
GioComponent?: any;
|
|
101
|
+
GioBehavior?: any;
|
|
102
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { PLATFORMS } from './platforms';
|
|
2
|
+
|
|
3
|
+
export interface NavigateToMiniProgramOption {
|
|
4
|
+
appId: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
extraData?: any;
|
|
7
|
+
envVersion?: any;
|
|
8
|
+
success: (res: any) => void;
|
|
9
|
+
fail: (err: any) => void;
|
|
10
|
+
complete: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface AppSource {
|
|
14
|
+
extra: any;
|
|
15
|
+
packageName: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface UserInfo {
|
|
20
|
+
nickname: string;
|
|
21
|
+
avatarUrl: string;
|
|
22
|
+
gender: number;
|
|
23
|
+
province: string;
|
|
24
|
+
city: string;
|
|
25
|
+
country: string;
|
|
26
|
+
}
|
|
27
|
+
export interface SystemInfo {
|
|
28
|
+
// 设备品牌
|
|
29
|
+
brand: string;
|
|
30
|
+
// 设备型号
|
|
31
|
+
model: string;
|
|
32
|
+
// 设备像素比
|
|
33
|
+
pixelRatio: number;
|
|
34
|
+
// 屏幕宽度,单位px
|
|
35
|
+
screenWidth: number;
|
|
36
|
+
// 屏幕高度,单位px
|
|
37
|
+
screenHeight: number;
|
|
38
|
+
// 语言
|
|
39
|
+
language: string;
|
|
40
|
+
// 平台容器版本号
|
|
41
|
+
version: string;
|
|
42
|
+
// 操作系统及版本
|
|
43
|
+
system: string;
|
|
44
|
+
// 客户端基础库版本
|
|
45
|
+
SDKVersion: string;
|
|
46
|
+
// 客户端平台
|
|
47
|
+
platform: string;
|
|
48
|
+
}
|
|
49
|
+
export interface Location {
|
|
50
|
+
// 纬度,范围为 -90~90,负数表示南纬
|
|
51
|
+
latitude: number;
|
|
52
|
+
// 经度,范围为 -180~180,负数表示西经
|
|
53
|
+
longitude: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface MinipInstanceType {
|
|
57
|
+
// 小程序原生对象 wx/my/tt/swan/qq/ks
|
|
58
|
+
readonly minip: any;
|
|
59
|
+
// 当前平台
|
|
60
|
+
platform: PLATFORMS;
|
|
61
|
+
// 场景值前缀
|
|
62
|
+
scnPrefix: string;
|
|
63
|
+
// 地理位置
|
|
64
|
+
location: Location;
|
|
65
|
+
// 快应用来源
|
|
66
|
+
appSource: AppSource;
|
|
67
|
+
// 系统信息
|
|
68
|
+
systemInfo: any;
|
|
69
|
+
// 网络信息
|
|
70
|
+
network: any;
|
|
71
|
+
// hook动态设置页面标题方法
|
|
72
|
+
hookSetTitle: () => void;
|
|
73
|
+
// 获取快应用来源信息
|
|
74
|
+
getAppSource?: () => AppSource;
|
|
75
|
+
// 保留当前页面,跳转到应用内的某个页面
|
|
76
|
+
navigateTo?: (opt: any) => void;
|
|
77
|
+
// 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
|
|
78
|
+
switchTab?: (opt: any) => void;
|
|
79
|
+
// 打开另一个小程序
|
|
80
|
+
navigateToMiniProgram?: (opt: NavigateToMiniProgramOption) => void;
|
|
81
|
+
// 获取图片信息
|
|
82
|
+
getImageInfo: (args: any) => any;
|
|
83
|
+
// 采集曝光事件
|
|
84
|
+
initImpression?: (collectPage: any) => void;
|
|
85
|
+
// 获取快应用分享信息
|
|
86
|
+
initShareAppMessage?: (growingio: any) => void;
|
|
87
|
+
// 获取当前页面栈
|
|
88
|
+
getCurrentPage: () => any;
|
|
89
|
+
// 获取当前页面路由
|
|
90
|
+
getCurrentPath: (page?: any) => string;
|
|
91
|
+
// 获取页面标题
|
|
92
|
+
getPageTitle: (page: any) => string;
|
|
93
|
+
// 同步获取存储数据
|
|
94
|
+
getStorageSync: (key: string) => any;
|
|
95
|
+
// 异步获取存储数据
|
|
96
|
+
getStorage: (key: string) => Promise<string>;
|
|
97
|
+
// 同步存储数据
|
|
98
|
+
setStorageSync: (
|
|
99
|
+
key: string,
|
|
100
|
+
value: any,
|
|
101
|
+
expiredAt?: string | number
|
|
102
|
+
) => void;
|
|
103
|
+
// 异步存储数据
|
|
104
|
+
setStorage: (key: string, value: any) => void;
|
|
105
|
+
// 同步移除指定数据
|
|
106
|
+
removeStorageSync: (key: string) => void;
|
|
107
|
+
// 异步移除指定数据
|
|
108
|
+
removeStorage: (key: string) => void;
|
|
109
|
+
// 获取网络类型
|
|
110
|
+
getNetworkType: () => Promise<{ networkType: string }>;
|
|
111
|
+
// 网络请求
|
|
112
|
+
request: ({
|
|
113
|
+
url,
|
|
114
|
+
data,
|
|
115
|
+
header,
|
|
116
|
+
timeout,
|
|
117
|
+
method,
|
|
118
|
+
fail,
|
|
119
|
+
success,
|
|
120
|
+
complete
|
|
121
|
+
}: any) => void;
|
|
122
|
+
// 获取小程序系统信息
|
|
123
|
+
getSystemInfo?: () => Promise<SystemInfo>;
|
|
124
|
+
// 获取小程序设置
|
|
125
|
+
getSetting?: () => any;
|
|
126
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type PLATFORMS =
|
|
2
|
+
| 'MinP'
|
|
3
|
+
| 'alip'
|
|
4
|
+
| 'tbp'
|
|
5
|
+
| 'baidup'
|
|
6
|
+
| 'qq'
|
|
7
|
+
| 'bytedance'
|
|
8
|
+
| 'kuaishoup'
|
|
9
|
+
| 'jdp'
|
|
10
|
+
| 'quickapp';
|
|
11
|
+
export type PLATFORMTYPES =
|
|
12
|
+
| 'wx'
|
|
13
|
+
| 'my'
|
|
14
|
+
| 'tb'
|
|
15
|
+
| 'swan'
|
|
16
|
+
| 'qq'
|
|
17
|
+
| 'tt'
|
|
18
|
+
| 'ks'
|
|
19
|
+
| 'jd'
|
|
20
|
+
| 'quickapp';
|
|
21
|
+
|
|
22
|
+
export type FRAMEWORKS = 'taro' | 'uniapp' | 'full';
|
|
23
|
+
|
|
24
|
+
export interface PlatformConfigType {
|
|
25
|
+
name?: string;
|
|
26
|
+
platform?: PLATFORMS;
|
|
27
|
+
scnPrefix?: string;
|
|
28
|
+
appHandlers?: string[];
|
|
29
|
+
pageHandlers?: string[];
|
|
30
|
+
actionEventTypes?: string[];
|
|
31
|
+
originalPage?: (any) => any;
|
|
32
|
+
originalApp?: (any) => any;
|
|
33
|
+
originalComponent?: (any) => any;
|
|
34
|
+
originalBehavior?: (any) => any;
|
|
35
|
+
hooks?: {
|
|
36
|
+
App: boolean;
|
|
37
|
+
Page: boolean;
|
|
38
|
+
Component: boolean;
|
|
39
|
+
Behavior: boolean;
|
|
40
|
+
};
|
|
41
|
+
canHook: boolean;
|
|
42
|
+
listeners?: {
|
|
43
|
+
app: {
|
|
44
|
+
appLaunch: string;
|
|
45
|
+
appShow: string;
|
|
46
|
+
appClose: string;
|
|
47
|
+
};
|
|
48
|
+
page: {
|
|
49
|
+
pageLoad: string;
|
|
50
|
+
pageShow: string;
|
|
51
|
+
pageReady: string;
|
|
52
|
+
pageHide: string;
|
|
53
|
+
pageUnload: string;
|
|
54
|
+
tabTap: string;
|
|
55
|
+
shareApp: string;
|
|
56
|
+
shareTime?: string;
|
|
57
|
+
addFavorites?: string;
|
|
58
|
+
};
|
|
59
|
+
actions: {
|
|
60
|
+
click: string[];
|
|
61
|
+
change: string[];
|
|
62
|
+
submit: string[];
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface PluginItem {
|
|
2
|
+
name: string;
|
|
3
|
+
method: (growingIO) => void;
|
|
4
|
+
options?: any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface PluginsType {
|
|
8
|
+
gioCompress?: any;
|
|
9
|
+
gioCustomTracking?: any;
|
|
10
|
+
gioEventAutoTracking?: any;
|
|
11
|
+
gioImpressionTracking?: any;
|
|
12
|
+
gioMultiIntegrate?: any;
|
|
13
|
+
gioPerformance?: any;
|
|
14
|
+
gioTaobaoAdapter?: any;
|
|
15
|
+
gioTaroAdapter?: any;
|
|
16
|
+
gioUniAppAdapter?: any;
|
|
17
|
+
innerPluginInit: () => void;
|
|
18
|
+
outerPluginInit?: (folder?: string) => void;
|
|
19
|
+
install: (pluginName: string, showLog: boolean) => boolean;
|
|
20
|
+
installAll: (plugins: PluginItem[]) => void;
|
|
21
|
+
pluginItems: PluginItem[];
|
|
22
|
+
uninstall: (pluginName: string) => boolean;
|
|
23
|
+
uninstallAll: () => void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface UploaderType {
|
|
2
|
+
// 因forceLogin配置积压的事件请求队列
|
|
3
|
+
hoardingQueue: any[];
|
|
4
|
+
// 请求队列
|
|
5
|
+
requestQueue: any[];
|
|
6
|
+
// 请求限制最大数
|
|
7
|
+
requestLimit: number;
|
|
8
|
+
// 请求超时时间(ms)
|
|
9
|
+
requestTimeout: number;
|
|
10
|
+
// 请求重试限制最大数
|
|
11
|
+
retryLimit: number;
|
|
12
|
+
// 请求重试的原请求id
|
|
13
|
+
retryIds: any;
|
|
14
|
+
// 请求中的请求数
|
|
15
|
+
requestingNum: number;
|
|
16
|
+
// 请求地址
|
|
17
|
+
requestURL: string;
|
|
18
|
+
// 提交请求至队列
|
|
19
|
+
commitRequest: (reqData) => void;
|
|
20
|
+
// 发送请求
|
|
21
|
+
initiateRequest: (forceSend?: boolean) => void;
|
|
22
|
+
// 请求错误回调
|
|
23
|
+
requestFailFn: (data) => void;
|
|
24
|
+
// 更新/生成新的上报地址方法
|
|
25
|
+
generateURL?: () => void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface UserStoreType {
|
|
2
|
+
// 访问用户id在存储中的名称
|
|
3
|
+
uidStorageName: string;
|
|
4
|
+
// 登录用户id在存储中的名称
|
|
5
|
+
userIdStorageName: string;
|
|
6
|
+
// 最后一次登录用户id在存储中的名称
|
|
7
|
+
gioIdStorageName: string;
|
|
8
|
+
// 用户访问会话id
|
|
9
|
+
sessionId: string;
|
|
10
|
+
// 访问用户id(系统设置持久性存储)
|
|
11
|
+
uid: string;
|
|
12
|
+
// 登录用户id(客户设置持久性存储)
|
|
13
|
+
userId: string;
|
|
14
|
+
// idMapping userKey(客户设置持久性存储)
|
|
15
|
+
userKey: string;
|
|
16
|
+
// 最后一次登录用户id(持久性存储)
|
|
17
|
+
gioId: string;
|
|
18
|
+
// 初始化用户信息
|
|
19
|
+
initUserInfo: () => void;
|
|
20
|
+
// 退出小程序时在存储中同步用户信息
|
|
21
|
+
saveUserInfo: () => void;
|
|
22
|
+
}
|