gio-miniprogram-sdk 4.4.2 → 4.4.3
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/alipay.js +1 -1
- package/dist/baidu.js +1 -1
- package/dist/bytedance.js +1 -1
- package/dist/jingdong.js +1 -1
- package/dist/kuaishou.js +1 -1
- package/dist/plugins/gioABTest.js +1 -1
- package/dist/plugins/gioCompress.js +1 -1
- package/dist/plugins/gioEventAutoTracking.js +1 -1
- package/dist/plugins/gioImpressionTracking.js +1 -1
- package/dist/plugins/gioMultipleInstances.js +1 -1
- package/dist/plugins/gioPerformance.js +1 -1
- package/dist/qq.js +1 -1
- package/dist/quickapp.js +1 -1
- package/dist/taobao.js +1 -1
- package/dist/taro.js +1 -1
- package/dist/uniapp.js +1 -1
- package/dist/wechat.js +1 -1
- package/dist/xiaohongshu.js +1 -1
- package/package.json +7 -1
- package/.eslintignore +0 -11
- package/.eslintrc.js +0 -120
- package/.github/workflows/greetings.yml +0 -13
- package/.github/workflows/publish.yml +0 -45
- package/.prettierignore +0 -19
- package/.prettierrc.js +0 -9
- package/babel.config.js +0 -6
- package/rollup.config.js +0 -100
- package/rollup.plugins.config.js +0 -84
- package/src/adapters/gioTaobaoAdapter.ts +0 -202
- package/src/adapters/gioTaroAdapter.ts +0 -467
- package/src/adapters/gioUniAppAdapter.ts +0 -431
- package/src/constants/config.ts +0 -170
- package/src/constants/emitMsg.ts +0 -24
- package/src/constants/regex.ts +0 -18
- package/src/core/dataStore/eventContextBuilder.ts +0 -95
- package/src/core/dataStore/eventHooks/appEffects.ts +0 -218
- package/src/core/dataStore/eventHooks/index.ts +0 -468
- package/src/core/dataStore/eventHooks/minipPage.ts +0 -221
- package/src/core/dataStore/eventHooks/pageEffects.ts +0 -189
- package/src/core/dataStore/index.ts +0 -661
- package/src/core/growingIO.ts +0 -637
- package/src/core/pluginsInstance/base.ts +0 -157
- package/src/core/pluginsInstance/taro.ts +0 -15
- package/src/core/pluginsInstance/tb.ts +0 -15
- package/src/core/pluginsInstance/uniapp.ts +0 -15
- package/src/core/uploader.ts +0 -272
- package/src/core/userStore.ts +0 -267
- package/src/index.ts +0 -77
- package/src/minipInstance/base.ts +0 -352
- package/src/minipInstance/framework.ts +0 -24
- package/src/minipInstance/jd.ts +0 -11
- package/src/minipInstance/ks.ts +0 -12
- package/src/minipInstance/my.ts +0 -131
- package/src/minipInstance/qq.ts +0 -12
- package/src/minipInstance/quickapp.ts +0 -233
- package/src/minipInstance/swan.ts +0 -20
- package/src/minipInstance/tb.ts +0 -58
- package/src/minipInstance/tt.ts +0 -12
- package/src/minipInstance/wx.ts +0 -27
- package/src/minipInstance/xhs.ts +0 -20
- package/src/platformConfig/base.ts +0 -82
- package/src/platformConfig/framework.ts +0 -31
- package/src/platformConfig/jd.ts +0 -11
- package/src/platformConfig/ks.ts +0 -11
- package/src/platformConfig/my.ts +0 -16
- package/src/platformConfig/qq.ts +0 -13
- package/src/platformConfig/quickapp.ts +0 -48
- package/src/platformConfig/swan.ts +0 -11
- package/src/platformConfig/tb.ts +0 -29
- package/src/platformConfig/tt.ts +0 -11
- package/src/platformConfig/wx.ts +0 -20
- package/src/platformConfig/xhs.ts +0 -27
- package/src/plugins/gioABTest.ts +0 -348
- package/src/plugins/gioCompress.ts +0 -253
- package/src/plugins/gioEventAutoTracking.ts +0 -310
- package/src/plugins/gioImpressionTracking.ts +0 -386
- package/src/plugins/gioMultipleInstances.ts +0 -189
- package/src/plugins/gioPerformance/exception.ts +0 -152
- package/src/plugins/gioPerformance/monitor.ts +0 -284
- package/src/plugins/gioPerformance/network.ts +0 -197
- package/src/plugins/gioPerformance.ts +0 -131
- package/src/types/base.ts +0 -167
- package/src/types/dataStore.ts +0 -62
- package/src/types/eventHooks.ts +0 -146
- package/src/types/gioCustomTracking.ts +0 -9
- package/src/types/gioEventTracking.ts +0 -10
- package/src/types/gioPerformance.ts +0 -8
- package/src/types/growingIO.ts +0 -137
- package/src/types/minipInstance.ts +0 -133
- package/src/types/platforms.ts +0 -64
- package/src/types/plugins.ts +0 -24
- package/src/types/uploader.ts +0 -30
- package/src/types/userStore.ts +0 -28
- package/src/utils/glodash.ts +0 -430
- package/src/utils/tools.ts +0 -511
- package/src/utils/verifiers.ts +0 -52
- package/tsconfig.json +0 -32
- package/typings/global.d.ts +0 -105
package/rollup.config.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { babel } from '@rollup/plugin-babel';
|
|
3
|
-
import { version } from './package.json';
|
|
4
|
-
import { terser } from 'rollup-plugin-terser';
|
|
5
|
-
import alias from '@rollup/plugin-alias';
|
|
6
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
7
|
-
import filesize from 'rollup-plugin-filesize';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import replace from '@rollup/plugin-replace';
|
|
10
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
11
|
-
import typescript from '@rollup/plugin-typescript';
|
|
12
|
-
|
|
13
|
-
const processENV = process.argv[process.argv.length - 1]
|
|
14
|
-
.split('-')
|
|
15
|
-
.filter((o) => o);
|
|
16
|
-
|
|
17
|
-
// 小程序平台
|
|
18
|
-
const platform = processENV[0];
|
|
19
|
-
// 框架平台
|
|
20
|
-
const frameName = processENV[1];
|
|
21
|
-
// 插件实例的入口名
|
|
22
|
-
const pluginInstanceName =
|
|
23
|
-
frameName || platform === 'tb' ? frameName || platform : 'base';
|
|
24
|
-
// 小程序平台文件名枚举
|
|
25
|
-
const PLATFORMS = {
|
|
26
|
-
wx: 'wechat',
|
|
27
|
-
my: 'alipay',
|
|
28
|
-
swan: 'baidu',
|
|
29
|
-
tt: 'bytedance',
|
|
30
|
-
qq: 'qq',
|
|
31
|
-
ks: 'kuaishou',
|
|
32
|
-
tb: 'taobao',
|
|
33
|
-
jd: 'jingdong',
|
|
34
|
-
quickapp: 'quickapp',
|
|
35
|
-
xhs: 'xiaohongshu'
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// 控制台打印当前打包的环境和小程序平台
|
|
39
|
-
console.log(
|
|
40
|
-
`Packaging ${
|
|
41
|
-
PLATFORMS[platform]
|
|
42
|
-
? 'platform:' + PLATFORMS[platform]
|
|
43
|
-
: 'framework:' + frameName
|
|
44
|
-
}`
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const fileName = () => {
|
|
48
|
-
let n = 'dist/';
|
|
49
|
-
n += PLATFORMS[platform] ? PLATFORMS[platform] : frameName;
|
|
50
|
-
n += '.js';
|
|
51
|
-
return n;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const config = {
|
|
55
|
-
input: 'src/index.ts',
|
|
56
|
-
output: {
|
|
57
|
-
file: fileName(),
|
|
58
|
-
format: 'es'
|
|
59
|
-
},
|
|
60
|
-
plugins: [
|
|
61
|
-
replace({
|
|
62
|
-
__SDK_VERSION__: version,
|
|
63
|
-
__GIO_PLATFORM__: PLATFORMS[platform] ? platform : 'framework',
|
|
64
|
-
__GIO_FRAMEWORK__: PLATFORMS[platform] ? 'native' : frameName,
|
|
65
|
-
__GIO_PLATFORM_CONFIG__: `@@/platformConfig/${platform}.ts`,
|
|
66
|
-
__GIO_PLATFORM_INSTANCE__: `@@/minipInstance/${platform}.ts`,
|
|
67
|
-
__GIO_PLUGIN_INSTANCE__: `@@/core/pluginsInstance/${pluginInstanceName}.ts`
|
|
68
|
-
}),
|
|
69
|
-
alias({
|
|
70
|
-
entries: {
|
|
71
|
-
'@@': path.resolve(__dirname, 'src')
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
resolve(),
|
|
75
|
-
commonjs({ extensions: ['.js', '.ts'] }),
|
|
76
|
-
typescript(),
|
|
77
|
-
babel({
|
|
78
|
-
babelHelpers: 'bundled',
|
|
79
|
-
exclude: 'node_modules/**',
|
|
80
|
-
extensions: ['.ts', '.js', '.json']
|
|
81
|
-
}),
|
|
82
|
-
terser({
|
|
83
|
-
ecma: 'es6',
|
|
84
|
-
format: { comments: false },
|
|
85
|
-
compress: {
|
|
86
|
-
passes: 2,
|
|
87
|
-
unsafe: true,
|
|
88
|
-
unsafe_comps: true,
|
|
89
|
-
unsafe_proto: true,
|
|
90
|
-
unsafe_undefined: true
|
|
91
|
-
}
|
|
92
|
-
}),
|
|
93
|
-
filesize({
|
|
94
|
-
showMinifiedSize: false,
|
|
95
|
-
showGzippedSize: false
|
|
96
|
-
})
|
|
97
|
-
]
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default config;
|
package/rollup.plugins.config.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import * as packageJson from './package.json';
|
|
3
|
-
import { babel } from '@rollup/plugin-babel';
|
|
4
|
-
import { terser } from 'rollup-plugin-terser';
|
|
5
|
-
import alias from '@rollup/plugin-alias';
|
|
6
|
-
import commonjs from '@rollup/plugin-commonjs';
|
|
7
|
-
import filesize from 'rollup-plugin-filesize';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import resolve from '@rollup/plugin-node-resolve';
|
|
10
|
-
import replace from '@rollup/plugin-replace';
|
|
11
|
-
import typescript from '@rollup/plugin-typescript';
|
|
12
|
-
|
|
13
|
-
const fs = require('fs');
|
|
14
|
-
|
|
15
|
-
const processENV = process.argv[process.argv.length - 1]
|
|
16
|
-
.split('-')
|
|
17
|
-
.filter((o) => o);
|
|
18
|
-
// 获取是否打包全量插件
|
|
19
|
-
const folder = processENV[0] ? processENV[0] : 'plugins';
|
|
20
|
-
|
|
21
|
-
// 获取外置插件的目录
|
|
22
|
-
const plugInFolder = fs
|
|
23
|
-
.readdirSync(`./src/${folder}`)
|
|
24
|
-
.filter((o) => !['.DS_Store'].includes(o));
|
|
25
|
-
|
|
26
|
-
const expls = [];
|
|
27
|
-
plugInFolder.forEach((plugin) => {
|
|
28
|
-
if (plugin && plugin.endsWith('.ts')) {
|
|
29
|
-
const outName = plugin.split('.')[0];
|
|
30
|
-
expls.push({
|
|
31
|
-
input: `src/${folder}/${plugin}`,
|
|
32
|
-
output: `${folder}/${outName}.js`,
|
|
33
|
-
name: `${outName}.js`
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const configs = [];
|
|
39
|
-
const configGenerat = ({ input, output, name }) => ({
|
|
40
|
-
input,
|
|
41
|
-
output: {
|
|
42
|
-
file: `dist/${output}`,
|
|
43
|
-
format: 'es',
|
|
44
|
-
name
|
|
45
|
-
},
|
|
46
|
-
plugins: [
|
|
47
|
-
replace({
|
|
48
|
-
__PLUGIN_VERSION__: packageJson.version || '0.0.1'
|
|
49
|
-
}),
|
|
50
|
-
alias({
|
|
51
|
-
entries: {
|
|
52
|
-
'@@': path.resolve(__dirname, 'src')
|
|
53
|
-
}
|
|
54
|
-
}),
|
|
55
|
-
resolve(),
|
|
56
|
-
commonjs({ extensions: ['.js', '.ts'] }),
|
|
57
|
-
typescript({ target: 'ES5' }),
|
|
58
|
-
babel({
|
|
59
|
-
babelHelpers: 'bundled',
|
|
60
|
-
exclude: 'node_modules/**',
|
|
61
|
-
extensions: ['.ts']
|
|
62
|
-
}),
|
|
63
|
-
terser({
|
|
64
|
-
ecma: 'es5',
|
|
65
|
-
format: { comments: false },
|
|
66
|
-
compress: {
|
|
67
|
-
passes: 2,
|
|
68
|
-
unsafe: true,
|
|
69
|
-
unsafe_comps: true,
|
|
70
|
-
unsafe_proto: true,
|
|
71
|
-
unsafe_undefined: true
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
filesize({
|
|
75
|
-
showMinifiedSize: false,
|
|
76
|
-
showGzippedSize: false
|
|
77
|
-
})
|
|
78
|
-
]
|
|
79
|
-
});
|
|
80
|
-
expls.forEach((o) => {
|
|
81
|
-
if (o) configs.push(configGenerat(o));
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
export default configs;
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 名称:淘宝小程序单发插件
|
|
3
|
-
* 用途:用于提供淘宝小程序云函数和云应用的请求方法。
|
|
4
|
-
*/
|
|
5
|
-
import { EVENT, EXTEND_EVENT } from '@@/types/base';
|
|
6
|
-
import { GrowingIOType } from '@@/types/growingIO';
|
|
7
|
-
import { head, unset } from '@@/utils/glodash';
|
|
8
|
-
import EMIT_MSG from '@@/constants/emitMsg';
|
|
9
|
-
|
|
10
|
-
let ut;
|
|
11
|
-
class GioTaobaoAdapter {
|
|
12
|
-
public pluginVersion: string;
|
|
13
|
-
constructor(public growingIO: GrowingIOType) {
|
|
14
|
-
this.pluginVersion = '__PLUGIN_VERSION__';
|
|
15
|
-
const { utils, emitter } = this.growingIO;
|
|
16
|
-
ut = utils;
|
|
17
|
-
emitter.on(EMIT_MSG.OPTION_INITIALIZED, (growingIO: GrowingIOType) => {
|
|
18
|
-
const { inPlugin, dataStore } = growingIO;
|
|
19
|
-
if (inPlugin) {
|
|
20
|
-
ut.getGlobal().Component = function (...args: any[]) {
|
|
21
|
-
return dataStore.eventHooks.componentOverriding(args[0]);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
emitter.on(EMIT_MSG.MINIP_LIFECYCLE, ({ event }) => {
|
|
26
|
-
const { dataStore, vdsConfig } = this.growingIO;
|
|
27
|
-
const widgetName = `小部件${vdsConfig.appId}`;
|
|
28
|
-
switch (event) {
|
|
29
|
-
case 'Page onInit':
|
|
30
|
-
{
|
|
31
|
-
const sendVisit = (relationAppInfo: any, sceneInfo: any) => {
|
|
32
|
-
const query = ut
|
|
33
|
-
.keys(relationAppInfo)
|
|
34
|
-
.map((k) => `${k}=${relationAppInfo[k]}`)
|
|
35
|
-
.join('&');
|
|
36
|
-
dataStore.scene = sceneInfo.sceneId ?? '';
|
|
37
|
-
dataStore.trackersExecute((trackingId: string) => {
|
|
38
|
-
dataStore.sendVisit(trackingId, {
|
|
39
|
-
path: widgetName,
|
|
40
|
-
query,
|
|
41
|
-
title: widgetName
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
this.getRelationAppInfo((relationAppInfo: any) =>
|
|
46
|
-
this.getSceneInfo(relationAppInfo, sendVisit)
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
break;
|
|
50
|
-
case 'Page didMount':
|
|
51
|
-
dataStore.trackersExecute((trackingId: string) => {
|
|
52
|
-
const { trackPage } = dataStore.getTrackerVds(trackingId);
|
|
53
|
-
if (trackPage) {
|
|
54
|
-
dataStore.sendPage(trackingId, {
|
|
55
|
-
path: widgetName,
|
|
56
|
-
title: widgetName
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
break;
|
|
61
|
-
default:
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// 小部件获取场景值信息
|
|
68
|
-
getSceneInfo = (relationAppInfo: any, callback: any) => {
|
|
69
|
-
this.growingIO.minipInstance.minip?.getRelationAppInfo({
|
|
70
|
-
success: (res) => callback(relationAppInfo, res),
|
|
71
|
-
fail: () => callback(relationAppInfo, {})
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// 小部件获取关联小程序的信息
|
|
76
|
-
getRelationAppInfo = (callback: any) => {
|
|
77
|
-
this.growingIO.minipInstance.minip?.getRelationAppInfo({
|
|
78
|
-
success: callback,
|
|
79
|
-
fail: () => callback({})
|
|
80
|
-
});
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// 单条发送无延迟
|
|
84
|
-
singleInvoke = (trackingId: string) => {
|
|
85
|
-
const { vdsConfig, emitter, uploader } = this.growingIO;
|
|
86
|
-
let hoardingQueue = uploader.getHoardingQueue(trackingId);
|
|
87
|
-
let requestQueue = uploader.getRequestQueue(trackingId);
|
|
88
|
-
// 过滤掉重试超过3次的请求(直接丢弃)
|
|
89
|
-
uploader.requestQueue[trackingId] = [...requestQueue].filter(
|
|
90
|
-
(o) => (uploader.retryIds[o.requestId] ?? 0) <= uploader.retryLimit
|
|
91
|
-
);
|
|
92
|
-
// 过滤重新赋值后要重新获取
|
|
93
|
-
requestQueue = uploader.getRequestQueue(trackingId);
|
|
94
|
-
if (ut.isEmpty([...hoardingQueue, ...requestQueue])) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
const eventData: EXTEND_EVENT =
|
|
98
|
-
hoardingQueue.shift() ?? requestQueue.shift();
|
|
99
|
-
let requestData = { ...eventData };
|
|
100
|
-
unset(requestData, ['requestId', 'trackingId']);
|
|
101
|
-
// 开启debug模式时,打印事件日志
|
|
102
|
-
if (vdsConfig.debug) {
|
|
103
|
-
console.log('[GrowingIO Debug]:', JSON.stringify(requestData, null, 2));
|
|
104
|
-
}
|
|
105
|
-
emitter.emit(EMIT_MSG.ON_SEND_BEFORE, { requestData });
|
|
106
|
-
this.cloudFuncInvoke(eventData, requestData);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
// 云函数调用
|
|
110
|
-
cloudFuncInvoke = (eventData: EXTEND_EVENT, requestData: EVENT) => {
|
|
111
|
-
const { vdsConfig, emitter, uploader } = this.growingIO;
|
|
112
|
-
const { serverUrl, projectId, tbConfig } = vdsConfig;
|
|
113
|
-
const app = ut.niceTry(() => getApp() ?? $global);
|
|
114
|
-
const cloud = tbConfig.cloud ?? app.cloud;
|
|
115
|
-
if (cloud?.function?.invoke) {
|
|
116
|
-
uploader.requestingNum += 1;
|
|
117
|
-
cloud.function
|
|
118
|
-
.invoke(
|
|
119
|
-
tbConfig.cloudFuncName,
|
|
120
|
-
{
|
|
121
|
-
domain: serverUrl,
|
|
122
|
-
path: `/v3/projects/${projectId}/collect`,
|
|
123
|
-
params: { stm: Date.now() },
|
|
124
|
-
body: requestData
|
|
125
|
-
},
|
|
126
|
-
tbConfig.cloudFuncHandler
|
|
127
|
-
)
|
|
128
|
-
.then((res) => {
|
|
129
|
-
uploader.requestingNum -= 1;
|
|
130
|
-
// 这里的返回值只是调用了api是否成功,真正是否上报成功不知道,要去淘宝控制台看
|
|
131
|
-
if (res.success) {
|
|
132
|
-
emitter.emit(EMIT_MSG.ON_SEND_AFTER, { result: res, requestData });
|
|
133
|
-
} else {
|
|
134
|
-
uploader.requestFailFn(eventData);
|
|
135
|
-
ut.consoleText(`请求失败! ${JSON.stringify(res)}`, 'error');
|
|
136
|
-
}
|
|
137
|
-
uploader.initiateRequest(eventData.trackingId);
|
|
138
|
-
})
|
|
139
|
-
.catch((e) => {
|
|
140
|
-
uploader.requestingNum -= 1;
|
|
141
|
-
uploader.requestFailFn(eventData);
|
|
142
|
-
ut.consoleText(`请求失败! ${JSON.stringify(e)}`, 'error');
|
|
143
|
-
uploader.initiateRequest(eventData.trackingId);
|
|
144
|
-
});
|
|
145
|
-
} else {
|
|
146
|
-
ut.consoleText(
|
|
147
|
-
'请求失败!无法获取 cloud 对象,请检查 tbConfig 配置项!',
|
|
148
|
-
'error'
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
// 云应用调用
|
|
154
|
-
tbCloudAppInvoke(eventsQueue: EXTEND_EVENT[], requestData: EVENT) {
|
|
155
|
-
const { vdsConfig, emitter, uploader } = this.growingIO;
|
|
156
|
-
const { serverUrl, projectId, tbConfig } = vdsConfig;
|
|
157
|
-
const app = ut.niceTry(() => getApp() ?? $global);
|
|
158
|
-
const cloud = tbConfig.cloud ?? app.cloud;
|
|
159
|
-
if (cloud?.application?.httpRequest) {
|
|
160
|
-
const trackingId = head(eventsQueue).trackingId;
|
|
161
|
-
uploader.requestingNum += 1;
|
|
162
|
-
cloud.application
|
|
163
|
-
.httpRequest({
|
|
164
|
-
//不需要完整域名,只需要接口访问路径即可
|
|
165
|
-
path: tbConfig.path,
|
|
166
|
-
method: 'POST',
|
|
167
|
-
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
|
168
|
-
params: { serverUrl, projectId, stm: Date.now() },
|
|
169
|
-
body: requestData,
|
|
170
|
-
exts: { cloudAppId: tbConfig.cloudAppId }
|
|
171
|
-
})
|
|
172
|
-
.then((res) => {
|
|
173
|
-
uploader.requestingNum -= 1;
|
|
174
|
-
// 这里的返回值只是调用了api是否成功,真正是否上报成功不知道,要看云应用的服务端是不是真的转发成功
|
|
175
|
-
if (res.success) {
|
|
176
|
-
emitter.emit(EMIT_MSG.ON_SEND_AFTER, { result: res, requestData });
|
|
177
|
-
} else {
|
|
178
|
-
eventsQueue.forEach((o: any) => {
|
|
179
|
-
uploader.requestFailFn(o);
|
|
180
|
-
});
|
|
181
|
-
ut.consoleText(`请求失败! ${JSON.stringify(res)}`, 'error');
|
|
182
|
-
}
|
|
183
|
-
uploader.initiateRequest(trackingId);
|
|
184
|
-
})
|
|
185
|
-
.catch((e) => {
|
|
186
|
-
uploader.requestingNum -= 1;
|
|
187
|
-
eventsQueue.forEach((o: any) => {
|
|
188
|
-
uploader.requestFailFn(o);
|
|
189
|
-
});
|
|
190
|
-
ut.consoleText(`请求失败! ${JSON.stringify(e)}`, 'error');
|
|
191
|
-
uploader.initiateRequest(trackingId);
|
|
192
|
-
});
|
|
193
|
-
} else {
|
|
194
|
-
ut.consoleText(
|
|
195
|
-
'请求失败!无法获取 cloud 对象,请检查 tbConfig 配置项!',
|
|
196
|
-
'error'
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export default { name: 'gioTaobaoAdapter', method: GioTaobaoAdapter };
|