@jolibox/implement 1.1.51 → 1.1.52
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 +6 -6
- package/dist/common/context/index.d.ts +1 -0
- package/dist/index.js +9 -9
- package/dist/index.native.js +32 -32
- package/implement.build.log +2 -2
- package/package.json +5 -5
- package/src/common/context/index.ts +3 -0
- package/src/common/rewards/fetch-reward.ts +8 -7
- package/src/common/rewards/registers/utils/coins/index.ts +12 -7
- 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 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.
|
|
7
|
+
> @jolibox/implement@1.1.52 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.
|
|
4
|
+
"version": "1.1.52",
|
|
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",
|
|
10
|
+
"@jolibox/types": "1.1.52",
|
|
11
|
+
"@jolibox/native-bridge": "1.1.52",
|
|
12
|
+
"@jolibox/ads": "1.1.52",
|
|
13
13
|
"localforage": "1.10.0",
|
|
14
14
|
"@jolibox/ui": "1.0.0",
|
|
15
15
|
"web-vitals": "4.2.4"
|
|
@@ -162,6 +162,9 @@ const wrapContext = () => {
|
|
|
162
162
|
navigationBarHeight: rawNavHeight !== undefined ? rawNavHeight / pixelRatio : 10
|
|
163
163
|
};
|
|
164
164
|
},
|
|
165
|
+
get abTests(): string[] {
|
|
166
|
+
return env.abValues?.split(',') ?? [];
|
|
167
|
+
},
|
|
165
168
|
onEnvConfigChanged: (newConfig: Partial<Env>) => {
|
|
166
169
|
mergeWith(env, newConfig, mergeArray);
|
|
167
170
|
},
|
|
@@ -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,
|
|
@@ -61,16 +61,21 @@ export const createCommonJolicoinRewardHandler = (
|
|
|
61
61
|
registerUseJolicoinCommand(type, {
|
|
62
62
|
showUnlockWithJolicoinModal: showUnlockWithJolicoinModal
|
|
63
63
|
});
|
|
64
|
+
|
|
65
|
+
const targetABTest = context.abTests.find((abTest) => abTest.startsWith('coinOpt_v1'));
|
|
66
|
+
let commands = [];
|
|
67
|
+
if (targetABTest) {
|
|
68
|
+
commands = [`Rewards.${type}.usePayment`, `Rewards.${type}.useJolicoin`];
|
|
69
|
+
} else {
|
|
70
|
+
commands = [
|
|
71
|
+
`Rewards.${type}.useUnloginModal`,
|
|
72
|
+
`Rewards.${type}.usePayment`,
|
|
73
|
+
`Rewards.${type}.useJolicoin`
|
|
74
|
+
];
|
|
75
|
+
}
|
|
64
76
|
return async (params: IAdBreakParams) => {
|
|
65
77
|
try {
|
|
66
78
|
let result = true;
|
|
67
|
-
|
|
68
|
-
const commands = [
|
|
69
|
-
`Rewards.${type}.useUnloginModal`,
|
|
70
|
-
`Rewards.${type}.usePayment`,
|
|
71
|
-
`Rewards.${type}.useJolicoin`
|
|
72
|
-
];
|
|
73
|
-
|
|
74
79
|
for (const command of commands) {
|
|
75
80
|
const commandResult = await rewardsCommands.executeCommand(command as RewardsCommandType);
|
|
76
81
|
result = result && commandResult.result !== 'FAILED';
|
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);
|