@jolibox/implement 1.1.4-beta.16 → 1.1.4-beta.17
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/.rush/temp/package-deps_build.json +14 -14
- package/dist/common/ads/channel-policy.d.ts +24 -2
- package/dist/common/ads/index.d.ts +1 -0
- package/dist/common/context/index.d.ts +1 -0
- package/dist/common/report/base-tracker.d.ts +9 -0
- package/dist/common/report/errors/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.native.js +3 -3
- package/dist/native/network/index.d.ts +0 -3
- package/implement.build.log +2 -2
- package/package.json +3 -3
- package/src/common/ads/channel-policy.ts +49 -4
- package/src/common/ads/index.ts +6 -4
- package/src/common/api-factory/index.ts +3 -3
- package/src/common/context/index.ts +3 -0
- package/src/common/report/base-tracker.ts +40 -0
- package/src/common/report/errors/index.ts +3 -3
- package/src/common/report/errors/report/listeners.ts +0 -2
- package/src/common/report/track.ts +2 -2
- package/src/h5/http/index.ts +1 -2
- package/src/h5/report/index.ts +1 -1
- package/src/native/api/ads.ts +6 -2
- package/src/native/network/index.ts +11 -4
- package/src/native/types/native-method-map.d.ts +11 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { debounce } from '@jolibox/common';
|
|
2
2
|
import { ReportHandler, Track, TrackPerformance, CommonReportConfig } from './types';
|
|
3
3
|
import { PerformanceType, TrackEvent } from '@jolibox/types';
|
|
4
|
-
import {
|
|
4
|
+
import { InternalGlobalJSError } from '@jolibox/common';
|
|
5
5
|
import { reportError } from './errors/report';
|
|
6
6
|
|
|
7
7
|
// Track system event, wrap common config
|
|
@@ -15,7 +15,7 @@ export function createTrack(reportHandler: ReportHandler, common: CommonReportCo
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
if (tag == 'globalJsError') {
|
|
18
|
-
reportError(new
|
|
18
|
+
reportError(new InternalGlobalJSError(JSON.stringify(data))); // window.onerror, 白屏
|
|
19
19
|
} else {
|
|
20
20
|
reportHandler('systemLog', data, webviewId);
|
|
21
21
|
}
|
package/src/h5/http/index.ts
CHANGED
|
@@ -25,8 +25,7 @@ export class JoliboxHttpClient implements IHttpClient {
|
|
|
25
25
|
private xua = xUserAgent();
|
|
26
26
|
|
|
27
27
|
private getJoliSource = () => {
|
|
28
|
-
|
|
29
|
-
return urlParams.get('joliSource') ?? null;
|
|
28
|
+
return context.joliSource;
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
// private getApiBaseURL = () => {
|
package/src/h5/report/index.ts
CHANGED
|
@@ -32,7 +32,7 @@ const { track, trackPerformance } = createTracks((...args) => {
|
|
|
32
32
|
mp_id: (_data.mp_id as string) ?? '',
|
|
33
33
|
mp_version: (_data.mp_version as string) ?? ''
|
|
34
34
|
};
|
|
35
|
-
//TODO:
|
|
35
|
+
//TODO: 根据上报重要性做采样
|
|
36
36
|
const eventBody: IEvent = {
|
|
37
37
|
name: data.tag,
|
|
38
38
|
type: EventType.System,
|
package/src/native/api/ads.ts
CHANGED
|
@@ -7,8 +7,12 @@ import { IAdsInitParams, JoliboxAdsImpl, IAdConfigParams, IAdBreakParams, IAdUni
|
|
|
7
7
|
import { track } from '../report';
|
|
8
8
|
|
|
9
9
|
import { innerFetch as fetch } from '../network';
|
|
10
|
+
import { invokeNative } from '../bootstrap/bridge';
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
const checkNetworkStatus = () => {
|
|
13
|
+
const { data } = invokeNative('getNetworkStatusSync');
|
|
14
|
+
return !!data?.isConnected;
|
|
15
|
+
};
|
|
12
16
|
const ads = new JoliboxAdsImpl(
|
|
13
17
|
track,
|
|
14
18
|
{
|
|
@@ -20,7 +24,7 @@ const ads = new JoliboxAdsImpl(
|
|
|
20
24
|
...options
|
|
21
25
|
}).then((res) => res.response.data as T)
|
|
22
26
|
},
|
|
23
|
-
|
|
27
|
+
checkNetworkStatus
|
|
24
28
|
);
|
|
25
29
|
|
|
26
30
|
const adInit = createSyncAPI('adInit', {
|
|
@@ -5,11 +5,18 @@ import { context } from '@/common/context';
|
|
|
5
5
|
/**
|
|
6
6
|
* inner fetch
|
|
7
7
|
*/
|
|
8
|
+
const defaultHeaders: Record<string, string> = {
|
|
9
|
+
'x-user-agent': xUserAgent()
|
|
10
|
+
};
|
|
11
|
+
if (context.hostUserInfo?.token) {
|
|
12
|
+
defaultHeaders['x-joli-token'] = context.hostUserInfo.token;
|
|
13
|
+
}
|
|
14
|
+
if (context.joliSource) {
|
|
15
|
+
defaultHeaders['x-joli-source'] = context.joliSource;
|
|
16
|
+
}
|
|
17
|
+
|
|
8
18
|
export const innerFetch = createFetch('createRequestTaskSync', 'operateRequestTaskSync', {
|
|
9
19
|
type: 'inner',
|
|
10
20
|
baseUrl: context.testMode ? 'https://stg-api.jolibox.com' : 'https://api.jolibox.com',
|
|
11
|
-
defaultHeaders
|
|
12
|
-
'x-user-agent': xUserAgent(),
|
|
13
|
-
'X-JOLI-TOKEN': context.hostUserInfo?.token ?? ''
|
|
14
|
-
}
|
|
21
|
+
defaultHeaders
|
|
15
22
|
});
|
|
@@ -237,6 +237,17 @@ declare global {
|
|
|
237
237
|
realNameAuthenticationStatus?: 'uncertified' | 'certified';
|
|
238
238
|
};
|
|
239
239
|
}>;
|
|
240
|
+
|
|
241
|
+
getNetworkStatusSync: () => {
|
|
242
|
+
/** 错误消息 */
|
|
243
|
+
errMsg: string;
|
|
244
|
+
/** 错误码 */
|
|
245
|
+
errNo?: number;
|
|
246
|
+
data: {
|
|
247
|
+
isConnected: boolean;
|
|
248
|
+
networkType: 'wifi' | '4g' | '5g' | '3g' | '2g' | 'unknown';
|
|
249
|
+
};
|
|
250
|
+
};
|
|
240
251
|
}
|
|
241
252
|
|
|
242
253
|
interface NativeEventMap {
|