@jolibox/implement 1.1.52-beta.1 → 1.1.53

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.52-beta.1 clean
3
+ > @jolibox/implement@1.1.53 clean
4
4
  > rimraf ./dist
5
5
 
6
6
 
7
- > @jolibox/implement@1.1.52-beta.1 build:esm
7
+ > @jolibox/implement@1.1.53 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.52-beta.1",
4
+ "version": "1.1.53",
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.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",
9
+ "@jolibox/common": "1.1.53",
10
+ "@jolibox/types": "1.1.53",
11
+ "@jolibox/native-bridge": "1.1.53",
12
+ "@jolibox/ads": "1.1.53",
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.1-beta.6"
22
+ "@jolibox/eslint-config": "1.0.0"
23
23
  },
24
24
  "scripts": {
25
25
  "clean": "rimraf ./dist",
@@ -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
  },
@@ -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/h5/api/ads.ts CHANGED
@@ -127,6 +127,11 @@ 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
+ };
130
135
 
131
136
  const adsManager = new H5AdsManager(adsContext);
132
137
  const adsHandler = adsManager.getAdsHandler(context.sdkEnvironment);
@@ -135,11 +140,14 @@ rewardsHelper.registerRewardHandler('ADS', createAdsRewardHandler(adsHandler.get
135
140
  rewardsHelper.registerRewardHandler(
136
141
  'JOLI_COIN',
137
142
  createJolicoinRewardHandler(httpClient, {
138
- onUnlockSuccess: (params: { quantity: number; balance: number }) => {
139
- notifyCustomEvent('JOLIBOX_CUSTOM_REWARDS_EVENT', {
140
- JOLI_COIN: params
141
- });
142
- }
143
+ onUnlockSuccess: handleUnlockSuccess.bind(this)
144
+ }) as unknown as (params?: unknown) => Promise<boolean>
145
+ );
146
+
147
+ rewardsHelper.registerRewardHandler(
148
+ 'JOLI_COIN_ONLY',
149
+ createJolicoinOnlyRewardHandler(httpClient, {
150
+ onUnlockSuccess: handleUnlockSuccess.bind(this)
143
151
  }) as unknown as (params?: unknown) => Promise<boolean>
144
152
  );
145
153
 
package/CHANGELOG.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "name": "@jolibox/implement",
3
- "entries": [
4
- {
5
- "version": "1.1.43",
6
- "tag": "@jolibox/implement_v1.1.43",
7
- "date": "Mon, 21 Jul 2025 10:06:33 GMT",
8
- "comments": {}
9
- }
10
- ]
11
- }
package/CHANGELOG.md DELETED
@@ -1,9 +0,0 @@
1
- # Change Log - @jolibox/implement
2
-
3
- This log was last generated on Mon, 21 Jul 2025 10:06:33 GMT and should not be manually modified.
4
-
5
- ## 1.1.43
6
- Mon, 21 Jul 2025 10:06:33 GMT
7
-
8
- _Initial release_
9
-
@@ -1,9 +0,0 @@
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
-