@jolibox/implement 1.2.5 → 1.2.6
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 +21 -16
- package/dist/common/rewards/cached-fetch-reward.d.ts +2 -2
- package/dist/common/rewards/cached-reward-service.d.ts +2 -2
- package/dist/common/rewards/index.d.ts +1 -0
- package/dist/common/rewards/registers/use-subscription.d.ts +7 -0
- package/dist/common/rewards/registers/utils/coins/jolicoin/cached-fetch-balance.d.ts +2 -2
- package/dist/common/rewards/registers/utils/coins/joligem/cached-fetch-gem-balance.d.ts +2 -2
- package/dist/common/rewards/registers/utils/subscription/commands/index.d.ts +1 -0
- package/dist/common/rewards/registers/utils/subscription/commands/use-subscription.d.ts +4 -0
- package/dist/common/rewards/registers/utils/subscription/sub-handler.d.ts +13 -0
- package/dist/common/rewards/reward-emitter.d.ts +7 -0
- package/dist/common/rewards/reward-helper.d.ts +2 -1
- package/dist/common/utils/index.d.ts +18 -0
- package/dist/h5/api/platformAdsHandle/JoliboxAdsHandler.d.ts +1 -0
- package/dist/h5/bootstrap/auth/index.d.ts +2 -0
- package/dist/h5/bootstrap/auth/sub.d.ts +2 -0
- package/dist/index.js +9 -9
- package/dist/index.native.js +46 -46
- package/dist/native/payment/payment-service.d.ts +1 -1
- package/implement.build.log +2 -2
- package/package.json +5 -5
- package/src/common/rewards/cached-fetch-reward.ts +19 -2
- package/src/common/rewards/cached-reward-service.ts +3 -3
- package/src/common/rewards/index.ts +1 -0
- package/src/common/rewards/registers/use-subscription.ts +34 -0
- package/src/common/rewards/registers/utils/coins/jolicoin/cached-fetch-balance.ts +1 -1
- package/src/common/rewards/registers/utils/coins/joligem/cached-fetch-gem-balance.ts +1 -1
- package/src/common/rewards/registers/utils/subscription/commands/index.ts +1 -0
- package/src/common/rewards/registers/utils/subscription/commands/use-subscription.ts +29 -0
- package/src/common/rewards/registers/utils/subscription/sub-handler.ts +88 -0
- package/src/common/rewards/reward-emitter.ts +8 -0
- package/src/common/rewards/reward-helper.ts +8 -1
- package/src/common/utils/index.ts +23 -0
- package/src/h5/api/ads.ts +14 -2
- package/src/h5/api/platformAdsHandle/JoliboxAdsHandler.ts +25 -1
- package/src/h5/bootstrap/auth/__tests__/auth.test.ts +308 -0
- package/src/h5/bootstrap/auth/index.ts +20 -0
- package/src/h5/bootstrap/auth/sub.ts +56 -0
- package/src/h5/bootstrap/index.ts +4 -19
- package/src/h5/rewards/index.ts +18 -1
- package/src/native/payment/payment-service.ts +1 -1
- package/dist/common/cache/request-cache-service.d.ts +0 -111
- package/src/common/cache/__tests__/request-cache-service.test.ts +0 -686
- package/src/common/cache/request-cache-service.ts +0 -393
- /package/dist/{common/cache/__tests__/request-cache-service.test.d.ts → h5/bootstrap/auth/__tests__/auth.test.d.ts} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
|
|
5
5
|
"packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
|
|
6
6
|
"packages/implement/esbuild.config.js": "876db4e384d8543b66a0b61d8f7b277a36dfb4e0",
|
|
7
|
-
"packages/implement/package.json": "
|
|
7
|
+
"packages/implement/package.json": "b4f1e963f16eec1fe7426ba6f0564ce1bfa36ed7",
|
|
8
8
|
"packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
|
|
9
9
|
"packages/implement/src/common/ads/anti-cheating.test.ts": "e2ff3dc6760cfd28d0f8c15703d7fb20d43df583",
|
|
10
10
|
"packages/implement/src/common/ads/anti-cheating.ts": "a3ffb6a78e289e1c0ce45c7f7c0cee000e75e541",
|
|
@@ -30,8 +30,6 @@
|
|
|
30
30
|
"packages/implement/src/common/api-factory/validator/__tests__/validate/utils.test.ts": "a0304e6984e1d9ec2a61d5a9db5c896f06970b48",
|
|
31
31
|
"packages/implement/src/common/api-factory/validator/index.ts": "204e86b97c854647d177805e3180d4cfd542b0f8",
|
|
32
32
|
"packages/implement/src/common/api-factory/validator/validate.ts": "5fee8175a9a05a69fe709c7e7899e5372d81efb1",
|
|
33
|
-
"packages/implement/src/common/cache/__tests__/request-cache-service.test.ts": "fac49a211e18e07932fbe279fda36017ad5fe3aa",
|
|
34
|
-
"packages/implement/src/common/cache/request-cache-service.ts": "ba7616f870e970847f5367f4efe31b658c001d96",
|
|
35
33
|
"packages/implement/src/common/can-i-use.ts": "9a28562870d92b82ce42ec656c8e9d868dd87528",
|
|
36
34
|
"packages/implement/src/common/context/index.ts": "7c6b61d1ac581cdb945314fb48090d4f01209b13",
|
|
37
35
|
"packages/implement/src/common/context/types.ts": "244ff65de52dcbce2457ffee427f5fa102987825",
|
|
@@ -49,15 +47,16 @@
|
|
|
49
47
|
"packages/implement/src/common/report/track.ts": "4072dee69ace09d8099e1131507b35f0cb6bd92e",
|
|
50
48
|
"packages/implement/src/common/report/types.ts": "9c25c62b85b9ac5dbde674601924703f7df33773",
|
|
51
49
|
"packages/implement/src/common/rewards/__tests__/can-use-jolicoin.test.ts": "aac9c78779f1d8de33918cff9961326a5054ef3d",
|
|
52
|
-
"packages/implement/src/common/rewards/cached-fetch-reward.ts": "
|
|
53
|
-
"packages/implement/src/common/rewards/cached-reward-service.ts": "
|
|
50
|
+
"packages/implement/src/common/rewards/cached-fetch-reward.ts": "1c4f28e4e12311ab4d3162c86fd60b9dfcf18d7e",
|
|
51
|
+
"packages/implement/src/common/rewards/cached-reward-service.ts": "3310dcab46db046abeec6d6e2a1478160e0d3934",
|
|
54
52
|
"packages/implement/src/common/rewards/fetch-reward.ts": "23f40af40ca4c3a594f7bc3ef6ea96a593648e35",
|
|
55
|
-
"packages/implement/src/common/rewards/index.ts": "
|
|
53
|
+
"packages/implement/src/common/rewards/index.ts": "92a31d63098d8dc874d3814a76819e96d7e9f269",
|
|
56
54
|
"packages/implement/src/common/rewards/registers/use-ads.ts": "77c887f0e2065a8f3eec31cb5b62e1752d07298b",
|
|
57
55
|
"packages/implement/src/common/rewards/registers/use-gem-only.ts": "944f012b2d7e6a786b0c1b8eb139db6b09fc309f",
|
|
58
56
|
"packages/implement/src/common/rewards/registers/use-gem.ts": "4ec6e2e3888763b1e1ab63b6694eed95460f0684",
|
|
59
57
|
"packages/implement/src/common/rewards/registers/use-jolicoin-only.ts": "57f8c7156ef4cb55a707746c287eed1e883be694",
|
|
60
58
|
"packages/implement/src/common/rewards/registers/use-jolicoin.ts": "46c3e782cfa780bf262f1744bb7eff60d77cf2e3",
|
|
59
|
+
"packages/implement/src/common/rewards/registers/use-subscription.ts": "f6647b63b07f3d4d8324cb3138ec5e0d7b5262d4",
|
|
61
60
|
"packages/implement/src/common/rewards/registers/utils/coins/commands/currency-handlers.ts": "77219e8ce3b7cfe8c26880f6c619d41e2cccf8cb",
|
|
62
61
|
"packages/implement/src/common/rewards/registers/utils/coins/commands/index.ts": "1d5700642bf3bddb8eb598b6018cfd55bd7b3308",
|
|
63
62
|
"packages/implement/src/common/rewards/registers/utils/coins/commands/use-jolicoin.ts": "1d4eca1b189d67db138b0ac93144c9d8b33f22bb",
|
|
@@ -65,21 +64,24 @@
|
|
|
65
64
|
"packages/implement/src/common/rewards/registers/utils/coins/commands/use-unlogin.ts": "359ec6f2bfbf865ad1b03f3f7515e14fa438da8f",
|
|
66
65
|
"packages/implement/src/common/rewards/registers/utils/coins/currency-config.ts": "e8c1c5c9280fcc24df95d1aad60d0ae795042198",
|
|
67
66
|
"packages/implement/src/common/rewards/registers/utils/coins/index.ts": "454c807a24a64a0a7c2c8ce0f11539d3e08c9ebe",
|
|
68
|
-
"packages/implement/src/common/rewards/registers/utils/coins/jolicoin/cached-fetch-balance.ts": "
|
|
67
|
+
"packages/implement/src/common/rewards/registers/utils/coins/jolicoin/cached-fetch-balance.ts": "4d4e504fb00ddd0de11a74d8e62cfb3190ec23e3",
|
|
69
68
|
"packages/implement/src/common/rewards/registers/utils/coins/jolicoin/fetch-balance.ts": "cb54beec6a430d42ff81410198adf892f7e11182",
|
|
70
69
|
"packages/implement/src/common/rewards/registers/utils/coins/jolicoin/jolicoin-handler.ts": "b52f2e2caef6d86512a41a5004a88dff1ce45496",
|
|
71
|
-
"packages/implement/src/common/rewards/registers/utils/coins/joligem/cached-fetch-gem-balance.ts": "
|
|
70
|
+
"packages/implement/src/common/rewards/registers/utils/coins/joligem/cached-fetch-gem-balance.ts": "e462c138142b2f51971c9596f864fc0b5f8a7dda",
|
|
72
71
|
"packages/implement/src/common/rewards/registers/utils/coins/joligem/fetch-gem-balance.ts": "78efdd85ea2b0141f2ff7614ef563a62e56efbfa",
|
|
73
72
|
"packages/implement/src/common/rewards/registers/utils/coins/joligem/gem-handler.ts": "fb056fe4155506c25a1ce335086b2e6d75d0a6fa",
|
|
74
73
|
"packages/implement/src/common/rewards/registers/utils/coins/rewards-command.ts": "b7a5309a43869f5024022158e3c95b505ecb55df",
|
|
75
74
|
"packages/implement/src/common/rewards/registers/utils/common.ts": "45f813bf8f1655d0533bc04e5d947f7e8b2262ec",
|
|
76
75
|
"packages/implement/src/common/rewards/registers/utils/event-listener.ts": "cd6a393d4771833cc37e38d9fb8af1900c8b0487",
|
|
77
76
|
"packages/implement/src/common/rewards/registers/utils/index.ts": "f496c92e3bf81418e463f0a9a95d44798c3424b9",
|
|
78
|
-
"packages/implement/src/common/rewards/
|
|
79
|
-
"packages/implement/src/common/rewards/
|
|
77
|
+
"packages/implement/src/common/rewards/registers/utils/subscription/commands/index.ts": "94b4f9510641773cb4f73a4544a36af3c1b4bd10",
|
|
78
|
+
"packages/implement/src/common/rewards/registers/utils/subscription/commands/use-subscription.ts": "69b0368bfffd19bffeff3de3d49ac096251df625",
|
|
79
|
+
"packages/implement/src/common/rewards/registers/utils/subscription/sub-handler.ts": "198624167153353416f295dcec92af99af161607",
|
|
80
|
+
"packages/implement/src/common/rewards/reward-emitter.ts": "b676f07ad0dfb841c6f795c7e3abe16e238d9f28",
|
|
81
|
+
"packages/implement/src/common/rewards/reward-helper.ts": "3f1a0064b1932b4e94140ed42b41d794a3ca0019",
|
|
80
82
|
"packages/implement/src/common/rewards/type.ts": "80b082ce5193447ccf6c85151cb849f488f68cf9",
|
|
81
|
-
"packages/implement/src/common/utils/index.ts": "
|
|
82
|
-
"packages/implement/src/h5/api/ads.ts": "
|
|
83
|
+
"packages/implement/src/common/utils/index.ts": "36ad7410adb3fa99c2af3963f68ff30637025f6b",
|
|
84
|
+
"packages/implement/src/h5/api/ads.ts": "80fc56b0e729ff5167e2d9cc43a275cf67c3fcdb",
|
|
83
85
|
"packages/implement/src/h5/api/base.ts": "ead2c3cdcbe174b0e725c31a3885c7985bd8f667",
|
|
84
86
|
"packages/implement/src/h5/api/get-system-info.ts": "158d66156c720446457318b7eaa9112452114dbb",
|
|
85
87
|
"packages/implement/src/h5/api/index.ts": "59b4a8a83134e52de589f77bf3a6591cbf3a0e11",
|
|
@@ -88,11 +90,14 @@
|
|
|
88
90
|
"packages/implement/src/h5/api/platformAdsHandle/FunmaxAdsHandler.ts": "85d874af2aff253259756b05503a020642af2ca9",
|
|
89
91
|
"packages/implement/src/h5/api/platformAdsHandle/GamedistributionAdsHandler.ts": "4d1b1460eb2cbd1ff06bf3ce4d69638320c760e1",
|
|
90
92
|
"packages/implement/src/h5/api/platformAdsHandle/HuaweiQuickAdsHandler.ts": "fc2b9b91a4f18ccfb70539fba5b993c1e7d941cd",
|
|
91
|
-
"packages/implement/src/h5/api/platformAdsHandle/JoliboxAdsHandler.ts": "
|
|
93
|
+
"packages/implement/src/h5/api/platformAdsHandle/JoliboxAdsHandler.ts": "81f04604c9e432f04dc096256e24b05cd7d6ce11",
|
|
92
94
|
"packages/implement/src/h5/api/runtime.ts": "25e72f2af156fe2abaf0f25e34681511995ab22a",
|
|
93
95
|
"packages/implement/src/h5/api/storage.ts": "d16fe40e39f1e04f5f527c0878edba6d618b5a05",
|
|
94
96
|
"packages/implement/src/h5/api/task.ts": "c501814d9dc01a564b716fdcefa4a86427717a08",
|
|
95
|
-
"packages/implement/src/h5/bootstrap/
|
|
97
|
+
"packages/implement/src/h5/bootstrap/auth/__tests__/auth.test.ts": "5784f93b83026b9c973891e386f342c027753fa7",
|
|
98
|
+
"packages/implement/src/h5/bootstrap/auth/index.ts": "1f99932c09442673326b97c457427d8595104aca",
|
|
99
|
+
"packages/implement/src/h5/bootstrap/auth/sub.ts": "5406e11dcaa29c06e9522b97894ddff2b9e4fdf5",
|
|
100
|
+
"packages/implement/src/h5/bootstrap/index.ts": "6b0d615068762a5ab17e4c28a93ed19726989339",
|
|
96
101
|
"packages/implement/src/h5/http/index.ts": "1e3118ffc31a5e93d673c703d637b082f2420c15",
|
|
97
102
|
"packages/implement/src/h5/http/utils/__tests__/xua.test.ts": "4345cfd10cae6f94cef673f04a5155b70123c048",
|
|
98
103
|
"packages/implement/src/h5/http/utils/index.ts": "05f4d94be09b9bfdcbb1365b31a5559e44a74991",
|
|
@@ -101,7 +106,7 @@
|
|
|
101
106
|
"packages/implement/src/h5/report/event-tracker.ts": "146ff1f9e154e40f3b26679955a9b8dfe01d5462",
|
|
102
107
|
"packages/implement/src/h5/report/index.ts": "7154000726a72f477183d069eea5de87d12ceb7d",
|
|
103
108
|
"packages/implement/src/h5/report/task-tracker.ts": "07ffd3b6316221652528c7172869068cf4df0a15",
|
|
104
|
-
"packages/implement/src/h5/rewards/index.ts": "
|
|
109
|
+
"packages/implement/src/h5/rewards/index.ts": "fb46cd07d2aa58fdeef38190b0f3df84d9aa62c3",
|
|
105
110
|
"packages/implement/src/index.native.ts": "96cc46c8919ba2333600e9c3ee100f47c511a79a",
|
|
106
111
|
"packages/implement/src/index.ts": "d0ca7b5312b0a258ae8887e725440c70190442f7",
|
|
107
112
|
"packages/implement/src/native/api/__tests__/convertVersionCodeToVString.test.ts": "5f948265725f8ca48851de4bd41b24a10d754982",
|
|
@@ -131,7 +136,7 @@
|
|
|
131
136
|
"packages/implement/src/native/payment/__tests__/payment-service-simple.test.ts": "65779c1a2032979aca0c90db012af52182f47d67",
|
|
132
137
|
"packages/implement/src/native/payment/index.ts": "6ead1fc6e7261ba851f926afb315f6988639e74a",
|
|
133
138
|
"packages/implement/src/native/payment/payment-helper.ts": "8ba410780450897fc9ee8f93cb38c67ae3dd7291",
|
|
134
|
-
"packages/implement/src/native/payment/payment-service.ts": "
|
|
139
|
+
"packages/implement/src/native/payment/payment-service.ts": "2e2e4dd1a167098e663d7fd87b2ed9fc05c79630",
|
|
135
140
|
"packages/implement/src/native/payment/registers/base.ts": "63973fe618cfaa5bc0baa88c7f1d271638c65c1a",
|
|
136
141
|
"packages/implement/src/native/payment/registers/const.ts": "cba0087bccbd01349acc46f69adaeed80f4d16a0",
|
|
137
142
|
"packages/implement/src/native/payment/registers/joli-coin.ts": "caa3bd121e2159091dbe7cc3f58c2fba67d337a4",
|
|
@@ -35,10 +35,10 @@ export declare const clearRewardCache: (httpClient: IHttpClient) => void;
|
|
|
35
35
|
* 获取缓存统计信息
|
|
36
36
|
*/
|
|
37
37
|
export declare const getRewardCacheStats: (httpClient: IHttpClient) => {
|
|
38
|
-
unlockOptions: import("
|
|
38
|
+
unlockOptions: import("@jolibox/common").CacheStats & {
|
|
39
39
|
pendingRequestCount: number;
|
|
40
40
|
};
|
|
41
|
-
globalConfig: import("
|
|
41
|
+
globalConfig: import("@jolibox/common").CacheStats & {
|
|
42
42
|
pendingRequestCount: number;
|
|
43
43
|
};
|
|
44
44
|
};
|
|
@@ -13,10 +13,10 @@ export declare class CachedRewardService {
|
|
|
13
13
|
warmupCache(): Promise<void>;
|
|
14
14
|
clearAllCache(): void;
|
|
15
15
|
getCacheStats(): {
|
|
16
|
-
unlockOptions: import("
|
|
16
|
+
unlockOptions: import("@jolibox/common").CacheStats & {
|
|
17
17
|
pendingRequestCount: number;
|
|
18
18
|
};
|
|
19
|
-
globalConfig: import("
|
|
19
|
+
globalConfig: import("@jolibox/common").CacheStats & {
|
|
20
20
|
pendingRequestCount: number;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
@@ -11,5 +11,6 @@ export * from './registers/use-jolicoin';
|
|
|
11
11
|
export * from './registers/use-jolicoin-only';
|
|
12
12
|
export * from './registers/use-gem';
|
|
13
13
|
export * from './registers/use-gem-only';
|
|
14
|
+
export * from './registers/use-subscription';
|
|
14
15
|
export { warmupBalanceCache } from './registers/utils/coins/jolicoin/cached-fetch-balance';
|
|
15
16
|
export { warmupGemBalanceCache } from './registers/utils/coins/joligem/cached-fetch-gem-balance';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IHttpClient } from '@/common/http';
|
|
2
|
+
import { IAdBreakParams } from '@/common/ads';
|
|
3
|
+
export type SubscriptionRewardsHandler = (params: IAdBreakParams) => Promise<boolean>;
|
|
4
|
+
export declare const createSubscriptionRewardHandler: (httpClient: IHttpClient, { onSubSuccess, onSubFailed }: {
|
|
5
|
+
onSubSuccess?: () => void;
|
|
6
|
+
onSubFailed?: () => void;
|
|
7
|
+
}) => SubscriptionRewardsHandler;
|
|
@@ -9,7 +9,7 @@ export declare class CachedBalanceService {
|
|
|
9
9
|
refreshBalance(type?: string): Promise<BalanceResponse | undefined>;
|
|
10
10
|
warmupBalance(type?: string): Promise<void>;
|
|
11
11
|
clearBalanceCache(): void;
|
|
12
|
-
getBalanceCacheStats(): import("
|
|
12
|
+
getBalanceCacheStats(): import("@jolibox/common").CacheStats & {
|
|
13
13
|
pendingRequestCount: number;
|
|
14
14
|
};
|
|
15
15
|
clearExpiredCache(): void;
|
|
@@ -27,7 +27,7 @@ export declare const refreshBalanceCache: (httpClient: IHttpClient, type?: strin
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const warmupBalanceCache: (httpClient: IHttpClient, type?: string) => Promise<void>;
|
|
29
29
|
export declare const clearBalanceCache: (httpClient: IHttpClient) => void;
|
|
30
|
-
export declare const getBalanceCacheStats: (httpClient: IHttpClient) => import("
|
|
30
|
+
export declare const getBalanceCacheStats: (httpClient: IHttpClient) => import("@jolibox/common").CacheStats & {
|
|
31
31
|
pendingRequestCount: number;
|
|
32
32
|
};
|
|
33
33
|
export declare const getBalanceCacheService: (httpClient: IHttpClient) => CachedBalanceService;
|
|
@@ -9,7 +9,7 @@ export declare class CachedGemBalanceService {
|
|
|
9
9
|
refreshGemBalance(type?: string): Promise<GemBalanceResponse | undefined>;
|
|
10
10
|
warmupGemBalance(type?: string): Promise<void>;
|
|
11
11
|
clearGemBalanceCache(): void;
|
|
12
|
-
getGemBalanceCacheStats(): import("
|
|
12
|
+
getGemBalanceCacheStats(): import("@jolibox/common").CacheStats & {
|
|
13
13
|
pendingRequestCount: number;
|
|
14
14
|
};
|
|
15
15
|
clearExpiredCache(): void;
|
|
@@ -27,7 +27,7 @@ export declare const refreshGemBalanceCache: (httpClient: IHttpClient, type?: st
|
|
|
27
27
|
*/
|
|
28
28
|
export declare const warmupGemBalanceCache: (httpClient: IHttpClient, type?: string) => Promise<void>;
|
|
29
29
|
export declare const clearGemBalanceCache: (httpClient: IHttpClient) => void;
|
|
30
|
-
export declare const getGemBalanceCacheStats: (httpClient: IHttpClient) => import("
|
|
30
|
+
export declare const getGemBalanceCacheStats: (httpClient: IHttpClient) => import("@jolibox/common").CacheStats & {
|
|
31
31
|
pendingRequestCount: number;
|
|
32
32
|
};
|
|
33
33
|
export declare const getGemBalanceCacheService: (httpClient: IHttpClient) => CachedGemBalanceService;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './use-subscription';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const registerUseSubscriptionCommand: (params: {
|
|
2
|
+
showSubscriptionModal: () => Promise<"SUCCESS" | "CANCEL" | "FAILED">;
|
|
3
|
+
}) => void;
|
|
4
|
+
export declare const createShowSubscriptionModal: (type: "SUBSCRIPTION") => () => Promise<"SUCCESS" | "FAILED" | "CANCEL">;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IHttpClient } from '@/common/http';
|
|
2
|
+
import { IAdBreakParams } from '@/common/ads';
|
|
3
|
+
import { EventPromiseHandler } from '../event-listener';
|
|
4
|
+
import { UnlockOptionsEventName, IUnlockOptionsEvent } from '@/common/rewards/reward-emitter';
|
|
5
|
+
import { createShowSubscriptionModal } from './commands/use-subscription';
|
|
6
|
+
export declare const createCommonSubscriptionHandler: (type: "SUBSCRIPTION", httpClient: IHttpClient, { handlers: { handleSubSuccess, handleSubFailed, unlockOptionsHandler, showSubscriptionModal } }: {
|
|
7
|
+
handlers: {
|
|
8
|
+
handleSubSuccess?: () => void;
|
|
9
|
+
handleSubFailed?: (params: IAdBreakParams) => void;
|
|
10
|
+
unlockOptionsHandler: EventPromiseHandler<IUnlockOptionsEvent, typeof UnlockOptionsEventName>;
|
|
11
|
+
showSubscriptionModal: ReturnType<typeof createShowSubscriptionModal>;
|
|
12
|
+
};
|
|
13
|
+
}) => (params: IAdBreakParams) => Promise<boolean>;
|
|
@@ -13,6 +13,8 @@ export declare const UseModalResultEventName: "ON_USE_MODAL_RESULT";
|
|
|
13
13
|
export declare const UseModalFrequencyEventName: "ON_USE_MODAL_FREQUENCY";
|
|
14
14
|
export declare const UseUnloginModalResultEventName: "ON_USE_UNLOGIN_MODAL_EVENT";
|
|
15
15
|
export declare const InvokeUnloginModalEventName: "INVOKE_UNLOGIN_MODAL_EVENT";
|
|
16
|
+
export declare const InvokeSubscriptionEventName: "INVOKE_SUBSCRIPTION_EVENT";
|
|
17
|
+
export declare const UseSubscriptionResultEventName: "ON_USE_SUBSCRIPTION_RESULT";
|
|
16
18
|
type IPaymentResult = 'SUCCESS' | 'FAILED' | 'CANCEL';
|
|
17
19
|
export interface IPaymentEvent {
|
|
18
20
|
userJoliCoin?: IJoliCoin;
|
|
@@ -77,6 +79,9 @@ export interface IUseModalFrequencyConfig {
|
|
|
77
79
|
minInterval?: number;
|
|
78
80
|
};
|
|
79
81
|
}
|
|
82
|
+
export interface IUseSubscriptionResultEvent {
|
|
83
|
+
result: 'SUCCESS' | 'CANCEL' | 'FAILED';
|
|
84
|
+
}
|
|
80
85
|
export interface RewardsEventMap extends Record<string, unknown[]> {
|
|
81
86
|
[UnlockOptionsEventName]: [IUnlockOptionsEvent];
|
|
82
87
|
[InvokePaymentEventName]: [
|
|
@@ -92,6 +97,8 @@ export interface RewardsEventMap extends Record<string, unknown[]> {
|
|
|
92
97
|
IUseUnloginModalEvent
|
|
93
98
|
];
|
|
94
99
|
[UseUnloginModalResultEventName]: [IUseUnloginModalResultEvent];
|
|
100
|
+
[InvokeSubscriptionEventName]: ['SUBSCRIPTION'];
|
|
101
|
+
[UseSubscriptionResultEventName]: [IUseSubscriptionResultEvent];
|
|
95
102
|
}
|
|
96
103
|
export declare const originalRewardsEmitter: EventEmitter<RewardsEventMap, keyof RewardsEventMap>;
|
|
97
104
|
export type RewardsEventType = keyof RewardsEventMap;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type RewardType = 'ADS' | 'JOLI_COIN' | 'JOLI_COIN_ONLY' | 'JOLI_GEM' | 'JOLI_GEM_ONLY';
|
|
1
|
+
export type RewardType = 'ADS' | 'JOLI_COIN' | 'JOLI_COIN_ONLY' | 'JOLI_GEM' | 'JOLI_GEM_ONLY' | 'SUBSCRIPTION';
|
|
2
2
|
import type { AdsRewardsHandler } from './registers/use-ads';
|
|
3
3
|
import { IUseModalFrequencyConfig } from './reward-emitter';
|
|
4
4
|
export interface RewardHandlerMap {
|
|
@@ -7,6 +7,7 @@ export interface RewardHandlerMap {
|
|
|
7
7
|
JOLI_COIN_ONLY: (params?: unknown) => Promise<boolean>;
|
|
8
8
|
JOLI_GEM: (params?: unknown) => Promise<boolean>;
|
|
9
9
|
JOLI_GEM_ONLY: (params?: unknown) => Promise<boolean>;
|
|
10
|
+
SUBSCRIPTION: (params?: unknown) => Promise<boolean>;
|
|
10
11
|
}
|
|
11
12
|
export type RewardHandler<T extends RewardType> = RewardHandlerMap[T];
|
|
12
13
|
export declare function createRewardsHelper(): {
|
|
@@ -6,6 +6,8 @@ declare const JOLIBOX_CUSTOM_REWARDS_EVENT_TYPE = "JOLIBOX_CUSTOM_REWARDS_EVENT"
|
|
|
6
6
|
declare const JOLIBOX_TOPUP_EVENT = "JOLIBOX_TOPUP_EVENT";
|
|
7
7
|
declare const JOLIBOX_JOLI_COIN_USE_EVENT = "JOLIBOX_JOLI_COIN_USE_EVENT";
|
|
8
8
|
declare const JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT = "JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT";
|
|
9
|
+
declare const JOLIBOX_GET_USER_SUB_STATUS = "JOLIBOX_GET_USER_SUB_STATUS";
|
|
10
|
+
declare const JOLIBOX_SUB_EVENT = "JOLIBOX_SUB_EVENT";
|
|
9
11
|
interface JoliboxCustomEvent {
|
|
10
12
|
[JOLIBOX_CUSTOM_ADS_EVENT_TYPE]: {
|
|
11
13
|
isAdShowing: boolean;
|
|
@@ -38,6 +40,12 @@ interface JoliboxCustomEvent {
|
|
|
38
40
|
sequenceId: string;
|
|
39
41
|
type: 'ADS-JOLI_COIN' | 'JOLI_COIN';
|
|
40
42
|
};
|
|
43
|
+
[JOLIBOX_GET_USER_SUB_STATUS]: {
|
|
44
|
+
sequenceId: string;
|
|
45
|
+
};
|
|
46
|
+
[JOLIBOX_SUB_EVENT]: {
|
|
47
|
+
sequenceId: string;
|
|
48
|
+
};
|
|
41
49
|
}
|
|
42
50
|
declare const notifyCustomEvent: <T extends keyof JoliboxCustomEvent>(eventName: T, data: JoliboxCustomEvent[T]) => void;
|
|
43
51
|
/**
|
|
@@ -48,6 +56,8 @@ declare const notifyCustomEvent: <T extends keyof JoliboxCustomEvent>(eventName:
|
|
|
48
56
|
declare const ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT = "ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT";
|
|
49
57
|
declare const ON_JOLIBOX_JOLI_COIN_USE_RESULT = "ON_JOLIBOX_JOLI_COIN_USE_RESULT";
|
|
50
58
|
declare const ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT = "ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT";
|
|
59
|
+
declare const ON_GET_USER_SUB_STATUS = "ON_GET_USER_SUB_STATUS";
|
|
60
|
+
declare const ON_JOLIBOX_SUB_RESULT_EVENT = "ON_JOLIBOX_SUB_RESULT_EVENT";
|
|
51
61
|
interface ReceivedJoliboxCustomEvent {
|
|
52
62
|
[ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT]: {
|
|
53
63
|
sequenceId: string;
|
|
@@ -75,6 +85,14 @@ interface ReceivedJoliboxCustomEvent {
|
|
|
75
85
|
};
|
|
76
86
|
isFirstLogin?: boolean;
|
|
77
87
|
};
|
|
88
|
+
[ON_GET_USER_SUB_STATUS]: {
|
|
89
|
+
sequenceId: string;
|
|
90
|
+
isSubUser: boolean;
|
|
91
|
+
};
|
|
92
|
+
[ON_JOLIBOX_SUB_RESULT_EVENT]: {
|
|
93
|
+
sequenceId: string;
|
|
94
|
+
result: 'SUCCESS' | 'CANCEL' | 'FAILED';
|
|
95
|
+
};
|
|
78
96
|
}
|
|
79
97
|
type ReceivedJoliboxCustomEventResult = keyof ReceivedJoliboxCustomEvent;
|
|
80
98
|
declare const onCustomEvent: <T extends ReceivedJoliboxCustomEventResult>(eventName: T, callback: (data: ReceivedJoliboxCustomEvent[T]) => void) => () => void;
|