@jolibox/implement 1.1.26 → 1.1.27

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.26 clean
3
+ > @jolibox/implement@1.1.27 clean
4
4
  > rimraf ./dist
5
5
 
6
6
 
7
- > @jolibox/implement@1.1.26 build:esm
7
+ > @jolibox/implement@1.1.27 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.26",
4
+ "version": "1.1.27",
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.26",
10
- "@jolibox/types": "1.1.26",
11
- "@jolibox/native-bridge": "1.1.26",
12
- "@jolibox/ads": "1.1.26",
9
+ "@jolibox/common": "1.1.27",
10
+ "@jolibox/types": "1.1.27",
11
+ "@jolibox/native-bridge": "1.1.27",
12
+ "@jolibox/ads": "1.1.27",
13
13
  "localforage": "1.10.0",
14
14
  "@jolibox/ui": "1.0.0",
15
15
  "web-vitals": "4.2.4"
package/src/h5/api/ads.ts CHANGED
@@ -25,6 +25,14 @@ const adsContext: IAdsContext<'GAME'> = {
25
25
  checkNetwork: () => httpClientManager.getNetworkStatus(),
26
26
  track,
27
27
  eventEmitter: adEventEmitter,
28
+ getWindowInfo: () => ({
29
+ width: window.innerWidth * window.devicePixelRatio,
30
+ height: window.innerHeight * window.devicePixelRatio,
31
+ statusBarHeight: 0
32
+ }),
33
+ handleLinkClicked: (link) => {
34
+ window.open(link, '_blank');
35
+ },
28
36
  getContextInfo: () => {
29
37
  return {
30
38
  hostAppId: context.hostInfo?.aid ?? '1',
@@ -40,7 +48,8 @@ const adsContext: IAdsContext<'GAME'> = {
40
48
  deviceModel: context.deviceInfo.model,
41
49
  osType: platform.isAndroid ? 'ANDROID' : platform.isiOS ? 'IOS' : 'PC',
42
50
  runtimeType: 'WEB',
43
- platform: 1000 // WebSDK
51
+ platform: 1000, // WebSDK
52
+ joliSource: context.joliSource ?? ''
44
53
  };
45
54
  }
46
55
  };
@@ -1,6 +1,7 @@
1
1
  import { IHttpClient } from '@/common/http';
2
2
  import { xUserAgent } from '../../common/http/xua';
3
3
  import { context } from '@/common/context';
4
+ import { platform } from '@jolibox/common';
4
5
 
5
6
  declare global {
6
7
  interface Window {
@@ -131,7 +132,9 @@ class JoliboxHttpClient implements IHttpClient {
131
132
  headers ?? {},
132
133
  { 'Content-Type': 'application/json' },
133
134
  xua ? { 'x-user-agent': xua } : {},
134
- joliSource ? { 'x-joli-source': joliSource } : {}
135
+ joliSource ? { 'x-joli-source': joliSource } : {},
136
+ { 'x-os-type': platform.isAndroid ? 'ANDROID' : platform.isiOS ? 'IOS' : 'PC' },
137
+ { 'x-runtime-type': 'WEB' }
135
138
  );
136
139
  const response = await fetch(url, {
137
140
  method: 'POST',
@@ -54,6 +54,15 @@ const adsContext: IAdsContext<'GAME'> = {
54
54
  checkNetwork: checkNetworkStatus,
55
55
  track,
56
56
  eventEmitter: adEventEmitter,
57
+ // TODO: @Deng Xue
58
+ getWindowInfo: () => ({
59
+ width: window.innerWidth * window.devicePixelRatio,
60
+ height: window.innerHeight * window.devicePixelRatio,
61
+ statusBarHeight: 30
62
+ }),
63
+ handleLinkClicked: (link) => {
64
+ window.open(link, '_blank');
65
+ },
57
66
  getContextInfo: () => {
58
67
  return {
59
68
  hostAppId: context.hostInfo?.aid ?? '1',
@@ -69,7 +78,8 @@ const adsContext: IAdsContext<'GAME'> = {
69
78
  deviceModel: context.deviceInfo.model,
70
79
  osType: context.platform === 'android' ? 'ANDROID' : context.platform === 'ios' ? 'IOS' : 'PC',
71
80
  runtimeType: 'APP',
72
- platform: 1000 // WebSDK
81
+ platform: 1000, // WebSDK
82
+ joliSource: context.joliSource ?? ''
73
83
  };
74
84
  }
75
85
  };