gio-miniprogram-sdk 4.4.2 → 4.5.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.
Files changed (100) hide show
  1. package/README.md +13 -11
  2. package/dist/alipay.js +1 -1
  3. package/dist/baidu.js +1 -1
  4. package/dist/bytedance.js +1 -1
  5. package/dist/jingdong.js +1 -1
  6. package/dist/kuaishou.js +1 -1
  7. package/dist/mpx.js +1 -0
  8. package/dist/plugins/gioABTest.js +1 -1
  9. package/dist/plugins/gioCompress.js +1 -1
  10. package/dist/plugins/gioEventAutoTracking.js +1 -1
  11. package/dist/plugins/gioImpressionTracking.js +1 -1
  12. package/dist/plugins/gioMultipleInstances.js +1 -1
  13. package/dist/plugins/gioPerformance.js +1 -1
  14. package/dist/qq.js +1 -1
  15. package/dist/quickapp.js +1 -1
  16. package/dist/taobao.js +1 -1
  17. package/dist/taro.js +1 -1
  18. package/dist/uniapp.js +1 -1
  19. package/dist/wechat.js +1 -1
  20. package/dist/xiaohongshu.js +1 -1
  21. package/package.json +13 -2
  22. package/.eslintignore +0 -11
  23. package/.eslintrc.js +0 -120
  24. package/.github/workflows/greetings.yml +0 -13
  25. package/.github/workflows/publish.yml +0 -45
  26. package/.prettierignore +0 -19
  27. package/.prettierrc.js +0 -9
  28. package/babel.config.js +0 -6
  29. package/rollup.config.js +0 -100
  30. package/rollup.plugins.config.js +0 -84
  31. package/src/adapters/gioTaobaoAdapter.ts +0 -202
  32. package/src/adapters/gioTaroAdapter.ts +0 -467
  33. package/src/adapters/gioUniAppAdapter.ts +0 -431
  34. package/src/constants/config.ts +0 -170
  35. package/src/constants/emitMsg.ts +0 -24
  36. package/src/constants/regex.ts +0 -18
  37. package/src/core/dataStore/eventContextBuilder.ts +0 -95
  38. package/src/core/dataStore/eventHooks/appEffects.ts +0 -218
  39. package/src/core/dataStore/eventHooks/index.ts +0 -468
  40. package/src/core/dataStore/eventHooks/minipPage.ts +0 -221
  41. package/src/core/dataStore/eventHooks/pageEffects.ts +0 -189
  42. package/src/core/dataStore/index.ts +0 -661
  43. package/src/core/growingIO.ts +0 -637
  44. package/src/core/pluginsInstance/base.ts +0 -157
  45. package/src/core/pluginsInstance/taro.ts +0 -15
  46. package/src/core/pluginsInstance/tb.ts +0 -15
  47. package/src/core/pluginsInstance/uniapp.ts +0 -15
  48. package/src/core/uploader.ts +0 -272
  49. package/src/core/userStore.ts +0 -267
  50. package/src/index.ts +0 -77
  51. package/src/minipInstance/base.ts +0 -352
  52. package/src/minipInstance/framework.ts +0 -24
  53. package/src/minipInstance/jd.ts +0 -11
  54. package/src/minipInstance/ks.ts +0 -12
  55. package/src/minipInstance/my.ts +0 -131
  56. package/src/minipInstance/qq.ts +0 -12
  57. package/src/minipInstance/quickapp.ts +0 -233
  58. package/src/minipInstance/swan.ts +0 -20
  59. package/src/minipInstance/tb.ts +0 -58
  60. package/src/minipInstance/tt.ts +0 -12
  61. package/src/minipInstance/wx.ts +0 -27
  62. package/src/minipInstance/xhs.ts +0 -20
  63. package/src/platformConfig/base.ts +0 -82
  64. package/src/platformConfig/framework.ts +0 -31
  65. package/src/platformConfig/jd.ts +0 -11
  66. package/src/platformConfig/ks.ts +0 -11
  67. package/src/platformConfig/my.ts +0 -16
  68. package/src/platformConfig/qq.ts +0 -13
  69. package/src/platformConfig/quickapp.ts +0 -48
  70. package/src/platformConfig/swan.ts +0 -11
  71. package/src/platformConfig/tb.ts +0 -29
  72. package/src/platformConfig/tt.ts +0 -11
  73. package/src/platformConfig/wx.ts +0 -20
  74. package/src/platformConfig/xhs.ts +0 -27
  75. package/src/plugins/gioABTest.ts +0 -348
  76. package/src/plugins/gioCompress.ts +0 -253
  77. package/src/plugins/gioEventAutoTracking.ts +0 -310
  78. package/src/plugins/gioImpressionTracking.ts +0 -386
  79. package/src/plugins/gioMultipleInstances.ts +0 -189
  80. package/src/plugins/gioPerformance/exception.ts +0 -152
  81. package/src/plugins/gioPerformance/monitor.ts +0 -284
  82. package/src/plugins/gioPerformance/network.ts +0 -197
  83. package/src/plugins/gioPerformance.ts +0 -131
  84. package/src/types/base.ts +0 -167
  85. package/src/types/dataStore.ts +0 -62
  86. package/src/types/eventHooks.ts +0 -146
  87. package/src/types/gioCustomTracking.ts +0 -9
  88. package/src/types/gioEventTracking.ts +0 -10
  89. package/src/types/gioPerformance.ts +0 -8
  90. package/src/types/growingIO.ts +0 -137
  91. package/src/types/minipInstance.ts +0 -133
  92. package/src/types/platforms.ts +0 -64
  93. package/src/types/plugins.ts +0 -24
  94. package/src/types/uploader.ts +0 -30
  95. package/src/types/userStore.ts +0 -28
  96. package/src/utils/glodash.ts +0 -430
  97. package/src/utils/tools.ts +0 -511
  98. package/src/utils/verifiers.ts +0 -52
  99. package/tsconfig.json +0 -32
  100. package/typings/global.d.ts +0 -105
