@jolibox/implement 1.1.55 → 1.2.0-beta.9
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 +34 -27
- package/dist/common/rewards/index.d.ts +2 -0
- package/dist/common/rewards/registers/use-gem-only.d.ts +10 -0
- package/dist/common/rewards/registers/use-gem.d.ts +10 -0
- package/dist/common/rewards/registers/utils/coins/commands/currency-handlers.d.ts +15 -0
- package/dist/common/rewards/registers/utils/coins/commands/index.d.ts +1 -1
- package/dist/common/rewards/registers/utils/coins/commands/use-jolicoin.d.ts +10 -8
- package/dist/common/rewards/registers/utils/coins/commands/use-payment.d.ts +10 -8
- package/dist/common/rewards/registers/utils/coins/commands/use-unlogin.d.ts +6 -8
- package/dist/common/rewards/registers/utils/coins/currency-config.d.ts +8 -0
- package/dist/common/rewards/registers/utils/coins/index.d.ts +2 -18
- package/dist/common/rewards/registers/utils/coins/jolicoin/jolicoin-handler.d.ts +18 -0
- package/dist/common/rewards/registers/utils/coins/joligem/fetch-gem-balance.d.ts +4 -0
- package/dist/common/rewards/registers/utils/coins/joligem/gem-handler.d.ts +19 -0
- package/dist/common/rewards/registers/utils/index.d.ts +3 -1
- package/dist/common/rewards/reward-emitter.d.ts +23 -13
- package/dist/common/rewards/reward-helper.d.ts +3 -1
- package/dist/common/rewards/type.d.ts +10 -1
- package/dist/index.js +25 -25
- package/dist/index.native.js +68 -53
- package/dist/native/api/ads.d.ts +4 -0
- package/dist/native/payment/payment-helper.d.ts +5 -1
- package/dist/native/rewards/check-frequency.d.ts +24 -0
- package/dist/native/rewards/ui/utils.d.ts +1 -1
- package/implement.build.log +2 -2
- package/package.json +5 -5
- package/src/common/rewards/__tests__/can-use-jolicoin.test.ts +265 -9
- package/src/common/rewards/fetch-reward.ts +18 -3
- package/src/common/rewards/index.ts +2 -0
- package/src/common/rewards/registers/use-gem-only.ts +58 -0
- package/src/common/rewards/registers/use-gem.ts +53 -0
- package/src/common/rewards/registers/use-jolicoin-only.ts +4 -4
- package/src/common/rewards/registers/use-jolicoin.ts +4 -4
- package/src/common/rewards/registers/utils/coins/commands/currency-handlers.ts +50 -0
- package/src/common/rewards/registers/utils/coins/commands/index.ts +1 -1
- package/src/common/rewards/registers/utils/coins/commands/use-jolicoin.ts +31 -19
- package/src/common/rewards/registers/utils/coins/commands/use-payment.ts +32 -25
- package/src/common/rewards/registers/utils/coins/commands/use-unlogin.ts +22 -24
- package/src/common/rewards/registers/utils/coins/currency-config.ts +23 -0
- package/src/common/rewards/registers/utils/coins/index.ts +2 -139
- package/src/common/rewards/registers/utils/coins/jolicoin/jolicoin-handler.ts +152 -0
- package/src/common/rewards/registers/utils/coins/joligem/fetch-gem-balance.ts +15 -0
- package/src/common/rewards/registers/utils/coins/joligem/gem-handler.ts +134 -0
- package/src/common/rewards/registers/utils/index.ts +20 -1
- package/src/common/rewards/reward-emitter.ts +23 -13
- package/src/common/rewards/reward-helper.ts +3 -1
- package/src/common/rewards/type.ts +13 -1
- package/src/h5/rewards/index.ts +33 -20
- package/src/native/api/ads.ts +55 -1
- package/src/native/api/call-host-method.ts +36 -1
- package/src/native/bootstrap/index.ts +11 -7
- package/src/native/payment/index.ts +2 -0
- package/src/native/payment/payment-helper.ts +2 -1
- package/src/native/rewards/check-frequency.ts +10 -0
- package/src/native/rewards/ui/payment-modal.ts +115 -34
- package/src/native/rewards/ui/unlogin-modal.ts +182 -87
- package/src/native/rewards/ui/use-modal.ts +129 -68
- package/src/native/rewards/ui/utils.ts +2 -2
- /package/dist/common/rewards/registers/utils/coins/{fetch-balance.d.ts → jolicoin/fetch-balance.d.ts} +0 -0
- /package/src/common/rewards/registers/utils/coins/{fetch-balance.ts → jolicoin/fetch-balance.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": "aa821d95b0de6f92b4f9aed50465c377b537cf49",
|
|
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",
|
|
@@ -46,25 +46,32 @@
|
|
|
46
46
|
"packages/implement/src/common/report/task-track/index.ts": "0482d7d11c2af51903d344d2ac44f6930ea81c3d",
|
|
47
47
|
"packages/implement/src/common/report/track.ts": "4072dee69ace09d8099e1131507b35f0cb6bd92e",
|
|
48
48
|
"packages/implement/src/common/report/types.ts": "9c25c62b85b9ac5dbde674601924703f7df33773",
|
|
49
|
-
"packages/implement/src/common/rewards/__tests__/can-use-jolicoin.test.ts": "
|
|
50
|
-
"packages/implement/src/common/rewards/fetch-reward.ts": "
|
|
51
|
-
"packages/implement/src/common/rewards/index.ts": "
|
|
49
|
+
"packages/implement/src/common/rewards/__tests__/can-use-jolicoin.test.ts": "aac9c78779f1d8de33918cff9961326a5054ef3d",
|
|
50
|
+
"packages/implement/src/common/rewards/fetch-reward.ts": "a2dd370ee4715ae2b52a35c13be9944d4819e5de",
|
|
51
|
+
"packages/implement/src/common/rewards/index.ts": "58fce95c7d91e28646142c03fc9f9d7a9f90b9e9",
|
|
52
52
|
"packages/implement/src/common/rewards/registers/use-ads.ts": "77c887f0e2065a8f3eec31cb5b62e1752d07298b",
|
|
53
|
-
"packages/implement/src/common/rewards/registers/use-
|
|
54
|
-
"packages/implement/src/common/rewards/registers/use-
|
|
55
|
-
"packages/implement/src/common/rewards/registers/
|
|
56
|
-
"packages/implement/src/common/rewards/registers/
|
|
57
|
-
"packages/implement/src/common/rewards/registers/utils/coins/commands/
|
|
58
|
-
"packages/implement/src/common/rewards/registers/utils/coins/commands/
|
|
59
|
-
"packages/implement/src/common/rewards/registers/utils/coins/
|
|
60
|
-
"packages/implement/src/common/rewards/registers/utils/coins/
|
|
53
|
+
"packages/implement/src/common/rewards/registers/use-gem-only.ts": "944f012b2d7e6a786b0c1b8eb139db6b09fc309f",
|
|
54
|
+
"packages/implement/src/common/rewards/registers/use-gem.ts": "4ec6e2e3888763b1e1ab63b6694eed95460f0684",
|
|
55
|
+
"packages/implement/src/common/rewards/registers/use-jolicoin-only.ts": "57f8c7156ef4cb55a707746c287eed1e883be694",
|
|
56
|
+
"packages/implement/src/common/rewards/registers/use-jolicoin.ts": "46c3e782cfa780bf262f1744bb7eff60d77cf2e3",
|
|
57
|
+
"packages/implement/src/common/rewards/registers/utils/coins/commands/currency-handlers.ts": "77219e8ce3b7cfe8c26880f6c619d41e2cccf8cb",
|
|
58
|
+
"packages/implement/src/common/rewards/registers/utils/coins/commands/index.ts": "1d5700642bf3bddb8eb598b6018cfd55bd7b3308",
|
|
59
|
+
"packages/implement/src/common/rewards/registers/utils/coins/commands/use-jolicoin.ts": "1d4eca1b189d67db138b0ac93144c9d8b33f22bb",
|
|
60
|
+
"packages/implement/src/common/rewards/registers/utils/coins/commands/use-payment.ts": "926904c3175fed90795bad1578a17d3573627180",
|
|
61
|
+
"packages/implement/src/common/rewards/registers/utils/coins/commands/use-unlogin.ts": "359ec6f2bfbf865ad1b03f3f7515e14fa438da8f",
|
|
62
|
+
"packages/implement/src/common/rewards/registers/utils/coins/currency-config.ts": "e8c1c5c9280fcc24df95d1aad60d0ae795042198",
|
|
63
|
+
"packages/implement/src/common/rewards/registers/utils/coins/index.ts": "454c807a24a64a0a7c2c8ce0f11539d3e08c9ebe",
|
|
64
|
+
"packages/implement/src/common/rewards/registers/utils/coins/jolicoin/fetch-balance.ts": "ee5887ffe5289ba59ceb12133dc4f6de26b750a4",
|
|
65
|
+
"packages/implement/src/common/rewards/registers/utils/coins/jolicoin/jolicoin-handler.ts": "c7565d73113e6d713ac150dfd5c702a476831a6c",
|
|
66
|
+
"packages/implement/src/common/rewards/registers/utils/coins/joligem/fetch-gem-balance.ts": "16e24d75cd2668ed331d0679c7ff82b0946222fb",
|
|
67
|
+
"packages/implement/src/common/rewards/registers/utils/coins/joligem/gem-handler.ts": "aa2d6a04ea82120e23c8f0f69136aa35156a2cc1",
|
|
61
68
|
"packages/implement/src/common/rewards/registers/utils/coins/rewards-command.ts": "b7a5309a43869f5024022158e3c95b505ecb55df",
|
|
62
69
|
"packages/implement/src/common/rewards/registers/utils/common.ts": "45f813bf8f1655d0533bc04e5d947f7e8b2262ec",
|
|
63
70
|
"packages/implement/src/common/rewards/registers/utils/event-listener.ts": "cd6a393d4771833cc37e38d9fb8af1900c8b0487",
|
|
64
|
-
"packages/implement/src/common/rewards/registers/utils/index.ts": "
|
|
65
|
-
"packages/implement/src/common/rewards/reward-emitter.ts": "
|
|
66
|
-
"packages/implement/src/common/rewards/reward-helper.ts": "
|
|
67
|
-
"packages/implement/src/common/rewards/type.ts": "
|
|
71
|
+
"packages/implement/src/common/rewards/registers/utils/index.ts": "f496c92e3bf81418e463f0a9a95d44798c3424b9",
|
|
72
|
+
"packages/implement/src/common/rewards/reward-emitter.ts": "1d5d9548ffe838d721e1eaa806168a770ac18590",
|
|
73
|
+
"packages/implement/src/common/rewards/reward-helper.ts": "b4813747f0da4fbd05fb23758c504ae1bc6c0e87",
|
|
74
|
+
"packages/implement/src/common/rewards/type.ts": "80b082ce5193447ccf6c85151cb849f488f68cf9",
|
|
68
75
|
"packages/implement/src/common/utils/index.ts": "54bfc80c8c20bc71504f997e445d3e8019bb762d",
|
|
69
76
|
"packages/implement/src/h5/api/ads.ts": "a6e79587749b18dd3fe7ab28dd10457f87a81f38",
|
|
70
77
|
"packages/implement/src/h5/api/base.ts": "ead2c3cdcbe174b0e725c31a3885c7985bd8f667",
|
|
@@ -88,13 +95,13 @@
|
|
|
88
95
|
"packages/implement/src/h5/report/event-tracker.ts": "012df642748f830359f86d7592fb7eee25abc4f9",
|
|
89
96
|
"packages/implement/src/h5/report/index.ts": "7154000726a72f477183d069eea5de87d12ceb7d",
|
|
90
97
|
"packages/implement/src/h5/report/task-tracker.ts": "07ffd3b6316221652528c7172869068cf4df0a15",
|
|
91
|
-
"packages/implement/src/h5/rewards/index.ts": "
|
|
98
|
+
"packages/implement/src/h5/rewards/index.ts": "b4e917c76972b6b79e24bd68180317185d971caa",
|
|
92
99
|
"packages/implement/src/index.native.ts": "96cc46c8919ba2333600e9c3ee100f47c511a79a",
|
|
93
100
|
"packages/implement/src/index.ts": "d0ca7b5312b0a258ae8887e725440c70190442f7",
|
|
94
101
|
"packages/implement/src/native/api/__tests__/convertVersionCodeToVString.test.ts": "5f948265725f8ca48851de4bd41b24a10d754982",
|
|
95
|
-
"packages/implement/src/native/api/ads.ts": "
|
|
102
|
+
"packages/implement/src/native/api/ads.ts": "cb91439dbdc300329372c0de59cefdc6e2c7108b",
|
|
96
103
|
"packages/implement/src/native/api/base.ts": "0ebf7c92ef5154ca1d321172e4f94a65e2d91b41",
|
|
97
|
-
"packages/implement/src/native/api/call-host-method.ts": "
|
|
104
|
+
"packages/implement/src/native/api/call-host-method.ts": "058cffbaf953827dd0ed938628200be9e18d38ea",
|
|
98
105
|
"packages/implement/src/native/api/get-system-info.ts": "33aa88b7f4d6c4204bc7e81ee9cce05296587691",
|
|
99
106
|
"packages/implement/src/native/api/index.ts": "0ab963402074157d1f7a77c12d0a97635b94b2a9",
|
|
100
107
|
"packages/implement/src/native/api/is-native-support.ts": "46d9353fcec02ac0f4ed7094a7ceae2900eb45c1",
|
|
@@ -107,15 +114,15 @@
|
|
|
107
114
|
"packages/implement/src/native/api/storage.ts": "d395e86a04060a1e734f12c1b9c2e7b56eba392b",
|
|
108
115
|
"packages/implement/src/native/api/task.ts": "a22d6f9b0587d2e6c7bfe13cd344d5192c1f75ea",
|
|
109
116
|
"packages/implement/src/native/api/utils.ts": "a589552be6ef411ea7bffa5061da9825ae68a73f",
|
|
110
|
-
"packages/implement/src/native/bootstrap/index.ts": "
|
|
117
|
+
"packages/implement/src/native/bootstrap/index.ts": "2f40056c876ff5ce9db01385d8e4401e2ba48149",
|
|
111
118
|
"packages/implement/src/native/bootstrap/init-env.ts": "d7c3d9bfcf496d6478836f9c6d6e61a712f7b612",
|
|
112
119
|
"packages/implement/src/native/network/create-fetch.ts": "6d9dacabf473f2e965227c09c5293aa5d9789309",
|
|
113
120
|
"packages/implement/src/native/network/index.ts": "27b619a9a1127c3713eade7731cb26a3d84be6d5",
|
|
114
121
|
"packages/implement/src/native/network/report.ts": "705e9614faeb0611c9c57ced998885bdc3a02d11",
|
|
115
122
|
"packages/implement/src/native/network/types.ts": "4e8eb72bf0b0b26a5298ce42d96855d27769be51",
|
|
116
123
|
"packages/implement/src/native/network/utils.ts": "53877a6871dc3a6b173daef930872c44589659b9",
|
|
117
|
-
"packages/implement/src/native/payment/index.ts": "
|
|
118
|
-
"packages/implement/src/native/payment/payment-helper.ts": "
|
|
124
|
+
"packages/implement/src/native/payment/index.ts": "6ead1fc6e7261ba851f926afb315f6988639e74a",
|
|
125
|
+
"packages/implement/src/native/payment/payment-helper.ts": "bb016488a6eaad42f1fd9c18cb77279d34a77410",
|
|
119
126
|
"packages/implement/src/native/payment/registers/base.ts": "63973fe618cfaa5bc0baa88c7f1d271638c65c1a",
|
|
120
127
|
"packages/implement/src/native/payment/registers/const.ts": "cba0087bccbd01349acc46f69adaeed80f4d16a0",
|
|
121
128
|
"packages/implement/src/native/payment/registers/joli-coin.ts": "caa3bd121e2159091dbe7cc3f58c2fba67d337a4",
|
|
@@ -124,12 +131,12 @@
|
|
|
124
131
|
"packages/implement/src/native/report/errors/index.ts": "40e60ee03e0b91cdb0a143a2bea07f5d1e5d6dd7",
|
|
125
132
|
"packages/implement/src/native/report/index.ts": "5a92a8ed6a3414b4c9e78f965a5d0d555001c024",
|
|
126
133
|
"packages/implement/src/native/report/task-tracker.ts": "af004ee899252849ccb312bb0c00450c742951f4",
|
|
127
|
-
"packages/implement/src/native/rewards/check-frequency.ts": "
|
|
134
|
+
"packages/implement/src/native/rewards/check-frequency.ts": "9216ec863acd9ae1a2ae7a8c144721fb262fda37",
|
|
128
135
|
"packages/implement/src/native/rewards/index.ts": "543b4631fb8952aaf19e10863463a0e3a4f0b34e",
|
|
129
|
-
"packages/implement/src/native/rewards/ui/payment-modal.ts": "
|
|
130
|
-
"packages/implement/src/native/rewards/ui/unlogin-modal.ts": "
|
|
131
|
-
"packages/implement/src/native/rewards/ui/use-modal.ts": "
|
|
132
|
-
"packages/implement/src/native/rewards/ui/utils.ts": "
|
|
136
|
+
"packages/implement/src/native/rewards/ui/payment-modal.ts": "33092a6ec3e9936cc8976fe8315f1edb316babc5",
|
|
137
|
+
"packages/implement/src/native/rewards/ui/unlogin-modal.ts": "da6f18bd2cc575592e216fed584d09f6765f1e96",
|
|
138
|
+
"packages/implement/src/native/rewards/ui/use-modal.ts": "7ec80b389daac9660c20c46979e875fc00ebd0ac",
|
|
139
|
+
"packages/implement/src/native/rewards/ui/utils.ts": "4ac58033bd35757b9519c1490abb70c4e6af66af",
|
|
133
140
|
"packages/implement/src/native/rewards/utils.ts": "af00dd225556ab61332cb2cbf5e8da426136bc0b",
|
|
134
141
|
"packages/implement/src/native/ui/modal-iframe.ts": "7d50b2c44023f08dc025d4483838f930c8e5a55d",
|
|
135
142
|
"packages/implement/src/native/ui/retention.ts": "85b600af664d714c6ce8b56a9eee823527df87ec",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IHttpClient } from '@/common/http';
|
|
2
|
+
import { IAdBreakParams } from '@/common/ads';
|
|
3
|
+
export type GemOnlyRewardsHandler = (params: IAdBreakParams) => Promise<boolean>;
|
|
4
|
+
export declare const createGemOnlyRewardHandler: (httpClient: IHttpClient, { onUnlockSuccess, onUnlockFailed }: {
|
|
5
|
+
onUnlockSuccess?: (data: {
|
|
6
|
+
quantity: number;
|
|
7
|
+
balance: number;
|
|
8
|
+
}) => void;
|
|
9
|
+
onUnlockFailed?: () => void;
|
|
10
|
+
}) => GemOnlyRewardsHandler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IHttpClient } from '@/common/http';
|
|
2
|
+
import { IAdBreakParams } from '@/common/ads';
|
|
3
|
+
export type GemRewardsHandler = (params: IAdBreakParams) => Promise<boolean>;
|
|
4
|
+
export declare const createGemRewardHandler: (httpClient: IHttpClient, { onUnlockSuccess, onUnlockFailed }: {
|
|
5
|
+
onUnlockSuccess?: (data: {
|
|
6
|
+
quantity: number;
|
|
7
|
+
balance: number;
|
|
8
|
+
}) => void;
|
|
9
|
+
onUnlockFailed?: () => void;
|
|
10
|
+
}) => GemRewardsHandler;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IHttpClient } from '@/common/http';
|
|
2
|
+
import { IJoliCoin, IGem } from '@/common/rewards/type';
|
|
3
|
+
import { IUnlockOptionsEvent } from '@/common/rewards/reward-emitter';
|
|
4
|
+
export type CurrencyType = 'JOLI_COIN' | 'JOLI_GEM';
|
|
5
|
+
export interface CurrencyHandler {
|
|
6
|
+
fetchBalance: (httpClient: IHttpClient) => Promise<{
|
|
7
|
+
balance: number;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
getQuantity: (unlockOptions: IUnlockOptionsEvent | null) => number;
|
|
10
|
+
getCurrentUser: (unlockOptions: IUnlockOptionsEvent | null) => IJoliCoin | IGem;
|
|
11
|
+
createUpdatedUser: (balance: number, enableAutoDeduct: boolean) => IJoliCoin | IGem;
|
|
12
|
+
getUpdateKey: () => keyof Pick<IUnlockOptionsEvent, 'userJoliCoin' | 'userGem'>;
|
|
13
|
+
isEnough: (unlockOptions: IUnlockOptionsEvent | null, user: IJoliCoin | IGem) => boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const CURRENCY_HANDLERS: Record<CurrencyType, CurrencyHandler>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { registerUseJolicoinCommand,
|
|
1
|
+
export { registerUseJolicoinCommand, createShowUnlockWithCurrencyModal } from './use-jolicoin';
|
|
2
2
|
export { registerUsePaymentCommand, createInitiateAndAwaitPayment } from './use-payment';
|
|
3
3
|
export { registerUseUnloginCommand, createShowUnloginModal } from './use-unlogin';
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { IJoliCoin } from '@/common/rewards/type';
|
|
2
|
-
export declare const registerUseJolicoinCommand: (prefix: "JOLI_COIN" | "ADS-JOLI_COIN", params: {
|
|
3
|
-
|
|
1
|
+
import { IGem, IJoliCoin } from '@/common/rewards/type';
|
|
2
|
+
export declare const registerUseJolicoinCommand: <T extends IJoliCoin | IGem>(prefix: "JOLI_COIN" | "ADS-JOLI_COIN" | "JOLI_GEM" | "ADS-JOLI_GEM", currency: "JOLI_COIN" | "JOLI_GEM", params: {
|
|
3
|
+
showUnlockWithCurrencyModal: (params: {
|
|
4
4
|
enableAutoDeduct: boolean;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
userCurrency: T;
|
|
6
|
+
quantity: number;
|
|
7
|
+
currency: T extends IJoliCoin ? "JOLI_COIN" : "JOLI_GEM";
|
|
7
8
|
}) => Promise<"CONFIRM" | "CANCEL" | "FAILED">;
|
|
8
9
|
}) => void;
|
|
9
|
-
export declare const
|
|
10
|
+
export declare const createShowUnlockWithCurrencyModal: <T extends IJoliCoin | IGem>(type: "JOLI_COIN" | "ADS-JOLI_COIN" | "JOLI_GEM" | "ADS-JOLI_GEM", buttons: {
|
|
10
11
|
confirmButtonText: string;
|
|
11
12
|
cancelButtonText: string;
|
|
12
13
|
}) => (params: {
|
|
13
14
|
enableAutoDeduct: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
userCurrency: T;
|
|
16
|
+
quantity: number;
|
|
17
|
+
currency: T extends IJoliCoin ? "JOLI_COIN" : "JOLI_GEM";
|
|
16
18
|
}) => Promise<"FAILED" | "CANCEL" | "CONFIRM">;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { IJoliCoin } from '@/common/rewards/type';
|
|
1
|
+
import { IJoliCoin, IGem } from '@/common/rewards/type';
|
|
2
2
|
import { IHttpClient } from '@/common/http';
|
|
3
|
-
export declare const registerUsePaymentCommand: (prefix: "JOLI_COIN" | "ADS-JOLI_COIN", params: {
|
|
3
|
+
export declare const registerUsePaymentCommand: <T extends IJoliCoin | IGem>(prefix: "JOLI_COIN" | "ADS-JOLI_COIN" | "JOLI_GEM" | "ADS-JOLI_GEM", currency: "JOLI_COIN" | "JOLI_GEM", params: {
|
|
4
4
|
httpClient: IHttpClient;
|
|
5
5
|
initiateAndAwaitPayment: (params: {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
userCurrency: T;
|
|
7
|
+
currencyQuantity: number;
|
|
8
|
+
currency: T extends IJoliCoin ? "JOLI_COIN" : "JOLI_GEM";
|
|
8
9
|
}) => Promise<"SUCCESS" | "FAILED" | "CANCEL">;
|
|
9
10
|
}) => void;
|
|
10
|
-
export declare const createInitiateAndAwaitPayment: (type: "JOLI_COIN" | "ADS-JOLI_COIN", buttons: {
|
|
11
|
+
export declare const createInitiateAndAwaitPayment: (type: "JOLI_COIN" | "ADS-JOLI_COIN" | "JOLI_GEM" | "ADS-JOLI_GEM", buttons: {
|
|
11
12
|
confirmButtonText: string;
|
|
12
13
|
cancelButtonText: string;
|
|
13
|
-
}) => (params: {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
}) => <T extends IJoliCoin | IGem>(params: {
|
|
15
|
+
userCurrency: T;
|
|
16
|
+
currencyQuantity: number;
|
|
17
|
+
currency: T extends IJoliCoin ? "JOLI_COIN" : "JOLI_GEM";
|
|
16
18
|
}) => Promise<"SUCCESS" | "FAILED" | "CANCEL">;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { IUseUnloginModalResultEvent } from '@/common/rewards/reward-emitter';
|
|
2
2
|
import { IHttpClient } from '@/common/http';
|
|
3
|
-
export declare const registerUseUnloginCommand: (prefix: "JOLI_COIN" | "ADS-JOLI_COIN", params: {
|
|
3
|
+
export declare const registerUseUnloginCommand: (prefix: "JOLI_COIN" | "ADS-JOLI_COIN" | "JOLI_GEM" | "ADS-JOLI_GEM", currency: "JOLI_COIN" | "JOLI_GEM", params: {
|
|
4
4
|
httpClient: IHttpClient;
|
|
5
|
-
showUnloginModal: () => Promise<{
|
|
5
|
+
showUnloginModal: (currency: "JOLI_COIN" | "JOLI_GEM") => Promise<{
|
|
6
6
|
result: "CANCEL" | "FAILED" | "SUCCESS" | "ADS" | "NOT_SUPPORT";
|
|
7
7
|
rewards?: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
claimedRewardValue: number;
|
|
11
|
-
};
|
|
8
|
+
isFirstLogin: boolean;
|
|
9
|
+
claimedRewardValue: number;
|
|
12
10
|
};
|
|
13
11
|
}>;
|
|
14
12
|
}) => void;
|
|
15
|
-
export declare const createShowUnloginModal: (type: "JOLI_COIN" | "ADS-JOLI_COIN", buttons: {
|
|
13
|
+
export declare const createShowUnloginModal: (type: "JOLI_COIN" | "ADS-JOLI_COIN" | "JOLI_GEM" | "ADS-JOLI_GEM", buttons: {
|
|
16
14
|
confirmButtonText: string;
|
|
17
15
|
cancelButtonText: string;
|
|
18
|
-
}) => () => Promise<IUseUnloginModalResultEvent>;
|
|
16
|
+
}) => (currency: "JOLI_COIN" | "JOLI_GEM") => Promise<IUseUnloginModalResultEvent>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type CurrencyType = 'JOLI_COIN' | 'GEM';
|
|
2
|
+
export interface CurrencyConfig {
|
|
3
|
+
balanceEndpoint: string;
|
|
4
|
+
unlockEndpoint: string;
|
|
5
|
+
balanceDetailEndpoint: string;
|
|
6
|
+
unlockType: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const CURRENCY_CONFIG: Record<CurrencyType, CurrencyConfig>;
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { IAdBreakParams } from '@/common/ads';
|
|
4
|
-
import { EventPromiseHandler } from '../event-listener';
|
|
5
|
-
import { createInitiateAndAwaitPayment, createShowUnlockWithJolicoinModal, createShowUnloginModal } from './commands';
|
|
6
|
-
export declare const createCommonJolicoinRewardHandler: (type: "JOLI_COIN" | "ADS-JOLI_COIN", httpClient: IHttpClient, { handlers: { handleUnlockSuccess, handleUnlockFailed, unlockOptionsHandler, initiateAndAwaitPayment, showUnlockWithJolicoinModal, showUnloginModal } }: {
|
|
7
|
-
handlers: {
|
|
8
|
-
handleUnlockSuccess?: (data: {
|
|
9
|
-
quantity: number;
|
|
10
|
-
balance: number;
|
|
11
|
-
}) => void;
|
|
12
|
-
handleUnlockFailed?: (params: IAdBreakParams) => void;
|
|
13
|
-
unlockOptionsHandler: EventPromiseHandler<IUnlockOptionsEvent, typeof UnlockOptionsEventName>;
|
|
14
|
-
initiateAndAwaitPayment: ReturnType<typeof createInitiateAndAwaitPayment>;
|
|
15
|
-
showUnlockWithJolicoinModal: ReturnType<typeof createShowUnlockWithJolicoinModal>;
|
|
16
|
-
showUnloginModal: ReturnType<typeof createShowUnloginModal>;
|
|
17
|
-
};
|
|
18
|
-
}) => (params: IAdBreakParams) => Promise<boolean>;
|
|
1
|
+
export { createCommonJolicoinRewardHandler } from './jolicoin/jolicoin-handler';
|
|
2
|
+
export { createCommonGemRewardHandler } from './joligem/gem-handler';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IHttpClient } from '@/common/http';
|
|
2
|
+
import { UnlockOptionsEventName, IUnlockOptionsEvent } from '@/common/rewards/reward-emitter';
|
|
3
|
+
import { IAdBreakParams } from '@/common/ads';
|
|
4
|
+
import { EventPromiseHandler } from '../../event-listener';
|
|
5
|
+
import { createInitiateAndAwaitPayment, createShowUnlockWithCurrencyModal, createShowUnloginModal } from '../commands';
|
|
6
|
+
export declare const createCommonJolicoinRewardHandler: (type: "JOLI_COIN" | "ADS-JOLI_COIN", httpClient: IHttpClient, config: {
|
|
7
|
+
handlers: {
|
|
8
|
+
handleUnlockSuccess?: (data: {
|
|
9
|
+
quantity: number;
|
|
10
|
+
balance: number;
|
|
11
|
+
}) => void;
|
|
12
|
+
handleUnlockFailed?: (params: IAdBreakParams) => void;
|
|
13
|
+
unlockOptionsHandler: EventPromiseHandler<IUnlockOptionsEvent, typeof UnlockOptionsEventName>;
|
|
14
|
+
initiateAndAwaitPayment: ReturnType<typeof createInitiateAndAwaitPayment>;
|
|
15
|
+
showUnlockWithCurrencyModal: ReturnType<typeof createShowUnlockWithCurrencyModal>;
|
|
16
|
+
showUnloginModal: ReturnType<typeof createShowUnloginModal>;
|
|
17
|
+
};
|
|
18
|
+
}) => (params: IAdBreakParams) => Promise<boolean>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IHttpClient } from '@/common/http';
|
|
2
|
+
import { UnlockOptionsEventName, IUnlockOptionsEvent } from '@/common/rewards/reward-emitter';
|
|
3
|
+
import { IAdBreakParams } from '@/common/ads';
|
|
4
|
+
import { EventPromiseHandler } from '../../event-listener';
|
|
5
|
+
import { createInitiateAndAwaitPayment, createShowUnloginModal } from '../commands';
|
|
6
|
+
import { createShowUnlockWithCurrencyModal } from '../commands/use-jolicoin';
|
|
7
|
+
export declare const createCommonGemRewardHandler: (type: "JOLI_GEM" | "ADS-JOLI_GEM", httpClient: IHttpClient, { handlers: { handleUnlockSuccess, handleUnlockFailed, unlockOptionsHandler, initiateAndAwaitPayment, showUnlockWithCurrencyModal, showUnloginModal } }: {
|
|
8
|
+
handlers: {
|
|
9
|
+
handleUnlockSuccess?: (data: {
|
|
10
|
+
quantity: number;
|
|
11
|
+
balance: number;
|
|
12
|
+
}) => void;
|
|
13
|
+
handleUnlockFailed?: (params: IAdBreakParams) => void;
|
|
14
|
+
unlockOptionsHandler: EventPromiseHandler<IUnlockOptionsEvent, typeof UnlockOptionsEventName>;
|
|
15
|
+
initiateAndAwaitPayment: ReturnType<typeof createInitiateAndAwaitPayment>;
|
|
16
|
+
showUnlockWithCurrencyModal: ReturnType<typeof createShowUnlockWithCurrencyModal>;
|
|
17
|
+
showUnloginModal: ReturnType<typeof createShowUnloginModal>;
|
|
18
|
+
};
|
|
19
|
+
}) => (params: IAdBreakParams) => Promise<boolean>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { IJoliCoin, IUnlockOption } from '@/common/rewards/type';
|
|
1
|
+
import { IJoliCoin, IGem, IUnlockOption } from '@/common/rewards/type';
|
|
2
2
|
export declare const canUseJolicoin: (unlockOptions: IUnlockOption[], joliCoin?: IJoliCoin) => boolean;
|
|
3
3
|
export declare const joliCoinIsEnough: (unlockOptions: IUnlockOption[], joliCoin?: IJoliCoin) => boolean;
|
|
4
|
+
export declare const canUseGem: (unlockOptions: IUnlockOption[], gem?: IGem) => boolean;
|
|
5
|
+
export declare const gemIsEnough: (unlockOptions: IUnlockOption[], gem?: IGem) => boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EventEmitter } from '@jolibox/common';
|
|
2
|
-
import { IUnlockOption } from './type';
|
|
3
|
-
import { IJoliCoin } from './type';
|
|
2
|
+
import { IUnlockOption, IJoliCoin, IGem } from './type';
|
|
4
3
|
export interface IUnlockOptionsEvent {
|
|
5
4
|
options: IUnlockOption[];
|
|
6
5
|
userJoliCoin: IJoliCoin;
|
|
6
|
+
userGem?: IGem;
|
|
7
7
|
}
|
|
8
8
|
export declare const UnlockOptionsEventName: "UNLOCK_OPTIONS_CHANGED";
|
|
9
9
|
export declare const InvokePaymentEventName: "INVOKE_PAYMENT";
|
|
@@ -16,6 +16,8 @@ export declare const InvokeUnloginModalEventName: "INVOKE_UNLOGIN_MODAL_EVENT";
|
|
|
16
16
|
type IPaymentResult = 'SUCCESS' | 'FAILED' | 'CANCEL';
|
|
17
17
|
export interface IPaymentEvent {
|
|
18
18
|
userJoliCoin?: IJoliCoin;
|
|
19
|
+
userGem?: IGem;
|
|
20
|
+
currency: 'JOLI_COIN' | 'JOLI_GEM';
|
|
19
21
|
paymentResult: IPaymentResult;
|
|
20
22
|
}
|
|
21
23
|
export interface IPaymentChoice {
|
|
@@ -25,8 +27,9 @@ export interface IPaymentChoice {
|
|
|
25
27
|
appStoreProductId?: string;
|
|
26
28
|
}
|
|
27
29
|
export interface IInvokePaymentEvent {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
userCurrency: IJoliCoin | IGem;
|
|
31
|
+
quantity: number;
|
|
32
|
+
currency: 'JOLI_COIN' | 'JOLI_GEM';
|
|
30
33
|
enableAutoDeduct: boolean;
|
|
31
34
|
confirmButtonText: string;
|
|
32
35
|
cancelButtonText: string;
|
|
@@ -34,8 +37,9 @@ export interface IInvokePaymentEvent {
|
|
|
34
37
|
}
|
|
35
38
|
export interface IUseModalEvent {
|
|
36
39
|
enableAutoDeduct: boolean;
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
userCurrency: IJoliCoin | IGem;
|
|
41
|
+
quantity: number;
|
|
42
|
+
currency: 'JOLI_COIN' | 'JOLI_GEM';
|
|
39
43
|
confirmButtonText: string;
|
|
40
44
|
cancelButtonText: string;
|
|
41
45
|
sequenceId?: string;
|
|
@@ -43,6 +47,7 @@ export interface IUseModalEvent {
|
|
|
43
47
|
export interface IUseUnloginModalEvent {
|
|
44
48
|
confirmButtonText: string;
|
|
45
49
|
cancelButtonText: string;
|
|
50
|
+
currency: 'JOLI_COIN' | 'JOLI_GEM';
|
|
46
51
|
}
|
|
47
52
|
export interface IUseModalResultEvent {
|
|
48
53
|
useModalResult: 'CONFIRM' | 'CANCEL' | 'FAILED';
|
|
@@ -50,10 +55,9 @@ export interface IUseModalResultEvent {
|
|
|
50
55
|
export interface IUseUnloginModalResultEvent {
|
|
51
56
|
result: 'SUCCESS' | 'CANCEL' | 'ADS' | 'FAILED' | 'NOT_SUPPORT';
|
|
52
57
|
rewards?: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
58
|
+
claimedRewardValue: number;
|
|
59
|
+
isFirstLogin: boolean;
|
|
60
|
+
currency?: 'JOLI_COIN' | 'JOLI_GEM';
|
|
57
61
|
};
|
|
58
62
|
}
|
|
59
63
|
export interface IUseModalFrequencyConfig {
|
|
@@ -75,12 +79,18 @@ export interface IUseModalFrequencyConfig {
|
|
|
75
79
|
}
|
|
76
80
|
export interface RewardsEventMap extends Record<string, unknown[]> {
|
|
77
81
|
[UnlockOptionsEventName]: [IUnlockOptionsEvent];
|
|
78
|
-
[InvokePaymentEventName]: [
|
|
82
|
+
[InvokePaymentEventName]: [
|
|
83
|
+
'JOLI_COIN' | 'ADS-JOLI_COIN' | 'JOLI_GEM' | 'ADS-JOLI_GEM',
|
|
84
|
+
IInvokePaymentEvent
|
|
85
|
+
];
|
|
79
86
|
[PaymentResultEventName]: [IPaymentEvent];
|
|
80
87
|
[UseModalResultEventName]: [IUseModalResultEvent];
|
|
81
|
-
[UseModalEventName]: ['JOLI_COIN' | 'ADS-JOLI_COIN', IUseModalEvent];
|
|
88
|
+
[UseModalEventName]: ['JOLI_COIN' | 'ADS-JOLI_COIN' | 'JOLI_GEM' | 'ADS-JOLI_GEM', IUseModalEvent];
|
|
82
89
|
[UseModalFrequencyEventName]: [IUseModalFrequencyConfig];
|
|
83
|
-
[InvokeUnloginModalEventName]: [
|
|
90
|
+
[InvokeUnloginModalEventName]: [
|
|
91
|
+
'JOLI_COIN' | 'ADS-JOLI_COIN' | 'JOLI_GEM' | 'ADS-JOLI_GEM',
|
|
92
|
+
IUseUnloginModalEvent
|
|
93
|
+
];
|
|
84
94
|
[UseUnloginModalResultEventName]: [IUseUnloginModalResultEvent];
|
|
85
95
|
}
|
|
86
96
|
export declare const originalRewardsEmitter: EventEmitter<RewardsEventMap, keyof RewardsEventMap>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
export type RewardType = 'ADS' | 'JOLI_COIN' | 'JOLI_COIN_ONLY';
|
|
1
|
+
export type RewardType = 'ADS' | 'JOLI_COIN' | 'JOLI_COIN_ONLY' | 'JOLI_GEM' | 'JOLI_GEM_ONLY';
|
|
2
2
|
import type { AdsRewardsHandler } from './registers/use-ads';
|
|
3
3
|
import { IUseModalFrequencyConfig } from './reward-emitter';
|
|
4
4
|
export interface RewardHandlerMap {
|
|
5
5
|
ADS: AdsRewardsHandler;
|
|
6
6
|
JOLI_COIN: (params?: unknown) => Promise<boolean>;
|
|
7
7
|
JOLI_COIN_ONLY: (params?: unknown) => Promise<boolean>;
|
|
8
|
+
JOLI_GEM: (params?: unknown) => Promise<boolean>;
|
|
9
|
+
JOLI_GEM_ONLY: (params?: unknown) => Promise<boolean>;
|
|
8
10
|
}
|
|
9
11
|
export type RewardHandler<T extends RewardType> = RewardHandlerMap[T];
|
|
10
12
|
export declare function createRewardsHelper(): {
|
|
@@ -2,13 +2,21 @@ export interface IJoliCoin {
|
|
|
2
2
|
balance: number;
|
|
3
3
|
enableAutoDeduct: boolean;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export interface IGem {
|
|
6
|
+
balance: number;
|
|
7
|
+
enableAutoDeduct: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type IUnlockOptionType = 'JOLI_COIN' | 'ADS' | 'JOLI_GEM';
|
|
6
10
|
interface IJoliCoinChoice {
|
|
7
11
|
joliCoinQuantity: number;
|
|
8
12
|
}
|
|
13
|
+
interface IGemChoice {
|
|
14
|
+
joliGemQuantity: number;
|
|
15
|
+
}
|
|
9
16
|
export interface IUnlockOption {
|
|
10
17
|
type: IUnlockOptionType;
|
|
11
18
|
joliCoinChoices: IJoliCoinChoice[];
|
|
19
|
+
joliGemChoice: IGemChoice | null;
|
|
12
20
|
}
|
|
13
21
|
export interface IJolicoinRewardOption {
|
|
14
22
|
code: 'SUCCESS' | 'ERROR' | 'PARAMETER_ERROR' | 'EPISODE_LOCK_JUMP';
|
|
@@ -18,6 +26,7 @@ export interface IJolicoinRewardOption {
|
|
|
18
26
|
};
|
|
19
27
|
extra: {
|
|
20
28
|
joliCoin: IJoliCoin;
|
|
29
|
+
joliGem?: IGem;
|
|
21
30
|
};
|
|
22
31
|
}
|
|
23
32
|
export {};
|