@jolibox/implement 1.1.51 → 1.1.52-beta.1
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 +7 -5
- package/CHANGELOG.json +11 -0
- package/CHANGELOG.md +9 -0
- package/dist/index.js +9 -9
- package/dist/index.native.js +31 -31
- package/implement.build.log +2 -2
- package/implementation.build.log +9 -0
- package/package.json +6 -6
- package/src/common/rewards/fetch-reward.ts +8 -7
- package/src/h5/api/ads.ts +5 -13
- package/src/native/api/base.ts +4 -1
- package/src/native/api/call-host-method.ts +37 -4
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.
|
|
3
|
+
> @jolibox/implement@1.1.52-beta.1 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.
|
|
7
|
+
> @jolibox/implement@1.1.52-beta.1 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
|
+
|
|
3
|
+
> @jolibox/implementation@1.1.4-beta.3 clean
|
|
4
|
+
> rimraf ./dist
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
> @jolibox/implementation@1.1.4-beta.3 build:esm
|
|
8
|
+
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
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.
|
|
4
|
+
"version": "1.1.52-beta.1",
|
|
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.
|
|
10
|
-
"@jolibox/types": "1.1.
|
|
11
|
-
"@jolibox/native-bridge": "1.1.
|
|
12
|
-
"@jolibox/ads": "1.1.
|
|
9
|
+
"@jolibox/common": "1.1.52-beta.1",
|
|
10
|
+
"@jolibox/types": "1.1.52-beta.1",
|
|
11
|
+
"@jolibox/native-bridge": "1.1.52-beta.1",
|
|
12
|
+
"@jolibox/ads": "1.1.52-beta.1",
|
|
13
13
|
"localforage": "1.10.0",
|
|
14
14
|
"@jolibox/ui": "1.0.0",
|
|
15
15
|
"web-vitals": "4.2.4"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@types/jest": "28.1.1",
|
|
20
20
|
"rimraf": "6.0.1",
|
|
21
21
|
"esbuild": "0.24.2",
|
|
22
|
-
"@jolibox/eslint-config": "1.0.
|
|
22
|
+
"@jolibox/eslint-config": "1.0.1-beta.6"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"clean": "rimraf ./dist",
|
|
@@ -2,14 +2,14 @@ import { IHttpClient } from '../http';
|
|
|
2
2
|
import { RewardsHelper, RewardType } from './reward-helper';
|
|
3
3
|
import { IJolicoinRewardOption } from './type';
|
|
4
4
|
import {
|
|
5
|
-
IUseModalFrequencyConfig,
|
|
6
5
|
UnlockOptionsEventName,
|
|
7
6
|
UseModalFrequencyEventName,
|
|
8
7
|
rewardsEmitter,
|
|
9
8
|
DefaltJoliCoinUseAndCharge,
|
|
10
|
-
DefaltLoginGuide
|
|
9
|
+
DefaltLoginGuide,
|
|
10
|
+
IUseModalFrequencyConfig
|
|
11
11
|
} from './reward-emitter';
|
|
12
|
-
import { StandardResponse } from '@jolibox/types';
|
|
12
|
+
import { StandardResponse, GlobalConfig } from '@jolibox/types';
|
|
13
13
|
import { hostEmitter } from '@jolibox/common';
|
|
14
14
|
|
|
15
15
|
const priority = () => {
|
|
@@ -55,7 +55,7 @@ export const createRewardFetcher = (rewardsHelper: RewardsHelper) => {
|
|
|
55
55
|
|
|
56
56
|
export const createRewardFrequencyConfigFetcher = (rewardsHelper: RewardsHelper) => {
|
|
57
57
|
rewardsHelper.registerRewardFrequencyConfigFetcher(async (httpClient: IHttpClient) => {
|
|
58
|
-
const res = await httpClient.get<StandardResponse<IUseModalFrequencyConfig>>(
|
|
58
|
+
const res = await httpClient.get<StandardResponse<GlobalConfig & IUseModalFrequencyConfig>>(
|
|
59
59
|
'/api/fe-configs/web-common/global-config',
|
|
60
60
|
{}
|
|
61
61
|
);
|
|
@@ -65,9 +65,10 @@ export const createRewardFrequencyConfigFetcher = (rewardsHelper: RewardsHelper)
|
|
|
65
65
|
loginGuide: res.data?.loginGuide || DefaltLoginGuide
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
res.data &&
|
|
69
|
+
hostEmitter.emit('onGlobalConfigChanged', {
|
|
70
|
+
globalConfig: res.data
|
|
71
|
+
});
|
|
71
72
|
|
|
72
73
|
return {
|
|
73
74
|
joliCoinUseAndCharge: res.data?.joliCoinUseAndCharge || DefaltJoliCoinUseAndCharge,
|
package/src/h5/api/ads.ts
CHANGED
|
@@ -127,11 +127,6 @@ const adsContext: IAdsContext<'GAME'> = {
|
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
-
const handleUnlockSuccess = (params: { quantity: number; balance: number }) => {
|
|
131
|
-
notifyCustomEvent('JOLIBOX_CUSTOM_REWARDS_EVENT', {
|
|
132
|
-
JOLI_COIN: params
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
130
|
|
|
136
131
|
const adsManager = new H5AdsManager(adsContext);
|
|
137
132
|
const adsHandler = adsManager.getAdsHandler(context.sdkEnvironment);
|
|
@@ -140,14 +135,11 @@ rewardsHelper.registerRewardHandler('ADS', createAdsRewardHandler(adsHandler.get
|
|
|
140
135
|
rewardsHelper.registerRewardHandler(
|
|
141
136
|
'JOLI_COIN',
|
|
142
137
|
createJolicoinRewardHandler(httpClient, {
|
|
143
|
-
onUnlockSuccess:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
'JOLI_COIN_ONLY',
|
|
149
|
-
createJolicoinOnlyRewardHandler(httpClient, {
|
|
150
|
-
onUnlockSuccess: handleUnlockSuccess.bind(this)
|
|
138
|
+
onUnlockSuccess: (params: { quantity: number; balance: number }) => {
|
|
139
|
+
notifyCustomEvent('JOLIBOX_CUSTOM_REWARDS_EVENT', {
|
|
140
|
+
JOLI_COIN: params
|
|
141
|
+
});
|
|
142
|
+
}
|
|
151
143
|
}) as unknown as (params?: unknown) => Promise<boolean>
|
|
152
144
|
);
|
|
153
145
|
|
package/src/native/api/base.ts
CHANGED
|
@@ -9,5 +9,8 @@ import { registerCanIUseContext } from '@jolibox/native-bridge';
|
|
|
9
9
|
import { context } from '@/common/context';
|
|
10
10
|
export { t };
|
|
11
11
|
|
|
12
|
-
export const { canIUseNative } = registerCanIUseContext(
|
|
12
|
+
export const { canIUseNative } = registerCanIUseContext(
|
|
13
|
+
() => context.sdkInfo.nativeSDKVersionCode,
|
|
14
|
+
() => context.platform
|
|
15
|
+
);
|
|
13
16
|
export { convertVersionCodeToVString } from './utils';
|
|
@@ -1,14 +1,47 @@
|
|
|
1
|
-
import { createAPI, registerCanIUse, t } from './base';
|
|
2
|
-
import {
|
|
1
|
+
import { canIUseNative, createAPI, registerCanIUse, t } from './base';
|
|
2
|
+
import { invokeNative } from '@jolibox/native-bridge';
|
|
3
3
|
import { hostEmitter, UserCustomError } from '@jolibox/common';
|
|
4
4
|
import { createCommands } from '@jolibox/common';
|
|
5
|
+
import { context } from '@/common/context';
|
|
5
6
|
|
|
6
7
|
const commands = createCommands();
|
|
7
8
|
let supportedMethods: string[] = [];
|
|
8
9
|
let isInitialized = false;
|
|
9
10
|
|
|
11
|
+
const formatSupportedMethods = (
|
|
12
|
+
methods: (
|
|
13
|
+
| string
|
|
14
|
+
| {
|
|
15
|
+
method: string;
|
|
16
|
+
platforms?: string[];
|
|
17
|
+
nativeVersionCode?: number;
|
|
18
|
+
}
|
|
19
|
+
)[]
|
|
20
|
+
) => {
|
|
21
|
+
const platform = context.platform;
|
|
22
|
+
const nativeVersionCode = context.sdkInfo.nativeSDKVersionCode ?? 0;
|
|
23
|
+
return methods.reduce((acc, method) => {
|
|
24
|
+
if (typeof method === 'string') {
|
|
25
|
+
acc.push(method);
|
|
26
|
+
} else {
|
|
27
|
+
const { method: platformMethod, platforms, nativeVersionCode: methodNativeVersionCode } = method;
|
|
28
|
+
let canUse = true;
|
|
29
|
+
if (platforms && !platforms.includes(platform)) {
|
|
30
|
+
canUse = false;
|
|
31
|
+
}
|
|
32
|
+
if (methodNativeVersionCode && methodNativeVersionCode > nativeVersionCode) {
|
|
33
|
+
canUse = false;
|
|
34
|
+
}
|
|
35
|
+
if (canUse) {
|
|
36
|
+
acc.push(platformMethod);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return acc;
|
|
40
|
+
}, [] as string[]);
|
|
41
|
+
};
|
|
42
|
+
|
|
10
43
|
hostEmitter.on('onGlobalConfigChanged', (params) => {
|
|
11
|
-
supportedMethods = params.globalConfig
|
|
44
|
+
supportedMethods = formatSupportedMethods(params.globalConfig?.supportedHostMethods ?? []);
|
|
12
45
|
isInitialized = true;
|
|
13
46
|
});
|
|
14
47
|
|
|
@@ -18,7 +51,7 @@ const getSupportedMethods = (): Promise<string[]> => {
|
|
|
18
51
|
resolve(supportedMethods);
|
|
19
52
|
} else {
|
|
20
53
|
const handler = (params: any) => {
|
|
21
|
-
supportedMethods = params.globalConfig.supportedHostMethods ?? [];
|
|
54
|
+
supportedMethods = formatSupportedMethods(params.globalConfig.supportedHostMethods ?? []);
|
|
22
55
|
isInitialized = true;
|
|
23
56
|
hostEmitter.off('onGlobalConfigChanged', handler);
|
|
24
57
|
resolve(supportedMethods);
|