@jolibox/implement 1.1.47 → 1.1.49

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.
@@ -1,9 +1,9 @@
1
1
  Invoking: npm run clean && npm run build:esm && tsc
2
2
 
3
- > @jolibox/implement@1.1.47 clean
3
+ > @jolibox/implement@1.1.49 clean
4
4
  > rimraf ./dist
5
5
 
6
6
 
7
- > @jolibox/implement@1.1.47 build:esm
7
+ > @jolibox/implement@1.1.49 build:esm
8
8
  > BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
9
9
 
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@jolibox/implement",
3
3
  "description": "This project is Jolibox JS-SDk implement for Native && H5",
4
- "version": "1.1.47",
4
+ "version": "1.1.49",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "@jolibox/common": "1.1.47",
10
- "@jolibox/types": "1.1.47",
11
- "@jolibox/native-bridge": "1.1.47",
12
- "@jolibox/ads": "1.1.47",
9
+ "@jolibox/common": "1.1.49",
10
+ "@jolibox/types": "1.1.49",
11
+ "@jolibox/native-bridge": "1.1.49",
12
+ "@jolibox/ads": "1.1.49",
13
13
  "localforage": "1.10.0",
14
14
  "@jolibox/ui": "1.0.0",
15
15
  "web-vitals": "4.2.4"
@@ -3,14 +3,19 @@ import { ReportHandler, Track, TrackPerformance, CommonReportConfig } from './ty
3
3
  import { PerformanceType, TrackEvent } from '@jolibox/types';
4
4
  import { InternalGlobalJSError } from '@jolibox/common';
5
5
  import { reportError } from './errors/report';
6
+ import { context } from '@/common/context';
6
7
 
7
8
  // Track system event, wrap common config
8
9
  export function createTrack(reportHandler: ReportHandler, common: CommonReportConfig): Track {
9
- const track = (tag: TrackEvent, info: Record<string, unknown> | null, webviewId?: number): void => {
10
+ const track = (
11
+ tag: TrackEvent,
12
+ info: Record<string, unknown> | null,
13
+ originEventType?: EventType
14
+ ): void => {
10
15
  const { eventType, ...rest } = info ?? {};
11
16
  const data = {
12
17
  tag,
13
- eventType: (eventType ?? EventType.Other) as number,
18
+ eventType: originEventType ?? ((eventType ?? EventType.Other) as number),
14
19
  ...common,
15
20
  extra: {
16
21
  ...rest
@@ -19,7 +24,7 @@ export function createTrack(reportHandler: ReportHandler, common: CommonReportCo
19
24
  if (tag == 'globalJsError') {
20
25
  reportError(new InternalGlobalJSError(JSON.stringify(data))); // window.onerror, 白屏
21
26
  } else {
22
- reportHandler('systemLog', data, webviewId);
27
+ reportHandler('systemLog', data, context.webviewId);
23
28
  }
24
29
  };
25
30
 
@@ -49,7 +49,7 @@ const request = (_params: unknown) => {
49
49
  url: t.string(),
50
50
  method: t.string(),
51
51
  headers: t.object().optional(),
52
- data: t.object().optional(),
52
+ data: t.or(t.object(), t.array()).optional(),
53
53
  query: t.object().optional(),
54
54
  dataType: t.string().default('json'),
55
55
  responseType: t.string().default('text'),