@jolibox/implement 1.1.19-beta.1 → 1.1.19-beta.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 +22 -15
- package/.rush/temp/shrinkwrap-deps.json +1 -1
- package/dist/common/rewards/index.d.ts +1 -10
- package/dist/common/rewards/registers/use-ads.d.ts +3 -2
- package/dist/common/rewards/registers/use-jolicoin-only.d.ts +10 -0
- package/dist/common/rewards/registers/utils/coins/index.d.ts +32 -0
- package/dist/common/rewards/registers/utils/event-listener.d.ts +15 -0
- package/dist/common/rewards/registers/utils/index.d.ts +1 -0
- package/dist/common/rewards/reward-emitter.d.ts +58 -0
- package/dist/common/rewards/reward-helper.d.ts +2 -1
- package/dist/common/utils/index.d.ts +49 -2
- package/dist/h5/api/ads.d.ts +1 -1
- package/dist/h5/http/index.d.ts +1 -1
- package/dist/h5/rewards/index.d.ts +4 -0
- package/dist/index.js +197 -3
- package/dist/index.native.js +402 -21
- package/dist/native/api/ads.d.ts +1 -1
- package/dist/native/api/login.d.ts +4 -1
- package/dist/native/rewards/index.d.ts +4 -0
- package/dist/native/ui/modal-iframe.d.ts +26 -0
- package/implement.build.log +2 -2
- package/package.json +5 -4
- package/src/common/context/index.ts +3 -3
- package/src/common/rewards/fetch-reward.ts +9 -3
- package/src/common/rewards/index.ts +1 -12
- package/src/common/rewards/registers/use-ads.ts +3 -2
- package/src/common/rewards/registers/use-jolicoin-only.ts +57 -0
- package/src/common/rewards/registers/use-jolicoin.ts +27 -77
- package/src/common/rewards/registers/utils/coins/index.ts +186 -0
- package/src/common/rewards/registers/utils/event-listener.ts +66 -0
- package/src/common/rewards/registers/utils/index.ts +8 -0
- package/src/common/rewards/reward-emitter.ts +79 -0
- package/src/common/rewards/reward-helper.ts +3 -2
- package/src/common/utils/index.ts +117 -4
- package/src/h5/api/ads.ts +65 -12
- package/src/h5/http/index.ts +2 -2
- package/src/h5/rewards/index.ts +69 -0
- package/src/native/api/ads.ts +95 -33
- package/src/native/api/login.ts +1 -1
- package/src/native/bootstrap/index.ts +5 -0
- package/src/native/rewards/index.ts +138 -0
- package/src/native/ui/modal-iframe.ts +271 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
|
-
"packages/implement/.rush/temp/shrinkwrap-deps.json": "
|
|
3
|
+
"packages/implement/.rush/temp/shrinkwrap-deps.json": "863889e770f49c143b57a3b3a0900c3081b3ce64",
|
|
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": "612d36c8452ed7612975d2286150c1bc3af89f00",
|
|
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",
|
|
@@ -31,7 +31,7 @@
|
|
|
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
33
|
"packages/implement/src/common/can-i-use.ts": "9a28562870d92b82ce42ec656c8e9d868dd87528",
|
|
34
|
-
"packages/implement/src/common/context/index.ts": "
|
|
34
|
+
"packages/implement/src/common/context/index.ts": "2f8d04936bc208ef9314594120120d0e86769666",
|
|
35
35
|
"packages/implement/src/common/context/types.ts": "244ff65de52dcbce2457ffee427f5fa102987825",
|
|
36
36
|
"packages/implement/src/common/context/url-parse.ts": "45c785fa2fde9ea1096a353b65d986a28137ee89",
|
|
37
37
|
"packages/implement/src/common/http/index.ts": "5087185d80e1e239262f849b3015eb9b810e2945",
|
|
@@ -47,15 +47,19 @@
|
|
|
47
47
|
"packages/implement/src/common/report/track.ts": "1c71050f8caadfe7065f0db5a4a0708c264c21b4",
|
|
48
48
|
"packages/implement/src/common/report/types.ts": "fd127bfd31586f1d712152ef60a4e9175f8bfe8f",
|
|
49
49
|
"packages/implement/src/common/rewards/__tests__/can-use-jolicoin.test.ts": "ec0f7225cb1b322e9278a3d8d6848bc50190696a",
|
|
50
|
-
"packages/implement/src/common/rewards/fetch-reward.ts": "
|
|
51
|
-
"packages/implement/src/common/rewards/index.ts": "
|
|
52
|
-
"packages/implement/src/common/rewards/registers/use-ads.ts": "
|
|
53
|
-
"packages/implement/src/common/rewards/registers/use-jolicoin.ts": "
|
|
54
|
-
"packages/implement/src/common/rewards/registers/
|
|
55
|
-
"packages/implement/src/common/rewards/
|
|
50
|
+
"packages/implement/src/common/rewards/fetch-reward.ts": "8ab2dddc9dea80f90b7d829fdb44965c53f2b78f",
|
|
51
|
+
"packages/implement/src/common/rewards/index.ts": "c38e430e08d2738be5e6c26a200454b6fe83e969",
|
|
52
|
+
"packages/implement/src/common/rewards/registers/use-ads.ts": "7ba8cf739f97b658cb33446c11fdb0eaf58c2ea1",
|
|
53
|
+
"packages/implement/src/common/rewards/registers/use-jolicoin-only.ts": "445d75475d1307d654c647f3f93660f8964f149d",
|
|
54
|
+
"packages/implement/src/common/rewards/registers/use-jolicoin.ts": "cec4538397226a7ad801d06a12ee20d3fc995d0d",
|
|
55
|
+
"packages/implement/src/common/rewards/registers/utils/coins/index.ts": "8c7ece78442c861395b210457f148b7fcc978d88",
|
|
56
|
+
"packages/implement/src/common/rewards/registers/utils/event-listener.ts": "960e17a6c405c3a64975448052198b1388674c08",
|
|
57
|
+
"packages/implement/src/common/rewards/registers/utils/index.ts": "0b72aa9221d5b2bf0514205c77292d1f946a7a67",
|
|
58
|
+
"packages/implement/src/common/rewards/reward-emitter.ts": "64e262797f8f5f8dfe7dfb7807bc86cc5f340a36",
|
|
59
|
+
"packages/implement/src/common/rewards/reward-helper.ts": "515d54356e03e11eebd6cb617f34c8c74a8d1d6a",
|
|
56
60
|
"packages/implement/src/common/rewards/type.ts": "75c8444405686dbee1628f6d67c4a6b803e0623e",
|
|
57
|
-
"packages/implement/src/common/utils/index.ts": "
|
|
58
|
-
"packages/implement/src/h5/api/ads.ts": "
|
|
61
|
+
"packages/implement/src/common/utils/index.ts": "ea62c3925db1a4cb3a8c58d03a89956fba156e99",
|
|
62
|
+
"packages/implement/src/h5/api/ads.ts": "b0bdfd546fd7cdefbdc29f4ecab09d202d891e00",
|
|
59
63
|
"packages/implement/src/h5/api/base.ts": "ead2c3cdcbe174b0e725c31a3885c7985bd8f667",
|
|
60
64
|
"packages/implement/src/h5/api/get-system-info.ts": "158d66156c720446457318b7eaa9112452114dbb",
|
|
61
65
|
"packages/implement/src/h5/api/index.ts": "81b815f5ac8e1bd3e3f019f94c28bd5522a36193",
|
|
@@ -63,7 +67,7 @@
|
|
|
63
67
|
"packages/implement/src/h5/api/storage.ts": "ac2d6aa75c8fd5fc2f9f06124db0b0b61ab40ac3",
|
|
64
68
|
"packages/implement/src/h5/api/task.ts": "8bb87ad8874f6a3833901977b9b5659838c9aacf",
|
|
65
69
|
"packages/implement/src/h5/bootstrap/index.ts": "8beec81dba25b479afe06f79f9b6e3d240eea32a",
|
|
66
|
-
"packages/implement/src/h5/http/index.ts": "
|
|
70
|
+
"packages/implement/src/h5/http/index.ts": "663773a22102d7c439270de8ecb759166aa683e5",
|
|
67
71
|
"packages/implement/src/h5/http/utils/__tests__/xua.test.ts": "4345cfd10cae6f94cef673f04a5155b70123c048",
|
|
68
72
|
"packages/implement/src/h5/http/utils/index.ts": "05f4d94be09b9bfdcbb1365b31a5559e44a74991",
|
|
69
73
|
"packages/implement/src/h5/http/utils/session.ts": "4762a6a56762484f91ca5f2a456ab2cff3107659",
|
|
@@ -71,20 +75,21 @@
|
|
|
71
75
|
"packages/implement/src/h5/report/event-tracker.ts": "792ab8e4776b2479ea95cb9d0312aff06a8beffc",
|
|
72
76
|
"packages/implement/src/h5/report/index.ts": "7154000726a72f477183d069eea5de87d12ceb7d",
|
|
73
77
|
"packages/implement/src/h5/report/task-tracker.ts": "9b55e81e5c20d459ff851f70689e9280e89c0e63",
|
|
78
|
+
"packages/implement/src/h5/rewards/index.ts": "68e82e6f283ae20f4de901834c7bebc02089b8bc",
|
|
74
79
|
"packages/implement/src/index.native.ts": "96cc46c8919ba2333600e9c3ee100f47c511a79a",
|
|
75
80
|
"packages/implement/src/index.ts": "d0ca7b5312b0a258ae8887e725440c70190442f7",
|
|
76
|
-
"packages/implement/src/native/api/ads.ts": "
|
|
81
|
+
"packages/implement/src/native/api/ads.ts": "f4bd78471c91ef2479963755fcf6b202a9cc7704",
|
|
77
82
|
"packages/implement/src/native/api/base.ts": "c4c4d04519cdbc3a08226c620f6314ee3b151435",
|
|
78
83
|
"packages/implement/src/native/api/get-system-info.ts": "187333a4eca5304e896360d1496744cb7535ab49",
|
|
79
84
|
"packages/implement/src/native/api/index.ts": "39c85b6c6d93f91d9ecc4a96a38a39a425d5487a",
|
|
80
85
|
"packages/implement/src/native/api/keyboard.ts": "cb65da6e8cbfb7ef4a21582acd74f450a0e3c894",
|
|
81
86
|
"packages/implement/src/native/api/lifecycle.ts": "857beae3012fcb89396ac8e485c9d9b3df737db2",
|
|
82
|
-
"packages/implement/src/native/api/login.ts": "
|
|
87
|
+
"packages/implement/src/native/api/login.ts": "df243d5e61e0c091e8b221919188464ae35b01d0",
|
|
83
88
|
"packages/implement/src/native/api/navigate.ts": "02959c68d944fdd1478cdca29e8f50dcc70ef6a0",
|
|
84
89
|
"packages/implement/src/native/api/request.ts": "d2b5fb71eff0dfda5f24ca7ddf11fa4704c35eee",
|
|
85
90
|
"packages/implement/src/native/api/storage.ts": "4e5886d5cdb4db50ab7fcdc24392569f749f4c93",
|
|
86
91
|
"packages/implement/src/native/api/task.ts": "26e06a3d6bbeaed34fd704d096e712448296607e",
|
|
87
|
-
"packages/implement/src/native/bootstrap/index.ts": "
|
|
92
|
+
"packages/implement/src/native/bootstrap/index.ts": "3ee51f6b8c5889211aee1af654827891e0727480",
|
|
88
93
|
"packages/implement/src/native/bootstrap/init-env.ts": "b7514d5d2db60da990575c1426243777aee57748",
|
|
89
94
|
"packages/implement/src/native/network/create-fetch.ts": "74cd6f0a58a718764c4d1a15f331b2354bd1ba6e",
|
|
90
95
|
"packages/implement/src/native/network/index.ts": "be552ee13a2dbc253c0c3e46b28e01ccbeee6723",
|
|
@@ -94,6 +99,8 @@
|
|
|
94
99
|
"packages/implement/src/native/report/errors/index.ts": "40e60ee03e0b91cdb0a143a2bea07f5d1e5d6dd7",
|
|
95
100
|
"packages/implement/src/native/report/index.ts": "2df4598a1004c3f7764ac7a90528e44772b41943",
|
|
96
101
|
"packages/implement/src/native/report/task-tracker.ts": "2ae175da1a49cf62c8be344c456a83d953cfb712",
|
|
102
|
+
"packages/implement/src/native/rewards/index.ts": "4018907c7fc60a5ab2834e13656e2e63eb99a825",
|
|
103
|
+
"packages/implement/src/native/ui/modal-iframe.ts": "7d50b2c44023f08dc025d4483838f930c8e5a55d",
|
|
97
104
|
"packages/implement/src/native/ui/retention.ts": "49bc3b960c5bb4812c2dbf3a54e694ad881fbdae",
|
|
98
105
|
"packages/implement/tsconfig.json": "b150f4b2ef4eb9d98f92135d481fe530eb7145b5"
|
|
99
106
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"../../packages/implement": "../../packages/implement:
|
|
2
|
+
"../../packages/implement": "../../packages/implement:3KsljcGg3uY5Rt6XwXcD5IMpqhmdC7OJm7LyKZvNIy0=:",
|
|
3
3
|
"/@esbuild/aix-ppc64/0.24.2": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==",
|
|
4
4
|
"/@esbuild/android-arm/0.24.2": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==",
|
|
5
5
|
"/@esbuild/android-arm64/0.24.2": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==",
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { EventEmitter } from '@jolibox/common';
|
|
2
|
-
import { IUnlockOption, IJoliCoin } from './type';
|
|
3
1
|
export declare const rewardsHelper: {
|
|
4
2
|
registerRewardHandler<T extends import("./reward-helper").RewardType>(type: T, handler: import("./reward-helper").RewardHandler<T>): void;
|
|
5
3
|
handleReward<T extends import("./reward-helper").RewardType>(rewardsTypes: T[], ...args: Parameters<import("./reward-helper").RewardHandler<T>>): Promise<any>;
|
|
@@ -8,11 +6,4 @@ export declare const rewardsHelper: {
|
|
|
8
6
|
};
|
|
9
7
|
export * from './registers/use-ads';
|
|
10
8
|
export * from './registers/use-jolicoin';
|
|
11
|
-
export
|
|
12
|
-
options: IUnlockOption[];
|
|
13
|
-
userJoliCoin: IJoliCoin;
|
|
14
|
-
}
|
|
15
|
-
export declare const UnlockOptionsEventName: "UNLOCK_OPTIONS_CHANGED";
|
|
16
|
-
export declare const unlockOptionsEmitter: EventEmitter<{
|
|
17
|
-
UNLOCK_OPTIONS_CHANGED: [IUnlockOptionsEvent];
|
|
18
|
-
}, "UNLOCK_OPTIONS_CHANGED">;
|
|
9
|
+
export * from './registers/use-jolicoin-only';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IRewardParams } from '../../ads';
|
|
2
|
+
import { JoliboxAdsForGame } from '@jolibox/ads';
|
|
2
3
|
export type AdsRewardsHandler = (params: IRewardParams) => Promise<boolean>;
|
|
3
|
-
export declare const createAdsRewardHandler: (ads:
|
|
4
|
+
export declare const createAdsRewardHandler: (ads: JoliboxAdsForGame) => AdsRewardsHandler;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IHttpClient } from '@/common/http';
|
|
2
|
+
import { IAdBreakParams } from '@/common/ads';
|
|
3
|
+
export type JolicoinOnlyRewardsHandler = (params: IAdBreakParams) => Promise<boolean>;
|
|
4
|
+
export declare const createJolicoinOnlyRewardHandler: (httpClient: IHttpClient, { onUnlockSuccess, onUnlockFailed }: {
|
|
5
|
+
onUnlockSuccess?: (data: {
|
|
6
|
+
quantity: number;
|
|
7
|
+
balance: number;
|
|
8
|
+
}) => void;
|
|
9
|
+
onUnlockFailed?: () => void;
|
|
10
|
+
}) => JolicoinOnlyRewardsHandler;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { IJoliCoin } from '@/common/rewards/type';
|
|
6
|
+
export declare const createInitiateAndAwaitPayment: (type: "JOLI_COIN" | "ADS-JOLI_COIN", buttons: {
|
|
7
|
+
confirmButtonText: string;
|
|
8
|
+
cancelButtonText: string;
|
|
9
|
+
}) => (params: {
|
|
10
|
+
userJoliCoin: IJoliCoin;
|
|
11
|
+
joliCoinQuantity: number;
|
|
12
|
+
}) => Promise<"SUCCESS" | "FAILED" | "CANCEL">;
|
|
13
|
+
export declare const createShowUnlockWithJolicoinModal: (type: "JOLI_COIN" | "ADS-JOLI_COIN", buttons: {
|
|
14
|
+
confirmButtonText: string;
|
|
15
|
+
cancelButtonText: string;
|
|
16
|
+
}) => (params: {
|
|
17
|
+
enableAutoDeduct: boolean;
|
|
18
|
+
userJoliCoin: IJoliCoin;
|
|
19
|
+
joliCoinQuantity: number;
|
|
20
|
+
}) => Promise<"FAILED" | "CANCEL" | "CONFIRM">;
|
|
21
|
+
export declare const createCommonJolicoinRewardHandler: (httpClient: IHttpClient, { handlers: { handleUnlockSuccess, handleUnlockFailed, unlockOptionsHandler, initiateAndAwaitPayment, showUnlockWithJolicoinModal } }: {
|
|
22
|
+
handlers: {
|
|
23
|
+
handleUnlockSuccess?: (data: {
|
|
24
|
+
quantity: number;
|
|
25
|
+
balance: number;
|
|
26
|
+
}) => void;
|
|
27
|
+
handleUnlockFailed?: (params: IAdBreakParams) => void;
|
|
28
|
+
unlockOptionsHandler: EventPromiseHandler<IUnlockOptionsEvent, typeof UnlockOptionsEventName>;
|
|
29
|
+
initiateAndAwaitPayment: ReturnType<typeof createInitiateAndAwaitPayment>;
|
|
30
|
+
showUnlockWithJolicoinModal: ReturnType<typeof createShowUnlockWithJolicoinModal>;
|
|
31
|
+
};
|
|
32
|
+
}) => (params: IAdBreakParams) => Promise<boolean>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an event promise handler for EventEmitter with tuple-based events
|
|
3
|
+
* @param emitter The event emitter
|
|
4
|
+
* @param eventName The event name to listen for
|
|
5
|
+
* @returns An object with methods to get and manage the event data
|
|
6
|
+
*/
|
|
7
|
+
export declare function createEventPromiseHandler<T, E extends string = string>(emitter: {
|
|
8
|
+
on: (eventName: E, listener: (...args: any[]) => void) => void;
|
|
9
|
+
}, eventName: E): {
|
|
10
|
+
getData: () => Promise<T>;
|
|
11
|
+
getCachedData: () => T | null;
|
|
12
|
+
clearCache: () => void;
|
|
13
|
+
getFreshData: () => Promise<T>;
|
|
14
|
+
};
|
|
15
|
+
export type EventPromiseHandler<T, E extends string = string> = ReturnType<typeof createEventPromiseHandler<T, E>>;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { IJoliCoin, IUnlockOption } from '@/common/rewards/type';
|
|
2
2
|
export declare const canUseJolicoin: (unlockOptions: IUnlockOption[], joliCoin?: IJoliCoin) => boolean;
|
|
3
|
+
export declare const joliCoinIsEnough: (unlockOptions: IUnlockOption[], joliCoin?: IJoliCoin) => boolean;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EventEmitter } from '@jolibox/common';
|
|
2
|
+
import { IUnlockOption } from './type';
|
|
3
|
+
import { IJoliCoin } from './type';
|
|
4
|
+
export interface IUnlockOptionsEvent {
|
|
5
|
+
options: IUnlockOption[];
|
|
6
|
+
userJoliCoin: IJoliCoin;
|
|
7
|
+
}
|
|
8
|
+
export declare const UnlockOptionsEventName: "UNLOCK_OPTIONS_CHANGED";
|
|
9
|
+
export declare const InvokePaymentEventName: "INVOKE_PAYMENT";
|
|
10
|
+
export declare const PaymentResultEventName: "ON_PAYMENT_RESULT";
|
|
11
|
+
export declare const UseModalEventName: "ON_USE_MODAL_EVENT";
|
|
12
|
+
export declare const UseModalResultEventName: "ON_USE_MODAL_RESULT";
|
|
13
|
+
type IPaymentResult = 'SUCCESS' | 'FAILED' | 'CANCEL';
|
|
14
|
+
export interface IPaymentEvent {
|
|
15
|
+
userJoliCoin?: IJoliCoin;
|
|
16
|
+
paymentResult: IPaymentResult;
|
|
17
|
+
}
|
|
18
|
+
export interface IPaymentChoice {
|
|
19
|
+
productId: string;
|
|
20
|
+
totalAmountStr: string;
|
|
21
|
+
quantity: number;
|
|
22
|
+
}
|
|
23
|
+
export interface IInvokePaymentEvent {
|
|
24
|
+
userJoliCoin: IJoliCoin;
|
|
25
|
+
joliCoinQuantity: number;
|
|
26
|
+
enableAutoDeduct: boolean;
|
|
27
|
+
confirmButtonText: string;
|
|
28
|
+
cancelButtonText: string;
|
|
29
|
+
sequenceId?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface IUseModalEvent {
|
|
32
|
+
enableAutoDeduct: boolean;
|
|
33
|
+
userJoliCoin: IJoliCoin;
|
|
34
|
+
joliCoinQuantity: number;
|
|
35
|
+
confirmButtonText: string;
|
|
36
|
+
cancelButtonText: string;
|
|
37
|
+
sequenceId?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface IUseModalResultEvent {
|
|
40
|
+
useModalResult: 'CONFIRM' | 'CANCEL' | 'FAILED';
|
|
41
|
+
}
|
|
42
|
+
export interface RewardsEventMap extends Record<string, unknown[]> {
|
|
43
|
+
[UnlockOptionsEventName]: [IUnlockOptionsEvent];
|
|
44
|
+
[InvokePaymentEventName]: ['JOLI_COIN' | 'ADS-JOLI_COIN', IInvokePaymentEvent];
|
|
45
|
+
[PaymentResultEventName]: [IPaymentEvent];
|
|
46
|
+
[UseModalResultEventName]: [IUseModalResultEvent];
|
|
47
|
+
[UseModalEventName]: ['JOLI_COIN' | 'ADS-JOLI_COIN', IUseModalEvent];
|
|
48
|
+
}
|
|
49
|
+
export declare const originalRewardsEmitter: EventEmitter<RewardsEventMap, keyof RewardsEventMap>;
|
|
50
|
+
export type RewardsEventType = keyof RewardsEventMap;
|
|
51
|
+
export interface RewardsEmitter {
|
|
52
|
+
on<T extends RewardsEventType>(event: T, callback: (...args: RewardsEventMap[T]) => void): void;
|
|
53
|
+
off<T extends RewardsEventType>(event: T, callback: (...args: RewardsEventMap[T]) => void): void;
|
|
54
|
+
emit<T extends RewardsEventType>(event: T, ...args: RewardsEventMap[T]): void;
|
|
55
|
+
}
|
|
56
|
+
export declare const createRewardsEmitterWrapper: () => RewardsEmitter;
|
|
57
|
+
export declare const rewardsEmitter: RewardsEmitter;
|
|
58
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export type RewardType = 'ADS' | 'JOLI_COIN';
|
|
1
|
+
export type RewardType = 'ADS' | 'JOLI_COIN' | 'JOLI_COIN_ONLY';
|
|
2
2
|
import type { AdsRewardsHandler } from './registers/use-ads';
|
|
3
3
|
export interface RewardHandlerMap {
|
|
4
4
|
ADS: AdsRewardsHandler;
|
|
5
5
|
JOLI_COIN: (params?: unknown) => Promise<boolean>;
|
|
6
|
+
JOLI_COIN_ONLY: (params?: unknown) => Promise<boolean>;
|
|
6
7
|
}
|
|
7
8
|
export type RewardHandler<T extends RewardType> = RewardHandlerMap[T];
|
|
8
9
|
export declare function createRewardsHelper(): {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* event send to parent window
|
|
3
|
+
*/
|
|
1
4
|
declare const JOLIBOX_CUSTOM_ADS_EVENT_TYPE = "JOLIBOX_ADS_EVENT";
|
|
2
5
|
declare const JOLIBOX_CUSTOM_REWARDS_EVENT_TYPE = "JOLIBOX_CUSTOM_REWARDS_EVENT";
|
|
6
|
+
declare const JOLIBOX_TOPUP_EVENT = "JOLIBOX_TOPUP_EVENT";
|
|
7
|
+
declare const JOLIBOX_JOLI_COIN_USE_EVENT = "JOLIBOX_JOLI_COIN_USE_EVENT";
|
|
3
8
|
interface JoliboxCustomEvent {
|
|
4
9
|
[JOLIBOX_CUSTOM_ADS_EVENT_TYPE]: {
|
|
5
10
|
isAdShowing: boolean;
|
|
@@ -10,6 +15,48 @@ interface JoliboxCustomEvent {
|
|
|
10
15
|
balance: number;
|
|
11
16
|
};
|
|
12
17
|
};
|
|
18
|
+
[JOLIBOX_TOPUP_EVENT]: {
|
|
19
|
+
['JOLI_COIN']?: {
|
|
20
|
+
quantity: number;
|
|
21
|
+
balance: number;
|
|
22
|
+
enableAutoDeduct?: boolean;
|
|
23
|
+
};
|
|
24
|
+
type: 'ADS-JOLI_COIN' | 'JOLI_COIN';
|
|
25
|
+
sequenceId: string;
|
|
26
|
+
};
|
|
27
|
+
[JOLIBOX_JOLI_COIN_USE_EVENT]: {
|
|
28
|
+
['JOLI_COIN']?: {
|
|
29
|
+
quantity: number;
|
|
30
|
+
balance: number;
|
|
31
|
+
enableAutoDeduct?: boolean;
|
|
32
|
+
};
|
|
33
|
+
type: 'ADS-JOLI_COIN' | 'JOLI_COIN';
|
|
34
|
+
sequenceId: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
declare const notifyCustomEvent: <T extends keyof JoliboxCustomEvent>(eventName: T, data: JoliboxCustomEvent[T]) => void;
|
|
38
|
+
/**
|
|
39
|
+
* received event to parent window
|
|
40
|
+
* @param eventName
|
|
41
|
+
* @param data
|
|
42
|
+
*/
|
|
43
|
+
declare const ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT = "ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT";
|
|
44
|
+
declare const ON_JOLIBOX_JOLI_COIN_USE_RESULT = "ON_JOLIBOX_JOLI_COIN_USE_RESULT";
|
|
45
|
+
interface ReceivedJoliboxCustomEvent {
|
|
46
|
+
[ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT]: {
|
|
47
|
+
sequenceId: string;
|
|
48
|
+
result: 'SUCCESS' | 'CANCEL' | 'ADS';
|
|
49
|
+
type: 'ADS-JOLI_COIN' | 'JOLI_COIN';
|
|
50
|
+
joliCoin: {
|
|
51
|
+
enableAutoDeduct: boolean;
|
|
52
|
+
balance: number;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
[ON_JOLIBOX_JOLI_COIN_USE_RESULT]: {
|
|
56
|
+
sequenceId: string;
|
|
57
|
+
result: 'USE_COIN' | 'ADS' | 'CANCEL';
|
|
58
|
+
};
|
|
13
59
|
}
|
|
14
|
-
|
|
15
|
-
|
|
60
|
+
type ReceivedJoliboxCustomEventResult = keyof ReceivedJoliboxCustomEvent;
|
|
61
|
+
declare const onCustomEvent: <T extends ReceivedJoliboxCustomEventResult>(eventName: T, callback: (data: ReceivedJoliboxCustomEvent[T]) => void) => () => void;
|
|
62
|
+
export { onCustomEvent, notifyCustomEvent };
|
package/dist/h5/api/ads.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import '../rewards';
|
package/dist/h5/http/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare class HttpClientManager {
|
|
|
15
15
|
static getInstance(): HttpClientManager;
|
|
16
16
|
create(config?: IHttpClientInitParams): JoliboxHttpClient;
|
|
17
17
|
recordNetworkRequest(success: boolean): void;
|
|
18
|
-
getNetworkStatus()
|
|
18
|
+
getNetworkStatus: () => boolean;
|
|
19
19
|
}
|
|
20
20
|
declare class JoliboxHttpClient implements IHttpClient {
|
|
21
21
|
private baseUrl;
|