@@ -1,131 +0,0 @@
1
- /**
2
- * 名称:性能采集插件
3
- * 用途:用于采集小程序基本性能信息。
4
- */
5
- import { GrowingIOType } from '@@/types/growingIO';
6
- import { isEmpty } from '@@/utils/glodash';
7
- import { limitObject } from '@@/utils/tools';
8
- import EMIT_MSG from '@@/constants/emitMsg';
9
- import Exception from './gioPerformance/exception';
10
- import Monitor from './gioPerformance/monitor';
11
- import Network from './gioPerformance/network';
12
-
13
- let ut;
14
- class GioPerformance {
15
- public pluginVersion: string;
16
- public network: any;
17
- public exception: any;
18
- public monitor: any;
19
- // 缓存队列,SDK初始化完成之后再根据性能的配置项发送数据
20
- private cacheQueue: any[];
21
- constructor(public growingIO: GrowingIOType, public options: any = {}) {
22
- this.pluginVersion = '__PLUGIN_VERSION__';
23
- ut = this.growingIO.utils;
24
- this.options = {
25
- monitor: true,
26
- exception: true,
27
- network: false,
28
- ...this.options
29
- };
30
- this.cacheQueue = [];
31
- this.growingIO.emitter.on(EMIT_MSG.SDK_INITIALIZED, (vdsConfig: any) => {
32
- if (vdsConfig.trackingId === this.growingIO.trackingId) {
33
- // 初始化配置项优先级更高(后续版本考虑把配置项值放在插件options上去配,弱化初始化配置项)
34
- const { monitor, exception, network } = vdsConfig.performance;
35
- if (monitor !== this.options.monitor) {
36
- this.options.monitor = monitor;
37
- }
38
- if (exception !== this.options.exception) {
39
- this.options.exception = exception;
40
- }
41
- if (network !== this.options.network) {
42
- this.options.network = network;
43
- }
44
- this.init();
45
- }
46
- });
47
- // 采集开关从关闭到打开时要把队列中存的启动和错误都发出去
48
- // 采集开关开启必会更新session
49
- this.growingIO.emitter?.on(EMIT_MSG.SESSIONID_UPDATE, () => {
50
- const { trackingId, getOption } = this.growingIO;
51
- if (getOption(trackingId, 'dataCollect')) {
52
- this.sendCacheQuene();
53
- }
54
- });
55
- }
56
-
57
- init = () => {
58
- const { dataCollect } = this.growingIO.vdsConfig;
59
- const { monitor, exception, network } = this.options;
60
- if (monitor) {
61
- this.monitor = new Monitor(this.growingIO);
62
- }
63
- if (exception) {
64
- this.exception = new Exception(this.growingIO);
65
- }
66
- if (network) {
67
- this.network = new Network(this.growingIO, this.options);
68
- }
69
- // SDK初始化完成发送缓存队列
70
- if (dataCollect) {
71
- this.sendCacheQuene();
72
- }
73
- };
74
-
75
- // 发送缓存队列
76
- sendCacheQuene = () => {
77
- if (!ut.isEmpty(this.cacheQueue)) {
78
- this.cacheQueue.forEach((o: any) => {
79
- this.buildPerfEvent(o.eventName, o.attributes, o.extra);
80
- });
81
- this.cacheQueue = [];
82
- }
83
- };
84
-
85
- // 构建各种性能事件
86
- buildPerfEvent = (eventName: string, attributes: any, extra?: any) => {
87
- const {
88
- dataStore: { eventContextBuilder, eventConverter },
89
- gioSDKInitialized,
90
- vdsConfig
91
- } = this.growingIO;
92
- // SDK没初始化完成或初始化关闭采集开关的事件先存起来,等SDK初始化完成或开启采集开关再发
93
- if (!gioSDKInitialized || !vdsConfig.dataCollect) {
94
- this.cacheQueue = [
95
- ...this.cacheQueue,
96
- {
97
- eventName,
98
- attributes,
99
- extra
100
- }
101
- ];
102
- return false;
103
- }
104
- // 处理过长的小数,保留0位
105
- ut.forEach(attributes, (v, k) => {
106
- if (Number.isNaN(v) || ut.isNil(v) || Number(v) < 0) {
107
- attributes[k] = 0;
108
- }
109
- attributes[k] = ut.fixed(v, 0);
110
- });
111
- let event = {
112
- eventType: 'CUSTOM',
113
- eventName,
114
- attributes,
115
- ...eventContextBuilder(this.growingIO.trackingId)
116
- };
117
- event.attributes = limitObject({
118
- ...(event.attributes ?? {}),
119
- ...attributes
120
- });
121
- if (!isEmpty(extra)) {
122
- event = { ...event, ...extra };
123
- }
124
- eventConverter(event);
125
- };
126
- }
127
-
128
- export default {
129
- name: 'gioPerformance',
130
- method: GioPerformance
131
- };
package/src/types/base.ts DELETED
@@ -1,167 +0,0 @@
1
- export interface StringObject {
2
- [key: string]: string;
3
- }
4
-
5
- interface TBConfig {
6
- cloud: any;
7
- cloudFuncSend?: boolean;
8
- cloudFuncName?: string;
9
- cloudFuncHandler?: string;
10
- cloudAppId?: string;
11
- path?: string;
12
- }
13
- export interface UserOptions {
14
- // 是否开启无埋点
15
- autotrack: boolean;
16
- // 是否开启加密压缩
17
- compress: boolean;
18
- // 是否开启数据采集
19
- dataCollect: boolean;
20
- // 是否开启调试模式
21
- debug: boolean;
22
- // 是否开启
23
- idMapping: boolean;
24
- // 与内嵌页打通时额外的信息参数
25
- extraParams: string[];
26
- // 是否开启分享跟踪
27
- followShare: boolean;
28
- // 是否开启强制登录
29
- forceLogin: boolean;
30
- // 或略上报字段
31
- ignoreFields: string[];
32
- // 曝光比例
33
- impressionScale: number;
34
- // 是否使用原始来源信息作为访问事件的参数上报
35
- originalSource: boolean;
36
- // session保活时长(5分钟)
37
- keepAlive: number;
38
- // 性能采集配置
39
- performance?: {
40
- monitor: boolean;
41
- exception: boolean;
42
- network: boolean;
43
- };
44
- // 请求超时时长
45
- requestTimeout?: number;
46
- // 数据上报域名
47
- serverUrl?: string;
48
- // session超时时长
49
- sessionExpires?: number;
50
- // taro框架实例
51
- taro?: any;
52
- // taro框架vue实例
53
- taroVue?: any;
54
- // 淘宝小程序/小部件配置
55
- tbConfig?: TBConfig;
56
- // uniapp vue实例
57
- uniVue?: boolean;
58
- // 上报间隔(1秒)
59
- uploadInterval: number;
60
- // 小程序应用版本
61
- version: string;
62
- }
63
-
64
- export interface ErrorEventParams {
65
- key?: string;
66
- error: string;
67
- page?: string;
68
- function?: string;
69
- }
70
-
71
- export interface Element {
72
- x: string;
73
- v?: string;
74
- h?: string;
75
- idx?: number;
76
- obj?: number;
77
- }
78
-
79
- export type EventTypes =
80
- | 'PAGE'
81
- | 'VISIT'
82
- | 'CUSTOM'
83
- | 'VISITOR_ATTRIBUTES'
84
- | 'LOGIN_USER_ATTRIBUTES'
85
- | 'APP_CLOSED'
86
- | 'VIEW_CLICK'
87
- | 'VIEW_CHANGE';
88
-
89
- export interface EVENT {
90
- appChannel: string;
91
- appVersion: string;
92
- attributes?: any;
93
- dataSourceId: string;
94
- deviceBrand: string;
95
- deviceId: string;
96
- deviceModel: string;
97
- deviceType: string;
98
- domain: string;
99
- eventName: string;
100
- eventSequenceId: number;
101
- eventType: EventTypes;
102
- hyperlink?: string;
103
- index?: number;
104
- language: string;
105
- latitude?: number;
106
- longitude?: number;
107
- networkState: string;
108
- path?: string;
109
- platform: string;
110
- platformVersion: string;
111
- properties?: any;
112
- query?: string;
113
- referralPage?: string;
114
- screenHeight: number;
115
- screenWidth: number;
116
- sdkVersion: string;
117
- sessionId: string;
118
- textValue?: string;
119
- timestamp: number;
120
- title: string;
121
- userId?: string;
122
- xpath?: string;
123
- }
124
-
125
- export interface EXTEND_EVENT extends EVENT {
126
- requestId: string;
127
- trackingId: string;
128
- }
129
-
130
- export type Actions =
131
- | 'tap'
132
- | 'longpress'
133
- | 'longtap'
134
- | 'change'
135
- | 'confirm'
136
- | 'blur'
137
- | 'getphonenumber'
138
- | 'contact'
139
- | 'getuserinfo';
140
-
141
- export interface EventTarget {
142
- type: Actions;
143
- currentTarget: {
144
- id: string;
145
- dataset: {
146
- index: number | string;
147
- src: string;
148
- title: string;
149
- growingTrack: boolean;
150
- growingtrack: boolean;
151
- growingIgnore: boolean;
152
- };
153
- };
154
- target: {
155
- id: string;
156
- dataset: {
157
- index: number | string;
158
- src: string;
159
- title: string;
160
- growingTrack: boolean;
161
- growingtrack: boolean;
162
- growingIgnore: boolean;
163
- };
164
- };
165
- detail: any;
166
- handler: string | undefined;
167
- }
@@ -1,62 +0,0 @@
1
- import { UserOptions } from '@@/types/base';
2
- import { EventHooksType } from '@@/types/eventHooks';
3
-
4
- export type StorageKeyType =
5
- | 'gsid'
6
- | 'originalSource'
7
- | 'uid'
8
- | 'sessionId'
9
- | 'userId'
10
- | 'userKey'
11
- | 'gioId';
12
-
13
- export interface OriginOptions extends UserOptions {
14
- appId: string;
15
- dataSourceId?: string;
16
- projectId: string;
17
- trackingId: string;
18
- }
19
-
20
- export interface DataStoreType {
21
- buildAddFavorites: (trackingId: string, args: any) => void;
22
- buildAppMessageEvent: (trackingId: string, args: any) => void;
23
- buildTimelineEvent: (trackingId: string, args: any) => void;
24
- // 事件通用维度组装
25
- eventContextBuilder?: (
26
- trackingId: string,
27
- params?: any,
28
- executeAttributes?: boolean
29
- ) => any;
30
- eventConverter?: (event) => void;
31
- eventHooks: EventHooksType;
32
- eventInterceptor?: (event: any | void) => void;
33
- eventReleaseInspector?: () => void;
34
- generalProps: any;
35
- getStorageKey: (trackingId: string, name: StorageKeyType) => string;
36
- getTrackerVds: (trackingId: string) => any;
37
- getOption: (trackingId: string, k?: string) => OriginOptions;
38
- getOriginalSource: (trackingId: string) => any;
39
- getGsid: (trackingId: string) => number;
40
- setGsid: (trackingId: string, value: number) => void;
41
- initTrackerOptions: (userOptions: OriginOptions) => any;
42
- initTrackerHooker: (trackerOptions: OriginOptions) => void;
43
- initOptions: (userOptions: OriginOptions) => OriginOptions;
44
- initStorageInfo: (trackingId: string) => void;
45
- interceptEvents: any[];
46
- lastCloseTime: number;
47
- lastPageEvent: any;
48
- lastScene: number | string;
49
- lastVisitEvent: any;
50
- locationData: any;
51
- saveStorageInfo: () => void;
52
- scene: number | string;
53
- sendPage: (trackingId: string, props?: any) => void;
54
- sendVisit: (trackingId: string, props?: any) => void;
55
- setOption: (trackingId: string, k: string, v: any) => boolean;
56
- setOriginalSource: (trackingId: string, origins: any) => void;
57
- shareOut: boolean;
58
- toggleShareOut: (v?: boolean) => void;
59
- trackTimers?: any;
60
- initializedTrackingIds: string[];
61
- trackersExecute: (callback: (trackingId: string) => void) => void;
62
- }
@@ -1,146 +0,0 @@
1
- import { EVENT } from './base';
2
-
3
- export type AppHookLifeCircle = 'onShow' | 'onHide' | 'onError';
4
- export type PageHookLifeCircle =
5
- | 'onShow'
6
- | 'onLoad'
7
- | 'onReady'
8
- | 'onHide'
9
- | 'onUnload'
10
- | 'onShareAppMessage'
11
- | 'onTabItemTap';
12
-
13
- export type ActionEventTypes =
14
- | 'tap'
15
- | 'longpress'
16
- | 'longtap'
17
- | 'change'
18
- | 'confirm'
19
- | 'blur'
20
- | 'getphonenumber'
21
- | 'contact'
22
- | 'submit'
23
- | 'getuserinfo';
24
- export interface EventTarget {
25
- type: ActionEventTypes;
26
- currentTarget: {
27
- id: string;
28
- dataset: {
29
- index: number | string;
30
- src: string;
31
- title: string;
32
- growingTrack: boolean;
33
- growingtrack: boolean;
34
- growingIgnore: boolean;
35
- };
36
- };
37
- target: {
38
- id: string;
39
- dataset: {
40
- index: number | string;
41
- src: string;
42
- title: string;
43
- growingTrack: boolean;
44
- growingtrack: boolean;
45
- growingIgnore: boolean;
46
- };
47
- };
48
- detail: any;
49
- handler: string | undefined;
50
- timeStamp: number | string;
51
- }
52
-
53
- export interface ShareQuery {
54
- // 访问用户id
55
- suid: string;
56
- // 当前用户分享id
57
- gioShareId: string;
58
- // 之前用户分享id
59
- gioPreShareId?: string;
60
- // 内容类型
61
- contentType?: string;
62
- // 内容id
63
- contentId?: string;
64
-
65
- [K: string]: string;
66
- }
67
-
68
- export interface PageShareResult {
69
- title: string;
70
- path?: string;
71
- query?: string;
72
- imageUrl?: string;
73
- contentType?: string;
74
- contentId?: string;
75
- attributes?: any;
76
- }
77
-
78
- export interface MinipPageType {
79
- queryOptions: any;
80
- configuredTitle: any;
81
- pageProps: any;
82
- lastLifecycle: string;
83
- currentLifecycle: string;
84
- lifeBeforeShow: boolean;
85
- getPagePath: () => string;
86
- getPageQuery: () => string;
87
- getPageTitle: (trackingId?: string) => string;
88
- getReferralPage: (trackingId: string) => string;
89
- buildShareQuery: (result: PageShareResult) => [string, string];
90
- updateShareResult: (
91
- result: PageShareResult,
92
- fillParams?: boolean
93
- ) => PageShareResult;
94
- eventSetPageProps: (trackingId: string, event: EVENT) => any;
95
- }
96
-
97
- export interface EventHooksType {
98
- defAppCbs: any;
99
- defPageCbs: any;
100
- appHandlers: string[];
101
- pageHandlers: string[];
102
- actionEventTypes: string[];
103
- appEffects: any;
104
- pageEffects: any;
105
- actionEffects: any;
106
- currentPage: MinipPageType;
107
- // 判断是否为非构造函数的一个函数
108
- isNormalFc: (key: string, method: any) => any;
109
- // 补充生命周期函数
110
- supLifeFcs: (target: any, type: 'app' | 'page') => void;
111
- // 对象的遍历
112
- objectTraverse: (target: any, fn: any) => any;
113
-
114
- // 生命周期方法effects
115
- lifeFcEffects: (eventName: string, method: any, cType: 'App' | 'Page') => any;
116
- // 自定义方法effects
117
- customFcEffects: (eventName: string, method: any) => any;
118
- // app逻辑执行代理
119
- appApplyProxy: (eventName: string, method: any) => Function;
120
- // Page事件执行代理
121
- pageApplyProxy: (eventName: string, method: any) => Function;
122
- // App重写(重写除构造函数之外的所有方法)
123
- appOverriding: (options: any) => any;
124
- // Page/Component/Behavior重写(重写除构造函数之外的所有方法,原生小程序使用)
125
- pageOverriding: (options: any) => any;
126
- // Component/Behavior重写(重写除构造函数之外的所有方法)
127
- componentOverriding: (options: any) => any;
128
- // 挂载App生命周期的effect方法
129
- setAppEffectCbs: () => void;
130
- // 挂载Page/Component生命周期的effect方法
131
- setPageEffectCbs: () => void;
132
- // App属性重写复用方法
133
- growingApp: (app: any) => any;
134
- // Page属性重写复用方法
135
- growingPage: (page: any) => any;
136
- // Component属性重写复用方法
137
- growingComponent: (component: any) => any;
138
- // Behavior属性重写复用方法
139
- growingBehavior: (behavior: any) => any;
140
- // 对原生的重写方法
141
- nativeGrowing: (designated?: string[]) => void;
142
- // 初始化原始值
143
- initOriginalValue: () => void;
144
- // 初始化事件钩子
145
- initEventHooks: () => void;
146
- }
@@ -1,9 +0,0 @@
1
- export interface GioCustomTrackingType {
2
- // 构建自定义埋点事件
3
- buildCustomEvent: (
4
- name: string,
5
- properties: { [key: string]: string }
6
- ) => void;
7
- // 构建用户变量事件
8
- buildUserAttributesEvent?: (attributes: { [key: string]: string }) => void;
9
- }
@@ -1,10 +0,0 @@
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
- }
@@ -1,8 +0,0 @@
1
- export interface PERF_MONITOR_VLUES {
2
- title: string;
3
- page_launch_duration?: number | string;
4
- first_contentful_paint_duration?: number;
5
- largest_contentful_paint_duration?: number;
6
- reboot_duration?: number;
7
- reboot_mode?: 'warm' | 'cold';
8
- }
@@ -1,137 +0,0 @@
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
- utils?: any;
11
- // 监听器
12
- emitter: {
13
- emit?: (msg: string, args?: any) => void;
14
- on?: (msg: string, method: (args?: any) => any) => void;
15
- once?: (msg: string, method: (args?: any) => any) => void;
16
- off?: (msg: string, method: (args?: any) => any) => void;
17
- };
18
- // 小程序平台
19
- gioPlatform: PLATFORMTYPES;
20
- // 标记当前小程序是什么框架
21
- gioFramework: FRAMEWORKS;
22
- // sdk版本号
23
- sdkVersion: string;
24
- // 是否在小程序插件中标识
25
- inPlugin: boolean;
26
- // 分包在全局中的实例key值
27
- subKey?: string;
28
- // 小程序实例配置
29
- platformConfig: any;
30
- // sdk初始化标识
31
- gioSDKInitialized: boolean;
32
- // 所有配置项
33
- vdsConfig: OriginOptions;
34
- // 小程序实例
35
- minipInstance: MinipInstanceType;
36
- // 用户管理实例
37
- userStore: UserStoreType;
38
- // 数据管理实例
39
- dataStore: DataStoreType;
40
- // 插件管理实例
41
- plugins: PluginsType;
42
- // 上传组件实例
43
- uploader: UploaderType;
44
- // 无埋点插件实例
45
- eventTracking?: any;
46
- // 埋点插件实例
47
- customTracking?: any;
48
- // taro3中存储完整的页面节点信息
49
- taro3VMs?: any;
50
- // 分享数据
51
- shareAppMessage?: any;
52
- // 用于放在事件中区别于为其他功能而生成事件的跟踪器Id,默认为g0
53
- trackingId: string;
54
- // 存储子实例的配置和信息
55
- subInstance: {
56
- [key: string]: OriginOptions;
57
- };
58
- // 初始化方法
59
- init: (args: any) => void;
60
- // 注册插件
61
- registerPlugins?: (path?: string) => void;
62
- // 运行中修改配置
63
- setOption: (trackingId: string, optionKey: string, value: any) => void;
64
- // 运行中获取配置
65
- getOption: (trackingId: string, optionKey?: string) => any;
66
- // 设置页面属性
67
- setPageAttributes: (trackingId: string, properties: any) => void;
68
- // 清空已设置的页面属性
69
- clearPageAttributes: (
70
- trackingId: string,
71
- properties: string[] | undefined
72
- ) => void;
73
- // 手动发page
74
- sendPage: (trackingId: string, props?: any) => void;
75
- // 设置openId作为uid
76
- identify?: (trackingId: string, openId: string) => void;
77
- // 发送用户变量
78
- setUserAttributes?: (trackingId: string, userAttributes: any) => void;
79
- // 设置登录用户Id
80
- setUserId?: (trackingId: string, userId: string, userKey?: string) => void;
81
- // 清除登录用户Id
82
- clearUserId?: (trackingId: string) => void;
83
- // 设置全局通用属性
84
- setGeneralProps?: (trackingId: string, properties: any) => void;
85
- // 清除已设置的全局通用属性
86
- clearGeneralProps?: (
87
- trackingId: string,
88
- properties: string[] | undefined
89
- ) => void;
90
- // 创建自定义埋点事件
91
- track?: (
92
- trackingId: string,
93
- name: string,
94
- properties: { [key: string]: string },
95
- items?: { key: string; id: string; attributes?: { [key: string]: string } }
96
- ) => void;
97
- // 初始化事件计时器
98
- trackTimerStart: (trackingId: string, eventName: string) => any;
99
- // 暂停事件计时器
100
- trackTimerPause: (trackingId: string, timerId: string) => boolean;
101
- // 恢复事件计时器
102
- trackTimerResume: (trackingId: string, timerId: string) => boolean;
103
- // 停止事件计时器并上报事件
104
- trackTimerEnd: (
105
- trackingId: string,
106
- timerId: string,
107
- properties: any
108
- ) => boolean;
109
- // 移除事件计时器
110
- removeTimer: (trackingId: string, timerId: string) => boolean;
111
- // 清除所有事件计时器
112
- clearTrackTimer: (trackingId: string) => void;
113
- // 手动获取位置信息补发visit上报
114
- setLocation: (
115
- trackingId: string,
116
- latitude: number,
117
- longitude: number
118
- ) => void;
119
- // 手动更新曝光监听
120
- updateImpression?: (collect?: any) => void;
121
- // 获取ABTest数据
122
- getABTest?: (
123
- trackingId: string,
124
- layerId: string,
125
- callback?: (arg: any) => any
126
- ) => void;
127
- // 获取打通信息
128
- getGioInfo: (trackingId: string) => string;
129
- // 初始化回调
130
- initCallback?: () => void;
131
- // 错误提示
132
- callError?: (fn: string, type?: boolean, msg?: string) => void;
133
- GioApp?: any;
134
- GioPage?: any;
135
- GioComponent?: any;
136
- GioBehavior?: any;
137
- }