@jolibox/implement 1.1.16-beta.1 → 1.1.16-beta.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/.rush/temp/package-deps_build.json +5 -5
- package/dist/common/context/url-parse.d.ts +2 -0
- package/dist/index.js +3 -3
- package/dist/index.native.js +13 -13
- package/implement.build.log +2 -2
- package/package.json +4 -4
- package/src/common/context/index.ts +7 -2
- package/src/common/context/url-parse.ts +4 -2
- package/src/native/bootstrap/index.ts +7 -0
- package/src/native/network/index.ts +1 -1
package/implement.build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
2
|
|
|
3
|
-
> @jolibox/implement@1.1.16-beta.
|
|
3
|
+
> @jolibox/implement@1.1.16-beta.3 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.16-beta.
|
|
7
|
+
> @jolibox/implement@1.1.16-beta.3 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,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.1.16-beta.
|
|
4
|
+
"version": "1.1.16-beta.3",
|
|
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.16-beta.
|
|
10
|
-
"@jolibox/types": "1.1.16-beta.
|
|
11
|
-
"@jolibox/native-bridge": "1.1.16-beta.
|
|
9
|
+
"@jolibox/common": "1.1.16-beta.3",
|
|
10
|
+
"@jolibox/types": "1.1.16-beta.3",
|
|
11
|
+
"@jolibox/native-bridge": "1.1.16-beta.3",
|
|
12
12
|
"localforage": "1.10.0",
|
|
13
13
|
"@jolibox/ui": "1.0.0",
|
|
14
14
|
"web-vitals": "4.2.4"
|
|
@@ -43,8 +43,13 @@ const wrapContext = () => {
|
|
|
43
43
|
const defaultGameID = urlParams.get('mpId') ?? urlParams.get('appId') ?? urlParams.get('gameId') ?? '';
|
|
44
44
|
const sessionId =
|
|
45
45
|
env.clientSessionId ?? payloadJson?.sessionId ?? urlParams.get('sessionId') ?? defaultSessionId;
|
|
46
|
-
const testAdsMode = !!(
|
|
47
|
-
|
|
46
|
+
const testAdsMode = !!(
|
|
47
|
+
payloadJson?.testAdsMode ??
|
|
48
|
+
payloadJson?.__testAdsMode ??
|
|
49
|
+
urlParams.get('testAdsMode') === 'true'
|
|
50
|
+
);
|
|
51
|
+
const joliboxEnv =
|
|
52
|
+
payloadJson?.joliboxEnv ?? payloadJson?.__joliboxEnv ?? urlParams.get('joliboxEnv') ?? 'production';
|
|
48
53
|
const testMode = joliboxEnv === 'staging';
|
|
49
54
|
const channel = headerJson?.channel;
|
|
50
55
|
|
|
@@ -10,8 +10,8 @@ interface HeaderJson {
|
|
|
10
10
|
|
|
11
11
|
interface PayloadJson {
|
|
12
12
|
id?: string;
|
|
13
|
-
testAdsMode?: boolean;
|
|
14
|
-
joliboxEnv?: 'staging' | 'production';
|
|
13
|
+
testAdsMode?: boolean; // deprecated
|
|
14
|
+
joliboxEnv?: 'staging' | 'production'; // deprecated
|
|
15
15
|
sessionId?: string;
|
|
16
16
|
__mpType?: 'game' | 'miniApp';
|
|
17
17
|
__orientation?: 'HORIZONTAL' | 'VERTICAL';
|
|
@@ -20,6 +20,8 @@ interface PayloadJson {
|
|
|
20
20
|
__showStatusBar?: boolean;
|
|
21
21
|
__shouldInterupt?: boolean;
|
|
22
22
|
__from?: number; // 从哪个小程序打开的
|
|
23
|
+
__testAdsMode?: boolean;
|
|
24
|
+
__joliboxEnv?: 'staging' | 'production';
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
interface Signature {
|
|
@@ -73,6 +73,12 @@ function addWebviewReadyListener() {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
function addI18nChangedListener() {
|
|
77
|
+
onNative('onI18nChanged', ({ language }) => {
|
|
78
|
+
hostEmitter.emit('onI18nChanged', { i18n: language });
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
76
82
|
function handleTaskTracker(duration?: number) {
|
|
77
83
|
// 只有小游戏场景需要上报进度
|
|
78
84
|
if (context.mpType === 'game') {
|
|
@@ -164,6 +170,7 @@ export function config(): void {
|
|
|
164
170
|
addShowAdListener();
|
|
165
171
|
addDoExitLoader();
|
|
166
172
|
addWebviewReadyListener();
|
|
173
|
+
addI18nChangedListener();
|
|
167
174
|
fetchMetaConfig();
|
|
168
175
|
cleanStyles = initializeNativeEnv();
|
|
169
176
|
}
|
|
@@ -6,7 +6,7 @@ import { context } from '@/common/context';
|
|
|
6
6
|
* inner fetch
|
|
7
7
|
*/
|
|
8
8
|
const defaultHeaders: Record<string, string> = {
|
|
9
|
-
'x-user-agent': xUserAgent()
|
|
9
|
+
// 'x-user-agent': xUserAgent()
|
|
10
10
|
};
|
|
11
11
|
if (context.hostUserInfo?.token) {
|
|
12
12
|
defaultHeaders['x-joli-token'] = context.hostUserInfo.token;
|